From 7167c5a7493001d6f429a8851516609b7e2b33d5 Mon Sep 17 00:00:00 2001 From: Jeff Teunissen Date: Mon, 20 Mar 2000 14:24:20 +0000 Subject: [PATCH] view.c: Whitespace changes. */menu.c: Sliders update the string versions of cvars again. Also, UQ now has config menu entries for the HUD. --- common/view.c | 42 ++++++++-------- qw_client/menu.c | 124 +++++++++++++++++++---------------------------- uquake/menu.c | 121 ++++++++++++++++++++++----------------------- 3 files changed, 127 insertions(+), 160 deletions(-) diff --git a/common/view.c b/common/view.c index 0a1d63e..39e43dd 100644 --- a/common/view.c +++ b/common/view.c @@ -442,25 +442,22 @@ V_SetContentsColor (int contents) return; } - switch (contents) - { - case CONTENTS_SOLID: -#ifdef QUAKEWORLD - cl.cshifts[CSHIFT_CONTENTS] = cshift_slime; -#else - cl.cshifts[CSHIFT_CONTENTS] = cshift_empty; + switch (contents) { + case CONTENTS_EMPTY: + cl.cshifts[CSHIFT_CONTENTS] = cshift_empty; + break; + case CONTENTS_LAVA: + cl.cshifts[CSHIFT_CONTENTS] = cshift_lava; + break; + case CONTENTS_SOLID: +#ifdef UQUAKE + cl.cshifts[CSHIFT_CONTENTS] = cshift_empty; #endif - case CONTENTS_EMPTY: - cl.cshifts[CSHIFT_CONTENTS] = cshift_empty; - break; - case CONTENTS_LAVA: - cl.cshifts[CSHIFT_CONTENTS] = cshift_lava; - break; - case CONTENTS_SLIME: - cl.cshifts[CSHIFT_CONTENTS] = cshift_slime; - break; - default: - cl.cshifts[CSHIFT_CONTENTS] = cshift_water; + case CONTENTS_SLIME: + cl.cshifts[CSHIFT_CONTENTS] = cshift_slime; + break; + default: + cl.cshifts[CSHIFT_CONTENTS] = cshift_water; } if (v_contentblend->value > 0 && v_contentblend->value < 1) @@ -617,8 +614,6 @@ V_BoundOffsets ( void ) ent = &cl_entities[cl.playernum + 1]; #endif -// absolutely bound refresh reletive to entity clipping hull -// so the view can never be inside a solid wall #ifdef QUAKEWORLD if (r_refdef.vieworg[0] < cl.simorg[0] - 14) @@ -967,13 +962,15 @@ DropPunchAngle (void) */ extern vrect_t scr_vrect; -void V_RenderView (void) +void +V_RenderView (void) { #ifdef QUAKEWORLD // if (cl.simangles[ROLL]) // Sys_Error ("cl.simangles[ROLL]"); // DEBUG cl.simangles[ROLL] = 0; // FIXME #endif + if (cls.state != ca_active) return; @@ -982,8 +979,7 @@ cl.simangles[ROLL] = 0; // FIXME view_message = &view_frame->playerstate[cl.playernum]; #else // don't allow cheats in multiplayer - if (cl.maxclients > 1) - { + if (cl.maxclients > 1) { Cvar_Set ("scr_ofsx", "0"); Cvar_Set ("scr_ofsy", "0"); Cvar_Set ("scr_ofsz", "0"); diff --git a/qw_client/menu.c b/qw_client/menu.c index 4cf9033..8af1637 100644 --- a/qw_client/menu.c +++ b/qw_client/menu.c @@ -401,93 +401,69 @@ void M_Menu_Options_f (void) } -void M_AdjustSliders (int dir) +void +M_AdjustSliders ( int dir ) { S_LocalSound ("misc/menu3.wav"); - switch (options_cursor) - { - case 3: // screen size - scr_viewsize->value += dir * 10; - if (scr_viewsize->value < 30) - scr_viewsize->value = 30; - if (scr_viewsize->value > 120) - scr_viewsize->value = 120; - - break; - case 4: // gamma - v_gamma->value -= dir * 0.05; - if (v_gamma->value < 0.5) - v_gamma->value = 0.5; - if (v_gamma->value > 1) - v_gamma->value = 1; - break; - case 5: // mouse speed - sensitivity->value += dir * 0.5; - if (sensitivity->value < 1) - sensitivity->value = 1; - if (sensitivity->value > 11) - sensitivity->value = 11; - - break; - case 6: // music volume + switch (options_cursor) { + case 3: // screen size + Cvar_Set("scr_viewsize", va("%d", + bound(30, scr_viewsize->value + (dir * 10), 120))); + break; + case 4: // gamma + Cvar_Set("v_gamma", va("%f", + bound(0.5, v_gamma->value - (dir * 0.05), 1))); + break; + case 5: // mouse speed + Cvar_Set("sensitivity", va("%f", + bound(1, sensitivity->value + (dir * 0.05), 11))); + break; + case 6: // music volume + Cvar_Set("bgmvolume", va("%f", #ifdef _WIN32 - bgmvolume->value += dir * 1.0; + bound(0, bgmvolume->value + dir, 1))); #else - bgmvolume->value += dir * 0.1; + bound(0, bgmvolume->value + (dir * 0.1), 1))); #endif - if (bgmvolume->value < 0) - bgmvolume->value = 0; - if (bgmvolume->value > 1) - bgmvolume->value = 1; + break; + case 7: // sfx volume + Cvar_Set("volume", va("%f", bound(0, volume->value + (dir * 0.1), 1))); + break; - break; - case 7: // sfx volume - volume->value += dir * 0.1; - if (volume->value < 0) - volume->value = 0; - if (volume->value > 1) - volume->value = 1; + case 8: // allways run + if (cl_forwardspeed->value > 200) { + Cvar_Set("cl_forwardspeed", va("%d", 200)); + Cvar_Set("cl_backspeed", va("%d", 200)); + } else { + Cvar_Set("cl_forwardspeed", va("%d", 400)); + Cvar_Set("cl_backspeed", va("%d", 400)); + } + break; - break; + case 9: // invert mouse + Cvar_Set("m_pitch", va("%d", -m_pitch->value)); + break; - case 8: // allways run - if (cl_forwardspeed->value > 200) - { - cl_forwardspeed->value = 200; - cl_backspeed->value = 200; - } - else - { - cl_forwardspeed->value = 400; - cl_backspeed->value = 400; - } - break; + case 10: // lookspring + Cvar_Set("lookspring", va("%d", !lookspring->value)); + break; - case 9: // invert mouse - m_pitch->value = -m_pitch->value; - break; + case 11: // lookstrafe + Cvar_Set("lookstrafe", va("%d", !lookstrafe->value)); + break; - case 10: // lookspring - lookspring->value = !lookspring->value; - break; + case 12: // Use old-style sbar + Cvar_Set("cl_sbar", va("%d", !cl_sbar->value)); + break; - case 11: // lookstrafe - lookstrafe->value = !lookstrafe->value; - break; - - case 12: - cl_sbar->value = !cl_sbar->value; - break; - - case 13: - cl_hudswap->value = !cl_hudswap->value; - - /* - default: - VID_ExtraOptionCmd(options_cursor + 2 - L_OPTIONS_ITEMS); - */ + case 13: // HUD on left side + Cvar_Set("cl_hudswap", va("%d", !cl_hudswap->value)); + break; + default: + //VID_ExtraOptionCmd(options_cursor + 2 - L_OPTIONS_ITEMS); + ; } } diff --git a/uquake/menu.c b/uquake/menu.c index afaa3a7..6c92f8f 100644 --- a/uquake/menu.c +++ b/uquake/menu.c @@ -1111,80 +1111,69 @@ void M_Menu_Options_f (void) } -void M_AdjustSliders (int dir) +void +M_AdjustSliders ( int dir ) { S_LocalSound ("misc/menu3.wav"); - switch (options_cursor) - { - case 3: // screen size - scr_viewsize->value += dir * 10; - if (scr_viewsize->value < 30) - scr_viewsize->value = 30; - if (scr_viewsize->value > 120) - scr_viewsize->value = 120; - break; - case 4: // gamma - v_gamma->value -= dir * 0.05; - if (v_gamma->value < 0.5) - v_gamma->value = 0.5; - if (v_gamma->value > 1) - v_gamma->value = 1; - break; - case 5: // mouse speed - sensitivity->value += dir * 0.5; - if (sensitivity->value < 1) - sensitivity->value = 1; - if (sensitivity->value > 11) - sensitivity->value = 11; - break; - case 6: // music volume + switch (options_cursor) { + case 3: // screen size + Cvar_Set("scr_viewsize", va("%d", + bound(30, scr_viewsize->value + (dir * 10), 120))); + break; + case 4: // gamma + Cvar_Set("v_gamma", va("%f", + bound(0.5, v_gamma->value - (dir * 0.05), 1))); + break; + case 5: // mouse speed + Cvar_Set("sensitivity", va("%f", + bound(1, sensitivity->value + (dir * 0.05), 11))); + break; + case 6: // music volume + Cvar_Set("bgmvolume", va("%f", #ifdef _WIN32 - bgmvolume->value += dir * 1.0; + bound(0, bgmvolume->value + dir, 1))); #else - bgmvolume->value += dir * 0.1; + bound(0, bgmvolume->value + (dir * 0.1), 1))); #endif - if (bgmvolume->value < 0) - bgmvolume->value = 0; - if (bgmvolume->value > 1) - bgmvolume->value = 1; - break; - case 7: // sfx volume - volume->value += dir * 0.1; - if (volume->value < 0) - volume->value = 0; - if (volume->value > 1) - volume->value = 1; - break; + break; + case 7: // sfx volume + Cvar_Set("volume", va("%f", bound(0, volume->value + (dir * 0.1), 1))); + break; - case 8: // allways run - if (cl_forwardspeed->value > 200) - { - cl_forwardspeed->value = 200; - cl_backspeed->value = 200; - } - else - { - cl_forwardspeed->value = 400; - cl_backspeed->value = 400; - } - break; + case 8: // allways run + if (cl_forwardspeed->value > 200) { + Cvar_Set("cl_forwardspeed", va("%d", 200)); + Cvar_Set("cl_backspeed", va("%d", 200)); + } else { + Cvar_Set("cl_forwardspeed", va("%d", 400)); + Cvar_Set("cl_backspeed", va("%d", 400)); + } + break; - case 9: // invert mouse - m_pitch->value = -m_pitch->value; - break; + case 9: // invert mouse + Cvar_Set("m_pitch", va("%d", -m_pitch->value)); + break; - case 10: // lookspring - lookspring->value = !lookspring->value; - break; + case 10: // lookspring + Cvar_Set("lookspring", va("%d", !lookspring->value)); + break; - case 11: // lookstrafe - lookstrafe->value = !lookstrafe->value; - break; + case 11: // lookstrafe + Cvar_Set("lookstrafe", va("%d", !lookstrafe->value)); + break; - default: - //VID_ExtraOptionCmd(options_cursor + 2 - L_OPTIONS_ITEMS); - ; + case 12: // Use old-style sbar + Cvar_Set("cl_sbar", va("%d", !cl_sbar->value)); + break; + + case 13: // HUD on left side + Cvar_Set("cl_hudswap", va("%d", !cl_hudswap->value)); + break; + + default: + //VID_ExtraOptionCmd(options_cursor + 2 - L_OPTIONS_ITEMS); + ; } } @@ -1259,6 +1248,12 @@ void M_Options_Draw (void) M_Print (16, options_draw_cursor+=8, " Lookstrafe"); M_DrawCheckbox (220, options_draw_cursor, lookstrafe->value); + M_Print (16, options_draw_cursor+=8, " Use old status bar"); + M_DrawCheckbox (220, options_draw_cursor, cl_sbar->value); + + M_Print (16, options_draw_cursor+=8, " HUD on left side"); + M_DrawCheckbox (220, options_draw_cursor, cl_hudswap->value); + //VID_ExtraOptionDraw(options_draw_cursor); options_draw_cursor+=VID_options_items*8;