From 5cf8eacc9621cf85f9d0474e59289b13d083260f Mon Sep 17 00:00:00 2001 From: havoc Date: Wed, 2 Jul 2003 05:48:36 +0000 Subject: [PATCH] added support for GAME_GOODVSBAD2 moved Hostname option from Player Setup to server setup menu, and renamed it "Server name" added snd_staticvolume cvar to control volume of static sounds git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3136 d7cf8633-e32d-0410-b094-e92efae38249 --- cd_linux.c | 28 ++-- cd_win.c | 14 +- chase.c | 28 +++- cl_particles.c | 58 +++++-- cmd.c | 2 +- gl_backend.c | 6 +- gl_rmain.c | 2 +- host.c | 2 +- host_cmd.c | 2 +- jpeg.c | 6 +- menu.c | 440 ++++++++++++++++++++++++++++++++----------------- sbar.c | 51 +++--- snd_dma.c | 98 ++++++----- snd_mem.c | 2 +- vid_glx.c | 4 +- vid_shared.c | 26 +-- vid_wgl.c | 2 +- 17 files changed, 492 insertions(+), 279 deletions(-) diff --git a/cd_linux.c b/cd_linux.c index 7623b0a3..1385cb5d 100644 --- a/cd_linux.c +++ b/cd_linux.c @@ -8,7 +8,7 @@ of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -56,7 +56,7 @@ static void CDAudio_Eject(void) if (cdfile == -1 || !enabled) return; // no cd init'd - if ( ioctl(cdfile, CDROMEJECT) == -1 ) + if ( ioctl(cdfile, CDROMEJECT) == -1 ) Con_DPrintf("ioctl cdromeject failed\n"); } @@ -66,7 +66,7 @@ static void CDAudio_CloseDoor(void) if (cdfile == -1 || !enabled) return; // no cd init'd - if ( ioctl(cdfile, CDROMCLOSETRAY) == -1 ) + if ( ioctl(cdfile, CDROMCLOSETRAY) == -1 ) Con_DPrintf("ioctl cdromclosetray failed\n"); } @@ -76,7 +76,7 @@ static int CDAudio_GetAudioDiskInfo(void) cdValid = false; - if ( ioctl(cdfile, CDROMREADTOCHDR, &tochdr) == -1 ) + if ( ioctl(cdfile, CDROMREADTOCHDR, &tochdr) == -1 ) { Con_DPrintf("ioctl cdromreadtochdr failed\n"); return -1; @@ -102,7 +102,7 @@ void CDAudio_Play(qbyte track, qboolean looping) if (cdfile == -1 || !enabled) return; - + if (!cdValid) { CDAudio_GetAudioDiskInfo(); @@ -144,13 +144,13 @@ void CDAudio_Play(qbyte track, qboolean looping) ti.cdti_ind0 = 1; ti.cdti_ind1 = 99; - if ( ioctl(cdfile, CDROMPLAYTRKIND, &ti) == -1 ) + if ( ioctl(cdfile, CDROMPLAYTRKIND, &ti) == -1 ) { Con_DPrintf("ioctl cdromplaytrkind failed\n"); return; } - if ( ioctl(cdfile, CDROMRESUME) == -1 ) + if ( ioctl(cdfile, CDROMRESUME) == -1 ) Con_DPrintf("ioctl cdromresume failed\n"); playLooping = looping; @@ -166,7 +166,7 @@ void CDAudio_Stop(void) { if (cdfile == -1 || !enabled) return; - + if (!playing) return; @@ -185,7 +185,7 @@ void CDAudio_Pause(void) if (!playing) return; - if ( ioctl(cdfile, CDROMPAUSE) == -1 ) + if ( ioctl(cdfile, CDROMPAUSE) == -1 ) Con_DPrintf("ioctl cdrompause failed\n"); wasPlaying = playing; @@ -197,13 +197,13 @@ void CDAudio_Resume(void) { if (cdfile == -1 || !enabled) return; - + if (!cdValid) return; if (!wasPlaying) return; - + if ( ioctl(cdfile, CDROMRESUME) == -1 ) Con_DPrintf("ioctl cdromresume failed\n"); playing = true; @@ -384,7 +384,7 @@ int CDAudio_Init(void) } if ((cdfile = open(cd_dev, O_RDONLY)) == -1) { - Con_Printf("CDAudio_Init: open of \"%s\" failed (%i)\n", cd_dev, errno); + Con_DPrintf("CDAudio_Init: open of \"%s\" failed (%i)\n", cd_dev, errno); cdfile = -1; return -1; } @@ -397,13 +397,13 @@ int CDAudio_Init(void) if (CDAudio_GetAudioDiskInfo()) { - Con_Printf("CDAudio_Init: No CD in player.\n"); + Con_DPrintf("CDAudio_Init: No CD in player.\n"); cdValid = false; } Cmd_AddCommand ("cd", CD_f); - Con_Printf("CD Audio Initialized\n"); + Con_DPrintf("CD Audio Initialized\n"); return 0; } diff --git a/cd_win.c b/cd_win.c index 8fba829a..4ea77dd9 100644 --- a/cd_win.c +++ b/cd_win.c @@ -8,7 +8,7 @@ of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -107,7 +107,7 @@ void CDAudio_Play(qbyte track, qboolean looping) if (!enabled) return; - + if (!cdValid) { CDAudio_GetAudioDiskInfo(); @@ -180,7 +180,7 @@ void CDAudio_Stop(void) if (!enabled) return; - + if (!playing) return; @@ -219,13 +219,13 @@ void CDAudio_Resume(void) if (!enabled) return; - + if (!cdValid) return; if (!wasPlaying) return; - + mciPlayParms.dwFrom = MCI_MAKE_TMSF(playTrack, 0, 0, 0); mciPlayParms.dwTo = MCI_MAKE_TMSF(playTrack + 1, 0, 0, 0); mciPlayParms.dwCallback = (DWORD)mainwindow; @@ -454,13 +454,13 @@ int CDAudio_Init(void) if (CDAudio_GetAudioDiskInfo()) { - Con_Printf("CDAudio_Init: No CD in player.\n"); + Con_DPrintf("CDAudio_Init: No CD in player.\n"); cdValid = false; } Cmd_AddCommand ("cd", CD_f); - Con_Printf("CD Audio Initialized\n"); + Con_DPrintf("CD Audio Initialized\n"); return 0; } diff --git a/chase.c b/chase.c index be915bcf..1d0fe2a6 100644 --- a/chase.c +++ b/chase.c @@ -25,12 +25,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. cvar_t chase_back = {CVAR_SAVE, "chase_back", "48"}; cvar_t chase_up = {CVAR_SAVE, "chase_up", "24"}; cvar_t chase_active = {CVAR_SAVE, "chase_active", "0"}; +// GAME_GOODVSBAD2 +cvar_t chase_stevie = {0, "chase_stevie", "0"}; void Chase_Init (void) { Cvar_RegisterVariable (&chase_back); Cvar_RegisterVariable (&chase_up); Cvar_RegisterVariable (&chase_active); + if (gamemode == GAME_GOODVSBAD2) + Cvar_RegisterVariable (&chase_stevie); } void Chase_Reset (void) @@ -41,13 +45,23 @@ void Chase_Reset (void) void Chase_Update (void) { - vec3_t forward, stop, chase_dest, normal; - float dist; - - chase_back.value = bound(0, chase_back.value, 128); - chase_up.value = bound(-48, chase_up.value, 96); - - AngleVectors (cl.viewangles, forward, NULL, NULL); + vec_t camback, camup, dist, forward[3], stop[3], chase_dest[3], normal[3], projectangles[3]; + + camback = bound(0, chase_back.value, 128); + if (chase_back.value != camback) + Cvar_SetValueQuick(&chase_back, camback); + camup = bound(-48, chase_up.value, 96); + if (chase_up.value != camup) + Cvar_SetValueQuick(&chase_up, camup); + + VectorCopy(cl.viewangles, projectangles); + if (gamemode == GAME_GOODVSBAD2 && chase_stevie.integer) + { + projectangles[0] = 90; + r_refdef.viewangles[0] = 90; + camback = 1024; + } + AngleVectors (projectangles, forward, NULL, NULL); dist = -chase_back.value - 8; chase_dest[0] = r_refdef.vieworg[0] + forward[0] * dist; diff --git a/cl_particles.c b/cl_particles.c index d01333a8..23d9c814 100644 --- a/cl_particles.c +++ b/cl_particles.c @@ -658,7 +658,7 @@ void CL_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count) while (count--) { k = particlepalette[color + (rand()&7)]; - particle(pt_static, PARTICLE_BILLBOARD, k, k, tex_particle, false, PBLEND_ALPHA, 1, 1, 255, 512, 9999, 0, 0, org[0] + lhrandom(-8, 8), org[1] + lhrandom(-8, 8), org[2] + lhrandom(-8, 8), lhrandom(-15, 15), lhrandom(-15, 15), lhrandom(-15, 15), 0, 0, 0, 0, 0, 0); + particle(pt_static, PARTICLE_BILLBOARD, k, k, tex_particle, false, PBLEND_ALPHA, 5, 5, 255, 300, 9999, 0, 0, org[0] + lhrandom(-8, 8), org[1] + lhrandom(-8, 8), org[2] + lhrandom(-8, 8), lhrandom(-10, 10), lhrandom(-10, 10), lhrandom(-10, 10), 0, 0, 0, 0, 0, 0); } } @@ -826,14 +826,28 @@ void CL_ParticleRain (vec3_t mins, vec3_t maxs, vec3_t dir, int count, int color while(count--) { k = particlepalette[colorbase + (rand()&3)]; - particle(pt_rain, PARTICLE_SPARK, k, k, tex_particle, true, PBLEND_ADD, 0.5, 0.02, lhrandom(8, 16), 0, t, 0, 0, lhrandom(mins[0], maxs[0]), lhrandom(mins[1], maxs[1]), lhrandom(minz, maxz), dir[0], dir[1], dir[2], cl.time + 9999, dir[0], dir[1], dir[2], 0, 0); + if (gamemode == GAME_GOODVSBAD2) + { + particle(pt_rain, PARTICLE_SPARK, k, k, tex_particle, true, PBLEND_ADD, 20, 20, lhrandom(8, 16), 0, t, 0, 0, lhrandom(mins[0], maxs[0]), lhrandom(mins[1], maxs[1]), lhrandom(minz, maxz), dir[0], dir[1], dir[2], cl.time + 9999, dir[0], dir[1], dir[2], 0, 0); + } + else + { + particle(pt_rain, PARTICLE_SPARK, k, k, tex_particle, true, PBLEND_ADD, 0.5, 0.02, lhrandom(8, 16), 0, t, 0, 0, lhrandom(mins[0], maxs[0]), lhrandom(mins[1], maxs[1]), lhrandom(minz, maxz), dir[0], dir[1], dir[2], cl.time + 9999, dir[0], dir[1], dir[2], 0, 0); + } } break; case 1: while(count--) { k = particlepalette[colorbase + (rand()&3)]; - particle(pt_rain, PARTICLE_BILLBOARD, k, k, tex_particle, false, PBLEND_ADD, 1, 1, lhrandom(64, 128), 0, t, 0, 0, lhrandom(mins[0], maxs[0]), lhrandom(mins[1], maxs[1]), lhrandom(minz, maxz), dir[0], dir[1], dir[2], 0, dir[0], dir[1], dir[2], 0, 0); + if (gamemode == GAME_GOODVSBAD2) + { + particle(pt_rain, PARTICLE_BILLBOARD, k, k, tex_particle, false, PBLEND_ADD, 20, 20, lhrandom(64, 128), 0, t, 0, 0, lhrandom(mins[0], maxs[0]), lhrandom(mins[1], maxs[1]), lhrandom(minz, maxz), dir[0], dir[1], dir[2], 0, dir[0], dir[1], dir[2], 0, 0); + } + else + { + particle(pt_rain, PARTICLE_BILLBOARD, k, k, tex_particle, false, PBLEND_ADD, 1, 1, lhrandom(64, 128), 0, t, 0, 0, lhrandom(mins[0], maxs[0]), lhrandom(mins[1], maxs[1]), lhrandom(minz, maxz), dir[0], dir[1], dir[2], 0, dir[0], dir[1], dir[2], 0, 0); + } } break; default: @@ -910,14 +924,15 @@ CL_LavaSplash */ void CL_LavaSplash (vec3_t origin) { - int i, j, k; + int i, j, k, l, inc; float vel; vec3_t dir, org; if (!cl_particles.integer) return; - for (i=-128 ; i<128 ; i+=16) + inc = 32; + for (i = -128;i < 128;i += inc) { - for (j=-128 ; j<128 ; j+=16) + for (j = -128;j < 128;j += inc) { dir[0] = j + lhrandom(0, 8); dir[1] = i + lhrandom(0, 8); @@ -926,8 +941,17 @@ void CL_LavaSplash (vec3_t origin) org[1] = origin[1] + dir[1]; org[2] = origin[2] + lhrandom(0, 64); vel = lhrandom(50, 120) / VectorLength(dir); // normalize and scale - k = particlepalette[224 + (rand()&7)]; - particle(pt_static, PARTICLE_BILLBOARD, k, k, tex_particle, false, PBLEND_ADD, 7, 7, 255, 192, 9999, 0.05, 0, org[0], org[1], org[2], dir[0] * vel, dir[1] * vel, dir[2] * vel, 0, 0, 0, 0, 0, 0); + if (gamemode == GAME_GOODVSBAD2) + { + k = particlepalette[0 + (rand()&255)]; + l = particlepalette[0 + (rand()&255)]; + particle(pt_static, PARTICLE_BILLBOARD, k, l, tex_particle, false, PBLEND_ADD, 12, 12, 255, 240, 9999, 0.05, 1, org[0], org[1], org[2], dir[0] * vel, dir[1] * vel, dir[2] * vel, 0, 0, 0, 0, 0, 0); + } + else + { + k = l = particlepalette[224 + (rand()&7)]; + particle(pt_static, PARTICLE_BILLBOARD, k, l, tex_particle, false, PBLEND_ADD, 12, 12, 255, 240, 9999, 0.05, 0, org[0], org[1], org[2], dir[0] * vel, dir[1] * vel, dir[2] * vel, 0, 0, 0, 0, 0, 0); + } } } } @@ -1042,7 +1066,14 @@ void CL_RocketTrail (vec3_t start, vec3_t end, int type, entity_t *ent) dec = 6; if (smoke) { - particle(pt_static, PARTICLE_BILLBOARD, 0x002000, 0x003000, tex_particle, false, PBLEND_ADD, dec, dec, 128, 384, 9999, 0, 0, pos[0], pos[1], pos[2], lhrandom(-8, 8), lhrandom(-8, 8), lhrandom(-8, 8), 0, 0, 0, 0, 0, 0); + if (gamemode == GAME_GOODVSBAD2) + { + particle(pt_static, PARTICLE_BILLBOARD, 0x00002E, 0x000030, tex_particle, false, PBLEND_ADD, dec, dec, 128, 384, 9999, 0, 0, pos[0], pos[1], pos[2], lhrandom(-8, 8), lhrandom(-8, 8), lhrandom(-8, 8), 0, 0, 0, 0, 0, 0); + } + else + { + particle(pt_static, PARTICLE_BILLBOARD, 0x002000, 0x003000, tex_particle, false, PBLEND_ADD, dec, dec, 128, 384, 9999, 0, 0, pos[0], pos[1], pos[2], lhrandom(-8, 8), lhrandom(-8, 8), lhrandom(-8, 8), 0, 0, 0, 0, 0, 0); + } } break; @@ -1058,7 +1089,14 @@ void CL_RocketTrail (vec3_t start, vec3_t end, int type, entity_t *ent) dec = 6; if (smoke) { - particle(pt_static, PARTICLE_BILLBOARD, 0x502030, 0x502030, tex_particle, false, PBLEND_ADD, dec, dec, 128, 384, 9999, 0, 0, pos[0], pos[1], pos[2], lhrandom(-8, 8), lhrandom(-8, 8), lhrandom(-8, 8), 0, 0, 0, 0, 0, 0); + if (gamemode == GAME_GOODVSBAD2) + { + particle(pt_static, PARTICLE_BILLBOARD, particlepalette[0 + (rand()&255)], particlepalette[0 + (rand()&255)], tex_particle, false, PBLEND_ALPHA, dec, dec, 255, 384, 9999, 0, 0, pos[0], pos[1], pos[2], lhrandom(-8, 8), lhrandom(-8, 8), lhrandom(-8, 8), 0, 0, 0, 0, 0, 0); + } + else + { + particle(pt_static, PARTICLE_BILLBOARD, 0x502030, 0x502030, tex_particle, false, PBLEND_ADD, dec, dec, 128, 384, 9999, 0, 0, pos[0], pos[1], pos[2], lhrandom(-8, 8), lhrandom(-8, 8), lhrandom(-8, 8), 0, 0, 0, 0, 0, 0); + } } break; diff --git a/cmd.c b/cmd.c index 0fa4a3a2..169f9efa 100644 --- a/cmd.c +++ b/cmd.c @@ -300,7 +300,7 @@ static void Cmd_Exec_f (void) Con_Printf ("couldn't exec %s\n",Cmd_Argv(1)); return; } - Con_Printf ("execing %s\n",Cmd_Argv(1)); + Con_DPrintf ("execing %s\n",Cmd_Argv(1)); Cbuf_InsertText (f); Mem_Free(f); diff --git a/gl_backend.c b/gl_backend.c index 3a15f7a5..833bdb1b 100644 --- a/gl_backend.c +++ b/gl_backend.c @@ -121,7 +121,7 @@ void GL_Backend_FreeArrays(void) static void gl_backend_start(void) { - Con_Printf("OpenGL Backend started\n"); + Con_DPrintf("OpenGL Backend started\n"); if (qglDrawRangeElements != NULL) { CHECKGLERROR @@ -129,7 +129,7 @@ static void gl_backend_start(void) CHECKGLERROR qglGetIntegerv(GL_MAX_ELEMENTS_INDICES, &gl_maxdrawrangeelementsindices); CHECKGLERROR - Con_Printf("glDrawRangeElements detected (max vertices %i, max indices %i)\n", gl_maxdrawrangeelementsvertices, gl_maxdrawrangeelementsindices); + Con_DPrintf("glDrawRangeElements detected (max vertices %i, max indices %i)\n", gl_maxdrawrangeelementsvertices, gl_maxdrawrangeelementsindices); } backendunits = min(MAX_TEXTUREUNITS, gl_textureunits); @@ -144,7 +144,7 @@ static void gl_backend_shutdown(void) backendunits = 0; backendactive = false; - Con_Printf("OpenGL Backend shutting down\n"); + Con_DPrintf("OpenGL Backend shutting down\n"); GL_Backend_FreeArrays(); } diff --git a/gl_rmain.c b/gl_rmain.c index efe64d9a..7c1d60a7 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -319,7 +319,7 @@ void GL_Init (void) VID_CheckExtensions(); // LordHavoc: report supported extensions - Con_Printf ("\nengine extensions: %s\n", ENGINE_EXTENSIONS); + Con_DPrintf("\nengine extensions: %s\n", ENGINE_EXTENSIONS); } int R_CullBox(const vec3_t mins, const vec3_t maxs) diff --git a/host.c b/host.c index 1c8a00a2..9a679db3 100644 --- a/host.c +++ b/host.c @@ -911,7 +911,7 @@ void Host_Init (void) host_initialized = true; - Con_Printf ("========Quake Initialized=========\n"); + Con_DPrintf ("========Initialized=========\n"); if (cls.state != ca_dedicated) VID_Open(); diff --git a/host_cmd.c b/host_cmd.c index 9e202d1e..1f595571 100644 --- a/host_cmd.c +++ b/host_cmd.c @@ -1568,7 +1568,7 @@ void Host_Startdemos_f (void) Con_Printf ("Max %i demos in demoloop\n", MAX_DEMOS); c = MAX_DEMOS; } - Con_Printf ("%i demo(s) in loop\n", c); + Con_DPrintf ("%i demo(s) in loop\n", c); for (i=1 ; iname != NULL; func++) if (!(*func->funcvariable = (void *) Sys_GetProcAddress (jpeg_dll, func->name))) { - Con_Printf ("missing function \"%s\" - broken JPEG library!\n", func->name); + Con_Printf("missing function \"%s\" - broken JPEG library!\n", func->name); JPEG_CloseLibrary (); return false; } - Con_Printf ("%s loaded. JPEG support enabled\n", dllname); + Con_DPrintf("%s loaded. JPEG support enabled\n", dllname); return true; } diff --git a/menu.c b/menu.c index ab3df3ce..3656e90f 100644 --- a/menu.c +++ b/menu.c @@ -570,13 +570,15 @@ void M_SinglePlayer_Draw (void) p = Draw_CachePic ("gfx/ttl_sgl.lmp"); // Transfusion doesn't have a single player mode - if (gamemode == GAME_TRANSFUSION || gamemode == GAME_NEXUIZ) + if (gamemode == GAME_TRANSFUSION || gamemode == GAME_NEXUIZ || gamemode == GAME_GOODVSBAD2) { M_DrawPic ((320 - p->width) / 2, 4, "gfx/ttl_sgl.lmp"); M_DrawTextBox (60, 8 * 8, 23, 4); if (gamemode == GAME_NEXUIZ) M_PrintWhite (95, 10 * 8, "Nexuiz is for"); + else if (gamemode == GAME_GOODVSBAD2) + M_PrintWhite (95, 10 * 8, "Good Vs Bad 2 is for"); else M_PrintWhite (95, 10 * 8, "Transfusion is for"); M_PrintWhite (83, 11 * 8, "multiplayer play only"); @@ -597,7 +599,7 @@ void M_SinglePlayer_Draw (void) void M_SinglePlayer_Key (int key) { - if (gamemode == GAME_TRANSFUSION || gamemode == GAME_NEXUIZ) + if (gamemode == GAME_TRANSFUSION || gamemode == GAME_NEXUIZ || gamemode == GAME_GOODVSBAD2) { if (key == K_ESCAPE || key == K_ENTER) m_state = m_main; @@ -892,17 +894,16 @@ void M_MultiPlayer_Key (int key) //============================================================================= /* SETUP MENU */ -int setup_cursor = 4; -int setup_cursor_table[] = {40, 56, 80, 104, 140}; +int setup_cursor = 3; +int setup_cursor_table[] = {40, 64, 88, 124}; -char setup_hostname[16]; -char setup_myname[16]; +char setup_myname[32]; int setup_oldtop; int setup_oldbottom; int setup_top; int setup_bottom; -#define NUM_SETUP_CMDS 5 +#define NUM_SETUP_CMDS 4 void M_Menu_Setup_f (void) { @@ -910,7 +911,6 @@ void M_Menu_Setup_f (void) m_state = m_setup; m_entersound = true; strcpy(setup_myname, cl_name.string); - strcpy(setup_hostname, hostname.string); setup_top = setup_oldtop = cl_color.integer >> 4; setup_bottom = setup_oldbottom = cl_color.integer & 15; } @@ -930,21 +930,18 @@ void M_Setup_Draw (void) p = Draw_CachePic ("gfx/p_multi.lmp"); M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp"); - M_Print (64, 40, "Hostname"); + M_Print (64, 40, "Your name"); M_DrawTextBox (160, 32, 16, 1); - M_Print (168, 40, setup_hostname); + M_Print (168, 40, setup_myname); - M_Print (64, 56, "Your name"); - M_DrawTextBox (160, 48, 16, 1); - M_Print (168, 56, setup_myname); - - M_Print (64, 80, "Shirt color"); - M_Print (64, 104, "Pants color"); - - M_DrawTextBox (64, 140-8, 14, 1); - M_Print (72, 140, "Accept Changes"); + if (gamemode != GAME_GOODVSBAD2) + { + M_Print (64, 64, "Shirt color"); + M_Print (64, 88, "Pants color"); + } - M_DrawPic (160, 64, "gfx/bigbox.lmp"); + M_DrawTextBox (64, 124-8, 14, 1); + M_Print (72, 124, "Accept Changes"); // LordHavoc: rewrote this code greatly if (menuplyr_load) @@ -977,16 +974,14 @@ void M_Setup_Draw (void) menuplyr_translated[i] = palette_complete[translationTable[menuplyr_pixels[i]]]; Draw_NewPic("gfx/menuplyr.lmp", menuplyr_width, menuplyr_height, true, (qbyte *)menuplyr_translated); } - M_DrawPic(172, 72, "gfx/menuplyr.lmp"); + M_DrawPic(160, 48, "gfx/bigbox.lmp"); + M_DrawPic(172, 56, "gfx/menuplyr.lmp"); } - M_DrawCharacter (56, setup_cursor_table [setup_cursor], 12+((int)(realtime*4)&1)); - if (setup_cursor == 0) - M_DrawCharacter (168 + 8*strlen(setup_hostname), setup_cursor_table [setup_cursor], 10+((int)(realtime*4)&1)); - - if (setup_cursor == 1) M_DrawCharacter (168 + 8*strlen(setup_myname), setup_cursor_table [setup_cursor], 10+((int)(realtime*4)&1)); + else + M_DrawCharacter (56, setup_cursor_table [setup_cursor], 12+((int)(realtime*4)&1)); } @@ -1015,37 +1010,35 @@ void M_Setup_Key (int k) break; case K_LEFTARROW: - if (setup_cursor < 2) + if (setup_cursor < 1) return; S_LocalSound ("misc/menu3.wav"); - if (setup_cursor == 2) + if (setup_cursor == 1) setup_top = setup_top - 1; - if (setup_cursor == 3) + if (setup_cursor == 2) setup_bottom = setup_bottom - 1; break; case K_RIGHTARROW: - if (setup_cursor < 2) + if (setup_cursor < 1) return; forward: S_LocalSound ("misc/menu3.wav"); - if (setup_cursor == 2) + if (setup_cursor == 1) setup_top = setup_top + 1; - if (setup_cursor == 3) + if (setup_cursor == 2) setup_bottom = setup_bottom + 1; break; case K_ENTER: - if (setup_cursor == 0 || setup_cursor == 1) + if (setup_cursor == 0) return; - if (setup_cursor == 2 || setup_cursor == 3) + if (setup_cursor == 1 || setup_cursor == 2) goto forward; - // setup_cursor == 4 (OK) + // setup_cursor == 3 (Accept changes) if (strcmp(cl_name.string, setup_myname) != 0) Cbuf_AddText ( va ("name \"%s\"\n", setup_myname) ); - if (strcmp(hostname.string, setup_hostname) != 0) - Cvar_Set("hostname", setup_hostname); if (setup_top != setup_oldtop || setup_bottom != setup_oldbottom) Cbuf_AddText( va ("color %i %i\n", setup_top, setup_bottom) ); m_entersound = true; @@ -1054,12 +1047,6 @@ forward: case K_BACKSPACE: if (setup_cursor == 0) - { - if (strlen(setup_hostname)) - setup_hostname[strlen(setup_hostname)-1] = 0; - } - - if (setup_cursor == 1) { if (strlen(setup_myname)) setup_myname[strlen(setup_myname)-1] = 0; @@ -1070,15 +1057,6 @@ forward: if (k < 32 || k > 127) break; if (setup_cursor == 0) - { - l = strlen(setup_hostname); - if (l < 15) - { - setup_hostname[l+1] = 0; - setup_hostname[l] = k; - } - } - if (setup_cursor == 1) { l = strlen(setup_myname); if (l < 15) @@ -1128,7 +1106,7 @@ void M_DrawCheckbox (int x, int y, int on) } -#define OPTIONS_ITEMS 28 +#define OPTIONS_ITEMS 29 int options_cursor; @@ -1139,6 +1117,7 @@ void M_Menu_Options_f (void) m_entersound = true; } +extern cvar_t snd_staticvolume; extern cvar_t gl_delayfinish; extern cvar_t slowmo; extern dllhandle_t jpeg_dll; @@ -1187,19 +1166,22 @@ void M_Menu_Options_AdjustSliders (int dir) case 16: // sfx volume Cvar_SetValueQuick (&volume, bound(0, volume.value + dir * 0.1, 1)); break; - case 17: - Cvar_SetValueQuick (&crosshair, bound(0, crosshair.integer + dir, 5)); + case 17: // static volume + Cvar_SetValueQuick (&snd_staticvolume, bound(0, snd_staticvolume.value + dir * 0.1, 1)); break; case 18: + Cvar_SetValueQuick (&crosshair, bound(0, crosshair.integer + dir, 5)); + break; + case 19: Cvar_SetValueQuick (&crosshair_size, bound(1, crosshair_size.value + dir, 5)); break; - case 19: // static crosshair + case 20: // static crosshair Cvar_SetValueQuick (&crosshair_static, !crosshair_static.integer); break; - case 20: // show framerate + case 21: // show framerate Cvar_SetValueQuick (&showfps, !showfps.integer); break; - case 21: // always run + case 22: // always run if (cl_forwardspeed.value > 200) { Cvar_SetValueQuick (&cl_forwardspeed, 200); @@ -1211,22 +1193,22 @@ void M_Menu_Options_AdjustSliders (int dir) Cvar_SetValueQuick (&cl_backspeed, 400); } break; - case 22: // lookspring + case 23: // lookspring Cvar_SetValueQuick (&lookspring, !lookspring.integer); break; - case 23: // lookstrafe + case 24: // lookstrafe Cvar_SetValueQuick (&lookstrafe, !lookstrafe.integer); break; - case 24: // mouse speed + case 25: // mouse speed Cvar_SetValueQuick (&sensitivity, bound(1, sensitivity.value + dir * 0.5, 50)); break; - case 25: // mouse look + case 26: // mouse look Cvar_SetValueQuick (&freelook, !freelook.integer); break; - case 26: // invert mouse + case 27: // invert mouse Cvar_SetValueQuick (&m_pitch, -m_pitch.value); break; - case 27: // windowed mouse + case 28: // windowed mouse Cvar_SetValueQuick (&vid_mouse, !vid_mouse.integer); break; } @@ -1254,6 +1236,8 @@ void M_Options_Draw (void) M_Print(16, y, " Screen size");M_DrawSlider(220, y, scr_viewsize.value, 30, 120);y += 8; M_ItemPrint(16, y, " JPEG screenshots", jpeg_dll != NULL);M_DrawCheckbox(220, y, scr_screenshot_jpeg.integer);y += 8; M_Print(16, y, " Sky");M_DrawCheckbox(220, y, r_sky.integer);y += 8; + // LordHavoc: FIXME: overbright needs to be disabled in GAME_GOODVSBAD2 but combine should not be disabled + // LordHavoc: perhaps it's time for Overbright Bits to die, and a r_lightmapintensity option to be added? M_Print(16, y, " Overbright Bits");M_DrawSlider(220, y, v_overbrightbits.value, 0, 4);y += 8; M_Print(16, y, " Texture Combine");M_DrawCheckbox(220, y, gl_combine.integer);y += 8; M_Print(16, y, " Dithering");M_DrawCheckbox(220, y, gl_dither.integer);y += 8; @@ -1261,6 +1245,12 @@ void M_Options_Draw (void) M_ItemPrint(16, y, " Game Speed", sv.active);M_DrawSlider(220, y, slowmo.value, 0, 5);y += 8; M_ItemPrint(16, y, " CD Music Volume", cdaudioinitialized);M_DrawSlider(220, y, bgmvolume.value, 0, 1);y += 8; M_ItemPrint(16, y, " Sound Volume", snd_initialized);M_DrawSlider(220, y, volume.value, 0, 1);y += 8; + if (gamemode == GAME_GOODVSBAD2) + M_ItemPrint(16, y, " Music Volume", snd_initialized); + else + M_ItemPrint(16, y, " Ambient Sound Volume", snd_initialized); + M_DrawSlider(220, y, snd_staticvolume.value, 0, 1); + y += 8; M_Print(16, y, " Crosshair");M_DrawSlider(220, y, crosshair.value, 0, 5);y += 8; M_Print(16, y, " Crosshair Size");M_DrawSlider(220, y, crosshair_size.value, 1, 5);y += 8; M_Print(16, y, " Static Crosshair");M_DrawCheckbox(220, y, crosshair_static.integer);y += 8; @@ -1794,6 +1784,29 @@ char *transfusionbindnames[][2] = {"impulse 20", "observer mode"} }; +char *goodvsbad2bindnames[][2] = +{ +{"impulse 69", "Power 1"}, +{"impulse 70", "Power 2"}, +{"impulse 71", "Power 3"}, +{"+jump", "jump / swim up"}, +{"+forward", "walk forward"}, +{"+back", "backpedal"}, +{"+left", "turn left"}, +{"+right", "turn right"}, +{"+speed", "run"}, +{"+moveleft", "step left"}, +{"+moveright", "step right"}, +{"+strafe", "sidestep"}, +{"+lookup", "look up"}, +{"+lookdown", "look down"}, +{"centerview", "center view"}, +{"+mlook", "mouse look"}, +{"kill", "kill yourself"}, +{"+moveup", "swim up"}, +{"+movedown", "swim down"} +}; + int numcommands; char *(*bindnames)[2]; @@ -2346,6 +2359,70 @@ char *quitMessage [] = " ", }; +char *goodvsbad2quitMessage [] = +{ +/* .........1.........2.... */ + " Press Yes To Quit ", + " ... ", + " Yes ", + " ", + + " Do you really want to ", + " Quit? ", + " Play Good vs bad 3! ", + " ", + + " All your quit are ", + " belong to long duck ", + " dong ", + " ", + + " Press Y to quit ", + " ", + " But are you too legit?", + " ", + + " This game was made by ", + " e@chip-web.com ", + " It is by far the best ", + " game ever made. ", + + " Even I really dont ", + " know of a game better ", + " Press Y to quit ", + " like rougue chedder ", + + " After you stop playing", + " tell the guys who made ", + " counterstrike to just ", + " kill themselves now ", + + " Press Y to exit to DOS", + " ", + " SSH login as user Y ", + " to exit to Linux " + + " ", + " Press Y like you ", + " were waanderers ", + " from Ys' ", + + " ", + " This game was made in ", + " Nippon like the SS ", + " announcer's saying ipon", + + " ", + " you ", + " want to quit? ", + " ", + + " ", + " Please stop playing ", + " this stupid game ", + " ", +}; + void M_Menu_Quit_f (void) { if (m_state == m_quit) @@ -2670,7 +2747,7 @@ episode_t quakeepisodes[] = {"Deathmatch Arena", 32, 6} }; -//MED 01/06/97 added hipnotic levels + //MED 01/06/97 added hipnotic levels level_t hipnoticlevels[] = { {"start", "Command HQ"}, // 0 @@ -2833,12 +2910,31 @@ episode_t transfusionepisodes[] = {"Conversions", 33, 5} }; +level_t goodvsbad2levels[] = +{ + {"rts", "Many Paths"}, // 0 + {"chess", "Chess, Scott Hess"}, // 1 + {"dot", "Big Wall"}, + {"city2", "The Big City"}, + {"bwall", "0 G like Psychic TV"}, + {"snow", "Wireframed"}, + {"telep", "Infinite Falling"}, + {"faces", "Facing Bases"}, + {"island", "Adventure Islands"}, +}; + +episode_t goodvsbad2episodes[] = +{ + {"Levels? Bevels!", 0, 8}, +}; + gamelevels_t sharewarequakegame = {"Shareware Quake", quakelevels, quakeepisodes, 2}; gamelevels_t registeredquakegame = {"Quake", quakelevels, quakeepisodes, 7}; gamelevels_t hipnoticgame = {"Scourge of Armagon", hipnoticlevels, hipnoticepisodes, 6}; gamelevels_t roguegame = {"Dissolution of Eternity", roguelevels, rogueepisodes, 4}; gamelevels_t nehahragame = {"Nehahra", nehahralevels, nehahraepisodes, 4}; gamelevels_t transfusiongame = {"Transfusion", transfusionlevels, transfusionepisodes, 7}; +gamelevels_t goodvsbad2game = {"Good Vs. Bad 2", goodvsbad2levels, goodvsbad2episodes, 1}; typedef struct { @@ -2888,8 +2984,8 @@ void M_Menu_GameOptions_f (void) } -int gameoptions_cursor_table[] = {40, 56, 64, 72, 80, 88, 96, 104, 120, 128}; -#define NUM_GAMEOPTIONS 10 +int gameoptions_cursor_table[] = {40, 56, 64, 72, 80, 88, 96, 104, 132, 152, 160}; +#define NUM_GAMEOPTIONS 11 int gameoptions_cursor; void M_GameOptions_Draw (void) @@ -2910,104 +3006,105 @@ void M_GameOptions_Draw (void) M_Print (0, 56, " Max players"); M_Print (160, 56, va("%i", maxplayers) ); - M_Print (0, 64, " Game Type"); - if (gamemode == GAME_TRANSFUSION) - { - if (!deathmatch.integer) - Cvar_SetValue("deathmatch", 1); - if (deathmatch.integer == 2) - M_Print (160, 64, "Capture the Flag"); - else - M_Print (160, 64, "Blood Bath"); - } - else + if (gamemode != GAME_GOODVSBAD2) { - if (!coop.integer && !deathmatch.integer) - Cvar_SetValue("deathmatch", 1); - if (coop.integer) - M_Print (160, 64, "Cooperative"); + M_Print (0, 64, " Game Type"); + if (gamemode == GAME_TRANSFUSION) + { + if (!deathmatch.integer) + Cvar_SetValue("deathmatch", 1); + if (deathmatch.integer == 2) + M_Print (160, 64, "Capture the Flag"); + else + M_Print (160, 64, "Blood Bath"); + } else - M_Print (160, 64, "Deathmatch"); - } - - M_Print (0, 72, " Teamplay"); - if (gamemode == GAME_ROGUE) - { - char *msg; - - switch((int)teamplay.integer) { - case 1: msg = "No Friendly Fire"; break; - case 2: msg = "Friendly Fire"; break; - case 3: msg = "Tag"; break; - case 4: msg = "Capture the Flag"; break; - case 5: msg = "One Flag CTF"; break; - case 6: msg = "Three Team CTF"; break; - default: msg = "Off"; break; + if (!coop.integer && !deathmatch.integer) + Cvar_SetValue("deathmatch", 1); + if (coop.integer) + M_Print (160, 64, "Cooperative"); + else + M_Print (160, 64, "Deathmatch"); } - M_Print (160, 72, msg); - } - else if (gamemode == GAME_TRANSFUSION) - { - char *msg; - switch (teamplay.integer) + M_Print (0, 72, " Teamplay"); + if (gamemode == GAME_ROGUE) { - case 0: msg = "Off"; break; - case 2: msg = "Friendly Fire"; break; - default: msg = "No Friendly Fire"; break; - } - M_Print (160, 72, msg); - } - else - { - char *msg; + char *msg; - switch((int)teamplay.integer) + switch((int)teamplay.integer) + { + case 1: msg = "No Friendly Fire"; break; + case 2: msg = "Friendly Fire"; break; + case 3: msg = "Tag"; break; + case 4: msg = "Capture the Flag"; break; + case 5: msg = "One Flag CTF"; break; + case 6: msg = "Three Team CTF"; break; + default: msg = "Off"; break; + } + M_Print (160, 72, msg); + } + else { - case 1: msg = "No Friendly Fire"; break; - case 2: msg = "Friendly Fire"; break; - default: msg = "Off"; break; + char *msg; + + switch (teamplay.integer) + { + case 0: msg = "Off"; break; + case 2: msg = "Friendly Fire"; break; + default: msg = "No Friendly Fire"; break; + } + M_Print (160, 72, msg); } - M_Print (160, 72, msg); - } - M_Print (0, 80, " Skill"); - if (skill.integer == 0) - M_Print (160, 80, "Easy difficulty"); - else if (skill.integer == 1) - M_Print (160, 80, "Normal difficulty"); - else if (skill.integer == 2) - M_Print (160, 80, "Hard difficulty"); - else - M_Print (160, 80, "Nightmare difficulty"); + M_Print (0, 80, " Skill"); + if (skill.integer == 0) + M_Print (160, 80, "Easy difficulty"); + else if (skill.integer == 1) + M_Print (160, 80, "Normal difficulty"); + else if (skill.integer == 2) + M_Print (160, 80, "Hard difficulty"); + else + M_Print (160, 80, "Nightmare difficulty"); - M_Print (0, 88, " Frag Limit"); - if (fraglimit.integer == 0) - M_Print (160, 88, "none"); - else - M_Print (160, 88, va("%i frags", fraglimit.integer)); + M_Print (0, 88, " Frag Limit"); + if (fraglimit.integer == 0) + M_Print (160, 88, "none"); + else + M_Print (160, 88, va("%i frags", fraglimit.integer)); - M_Print (0, 96, " Time Limit"); - if (timelimit.integer == 0) - M_Print (160, 96, "none"); - else - M_Print (160, 96, va("%i minutes", timelimit.integer)); + M_Print (0, 96, " Time Limit"); + if (timelimit.integer == 0) + M_Print (160, 96, "none"); + else + M_Print (160, 96, va("%i minutes", timelimit.integer)); + } M_Print (0, 104, " Public server"); M_Print (160, 104, (sv_public.integer == 0) ? "no" : "yes"); + M_Print (0, 120, " Server name"); + M_DrawTextBox (0, 124, 38, 1); + M_Print (8, 132, hostname.string); + g = lookupgameinfo(); - M_Print (0, 120, " Episode"); - M_Print (160, 120, g->episodes[startepisode].description); + if (gamemode != GAME_GOODVSBAD2) + { + M_Print (0, 152, " Episode"); + M_Print (160, 152, g->episodes[startepisode].description); + } - M_Print (0, 128, " Level"); - M_Print (160, 128, g->levels[g->episodes[startepisode].firstLevel + startlevel].description); - M_Print (160, 136, g->levels[g->episodes[startepisode].firstLevel + startlevel].name); + M_Print (0, 160, " Level"); + M_Print (160, 160, g->levels[g->episodes[startepisode].firstLevel + startlevel].description); + M_Print (160, 168, g->levels[g->episodes[startepisode].firstLevel + startlevel].name); // line cursor - M_DrawCharacter (144, gameoptions_cursor_table[gameoptions_cursor], 12+((int)(realtime*4)&1)); + if (gameoptions_cursor == 8) + M_DrawCharacter (8 + 8 * strlen(hostname.string), gameoptions_cursor_table[gameoptions_cursor], 10+((int)(realtime*4)&1)); + else + M_DrawCharacter (144, gameoptions_cursor_table[gameoptions_cursor], 12+((int)(realtime*4)&1)); if (m_serverInfoMessage) { @@ -3022,9 +3119,7 @@ void M_GameOptions_Draw (void) M_Print (x, 170, " havoc@telefragged.com "); } else - { m_serverInfoMessage = false; - } } } @@ -3049,6 +3144,8 @@ void M_NetStart_Change (int dir) break; case 2: + if (gamemode == GAME_GOODVSBAD2) + break; if (gamemode == GAME_TRANSFUSION) { if (deathmatch.integer == 2) // changing from CTF to BloodBath @@ -3072,6 +3169,8 @@ void M_NetStart_Change (int dir) break; case 3: + if (gamemode == GAME_GOODVSBAD2) + break; if (gamemode == GAME_ROGUE) count = 6; else @@ -3085,6 +3184,8 @@ void M_NetStart_Change (int dir) break; case 4: + if (gamemode == GAME_GOODVSBAD2) + break; Cvar_SetValueQuick (&skill, skill.integer + dir); if (skill.integer > 3) Cvar_SetValueQuick (&skill, 0); @@ -3093,6 +3194,8 @@ void M_NetStart_Change (int dir) break; case 5: + if (gamemode == GAME_GOODVSBAD2) + break; Cvar_SetValueQuick (&fraglimit, fraglimit.integer + dir*10); if (fraglimit.integer > 100) Cvar_SetValueQuick (&fraglimit, 0); @@ -3101,6 +3204,8 @@ void M_NetStart_Change (int dir) break; case 6: + if (gamemode == GAME_GOODVSBAD2) + break; Cvar_SetValueQuick (&timelimit, timelimit.value + dir*5); if (timelimit.value > 60) Cvar_SetValueQuick (&timelimit, 0); @@ -3113,6 +3218,11 @@ void M_NetStart_Change (int dir) break; case 8: + break; + + case 9: + if (gamemode == GAME_GOODVSBAD2) + break; startepisode += dir; g = lookupgameinfo(); @@ -3125,7 +3235,7 @@ void M_NetStart_Change (int dir) startlevel = 0; break; - case 9: + case 10: startlevel += dir; g = lookupgameinfo(); @@ -3141,6 +3251,8 @@ void M_NetStart_Change (int dir) void M_GameOptions_Key (int key) { gamelevels_t *g; + int l; + char hostnamebuf[128]; switch (key) { @@ -3191,6 +3303,35 @@ void M_GameOptions_Key (int key) M_NetStart_Change (1); break; + + case K_BACKSPACE: + if (gameoptions_cursor == 8) + { + l = strlen(hostname.string); + if (l) + { + l = min(l - 1, 37); + memcpy(hostnamebuf, hostname.string, l); + hostnamebuf[l] = 0; + Cvar_Set("hostname", hostnamebuf); + } + } + break; + + default: + if (key < 32 || key > 127) + break; + if (gameoptions_cursor == 8) + { + l = strlen(hostname.string); + if (l < 37) + { + memcpy(hostnamebuf, hostname.string, l); + hostnamebuf[l] = key; + hostnamebuf[l+1] = 0; + Cvar_Set("hostname", hostnamebuf); + } + } } } @@ -3308,6 +3449,11 @@ void M_Init (void) numcommands = sizeof(transfusionbindnames) / sizeof(transfusionbindnames[0]); bindnames = transfusionbindnames; } + else if (gamemode == GAME_GOODVSBAD2) + { + numcommands = sizeof(goodvsbad2bindnames) / sizeof(goodvsbad2bindnames[0]); + bindnames = goodvsbad2bindnames; + } else { numcommands = sizeof(quakebindnames) / sizeof(quakebindnames[0]); diff --git a/sbar.c b/sbar.c index 0f905e83..8e4bbd84 100644 --- a/sbar.c +++ b/sbar.c @@ -778,14 +778,16 @@ void Sbar_Draw (void) if (sb_lines > 24) { - Sbar_DrawInventory (); + if (gamemode != GAME_GOODVSBAD2) + Sbar_DrawInventory (); if (cl.maxclients != 1) Sbar_DrawFrags (); } if (sb_showscores || cl.stats[STAT_HEALTH] <= 0) { - Sbar_DrawAlphaPic (0, 0, sb_scorebar, 0.4); + if (gamemode != GAME_GOODVSBAD2) + Sbar_DrawAlphaPic (0, 0, sb_scorebar, 0.4); Sbar_DrawScoreboard (); } else if (sb_lines) @@ -802,32 +804,35 @@ void Sbar_Draw (void) Sbar_DrawPic (209, 12, sb_items[1]); } // armor - if (cl.items & IT_INVULNERABILITY) + if (gamemode != GAME_GOODVSBAD2) { - Sbar_DrawNum (24, 0, 666, 3, 1); - Sbar_DrawPic (0, 0, sb_disc); - } - else - { - if (gamemode == GAME_ROGUE) + if (cl.items & IT_INVULNERABILITY) { - Sbar_DrawNum (24, 0, cl.stats[STAT_ARMOR], 3, cl.stats[STAT_ARMOR] <= 25); - if (cl.items & RIT_ARMOR3) - Sbar_DrawPic (0, 0, sb_armor[2]); - else if (cl.items & RIT_ARMOR2) - Sbar_DrawPic (0, 0, sb_armor[1]); - else if (cl.items & RIT_ARMOR1) - Sbar_DrawPic (0, 0, sb_armor[0]); + Sbar_DrawNum (24, 0, 666, 3, 1); + Sbar_DrawPic (0, 0, sb_disc); } else { - Sbar_DrawNum (24, 0, cl.stats[STAT_ARMOR], 3, cl.stats[STAT_ARMOR] <= 25); - if (cl.items & IT_ARMOR3) - Sbar_DrawPic (0, 0, sb_armor[2]); - else if (cl.items & IT_ARMOR2) - Sbar_DrawPic (0, 0, sb_armor[1]); - else if (cl.items & IT_ARMOR1) - Sbar_DrawPic (0, 0, sb_armor[0]); + if (gamemode == GAME_ROGUE) + { + Sbar_DrawNum (24, 0, cl.stats[STAT_ARMOR], 3, cl.stats[STAT_ARMOR] <= 25); + if (cl.items & RIT_ARMOR3) + Sbar_DrawPic (0, 0, sb_armor[2]); + else if (cl.items & RIT_ARMOR2) + Sbar_DrawPic (0, 0, sb_armor[1]); + else if (cl.items & RIT_ARMOR1) + Sbar_DrawPic (0, 0, sb_armor[0]); + } + else + { + Sbar_DrawNum (24, 0, cl.stats[STAT_ARMOR], 3, cl.stats[STAT_ARMOR] <= 25); + if (cl.items & IT_ARMOR3) + Sbar_DrawPic (0, 0, sb_armor[2]); + else if (cl.items & IT_ARMOR2) + Sbar_DrawPic (0, 0, sb_armor[1]); + else if (cl.items & IT_ARMOR1) + Sbar_DrawPic (0, 0, sb_armor[0]); + } } } diff --git a/snd_dma.c b/snd_dma.c index 3470723f..337f1987 100644 --- a/snd_dma.c +++ b/snd_dma.c @@ -71,6 +71,7 @@ int sound_started = 0; cvar_t bgmvolume = {CVAR_SAVE, "bgmvolume", "1"}; cvar_t volume = {CVAR_SAVE, "volume", "0.7"}; +cvar_t snd_staticvolume = {CVAR_SAVE, "snd_staticvolume", "1"}; cvar_t nosound = {0, "nosound", "0"}; cvar_t snd_precache = {0, "snd_precache", "1"}; @@ -163,12 +164,13 @@ S_Init */ void S_Init (void) { - Con_Printf("\nSound Initialization\n"); + Con_DPrintf("\nSound Initialization\n"); S_RawSamples_ClearQueue(); Cvar_RegisterVariable(&volume); Cvar_RegisterVariable(&bgmvolume); + Cvar_RegisterVariable(&snd_staticvolume); if (COM_CheckParm("-nosound") || COM_CheckParm("-safe")) return; @@ -224,7 +226,7 @@ void S_Init (void) if (!sound_started) return; - Con_Printf ("Sound sampling rate: %i\n", shm->speed); + Con_DPrintf ("Sound sampling rate: %i\n", shm->speed); // provides a tick sound until washed clean @@ -342,15 +344,15 @@ SND_PickChannel */ channel_t *SND_PickChannel(int entnum, int entchannel) { - int ch_idx; - int first_to_die; - int life_left; + int ch_idx; + int first_to_die; + int life_left; // Check for replacement sound, or find the best one to replace - first_to_die = -1; - life_left = 0x7fffffff; - for (ch_idx=NUM_AMBIENTS ; ch_idx < NUM_AMBIENTS + MAX_DYNAMIC_CHANNELS ; ch_idx++) - { + first_to_die = -1; + life_left = 0x7fffffff; + for (ch_idx=NUM_AMBIENTS ; ch_idx < NUM_AMBIENTS + MAX_DYNAMIC_CHANNELS ; ch_idx++) + { if (entchannel != 0 // channel 0 never overrides && channels[ch_idx].entnum == entnum && (channels[ch_idx].entchannel == entchannel || entchannel == -1) ) @@ -368,7 +370,7 @@ channel_t *SND_PickChannel(int entnum, int entchannel) life_left = channels[ch_idx].end - paintedtime; first_to_die = ch_idx; } - } + } if (first_to_die == -1) return NULL; @@ -376,7 +378,7 @@ channel_t *SND_PickChannel(int entnum, int entchannel) if (channels[first_to_die].sfx) channels[first_to_die].sfx = NULL; - return &channels[first_to_die]; + return &channels[first_to_die]; } /* @@ -384,12 +386,12 @@ channel_t *SND_PickChannel(int entnum, int entchannel) SND_Spatialize ================= */ -void SND_Spatialize(channel_t *ch) +void SND_Spatialize(channel_t *ch, int isstatic) { - vec_t dot; - vec_t dist; - vec_t lscale, rscale, scale; - vec3_t source_vec; + vec_t dot; + vec_t dist; + vec_t lscale, rscale, scale; + vec3_t source_vec; sfx_t *snd; // anything coming from the view entity will always be full volume @@ -398,39 +400,45 @@ void SND_Spatialize(channel_t *ch) { ch->leftvol = ch->master_vol; ch->rightvol = ch->master_vol; - return; } + else + { + // calculate stereo seperation and distance attenuation + snd = ch->sfx; + VectorSubtract(ch->origin, listener_origin, source_vec); -// calculate stereo seperation and distance attenuation + dist = VectorNormalizeLength(source_vec) * ch->dist_mult; - snd = ch->sfx; - VectorSubtract(ch->origin, listener_origin, source_vec); + dot = DotProduct(listener_right, source_vec); - dist = VectorNormalizeLength(source_vec) * ch->dist_mult; + if (shm->channels == 1) + { + rscale = 1.0; + lscale = 1.0; + } + else + { + rscale = 1.0 + dot; + lscale = 1.0 - dot; + } - dot = DotProduct(listener_right, source_vec); + // add in distance effect + scale = (1.0 - dist) * rscale; + ch->rightvol = (int) (ch->master_vol * scale); + if (ch->rightvol < 0) + ch->rightvol = 0; - if (shm->channels == 1) - { - rscale = 1.0; - lscale = 1.0; + scale = (1.0 - dist) * lscale; + ch->leftvol = (int) (ch->master_vol * scale); + if (ch->leftvol < 0) + ch->leftvol = 0; } - else + // LordHavoc: allow adjusting volume of static sounds + if (isstatic) { - rscale = 1.0 + dot; - lscale = 1.0 - dot; + ch->leftvol *= snd_staticvolume.value; + ch->rightvol *= snd_staticvolume.value; } - -// add in distance effect - scale = (1.0 - dist) * rscale; - ch->rightvol = (int) (ch->master_vol * scale); - if (ch->rightvol < 0) - ch->rightvol = 0; - - scale = (1.0 - dist) * lscale; - ch->leftvol = (int) (ch->master_vol * scale); - if (ch->leftvol < 0) - ch->leftvol = 0; } @@ -484,13 +492,13 @@ void S_StartSound(int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float f target_chan->sfx = sfx; target_chan->pos = 0.0; - target_chan->end = paintedtime + sc->length; + target_chan->end = paintedtime + sc->length; // if an identical sound has also been started this frame, offset the pos // a bit to keep it from just making the first one louder check = &channels[NUM_AMBIENTS]; - for (ch_idx=NUM_AMBIENTS ; ch_idx < NUM_AMBIENTS + MAX_DYNAMIC_CHANNELS ; ch_idx++, check++) - { + for (ch_idx=NUM_AMBIENTS ; ch_idx < NUM_AMBIENTS + MAX_DYNAMIC_CHANNELS ; ch_idx++, check++) + { if (check == target_chan) continue; if (check->sfx == sfx && !check->pos) @@ -650,7 +658,7 @@ void S_StaticSound (sfx_t *sfx, vec3_t origin, float vol, float attenuation) VectorCopy (origin, ss->origin); ss->master_vol = vol; ss->dist_mult = (attenuation/64) / sound_nominal_clip_dist; - ss->end = paintedtime + sc->length; + ss->end = paintedtime + sc->length; SND_Spatialize (ss); } @@ -745,7 +753,7 @@ void S_Update(vec3_t origin, vec3_t forward, vec3_t right, vec3_t up) { if (!ch->sfx) continue; - SND_Spatialize(ch); // respatialize channel + SND_Spatialize(ch, i > MAX_DYNAMIC_CHANNELS + NUM_AMBIENTS); // respatialize channel if (!ch->leftvol && !ch->rightvol) continue; diff --git a/snd_mem.c b/snd_mem.c index 1f7e7e35..b46f90f1 100644 --- a/snd_mem.c +++ b/snd_mem.c @@ -232,7 +232,7 @@ sfxcache_t *S_LoadSound (sfx_t *s, int complain) { s->silentlymissing = !complain; if (complain) - Con_Printf ("Couldn't load %s\n", namebuffer); + Con_DPrintf ("Couldn't load %s\n", namebuffer); return NULL; } diff --git a/vid_glx.c b/vid_glx.c index 1ea67984..27f89f92 100644 --- a/vid_glx.c +++ b/vid_glx.c @@ -707,7 +707,7 @@ int VID_InitMode(int fullscreen, int width, int height, int bpp, int stencil) vidmode_ext = false; else { - Con_Printf("Using XFree86-VidModeExtension Version %d.%d\n", MajorVersion, MinorVersion); + Con_DPrintf("Using XFree86-VidModeExtension Version %d.%d\n", MajorVersion, MinorVersion); vidmode_ext = true; } @@ -873,7 +873,7 @@ static void *prjobj = NULL; int GL_OpenLibrary(const char *name) { - Con_Printf("Loading GL driver %s\n", name); + Con_Printf("Loading OpenGL driver %s\n", name); GL_CloseLibrary(); if (!(prjobj = dlopen(name, RTLD_LAZY))) { diff --git a/vid_shared.c b/vid_shared.c index 044995fc..8dd32054 100644 --- a/vid_shared.c +++ b/vid_shared.c @@ -228,14 +228,14 @@ int GL_CheckExtension(const char *name, const dllfunction_t *funcs, const char * int failed = false; const dllfunction_t *func; - Con_Printf("checking for %s... ", name); + Con_DPrintf("checking for %s... ", name); for (func = funcs;func && func->name;func++) *func->funcvariable = NULL; if (disableparm && COM_CheckParm(disableparm)) { - Con_Printf("disabled by commandline\n"); + Con_DPrintf("disabled by commandline\n"); return false; } @@ -247,19 +247,19 @@ int GL_CheckExtension(const char *name, const dllfunction_t *funcs, const char * if (!(*func->funcvariable = (void *) GL_GetProcAddress(func->name))) { if (!silent) - Con_Printf("missing function \"%s\" - broken driver!\n", func->name); + Con_Printf("OpenGL extension \"%s\" is missing function \"%s\" - broken driver!\n", name, func->name); failed = true; } } // delay the return so it prints all missing functions if (failed) return false; - Con_Printf("enabled\n"); + Con_DPrintf("enabled\n"); return true; } else { - Con_Printf("not detected\n"); + Con_DPrintf("not detected\n"); return false; } } @@ -421,13 +421,13 @@ void VID_CheckExtensions(void) if (!GL_CheckExtension("OpenGL 1.1.0", opengl110funcs, NULL, false)) Sys_Error("OpenGL 1.1.0 functions not found\n"); - Con_Printf ("GL_VENDOR: %s\n", gl_vendor); - Con_Printf ("GL_RENDERER: %s\n", gl_renderer); - Con_Printf ("GL_VERSION: %s\n", gl_version); - Con_Printf ("GL_EXTENSIONS: %s\n", gl_extensions); - Con_Printf ("%s_EXTENSIONS: %s\n", gl_platform, gl_platformextensions); + Con_DPrintf ("GL_VENDOR: %s\n", gl_vendor); + Con_DPrintf ("GL_RENDERER: %s\n", gl_renderer); + Con_DPrintf ("GL_VERSION: %s\n", gl_version); + Con_DPrintf ("GL_EXTENSIONS: %s\n", gl_extensions); + Con_DPrintf ("%s_EXTENSIONS: %s\n", gl_platform, gl_platformextensions); - Con_Printf("Checking OpenGL extensions...\n"); + Con_DPrintf("Checking OpenGL extensions...\n"); if (!GL_CheckExtension("glDrawRangeElements", drawrangeelementsfuncs, "-nodrawrangeelements", true)) GL_CheckExtension("GL_EXT_draw_range_elements", drawrangeelementsextfuncs, "-nodrawrangeelements", false); @@ -669,6 +669,8 @@ void VID_Shared_Init(void) Cvar_RegisterVariable(&m_filter); Cmd_AddCommand("force_centerview", Force_CenterView_f); Cmd_AddCommand("vid_restart", VID_Restart_f); + if (gamemode == GAME_GOODVSBAD2) + Cvar_Set("gl_combine", "0"); } int current_vid_fullscreen; @@ -767,7 +769,7 @@ void VID_Open(void) Cvar_SetValueQuick(&vid_stencil, 0); } - Con_Printf("Starting video system\n"); + Con_DPrintf("Starting video system\n"); if (!VID_Mode(vid_fullscreen.integer, vid_width.integer, vid_height.integer, vid_bitsperpixel.integer, vid_stencil.integer)) { Con_Printf("Desired video mode fail, trying fallbacks...\n"); diff --git a/vid_wgl.c b/vid_wgl.c index 5df7d8de..8bc1d781 100644 --- a/vid_wgl.c +++ b/vid_wgl.c @@ -664,7 +664,7 @@ static HINSTANCE gldll; int GL_OpenLibrary(const char *name) { - Con_Printf("Loading GL driver %s\n", name); + Con_Printf("Loading OpenGL driver %s\n", name); GL_CloseLibrary(); if (!(gldll = LoadLibrary(name))) { -- 2.39.2