diff --git a/code/cgame/cg_consolecmds.c b/code/cgame/cg_consolecmds.c index c0779646..bb490940 100644 --- a/code/cgame/cg_consolecmds.c +++ b/code/cgame/cg_consolecmds.c @@ -393,7 +393,7 @@ static void CG_DenyOrder_f(void) { } static void CG_TaskOffense_f(void) { - if (CG_UsesTeamFlags(cgs.gametype)) { + if (cgs.gametype == GT_CTF || cgs.gametype == GT_CTF_ELIMINATION || cgs.gametype == GT_1FCTF) { trap_SendConsoleCommand(va("cmd vsay_team %s\n", VOICECHAT_ONGETFLAG)); } else { trap_SendConsoleCommand(va("cmd vsay_team %s\n", VOICECHAT_ONOFFENSE)); @@ -508,7 +508,10 @@ CG_StartOrbit_f */ static void CG_StartOrbit_f(void) { - if (!cg_developer.integer) { + char var[MAX_TOKEN_CHARS]; + + trap_Cvar_VariableStringBuffer("developer", var, sizeof ( var)); + if (!atoi(var)) { return; } if (cg_cameraOrbit.value != 0) { diff --git a/code/cgame/cg_draw.c b/code/cgame/cg_draw.c index ba874cb1..8cc4bc24 100644 --- a/code/cgame/cg_draw.c +++ b/code/cgame/cg_draw.c @@ -124,6 +124,14 @@ void CG_Text_PaintChar(float x, float y, float width, float height, float scale, trap_R_DrawStretchPic(x, y, w, h, s, t, s2, t2, hShader); } + +void CG_Text_PaintCharNoAdjust(float x, float y, float width, float height, float scale, float s, float t, float s2, float t2, qhandle_t hShader) { + float w, h; + w = width * scale; + h = height * scale; + trap_R_DrawStretchPic(x, y, w, h, s, t, s2, t2, hShader); +} + void CG_Text_Paint(float x, float y, float scale, vec4_t color, const char *text, float adjust, int limit, int style) { int len, count; vec4_t newColor; @@ -191,6 +199,75 @@ void CG_Text_Paint(float x, float y, float scale, vec4_t color, const char *text } + +void CG_Text_Paint_3D(float x, float y, float scale, vec4_t color, const char *text, float adjust, int limit, int style) { + int len, count; + vec4_t newColor; + glyphInfo_t *glyph; + float useScale; + fontInfo_t *font = &cgDC.Assets.textFont; + if (scale <= cg_smallFont.value) { + font = &cgDC.Assets.smallFont; + } else if (scale > cg_bigFont.value) { + font = &cgDC.Assets.bigFont; + } + useScale = scale * font->glyphScale; + if (text) { + const char *s = text; + trap_R_SetColor(color); + memcpy(&newColor[0], &color[0], sizeof (vec4_t)); + len = strlen(text); + if (limit > 0 && len > limit) { + len = limit; + } + count = 0; + while (s && *s && count < len) { + glyph = &font->glyphs[*s & 255]; + if (Q_IsColorString(s)) { + memcpy(newColor, g_color_table[ColorIndex(*(s + 1))], sizeof ( newColor)); + newColor[3] = color[3]; + trap_R_SetColor(newColor); + s += 2; + continue; + } else { + float yadj = useScale * glyph->top; + if (style == ITEM_TEXTSTYLE_SHADOWED || style == ITEM_TEXTSTYLE_SHADOWEDMORE) { + int ofs = style == ITEM_TEXTSTYLE_SHADOWED ? 1 : 2; + colorBlack[3] = newColor[3]; + trap_R_SetColor(colorBlack); + CG_Text_PaintCharNoAdjust(x + ofs, y - yadj + ofs, + glyph->imageWidth, + glyph->imageHeight, + useScale, + glyph->s, + glyph->t, + glyph->s2, + glyph->t2, + glyph->glyph); + colorBlack[3] = 1.0; + trap_R_SetColor(newColor); + } + CG_Text_PaintCharNoAdjust(x, y - yadj, + glyph->imageWidth, + glyph->imageHeight, + useScale, + glyph->s, + glyph->t, + glyph->s2, + glyph->t2, + glyph->glyph); + // CG_DrawPic(x, y - yadj, scale * cgDC.Assets.textFont.glyphs[text[i]].imageWidth, scale * cgDC.Assets.textFont.glyphs[text[i]].imageHeight, cgDC.Assets.textFont.glyphs[text[i]].glyph); + x += (glyph->xSkip * useScale) + adjust; + s++; + count++; + } + } + trap_R_SetColor(NULL); + } +} + + + #endif /* @@ -1184,9 +1261,6 @@ static float CG_DrawCountdownTimer(float y) { //msec = cg.time - cgs.levelStartTime; if (cg.time > rst) //We are started { - if (cgs.gametype == GT_DOUBLE_D) { - return y; - } msec = cgs.roundtime * 1000 - (cg.time - rst); if (msec <= 30 * 1000 - 1) //<= 30 seconds memcpy(color, g_color_table[ColorIndex(COLOR_YELLOW)], sizeof (color)); @@ -1449,7 +1523,7 @@ static float CG_DrawFollowMessage(float y) { char *s; int w; - if (!(cg.snap->ps.pm_flags & PMF_FOLLOW) || ((cgs.elimflags & EF_NO_FREESPEC) && CG_IsARoundBasedGametype(cgs.gametype) && CG_IsATeamGametype(cgs.gametype))) { + if (!(cg.snap->ps.pm_flags & PMF_FOLLOW) || ((cgs.elimflags & EF_NO_FREESPEC) && (cgs.gametype == GT_ELIMINATION || cgs.gametype == GT_CTF_ELIMINATION))) { return y; } @@ -1588,7 +1662,7 @@ static void CG_DrawUpperRight(stereoFrame_t stereoFrame) { y = 0; - if (CG_IsATeamGametype(cgs.gametype) && cg_drawTeamOverlay.integer == 1) { + if (cgs.gametype >= GT_TEAM && cgs.ffa_gt != 1 && cg_drawTeamOverlay.integer == 1) { y = CG_DrawTeamOverlay(y, qtrue, qtrue); } /*if ( cgs.gametype == GT_DOUBLE_D ) { @@ -1613,7 +1687,7 @@ static void CG_DrawUpperRight(stereoFrame_t stereoFrame) { if (cg_drawFPS.integer && (stereoFrame == STEREO_CENTER || stereoFrame == STEREO_RIGHT)) { y = CG_DrawFPS(y); } - if (CG_IsARoundBasedGametype(cgs.gametype) || cgs.gametype == GT_DOUBLE_D) { + if (cgs.gametype == GT_ELIMINATION || cgs.gametype == GT_CTF_ELIMINATION || cgs.gametype == GT_LMS) { y = CG_DrawCountdownTimer(y); /*if (cgs.clientinfo[ cg.clientNum ].isDead) y = CG_DrawEliminationDeathMessage( y);*/ @@ -1671,7 +1745,7 @@ static float CG_DrawScores(float y) { y1 = y; // draw from the right side to left - if (CG_IsATeamGametype(cgs.gametype)) { + if (cgs.gametype >= GT_TEAM && cgs.ffa_gt != 1) { x = 640; color[0] = 0.0f; color[1] = 0.0f; @@ -1686,7 +1760,7 @@ static float CG_DrawScores(float y) { } CG_DrawBigString(x + 4, y, s, 1.0F); - if (CG_UsesTeamFlags(cgs.gametype) && !CG_UsesTheWhiteFlag(cgs.gametype)) { + if (cgs.gametype == GT_CTF || cgs.gametype == GT_CTF_ELIMINATION) { // Display flag status item = BG_FindItemForPowerup(PW_BLUEFLAG); @@ -1720,7 +1794,7 @@ static float CG_DrawScores(float y) { } CG_DrawBigString(x + 4, y, s, 1.0F); - if (CG_UsesTeamFlags(cgs.gametype) && !CG_UsesTheWhiteFlag(cgs.gametype)) { + if (cgs.gametype == GT_CTF || cgs.gametype == GT_CTF_ELIMINATION) { // Display flag status item = BG_FindItemForPowerup(PW_REDFLAG); @@ -1756,7 +1830,9 @@ static float CG_DrawScores(float y) { CG_DrawSmallString(x, y - 28, s, 1.0F); } - if (CG_IsATeamGametype(cgs.gametype) && cgs.gametype != GT_TEAM) { + + + if (cgs.gametype >= GT_CTF && cgs.ffa_gt == 0) { v = cgs.capturelimit; } else { v = cgs.fraglimit; @@ -1959,7 +2035,7 @@ static void CG_DrawLowerRight(void) { y = 472 - ICON_SIZE; - if (CG_IsATeamGametype(cgs.gametype) && cg_drawTeamOverlay.integer == 2) { + if (cgs.gametype >= GT_TEAM && cgs.ffa_gt != 1 && cg_drawTeamOverlay.integer == 2) { y = CG_DrawTeamOverlay(y, qtrue, qfalse); } @@ -2014,7 +2090,7 @@ static void CG_DrawLowerLeft(void) { y = 480 - ICON_SIZE; - if (CG_IsATeamGametype(cgs.gametype) && cg_drawTeamOverlay.integer == 3) { + if (cgs.gametype >= GT_TEAM && cgs.ffa_gt != 1 && cg_drawTeamOverlay.integer == 3) { y = CG_DrawTeamOverlay(y, qfalse, qfalse); } @@ -2987,7 +3063,7 @@ static void CG_DrawSpectator(void) { CG_DrawBigString(320 - 9 * 8, 440, "SPECTATOR", 1.0F); if (cgs.gametype == GT_TOURNAMENT) { CG_DrawBigString(320 - 15 * 8, 460, "waiting to play", 1.0F); - } else if (CG_IsATeamGametype(cgs.gametype)) { + } else if (cgs.gametype >= GT_TEAM && cgs.ffa_gt != 1) { CG_DrawBigString(320 - 39 * 8, 460, "press ESC and use the JOIN menu to play", 1.0F); } } @@ -3102,7 +3178,7 @@ static qboolean CG_DrawScoreboard(void) { if (menuScoreboard == NULL) { - if (CG_IsATeamGametype(cgs.gametype)) { + if (cgs.gametype >= GT_TEAM && cgs.ffa_gt != 1) { menuScoreboard = Menus_FindByName("teamscore_menu"); } else { menuScoreboard = Menus_FindByName("score_menu"); @@ -3126,7 +3202,7 @@ static qboolean CG_DrawScoreboard(void) { #else char *s; int w; - if (cg.respawnTime && cg.snap->ps.persistant[PERS_TEAM] != TEAM_SPECTATOR && (!CG_IsARoundBasedGametype(cgs.gametype))) { + if (cg.respawnTime && cg.snap->ps.persistant[PERS_TEAM] != TEAM_SPECTATOR && (cgs.gametype < GT_ELIMINATION || cgs.gametype > GT_LMS)) { if (cg.respawnTime > cg.time) { s = va("Respawn in: %2.2f", ((double) cg.respawnTime - (double) cg.time) / 1000.0); w = CG_DrawStrlen(s) * SMALLCHAR_WIDTH; @@ -3474,6 +3550,8 @@ void CG_DrawTimedMenus(void) { CG_Draw2D ================= */ +void CG_PlayerSpritesOverWorld(centity_t *cent); + static void CG_Draw2D(stereoFrame_t stereoFrame) { #ifdef MISSIONPACK if (cgs.orderPending && cg.time > cgs.orderTime) { @@ -3534,18 +3612,38 @@ static void CG_Draw2D(stereoFrame_t stereoFrame) { CG_DrawReward(); } - } + + if (cgs.gametype >= GT_TEAM && cgs.ffa_gt != 1) { #ifndef MISSIONPACK - if (CG_IsATeamGametype(cgs.gametype)) { - CG_DrawTeamInfo(); - } + CG_DrawTeamInfo(); #endif + } + } CG_DrawVote(); CG_DrawTeamVote(); CG_DrawLagometer(); + // leilei - draw the player's names +#ifdef MISSIONPACK + { + int f; + centity_t *cent; + vec3_t angles; + vec3_t origin; + + + + for (f=0;frefEntity.rotation = rand() % 360; ex->refEntity.radius = 24; + ex->refEntity.shaderTime = ex->startTime / 1000.0f; // leilei- fix the blood animation ex->refEntity.customShader = cgs.media.bloodExplosionShader; // don't show player's own blood in view diff --git a/code/cgame/cg_ents.c b/code/cgame/cg_ents.c index ac2821a0..3ae89db6 100644 --- a/code/cgame/cg_ents.c +++ b/code/cgame/cg_ents.c @@ -864,7 +864,10 @@ static void CG_TeamBase( centity_t *cent ) { int t, h; float c; - if ( CG_UsesTeamFlags(cgs.gametype) ) { + if ( cgs.gametype == GT_CTF || cgs.gametype == GT_1FCTF ) { +//#else +// if ( cgs.gametype == GT_CTF) { +//#endif // show the flag base memset(&model, 0, sizeof(model)); model.reType = RT_MODEL; diff --git a/code/cgame/cg_event.c b/code/cgame/cg_event.c index 7c1d27c0..74c1b684 100644 --- a/code/cgame/cg_event.c +++ b/code/cgame/cg_event.c @@ -254,9 +254,7 @@ static void CG_Obituary(entityState_t *ent) { if (attacker == cg.snap->ps.clientNum) { char *s; - if (!CG_IsATeamGametype(cgs.gametype) && !CG_UsesTeamFlags(cgs.gametype) && - !CG_UsesTheWhiteFlag(cgs.gametype) && !CG_IsARoundBasedGametype(cgs.gametype) && - cgs.gametype != GT_DOUBLE_D && cgs.gametype != GT_DOMINATION) { + if ( cgs.gametype < GT_TEAM ) { s = va("You fragged %s\n%s place with %i", targetName, CG_PlaceString(cg.snap->ps.persistant[PERS_RANK] + 1), cg.snap->ps.persistant[PERS_SCORE]); @@ -732,6 +730,55 @@ void CG_EntityEvent(centity_t *cent, vec3_t position) { cgs.media.footsteps[ FOOTSTEP_METAL ][rand()&3]); } break; + case EV_FOOTSTEP_SNOW: + DEBUGNAME("EV_FOOTSTEP_SNOW"); + if (cg_footsteps.integer) { + trap_S_StartSound(NULL, es->number, CHAN_BODY, + cgs.media.footsteps[ FOOTSTEP_SNOW ][rand()&3]); + } + break; + case EV_FOOTSTEP_WOOD: + DEBUGNAME("EV_FOOTSTEP_WOOD"); + if (cg_footsteps.integer) { + trap_S_StartSound(NULL, es->number, CHAN_BODY, + cgs.media.footsteps[ FOOTSTEP_WOOD ][rand()&3]); + } + break; + case EV_FOOTSTEP_SAND: + DEBUGNAME("EV_FOOTSTEP_SAND"); + if (cg_footsteps.integer) { + trap_S_StartSound(NULL, es->number, CHAN_BODY, + cgs.media.footsteps[ FOOTSTEP_SAND ][rand()&3]); + } + break; + case EV_FOOTSTEP_GRAVEL: + DEBUGNAME("EV_FOOTSTEP_GRAVEL"); + if (cg_footsteps.integer) { + trap_S_StartSound(NULL, es->number, CHAN_BODY, + cgs.media.footsteps[ FOOTSTEP_GRAVEL ][rand()&3]); + } + break; + case EV_FOOTSTEP_FOILAGE: + DEBUGNAME("EV_FOOTSTEP_FOILAGE"); + if (cg_footsteps.integer) { + trap_S_StartSound(NULL, es->number, CHAN_BODY, + cgs.media.footsteps[ FOOTSTEP_FOILAGE ][rand()&3]); + } + break; + case EV_FOOTSTEP_ICE: + DEBUGNAME("EV_FOOTSTEP_ICE"); + if (cg_footsteps.integer) { + trap_S_StartSound(NULL, es->number, CHAN_BODY, + cgs.media.footsteps[ FOOTSTEP_ICE ][rand()&3]); + } + break; + case EV_FOOTSTEP_GLASS: + DEBUGNAME("EV_FOOTSTEP_GLASS"); + if (cg_footsteps.integer) { + trap_S_StartSound(NULL, es->number, CHAN_BODY, + cgs.media.footsteps[ FOOTSTEP_GLASS ][rand()&3]); + } + break; case EV_FOOTSPLASH: DEBUGNAME("EV_FOOTSPLASH"); if (cg_footsteps.integer) { diff --git a/code/cgame/cg_info.c b/code/cgame/cg_info.c index 4d0c48e6..0d825237 100644 --- a/code/cgame/cg_info.c +++ b/code/cgame/cg_info.c @@ -292,8 +292,7 @@ void CG_DrawInformation( void ) { y += PROP_HEIGHT; } - /* Fraglimits are restricted to non-team-based games and Team Deathmatch */ - if (!CG_IsATeamGametype(cgs.gametype) || cgs.gametype == GT_TEAM ) { + if (cgs.gametype < GT_CTF || cgs.ffa_gt>0) { value = atoi( Info_ValueForKey( info, "fraglimit" ) ); if ( value ) { UI_DrawProportionalString( 320, y, va( "fraglimit %i", value ), @@ -301,7 +300,8 @@ void CG_DrawInformation( void ) { y += PROP_HEIGHT; } } - else { + + if (cgs.gametype >= GT_CTF && cgs.ffa_gt == 0) { value = atoi( Info_ValueForKey( info, "capturelimit" ) ); if ( value ) { UI_DrawProportionalString( 320, y, va( "capturelimit %i", value ), diff --git a/code/cgame/cg_local.h b/code/cgame/cg_local.h index ab62f6fa..68a25d19 100644 --- a/code/cgame/cg_local.h +++ b/code/cgame/cg_local.h @@ -88,15 +88,15 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // leilei - change these to sorceress for baseoa3 as there is no sarge or sergei #define DEFAULT_MODEL "sarge" #ifdef MISSIONPACK -#define DEFAULT_TEAM_MODEL "sergei" -#define DEFAULT_TEAM_HEAD "*sergei" +#define DEFAULT_TEAM_MODEL "sarge" +#define DEFAULT_TEAM_HEAD "sarge" #else #define DEFAULT_TEAM_MODEL "sarge" #define DEFAULT_TEAM_HEAD "sarge" #endif -#define DEFAULT_REDTEAM_NAME "Vim supporters" -#define DEFAULT_BLUETEAM_NAME "Emacs supporters" +#define DEFAULT_REDTEAM_NAME "Red" +#define DEFAULT_BLUETEAM_NAME "Blue" typedef enum { FOOTSTEP_NORMAL, @@ -106,6 +106,13 @@ typedef enum { FOOTSTEP_ENERGY, FOOTSTEP_METAL, FOOTSTEP_SPLASH, + FOOTSTEP_SNOW, + FOOTSTEP_WOOD, + FOOTSTEP_GRAVEL, + FOOTSTEP_SAND, + FOOTSTEP_FOILAGE, + FOOTSTEP_ICE, + FOOTSTEP_GLASS, FOOTSTEP_TOTAL } footstep_t; @@ -113,7 +120,11 @@ typedef enum { typedef enum { IMPACTSOUND_DEFAULT, IMPACTSOUND_METAL, - IMPACTSOUND_FLESH + IMPACTSOUND_FLESH, + IMPACTSOUND_GLASS, + IMPACTSOUND_SAND, + IMPACTSOUND_SNOW, + IMPACTSOUND_WOOD } impactSound_t; //================================================= @@ -223,6 +234,7 @@ typedef struct centity_s { int muztime[5]; int muzslot; float muzroll[5]; + vec3_t headpos; // leilei - position of the head model (for bubbles) } centity_t; @@ -746,6 +758,9 @@ typedef struct { #endif + vec3_t headpos[MAX_CLIENTS]; // head positions of each client + centity_t headent[MAX_CLIENTS]; // head's entity so we know which + int headon[MAX_CLIENTS]; } cg_t; @@ -1197,6 +1212,9 @@ typedef struct { int levelStartTime; +//Forced FFA + int ffa_gt; + //Elimination int roundStartTime; int roundtime; @@ -1337,6 +1355,7 @@ extern vmCvar_t cg_tracerLength; extern vmCvar_t cg_autoswitch; extern vmCvar_t cg_ignore; extern vmCvar_t cg_simpleItems; +extern vmCvar_t cg_alternateShell; extern vmCvar_t cg_fov; extern vmCvar_t cg_zoomFov; extern vmCvar_t cg_thirdPersonRange; @@ -1465,20 +1484,16 @@ extern vmCvar_t cg_ch12; extern vmCvar_t cg_ch12size; extern vmCvar_t cg_ch13; extern vmCvar_t cg_ch13size; -extern vmCvar_t cg_crosshairColorRed; -extern vmCvar_t cg_crosshairColorGreen; -extern vmCvar_t cg_crosshairColorBlue; -extern vmCvar_t cg_weaponBarStyle; -extern vmCvar_t cg_weaponOrder; -extern vmCvar_t cg_chatBeep; -extern vmCvar_t cg_teamChatBeep; -/* Neon_Knight: Toggleable missionpack checks. */ -extern vmCvar_t cg_missionpackChecks; -/* /Neon_Knight */ -extern vmCvar_t cg_leiChibi; -/* Neon_Knight: Developer mode. */ -extern vmCvar_t cg_developer; -/* /Neon_Knight */ + +extern vmCvar_t cg_crosshairColorRed; +extern vmCvar_t cg_crosshairColorGreen; +extern vmCvar_t cg_crosshairColorBlue; + +extern vmCvar_t cg_weaponBarStyle; + +extern vmCvar_t cg_weaponOrder; +extern vmCvar_t cg_chatBeep; +extern vmCvar_t cg_teamChatBeep; //unlagged - cg_unlagged.c void CG_PredictWeaponEffects( centity_t *cent ); @@ -1581,8 +1596,11 @@ void CG_DrawFlagModel( float x, float y, float w, float h, int team, qboolean fo void CG_DrawTeamBackground( int x, int y, int w, int h, float alpha, int team ); void CG_OwnerDraw(float x, float y, float w, float h, float text_x, float text_y, int ownerDraw, int ownerDrawFlags, int align, float special, float scale, vec4_t color, qhandle_t shader, int textStyle); void CG_Text_Paint(float x, float y, float scale, vec4_t color, const char *text, float adjust, int limit, int style); +#ifdef MISSIONPACK +void CG_Text_Paint_3D(float x, float y, float scale, vec4_t color, const char *text, float adjust, int limit, int style); int CG_Text_Width(const char *text, float scale, int limit); int CG_Text_Height(const char *text, float scale, int limit); +#endif void CG_SelectPrevPlayer( void ); void CG_SelectNextPlayer( void ); float CG_GetValue(int ownerDraw); @@ -1993,6 +2011,7 @@ extern qboolean initparticles; extern int wideAdjustX; void trap_R_LFX_ParticleEffect( int effect, const vec3_t origin, const vec3_t velocity ); // leilei - particle effects. this allows to pick an effect, such as.. +void trap_R_GetViewPosition( vec3_t point ); #define LFX_SMOKEPUFF 1; #define LFX_BULLETHIT 2; @@ -2036,11 +2055,3 @@ void trap_R_LFX_ParticleEffect( int effect, const vec3_t origin, const vec3_t ve #define LFX_FLASHPROX 70; #define LFX_FLASHVULCAN 71; -// LEILEI ENHANCEMENT - -/* Neon_Knight: Useful check in order to have code consistency. */ -qboolean CG_IsATeamGametype(int check); /* Whether the gametype is team-based or not.*/ -qboolean CG_UsesTeamFlags(int check); /* Whether the gametype uses the red and blue flags. */ -qboolean CG_UsesTheWhiteFlag(int check); /* Whether the gametype uses the neutral flag. */ -qboolean CG_IsARoundBasedGametype(int check); /* Whether the gametype uses the neutral flag. */ -/* /Neon_Knight */ diff --git a/code/cgame/cg_main.c b/code/cgame/cg_main.c index d1e38dd9..f0d6b33a 100644 --- a/code/cgame/cg_main.c +++ b/code/cgame/cg_main.c @@ -135,6 +135,7 @@ vmCvar_t cg_brassTime; vmCvar_t cg_viewsize; vmCvar_t cg_viewnudge; // leilei vmCvar_t cg_muzzleflashStyle; +vmCvar_t cg_alternateShell; vmCvar_t cg_drawGun; vmCvar_t cg_gun_frame; vmCvar_t cg_gun_x; @@ -251,7 +252,7 @@ vmCvar_t cl_timeNudge; //elimination addition vmCvar_t cg_alwaysWeaponBar; -vmCvar_t cg_hitsound; +vmCvar_t cg_hitSound; vmCvar_t cg_voip_teamonly; vmCvar_t cg_voteflags; vmCvar_t cg_cyclegrapple; @@ -298,13 +299,6 @@ vmCvar_t cg_weaponBarStyle; vmCvar_t cg_chatBeep; vmCvar_t cg_teamChatBeep; -/* Neon_Knight: Missionpack checks toggle. Just because. */ -vmCvar_t cg_missionpackChecks; -/* /Neon_Knight */ -/* Neon_Knight: Developer mode. */ -vmCvar_t cg_developer; -/* /Neon_Knight */ - typedef struct { vmCvar_t *vmCvar; char *cvarName; @@ -394,7 +388,7 @@ static cvarTable_t cvarTable[] = {// bk001129 { &cg_paused, "cl_paused", "0", CVAR_ROM}, { &cg_blood, "com_blood", "1", CVAR_ARCHIVE}, { &cg_alwaysWeaponBar, "cg_alwaysWeaponBar", "0", CVAR_ARCHIVE}, //Elimination - { &cg_hitsound, "cg_hitsound", "0", CVAR_ARCHIVE}, + { &cg_hitSound, "cg_hitSound", "1", CVAR_ARCHIVE}, { &cg_voip_teamonly, "cg_voipTeamOnly", "1", CVAR_ARCHIVE}, { &cg_voteflags, "cg_voteflags", "*", CVAR_ROM}, { &cg_cyclegrapple, "cg_cyclegrapple", "1", CVAR_ARCHIVE}, @@ -517,12 +511,7 @@ static cvarTable_t cvarTable[] = {// bk001129 {&cg_chatBeep, "cg_chatBeep", "1", CVAR_ARCHIVE}, {&cg_teamChatBeep, "cg_teamChatBeep", "1", CVAR_ARCHIVE}, { &cg_muzzleflashStyle, "cg_muzzleflashStyle", "1", CVAR_ARCHIVE}, -/* Neon_Knight: Enables MP checks. */ - { &cg_missionpackChecks, "missionpackChecks", "1", CVAR_ARCHIVE}, -/* /Neon_Knight */ -/* Neon_Knight: Enables MP checks. */ - { &cg_developer, "developer", "0", CVAR_CHEAT} -/* /Neon_Knight */ + { &cg_alternateShell, "cg_alternateShell", "0", CVAR_ARCHIVE}, }; static int cvarTableSize = sizeof ( cvarTable) / sizeof ( cvarTable[0]); @@ -550,11 +539,8 @@ void CG_RegisterCvars(void) { trap_Cvar_Register(NULL, "model", DEFAULT_MODEL, CVAR_USERINFO | CVAR_ARCHIVE); trap_Cvar_Register(NULL, "headmodel", DEFAULT_MODEL, CVAR_USERINFO | CVAR_ARCHIVE); - /* Neon_Knight: Missionpack checks, if != 0, enables this. */ - if (cg_missionpackChecks.integer) { - trap_Cvar_Register(NULL, "team_model", DEFAULT_TEAM_MODEL, CVAR_USERINFO | CVAR_ARCHIVE); - trap_Cvar_Register(NULL, "team_headmodel", DEFAULT_TEAM_HEAD, CVAR_USERINFO | CVAR_ARCHIVE); - } + trap_Cvar_Register(NULL, "team_model", DEFAULT_TEAM_MODEL, CVAR_USERINFO | CVAR_ARCHIVE); + trap_Cvar_Register(NULL, "team_headmodel", DEFAULT_TEAM_HEAD, CVAR_USERINFO | CVAR_ARCHIVE); } /* @@ -803,7 +789,8 @@ static void CG_RegisterSounds(void) { // N_G: Another condition that makes no sense to me, see for // yourself if you really meant this // Sago: Makes perfect sense: Load team game stuff if the gametype is a teamgame and not an exception (like GT_LMS) - if (CG_IsATeamGametype(cgs.gametype) || cg_buildScript.integer) { + if (((cgs.gametype >= GT_TEAM) && (cgs.ffa_gt != 1)) || + cg_buildScript.integer) { cgs.media.captureAwardSound = trap_S_RegisterSound("sound/teamplay/flagcapture_yourteam.wav", qtrue); cgs.media.redLeadsSound = trap_S_RegisterSound("sound/feedback/redleads.wav", qtrue); @@ -823,14 +810,14 @@ static void CG_RegisterSounds(void) { cgs.media.takenYourTeamSound = trap_S_RegisterSound("sound/teamplay/flagtaken_yourteam.wav", qtrue); cgs.media.takenOpponentSound = trap_S_RegisterSound("sound/teamplay/flagtaken_opponent.wav", qtrue); - if ((CG_UsesTeamFlags(cgs.gametype) && !CG_UsesTheWhiteFlag(cgs.gametype)) || cg_buildScript.integer) { + if (cgs.gametype == GT_CTF || cgs.gametype == GT_CTF_ELIMINATION || cg_buildScript.integer) { cgs.media.redFlagReturnedSound = trap_S_RegisterSound("sound/teamplay/voc_red_returned.wav", qtrue); cgs.media.blueFlagReturnedSound = trap_S_RegisterSound("sound/teamplay/voc_blue_returned.wav", qtrue); cgs.media.enemyTookYourFlagSound = trap_S_RegisterSound("sound/teamplay/voc_enemy_flag.wav", qtrue); cgs.media.yourTeamTookEnemyFlagSound = trap_S_RegisterSound("sound/teamplay/voc_team_flag.wav", qtrue); } - if (CG_UsesTheWhiteFlag(cgs.gametype) || cg_buildScript.integer) { + if (cgs.gametype == GT_1FCTF || cg_buildScript.integer) { // FIXME: get a replacement for this sound ? cgs.media.neutralFlagReturnedSound = trap_S_RegisterSound("sound/teamplay/flagreturn_opponent.wav", qtrue); cgs.media.yourTeamTookTheFlagSound = trap_S_RegisterSound("sound/teamplay/voc_team_1flag.wav", qtrue); @@ -849,7 +836,7 @@ static void CG_RegisterSounds(void) { } - if (CG_UsesTeamFlags(cgs.gametype) || CG_UsesTheWhiteFlag(cgs.gametype) || cg_buildScript.integer) { + if (cgs.gametype == GT_1FCTF || cgs.gametype == GT_CTF || cgs.gametype == GT_CTF_ELIMINATION || cgs.gametype == GT_POSSESSION || cg_buildScript.integer) { cgs.media.youHaveFlagSound = trap_S_RegisterSound("sound/teamplay/voc_you_flag.wav", qtrue); cgs.media.holyShitSound = trap_S_RegisterSound("sound/feedback/voc_holyshit.wav", qtrue); } @@ -902,12 +889,7 @@ static void CG_RegisterSounds(void) { cgs.media.talkSound = trap_S_RegisterSound("sound/player/talk.wav", qfalse); cgs.media.landSound = trap_S_RegisterSound("sound/player/land1.wav", qfalse); - switch (cg_hitsound.integer) { - - case 0: - default: - cgs.media.hitSound = trap_S_RegisterSound("sound/feedback/hit.wav", qfalse); - }; + cgs.media.hitSound = trap_S_RegisterSound("sound/feedback/hit.wav", qfalse); #ifdef MISSIONPACK cgs.media.hitSoundHighArmor = trap_S_RegisterSound("sound/feedback/hithi.wav", qfalse); @@ -963,6 +945,27 @@ static void CG_RegisterSounds(void) { Com_sprintf(name, sizeof (name), "sound/player/footsteps/clank%i.wav", i + 1); cgs.media.footsteps[FOOTSTEP_METAL][i] = trap_S_RegisterSound(name, qfalse); + + Com_sprintf(name, sizeof (name), "sound/player/footsteps/sand%i.wav", i + 1); + cgs.media.footsteps[FOOTSTEP_SAND][i] = trap_S_RegisterSound(name, qfalse); + + Com_sprintf(name, sizeof (name), "sound/player/footsteps/wood%i.wav", i + 1); + cgs.media.footsteps[FOOTSTEP_WOOD][i] = trap_S_RegisterSound(name, qfalse); + + Com_sprintf(name, sizeof (name), "sound/player/footsteps/gravel%i.wav", i + 1); + cgs.media.footsteps[FOOTSTEP_GRAVEL][i] = trap_S_RegisterSound(name, qfalse); + + Com_sprintf(name, sizeof (name), "sound/player/footsteps/snow%i.wav", i + 1); + cgs.media.footsteps[FOOTSTEP_SNOW][i] = trap_S_RegisterSound(name, qfalse); + + Com_sprintf(name, sizeof (name), "sound/player/footsteps/foilage%i.wav", i + 1); + cgs.media.footsteps[FOOTSTEP_FOILAGE][i] = trap_S_RegisterSound(name, qfalse); + + Com_sprintf(name, sizeof (name), "sound/player/footsteps/ice%i.wav", i + 1); + cgs.media.footsteps[FOOTSTEP_ICE][i] = trap_S_RegisterSound(name, qfalse); + + Com_sprintf(name, sizeof (name), "sound/player/footsteps/glass%i.wav", i + 1); + cgs.media.footsteps[FOOTSTEP_GLASS][i] = trap_S_RegisterSound(name, qfalse); } // only register the items that the server says we need @@ -1028,33 +1031,7 @@ static void CG_RegisterSounds(void) { cgs.media.hgrenb1aSound = trap_S_RegisterSound("sound/weapons/grenade/hgrenb1a.wav", qfalse); cgs.media.hgrenb2aSound = trap_S_RegisterSound("sound/weapons/grenade/hgrenb2a.wav", qfalse); -#ifdef MISSIONPACK - trap_S_RegisterSound("sound/player/sergei/death1.wav", qfalse); - trap_S_RegisterSound("sound/player/sergei/death2.wav", qfalse); - trap_S_RegisterSound("sound/player/sergei/death3.wav", qfalse); - trap_S_RegisterSound("sound/player/sergei/jump1.wav", qfalse); - trap_S_RegisterSound("sound/player/sergei/pain25_1.wav", qfalse); - trap_S_RegisterSound("sound/player/sergei/pain75_1.wav", qfalse); - trap_S_RegisterSound("sound/player/sergei/pain100_1.wav", qfalse); - trap_S_RegisterSound("sound/player/sergei/falling1.wav", qfalse); - trap_S_RegisterSound("sound/player/sergei/gasp.wav", qfalse); - trap_S_RegisterSound("sound/player/sergei/drown.wav", qfalse); - trap_S_RegisterSound("sound/player/sergei/fall1.wav", qfalse); - trap_S_RegisterSound("sound/player/sergei/taunt.wav", qfalse); - - trap_S_RegisterSound("sound/player/kyonshi/death1.wav", qfalse); - trap_S_RegisterSound("sound/player/kyonshi/death2.wav", qfalse); - trap_S_RegisterSound("sound/player/kyonshi/death3.wav", qfalse); - trap_S_RegisterSound("sound/player/kyonshi/jump1.wav", qfalse); - trap_S_RegisterSound("sound/player/kyonshi/pain25_1.wav", qfalse); - trap_S_RegisterSound("sound/player/kyonshi/pain75_1.wav", qfalse); - trap_S_RegisterSound("sound/player/kyonshi/pain100_1.wav", qfalse); - trap_S_RegisterSound("sound/player/kyonshi/falling1.wav", qfalse); - trap_S_RegisterSound("sound/player/kyonshi/gasp.wav", qfalse); - trap_S_RegisterSound("sound/player/kyonshi/drown.wav", qfalse); - trap_S_RegisterSound("sound/player/kyonshi/fall1.wav", qfalse); - trap_S_RegisterSound("sound/player/kyonshi/taunt.wav", qfalse); -#endif + } @@ -1165,14 +1142,14 @@ static void CG_RegisterGraphics(void) { cgs.media.regenShader = trap_R_RegisterShader("powerups/regen"); cgs.media.hastePuffShader = trap_R_RegisterShader("hasteSmokePuff"); - if (CG_UsesTeamFlags(cgs.gametype) || cgs.gametype == GT_HARVESTER || cg_buildScript.integer) { + if (cgs.gametype == GT_CTF || cgs.gametype == GT_CTF_ELIMINATION || cgs.gametype == GT_1FCTF || cgs.gametype == GT_HARVESTER || cg_buildScript.integer) { cgs.media.redCubeModel = trap_R_RegisterModel("models/powerups/orb/r_orb.md3"); cgs.media.blueCubeModel = trap_R_RegisterModel("models/powerups/orb/b_orb.md3"); cgs.media.redCubeIcon = trap_R_RegisterShader("icons/skull_red"); cgs.media.blueCubeIcon = trap_R_RegisterShader("icons/skull_blue"); } - if (CG_IsATeamGametype(cgs.gametype)) { + if ((cgs.gametype >= GT_TEAM) && (cgs.ffa_gt != 1)) { cgs.media.redOverlay = trap_R_RegisterShader("playeroverlays/playerSuit1_Red"); cgs.media.blueOverlay = trap_R_RegisterShader("playeroverlays/playerSuit1_Blue"); } else { @@ -1192,7 +1169,8 @@ static void CG_RegisterGraphics(void) { cgs.media.ddPointSkinB[TEAM_NONE] = trap_R_RegisterShaderNoMip("icons/noammo"); } - if (CG_UsesTeamFlags(cgs.gametype) || CG_UsesTheWhiteFlag(cgs.gametype) || cgs.gametype == GT_HARVESTER || cg_buildScript.integer) { + if (cgs.gametype == GT_CTF || cgs.gametype == GT_CTF_ELIMINATION || cgs.gametype == GT_1FCTF || cgs.gametype == GT_POSSESSION + || cgs.gametype == GT_HARVESTER || cg_buildScript.integer) { cgs.media.redFlagModel = trap_R_RegisterModel("models/flags/r_flag.md3"); cgs.media.blueFlagModel = trap_R_RegisterModel("models/flags/b_flag.md3"); cgs.media.neutralFlagModel = trap_R_RegisterModel("models/flags/n_flag.md3"); @@ -1214,7 +1192,7 @@ static void CG_RegisterGraphics(void) { cgs.media.neutralFlagBaseModel = trap_R_RegisterModel("models/mapobjects/flagbase/ntrl_base.md3"); } - if (CG_UsesTheWhiteFlag(cgs.gametype) || cg_buildScript.integer) { + if (cgs.gametype == GT_1FCTF || cgs.gametype == GT_POSSESSION || cg_buildScript.integer) { cgs.media.neutralFlagModel = trap_R_RegisterModel("models/flags/n_flag.md3"); cgs.media.flagShader[0] = trap_R_RegisterShaderNoMip("icons/iconf_neutral1"); cgs.media.flagShader[1] = trap_R_RegisterShaderNoMip("icons/iconf_red2"); @@ -1240,7 +1218,8 @@ static void CG_RegisterGraphics(void) { cgs.media.redKamikazeShader = trap_R_RegisterShader("models/weaphits/kamikred"); cgs.media.dustPuffShader = trap_R_RegisterShader("hasteSmokePuff"); - if (CG_IsATeamGametype(cgs.gametype) || cg_buildScript.integer) { + if (((cgs.gametype >= GT_TEAM) && (cgs.ffa_gt != 1)) || + cg_buildScript.integer) { cgs.media.friendShader = trap_R_RegisterShader("sprites/foe"); cgs.media.redQuadShader = trap_R_RegisterShader("powerups/blueflag"); @@ -2047,7 +2026,7 @@ void CG_SetScoreSelection(void *p) { return; } - if (CG_IsATeamGametype(cgs.gametype)) { + if (cgs.gametype >= GT_TEAM && cgs.ffa_gt != 1) { int feeder = FEEDER_REDTEAM_LIST; i = red; if (cg.scores[cg.selectedScore].team == TEAM_BLUE) { @@ -2064,7 +2043,7 @@ void CG_SetScoreSelection(void *p) { static clientInfo_t * CG_InfoFromScoreIndex(int index, int team, int *scoreIndex) { int i, count; - if (CG_IsATeamGametype(cgs.gametype)) { + if (cgs.gametype >= GT_TEAM && cgs.ffa_gt != 1) { count = 0; for (i = 0; i < cg.numScores; i++) { if (cg.scores[i].team == team) { @@ -2171,7 +2150,7 @@ static qhandle_t CG_FeederItemImage(float feederID, int index) { } static void CG_FeederSelection(float feederID, int index) { - if (CG_IsATeamGametype(cgs.gametype)) { + if (cgs.gametype >= GT_TEAM && cgs.ffa_gt != 1) { int i, count; int team = (feederID == FEEDER_REDTEAM_LIST) ? TEAM_RED : TEAM_BLUE; count = 0; @@ -2703,47 +2682,3 @@ void CG_FairCvars() { do_vid_restart = qtrue; } - - -/* Neon_Knight: Useful check in order to have code consistency. */ -/* -=================== -CG_IsATeamGametype - -Checks if the gametype is a team-based game. -=================== - */ -qboolean CG_IsATeamGametype(int gametype) { - return GAMETYPE_IS_A_TEAM_GAME(gametype); -} -/* -=================== -CG_UsesTeamFlags - -Checks if the gametype makes use of the red and blue flags. -=================== - */ -qboolean CG_UsesTeamFlags(int check) { - return GAMETYPE_USES_RED_AND_BLUE_FLAG(check); -} -/* -=================== -CG_UsesTheWhiteFlag - -Checks if the gametype makes use of the neutral flag. -=================== - */ -qboolean CG_UsesTheWhiteFlag(int check) { - return GAMETYPE_USES_WHITE_FLAG(check); -} -/* -=================== -CG_IsARoundBasedGametype - -Checks if the gametype has a round-based system. -=================== - */ -qboolean CG_IsARoundBasedGametype(int check) { - return GAMETYPE_IS_ROUND_BASED(check); -} -/* /Neon_Knight */ diff --git a/code/cgame/cg_newdraw.c b/code/cgame/cg_newdraw.c index 2adb2128..201413f8 100644 --- a/code/cgame/cg_newdraw.c +++ b/code/cgame/cg_newdraw.c @@ -60,7 +60,7 @@ void CG_SetPrintString(int type, const char *p) void CG_CheckOrderPending(void) { - if (!CG_IsATeamGametype(cgs.gametype)) { + if (cgs.gametype < GT_CTF || cgs.ffa_gt>0) { return; } if (cgs.orderPending) { @@ -695,7 +695,7 @@ static void CG_DrawBlueFlagName(rectDef_t *rect, float scale, vec4_t color, int static void CG_DrawBlueFlagStatus(rectDef_t *rect, qhandle_t shader) { - if (!CG_UsesTeamFlags(cgs.gametype)) { + if (cgs.gametype != GT_CTF && cgs.gametype != GT_CTF_ELIMINATION && cgs.gametype != GT_1FCTF) { if (cgs.gametype == GT_HARVESTER) { vec4_t color = {0, 0, 1, 1}; trap_R_SetColor(color); @@ -750,7 +750,7 @@ static void CG_DrawRedFlagName(rectDef_t *rect, float scale, vec4_t color, int t static void CG_DrawRedFlagStatus(rectDef_t *rect, qhandle_t shader) { - if (!CG_UsesTeamFlags(cgs.gametype)) { + if (cgs.gametype != GT_CTF && cgs.gametype != GT_CTF_ELIMINATION && cgs.gametype != GT_1FCTF) { if (cgs.gametype == GT_HARVESTER) { vec4_t color = {1, 0, 0, 1}; trap_R_SetColor(color); @@ -840,7 +840,7 @@ static void CG_HarvesterSkulls(rectDef_t *rect, float scale, vec4_t color, qbool static void CG_OneFlagStatus(rectDef_t *rect) { - if (!CG_UsesTheWhiteFlag(cgs.gametype)) { + if (cgs.gametype != GT_1FCTF && cgs.gametype != GT_POSSESSION) { return; } else { @@ -872,7 +872,7 @@ static void CG_DrawCTFPowerUp(rectDef_t *rect) { int value; - if (!CG_IsATeamGametype(cgs.gametype)) { + if (cgs.gametype < GT_CTF || cgs.ffa_gt>0) { return; } value = cg.snap->ps.stats[STAT_PERSISTANT_POWERUP]; @@ -1024,7 +1024,7 @@ float CG_GetValue(int ownerDraw) qboolean CG_OtherTeamHasFlag(void) { - if (CG_UsesTeamFlags(cgs.gametype)) { + if (cgs.gametype == GT_CTF || cgs.gametype == GT_CTF_ELIMINATION || cgs.gametype == GT_1FCTF) { int team = cg.snap->ps.persistant[PERS_TEAM]; if (cgs.gametype == GT_1FCTF) { if (team == TEAM_RED && cgs.flagStatus == FLAG_TAKEN_BLUE) { @@ -1054,7 +1054,7 @@ qboolean CG_OtherTeamHasFlag(void) qboolean CG_YourTeamHasFlag(void) { - if (CG_UsesTeamFlags(cgs.gametype)) { + if (cgs.gametype == GT_CTF || cgs.gametype == GT_CTF_ELIMINATION || cgs.gametype == GT_1FCTF) { int team = cg.snap->ps.persistant[PERS_TEAM]; if (cgs.gametype == GT_1FCTF) { if (team == TEAM_RED && cgs.flagStatus == FLAG_TAKEN_RED) { @@ -1114,13 +1114,13 @@ qboolean CG_OwnerDrawVisible(int flags) } if (flags & CG_SHOW_ANYTEAMGAME) { - if(CG_IsATeamGametype(cgs.gametype)) { + if( cgs.gametype >= GT_TEAM && cgs.ffa_gt!=1) { return qtrue; } } if (flags & CG_SHOW_ANYNONTEAMGAME) { - if(!CG_IsATeamGametype(cgs.gametype)) { + if( cgs.gametype < GT_TEAM || cgs.ffa_gt==1) { return qtrue; } } @@ -1144,7 +1144,7 @@ qboolean CG_OwnerDrawVisible(int flags) } if (flags & CG_SHOW_CTF) { - if(CG_UsesTeamFlags(cgs.gametype) && !CG_UsesTheWhiteFlag(cgs.gametype)) { + if( cgs.gametype == GT_CTF || cgs.gametype == GT_CTF_ELIMINATION) { return qtrue; } } @@ -1247,7 +1247,7 @@ static void CG_DrawKiller(rectDef_t *rect, float scale, vec4_t color, qhandle_t static void CG_DrawCapFragLimit(rectDef_t *rect, float scale, vec4_t color, qhandle_t shader, int textStyle) { - int limit = (CG_IsATeamGametype(cgs.gametype) && cgs.gametype != GT_TEAM) ? cgs.capturelimit : cgs.fraglimit; + int limit = (cgs.gametype >= GT_CTF && cgs.ffa_gt==0) ? cgs.capturelimit : cgs.fraglimit; CG_Text_Paint(rect->x, rect->y, scale, color, va("%2i", limit),0, 0, textStyle); } @@ -1268,7 +1268,7 @@ static void CG_Draw2ndPlace(rectDef_t *rect, float scale, vec4_t color, qhandle_ const char *CG_GetGameStatusText(void) { const char *s = ""; - if (!CG_IsATeamGametype(cgs.gametype)) { + if ( cgs.gametype < GT_TEAM || cgs.ffa_gt==1) { if (cg.snap->ps.persistant[PERS_TEAM] != TEAM_SPECTATOR ) { s = va("%s place with %i",CG_PlaceString( cg.snap->ps.persistant[PERS_RANK] + 1 ),cg.snap->ps.persistant[PERS_SCORE] ); } @@ -1977,9 +1977,9 @@ static void CG_DrawCaptureLimit( rectDef_t *rect, float text_x, float text_y, ve int value; info = CG_ConfigString( CS_SERVERINFO ); value = atoi( Info_ValueForKey( info, "capturelimit" ) ); - if (CG_IsATeamGametype(cgs.gametype) && cgs.gametype != GT_TEAM) + if (cgs.gametype >= GT_CTF && cgs.ffa_gt == 0) value = atoi( Info_ValueForKey( info, "capturelimit" ) ); - else + if (cgs.gametype < GT_CTF || cgs.ffa_gt>0) value = atoi( Info_ValueForKey( info, "fraglimit" ) ); if ( value ) { CG_DrawLoadingString( rect, text_x, text_y, color, scale, align, textStyle, va( "%i", value )); diff --git a/code/cgame/cg_players.c b/code/cgame/cg_players.c index e9e6dd07..a060fc46 100644 --- a/code/cgame/cg_players.c +++ b/code/cgame/cg_players.c @@ -466,7 +466,7 @@ static qboolean CG_FindClientModelFile(char *filename, int length, clientInfo_t char *team, *charactersFolder; int i; - if (CG_IsATeamGametype(cgs.gametype)) { + if (cgs.gametype >= GT_TEAM && cgs.ffa_gt != 1) { switch (ci->team) { case TEAM_BLUE: { @@ -495,7 +495,7 @@ static qboolean CG_FindClientModelFile(char *filename, int length, clientInfo_t if (CG_FileExists(filename)) { return qtrue; } - if (CG_IsATeamGametype(cgs.gametype)) { + if (cgs.gametype >= GT_TEAM && cgs.ffa_gt != 1) { if (i == 0 && teamName && *teamName) { // "models/players/characters/sergei/stroggs/lower_red.skin" Com_sprintf(filename, length, "models/players/%s%s/%s%s_%s.%s", charactersFolder, modelName, teamName, base, team, ext); @@ -538,7 +538,7 @@ static qboolean CG_FindClientHeadFile(char *filename, int length, clientInfo_t * char *team, *headsFolder; int i; - if (CG_IsATeamGametype(cgs.gametype)) { + if (cgs.gametype >= GT_TEAM && cgs.ffa_gt != 1) { switch (ci->team) { case TEAM_BLUE: { @@ -571,7 +571,7 @@ static qboolean CG_FindClientHeadFile(char *filename, int length, clientInfo_t * if (CG_FileExists(filename)) { return qtrue; } - if (CG_IsATeamGametype(cgs.gametype)) { + if (cgs.gametype >= GT_TEAM && cgs.ffa_gt != 1) { if (i == 0 && teamName && *teamName) { Com_sprintf(filename, length, "models/players/%s%s/%s%s_%s.%s", headsFolder, headModelName, teamName, base, team, ext); } else { @@ -857,7 +857,7 @@ static void CG_LoadClientInfo(int clientNum, clientInfo_t *ci) { teamname[0] = 0; #ifdef MISSIONPACK - if (CG_IsATeamGametype(cgs.gametype)) { + if (cgs.gametype >= GT_TEAM && cgs.ffa_gt != 1) { if (ci->team == TEAM_BLUE) { Q_strncpyz(teamname, cg_blueTeamName.string, sizeof (teamname)); } else { @@ -875,20 +875,16 @@ static void CG_LoadClientInfo(int clientNum, clientInfo_t *ci) { } // fall back to default team name - if (CG_IsATeamGametype(cgs.gametype)) { + if (cgs.gametype >= GT_TEAM && cgs.ffa_gt != 1) { // keep skin name if (ci->team == TEAM_BLUE) { Q_strncpyz(teamname, DEFAULT_BLUETEAM_NAME, sizeof (teamname)); } else { Q_strncpyz(teamname, DEFAULT_REDTEAM_NAME, sizeof (teamname)); } - /* Neon_Knight: Missionpack checks, if != 0, enables this. */ - if (cg_missionpackChecks.integer != 0) { - if (!CG_RegisterClientModelname(ci, DEFAULT_TEAM_MODEL, ci->skinName, DEFAULT_TEAM_HEAD, ci->skinName, teamname)) { - CG_Error("DEFAULT_TEAM_MODEL / skin (%s/%s) failed to register", DEFAULT_TEAM_MODEL, ci->skinName); - } + if (!CG_RegisterClientModelname(ci, DEFAULT_TEAM_MODEL, ci->skinName, DEFAULT_TEAM_HEAD, ci->skinName, teamname)) { + CG_Error("DEFAULT_TEAM_MODEL / skin (%s/%s) failed to register", DEFAULT_TEAM_MODEL, ci->skinName); } - /* /Neon_Knight */ } else { if (!CG_RegisterClientModelname(ci, DEFAULT_MODEL, "default", DEFAULT_MODEL, "default", teamname)) { CG_Error("DEFAULT_MODEL (%s) failed to register", DEFAULT_MODEL); @@ -908,7 +904,7 @@ static void CG_LoadClientInfo(int clientNum, clientInfo_t *ci) { // sounds dir = ci->modelName; - fallback = (CG_IsATeamGametype(cgs.gametype)) ? DEFAULT_TEAM_MODEL : DEFAULT_MODEL; + fallback = (cgs.gametype >= GT_TEAM && cgs.ffa_gt != 1) ? DEFAULT_TEAM_MODEL : DEFAULT_MODEL; for (i = 0; i < MAX_CUSTOM_SOUNDS; i++) { s = cg_customSoundNames[i]; @@ -920,13 +916,9 @@ static void CG_LoadClientInfo(int clientNum, clientInfo_t *ci) { if (modelloaded) { ci->sounds[i] = trap_S_RegisterSound(va("sound/player/%s/%s", dir, s + 1), qfalse); } - /* Neon_Knight: Missionpack checks, if != 0, enables this. */ - if (cg_missionpackChecks.integer) { - if (!ci->sounds[i]) { - ci->sounds[i] = trap_S_RegisterSound(va("sound/player/%s/%s", fallback, s + 1), qfalse); - } + if (!ci->sounds[i]) { + ci->sounds[i] = trap_S_RegisterSound(va("sound/player/%s/%s", fallback, s + 1), qfalse); } - /* /Neon_Knight */ } ci->deferred = qfalse; @@ -989,7 +981,7 @@ static qboolean CG_ScanForExistingClientInfo(clientInfo_t *ci) { && Q_strequal(ci->headSkinName, match->headSkinName) && Q_strequal(ci->blueTeam, match->blueTeam) && Q_strequal(ci->redTeam, match->redTeam) - && (!CG_IsATeamGametype(cgs.gametype) || ci->team == match->team)) { + && (cgs.gametype < GT_TEAM || cgs.ffa_gt == 1 || ci->team == match->team)) { // this clientinfo is identical, so use it's handles ci->deferred = qfalse; @@ -1025,7 +1017,7 @@ static void CG_SetDeferredClientInfo(int clientNum, clientInfo_t *ci) { } if (!Q_strequal(ci->skinName, match->skinName) || !Q_strequal(ci->modelName, match->modelName) || - (CG_IsATeamGametype(cgs.gametype) && ci->team != match->team)) { + (cgs.gametype >= GT_TEAM && cgs.ffa_gt != 1 && ci->team != match->team)) { continue; } // just load the real info cause it uses the same models and skins @@ -1034,14 +1026,14 @@ static void CG_SetDeferredClientInfo(int clientNum, clientInfo_t *ci) { } // if we are in teamplay, only grab a model if the skin is correct - if (CG_IsATeamGametype(cgs.gametype)) { + if (cgs.gametype >= GT_TEAM && cgs.ffa_gt != 1) { for (i = 0; i < cgs.maxclients; i++) { match = &cgs.clientinfo[ i ]; if (!match->infoValid || match->deferred) { continue; } if (!Q_strequal(ci->skinName, match->skinName) || - (CG_IsATeamGametype(cgs.gametype) && ci->team != match->team)) { + (cgs.gametype >= GT_TEAM && cgs.ffa_gt != 1 && ci->team != match->team)) { continue; } ci->deferred = qtrue; @@ -1151,12 +1143,9 @@ void CG_NewClientInfo(int clientNum) { char modelStr[MAX_QPATH]; char *skin; - /* Neon_Knight: Missionpack checks, if != 0, enables this. */ - if (cg_missionpackChecks.integer) { - if (CG_IsATeamGametype(cgs.gametype)) { - Q_strncpyz(newInfo.modelName, DEFAULT_TEAM_MODEL, sizeof ( newInfo.modelName)); - Q_strncpyz(newInfo.skinName, "default", sizeof ( newInfo.skinName)); - } + if (cgs.gametype >= GT_TEAM && cgs.ffa_gt != 1) { + Q_strncpyz(newInfo.modelName, DEFAULT_TEAM_MODEL, sizeof ( newInfo.modelName)); + Q_strncpyz(newInfo.skinName, "default", sizeof ( newInfo.skinName)); } else { trap_Cvar_VariableStringBuffer("model", modelStr, sizeof ( modelStr)); if ((skin = strchr(modelStr, '/')) == NULL) { @@ -1168,8 +1157,8 @@ void CG_NewClientInfo(int clientNum) { Q_strncpyz(newInfo.skinName, skin, sizeof ( newInfo.skinName)); Q_strncpyz(newInfo.modelName, modelStr, sizeof ( newInfo.modelName)); } - /* /Neon_Knight */ - if (CG_IsATeamGametype(cgs.gametype)) { + + if (cgs.gametype >= GT_TEAM && cgs.ffa_gt != 1) { // keep skin name slash = strchr(v, '/'); if (slash) { @@ -1198,12 +1187,9 @@ void CG_NewClientInfo(int clientNum) { char modelStr[MAX_QPATH]; char *skin; - /* Neon_Knight: Missionpack checks, if != 0, enables this. */ - if (cg_missionpackChecks.integer) { - if (CG_IsATeamGametype(cgs.gametype)) { - Q_strncpyz(newInfo.headModelName, DEFAULT_TEAM_MODEL, sizeof ( newInfo.headModelName)); - Q_strncpyz(newInfo.headSkinName, "default", sizeof ( newInfo.headSkinName)); - } + if (cgs.gametype >= GT_TEAM && cgs.ffa_gt != 1) { + Q_strncpyz(newInfo.headModelName, DEFAULT_TEAM_MODEL, sizeof ( newInfo.headModelName)); + Q_strncpyz(newInfo.headSkinName, "default", sizeof ( newInfo.headSkinName)); } else { trap_Cvar_VariableStringBuffer("headmodel", modelStr, sizeof ( modelStr)); if ((skin = strchr(modelStr, '/')) == NULL) { @@ -1215,9 +1201,8 @@ void CG_NewClientInfo(int clientNum) { Q_strncpyz(newInfo.headSkinName, skin, sizeof ( newInfo.headSkinName)); Q_strncpyz(newInfo.headModelName, modelStr, sizeof ( newInfo.headModelName)); } - /* /Neon_Knight */ - if (CG_IsATeamGametype(cgs.gametype)) { + if (cgs.gametype >= GT_TEAM && cgs.ffa_gt != 1) { // keep skin name slash = strchr(v, '/'); if (slash) { @@ -1756,6 +1741,12 @@ static void CG_PlayerAngles(centity_t *cent, vec3_t legs[3], vec3_t torso[3], ve legsAngles[ROLL] = 0.0f; } + // leilei - don't lean for our new strafe animations + if ((cent->currentState.legsAnim & ~ANIM_TOGGLEBIT) == LEGS_STRAFE_LEFT || (cent->currentState.legsAnim & ~ANIM_TOGGLEBIT) == LEGS_STRAFE_RIGHT) { + legsAngles[YAW] = torsoAngles[YAW]; + legsAngles[ROLL] = 0.0f; + } + } // pain twitch @@ -2197,6 +2188,94 @@ static void CG_PlayerFloatSprite(centity_t *cent, qhandle_t shader) { trap_R_AddRefEntityToScene(&ent); } + +// leilei - Print their name over their head. Through walls. +static void CG_FloatName(centity_t *cent) { +#ifdef MISSIONPACK + int rf; + int them; + clientInfo_t *ci; + refEntity_t ent; + float textsize; + int x, y, w, chaty, vx, vy, sx, sy, tx, ty, nx, ny; + int l, h, i; + vec4_t color; + vec3_t vp; + char *start; + vec3_t not; + trace_t tr; + + float scl = cgs.screenYScale; // OA3 only scales vertically + if (scl<1) scl=1; + + textsize = 0.1875 * scl; // use the tiny pixel font + if (textsize < 0.1875) textsize = 0.1875; + if (textsize > 0.4) textsize = 0.4; // don't allow the huge font + + vp[0] = cent->headpos[0]; + vp[1] = cent->headpos[1]; + vp[2] = cent->headpos[2]; + + color[3] = 1; + + CG_Trace( &tr, cg.refdef.vieworg, not, not, vp, cg.predictedPlayerState.clientNum, MASK_SOLID ); + if (tr.fraction < 1) + color[3] = 0.3f; // fade names through walls + // return; // don't do names not in the view. + + VectorCopy(cg.headpos[cent->currentState.clientNum], vp); + + if (!vp[0] && !vp[1] && !vp[2]) + return; // ain't working + + color[0] = 0; + color[1] = 1; // green is for friend + color[2] = 0; + + vp[2] += 16; + trap_R_GetViewPosition( vp ); + + // It's time to print + x=vp[0]; + y=vp[1]; + + start = cgs.clientinfo[ cent->currentState.clientNum ].name; + + while (1) { + char linebuffer[256]; + + for (l = 0; l < 50; l++) { + if (!start[l] || start[l] == '\n') { + break; + } + linebuffer[l] = start[l]; + } + linebuffer[l] = 0; + + w = CG_Text_Width(linebuffer, 0.25, 0); + h = CG_Text_Height(linebuffer, 0.25, 0); + vx = x; + vy = (cg.refdef.height - y); + if (x<1) x=1; + if (y<1) y=1; + tx = (vx); + ty = vy; + + CG_Text_Paint_3D(tx-32, ty, textsize, color, linebuffer, 0, 0, 0); + y += h + 6; + while (*start && (*start != '\n')) { + start++; + } + if (!*start) { + break; + } + start++; + } + +#endif +} + + /* =============== CG_PlayerSprites @@ -2250,14 +2329,30 @@ static void CG_PlayerSprites(centity_t *cent) { team = cgs.clientinfo[ cent->currentState.clientNum ].team; if (!(cent->currentState.eFlags & EF_DEAD) && cg.snap->ps.persistant[PERS_TEAM] == team && - CG_IsATeamGametype(cgs.gametype)) { - if (cg_drawFriend.integer) { + cgs.gametype >= GT_TEAM && cgs.ffa_gt != 1) { + if (cg_drawFriend.integer == 2){ // leilei - name tags + cg.headon[ cent->currentState.clientNum ] = 0; + VectorCopy(cent->headpos,cg.headpos[cent->currentState.clientNum]); + cg.headent[ cent->currentState.clientNum ] = *cent; + } + else if (cg_drawFriend.integer) CG_PlayerFloatSprite(cent, cgs.media.friendShader); - } + return; } } +void CG_PlayerSpritesOverWorld(centity_t *cent) { + int team; + + if (!cg.headon[ cent->currentState.clientNum ]){ + CG_FloatName(cent); + cg.headon[ cent->currentState.clientNum ] = 1; // applied directly + } + + +} + /* =============== CG_PlayerShadow @@ -2419,40 +2514,84 @@ void CG_AddRefEntityWithPowerups(refEntity_t *ent, entityState_t *state, int tea trap_R_AddRefEntityToScene(ent); } } else { + if (cg_alternateShell.integer < 2) // leilei - skip the shell for the glow trap_R_AddRefEntityToScene(ent); if (!isMissile && (cgs.dmflags & DF_PLAYER_OVERLAY) && !(state->eFlags & EF_DEAD)) { - switch (team) { - case TEAM_RED: - ent->customShader = cgs.media.redOverlay; - trap_R_AddRefEntityToScene(ent); - break; - case TEAM_BLUE: - ent->customShader = cgs.media.blueOverlay; - trap_R_AddRefEntityToScene(ent); - break; - default: - ent->customShader = cgs.media.neutralOverlay; - trap_R_AddRefEntityToScene(ent); - } + if (cg_alternateShell.integer > 1){ + ent->glow = 1337; + switch (team) { + case TEAM_RED: + ent->glowcol = 0xF80A85; + break; + case TEAM_BLUE: + ent->glowcol = 0x0585FD; + break; + default: + ent->glowcol = 0xA0A0A0; + } + } + else + { + switch (team) { + case TEAM_RED: + ent->customShader = cgs.media.redOverlay; + trap_R_AddRefEntityToScene(ent); + break; + case TEAM_BLUE: + ent->customShader = cgs.media.blueOverlay; + trap_R_AddRefEntityToScene(ent); + break; + default: + ent->customShader = cgs.media.neutralOverlay; + trap_R_AddRefEntityToScene(ent); + } + } } if (state->powerups & (1 << PW_QUAD)) { + if (cg_alternateShell.integer > 1){ + ent->glow = 1338; + if (team == TEAM_RED) + ent->glowcol = 0xFF3040; + else + ent->glowcol = 0x0040E2; + + } + else + { if (team == TEAM_RED) ent->customShader = cgs.media.redQuadShader; else ent->customShader = cgs.media.quadShader; trap_R_AddRefEntityToScene(ent); + } } if (state->powerups & (1 << PW_REGEN)) { if (((cg.time / 100) % 10) == 1) { - ent->customShader = cgs.media.regenShader; - trap_R_AddRefEntityToScene(ent); + if (cg_alternateShell.integer > 1){ + ent->glow = 1337; + ent->glowcol = 0xFF6080; + } + else + { + ent->customShader = cgs.media.regenShader; + trap_R_AddRefEntityToScene(ent); + } } } if (state->powerups & (1 << PW_BATTLESUIT)) { - ent->customShader = cgs.media.battleSuitShader; - trap_R_AddRefEntityToScene(ent); + if (cg_alternateShell.integer > 1){ + ent->glow = 1340; + ent->glowcol = 0xE29000; + } + else + { + ent->customShader = cgs.media.battleSuitShader; + trap_R_AddRefEntityToScene(ent); + } } + if (cg_alternateShell.integer > 1) // NOW add the entity for the glow + trap_R_AddRefEntityToScene(ent); } } @@ -2523,37 +2662,6 @@ void CG_Player(centity_t *cent) { float angle; vec3_t dir, angles; int camereyes = 0; - // leilei - chibi hack - float chibifactorbody = 0.0f; - float chibifactortorso = 0.0f; - float chibifactorhead = 0.0f; - - if (cg_leiChibi.integer > 0) { - if (cg_leiChibi.integer == 1) { - // chibi SD proportion - chibifactortorso = 0.0f; - chibifactorbody = 0.62f; - chibifactorhead = 2.7f; - } else if (cg_leiChibi.integer == 2) { - // slightly younger proportion - chibifactorbody = 0.92f; - chibifactortorso = 0.82f; - chibifactorhead = 1.30f; - } else if (cg_leiChibi.integer == 3) { - // slightly more 'real' proportion - chibifactorbody = 0.92f; - chibifactortorso = 0.97f; - chibifactorhead = 0.92f; - } else if (cg_leiChibi.integer == 4) { - // big torso - chibifactorbody = 0.85f; - chibifactortorso = 1.3f; - chibifactorhead = 0.91f; - } - } else { - chibifactorbody = chibifactortorso = chibifactorhead = 0; // normal scale... - } - // the client number is stored in clientNum. It can't be derived // from the entity number, because a single client may have @@ -2624,14 +2732,6 @@ void CG_Player(centity_t *cent) { VectorCopy(cent->lerpOrigin, legs.lightingOrigin); - // leilei - chibi mode hack - if (chibifactorbody) { - VectorScale(legs.axis[0], chibifactorbody, legs.axis[0]); - VectorScale(legs.axis[1], chibifactorbody, legs.axis[1]); - VectorScale(legs.axis[2], chibifactorbody, legs.axis[2]); - } - - // leilei - q scale hack if (cg_enableQ.integer) { @@ -2758,16 +2858,6 @@ void CG_Player(centity_t *cent) { } - if (chibifactortorso) { - VectorScale(torso.axis[0], chibifactortorso, torso.axis[0]); - VectorScale(torso.axis[1], chibifactortorso, torso.axis[1]); - VectorScale(torso.axis[2], chibifactortorso, torso.axis[2]); - } - - - - - CG_AddRefEntityWithPowerups(&torso, ¢->currentState, ci->team, qfalse); if (cent->currentState.eFlags & EF_KAMIKAZE) { @@ -2983,6 +3073,7 @@ void CG_Player(centity_t *cent) { VectorCopy(cent->lerpOrigin, head.lightingOrigin); CG_PositionRotatedEntityOnTag(&head, &torso, ci->torsoModel, "tag_head"); + VectorCopy(head.origin,cent->headpos); // leilei - copy this position so names/bubbles can work // // add the eyes @@ -3031,16 +3122,6 @@ void CG_Player(centity_t *cent) { head.shadowPlane = shadowPlane; head.renderfx = renderfx; - - // leilei - chibi mode hack - if (chibifactorhead) { - VectorScale(head.axis[0], chibifactorhead, head.axis[0]); - VectorScale(head.axis[1], chibifactorhead, head.axis[1]); - VectorScale(head.axis[2], chibifactorhead, head.axis[2]); - } - - - CG_AddRefEntityWithPowerups(&head, ¢->currentState, ci->team, qfalse); CG_BreathPuffs(cent, &head); diff --git a/code/cgame/cg_playerstate.c b/code/cgame/cg_playerstate.c index a8bb4360..fbe2493f 100644 --- a/code/cgame/cg_playerstate.c +++ b/code/cgame/cg_playerstate.c @@ -337,7 +337,7 @@ void CG_CheckLocalSounds( playerState_t *ps, playerState_t *ops ) { // reward sounds reward = qfalse; if (ps->persistant[PERS_CAPTURES] != ops->persistant[PERS_CAPTURES]) { - pushReward(0, cgs.media.medalCapture, ps->persistant[PERS_CAPTURES]); + pushReward(cgs.media.captureAwardSound, cgs.media.medalCapture, ps->persistant[PERS_CAPTURES]); reward = qtrue; //Com_Printf("capture\n"); } @@ -415,7 +415,7 @@ void CG_CheckLocalSounds( playerState_t *ps, playerState_t *ops ) { } // check for flag pickup - if (CG_UsesTeamFlags(cgs.gametype)) { + if ( cgs.gametype > GT_TEAM ) { if ((ps->powerups[PW_REDFLAG] != ops->powerups[PW_REDFLAG] && ps->powerups[PW_REDFLAG]) || (ps->powerups[PW_BLUEFLAG] != ops->powerups[PW_BLUEFLAG] && ps->powerups[PW_BLUEFLAG]) || (ps->powerups[PW_NEUTRALFLAG] != ops->powerups[PW_NEUTRALFLAG] && ps->powerups[PW_NEUTRALFLAG]) ) @@ -430,7 +430,7 @@ void CG_CheckLocalSounds( playerState_t *ps, playerState_t *ops ) { if ( !cg.warmup ) { // never play lead changes during warmup if ( ps->persistant[PERS_RANK] != ops->persistant[PERS_RANK] ) { - if (!CG_IsATeamGametype(cgs.gametype)) { + if ( cgs.gametype < GT_TEAM || cgs.ffa_gt==1) { if ( ps->persistant[PERS_RANK] == 0 ) { CG_AddBufferedSound(cgs.media.takenLeadSound); } else if ( ps->persistant[PERS_RANK] == RANK_TIED_FLAG && cgs.gametype != GT_POSSESSION ) { @@ -463,7 +463,7 @@ void CG_CheckLocalSounds( playerState_t *ps, playerState_t *ops ) { } // fraglimit warnings - if (!CG_IsATeamGametype(cgs.gametype)) { + if ( cgs.fraglimit > 0 && cgs.gametype < GT_CTF) { highScore = cgs.scores1; if (cgs.gametype == GT_TEAM && cgs.scores2 > highScore) { diff --git a/code/cgame/cg_predict.c b/code/cgame/cg_predict.c index 1c3816c9..f06fd677 100644 --- a/code/cgame/cg_predict.c +++ b/code/cgame/cg_predict.c @@ -263,12 +263,9 @@ static void CG_TouchItem( centity_t *cent ) { //For instantgib qboolean canBePicked; - if(CG_IsARoundBasedGametype(cgs.gametype) && !CG_UsesTeamFlags(cgs.gametype)) + if(cgs.gametype == GT_ELIMINATION || cgs.gametype == GT_LMS) return; //No weapon pickup in elimination - if(CG_IsARoundBasedGametype(cgs.gametype) && cgs.roundStartTime > cgs.roundtime) - return; //We cannot pickup before the round has started - //normally we can canBePicked = qtrue; @@ -307,7 +304,7 @@ static void CG_TouchItem( centity_t *cent ) { } } - if (cgs.gametype == GT_CTF || cgs.gametype == GT_CTF_ELIMINATION ) { + if( cgs.gametype == GT_CTF || cgs.gametype == GT_CTF_ELIMINATION || cgs.gametype == GT_HARVESTER ) { if (cg.predictedPlayerState.persistant[PERS_TEAM] == TEAM_RED && item->giType == IT_TEAM && item->giTag == PW_REDFLAG) return; diff --git a/code/cgame/cg_public.h b/code/cgame/cg_public.h index caefff0a..5a8890eb 100644 --- a/code/cgame/cg_public.h +++ b/code/cgame/cg_public.h @@ -183,7 +183,8 @@ typedef enum { CG_TESTPRINTINT, CG_TESTPRINTFLOAT, CG_ACOS, - CG_R_LFX_PARTICLEEFFECT // leilei - particle effects + CG_R_LFX_PARTICLEEFFECT, // leilei - particle effects + CG_R_VIEWPOSITION } cgameImport_t; diff --git a/code/cgame/cg_scoreboard.c b/code/cgame/cg_scoreboard.c index f54d76ea..efe0779b 100644 --- a/code/cgame/cg_scoreboard.c +++ b/code/cgame/cg_scoreboard.c @@ -190,7 +190,8 @@ static void CG_DrawClientScore(int y, score_t *score, float *color, float fade, localClient = qtrue; if ((cg.snap->ps.persistant[PERS_TEAM] == TEAM_SPECTATOR) || - CG_IsATeamGametype(cgs.gametype)) { + ((cgs.gametype >= GT_TEAM) && + (cgs.ffa_gt != 1))) { // Sago: I think this means that it doesn't matter if two players are tied in team game - only team score counts rank = -1; } else { @@ -324,7 +325,7 @@ qboolean CG_DrawOldScoreboard(void) { } // current rank - if (!CG_IsATeamGametype(cgs.gametype)) { + if (cgs.gametype < GT_TEAM || cgs.ffa_gt == 1) { if (cg.snap->ps.persistant[PERS_TEAM] != TEAM_SPECTATOR) { s = va("%s place with %i", CG_PlaceString(cg.snap->ps.persistant[PERS_RANK] + 1), @@ -374,7 +375,7 @@ qboolean CG_DrawOldScoreboard(void) { localClient = qfalse; - if (CG_IsATeamGametype(cgs.gametype)) { + if (cgs.gametype >= GT_TEAM && cgs.ffa_gt != 1) { // // teamplay scoreboard // @@ -505,7 +506,7 @@ void CG_DrawTourneyScoreboard(void) { // print the two scores y = 160; - if (CG_IsATeamGametype(cgs.gametype)) { + if (cgs.gametype >= GT_TEAM && cgs.ffa_gt != 1) { // // teamplay scoreboard // diff --git a/code/cgame/cg_servercmds.c b/code/cgame/cg_servercmds.c index a309c3e0..d56a22bd 100644 --- a/code/cgame/cg_servercmds.c +++ b/code/cgame/cg_servercmds.c @@ -79,7 +79,7 @@ static void CG_ParseScores( void ) { cgs.roundStartTime = atoi( CG_Argv( 4 ) ); //Update thing in lower-right corner - if(CG_IsARoundBasedGametype(cgs.gametype) && CG_IsATeamGametype(cgs.gametype)) + if(cgs.gametype == GT_ELIMINATION || cgs.gametype == GT_CTF_ELIMINATION) { cgs.scores1 = cg.teamScores[0]; cgs.scores2 = cg.teamScores[1]; @@ -145,7 +145,7 @@ CG_ParseElimination ================= */ static void CG_ParseElimination( void ) { - if(CG_IsARoundBasedGametype(cgs.gametype) && CG_IsATeamGametype(cgs.gametype)) + if(cgs.gametype == GT_ELIMINATION || cgs.gametype == GT_CTF_ELIMINATION) { cgs.scores1 = atoi( CG_Argv( 1 ) ); cgs.scores2 = atoi( CG_Argv( 2 ) ); @@ -352,6 +352,12 @@ void CG_ParseServerinfo( void ) { info = CG_ConfigString( CS_SERVERINFO ); cgs.gametype = atoi( Info_ValueForKey( info, "g_gametype" ) ); + //By default do as normal: + cgs.ffa_gt = 0; + //See if ffa gametype + if (cgs.gametype == GT_LMS || cgs.gametype == GT_POSSESSION) { + cgs.ffa_gt = 1; + } trap_Cvar_Set("g_gametype", va("%i", cgs.gametype)); cgs.dmflags = atoi( Info_ValueForKey( info, "dmflags" ) ); cgs.videoflags = atoi( Info_ValueForKey( info, "videoflags" ) ); @@ -400,7 +406,7 @@ static void CG_ParseWarmup( void ) { } else if ( warmup > 0 && cg.warmup <= 0 ) { #ifdef MISSIONPACK - if (CG_IsATeamGametype(cgs.gametype)) { + if (cgs.gametype >= GT_CTF && cgs.gametype < GT_MAX_GAME_TYPE && !cgs.ffa_gt) { trap_S_StartLocalSound( cgs.media.countPrepareTeamSound, CHAN_ANNOUNCER ); } else #endif @@ -425,13 +431,13 @@ void CG_SetConfigValues( void ) { cgs.scores1 = atoi( CG_ConfigString( CS_SCORES1 ) ); cgs.scores2 = atoi( CG_ConfigString( CS_SCORES2 ) ); cgs.levelStartTime = atoi( CG_ConfigString( CS_LEVEL_START_TIME ) ); - if((CG_UsesTeamFlags(cgs.gametype) && !CG_UsesTheWhiteFlag(cgs.gametype)) || cgs.gametype == GT_DOUBLE_D) { + if( cgs.gametype == GT_CTF || cgs.gametype == GT_CTF_ELIMINATION || cgs.gametype == GT_DOUBLE_D) { s = CG_ConfigString( CS_FLAGSTATUS ); cgs.redflag = s[0] - '0'; cgs.blueflag = s[1] - '0'; } //#ifdef MISSIONPACK - else if( CG_UsesTheWhiteFlag(cgs.gametype) ) { + else if( cgs.gametype == GT_1FCTF || cgs.gametype == GT_POSSESSION ) { s = CG_ConfigString( CS_FLAGSTATUS ); cgs.flagStatus = s[0] - '0'; } @@ -548,12 +554,13 @@ static void CG_ConfigStringModified( void ) { CG_NewClientInfo( num - CS_PLAYERS ); CG_BuildSpectatorString(); } else if ( num == CS_FLAGSTATUS ) { - if((CG_UsesTeamFlags(cgs.gametype) && CG_UsesTheWhiteFlag(cgs.gametype)) || cgs.gametype == GT_DOUBLE_D) { + if( cgs.gametype == GT_CTF || cgs.gametype == GT_CTF_ELIMINATION || cgs.gametype == GT_DOUBLE_D) { // format is rb where its red/blue, 0 is at base, 1 is taken, 2 is dropped cgs.redflag = str[0] - '0'; cgs.blueflag = str[1] - '0'; } - else if( CG_UsesTheWhiteFlag(cgs.gametype) ) { + + else if( cgs.gametype == GT_1FCTF || cgs.gametype == GT_POSSESSION ) { cgs.flagStatus = str[0] - '0'; } } @@ -1106,10 +1113,6 @@ void CG_VoiceChatLocal( int mode, qboolean voiceOnly, int clientNum, int color, return; } - if ( mode == SAY_ALL && CG_IsATeamGametype(cgs.gametype) && cg_teamChatsOnly.integer ) { - return; - } - if ( clientNum < 0 || clientNum >= MAX_CLIENTS ) { clientNum = 0; } @@ -1120,18 +1123,23 @@ void CG_VoiceChatLocal( int mode, qboolean voiceOnly, int clientNum, int color, voiceChatList = CG_VoiceChatListForClient( clientNum ); if ( CG_GetVoiceChat( voiceChatList, cmd, &snd, &chat ) ) { - vchat.clientNum = clientNum; - vchat.snd = snd; - vchat.voiceOnly = voiceOnly; - Q_strncpyz(vchat.cmd, cmd, sizeof(vchat.cmd)); - if ( mode == SAY_TELL ) { - Com_sprintf(vchat.message, sizeof(vchat.message), "[%s]: %c%c%s", ci->name, Q_COLOR_ESCAPE, color, chat); - } else if ( mode == SAY_TEAM ) { - Com_sprintf(vchat.message, sizeof(vchat.message), "(%s): %c%c%s", ci->name, Q_COLOR_ESCAPE, color, chat); - } else { - Com_sprintf(vchat.message, sizeof(vchat.message), "%s: %c%c%s", ci->name, Q_COLOR_ESCAPE, color, chat); + // + if ( mode == SAY_TEAM || !cg_teamChatsOnly.integer ) { + vchat.clientNum = clientNum; + vchat.snd = snd; + vchat.voiceOnly = voiceOnly; + Q_strncpyz(vchat.cmd, cmd, sizeof(vchat.cmd)); + if ( mode == SAY_TELL ) { + Com_sprintf(vchat.message, sizeof(vchat.message), "[%s]: %c%c%s", ci->name, Q_COLOR_ESCAPE, color, chat); + } + else if ( mode == SAY_TEAM ) { + Com_sprintf(vchat.message, sizeof(vchat.message), "(%s): %c%c%s", ci->name, Q_COLOR_ESCAPE, color, chat); + } + else { + Com_sprintf(vchat.message, sizeof(vchat.message), "%s: %c%c%s", ci->name, Q_COLOR_ESCAPE, color, chat); + } + CG_AddBufferedVoiceChat(&vchat); } - CG_AddBufferedVoiceChat(&vchat); } #endif } @@ -1225,16 +1233,14 @@ static void CG_ServerCommand( void ) { } if ( strequals( cmd, "chat" ) ) { - if ( CG_IsATeamGametype(cgs.gametype) && cg_teamChatsOnly.integer ) { - return; - } - if( cg_chatBeep.integer ) { - trap_S_StartLocalSound( cgs.media.talkSound, CHAN_LOCAL_SOUND ); + if ( !cg_teamChatsOnly.integer ) { + if( cg_chatBeep.integer ) { + trap_S_StartLocalSound( cgs.media.talkSound, CHAN_LOCAL_SOUND ); + } + Q_strncpyz( text, CG_Argv(1), MAX_SAY_TEXT ); + CG_RemoveChatEscapeChar( text ); + CG_Printf( "%s\n", text ); } - trap_S_StartLocalSound( cgs.media.talkSound, CHAN_LOCAL_SOUND ); - Q_strncpyz( text, CG_Argv(1), MAX_SAY_TEXT ); - CG_RemoveChatEscapeChar( text ); - CG_Printf( "%s\n", text ); return; } diff --git a/code/cgame/cg_syscalls.asm b/code/cgame/cg_syscalls.asm index f6f8d9ef..ea702a60 100644 --- a/code/cgame/cg_syscalls.asm +++ b/code/cgame/cg_syscalls.asm @@ -103,4 +103,5 @@ equ ceil -109 equ testPrintInt -110 equ testPrintFloat -111 equ acos -112 -equ trap_R_LFX_ParticleEffect -113 +equ trap_R_LFX_ParticleEffect -113 +equ trap_R_GetViewPosition -114 diff --git a/code/cgame/cg_syscalls.c b/code/cgame/cg_syscalls.c index 515988bd..c44a5f61 100644 --- a/code/cgame/cg_syscalls.c +++ b/code/cgame/cg_syscalls.c @@ -399,6 +399,10 @@ void trap_R_LFX_ParticleEffect( int effect, const vec3_t origin, const vec3_t ve syscall( CG_R_LFX_PARTICLEEFFECT, effect, origin, velocity ); } +// leilei - get viewmatrix from value +void trap_R_GetViewPosition( vec3_t point ) { + syscall( CG_R_VIEWPOSITION, point ); +} // this returns a handle. arg0 is the name in the format "idlogo.roq", set arg1 to NULL, alteredstates to qfalse (do not alter gamestate) int trap_CIN_PlayCinematic( const char *arg0, int xpos, int ypos, int width, int height, int bits) { diff --git a/code/cgame/cg_view.c b/code/cgame/cg_view.c index 28c6d262..db671c26 100644 --- a/code/cgame/cg_view.c +++ b/code/cgame/cg_view.c @@ -266,7 +266,8 @@ static void CG_OffsetThirdPersonView( void ) { VectorCopy( cg.refdefViewAngles, focusAngles ); // if dead, look at killer - if ( (cg.predictedPlayerState.stats[STAT_HEALTH] <= 0) && !CG_IsARoundBasedGametype(cgs.gametype) ) { + if ( (cg.predictedPlayerState.stats[STAT_HEALTH] <= 0) && + (cgs.gametype !=GT_ELIMINATION && cgs.gametype !=GT_CTF_ELIMINATION && cgs.gametype !=GT_LMS) ) { focusAngles[YAW] = cg.predictedPlayerState.stats[STAT_DEAD_YAW]; cg.refdefViewAngles[YAW] = cg.predictedPlayerState.stats[STAT_DEAD_YAW]; } @@ -435,7 +436,7 @@ static void CG_OffsetFirstPersonView( void ) { VectorAdd (angles, cg.kick_angles, angles); // add angles based on damage kick - if ( cg.damageTime && !CG_IsARoundBasedGametype(cgs.gametype)) { + if ( cg.damageTime && cgs.gametype!=GT_ELIMINATION && cgs.gametype!=GT_CTF_ELIMINATION && cgs.gametype!=GT_LMS) { ratio = cg.time - cg.damageTime; if ( ratio < DAMAGE_DEFLECT_TIME ) { ratio /= DAMAGE_DEFLECT_TIME; diff --git a/code/cgame/cg_weapons.c b/code/cgame/cg_weapons.c index 3329d1c9..fedadae6 100644 --- a/code/cgame/cg_weapons.c +++ b/code/cgame/cg_weapons.c @@ -1572,16 +1572,33 @@ static void CG_AddWeaponWithPowerups( refEntity_t *gun, int powerups ) } } else { + if (cg_alternateShell.integer < 2) // leilei - skip the shell for the glow trap_R_AddRefEntityToScene( gun ); if ( powerups & ( 1 << PW_BATTLESUIT ) ) { - gun->customShader = cgs.media.battleWeaponShader; - trap_R_AddRefEntityToScene( gun ); + if (cg_alternateShell.integer > 1){ + gun->glow = 1340; + gun->glowcol = 0xE29000; + } + else + { + gun->customShader = cgs.media.battleWeaponShader; + trap_R_AddRefEntityToScene( gun ); + } } if ( powerups & ( 1 << PW_QUAD ) ) { - gun->customShader = cgs.media.quadWeaponShader; - trap_R_AddRefEntityToScene( gun ); + if (cg_alternateShell.integer > 1){ + gun->glow = 1338; + gun->glowcol = 0x0040E2; + } + else + { + gun->customShader = cgs.media.quadWeaponShader; + trap_R_AddRefEntityToScene( gun ); + } } + if (cg_alternateShell.integer > 1) // NOW add the entity for the glow + trap_R_AddRefEntityToScene( gun ); } } @@ -3424,7 +3441,7 @@ void CG_FireWeapon( centity_t *cent ) int c; weaponInfo_t *weap; - if(CG_IsARoundBasedGametype(cgs.gametype) && CG_IsATeamGametype(cgs.gametype) && cgs.roundStartTime>=cg.time) + if((cgs.gametype == GT_ELIMINATION || cgs.gametype == GT_CTF_ELIMINATION) && cgs.roundStartTime>=cg.time) return; //if we havn't started in ELIMINATION then do not fire ent = ¢->currentState; diff --git a/code/game/ai_chat.c b/code/game/ai_chat.c index 1a540276..11abdb20 100644 --- a/code/game/ai_chat.c +++ b/code/game/ai_chat.c @@ -384,7 +384,7 @@ int BotChat_EnterGame(bot_state_t *bs) { if (bot_nochat.integer) return qfalse; if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING) return qfalse; //don't chat in teamplay - if (G_IsATeamGametype(gametype)) return qfalse; + if (TeamPlayIsOn()) return qfalse; // don't chat in tournament mode if (gametype == GT_TOURNAMENT) return qfalse; rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_ENTEREXITGAME, 0, 1); @@ -417,7 +417,7 @@ int BotChat_ExitGame(bot_state_t *bs) { if (bot_nochat.integer) return qfalse; if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING) return qfalse; //don't chat in teamplay - if (G_IsATeamGametype(gametype)) return qfalse; + if (TeamPlayIsOn()) return qfalse; // don't chat in tournament mode if (gametype == GT_TOURNAMENT) return qfalse; rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_ENTEREXITGAME, 0, 1); @@ -451,7 +451,7 @@ int BotChat_StartLevel(bot_state_t *bs) { if (BotIsObserver(bs)) return qfalse; if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING) return qfalse; //don't chat in teamplay - if (G_IsATeamGametype(gametype)) { + if (TeamPlayIsOn()) { trap_EA_Command(bs->client, "vtaunt"); return qfalse; } @@ -483,7 +483,7 @@ int BotChat_EndLevel(bot_state_t *bs) { if (BotIsObserver(bs)) return qfalse; if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING) return qfalse; // teamplay - if (G_IsATeamGametype(gametype)) + if (TeamPlayIsOn()) { if (BotIsFirstInRankings(bs)) { trap_EA_Command(bs->client, "vtaunt"); @@ -555,7 +555,7 @@ int BotChat_Death(bot_state_t *bs) { else strcpy(name, "[world]"); // - if (G_IsATeamGametype(gametype) && BotSameTeam(bs, bs->lastkilledby)) { + if (TeamPlayIsOn() && BotSameTeam(bs, bs->lastkilledby)) { if (bs->lastkilledby == bs->client) return qfalse; BotAI_BotInitialChat(bs, "death_teammate", name, NULL); bs->chatto = CHAT_TEAM; @@ -563,7 +563,7 @@ int BotChat_Death(bot_state_t *bs) { else { //teamplay - if (G_IsATeamGametype(gametype)) { + if (TeamPlayIsOn()) { trap_EA_Command(bs->client, "vtaunt"); return qtrue; } @@ -656,14 +656,14 @@ int BotChat_Kill(bot_state_t *bs) { EasyClientName(bs->lastkilledplayer, name, 32); // bs->chatto = CHAT_ALL; - if (G_IsATeamGametype(gametype) && BotSameTeam(bs, bs->lastkilledplayer)) { + if (TeamPlayIsOn() && BotSameTeam(bs, bs->lastkilledplayer)) { BotAI_BotInitialChat(bs, "kill_teammate", name, NULL); bs->chatto = CHAT_TEAM; } else { //don't chat in teamplay - if (G_IsATeamGametype(gametype)) { + if (TeamPlayIsOn()) { trap_EA_Command(bs->client, "vtaunt"); return qfalse; // don't wait } @@ -706,7 +706,7 @@ int BotChat_EnemySuicide(bot_state_t *bs) { // rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_ENEMYSUICIDE, 0, 1); //don't chat in teamplay - if (G_IsATeamGametype(gametype)) return qfalse; + if (TeamPlayIsOn()) return qfalse; // don't chat in tournament mode if (gametype == GT_TOURNAMENT) return qfalse; //if fast chat is off @@ -746,7 +746,7 @@ int BotChat_HitTalking(bot_state_t *bs) { // rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_HITTALKING, 0, 1); //don't chat in teamplay - if (G_IsATeamGametype(gametype)) return qfalse; + if (TeamPlayIsOn()) return qfalse; // don't chat in tournament mode if (gametype == GT_TOURNAMENT) return qfalse; //if fast chat is off @@ -786,7 +786,7 @@ int BotChat_HitNoDeath(bot_state_t *bs) { if (BotNumActivePlayers() <= 1) return qfalse; rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_HITNODEATH, 0, 1); //don't chat in teamplay - if (G_IsATeamGametype(gametype)) return qfalse; + if (TeamPlayIsOn()) return qfalse; // don't chat in tournament mode if (gametype == GT_TOURNAMENT) return qfalse; //if fast chat is off @@ -824,7 +824,7 @@ int BotChat_HitNoKill(bot_state_t *bs) { if (BotNumActivePlayers() <= 1) return qfalse; rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_HITNOKILL, 0, 1); //don't chat in teamplay - if (G_IsATeamGametype(gametype)) return qfalse; + if (TeamPlayIsOn()) return qfalse; // don't chat in tournament mode if (gametype == GT_TOURNAMENT) return qfalse; //if fast chat is off @@ -884,7 +884,7 @@ int BotChat_Random(bot_state_t *bs) { else { EasyClientName(bs->lastkilledplayer, name, sizeof(name)); } - if (G_IsATeamGametype(gametype)) { + if (TeamPlayIsOn()) { trap_EA_Command(bs->client, "vtaunt"); return qfalse; // don't wait } diff --git a/code/game/ai_cmd.c b/code/game/ai_cmd.c index e8516dd7..b23c33e2 100644 --- a/code/game/ai_cmd.c +++ b/code/game/ai_cmd.c @@ -487,7 +487,7 @@ void BotMatch_HelpAccompany(bot_state_t *bs, bot_match_t *match) { bot_match_t teammatematch; aas_entityinfo_t entinfo; - if (!G_IsATeamGametype(gametype)) return; + if (!TeamPlayIsOn()) return; //if not addressed to this bot if (!BotAddressedToBot(bs, match)) return; //get the team mate name @@ -610,7 +610,7 @@ void BotMatch_DefendKeyArea(bot_state_t *bs, bot_match_t *match) { char netname[MAX_MESSAGE_SIZE]; int client; - if (!G_IsATeamGametype(gametype)) return; + if (!TeamPlayIsOn()) return; //if not addressed to this bot if (!BotAddressedToBot(bs, match)) return; //get the match variable @@ -659,7 +659,7 @@ void BotMatch_TakeA(bot_state_t *bs, bot_match_t *match) { char netname[MAX_MESSAGE_SIZE]; int client; - if (!G_IsATeamGametype(gametype)) return; + if (!TeamPlayIsOn()) return; //if not addressed to this bot if (!BotAddressedToBot(bs, match)) return; //get the match variable @@ -708,7 +708,7 @@ void BotMatch_TakeB(bot_state_t *bs, bot_match_t *match) { char netname[MAX_MESSAGE_SIZE]; int client; - if (!G_IsATeamGametype(gametype)) return; + if (!TeamPlayIsOn()) return; //if not addressed to this bot if (!BotAddressedToBot(bs, match)) return; //get the match variable @@ -756,7 +756,7 @@ void BotMatch_GetItem(bot_state_t *bs, bot_match_t *match) { char netname[MAX_MESSAGE_SIZE]; int client; - if (!G_IsATeamGametype(gametype)) return; + if (!TeamPlayIsOn()) return; //if not addressed to this bot if (!BotAddressedToBot(bs, match)) return; //get the match variable @@ -797,7 +797,7 @@ void BotMatch_Camp(bot_state_t *bs, bot_match_t *match) { char itemname[MAX_MESSAGE_SIZE]; aas_entityinfo_t entinfo; - if (!G_IsATeamGametype(gametype)) return; + if (!TeamPlayIsOn()) return; //if not addressed to this bot if (!BotAddressedToBot(bs, match)) return; // @@ -887,7 +887,7 @@ void BotMatch_Patrol(bot_state_t *bs, bot_match_t *match) { char netname[MAX_MESSAGE_SIZE]; int client; - if (!G_IsATeamGametype(gametype)) return; + if (!TeamPlayIsOn()) return; //if not addressed to this bot if (!BotAddressedToBot(bs, match)) return; //get the patrol waypoints @@ -926,7 +926,7 @@ void BotMatch_GetFlag(bot_state_t *bs, bot_match_t *match) { char netname[MAX_MESSAGE_SIZE]; int client; - if (G_UsesTeamFlags(gametype) && !G_UsesTheWhiteFlag(gametype)) { + if (gametype == GT_CTF || gametype == GT_CTF_ELIMINATION) { if (!ctf_redflag.areanum || !ctf_blueflag.areanum) return; } @@ -958,7 +958,7 @@ void BotMatch_GetFlag(bot_state_t *bs, bot_match_t *match) { //set the team goal time bs->teamgoal_time = FloatTime() + CTF_GETFLAG_TIME; // get an alternate route in ctf - if (G_UsesTeamFlags(gametype)) { + if (gametype == GT_CTF || gametype == GT_1FCTF || gametype == GT_CTF_ELIMINATION) { //get an alternative route goal towards the enemy base BotGetAlternateRouteGoal(bs, BotOppositeTeam(bs)); } @@ -980,11 +980,10 @@ void BotMatch_AttackEnemyBase(bot_state_t *bs, bot_match_t *match) { char netname[MAX_MESSAGE_SIZE]; int client; - if (G_UsesTeamFlags(gametype) && !G_UsesTheWhiteFlag(gametype)) { + if (gametype == GT_CTF|| gametype == GT_CTF_ELIMINATION) { BotMatch_GetFlag(bs, match); } - else if ((G_UsesTeamFlags(gametype) && G_UsesTheWhiteFlag(gametype)) || - gametype == GT_HARVESTER || gametype == GT_OBELISK) { + else if (gametype == GT_1FCTF || gametype == GT_OBELISK || gametype == GT_HARVESTER) { if (!redobelisk.areanum || !blueobelisk.areanum) return; } @@ -1068,7 +1067,7 @@ void BotMatch_RushBase(bot_state_t *bs, bot_match_t *match) { char netname[MAX_MESSAGE_SIZE]; int client; - if (G_UsesTeamFlags(gametype) && !G_UsesTheWhiteFlag(gametype)) { + if (gametype == GT_CTF|| gametype == GT_CTF_ELIMINATION) { if (!ctf_redflag.areanum || !ctf_blueflag.areanum) return; } @@ -1162,7 +1161,7 @@ void BotMatch_ReturnFlag(bot_state_t *bs, bot_match_t *match) { int client; //if not in CTF mode - if (G_UsesTeamFlags(gametype)) + if (gametype != GT_CTF && gametype != GT_CTF_ELIMINATION && gametype != GT_1FCTF) return; //if not addressed to this bot if (!BotAddressedToBot(bs, match)) @@ -1199,7 +1198,7 @@ void BotMatch_JoinSubteam(bot_state_t *bs, bot_match_t *match) { char netname[MAX_MESSAGE_SIZE]; int client; - if (!G_IsATeamGametype(gametype)) return; + if (!TeamPlayIsOn()) return; //if not addressed to this bot if (!BotAddressedToBot(bs, match)) return; //get the sub team name @@ -1222,7 +1221,7 @@ void BotMatch_LeaveSubteam(bot_state_t *bs, bot_match_t *match) { char netname[MAX_MESSAGE_SIZE]; int client; - if (!G_IsATeamGametype(gametype)) return; + if (!TeamPlayIsOn()) return; //if not addressed to this bot if (!BotAddressedToBot(bs, match)) return; // @@ -1242,7 +1241,7 @@ BotMatch_LeaveSubteam ================== */ void BotMatch_WhichTeam(bot_state_t *bs, bot_match_t *match) { - if (!G_IsATeamGametype(gametype)) return; + if (!TeamPlayIsOn()) return; //if not addressed to this bot if (!BotAddressedToBot(bs, match)) return; @@ -1268,7 +1267,7 @@ void BotMatch_CheckPoint(bot_state_t *bs, bot_match_t *match) { vec3_t position; bot_waypoint_t *cp; - if (!G_IsATeamGametype(gametype)) return; + if (!TeamPlayIsOn()) return; // trap_BotMatchVariable(match, POSITION, buf, MAX_MESSAGE_SIZE); VectorClear(position); @@ -1322,7 +1321,7 @@ void BotMatch_FormationSpace(bot_state_t *bs, bot_match_t *match) { char buf[MAX_MESSAGE_SIZE]; float space; - if (!G_IsATeamGametype(gametype)) return; + if (!TeamPlayIsOn()) return; //if not addressed to this bot if (!BotAddressedToBot(bs, match)) return; // @@ -1345,7 +1344,7 @@ void BotMatch_Dismiss(bot_state_t *bs, bot_match_t *match) { char netname[MAX_MESSAGE_SIZE]; int client; - if (!G_IsATeamGametype(gametype)) return; + if (!TeamPlayIsOn()) return; //if not addressed to this bot if (!BotAddressedToBot(bs, match)) return; trap_BotMatchVariable(match, NETNAME, netname, sizeof(netname)); @@ -1370,7 +1369,7 @@ void BotMatch_Suicide(bot_state_t *bs, bot_match_t *match) { char netname[MAX_MESSAGE_SIZE]; int client; - if (!G_IsATeamGametype(gametype)) return; + if (!TeamPlayIsOn()) return; //if not addressed to this bot if (!BotAddressedToBot(bs, match)) return; // @@ -1392,7 +1391,7 @@ void BotMatch_StartTeamLeaderShip(bot_state_t *bs, bot_match_t *match) { int client; char teammate[MAX_MESSAGE_SIZE]; - if (!G_IsATeamGametype(gametype)) return; + if (!TeamPlayIsOn()) return; //if chats for him or herself if (match->subtype & ST_I) { //get the team mate that will be the team leader @@ -1418,7 +1417,7 @@ void BotMatch_StopTeamLeaderShip(bot_state_t *bs, bot_match_t *match) { char teammate[MAX_MESSAGE_SIZE]; char netname[MAX_MESSAGE_SIZE]; - if (!G_IsATeamGametype(gametype)) return; + if (!TeamPlayIsOn()) return; //get the team mate that stops being the team leader trap_BotMatchVariable(match, TEAMMATE, teammate, sizeof(teammate)); //if chats for him or herself @@ -1446,7 +1445,7 @@ BotMatch_WhoIsTeamLeader void BotMatch_WhoIsTeamLeader(bot_state_t *bs, bot_match_t *match) { char netname[MAX_MESSAGE_SIZE]; - if (!G_IsATeamGametype(gametype)) return; + if (!TeamPlayIsOn()) return; ClientName(bs->client, netname, sizeof(netname)); //if this bot IS the team leader @@ -1650,7 +1649,7 @@ void BotMatch_WhereAreYou(bot_state_t *bs, bot_match_t *match) { NULL }; // - if (!G_IsATeamGametype(gametype)) + if (!TeamPlayIsOn()) return; //if not addressed to this bot @@ -1667,7 +1666,9 @@ void BotMatch_WhereAreYou(bot_state_t *bs, bot_match_t *match) { } } if (bestitem != -1) { - if (G_UsesTeamFlags(gametype)) { + if (gametype == GT_CTF || gametype == GT_CTF_ELIMINATION + || gametype == GT_1FCTF + ) { redtt = trap_AAS_AreaTravelTimeToGoalArea(bs->areanum, bs->origin, ctf_redflag.areanum, TFL_DEFAULT); bluett = trap_AAS_AreaTravelTimeToGoalArea(bs->areanum, bs->origin, ctf_blueflag.areanum, TFL_DEFAULT); if (redtt < (redtt + bluett) * 0.4) { @@ -1680,7 +1681,7 @@ void BotMatch_WhereAreYou(bot_state_t *bs, bot_match_t *match) { BotAI_BotInitialChat(bs, "location", nearbyitems[bestitem], NULL); } } - else if (gametype == GT_HARVESTER || gametype == GT_OBELISK) { + else if (gametype == GT_OBELISK || gametype == GT_HARVESTER) { redtt = trap_AAS_AreaTravelTimeToGoalArea(bs->areanum, bs->origin, redobelisk.areanum, TFL_DEFAULT); bluett = trap_AAS_AreaTravelTimeToGoalArea(bs->areanum, bs->origin, blueobelisk.areanum, TFL_DEFAULT); if (redtt < (redtt + bluett) * 0.4) { @@ -1712,7 +1713,7 @@ void BotMatch_LeadTheWay(bot_state_t *bs, bot_match_t *match) { char netname[MAX_MESSAGE_SIZE], teammate[MAX_MESSAGE_SIZE]; int client, areanum, other; - if (!G_IsATeamGametype(gametype)) return; + if (!TeamPlayIsOn()) return; //if not addressed to this bot if (!BotAddressedToBot(bs, match)) return; //if someone asks for someone else @@ -1781,7 +1782,7 @@ void BotMatch_Kill(bot_state_t *bs, bot_match_t *match) { char netname[MAX_MESSAGE_SIZE]; int client; - if (!G_IsATeamGametype(gametype)) return; + if (!TeamPlayIsOn()) return; //if not addressed to this bot if (!BotAddressedToBot(bs, match)) return; @@ -1818,7 +1819,7 @@ void BotMatch_CTF(bot_state_t *bs, bot_match_t *match) { char flag[128], netname[MAX_NETNAME]; - if (G_UsesTeamFlags(gametype) && !G_UsesTheWhiteFlag(gametype)) { + if (gametype == GT_CTF || gametype == GT_CTF_ELIMINATION) { trap_BotMatchVariable(match, FLAG, flag, sizeof(flag)); if (match->subtype & ST_GOTFLAG) { if (Q_strequal(flag, "red")) { @@ -1850,7 +1851,7 @@ void BotMatch_CTF(bot_state_t *bs, bot_match_t *match) { bs->flagstatuschanged = 1; } } - else if (G_UsesTheWhiteFlag(gametype)) { + else if (gametype == GT_1FCTF || gametype == GT_POSSESSION) { if (match->subtype & ST_1FCTFGOTFLAG) { trap_BotMatchVariable(match, NETNAME, netname, sizeof(netname)); bs->flagcarrier = ClientFromName(netname); diff --git a/code/game/ai_dmnet.c b/code/game/ai_dmnet.c index b47f6968..247fe444 100644 --- a/code/game/ai_dmnet.c +++ b/code/game/ai_dmnet.c @@ -832,7 +832,8 @@ int BotGetLongTermGoal(bot_state_t *bs, int tfl, int retreat, bot_goal_t *goal) memcpy(goal, &bs->curpatrolpoint->goal, sizeof(bot_goal_t)); return qtrue; } - if (G_UsesTeamFlags(gametype) && !G_UsesTheWhiteFlag(gametype)) { + + if (gametype == GT_CTF || gametype == GT_CTF_ELIMINATION) { //if going for enemy flag if (bs->ltgtype == LTG_GETFLAG) { //check for bot typing status message @@ -1955,12 +1956,14 @@ int AINode_Seek_LTG(bot_state_t *bs) if (bs->ltgtype == LTG_DEFENDKEYAREA) range = 400; else range = 150; // - if (G_UsesTeamFlags(gametype) && !G_UsesTheWhiteFlag(gametype)) { + + if (gametype == GT_CTF || gametype == GT_CTF_ELIMINATION) { //if carrying a flag the bot shouldn't be distracted too much if (BotCTFCarryingFlag(bs)) range = 50; } - else if (G_UsesTheWhiteFlag(gametype)) { + + else if (gametype == GT_1FCTF || GT_POSSESSION) { if (Bot1FCTFCarryingFlag(bs)) range = 50; } @@ -2471,12 +2474,14 @@ int AINode_Battle_Retreat(bot_state_t *bs) { if (bs->check_time < FloatTime()) { bs->check_time = FloatTime() + 1; range = 150; - if (G_UsesTeamFlags(gametype) && !G_UsesTheWhiteFlag(gametype)) { + + if (gametype == GT_CTF || gametype == GT_CTF_ELIMINATION) { //if carrying a flag the bot shouldn't be distracted too much if (BotCTFCarryingFlag(bs)) range = 50; } - else if (G_UsesTheWhiteFlag(gametype)) { + + else if (gametype == GT_1FCTF || gametype == GT_POSSESSION) { if (Bot1FCTFCarryingFlag(bs)) range = 50; } diff --git a/code/game/ai_dmq3.c b/code/game/ai_dmq3.c index 7c7d0ece..f2f3c56f 100644 --- a/code/game/ai_dmq3.c +++ b/code/game/ai_dmq3.c @@ -82,7 +82,7 @@ vmCvar_t bot_nochat; vmCvar_t bot_testrchat; vmCvar_t bot_challenge; vmCvar_t bot_predictobstacles; -vmCvar_t bot_spSkill; +vmCvar_t g_spSkill; extern vmCvar_t bot_developer; @@ -157,7 +157,7 @@ BotCTFCarryingFlag ================== */ int BotCTFCarryingFlag(bot_state_t *bs) { - if (!G_UsesTeamFlags(gametype) && !G_UsesTheWhiteFlag(gametype)) return CTF_FLAG_NONE; + if (gametype != GT_CTF && gametype != GT_CTF_ELIMINATION) return CTF_FLAG_NONE; if (bs->inventory[INVENTORY_REDFLAG] > 0) return CTF_FLAG_RED; else if (bs->inventory[INVENTORY_BLUEFLAG] > 0) return CTF_FLAG_BLUE; @@ -343,7 +343,7 @@ Bot1FCTFCarryingFlag ================== */ int Bot1FCTFCarryingFlag(bot_state_t *bs) { - if (!G_UsesTheWhiteFlag(gametype)) return qfalse; + if (gametype != GT_1FCTF || gametype != GT_POSSESSION) return qfalse; if (bs->inventory[INVENTORY_NEUTRALFLAG] > 0) return qtrue; return qfalse; @@ -394,8 +394,8 @@ void BotSetTeamStatus(bot_state_t *bs) { break; case LTG_TEAMACCOMPANY: BotEntityInfo(bs->teammate, &entinfo); - if ((G_UsesTeamFlags(gametype) && EntityCarriesFlag(&entinfo)) || - (gametype == GT_HARVESTER && EntityCarriesCubes(&entinfo))) { + if (((gametype == GT_CTF || gametype == GT_CTF_ELIMINATION || gametype == GT_1FCTF) && EntityCarriesFlag(&entinfo)) + || (gametype == GT_HARVESTER && EntityCarriesCubes(&entinfo))) { teamtask = TEAMTASK_ESCORT; } else { teamtask = TEAMTASK_FOLLOW; @@ -458,7 +458,7 @@ BotSetLastOrderedTask */ int BotSetLastOrderedTask(bot_state_t *bs) { - if (G_UsesTeamFlags(gametype) && !G_UsesTheWhiteFlag(gametype)) { + if (gametype == GT_CTF || gametype == GT_CTF_ELIMINATION) { // don't go back to returning the flag if it's at the base if (bs->lastgoal_ltgtype == LTG_RETURNFLAG) { if (BotTeam(bs) == TEAM_RED) { @@ -482,7 +482,7 @@ int BotSetLastOrderedTask(bot_state_t *bs) { bs->teamgoal_time = FloatTime() + 300; BotSetTeamStatus(bs); // - if (G_UsesTeamFlags(gametype) && !G_UsesTheWhiteFlag(gametype)) { + if (gametype == GT_CTF || gametype == GT_CTF_ELIMINATION) { if (bs->ltgtype == LTG_GETFLAG) { bot_goal_t *tb, *eb; int tt, et; @@ -1418,9 +1418,9 @@ BotTeamGoals void BotTeamGoals(bot_state_t *bs, int retreat) { if (retreat) { - if (G_UsesTeamFlags(gametype) && !G_UsesTheWhiteFlag(gametype)) { + if (gametype == GT_CTF || gametype == GT_CTF_ELIMINATION) { BotCTFRetreatGoals(bs); - } else if (G_UsesTheWhiteFlag(gametype)) { + } else if (gametype == GT_1FCTF) { Bot1FCTFRetreatGoals(bs); } else if (gametype == GT_OBELISK) { BotObeliskRetreatGoals(bs); @@ -1428,10 +1428,10 @@ void BotTeamGoals(bot_state_t *bs, int retreat) { BotHarvesterRetreatGoals(bs); } } else { - if (G_UsesTeamFlags(gametype) && !G_UsesTheWhiteFlag(gametype)) { + if (gametype == GT_CTF || gametype == GT_CTF_ELIMINATION) { //decide what to do in CTF mode BotCTFSeekGoals(bs); - } else if (G_UsesTheWhiteFlag(gametype)) { + } else if (gametype == GT_1FCTF || gametype == GT_POSSESSION) { Bot1FCTFSeekGoals(bs); } else if (gametype == GT_OBELISK) { BotObeliskSeekGoals(bs); @@ -1617,7 +1617,9 @@ int BotSynonymContext(bot_state_t *bs) { context = CONTEXT_NORMAL | CONTEXT_NEARBYITEM | CONTEXT_NAMES; // - if (G_UsesTeamFlags(gametype)) { + if (gametype == GT_CTF || gametype == GT_CTF_ELIMINATION + || gametype == GT_1FCTF + ) { if (BotTeam(bs) == TEAM_RED) context |= CONTEXT_CTFREDTEAM; else context |= CONTEXT_CTFBLUETEAM; } else if (gametype == GT_OBELISK) { @@ -1700,9 +1702,7 @@ BotCheckItemPickup void BotCheckItemPickup(bot_state_t *bs, int *oldinventory) { int offence, leader; - if (!G_UsesTeamFlags(gametype) && !G_UsesTheWhiteFlag(gametype) && - gametype != GT_HARVESTER && gametype != GT_OBELISK && - gametype != GT_DOUBLE_D && gametype != GT_DOMINATION) + if (gametype <= GT_TEAM && g_ffa_gt == 0) return; offence = -1; @@ -1739,11 +1739,12 @@ void BotCheckItemPickup(bot_state_t *bs, int *oldinventory) { BotVoiceChat(bs, leader, VOICECHAT_WANTONOFFENSE); //BotAI_BotInitialChat(bs, "wantoffence", NULL); //trap_BotEnterChat(bs->cs, leader, CHAT_TELL); - } else if (bot_spSkill.integer <= 3) { + } else if (g_spSkill.integer <= 3) { if ((bs->ltgtype != LTG_GETFLAG) && (bs->ltgtype != LTG_ATTACKENEMYBASE) && (bs->ltgtype != LTG_HARVEST) && - ((!(G_UsesTeamFlags(gametype) && !G_UsesTheWhiteFlag(gametype))) || + (((gametype != GT_CTF) && + (gametype != GT_CTF_ELIMINATION)) || ((bs->redflagstatus == 0) && (bs->blueflagstatus == 0))) && ((gametype != GT_1FCTF) || @@ -1765,9 +1766,10 @@ void BotCheckItemPickup(bot_state_t *bs, int *oldinventory) { BotVoiceChat(bs, -1, VOICECHAT_WANTONDEFENSE); //BotAI_BotInitialChat(bs, "wantdefence", NULL); //trap_BotEnterChat(bs->cs, leader, CHAT_TELL); - } else if ((bot_spSkill.integer <= 3) && + } else if ((g_spSkill.integer <= 3) && (bs->ltgtype != LTG_DEFENDKEYAREA) && - ((!(G_UsesTeamFlags(gametype) && !G_UsesTheWhiteFlag(gametype))) || + (((gametype != GT_CTF) && + (gametype != GT_CTF_ELIMINATION)) || ((bs->redflagstatus == 0) && (bs->blueflagstatus == 0))) && ((gametype != GT_1FCTF) || @@ -1893,7 +1895,7 @@ void BotUseKamikaze(bot_state_t *bs) { if (bs->kamikaze_time > FloatTime()) return; bs->kamikaze_time = FloatTime() + 0.2; - if (G_UsesTeamFlags(gametype) && !G_UsesTheWhiteFlag(gametype)) { + if (gametype == GT_CTF || gametype == GT_CTF_ELIMINATION) { //never use kamikaze if the team flag carrier is visible if (BotCTFCarryingFlag(bs)) return; @@ -1999,7 +2001,7 @@ void BotUseInvulnerability(bot_state_t *bs) { if (bs->invulnerability_time > FloatTime()) return; bs->invulnerability_time = FloatTime() + 0.2; - if (G_UsesTeamFlags(gametype) && !G_UsesTheWhiteFlag(gametype)) { + if (gametype == GT_CTF || gametype == GT_CTF_ELIMINATION) { //never use kamikaze if the team flag carrier is visible if (BotCTFCarryingFlag(bs)) return; @@ -2248,6 +2250,15 @@ void BotInitWaypoints(void) { } } +/* +================== +TeamPlayIsOn +================== + */ +int TeamPlayIsOn(void) { + return ( gametype >= GT_TEAM && g_ffa_gt != 1); +} + /* ================== BotAggression @@ -2325,11 +2336,11 @@ BotWantsToRetreat int BotWantsToRetreat(bot_state_t *bs) { aas_entityinfo_t entinfo; - if (G_UsesTeamFlags(gametype) && !G_UsesTheWhiteFlag(gametype)) { + if (gametype == GT_CTF || gametype == GT_CTF_ELIMINATION) { //always retreat when carrying a CTF flag if (BotCTFCarryingFlag(bs)) return qtrue; - } else if (G_UsesTheWhiteFlag(gametype)) { + } else if (gametype == GT_1FCTF || gametype == GT_POSSESSION) { //if carrying the flag then always retreat if (Bot1FCTFCarryingFlag(bs)) return qtrue; @@ -2375,7 +2386,7 @@ BotWantsToChase int BotWantsToChase(bot_state_t *bs) { aas_entityinfo_t entinfo; - if (G_UsesTeamFlags(gametype) && !G_UsesTheWhiteFlag(gametype)) { + if (gametype == GT_CTF || gametype == GT_CTF_ELIMINATION) { //never chase when carrying a CTF flag if (BotCTFCarryingFlag(bs)) return qfalse; @@ -2445,7 +2456,8 @@ int BotCanAndWantsToRocketJump(bot_state_t *bs) { //if low on rockets if (bs->inventory[INVENTORY_ROCKETS] < 3) return qfalse; //Sago: Special rule - always happy to rocket jump in elimination, eCTF end LMS if - if (G_IsARoundBasedGametype(g_gametype.integer) && g_elimination_selfdamage.integer == 0) { + if ((g_gametype.integer == GT_ELIMINATION || g_gametype.integer == GT_CTF_ELIMINATION || g_gametype.integer == GT_LMS) + && g_elimination_selfdamage.integer == 0) { return qtrue; } //never rocket jump with the Quad @@ -2829,7 +2841,7 @@ int BotSameTeam(bot_state_t *bs, int entnum) { //BotAI_Print(PRT_ERROR, "BotSameTeam: client out of range\n"); return qfalse; } - if (G_IsATeamGametype(gametype)) { + if (gametype >= GT_TEAM && g_ffa_gt != 1) { /*Sago: I don't know why they decided to check the configstring instead of the real value. For some reason bots sometimes gets a wrong config string when chaning gametypes. Now we check the real value: */ @@ -4692,8 +4704,7 @@ void BotCheckConsoleMessages(bot_state_t *bs) { BotAI_Print(PRT_MESSAGE, "**** no valid reply ****\n"); } } //if at a valid chat position and not chatting already and not in teamplay - else if (bs->ainode != AINode_Stand && BotValidChatPosition(bs) && - !G_IsATeamGametype(gametype)) { + else if (bs->ainode != AINode_Stand && BotValidChatPosition(bs) && !TeamPlayIsOn()) { chat_reply = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_REPLY, 0, 1); if (random() < 1.5 / (NumBots() + 1) && random() < chat_reply) { //if bot replies with a chat message @@ -4828,7 +4839,7 @@ void BotCheckEvents(bot_state_t *bs, entityState_t *state) { bs->enemysuicide = qtrue; } // - if (G_UsesTheWhiteFlag(gametype)) { + if (gametype == GT_1FCTF || gametype == GT_POSSESSION) { // BotEntityInfo(target, &entinfo); if (entinfo.powerups & (1 << PW_NEUTRALFLAG)) { @@ -4871,7 +4882,7 @@ void BotCheckEvents(bot_state_t *bs, entityState_t *state) { } case EV_GLOBAL_TEAM_SOUND: { - if (G_UsesTeamFlags(gametype) && !G_UsesTheWhiteFlag(gametype)) { + if (gametype == GT_CTF || gametype == GT_CTF_ELIMINATION) { switch (state->eventParm) { case GTS_RED_CAPTURE: bs->blueflagstatus = 0; @@ -4965,6 +4976,11 @@ void BotCheckEvents(bot_state_t *bs, entityState_t *state) { } case EV_FOOTSTEP: case EV_FOOTSTEP_METAL: + case EV_FOOTSTEP_SNOW: + case EV_FOOTSTEP_WOOD: + case EV_FOOTSTEP_SAND: + case EV_FOOTSTEP_GRAVEL: + case EV_FOOTSTEP_FOILAGE: case EV_FOOTSPLASH: case EV_FOOTWADE: case EV_SWIM: @@ -5131,7 +5147,7 @@ void BotSetupAlternativeRouteGoals(void) { if (altroutegoals_setup) return; - if (G_UsesTeamFlags(gametype) && !G_UsesTheWhiteFlag(gametype)) { + if (gametype == GT_CTF || gametype == GT_CTF_ELIMINATION) { if (trap_BotGetLevelItemGoal(-1, "Neutral Flag", &ctf_neutralflag) < 0) BotAI_Print(PRT_WARNING, "No alt routes without Neutral Flag\n"); if (ctf_neutralflag.areanum) { @@ -5423,9 +5439,9 @@ void BotSetupDeathmatchAI(void) { trap_Cvar_Register(&bot_testrchat, "bot_testrchat", "0", 0); trap_Cvar_Register(&bot_challenge, "bot_challenge", "0", 0); trap_Cvar_Register(&bot_predictobstacles, "bot_predictobstacles", "1", 0); - trap_Cvar_Register(&bot_spSkill, "g_spSkill", "2", 0); + trap_Cvar_Register(&g_spSkill, "g_spSkill", "2", 0); // - if (G_UsesTeamFlags(gametype) && !G_UsesTheWhiteFlag(gametype)) { + if (gametype == GT_CTF || gametype == GT_CTF_ELIMINATION) { if (untrap_BotGetLevelItemGoal(-1, "Red Flag", &ctf_redflag) < 0) BotAI_Print(PRT_WARNING, "CTF without Red Flag\n"); if (untrap_BotGetLevelItemGoal(-1, "Blue Flag", &ctf_blueflag) < 0) diff --git a/code/game/ai_dmq3.h b/code/game/ai_dmq3.h index ca7ecc56..5cc39d12 100644 --- a/code/game/ai_dmq3.h +++ b/code/game/ai_dmq3.h @@ -100,6 +100,8 @@ int BotWantsToCamp(bot_state_t *bs); bot_moveresult_t BotAttackMove(bot_state_t *bs, int tfl); //returns true if the bot and the entity are in the same team int BotSameTeam(bot_state_t *bs, int entnum); +//returns true if teamplay is on +int TeamPlayIsOn(void); // returns the client number of the team mate flag carrier (-1 if none) int BotTeamFlagCarrier(bot_state_t *bs); //returns visible team mate flag carrier if available diff --git a/code/game/ai_main.c b/code/game/ai_main.c index 85742aff..4344c4a3 100644 --- a/code/game/ai_main.c +++ b/code/game/ai_main.c @@ -188,7 +188,7 @@ int BotAI_GetEntityState( int entityNum, entityState_t *state ) { memset( state, 0, sizeof(entityState_t) ); if (!ent->inuse) return qfalse; if (!ent->r.linked) return qfalse; - if ( !(G_IsARoundBasedGametype(g_gametype.integer) ||g_instantgib.integer || g_rockets.integer || g_elimination_allgametypes.integer) + if ( !(g_gametype.integer == GT_ELIMINATION || g_gametype.integer == GT_LMS ||g_instantgib.integer || g_rockets.integer || g_elimination_allgametypes.integer || g_gametype.integer==GT_CTF_ELIMINATION) && (ent->r.svFlags & SVF_NOCLIENT) ) { return qfalse; } @@ -292,7 +292,7 @@ void BotReportStatus(bot_state_t *bs) { } strcpy(flagstatus, " "); - if (G_UsesTeamFlags(gametype) && !G_UsesTheWhiteFlag(gametype)) { + if (gametype == GT_CTF || gametype == GT_CTF_ELIMINATION) { if (BotCTFCarryingFlag(bs)) { if (BotTeam(bs) == TEAM_RED) strcpy(flagstatus, S_COLOR_RED"F "); else strcpy(flagstatus, S_COLOR_BLUE"F "); @@ -454,12 +454,12 @@ void BotSetInfoConfigString(bot_state_t *bs) { } strcpy(carrying, " "); - if (G_UsesTeamFlags(gametype) && !G_UsesTheWhiteFlag(gametype)) { + if (gametype == GT_CTF || gametype == GT_CTF_ELIMINATION) { if (BotCTFCarryingFlag(bs)) { strcpy(carrying, "F "); } } - else if (G_UsesTheWhiteFlag(gametype)) { + else if (gametype == GT_1FCTF || gametype == GT_POSSESSION) { if (Bot1FCTFCarryingFlag(bs)) { strcpy(carrying, "F "); } @@ -1216,7 +1216,7 @@ int BotAISetupClient(int client, struct bot_settings_s *settings, qboolean resta } bs = botstates[client]; - if (bs->inuse) { + if (bs && bs->inuse) { BotAI_Print(PRT_FATAL, "BotAISetupClient: client %d already setup\n", client); return qfalse; } @@ -1526,7 +1526,7 @@ int BotAIStartFrame(int time) { trap_BotLibUpdateEntity(i, NULL); continue; } - if ( !(G_IsARoundBasedGametype(g_gametype.integer) ||g_instantgib.integer || g_rockets.integer || g_elimination_allgametypes.integer) + if ( !(g_gametype.integer == GT_ELIMINATION || g_gametype.integer == GT_LMS ||g_instantgib.integer || g_rockets.integer || g_elimination_allgametypes.integer || g_gametype.integer==GT_CTF_ELIMINATION) && ent->r.svFlags & SVF_NOCLIENT) { trap_BotLibUpdateEntity(i, NULL); continue; diff --git a/code/game/ai_team.c b/code/game/ai_team.c index 4b20b75e..982203db 100644 --- a/code/game/ai_team.c +++ b/code/game/ai_team.c @@ -133,7 +133,7 @@ int BotSortTeamMatesByBaseTravelTime(bot_state_t *bs, int *teammates, int maxtea int traveltimes[MAX_CLIENTS]; bot_goal_t *goal = NULL; - if (G_UsesTeamFlags(gametype)) { + if (gametype == GT_CTF || gametype == GT_1FCTF || gametype == GT_CTF_ELIMINATION) { if (BotTeam(bs) == TEAM_RED) goal = &ctf_redflag; else @@ -304,9 +304,7 @@ void BotSayTeamOrderAlways(bot_state_t *bs, int toclient) { char buf[MAX_MESSAGE_SIZE]; char name[MAX_NETNAME]; - if (bot_nochat.integer>2) { - return; - } + if (bot_nochat.integer>2) return; //if the bot is talking to itself if (bs->client == toclient) { @@ -407,9 +405,7 @@ void BotCTFOrders_BothFlagsNotAtBase(bot_state_t *bs) { if (teammates[0] != bs->flagcarrier) other = teammates[0]; else other = teammates[1]; ClientName(other, name, sizeof(name)); - if (bot_nochat.integer<3) { - BotAI_BotInitialChat(bs, "cmd_getflag", name, NULL); - } + if (bot_nochat.integer<3) BotAI_BotInitialChat(bs, "cmd_getflag", name, NULL); BotSayTeamOrder(bs, other); BotSayVoiceTeamOrder(bs, other, VOICECHAT_GETFLAG); break; @@ -422,36 +418,28 @@ void BotCTFOrders_BothFlagsNotAtBase(bot_state_t *bs) { ClientName(other, name, sizeof(name)); if ( bs->flagcarrier != -1 ) { ClientName(bs->flagcarrier, carriername, sizeof(carriername)); - if (bot_nochat.integer<3) { - if (bs->flagcarrier == bs->client) { - BotAI_BotInitialChat(bs, "cmd_accompanyme", name, NULL); - BotSayVoiceTeamOrder(bs, other, VOICECHAT_FOLLOWME); - } - else { - BotAI_BotInitialChat(bs, "cmd_accompany", name, carriername, NULL); - BotSayVoiceTeamOrder(bs, other, VOICECHAT_FOLLOWFLAGCARRIER); - } + if (bs->flagcarrier == bs->client) { + if (bot_nochat.integer<3)BotAI_BotInitialChat(bs, "cmd_accompanyme", name, NULL); + if (bot_nochat.integer<3)BotSayVoiceTeamOrder(bs, other, VOICECHAT_FOLLOWME); + } + else { + if (bot_nochat.integer<3)BotAI_BotInitialChat(bs, "cmd_accompany", name, carriername, NULL); + if (bot_nochat.integer<3)BotSayVoiceTeamOrder(bs, other, VOICECHAT_FOLLOWFLAGCARRIER); } } else { // - if (bot_nochat.integer<3) { - BotAI_BotInitialChat(bs, "cmd_getflag", name, NULL); - BotSayVoiceTeamOrder(bs, other, VOICECHAT_GETFLAG); - } - } - if (bot_nochat.integer<3) { - BotSayTeamOrder(bs, other); + if (bot_nochat.integer<3)BotAI_BotInitialChat(bs, "cmd_getflag", name, NULL); + if (bot_nochat.integer<3)BotSayVoiceTeamOrder(bs, other, VOICECHAT_GETFLAG); } + if (bot_nochat.integer<3)BotSayTeamOrder(bs, other); //tell the one furthest from the the base not carrying the flag to get the enemy flag if (teammates[2] != bs->flagcarrier) other = teammates[2]; else other = teammates[1]; ClientName(other, name, sizeof(name)); - if (bot_nochat.integer<3) { - BotAI_BotInitialChat(bs, "cmd_getflag", name, NULL); - BotSayTeamOrder(bs, other); - BotSayVoiceTeamOrder(bs, other, VOICECHAT_RETURNFLAG); - } + if (bot_nochat.integer<3)BotAI_BotInitialChat(bs, "cmd_getflag", name, NULL); + if (bot_nochat.integer<3)BotSayTeamOrder(bs, other); + if (bot_nochat.integer<3)BotSayVoiceTeamOrder(bs, other, VOICECHAT_RETURNFLAG); break; } default: @@ -469,17 +457,15 @@ void BotCTFOrders_BothFlagsNotAtBase(bot_state_t *bs) { } // ClientName(teammates[i], name, sizeof(name)); - if (bot_nochat.integer<3) { - if (bs->flagcarrier == bs->client) { - BotAI_BotInitialChat(bs, "cmd_accompanyme", name, NULL); - BotSayVoiceTeamOrder(bs, teammates[i], VOICECHAT_FOLLOWME); - } - else { - BotAI_BotInitialChat(bs, "cmd_accompany", name, carriername, NULL); - BotSayVoiceTeamOrder(bs, teammates[i], VOICECHAT_FOLLOWFLAGCARRIER); - } - BotSayTeamOrder(bs, teammates[i]); + if (bs->flagcarrier == bs->client) { + if (bot_nochat.integer<3)BotAI_BotInitialChat(bs, "cmd_accompanyme", name, NULL); + if (bot_nochat.integer<3)BotSayVoiceTeamOrder(bs, teammates[i], VOICECHAT_FOLLOWME); + } + else { + if (bot_nochat.integer<3)BotAI_BotInitialChat(bs, "cmd_accompany", name, carriername, NULL); + if (bot_nochat.integer<3)BotSayVoiceTeamOrder(bs, teammates[i], VOICECHAT_FOLLOWFLAGCARRIER); } + if (bot_nochat.integer<3)BotSayTeamOrder(bs, teammates[i]); } } else { @@ -490,11 +476,9 @@ void BotCTFOrders_BothFlagsNotAtBase(bot_state_t *bs) { } // ClientName(teammates[i], name, sizeof(name)); - if (bot_nochat.integer<3) { - BotAI_BotInitialChat(bs, "cmd_getflag", name, NULL); - BotSayVoiceTeamOrder(bs, teammates[i], VOICECHAT_GETFLAG); - BotSayTeamOrder(bs, teammates[i]); - } + if (bot_nochat.integer<3)BotAI_BotInitialChat(bs, "cmd_getflag", name, NULL); + if (bot_nochat.integer<3)BotSayVoiceTeamOrder(bs, teammates[i], VOICECHAT_GETFLAG); + if (bot_nochat.integer<3)BotSayTeamOrder(bs, teammates[i]); } } for (i = 0; i < attackers; i++) { @@ -504,11 +488,9 @@ void BotCTFOrders_BothFlagsNotAtBase(bot_state_t *bs) { } // ClientName(teammates[numteammates - i - 1], name, sizeof(name)); - if (bot_nochat.integer<3) { - BotAI_BotInitialChat(bs, "cmd_getflag", name, NULL); - BotSayTeamOrder(bs, teammates[numteammates - i - 1]); - BotSayVoiceTeamOrder(bs, teammates[numteammates - i - 1], VOICECHAT_RETURNFLAG); - } + if (bot_nochat.integer<3)BotAI_BotInitialChat(bs, "cmd_getflag", name, NULL); + if (bot_nochat.integer<3)BotSayTeamOrder(bs, teammates[numteammates - i - 1]); + if (bot_nochat.integer<3)BotSayVoiceTeamOrder(bs, teammates[numteammates - i - 1], VOICECHAT_RETURNFLAG); } // break; @@ -525,11 +507,7 @@ void BotCTFOrders_FlagNotAtBase(bot_state_t *bs) { int numteammates, defenders, attackers, i; int teammates[MAX_CLIENTS]; char name[MAX_NETNAME]; - - if (bot_nochat.integer>2) { - return; - } - + if (bot_nochat.integer>2) return; numteammates = BotSortTeamMatesByBaseTravelTime(bs, teammates, sizeof(teammates)); BotSortTeamMatesByTaskPreference(bs, teammates, numteammates); //In oneway ctf we must all move out of the base (only one strategi, maybe we can also send some to the enemy base to meet the flag carier?) @@ -684,9 +662,7 @@ void BotCTFOrders_EnemyFlagNotAtBase(bot_state_t *bs) { int teammates[MAX_CLIENTS]; char name[MAX_NETNAME], carriername[MAX_NETNAME]; - if (bot_nochat.integer>2) { - return; - } + if (bot_nochat.integer>2) return; numteammates = BotSortTeamMatesByBaseTravelTime(bs, teammates, sizeof(teammates)); BotSortTeamMatesByTaskPreference(bs, teammates, numteammates); @@ -791,9 +767,7 @@ void BotDDorders_Standard(bot_state_t *bs) { int teammates[MAX_CLIENTS]; char name[MAX_NETNAME]; - if (bot_nochat.integer>2) { - return; - } + if (bot_nochat.integer>2) return; //sort team mates by travel time to base numteammates = BotSortTeamMatesByRelativeTravelTime2ddA(bs, teammates, sizeof(teammates)); @@ -844,9 +818,7 @@ void BotCTFOrders_BothFlagsAtBase(bot_state_t *bs) { char name[MAX_NETNAME]; qboolean weAreAttacking; - if (bot_nochat.integer>2) { - return; - } + if (bot_nochat.integer>2) return; //sort team mates by travel time to base numteammates = BotSortTeamMatesByBaseTravelTime(bs, teammates, sizeof(teammates)); @@ -1046,9 +1018,7 @@ void BotCreateGroup(bot_state_t *bs, int *teammates, int groupsize) { char name[MAX_NETNAME], leadername[MAX_NETNAME]; int i; - if (bot_nochat.integer>2) { - return; - } + if (bot_nochat.integer>2) return; // the others in the group will follow the teammates[0] ClientName(teammates[0], leadername, sizeof(leadername)); @@ -1140,9 +1110,7 @@ void Bot1FCTFOrders_FlagAtCenter(bot_state_t *bs) { int teammates[MAX_CLIENTS]; char name[MAX_NETNAME]; - if (bot_nochat.integer>2) { - return; - } + if (bot_nochat.integer>2) return; //sort team mates by travel time to base numteammates = BotSortTeamMatesByBaseTravelTime(bs, teammates, sizeof(teammates)); @@ -1291,9 +1259,7 @@ void Bot1FCTFOrders_TeamHasFlag(bot_state_t *bs) { int teammates[MAX_CLIENTS]; char name[MAX_NETNAME], carriername[MAX_NETNAME]; - if (bot_nochat.integer>2) { - return; - } + if (bot_nochat.integer>2) return; //sort team mates by travel time to base numteammates = BotSortTeamMatesByBaseTravelTime(bs, teammates, sizeof(teammates)); @@ -1498,9 +1464,7 @@ void Bot1FCTFOrders_EnemyHasFlag(bot_state_t *bs) { int teammates[MAX_CLIENTS]; char name[MAX_NETNAME]; - if (bot_nochat.integer>2) { - return; - } + if (bot_nochat.integer>2) return; //sort team mates by travel time to base numteammates = BotSortTeamMatesByBaseTravelTime(bs, teammates, sizeof(teammates)); @@ -1649,9 +1613,7 @@ void Bot1FCTFOrders_EnemyDroppedFlag(bot_state_t *bs) { int teammates[MAX_CLIENTS]; char name[MAX_NETNAME]; - if (bot_nochat.integer>2) { - return; - } + if (bot_nochat.integer>2) return; //sort team mates by travel time to base numteammates = BotSortTeamMatesByBaseTravelTime(bs, teammates, sizeof(teammates)); @@ -1814,9 +1776,7 @@ void BotObeliskOrders(bot_state_t *bs) { int teammates[MAX_CLIENTS]; char name[MAX_NETNAME]; - if (bot_nochat.integer>2) { - return; - } + if (bot_nochat.integer>2) return; //sort team mates by travel time to base numteammates = BotSortTeamMatesByBaseTravelTime(bs, teammates, sizeof(teammates)); @@ -1965,9 +1925,7 @@ void BotHarvesterOrders(bot_state_t *bs) { int teammates[MAX_CLIENTS]; char name[MAX_NETNAME]; - if (bot_nochat.integer>2) { - return; - } + if (bot_nochat.integer>2) return; //sort team mates by travel time to base numteammates = BotSortTeamMatesByBaseTravelTime(bs, teammates, sizeof(teammates)); @@ -2124,9 +2082,7 @@ int FindHumanTeamLeader(bot_state_t *bs) { // if not yet ordered to do anything if ( !BotSetLastOrderedTask(bs) ) { // go on defense by default - if (bot_nochat.integer<3) { - BotVoiceChat_Defend(bs, i, SAY_TELL); - } + if (bot_nochat.integer<3)BotVoiceChat_Defend(bs, i, SAY_TELL); } return qtrue; } @@ -2148,12 +2104,10 @@ void BotTeamAI(bot_state_t *bs) { int numteammates; char netname[MAX_NETNAME]; - if (bot_nochat.integer>2) { - return; - } + if (bot_nochat.integer>2) return; // - if (!G_IsATeamGametype(gametype)) + if ( gametype < GT_TEAM || g_ffa_gt == 1 ) return; // make sure we've got a valid team leader if (!BotValidTeamLeader(bs)) { diff --git a/code/game/ai_vcmd.c b/code/game/ai_vcmd.c index 77aa74a8..6ced12ff 100644 --- a/code/game/ai_vcmd.c +++ b/code/game/ai_vcmd.c @@ -71,7 +71,7 @@ BotVoiceChat_GetFlag */ void BotVoiceChat_GetFlag(bot_state_t *bs, int client, int mode) { // - if (G_UsesTeamFlags(gametype) && !G_UsesTheWhiteFlag(gametype)) { + if (gametype == GT_CTF || gametype == GT_CTF_ELIMINATION) { if (!ctf_redflag.areanum || !ctf_blueflag.areanum) return; } @@ -93,7 +93,7 @@ void BotVoiceChat_GetFlag(bot_state_t *bs, int client, int mode) { //set the team goal time bs->teamgoal_time = FloatTime() + CTF_GETFLAG_TIME; // get an alternate route in ctf - if (G_UsesTeamFlags(gametype) && !G_UsesTheWhiteFlag(gametype)) { + if (gametype == GT_CTF || gametype == GT_CTF_ELIMINATION) { //get an alternative route goal towards the enemy base BotGetAlternateRouteGoal(bs, BotOppositeTeam(bs)); } @@ -112,7 +112,7 @@ BotVoiceChat_Offense ================== */ void BotVoiceChat_Offense(bot_state_t *bs, int client, int mode) { - if (G_UsesTeamFlags(gametype)) { + if ( gametype == GT_CTF || gametype == GT_CTF_ELIMINATION || gametype == GT_1FCTF ) { BotVoiceChat_GetFlag(bs, client, mode); return; } @@ -162,7 +162,7 @@ BotVoiceChat_Defend ================== */ void BotVoiceChat_Defend(bot_state_t *bs, int client, int mode) { - if (gametype == GT_HARVESTER || gametype == GT_OBELISK) { + if ( gametype == GT_OBELISK || gametype == GT_HARVESTER) { // switch(BotTeam(bs)) { case TEAM_RED: memcpy(&bs->teamgoal, &redobelisk, sizeof(bot_goal_t)); break; @@ -171,7 +171,7 @@ void BotVoiceChat_Defend(bot_state_t *bs, int client, int mode) { } } else - if (G_UsesTeamFlags(gametype)) { + if (gametype == GT_CTF || gametype == GT_CTF_ELIMINATION || gametype == GT_1FCTF ) { // switch(BotTeam(bs)) { case TEAM_RED: memcpy(&bs->teamgoal, &ctf_redflag, sizeof(bot_goal_t)); break; @@ -368,7 +368,7 @@ BotVoiceChat_ReturnFlag */ void BotVoiceChat_ReturnFlag(bot_state_t *bs, int client, int mode) { //if not in CTF mode - if (!G_UsesTeamFlags(gametype)) { + if ( gametype != GT_CTF && gametype != GT_CTF_ELIMINATION && gametype != GT_1FCTF ) { return; } // @@ -419,7 +419,7 @@ BotVoiceChat_WhoIsLeader void BotVoiceChat_WhoIsLeader(bot_state_t *bs, int client, int mode) { char netname[MAX_MESSAGE_SIZE]; - if (!G_IsATeamGametype(gametype)) return; + if (!TeamPlayIsOn()) return; ClientName(bs->client, netname, sizeof(netname)); //if this bot IS the team leader @@ -497,7 +497,7 @@ int BotVoiceChatCommand(bot_state_t *bs, int mode, char *voiceChat) { int i, clientNum; char *ptr, buf[MAX_MESSAGE_SIZE], *cmd; - if (!G_IsATeamGametype(gametype)) { + if (!TeamPlayIsOn()) { return qfalse; } diff --git a/code/game/bg_misc.c b/code/game/bg_misc.c index 790feb8c..f2bafd6f 100644 --- a/code/game/bg_misc.c +++ b/code/game/bg_misc.c @@ -1288,9 +1288,6 @@ qboolean BG_CanItemBeGrabbed(int gametype, const entityState_t *ent, const playe } } } - /* Neon_Knight: For some reason, this doesn't work: - if (G_IsARoundBasedGametype(gametype) && G_IsATeamGametype(gametype)) { - */ if (gametype == GT_CTF || gametype == GT_CTF_ELIMINATION) { // ent->modelindex2 is non-zero on items if they are dropped // we need to know this because we can pick up our dropped flag (and return it) @@ -1327,8 +1324,7 @@ qboolean BG_CanItemBeGrabbed(int gametype, const entityState_t *ent, const playe } if (gametype == GT_HARVESTER) { - if ( strequals(item->classname, "item_redcube") || strequals(item->classname, "item_bluecube") ) - return qtrue; + return qtrue; } return qfalse; @@ -1539,7 +1535,18 @@ char *eventnames[] = { "EV_DEBUG_LINE", "EV_STOPLOOPINGSOUND", - "EV_TAUNT" + "EV_TAUNT", + "EV_FOOTSTEP_WOOD", + "EV_FOOTSTEP_SNOW", + "EV_FOOTSTEP_SAND", + "EV_FOOTSTEP_GRAVEL", + "EV_FOOTSTEP_FOILAGE", + "EV_FOOTSTEP_ICE", + "EV_FOOTSTEP_GLASS", + "EV_BULLET_HIT_WOOD", + "EV_BULLET_HIT_SAND", + "EV_BULLET_HIT_SNOW", + "EV_BULLET_HIT_GLASS" }; diff --git a/code/game/bg_pmove.c b/code/game/bg_pmove.c index 7daa2376..6fa0c09c 100644 --- a/code/game/bg_pmove.c +++ b/code/game/bg_pmove.c @@ -940,6 +940,28 @@ static int PM_FootstepForSurface( void ) if ( pml.groundTrace.surfaceFlags & SURF_METALSTEPS ) { return EV_FOOTSTEP_METAL; } + // leilei - additional footsteps + if ( pml.groundTrace.surfaceFlags & SURF_SNOW ) { + return EV_FOOTSTEP_SNOW; + } + if ( pml.groundTrace.surfaceFlags & SURF_WOOD ) { + return EV_FOOTSTEP_WOOD; + } + if ( pml.groundTrace.surfaceFlags & SURF_SAND ) { + return EV_FOOTSTEP_SAND; + } + if ( pml.groundTrace.surfaceFlags & SURF_GRAVEL ) { + return EV_FOOTSTEP_GRAVEL; + } + if ( pml.groundTrace.surfaceFlags & SURF_LEAVES ) { + return EV_FOOTSTEP_FOILAGE; + } + if ( pml.groundTrace.surfaceFlags & SURF_ICE ) { + return EV_FOOTSTEP_ICE; + } + if ( pml.groundTrace.surfaceFlags & SURF_GLASS ) { + return EV_FOOTSTEP_GLASS; + } return EV_FOOTSTEP; } diff --git a/code/game/bg_public.h b/code/game/bg_public.h index bf501499..e581d947 100644 --- a/code/game/bg_public.h +++ b/code/game/bg_public.h @@ -136,6 +136,7 @@ typedef enum { } gametype_t; #define GAMETYPE_IS_A_TEAM_GAME(gametype) (gametype != GT_FFA && gametype != GT_TOURNAMENT && gametype != GT_SINGLE_PLAYER && gametype != GT_LMS && gametype != GT_POSSESSION) +#define GAMETYPE_USES_KEY_OBJECTIVES(gametype) (gametype != GT_FFA && gametype != GT_TOURNAMENT && gametype != GT_SINGLE_PLAYER && gametype != GT_TEAM && gametype != GT_LMS && gametype != GT_POSSESSION) #define GAMETYPE_USES_RED_AND_BLUE_FLAG(gametype) (gametype == GT_CTF || gametype == GT_1FCTF || gametype == GT_CTF_ELIMINATION) #define GAMETYPE_USES_WHITE_FLAG(gametype) (gametype == GT_1FCTF || gametype == GT_POSSESSION) /* @@ -502,7 +503,20 @@ typedef enum { EV_TAUNT_FOLLOWME, EV_TAUNT_GETFLAG, EV_TAUNT_GUARDBASE, - EV_TAUNT_PATROL + EV_TAUNT_PATROL, + + // leilei - footsteps + EV_FOOTSTEP_SNOW, + EV_FOOTSTEP_WOOD, + EV_FOOTSTEP_SAND, + EV_FOOTSTEP_GRAVEL, + EV_FOOTSTEP_FOILAGE, + EV_FOOTSTEP_ICE, + EV_FOOTSTEP_GLASS, + EV_BULLET_HIT_WOOD, + EV_BULLET_HIT_SAND, + EV_BULLET_HIT_SNOW, + EV_BULLET_HIT_GLASS } entity_event_t; diff --git a/code/game/g_active.c b/code/game/g_active.c index 4801ba36..3e8ff38e 100644 --- a/code/game/g_active.c +++ b/code/game/g_active.c @@ -320,10 +320,10 @@ void SpectatorThink( gentity_t *ent, usercmd_t *ucmd ) { client = ent->client; - if ( G_IsARoundBasedGametype(g_gametype.integer) && G_IsATeamGametype(g_gametype.integer) && - client->sess.spectatorState != SPECTATOR_FOLLOW && - g_elimination_lockspectator.integer>1 && - ent->client->sess.sessionTeam != TEAM_SPECTATOR ) { + if ( ( g_gametype.integer == GT_ELIMINATION || g_gametype.integer == GT_CTF_ELIMINATION) && + client->sess.spectatorState != SPECTATOR_FOLLOW && + g_elimination_lockspectator.integer>1 && + ent->client->sess.sessionTeam != TEAM_SPECTATOR ) { Cmd_FollowCycle_f(ent); } @@ -367,7 +367,7 @@ void SpectatorThink( gentity_t *ent, usercmd_t *ucmd ) { } if ( ( client->buttons & BUTTON_USE_HOLDABLE ) && ! ( client->oldbuttons & BUTTON_USE_HOLDABLE ) ) { - if ( G_IsARoundBasedGametype(g_gametype.integer) && G_IsATeamGametype(g_gametype.integer) && + if ( ( g_gametype.integer == GT_ELIMINATION || g_gametype.integer == GT_CTF_ELIMINATION) && g_elimination_lockspectator.integer>1 && ent->client->sess.sessionTeam != TEAM_SPECTATOR ) { return; @@ -461,7 +461,7 @@ static void ClientTimerActions( gentity_t *ent, int msec ) { if ( ent->health > client->ps.stats[STAT_MAX_HEALTH] ) { ent->health--; } - if ( G_IsARoundBasedGametype(g_gametype.integer) && level.humansEliminated ) { + if ( (g_gametype.integer == GT_ELIMINATION || g_gametype.integer == GT_CTF_ELIMINATION || g_gametype.integer == GT_LMS) && level.humansEliminated ) { ent->damage=5; G_Damage (ent, NULL, NULL, NULL, NULL, ent->damage, DAMAGE_NO_KNOCKBACK, MOD_UNKNOWN); } @@ -1139,7 +1139,9 @@ void ClientThink_real( gentity_t *ent ) { if ( ( level.time > client->respawnTime ) && ( ( ( g_forcerespawn.integer > 0 ) && ( level.time - client->respawnTime > g_forcerespawn.integer * 1000 ) ) || - ( G_IsARoundBasedGametype(g_gametype.integer) && + ( ( ( g_gametype.integer == GT_LMS ) || + ( g_gametype.integer == GT_ELIMINATION ) || + ( g_gametype.integer == GT_CTF_ELIMINATION ) ) && ( level.time - client->respawnTime > 0 ) ) || ( ucmd->buttons & ( BUTTON_ATTACK | BUTTON_USE_HOLDABLE ) ) ) ) { diff --git a/code/game/g_arenas.c b/code/game/g_arenas.c index 450b4a8f..c16ad016 100644 --- a/code/game/g_arenas.c +++ b/code/game/g_arenas.c @@ -84,7 +84,7 @@ void UpdateTournamentInfo( void ) { } #ifdef MISSIONPACK won = qfalse; - if (G_IsATeamGametype(g_gametype.integer)) { + if (g_gametype.integer >= GT_CTF && g_ffa_gt==0) { score1 = level.teamScores[TEAM_RED]; score2 = level.teamScores[TEAM_BLUE]; if (level.clients[playerClientNum].sess.sessionTeam == TEAM_RED) { diff --git a/code/game/g_bot.c b/code/game/g_bot.c index ee29fd03..87cacffa 100644 --- a/code/game/g_bot.c +++ b/code/game/g_bot.c @@ -323,11 +323,13 @@ G_AddRandomBot */ void G_AddRandomBot( int team ) { char *teamstr; + float skill; + skill = trap_Cvar_VariableValue( "g_spSkill" ); if (team == TEAM_RED) teamstr = "red"; else if (team == TEAM_BLUE) teamstr = "blue"; else teamstr = "free"; - trap_SendConsoleCommand( EXEC_INSERT, va("addbot random %i %s %i\n", g_spSkill.integer, teamstr, 0) ); + trap_SendConsoleCommand( EXEC_INSERT, va("addbot random %f %s %i\n", skill, teamstr, 0) ); } /* @@ -436,7 +438,7 @@ void G_CheckMinimumPlayers( void ) { return; //If no AAS then don't even try } - if (G_IsATeamGametype(g_gametype.integer)) { + if (g_gametype.integer >= GT_TEAM && g_ffa_gt!=1) { if (minplayers >= g_maxclients.integer / 2) { minplayers = (g_maxclients.integer / 2) -1; } @@ -854,6 +856,7 @@ G_SpawnBots static void G_SpawnBots( char *botList, int baseDelay ) { char *bot; char *p; + float skill; int delay; char bots[MAX_INFO_VALUE]; @@ -861,11 +864,14 @@ static void G_SpawnBots( char *botList, int baseDelay ) { podium2 = NULL; podium3 = NULL; - if( g_spSkill.integer < 1 ) { - g_spSkill.integer = 1; + skill = trap_Cvar_VariableValue( "g_spSkill" ); + if( skill < 1 ) { + trap_Cvar_Set( "g_spSkill", "1" ); + skill = 1; } - else if ( g_spSkill.integer > 5 ) { - g_spSkill.integer = 5; + else if ( skill > 5 ) { + trap_Cvar_Set( "g_spSkill", "5" ); + skill = 5; } Q_strncpyz( bots, botList, sizeof(bots) ); @@ -873,7 +879,7 @@ static void G_SpawnBots( char *botList, int baseDelay ) { delay = baseDelay; while( *p ) { //skip spaces - while( *p == ' ' ) { + while( *p && *p == ' ' ) { p++; } if( !*p ) { @@ -893,7 +899,7 @@ static void G_SpawnBots( char *botList, int baseDelay ) { // we must add the bot this way, calling G_AddBot directly at this stage // does "Bad Things" - trap_SendConsoleCommand( EXEC_INSERT, va("addbot %s %i free %i\n", bot, g_spSkill.integer, delay) ); + trap_SendConsoleCommand( EXEC_INSERT, va("addbot %s %f free %i\n", bot, skill, delay) ); delay += BOT_BEGIN_DELAY_INCREMENT; } @@ -1064,20 +1070,18 @@ void G_InitBots( qboolean restart ) { G_SpawnBots( Info_ValueForKey( arenainfo, "bots" ), basedelay ); } } else { - if(bot_autominplayers.integer) { - //Set bot_minplayers - if(g_gametype.integer == GT_TOURNAMENT) { - trap_Cvar_Set("bot_minplayers","2"); //Always 2 for Tourney - } else { - basedelay = MinSpawnpointCount()/2; - if(basedelay < 3 && !(G_IsATeamGametype(g_gametype.integer))) { - basedelay = 3; //Minimum 3 for FFA - } - if(basedelay < 2 && G_IsATeamGametype(g_gametype.integer)) { - basedelay = 2; //Minimum 2 for TEAM - } - trap_Cvar_Set("bot_minplayers",va("%i",basedelay) ); - } + if(bot_autominplayers.integer) { + //Set bot_minplayers + if(g_gametype.integer == GT_TOURNAMENT) { + trap_Cvar_Set("bot_minplayers","2"); //Always 2 for Tourney + } else { + basedelay = MinSpawnpointCount()/2; + if(basedelay < 3 && (g_gametype.integer < GT_TEAM || g_ffa_gt) ) + basedelay = 3; //Minimum 3 for FFA + if(basedelay < 2 && !(g_gametype.integer < GT_TEAM || g_ffa_gt) ) + basedelay = 2; //Minimum 2 for TEAM + trap_Cvar_Set("bot_minplayers",va("%i",basedelay) ); } + } } } diff --git a/code/game/g_client.c b/code/game/g_client.c index f1b5cd89..e14bf27b 100644 --- a/code/game/g_client.c +++ b/code/game/g_client.c @@ -446,7 +446,7 @@ respawn void ClientRespawn( gentity_t *ent ) { gentity_t *tent; - if( !G_IsARoundBasedGametype(g_gametype.integer) && !ent->client->isEliminated) + if((g_gametype.integer!=GT_ELIMINATION && g_gametype.integer!=GT_CTF_ELIMINATION && g_gametype.integer !=GT_LMS) && !ent->client->isEliminated) { ent->client->isEliminated = qtrue; //must not be true in warmup } else { @@ -478,13 +478,14 @@ void ClientRespawn( gentity_t *ent ) { } } - if(G_IsARoundBasedGametype(g_gametype.integer) && ent->client->ps.pm_type == PM_SPECTATOR && ent->client->ps.stats[STAT_HEALTH] > 0) { + if((g_gametype.integer==GT_ELIMINATION || g_gametype.integer==GT_CTF_ELIMINATION || g_gametype.integer==GT_LMS) + && ent->client->ps.pm_type == PM_SPECTATOR && ent->client->ps.stats[STAT_HEALTH] > 0) { return; } ClientSpawn(ent); // add a teleportation effect - if(!G_IsARoundBasedGametype(g_gametype.integer)) + if(g_gametype.integer!=GT_ELIMINATION && g_gametype.integer!=GT_CTF_ELIMINATION && g_gametype.integer!=GT_LMS) { tent = G_TempEntity( ent->client->ps.origin, EV_PLAYER_TELEPORT_IN ); tent->s.clientNum = ent->s.clientNum; @@ -507,7 +508,7 @@ void respawnRound( gentity_t *ent ) { ClientSpawn(ent); // add a teleportation effect - if(!G_IsARoundBasedGametype(g_gametype.integer)) + if(g_gametype.integer!=GT_ELIMINATION && g_gametype.integer!=GT_CTF_ELIMINATION && g_gametype.integer!=GT_LMS) { tent = G_TempEntity( ent->client->ps.origin, EV_PLAYER_TELEPORT_IN ); tent->s.clientNum = ent->s.clientNum; @@ -1039,7 +1040,7 @@ if desired. */ void ClientUserinfoChanged( int clientNum ) { gentity_t *ent; - int teamTask, teamLeader, health; + int teamTask, teamLeader, team, health; char *s; char model[MAX_QPATH]; char headModel[MAX_QPATH]; @@ -1168,7 +1169,7 @@ void ClientUserinfoChanged( int clientNum ) { if ( ( ( client->sess.sessionTeam == TEAM_SPECTATOR ) || ( ( ( client->isEliminated ) /*|| ( client->ps.pm_type == PM_SPECTATOR )*/ ) && //Sago: If this is true client.isEliminated or TEAM_SPECTATOR is true to and this is redundant - G_IsARoundBasedGametype(g_gametype.integer) ) ) && + ( g_gametype.integer == GT_ELIMINATION || g_gametype.integer == GT_CTF_ELIMINATION || g_gametype.integer == GT_LMS) ) ) && ( client->sess.spectatorState == SPECTATOR_SCOREBOARD ) ) { Q_strncpyz( client->pers.netname, "scoreboard", sizeof(client->pers.netname) ); @@ -1194,7 +1195,7 @@ void ClientUserinfoChanged( int clientNum ) { client->ps.stats[STAT_MAX_HEALTH] = client->pers.maxHealth; // set model - if(G_IsATeamGametype(g_gametype.integer)) { + if( g_gametype.integer >= GT_TEAM && g_ffa_gt==0) { Q_strncpyz( model, Info_ValueForKey (userinfo, "team_model"), sizeof( model ) ); Q_strncpyz( headModel, Info_ValueForKey (userinfo, "team_headmodel"), sizeof( headModel ) ); } else { @@ -1202,7 +1203,24 @@ void ClientUserinfoChanged( int clientNum ) { Q_strncpyz( headModel, Info_ValueForKey (userinfo, "headmodel"), sizeof( headModel ) ); } - if (G_IsATeamGametype(g_gametype.integer) && !(ent->r.svFlags & SVF_BOT)) { + // bots set their team a few frames later + if (g_gametype.integer >= GT_TEAM && g_ffa_gt==0 && g_entities[clientNum].r.svFlags & SVF_BOT) { + s = Info_ValueForKey( userinfo, "team" ); + if ( Q_strequal( s, "red" ) || Q_strequal( s, "r" ) ) { + team = TEAM_RED; + } else if ( Q_strequal( s, "blue" ) || Q_strequal( s, "b" ) ) { + team = TEAM_BLUE; + } else { + // pick the team with the least number of players + team = PickTeam( clientNum ); + } + client->sess.sessionTeam = team; + } + else { + team = client->sess.sessionTeam; + } + + if (g_gametype.integer >= GT_TEAM && g_ffa_gt!=1) { client->pers.teamInfo = qtrue; } else { s = Info_ValueForKey( userinfo, "teamoverlay" ); @@ -1219,7 +1237,7 @@ void ClientUserinfoChanged( int clientNum ) { teamLeader = client->sess.teamLeader; // colors - if(G_IsATeamGametype(g_gametype.integer) && g_instantgib.integer) { + if( g_gametype.integer >= GT_TEAM && g_ffa_gt==0 && g_instantgib.integer) { switch(client->sess.sessionTeam) { case TEAM_RED: c1[0] = COLOR_BLUE; @@ -1391,7 +1409,8 @@ char *ClientConnect( int clientNum, qboolean firstTime, qboolean isBot ) { trap_SendServerCommand( -1, va("print \"%s" S_COLOR_WHITE " connected\n\"", client->pers.netname) ); } - if (G_IsATeamGametype(g_gametype.integer) && client->sess.sessionTeam != TEAM_SPECTATOR ) { + if ( g_gametype.integer >= GT_TEAM && + client->sess.sessionTeam != TEAM_SPECTATOR ) { BroadcastTeamChange( client, -1 ); } @@ -1504,7 +1523,7 @@ void ClientBegin( int clientNum ) { countFree = TeamCount(-1,TEAM_FREE); countRed = TeamCount(-1,TEAM_RED); countBlue = TeamCount(-1,TEAM_BLUE); - if(!G_IsATeamGametype(g_gametype.integer)) + if(g_gametype.integer < GT_TEAM || g_ffa_gt) { if(countFree>level.teamSize) level.teamSize=countFree; @@ -1539,7 +1558,9 @@ void ClientBegin( int clientNum ) { if( ( client->sess.sessionTeam != TEAM_SPECTATOR ) && ( ( !( client->isEliminated ) /*&& ( ( !client->ps.pm_type ) == PM_SPECTATOR ) */ ) || //Sago: Yes, it made no sense - ( (!G_IsARoundBasedGametype(g_gametype.integer) || level.intermissiontime) ) ) ) { + ( ( g_gametype.integer != GT_ELIMINATION || level.intermissiontime) && + ( g_gametype.integer != GT_CTF_ELIMINATION || level.intermissiontime) && + ( g_gametype.integer != GT_LMS || level.intermissiontime ) ) ) ) { // send event tent = G_TempEntity( ent->client->ps.origin, EV_PLAYER_TELEPORT_IN ); tent->s.clientNum = ent->s.clientNum; @@ -1603,7 +1624,15 @@ void ClientSpawn(gentity_t *ent) { //In Elimination the player should not spawn if he have already spawned in the round (but not for spectators) // N_G: You've obviously wanted something ELSE //Sago: Yes, the !level.intermissiontime is currently redundant but it might still be the bast place to make the test, CheckElimination in g_main makes sure the next if will fail and the rest of the things this block does might not affect if in Intermission (I'll just test that) - if((((G_IsARoundBasedGametype(g_gametype.integer) && G_IsATeamGametype(g_gametype.integer)) || (g_gametype.integer == GT_LMS && client->isEliminated)) && (!level.intermissiontime || level.warmupTime != 0)) && ( client->sess.sessionTeam != TEAM_SPECTATOR)) + if( + ( + ( + g_gametype.integer == GT_ELIMINATION || + g_gametype.integer == GT_CTF_ELIMINATION || (g_gametype.integer == GT_LMS && client->isEliminated)) && + (!level.intermissiontime || level.warmupTime != 0) + ) && + ( client->sess.sessionTeam != TEAM_SPECTATOR ) + ) { // N_G: Another condition that makes no sense to me, see for // yourself if you really meant this @@ -1664,8 +1693,8 @@ void ClientSpawn(gentity_t *ent) { // find a spawn point // do it before setting health back up, so farthest // ranging doesn't count this client - if ((client->sess.sessionTeam == TEAM_SPECTATOR) || ((client->ps.pm_type == PM_SPECTATOR || client->isEliminated ) && - (G_IsARoundBasedGametype(g_gametype.integer) && G_IsATeamGametype(g_gametype.integer)))) { + if ((client->sess.sessionTeam == TEAM_SPECTATOR) + || ( (client->ps.pm_type == PM_SPECTATOR || client->isEliminated ) && (g_gametype.integer == GT_ELIMINATION || g_gametype.integer == GT_CTF_ELIMINATION) ) ) { spawnPoint = SelectSpectatorSpawnPoint ( spawn_origin, spawn_angles); } else if (g_gametype.integer == GT_DOUBLE_D) { //Double Domination uses special spawn points: @@ -1673,7 +1702,7 @@ void ClientSpawn(gentity_t *ent) { } else if (g_gametype.integer == GT_DOMINATION) { //Domination uses special spawn points: spawnPoint = SelectDominationSpawnPoint (client->sess.sessionTeam, spawn_origin, spawn_angles); - } else if (G_IsATeamGametype(g_gametype.integer)) { + } else if (g_gametype.integer >= GT_CTF && g_ffa_gt==0 ) { // all base oriented team games use the CTF spawn points spawnPoint = SelectCTFSpawnPoint ( client->sess.sessionTeam, @@ -1780,7 +1809,7 @@ void ClientSpawn(gentity_t *ent) { client->ps.clientNum = index; - if(!G_IsARoundBasedGametype(g_gametype.integer) && !g_elimination_allgametypes.integer) + if(g_gametype.integer != GT_ELIMINATION && g_gametype.integer != GT_CTF_ELIMINATION && g_gametype.integer != GT_LMS && !g_elimination_allgametypes.integer) { client->ps.stats[STAT_WEAPONS] = ( 1 << WP_MACHINEGUN ); if ( g_gametype.integer == GT_TEAM ) { @@ -1874,15 +1903,14 @@ void ClientSpawn(gentity_t *ent) { // the respawned flag will be cleared after the attack and jump keys come up client->ps.pm_flags |= PMF_RESPAWNED; - if(G_IsARoundBasedGametype(g_gametype.integer)) { + if(g_gametype.integer==GT_ELIMINATION || g_gametype.integer==GT_CTF_ELIMINATION || g_gametype.integer==GT_LMS) client->ps.pm_flags |= PMF_ELIMWARMUP; - } trap_GetUsercmd( client - level.clients, &ent->client->pers.cmd ); SetClientViewAngle( ent, spawn_angles ); if ( (ent->client->sess.sessionTeam == TEAM_SPECTATOR) || ((client->ps.pm_type == PM_SPECTATOR || client->isEliminated) && - G_IsARoundBasedGametype(g_gametype.integer))) { + (g_gametype.integer == GT_ELIMINATION || g_gametype.integer == GT_CTF_ELIMINATION || g_gametype.integer == GT_LMS) ) ) { } else { G_KillBox( ent ); trap_LinkEntity (ent); @@ -1929,8 +1957,8 @@ void ClientSpawn(gentity_t *ent) { ClientThink( ent-g_entities ); // positively link the client, even if the command times are weird - if ( (ent->client->sess.sessionTeam != TEAM_SPECTATOR) || ( (!client->isEliminated || client->ps.pm_type != PM_SPECTATOR) && - G_IsARoundBasedGametype(g_gametype.integer) ) ) { + if ( (ent->client->sess.sessionTeam != TEAM_SPECTATOR) || ( (!client->isEliminated || client->ps.pm_type != PM_SPECTATOR)&& + (g_gametype.integer == GT_ELIMINATION || g_gametype.integer == GT_CTF_ELIMINATION || g_gametype.integer == GT_LMS) ) ) { BG_PlayerStateToEntityState( &client->ps, &ent->s, qtrue ); VectorCopy( ent->client->ps.origin, ent->r.currentOrigin ); trap_LinkEntity( ent ); diff --git a/code/game/g_cmds.c b/code/game/g_cmds.c index a6c5f17b..fd9d170c 100644 --- a/code/game/g_cmds.c +++ b/code/game/g_cmds.c @@ -785,7 +785,7 @@ void SetTeam( gentity_t *ent, const char *s ) { team = TEAM_SPECTATOR; specState = SPECTATOR_FREE; } - else if (G_IsATeamGametype(g_gametype.integer)) { + else if ( g_gametype.integer >= GT_TEAM && g_ffa_gt!=1) { // if running a team game, assign player to one of the teams specState = SPECTATOR_NOT; if ( Q_strequal( s, "red" ) || Q_strequal( s, "r" ) ) { @@ -929,7 +929,7 @@ to free floating spectator mode ================= */ void StopFollowing( gentity_t *ent ) { - if(!G_IsARoundBasedGametype(g_gametype.integer)) + if(g_gametype.integerGT_LMS) { //Shouldn't this already be the case? ent->client->ps.persistant[ PERS_TEAM ] = TEAM_SPECTATOR; @@ -1039,7 +1039,7 @@ void Cmd_Follow_f( gentity_t *ent ) { return; } - if ( G_IsARoundBasedGametype(g_gametype.integer) && G_IsATeamGametype(g_gametype.integer) && g_elimination_lockspectator.integer + if ( (g_gametype.integer == GT_ELIMINATION || g_gametype.integer == GT_CTF_ELIMINATION) && g_elimination_lockspectator.integer && ((ent->client->sess.sessionTeam == TEAM_RED && level.clients[ i ].sess.sessionTeam == TEAM_BLUE) || (ent->client->sess.sessionTeam == TEAM_BLUE && level.clients[ i ].sess.sessionTeam == TEAM_RED) ) ) { return; @@ -1141,7 +1141,7 @@ void Cmd_FollowCycle_f( gentity_t *ent ) { } //Stop players from spectating players on the enemy team in elimination modes. - if ( (G_IsARoundBasedGametype(g_gametype.integer) && G_IsATeamGametype(g_gametype.integer)) && g_elimination_lockspectator.integer + if ( (g_gametype.integer == GT_ELIMINATION || g_gametype.integer == GT_CTF_ELIMINATION) && g_elimination_lockspectator.integer && ((ent->client->sess.sessionTeam == TEAM_RED && level.clients[ clientnum ].sess.sessionTeam == TEAM_BLUE) || (ent->client->sess.sessionTeam == TEAM_BLUE && level.clients[ clientnum ].sess.sessionTeam == TEAM_RED) ) ) { continue; @@ -1180,7 +1180,7 @@ static void G_SayTo( gentity_t *ent, gentity_t *other, int mode, int color, cons return; } - if ((ent->r.svFlags & SVF_BOT) && g_bot_noChat.integer > 1) return; + if ((ent->r.svFlags & SVF_BOT) && trap_Cvar_VariableValue( "bot_nochat" )>1) return; // no chatting to players in tournements if ( (g_gametype.integer == GT_TOURNAMENT ) @@ -1205,15 +1205,9 @@ void G_Say( gentity_t *ent, gentity_t *target, int mode, const char *chatText ) char text[MAX_SAY_TEXT]; char location[64]; - if (!ent) { - return; - } - - if ((ent->r.svFlags & SVF_BOT) && g_bot_noChat.integer > 1) { - return; - } + if ((ent->r.svFlags & SVF_BOT) && trap_Cvar_VariableValue( "bot_nochat" )>1) return; - if ( !G_IsATeamGametype(g_gametype.integer) && mode == SAY_TEAM ) { + if ( (g_gametype.integer < GT_TEAM || g_ffa_gt == 1) && mode == SAY_TEAM ) { mode = SAY_ALL; } @@ -1235,7 +1229,7 @@ void G_Say( gentity_t *ent, gentity_t *target, int mode, const char *chatText ) color = COLOR_CYAN; break; case SAY_TELL: - if (target && target->inuse && target->client && G_IsATeamGametype(g_gametype.integer) && + if (target && target->inuse && target->client && g_gametype.integer >= GT_TEAM && g_ffa_gt != 1 && target->client->sess.sessionTeam == ent->client->sess.sessionTeam && Team_GetLocationMsg(ent, location, sizeof(location))) Com_sprintf (name, sizeof(name), EC"[%s%c%c"EC"] (%s)"EC": ", ent->client->pers.netname, Q_COLOR_ESCAPE, COLOR_WHITE, location ); @@ -1244,7 +1238,7 @@ void G_Say( gentity_t *ent, gentity_t *target, int mode, const char *chatText ) color = COLOR_MAGENTA; break; } - + // Add the chat text Q_strncpyz( text, chatText, sizeof(text) ); if ( target ) { @@ -1384,7 +1378,7 @@ void G_Voice( gentity_t *ent, gentity_t *target, int mode, const char *id, qbool int j; gentity_t *other; - if ( !G_IsATeamGametype(g_gametype.integer) && mode == SAY_TEAM ) { + if ( (g_gametype.integer < GT_TEAM || g_ffa_gt==1 ) && mode == SAY_TEAM ) { mode = SAY_ALL; } @@ -1539,7 +1533,7 @@ static void Cmd_VoiceTaunt_f( gentity_t *ent ) { } } - if (G_IsATeamGametype(g_gametype.integer)) { + if (g_gametype.integer >= GT_TEAM && g_ffa_gt!=1) { // praise a team mate who just got a reward for(i = 0; i < MAX_CLIENTS; i++) { who = g_entities + i; @@ -1909,7 +1903,7 @@ void Cmd_CallVote_f( gentity_t *ent ) { Com_sprintf( level.voteDisplayString, sizeof( level.voteDisplayString ), "Kick %s?" , level.clients[i].pers.netname ); } else if ( Q_strequal( arg1, "shuffle" ) ) { - if(!G_IsATeamGametype(g_gametype.integer)) { //Not a team game + if(g_gametype.integers.weapon; //Never drop in elimination or last man standing mode! - if(G_IsARoundBasedGametype(g_gametype.integer) && !G_UsesTeamFlags(g_gametype.integer)) + if( g_gametype.integer == GT_ELIMINATION || g_gametype.integer == GT_LMS) return; // make a special check to see if they are changing to a new @@ -414,7 +414,7 @@ void CheckAlmostCapture( gentity_t *self, gentity_t *attacker ) self->client->ps.powerups[PW_BLUEFLAG] || self->client->ps.powerups[PW_NEUTRALFLAG] ) { // get the goal flag this player should have been going for - if (G_UsesTeamFlags(g_gametype.integer) && !G_UsesTheWhiteFlag(g_gametype.integer)) { + if ( g_gametype.integer == GT_CTF || g_gametype.integer == GT_CTF_ELIMINATION) { if ( self->client->sess.sessionTeam == TEAM_BLUE ) { classname = "team_CTF_blueflag"; } @@ -567,7 +567,7 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int ent->s.otherEntityNum2 = killer; //Sago: Hmmm... generic? Can I transmit anything I like? Like if it is a team kill? Let's try ent->s.generic1 = OnSameTeam (self, attacker); - if( !((G_IsARoundBasedGametype(g_gametype.integer) && G_IsATeamGametype(g_gametype.integer)) && level.time < level.roundStartTime) ) { + if( !((g_gametype.integer==GT_ELIMINATION || g_gametype.integer==GT_CTF_ELIMINATION) && level.time < level.roundStartTime) ) { ent->r.svFlags = SVF_BROADCAST; // send to everyone (if not an elimination gametype during active warmup) } else { @@ -582,8 +582,8 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int attacker->client->lastkilled_client = self->s.number; if ( attacker == self || OnSameTeam (self, attacker ) ) { - if(g_gametype.integer != GT_POSSESSION && !G_IsARoundBasedGametype(g_gametype.integer) && level.time < level.roundStartTime) { - if( (G_IsATeamGametype(g_gametype.integer) && self->client->ps.persistant[PERS_SCORE]>0) || level.numNonSpectatorClients<3) { + if(g_gametype.integer!=GT_LMS && g_gametype.integer != GT_POSSESSION && !((g_gametype.integer==GT_ELIMINATION || g_gametype.integer==GT_CTF_ELIMINATION) && level.time < level.roundStartTime)) { + if( (g_gametype.integer client->ps.persistant[PERS_SCORE]>0) || level.numNonSpectatorClients<3) { //Cannot get negative scores by suicide AddScore( attacker, self->r.currentOrigin, -1 ); } @@ -762,7 +762,8 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int } } else { - if(g_gametype.integer != GT_POSSESSION && !G_IsARoundBasedGametype(g_gametype.integer) && level.time < level.roundStartTime) { + if(g_gametype.integer!=GT_LMS && g_gametype.integer != GT_POSSESSION && + !((g_gametype.integer==GT_ELIMINATION || g_gametype.integer==GT_CTF_ELIMINATION) && level.time < level.roundStartTime)) { if(self->client->ps.persistant[PERS_SCORE]>0 || level.numNonSpectatorClients<3) { //Cannot get negative scores by suicide AddScore( self, self->r.currentOrigin, -1 ); @@ -839,7 +840,7 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int self->client->respawnTime = i*g_respawntime.integer*1000; } //However during warm up, we should respawn quicker! - if(G_IsARoundBasedGametype(g_gametype.integer)) { + if(g_gametype.integer == GT_ELIMINATION || g_gametype.integer == GT_CTF_ELIMINATION || g_gametype.integer == GT_LMS) { if(level.time<=level.roundStartTime && level.time>level.roundStartTime-1000*g_elimination_activewarmup.integer) { self->client->respawnTime = level.time + rand()%800; } @@ -1197,7 +1198,7 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, // if TF_NO_FRIENDLY_FIRE is set, don't do damage to the target // if the attacker was on the same team if ( mod != MOD_JUICED && mod != MOD_CRUSH && targ != attacker && !(dflags & DAMAGE_NO_TEAM_PROTECTION) && OnSameTeam (targ, attacker) ) { - if ( ( !g_friendlyFire.integer && !(G_IsARoundBasedGametype(g_gametype.integer) && G_IsATeamGametype(g_gametype.integer)) ) || ( g_elimination_selfdamage.integer<2 && G_IsARoundBasedGametype(g_gametype.integer) ) ) { + if ( ( !g_friendlyFire.integer && g_gametype.integer != GT_ELIMINATION && g_gametype.integer != GT_CTF_ELIMINATION ) || ( g_elimination_selfdamage.integer<2 && (g_gametype.integer == GT_ELIMINATION || g_gametype.integer == GT_CTF_ELIMINATION) ) ) { return; } } @@ -1257,7 +1258,7 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, damage *= 0.5; } - if(targ->client && attacker->client ) { + if(targ && targ->client && attacker->client ) { damage = catchup_damage(damage, attacker->client->ps.persistant[PERS_SCORE], targ->client->ps.persistant[PERS_SCORE]); } @@ -1273,14 +1274,14 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, damage = 0; } - if ((G_IsARoundBasedGametype(g_gametype.integer) || g_elimination_allgametypes.integer) && - g_elimination_selfdamage.integer<1 && ( targ == attacker || mod == MOD_FALLING )) { + if ((g_gametype.integer == GT_ELIMINATION || g_gametype.integer == GT_CTF_ELIMINATION || g_gametype.integer == GT_LMS || g_elimination_allgametypes.integer) + && g_elimination_selfdamage.integer<1 && ( targ == attacker || mod == MOD_FALLING )) { damage = 0; } //So people can be telefragged! - if (G_IsARoundBasedGametype(g_gametype.integer) && level.time < level.roundStartTime && ((mod == MOD_LAVA) || (mod == MOD_SLIME)) ) { + if ((g_gametype.integer == GT_ELIMINATION || g_gametype.integer == GT_CTF_ELIMINATION || g_gametype.integer == GT_LMS) && level.time < level.roundStartTime && ((mod == MOD_LAVA) || (mod == MOD_SLIME)) ) { damage = 1000; } @@ -1324,7 +1325,7 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, } // See if it's the player hurting the emeny flag carrier - if(G_UsesTeamFlags(g_gametype.integer)) { + if( g_gametype.integer == GT_CTF || g_gametype.integer == GT_1FCTF || g_gametype.integer == GT_CTF_ELIMINATION) { Team_CheckHurtCarrier(targ, attacker); } diff --git a/code/game/g_elimination.c b/code/game/g_elimination.c index 9440ae6c..16228b59 100644 --- a/code/game/g_elimination.c +++ b/code/game/g_elimination.c @@ -188,7 +188,8 @@ void CheckElimination(void) { int countHumans; if ( level.numPlayingClients < 1 ) { - if( G_IsARoundBasedGametype(g_gametype.integer) && G_IsATeamGametype(g_gametype.integer) && ( level.time+1000*g_elimination_warmup.integer-500>level.roundStartTime )) { + if( (g_gametype.integer == GT_ELIMINATION || g_gametype.integer == GT_CTF_ELIMINATION) && + ( level.time+1000*g_elimination_warmup.integer-500>level.roundStartTime )) { RestartEliminationRound(); //For spectators } return; @@ -203,7 +204,7 @@ void CheckElimination(void) { return; } - if(!(G_IsARoundBasedGametype(g_gametype.integer) && G_IsATeamGametype(g_gametype.integer))) { + if(g_gametype.integer != GT_ELIMINATION && g_gametype.integer != GT_CTF_ELIMINATION) { return; } diff --git a/code/game/g_items.c b/code/game/g_items.c index 25cbdcca..8b13e1a3 100644 --- a/code/game/g_items.c +++ b/code/game/g_items.c @@ -88,7 +88,7 @@ int Pickup_Powerup( gentity_t *ent, gentity_t *other ) // if same team in team game, no sound // cannot use OnSameTeam as it expects to g_entities, not clients - if (G_IsATeamGametype(g_gametype.integer) && other->client->sess.sessionTeam == client->sess.sessionTeam ) { + if ( g_gametype.integer >= GT_TEAM && g_ffa_gt==0 && other->client->sess.sessionTeam == client->sess.sessionTeam ) { continue; } @@ -631,7 +631,8 @@ gentity_t *LaunchItem( gitem_t *item, vec3_t origin, vec3_t velocity ) VectorCopy( velocity, dropped->s.pos.trDelta ); dropped->s.eFlags |= EF_BOUNCE_HALF; - if ((G_UsesTeamFlags(g_gametype.integer) || G_UsesTheWhiteFlag(g_gametype.integer) || g_gametype.integer == GT_DOUBLE_D) + if ((g_gametype.integer == GT_CTF || g_gametype.integer == GT_1FCTF || + g_gametype.integer == GT_CTF_ELIMINATION || g_gametype.integer == GT_DOUBLE_D || g_gametype.integer == GT_POSSESSION) && item->giType == IT_TEAM) { // Special case for CTF flags dropped->think = Team_DroppedFlagThink; dropped->nextthink = level.time + 30000; @@ -741,7 +742,8 @@ void FinishSpawningItem( gentity_t *ent ) // powerups don't spawn in for a while (but not in elimination) - if(!G_IsARoundBasedGametype(g_gametype.integer) && !g_instantgib.integer && !g_elimination_allgametypes.integer && !g_rockets.integer ) + if(g_gametype.integer != GT_ELIMINATION && g_gametype.integer != GT_CTF_ELIMINATION && g_gametype.integer != GT_LMS + && !g_instantgib.integer && !g_elimination_allgametypes.integer && !g_rockets.integer ) if ( ent->item->giType == IT_POWERUP ) { float respawn; @@ -771,7 +773,7 @@ void G_CheckTeamItems( void ) // Set up team stuff Team_InitGame(); - if( (G_UsesTeamFlags(g_gametype.integer) && !G_UsesTheWhiteFlag(g_gametype.integer)) || g_gametype.integer == GT_DOUBLE_D) { + if( g_gametype.integer == GT_CTF || g_gametype.integer == GT_CTF_ELIMINATION || g_gametype.integer == GT_DOUBLE_D) { gitem_t *item; // check for the two flags @@ -865,7 +867,8 @@ void ClearRegisteredItems( void ) // players always start with the base weapon RegisterItem( BG_FindItemForWeapon( WP_MACHINEGUN ) ); RegisterItem( BG_FindItemForWeapon( WP_GAUNTLET ) ); - if(G_IsARoundBasedGametype(g_gametype.integer) || g_elimination_allgametypes.integer) { + if(g_gametype.integer == GT_ELIMINATION || g_gametype.integer == GT_CTF_ELIMINATION + || g_gametype.integer == GT_LMS || g_elimination_allgametypes.integer) { RegisterItem( BG_FindItemForWeapon( WP_SHOTGUN ) ); RegisterItem( BG_FindItemForWeapon( WP_GRENADE_LAUNCHER ) ); RegisterItem( BG_FindItemForWeapon( WP_ROCKET_LAUNCHER ) ); @@ -1006,7 +1009,7 @@ void G_SpawnItem (gentity_t *ent, gitem_t *item) ent->s.eFlags |= EF_NODRAW; //Don't draw the flag models/persistant powerups } - if( !G_UsesTheWhiteFlag(g_gametype.integer) && strequals(ent->classname, "team_CTF_neutralflag")) { + if( g_gametype.integer != GT_1FCTF && g_gametype.integer != GT_POSSESSION && strequals(ent->classname, "team_CTF_neutralflag")) { ent->s.eFlags |= EF_NODRAW; // Don't draw the flag in CTF_elimination } diff --git a/code/game/g_killspree.c b/code/game/g_killspree.c index 7e1e2ed7..706cf294 100644 --- a/code/game/g_killspree.c +++ b/code/game/g_killspree.c @@ -286,7 +286,7 @@ void G_RunStreakLogic( gentity_t *attacker, gentity_t *victim ) && ( attacker != victim ) ) { //Check the gametype--If FFA enabled, everybody's on the same team. - if(G_IsATeamGametype(g_gametype.integer)) { + if( g_gametype.integer >= GT_TEAM && g_ffa_gt!= 1 ) { //If they are on the same team we don't want to count it towards a killing spree. if( OnSameTeam( victim, attacker ) ) { return; diff --git a/code/game/g_local.h b/code/game/g_local.h index 8a149374..b9931c55 100644 --- a/code/game/g_local.h +++ b/code/game/g_local.h @@ -1121,13 +1121,19 @@ extern vmCvar_t g_instantgib; extern vmCvar_t g_vampire; extern vmCvar_t g_vampireMaxHealth; //new in elimination Beta3 -extern vmCvar_t g_regen; -extern vmCvar_t g_lms_lives; -extern vmCvar_t g_lms_mode; //How do we score: 0 = One Survivor get a point, 1 = same but without overtime, 2 = one point for each player killed (+overtime), 3 = same without overtime -extern vmCvar_t g_elimination_ctf_oneway; //Only attack in one direction (level.eliminationSides+level.roundNumber)%2 == 0 red attacks -extern vmCvar_t g_awardpushing; //The server can decide if players are awarded for pushing people in lave etc. +extern vmCvar_t g_regen; +//Free for all gametype +extern int g_ffa_gt; //0 = TEAM GAME, 1 = FFA, 2 = TEAM GAME without bases + +extern vmCvar_t g_lms_lives; + +extern vmCvar_t g_lms_mode; //How do we score: 0 = One Survivor get a point, 1 = same but without overtime, 2 = one point for each player killed (+overtime), 3 = same without overtime + +extern vmCvar_t g_elimination_ctf_oneway; //Only attack in one direction (level.eliminationSides+level.roundNumber)%2 == 0 red attacks + + +extern vmCvar_t g_catchup; //Favors the week players extern vmCvar_t g_runes; -extern vmCvar_t g_catchup; //Favors the week players extern vmCvar_t g_autonextmap; //Autochange map extern vmCvar_t g_mappools; //mappools to be used for autochange extern vmCvar_t g_voteNames; @@ -1176,8 +1182,7 @@ extern vmCvar_t g_harvesterFromBodies; extern vmCvar_t g_ddCaptureTime; extern vmCvar_t g_ddRespawnDelay; extern vmCvar_t g_developer; -extern vmCvar_t g_spSkill; -extern vmCvar_t g_bot_noChat; +extern vmCvar_t g_awardpushing; void trap_Printf( const char *fmt ); void trap_Error( const char *fmt ) __attribute__((noreturn)); @@ -1426,9 +1431,4 @@ void MapInfoPrint(mapinfo_result_t *info); void monster_die (gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int mod); -/* Neon_Knight: Useful check in order to have code consistency. */ -qboolean G_IsATeamGametype(int check); /* Whether the gametype is team-based or not.*/ -qboolean G_UsesTeamFlags(int check); /* Whether the gametype uses the red and blue flags. */ -qboolean G_UsesTheWhiteFlag(int check); /* Whether the gametype uses the neutral flag. */ -qboolean G_IsARoundBasedGametype(int check); /* Whether the gametype uses the neutral flag. */ -/* /Neon_Knight */ + diff --git a/code/game/g_main.c b/code/game/g_main.c index b9924771..e9e9cf17 100644 --- a/code/game/g_main.c +++ b/code/game/g_main.c @@ -136,12 +136,14 @@ vmCvar_t g_instantgib; vmCvar_t g_vampire; vmCvar_t g_vampireMaxHealth; //Regen -vmCvar_t g_regen; -vmCvar_t g_lms_lives; -vmCvar_t g_lms_mode; -vmCvar_t g_elimination_ctf_oneway; -vmCvar_t g_awardpushing; //The server can decide if players are awarded for pushing people in lave etc. +vmCvar_t g_regen; +int g_ffa_gt; //Are this a FFA gametype even if gametype is high? +vmCvar_t g_lms_lives; +vmCvar_t g_lms_mode; +vmCvar_t g_elimination_ctf_oneway; +vmCvar_t g_awardpushing; //The server can decide if players are awarded for pushing people in lave etc. vmCvar_t g_runes; //Allow missionpack style persistant powerups? + vmCvar_t g_catchup; //Favors the week players vmCvar_t g_autonextmap; //Autochange map vmCvar_t g_mappools; //mappools to be used for autochange @@ -193,8 +195,6 @@ vmCvar_t g_harvesterFromBodies; vmCvar_t g_ddCaptureTime; vmCvar_t g_ddRespawnDelay; vmCvar_t g_developer; -vmCvar_t g_spSkill; -vmCvar_t g_bot_noChat; mapinfo_result_t mapinfo; @@ -361,8 +361,6 @@ static cvarTable_t gameCvarTable[] = { { &g_lms_lives, "g_lms_lives", "1", 0, 0, qtrue }, { &g_lms_mode, "g_lms_mode", "0", CVAR_SERVERINFO | CVAR_ARCHIVE, 0, qtrue }, - { &g_catchup, "g_catchup", "0", CVAR_ARCHIVE, 0, qtrue}, - { &g_autonextmap, "g_autonextmap", "0", CVAR_ARCHIVE, 0, qfalse}, { &g_mappools, "g_mappools", "0\\maps_dm.cfg\\1\\maps_tourney.cfg\\3\\maps_tdm.cfg\\4\\maps_ctf.cfg\\5\\maps_oneflag.cfg\\6\\maps_obelisk.cfg\ @@ -410,9 +408,7 @@ static cvarTable_t gameCvarTable[] = { { &g_ddCaptureTime, "g_ddCaptureTime", "10", CVAR_ARCHIVE, 0, qtrue}, { &g_ddRespawnDelay, "g_ddRespawnDelay", "10", CVAR_ARCHIVE, 0, qtrue}, /* Neon_Knight: Developer mode*/ - { &g_developer, "developer", "0", CVAR_CHEAT, 0, qtrue}, - { &g_spSkill, "g_spSkill", "2", 0, 0, qtrue}, - { &g_bot_noChat, "bot_nochat", "0", 0, 0, qtrue} + { &g_developer, "developer", "0", CVAR_CHEAT, 0, qtrue} }; @@ -601,6 +597,14 @@ void G_RegisterCvars( void ) trap_Cvar_Set( "g_gametype", "0" ); } + //set FFA status for high gametypes: + if ( g_gametype.integer == GT_LMS || g_gametype.integer == GT_POSSESSION ) { + g_ffa_gt = 1; //Last Man standig is a FFA gametype + } + else { + g_ffa_gt = 0; //If >GT_CTF use bases + } + level.warmupModificationCount = g_warmup.modificationCount; } @@ -846,9 +850,8 @@ void G_InitGame( int levelTime, int randomSeed, int restart ) G_FindTeams(); // make sure we have flags for CTF, etc - if (G_UsesTeamFlags(g_gametype.integer) || G_UsesTheWhiteFlag(g_gametype.integer) || - g_gametype.integer == GT_HARVESTER || g_gametype.integer == GT_OBELISK || - g_gametype.integer == GT_DOUBLE_D || g_gametype.integer == GT_DOMINATION) { + if ( g_gametype.integer == GT_POSSESSION || + (g_gametype.integer >= GT_TEAM && g_ffa_gt!=1) ) { G_CheckTeamItems(); } @@ -1199,7 +1202,7 @@ int QDECL SortRanks( const void *a, const void *b ) } //In elimination and CTF elimination, sort dead players last - if(G_UsesTeamFlags(g_gametype.integer) && !G_UsesTheWhiteFlag(g_gametype.integer) + if((g_gametype.integer == GT_ELIMINATION || g_gametype.integer == GT_CTF_ELIMINATION) && level.roundNumber==level.roundNumberStarted && (ca->isEliminated != cb->isEliminated)) { if( ca->isEliminated ) return 1; @@ -1282,7 +1285,7 @@ void CalculateRanks( void ) sizeof(level.sortedClients[0]), SortRanks ); // set the rank value for all clients that are connected and not spectators - if (G_IsATeamGametype(g_gametype.integer)) { + if ( g_gametype.integer >= GT_TEAM && g_ffa_gt!=1) { // in team games, rank is just the order of the teams, 0=red, 1=blue, 2=tied for ( i = 0; i < level.numConnectedClients; i++ ) { cl = &level.clients[ level.sortedClients[i] ]; @@ -1321,7 +1324,7 @@ void CalculateRanks( void ) } // set the CS_SCORES1/2 configstrings, which will be visible to everyone - if (G_IsATeamGametype(g_gametype.integer)) { + if ( g_gametype.integer >= GT_TEAM && g_ffa_gt!=1) { trap_SetConfigstring( CS_SCORES1, va("%i", level.teamScores[TEAM_RED] ) ); trap_SetConfigstring( CS_SCORES2, va("%i", level.teamScores[TEAM_BLUE] ) ); } @@ -1409,9 +1412,6 @@ static void SendVictoryChallenge( void ) case GT_FFA: award = GAMETYPES_FFA_WINS; break; - case GT_TEAM: - award = GAMETYPES_TDM_WINS; - break; case GT_TOURNAMENT: award = GAMETYPES_TOURNEY_WINS; break; @@ -1448,7 +1448,7 @@ static void SendVictoryChallenge( void ) default: return; }; - if (G_IsATeamGametype(g_gametype.integer)) { + if ( g_gametype.integer!=GT_FFA && g_gametype.integer!=GT_TOURNAMENT && g_gametype.integer!=GT_LMS && g_gametype.integer!=GT_POSSESSION ) { //Team games for ( i = 0 ; i < level.maxclients ; i++ ) { cl = &level.clients[i]; @@ -1855,7 +1855,7 @@ void LogExit( const char *string ) numSorted = 32; } - if (G_IsATeamGametype(g_gametype.integer)) { + if ( g_gametype.integer >= GT_TEAM && g_ffa_gt!=1) { G_LogPrintf( "red:%i blue:%i\n", level.teamScores[TEAM_RED], level.teamScores[TEAM_BLUE] ); } @@ -1876,13 +1876,7 @@ void LogExit( const char *string ) G_LogPrintf( "score: %i ping: %i client: %i %s\n", cl->ps.persistant[PERS_SCORE], ping, level.sortedClients[i], cl->pers.netname ); #ifdef MISSIONPACK - if (g_singlePlayer.integer && !(g_entities[cl - level.clients].r.svFlags & SVF_BOT)) { - team = cl->sess.sessionTeam; - } - if (g_singlePlayer.integer && G_IsATeamGametype(g_gametype.integer) && - (G_UsesTeamFlags(g_gametype.integer) || G_UsesTheWhiteFlag(g_gametype.integer) || - g_gametype.integer == GT_HARVESTER || g_gametype.integer == GT_OBELISK || - g_gametype.integer == GT_DOUBLE_D || g_gametype.integer == GT_DOMINATION)) { + if (g_singlePlayer.integer && g_gametype.integer == GT_TOURNAMENT) { if (g_entities[cl - level.clients].r.svFlags & SVF_BOT && cl->ps.persistant[PERS_RANK] == 0) { won = qfalse; } @@ -1892,14 +1886,10 @@ void LogExit( const char *string ) } #ifdef MISSIONPACK - if (g_singlePlayer.integer) { - if (G_IsATeamGametype(g_gametype.integer)) { - if (team == TEAM_BLUE) { - won = level.teamScores[TEAM_BLUE] > level.teamScores[TEAM_RED]; - } else { - won = level.teamScores[TEAM_RED] > level.teamScores[TEAM_BLUE]; - } - } + if (g_singlePlayer.integer) { + if (g_gametype.integer >= GT_CTF && g_ffa_gt==0) { + won = level.teamScores[TEAM_RED] > level.teamScores[TEAM_BLUE]; + } trap_SendConsoleCommand( EXEC_APPEND, (won) ? "spWin\n" : "spLose\n" ); } #endif @@ -2014,14 +2004,14 @@ qboolean ScoreIsTied( void ) } //Sago: In Elimination and Oneway Flag Capture teams must win by two points. - if ( (G_IsARoundBasedGametype(g_gametype.integer) && G_IsATeamGametype(g_gametype.integer)) || + if ( g_gametype.integer == GT_ELIMINATION || (g_gametype.integer == GT_CTF_ELIMINATION && g_elimination_ctf_oneway.integer)) { return (level.teamScores[TEAM_RED] == level.teamScores[TEAM_BLUE] || level.teamScores[TEAM_RED] == level.teamScores[TEAM_BLUE]+1 || level.teamScores[TEAM_RED] == level.teamScores[TEAM_BLUE]-1); } - if (G_IsATeamGametype(g_gametype.integer)) { + if ( g_gametype.integer >= GT_TEAM && g_ffa_gt!=1) { return level.teamScores[TEAM_RED] == level.teamScores[TEAM_BLUE]; } @@ -2083,12 +2073,6 @@ void CheckExitRules( void ) return; } - if ( g_timelimit.integer < 0 || g_timelimit.integer > INT_MAX / 60000 ) { - G_Printf( "timelimit %i is out of range, defaulting to 0\n", g_timelimit.integer ); - trap_Cvar_Set( "timelimit", "0" ); - trap_Cvar_Update( &g_timelimit ); - } - if ( g_timelimit.integer > 0 && !level.warmupTime ) { if ( (level.time - level.startTime)/60000 >= g_timelimit.integer ) { trap_SendServerCommand( -1, "print \"Timelimit hit.\n\""); @@ -2101,83 +2085,49 @@ void CheckExitRules( void ) return; } - if ( g_fraglimit.integer < 0 ) { - G_Printf( "fraglimit %i is out of range, defaulting to 0\n", g_fraglimit.integer ); - trap_Cvar_Set( "fraglimit", "0" ); - trap_Cvar_Update( &g_fraglimit ); - } + if ( (g_gametype.integer < GT_CTF || g_ffa_gt>0 ) && g_fraglimit.integer ) { + if ( level.teamScores[TEAM_RED] >= g_fraglimit.integer ) { + trap_SendServerCommand( -1, "print \"Red hit the fraglimit.\n\"" ); + LogExit( "Fraglimit hit." ); + return; + } - if ( g_fraglimit.integer ) { - if ( G_IsATeamGametype(g_gametype.integer) ) { - if ( level.teamScores[TEAM_RED] >= g_fraglimit.integer ) { - trap_SendServerCommand( -1, "print \"Red hit the fraglimit.\n\"" ); - LogExit( "Fraglimit hit." ); - return; + if ( level.teamScores[TEAM_BLUE] >= g_fraglimit.integer ) { + trap_SendServerCommand( -1, "print \"Blue hit the fraglimit.\n\"" ); + LogExit( "Fraglimit hit." ); + return; + } + + for ( i=0 ; i< g_maxclients.integer ; i++ ) { + cl = level.clients + i; + if ( cl->pers.connected != CON_CONNECTED ) { + continue; + } + if ( cl->sess.sessionTeam != TEAM_FREE ) { + continue; } - if ( level.teamScores[TEAM_BLUE] >= g_fraglimit.integer ) { - trap_SendServerCommand( -1, "print \"Blue hit the fraglimit.\n\"" ); + if ( cl->ps.persistant[PERS_SCORE] >= g_fraglimit.integer ) { LogExit( "Fraglimit hit." ); + trap_SendServerCommand( -1, va("print \"%s" S_COLOR_WHITE " hit the fraglimit.\n\"", + cl->pers.netname ) ); return; } } - else { - for ( i=0 ; i< g_maxclients.integer ; i++ ) { - cl = level.clients + i; - if ( cl->pers.connected != CON_CONNECTED ) { - continue; - } - if ( cl->sess.sessionTeam != TEAM_FREE ) { - continue; - } - - if ( cl->ps.persistant[PERS_SCORE] >= g_fraglimit.integer ) { - LogExit( "Fraglimit hit." ); - trap_SendServerCommand( -1, va("print \"%s" S_COLOR_WHITE " hit the fraglimit.\n\"", - cl->pers.netname ) ); - return; - } - } - } } - if ( g_capturelimit.integer < 0 ) { - G_Printf( "capturelimit %i is out of range, defaulting to 0\n", g_capturelimit.integer ); - trap_Cvar_Set( "capturelimit", "0" ); - trap_Cvar_Update( &g_capturelimit ); - } + if ( (g_gametype.integer >= GT_CTF && !g_ffa_gt) && g_capturelimit.integer ) { - if ( g_capturelimit.integer ) { - if (G_IsATeamGametype(g_gametype.integer) && g_gametype.integer != GT_TEAM) { - if ( level.teamScores[TEAM_RED] >= g_capturelimit.integer ) { - trap_SendServerCommand( -1, "print \"Red hit the capturelimit.\n\"" ); - LogExit( "Capturelimit hit." ); - return; - } - - if ( level.teamScores[TEAM_BLUE] >= g_capturelimit.integer ) { - trap_SendServerCommand( -1, "print \"Blue hit the capturelimit.\n\"" ); - LogExit( "Capturelimit hit." ); - return; - } + if ( level.teamScores[TEAM_RED] >= g_capturelimit.integer ) { + trap_SendServerCommand( -1, "print \"Red hit the capturelimit.\n\"" ); + LogExit( "Capturelimit hit." ); + return; } - else { - for ( i=0 ; i< g_maxclients.integer ; i++ ) { - cl = level.clients + i; - if ( cl->pers.connected != CON_CONNECTED ) { - continue; - } - if ( cl->sess.sessionTeam != TEAM_FREE ) { - continue; - } - if ( cl->ps.persistant[PERS_SCORE] >= g_capturelimit.integer ) { - LogExit( "Capturelimit hit." ); - trap_SendServerCommand( -1, va("print \"%s" S_COLOR_WHITE " hit the capturelimit.\n\"", - cl->pers.netname ) ); - return; - } - } + if ( level.teamScores[TEAM_BLUE] >= g_capturelimit.integer ) { + trap_SendServerCommand( -1, "print \"Blue hit the capturelimit.\n\"" ); + LogExit( "Capturelimit hit." ); + return; } } } @@ -2250,6 +2200,7 @@ void CheckDoubleDomination( void ) } if((level.pointStatusA == TEAM_NONE || level.pointStatusB == TEAM_NONE) && level.time>level.roundStartTime) { + trap_SendServerCommand( -1, "print \"A new round has started\n\""); Team_SpawnDoubleDominationPoints(); SendScoreboardMessageToAllClients(); } @@ -2373,7 +2324,7 @@ void CheckTournament( void ) int counts[TEAM_NUM_TEAMS]; qboolean notEnough = qfalse; - if(!G_IsATeamGametype(g_gametype.integer)) { + if ( g_gametype.integer > GT_TEAM && !g_ffa_gt ) { counts[TEAM_BLUE] = TeamCount( -1, TEAM_BLUE ); counts[TEAM_RED] = TeamCount( -1, TEAM_RED ); @@ -2649,7 +2600,7 @@ void G_RunFrame( int levelTime ) // get any cvar changes G_UpdateCvars(); - if( (G_IsARoundBasedGametype(g_gametype.integer) && G_IsATeamGametype(g_gametype.integer)) && !(g_elimflags.integer & EF_NO_FREESPEC) && g_elimination_lockspectator.integer>1) + if( (g_gametype.integer==GT_ELIMINATION || g_gametype.integer==GT_CTF_ELIMINATION) && !(g_elimflags.integer & EF_NO_FREESPEC) && g_elimination_lockspectator.integer>1) trap_Cvar_Set("elimflags",va("%i",g_elimflags.integer|EF_NO_FREESPEC)); else if( (g_elimflags.integer & EF_NO_FREESPEC) && g_elimination_lockspectator.integer<2) trap_Cvar_Set("elimflags",va("%i",g_elimflags.integer&(~EF_NO_FREESPEC) ) ); @@ -2833,45 +2784,3 @@ void MapInfoPrint(mapinfo_result_t *info) G_Printf("minTeamSize: %i\n",info->minTeamSize); } -/* Neon_Knight: Useful check in order to have code consistency. */ -/* -=================== -G_IsATeamGametype - -Checks if the gametype is a team-based game. -=================== - */ -qboolean G_IsATeamGametype(int check) { - return GAMETYPE_IS_A_TEAM_GAME(check); -} -/* -=================== -G_UsesTeamFlags - -Checks if the gametype makes use of the red and blue flags. -=================== - */ -qboolean G_UsesTeamFlags(int check) { - return GAMETYPE_USES_RED_AND_BLUE_FLAG(check); -} -/* -=================== -G_UsesTheWhiteFlag - -Checks if the gametype makes use of the neutral flag. -=================== - */ -qboolean G_UsesTheWhiteFlag(int check) { - return GAMETYPE_USES_WHITE_FLAG(check); -} -/* -=================== -G_IsARoundBasedGametype - -Checks if the gametype has a round-based system. -=================== - */ -qboolean G_IsARoundBasedGametype(int check) { - return GAMETYPE_IS_ROUND_BASED(check); -} -/* /Neon_Knight */ \ No newline at end of file diff --git a/code/game/g_misc.c b/code/game/g_misc.c index 1e6ecbdf..90361bfe 100644 --- a/code/game/g_misc.c +++ b/code/game/g_misc.c @@ -569,7 +569,7 @@ static int countCtfSpawnpoints(void) { } int MinSpawnpointCount(void) { - if(!G_IsATeamGametype(g_gametype.integer)) { + if(g_gametype.integer < GT_CTF || g_ffa_gt > 0) { return countFfaSpawnpoints(); } if(g_gametype.integer == GT_DOUBLE_D ) { diff --git a/code/game/g_missile.c b/code/game/g_missile.c index 05421a3e..fb73a3c2 100644 --- a/code/game/g_missile.c +++ b/code/game/g_missile.c @@ -142,7 +142,7 @@ void ProximityMine_Trigger( gentity_t *trigger, gentity_t *other, trace_t *trace } - if (G_IsATeamGametype(g_gametype.integer)) { + if ( g_gametype.integer >= GT_TEAM && g_ffa_gt!=1) { // don't trigger same team mines if (trigger->parent->s.generic1 == other->client->sess.sessionTeam) { return; @@ -178,20 +178,22 @@ static void ProximityMine_Activate( gentity_t *ent ) qboolean nearFlag = qfalse; // find the flag - if (G_UsesTeamFlags(g_gametype.integer)) { - switch (ent->s.generic1) { - case TEAM_RED: - c = "team_CTF_redflag"; - break; - case TEAM_BLUE: - c = "team_CTF_blueflag"; - break; - default: - c = NULL; - } - } - - if (g_gametype.integer == GT_HARVESTER || g_gametype.integer == GT_OBELISK) { + switch (ent->s.generic1) { + case TEAM_RED: + c = "team_CTF_redflag"; + break; + case TEAM_BLUE: + c = "team_CTF_blueflag"; + break; + default: + c = NULL; + } + + if (g_gametype.integer == GT_TEAM || g_gametype.integer == GT_DOMINATION || g_gametype.integer == GT_ELIMINATION || g_gametype.integer == GT_DOUBLE_D) { + c = NULL; + } + + if (g_gametype.integer == GT_OBELISK || g_gametype.integer == GT_HARVESTER) { switch (ent->s.generic1) { case TEAM_RED: c = "team_redobelisk"; diff --git a/code/game/g_mover.c b/code/game/g_mover.c index 01e9e43b..8935da37 100644 --- a/code/game/g_mover.c +++ b/code/game/g_mover.c @@ -1004,7 +1004,7 @@ void SP_func_door (gentity_t *ent) ent->wait = 99999999; - if (G_IsARoundBasedGametype(g_gametype.integer) && G_IsATeamGametype(g_gametype.integer)) { + if ( g_gametype.integer == GT_ELIMINATION || g_gametype.integer == GT_CTF_ELIMINATION) { char* value; //Classic part to make the if ( strequals(ent->targetname, ELIMINATION_ACTIVE_TARGETNAME ) ) { diff --git a/code/game/g_rankings.c b/code/game/g_rankings.c index e51ef6f9..26ced962 100644 --- a/code/game/g_rankings.c +++ b/code/game/g_rankings.c @@ -105,7 +105,7 @@ void G_RankRunFrame() break; case QGR_STATUS_ACTIVE: if( (ent->client->sess.sessionTeam == TEAM_SPECTATOR || (client->isEliminated)) && - !(G_IsATeamGametype(g_gametype.integer)) ) + (g_gametype.integer < GT_TEAM) ) { SetTeam( ent, "free" ); } diff --git a/code/game/g_session.c b/code/game/g_session.c index e012feb7..a4ec9405 100644 --- a/code/game/g_session.c +++ b/code/game/g_session.c @@ -118,15 +118,16 @@ void G_InitSessionData( gclient_t *client, char *userinfo ) { } // initial team determination - if (G_IsATeamGametype(g_gametype.integer)) { - // always spawn as spectator in team games - sess->sessionTeam = TEAM_SPECTATOR; - sess->spectatorState = SPECTATOR_FREE; - - if ( value[0] || g_teamAutoJoin.integer ) { - SetTeam( &g_entities[client - level.clients], value ); + if ( g_gametype.integer >= GT_TEAM && g_ffa_gt!=1) { + if ( g_teamAutoJoin.integer && !(g_entities[ client - level.clients ].r.svFlags & SVF_BOT) ) { + sess->sessionTeam = PickTeam( -1 ); + BroadcastTeamChange( client, -1 ); + } else { + // always spawn as spectator in team games + sess->sessionTeam = TEAM_SPECTATOR; } } else { + value = Info_ValueForKey( userinfo, "team" ); if ( value[0] == 's' ) { // a willing spectator, not a waiting-in-line sess->sessionTeam = TEAM_SPECTATOR; @@ -153,10 +154,10 @@ void G_InitSessionData( gclient_t *client, char *userinfo ) { break; } } - sess->spectatorState = SPECTATOR_FREE; } - AddTournamentQueue(client); + sess->spectatorState = SPECTATOR_FREE; + AddTournamentQueue(client); G_WriteClientSessionData( client ); } diff --git a/code/game/g_spawn.c b/code/game/g_spawn.c index aa54f4e8..12dc0dd5 100644 --- a/code/game/g_spawn.c +++ b/code/game/g_spawn.c @@ -451,8 +451,9 @@ void G_SpawnGEntityFromSpawnVars( void ) { return; } } - // check for "notteam" flag - if (G_IsATeamGametype(g_gametype.integer)) { + // check for "notteam" flag (GT_FFA, GT_TOURNAMENT, GT_SINGLE_PLAYER) + if ( g_gametype.integer >= GT_TEAM && !g_ffa_gt ) { +/* if ( g_gametype.integer!=GT_FFA && g_gametype.integer!=GT_TOURNAMENT && g_gametype.integer!=GT_LMS && g_gametype.integer!=GT_POSSESSION ) { */ G_SpawnInt( "notteam", "0", &i ); if ( i ) { G_FreeEntity( ent ); diff --git a/code/game/g_team.c b/code/game/g_team.c index 94e3d1e0..1ed8e40d 100644 --- a/code/game/g_team.c +++ b/code/game/g_team.c @@ -231,7 +231,7 @@ qboolean OnSameTeam( const gentity_t *ent1, const gentity_t *ent2 ) return qfalse; } - if (!G_IsATeamGametype(g_gametype.integer)) { + if ( g_gametype.integer < GT_TEAM || g_ffa_gt==1) { return qfalse; } @@ -277,7 +277,7 @@ void Team_SetFlagStatus( int team, flagStatus_t status ) if( modified ) { char st[4]; - if(G_UsesTeamFlags(g_gametype.integer) && !G_UsesTheWhiteFlag(g_gametype.integer)) { + if( g_gametype.integer == GT_CTF || g_gametype.integer == GT_CTF_ELIMINATION) { st[0] = ctfFlagStatusRemap[teamgame.redStatus]; st[1] = ctfFlagStatusRemap[teamgame.blueStatus]; st[2] = 0; @@ -407,8 +407,7 @@ void Team_FragBonuses(gentity_t *targ, gentity_t *inflictor, gentity_t *attacker enemy_flag_pw = PW_REDFLAG; } - if (G_UsesTheWhiteFlag(g_gametype.integer)) { - flag_pw = PW_NEUTRALFLAG; + if (g_gametype.integer == GT_1FCTF || g_gametype.integer == GT_POSSESSION) { enemy_flag_pw = PW_NEUTRALFLAG; } @@ -948,11 +947,11 @@ static void Team_DD_makeB2team( gentity_t *target, int team ) static void Team_ResetFlags( void ) { - if(G_UsesTeamFlags(g_gametype.integer) && !G_UsesTheWhiteFlag(g_gametype.integer)) { + if( g_gametype.integer == GT_CTF || g_gametype.integer == GT_CTF_ELIMINATION) { Team_ResetFlag( TEAM_RED ); Team_ResetFlag( TEAM_BLUE ); } - else if(G_UsesTheWhiteFlag(g_gametype.integer)) { + else if( g_gametype.integer == GT_1FCTF || g_gametype.integer == GT_POSSESSION ) { Team_ResetFlag( TEAM_FREE ); } } @@ -1263,7 +1262,7 @@ int Team_TouchOurFlag( gentity_t *ent, gentity_t *other, int team ) gclient_t *cl = other->client; int enemy_flag; - if(G_UsesTheWhiteFlag(g_gametype.integer)) { + if( g_gametype.integer == GT_1FCTF || g_gametype.integer == GT_POSSESSION ) { enemy_flag = PW_NEUTRALFLAG; } else { @@ -2215,8 +2214,10 @@ static void ObeliskPain( gentity_t *self, gentity_t *attacker, int damage ) attacker->client->pers.netname,actualDamage); } -// spawn invisible damagable obelisk entity / harvester base trigger. -static gentity_t *SpawnObelisk( vec3_t origin, vec3_t mins, vec3_t maxs, int team ) { +static gentity_t *SpawnObelisk( vec3_t origin, int team, int spawnflags) +{ + trace_t tr; + vec3_t dest; gentity_t *ent; ent = G_Spawn(); @@ -2225,8 +2226,8 @@ static gentity_t *SpawnObelisk( vec3_t origin, vec3_t mins, vec3_t maxs, int tea VectorCopy( origin, ent->s.pos.trBase ); VectorCopy( origin, ent->r.currentOrigin ); - VectorCopy( mins, ent->r.mins ); - VectorCopy( maxs, ent->r.maxs ); + VectorSet( ent->r.mins, -15, -15, 0 ); + VectorSet( ent->r.maxs, 15, 15, 87 ); ent->s.eType = ET_GENERAL; ent->flags = FL_NO_KNOCKBACK; @@ -2245,26 +2246,7 @@ static gentity_t *SpawnObelisk( vec3_t origin, vec3_t mins, vec3_t maxs, int tea ent->touch = ObeliskTouch; } - G_SetOrigin( ent, ent->s.origin ); - - ent->spawnflags = team; - - trap_LinkEntity( ent ); - - return ent; -} - -// setup entity for team base model / obelisk model. -void ObeliskInit( gentity_t *ent ) { - trace_t tr; - vec3_t dest; - - ent->s.eType = ET_TEAM; - - VectorSet( ent->r.mins, -15, -15, 0 ); - VectorSet( ent->r.maxs, 15, 15, 87 ); - - if ( ent->spawnflags & 1 ) { + if ( spawnflags & 1 ) { // suspended G_SetOrigin( ent, ent->s.origin ); } @@ -2289,6 +2271,12 @@ void ObeliskInit( gentity_t *ent ) { G_SetOrigin( ent, tr.endpos ); } } + + ent->spawnflags = team; + + trap_LinkEntity( ent ); + + return ent; } /*QUAKED team_redobelisk (1 0 0) (-16 -16 0) (16 16 8) @@ -2297,20 +2285,20 @@ void SP_team_redobelisk( gentity_t *ent ) { gentity_t *obelisk; - if (g_gametype.integer != GT_HARVESTER && g_gametype.integer != GT_OBELISK) { + if ( g_gametype.integer <= GT_TEAM || g_ffa_gt>0) { G_FreeEntity(ent); return; } - ObeliskInit( ent ); + ent->s.eType = ET_TEAM; if ( g_gametype.integer == GT_OBELISK ) { - obelisk = SpawnObelisk( ent->s.origin, ent->r.mins, ent->r.maxs, TEAM_RED ); + obelisk = SpawnObelisk( ent->s.origin, TEAM_RED, ent->spawnflags ); obelisk->activator = ent; // initial obelisk health value ent->s.modelindex2 = 0xff; ent->s.frame = 0; } if ( g_gametype.integer == GT_HARVESTER ) { - obelisk = SpawnObelisk( ent->s.origin, ent->r.mins, ent->r.maxs, TEAM_RED ); + obelisk = SpawnObelisk( ent->s.origin, TEAM_RED, ent->spawnflags ); obelisk->activator = ent; } ent->s.modelindex = TEAM_RED; @@ -2323,20 +2311,20 @@ void SP_team_blueobelisk( gentity_t *ent ) { gentity_t *obelisk; - if (g_gametype.integer != GT_HARVESTER && g_gametype.integer != GT_OBELISK) { + if ( g_gametype.integer <= GT_TEAM || g_ffa_gt>0) { G_FreeEntity(ent); return; } - ObeliskInit( ent ); + ent->s.eType = ET_TEAM; if ( g_gametype.integer == GT_OBELISK ) { - obelisk = SpawnObelisk( ent->s.origin, ent->r.mins, ent->r.maxs, TEAM_BLUE ); + obelisk = SpawnObelisk( ent->s.origin, TEAM_BLUE, ent->spawnflags ); obelisk->activator = ent; // initial obelisk health value ent->s.modelindex2 = 0xff; ent->s.frame = 0; } if ( g_gametype.integer == GT_HARVESTER ) { - obelisk = SpawnObelisk( ent->s.origin, ent->r.mins, ent->r.maxs, TEAM_BLUE ); + obelisk = SpawnObelisk( ent->s.origin, TEAM_BLUE, ent->spawnflags ); obelisk->activator = ent; } ent->s.modelindex = TEAM_BLUE; @@ -2347,13 +2335,15 @@ void SP_team_blueobelisk( gentity_t *ent ) */ void SP_team_neutralobelisk( gentity_t *ent ) { - if (g_gametype.integer != GT_HARVESTER) { + if ( g_gametype.integer != GT_1FCTF && g_gametype.integer != GT_HARVESTER && g_gametype.integer != GT_POSSESSION ) { G_FreeEntity(ent); return; } - ObeliskInit( ent ); - neutralObelisk = SpawnObelisk( ent->s.origin, ent->r.mins, ent->r.maxs, TEAM_FREE ); - neutralObelisk->activator = ent; + ent->s.eType = ET_TEAM; + if ( g_gametype.integer == GT_HARVESTER) { + neutralObelisk = SpawnObelisk( ent->s.origin, TEAM_FREE, ent->spawnflags); + neutralObelisk->spawnflags = TEAM_FREE; + } ent->s.modelindex = TEAM_FREE; trap_LinkEntity(ent); } diff --git a/code/q3_ui/ui_addbots.c b/code/q3_ui/ui_addbots.c index ed72f4cc..afd2b900 100644 --- a/code/q3_ui/ui_addbots.c +++ b/code/q3_ui/ui_addbots.c @@ -333,7 +333,7 @@ static void UI_AddBotsMenu_Init( void ) { addBotsMenuInfo.team.generic.y = y; addBotsMenuInfo.team.generic.name = "Team: "; addBotsMenuInfo.team.generic.id = ID_TEAM; - if(UI_IsATeamGametype(gametype)) { + if( gametype >= GT_TEAM && gametype!=GT_LMS && gametype!=GT_POSSESSION) { addBotsMenuInfo.team.itemnames = teamNames2; } else { diff --git a/code/q3_ui/ui_ingame.c b/code/q3_ui/ui_ingame.c index 38f726d2..35758d6f 100644 --- a/code/q3_ui/ui_ingame.c +++ b/code/q3_ui/ui_ingame.c @@ -236,7 +236,7 @@ void InGame_MenuInit( void ) { s_ingame.teamorders.string = "TEAM ORDERS"; s_ingame.teamorders.color = color_red; s_ingame.teamorders.style = UI_CENTER|UI_SMALLFONT; - if(!UI_IsATeamGametype(gametype)) { + if( !(gametype >= GT_TEAM) || gametype == GT_LMS || gametype == GT_POSSESSION ) { s_ingame.teamorders.generic.flags |= QMF_GRAYED; } else { diff --git a/code/q3_ui/ui_local.h b/code/q3_ui/ui_local.h index b9b163fe..e5d88a48 100644 --- a/code/q3_ui/ui_local.h +++ b/code/q3_ui/ui_local.h @@ -112,7 +112,6 @@ extern vmCvar_t ui_server16; extern vmCvar_t ui_setupchecked; //new in beta 23: extern vmCvar_t ui_browserOnlyHumans; -extern vmCvar_t ui_developer; extern vmCvar_t ui_browserHidePrivate; // @@ -899,10 +898,3 @@ void RankStatus_Cache( void ); void UI_RankStatusMenu( void ); #endif - -/* Neon_Knight: Useful check in order to have code consistency. */ -qboolean UI_IsATeamGametype(int check); /* Whether the gametype is team-based or not.*/ -qboolean UI_UsesTeamFlags(int check); /* Whether the gametype uses the red and blue flags. */ -qboolean UI_UsesTheWhiteFlag(int check); /* Whether the gametype uses the neutral flag. */ -qboolean UI_IsARoundBasedGametype(int check); /* Whether the gametype uses the neutral flag. */ -/* /Neon_Knight */ diff --git a/code/q3_ui/ui_main.c b/code/q3_ui/ui_main.c index 13ea2a2f..1130f86d 100644 --- a/code/q3_ui/ui_main.c +++ b/code/q3_ui/ui_main.c @@ -173,7 +173,7 @@ vmCvar_t ui_server16; vmCvar_t ui_browserOnlyHumans; //new in beta 37: vmCvar_t ui_setupchecked; -vmCvar_t ui_developer; + vmCvar_t ui_browserHidePrivate; // bk001129 - made static to avoid aliasing. @@ -237,7 +237,7 @@ static cvarTable_t cvarTable[] = { { &ui_spSelection, "ui_spSelection", "", CVAR_ROM }, - { &ui_browserMaster, "ui_browserMaster", "1", CVAR_ARCHIVE }, + { &ui_browserMaster, "ui_browserMaster", "0", CVAR_ARCHIVE }, { &ui_browserGameType, "ui_browserGameType", "0", CVAR_ARCHIVE }, { &ui_browserSortKey, "ui_browserSortKey", "4", CVAR_ARCHIVE }, { &ui_browserShowFull, "ui_browserShowFull", "1", CVAR_ARCHIVE }, @@ -266,7 +266,6 @@ static cvarTable_t cvarTable[] = { { &ui_server16, "server16", "", CVAR_ARCHIVE }, { &ui_browserOnlyHumans, "ui_browserOnlyHumans", "0", CVAR_ARCHIVE }, { &ui_setupchecked, "ui_setupchecked", "0", CVAR_ARCHIVE }, - { &ui_developer, "developer", "0", CVAR_CHEAT }, { &ui_browserHidePrivate, "ui_browserHidePrivate", "1", CVAR_ARCHIVE }, { NULL, "g_localTeamPref", "", 0 } }; @@ -317,46 +316,3 @@ void UI_SetDefaultCvar(const char* cvar, const char* value) { trap_Cvar_Set(cvar,value); } } - -/* Neon_Knight: Useful check in order to have code consistency. */ -/* -=================== -UI_IsATeamGametype - -Checks if the gametype is a team-based game. -=================== - */ -qboolean UI_IsATeamGametype(int check) { - return GAMETYPE_IS_A_TEAM_GAME(check); -} -/* -=================== -UI_UsesTeamFlags - -Checks if the gametype makes use of the red and blue flags. -=================== - */ -qboolean UI_UsesTeamFlags(int check) { - return GAMETYPE_USES_RED_AND_BLUE_FLAG(check); -} -/* -=================== -UI_UsesTheWhiteFlag - -Checks if the gametype makes use of the neutral flag. -=================== - */ -qboolean UI_UsesTheWhiteFlag(int check) { - return GAMETYPE_USES_WHITE_FLAG(check); -} -/* -=================== -UI_IsARoundBasedGametype - -Checks if the gametype has a round-based system. -=================== - */ -qboolean UI_IsARoundBasedGametype(int check) { - return GAMETYPE_IS_ROUND_BASED(check); -} -/* /Neon_Knight */ diff --git a/code/q3_ui/ui_startserver.c b/code/q3_ui/ui_startserver.c index 877cf91e..1f655e8a 100644 --- a/code/q3_ui/ui_startserver.c +++ b/code/q3_ui/ui_startserver.c @@ -877,7 +877,7 @@ static qboolean BotAlreadySelected( const char *checkName ) { if( s_serveroptions.playerType[n].curvalue != 1 ) { continue; } - if(UI_IsATeamGametype(s_serveroptions.gametype) && + if( (s_serveroptions.gametype >= GT_TEAM) && s_serveroptions.gametype != GT_LMS && s_serveroptions.gametype != GT_POSSESSION && (s_serveroptions.playerTeam[n].curvalue != s_serveroptions.playerTeam[s_serveroptions.newBotIndex].curvalue ) ) { continue; } @@ -1070,7 +1070,7 @@ static void ServerOptions_Start( void ) { if( s_serveroptions.playerNameBuffers[n][0] == '-' ) { continue; } - if(UI_IsATeamGametype(s_serveroptions.gametype)) { + if( s_serveroptions.gametype >= GT_TEAM && s_serveroptions.gametype != GT_LMS && s_serveroptions.gametype != GT_POSSESSION ) { Com_sprintf( buf, sizeof(buf), "addbot %s %i %s\n", s_serveroptions.playerNameBuffers[n], skill, playerTeam_list[s_serveroptions.playerTeam[n].curvalue] ); } @@ -1081,8 +1081,9 @@ static void ServerOptions_Start( void ) { } // set player's team - if( UI_IsATeamGametype(s_serveroptions.gametype)) { - trap_Cvar_Set( "g_localTeamPref", playerTeam_list[s_serveroptions.playerTeam[0].curvalue] ); + if( /*dedicated == 0 &&*/ s_serveroptions.gametype >= GT_TEAM && s_serveroptions.gametype != GT_LMS + && s_serveroptions.gametype != GT_POSSESSION ) { + trap_Cmd_ExecuteText( EXEC_APPEND, va( "wait 5; team %s\n", playerTeam_list[s_serveroptions.playerTeam[0].curvalue] ) ); } } @@ -1108,7 +1109,7 @@ static void ServerOptions_InitPlayerItems( void ) { s_serveroptions.playerType[n].curvalue = v; } - if(s_serveroptions.multiplayer && !UI_IsATeamGametype(s_serveroptions.gametype)) { + if( s_serveroptions.multiplayer && (s_serveroptions.gametype < GT_TEAM || s_serveroptions.gametype == GT_LMS ) ) { for( n = 8; n < PLAYER_SLOTS; n++ ) { s_serveroptions.playerType[n].curvalue = 2; } @@ -1122,7 +1123,7 @@ static void ServerOptions_InitPlayerItems( void ) { Q_CleanStr( s_serveroptions.playerNameBuffers[0] ); // init teams - if(UI_IsATeamGametype(s_serveroptions.gametype)) { + if( s_serveroptions.gametype >= GT_TEAM && s_serveroptions.gametype != GT_LMS && s_serveroptions.gametype != GT_POSSESSION ) { for( n = 0; n < (PLAYER_SLOTS / 2); n++ ) { s_serveroptions.playerTeam[n].curvalue = 0; } @@ -1162,7 +1163,7 @@ static void ServerOptions_SetPlayerItems( void ) { } // teams - if(!UI_IsATeamGametype(s_serveroptions.gametype)) { + if( s_serveroptions.gametype < GT_TEAM || s_serveroptions.gametype == GT_LMS || s_serveroptions.gametype == GT_POSSESSION ) { return; } for( n = start; n < PLAYER_SLOTS; n++ ) { @@ -1344,7 +1345,7 @@ static void ServerOptions_InitBotNames( void ) { char bots[MAX_INFO_STRING]; //this SHOULD work - if(UI_IsATeamGametype(s_serveroptions.gametype)) { + if( s_serveroptions.gametype >= GT_TEAM && s_serveroptions.gametype != GT_LMS && s_serveroptions.gametype != GT_POSSESSION ) { Q_strncpyz( s_serveroptions.playerNameBuffers[1], "gargoyle", 16 ); Q_strncpyz( s_serveroptions.playerNameBuffers[2], "kyonshi", 16 ); Q_strncpyz( s_serveroptions.playerNameBuffers[3], "grism", 16 ); @@ -1660,7 +1661,7 @@ static void ServerOptions_MenuInit( qboolean multiplayer ) { s_serveroptions.picframe.focuspic = GAMESERVER_SELECT; y = 268; - if(!UI_IsATeamGametype(s_serveroptions.gametype)) { + if( s_serveroptions.gametype < GT_CTF || s_serveroptions.gametype== GT_LMS) { s_serveroptions.fraglimit.generic.type = MTYPE_FIELD; s_serveroptions.fraglimit.generic.name = "Frag Limit:"; s_serveroptions.fraglimit.generic.flags = QMF_NUMBERSONLY|QMF_PULSEIFFOCUS|QMF_SMALLFONT; @@ -1701,8 +1702,8 @@ static void ServerOptions_MenuInit( qboolean multiplayer ) { s_serveroptions.timelimit.field.widthInChars = 3; s_serveroptions.timelimit.field.maxchars = 3; - if(UI_IsATeamGametype(s_serveroptions.gametype) && - !UI_IsARoundBasedGametype(s_serveroptions.gametype)) { + if( s_serveroptions.gametype >= GT_TEAM && s_serveroptions.gametype != GT_LMS && s_serveroptions.gametype != GT_POSSESSION + && s_serveroptions.gametype != GT_ELIMINATION && s_serveroptions.gametype != GT_CTF_ELIMINATION) { y += BIGCHAR_HEIGHT+2; s_serveroptions.friendlyfire.generic.type = MTYPE_RADIOBUTTON; s_serveroptions.friendlyfire.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT; @@ -1880,20 +1881,20 @@ static void ServerOptions_MenuInit( qboolean multiplayer ) { Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.playerType[n] ); } Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.playerName[n] ); - if(UI_IsATeamGametype(s_serveroptions.gametype)) { + if( s_serveroptions.gametype >= GT_TEAM && s_serveroptions.gametype != GT_LMS ) { Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.playerTeam[n] ); } } - if(!UI_IsATeamGametype(s_serveroptions.gametype)) { + if( s_serveroptions.gametype < GT_CTF || s_serveroptions.gametype == GT_LMS || s_serveroptions.gametype == GT_POSSESSION ) { Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.fraglimit ); } else { Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.flaglimit ); } Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.timelimit ); - if(UI_IsATeamGametype(s_serveroptions.gametype) && - !UI_IsARoundBasedGametype(s_serveroptions.gametype)) { + if( s_serveroptions.gametype >= GT_TEAM && s_serveroptions.gametype != GT_LMS && s_serveroptions.gametype != GT_POSSESSION + && s_serveroptions.gametype != GT_ELIMINATION && s_serveroptions.gametype != GT_CTF_ELIMINATION) { Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.friendlyfire ); } Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.pure ); diff --git a/code/q3_ui/ui_teamorders.c b/code/q3_ui/ui_teamorders.c index fe0427d5..2025eecb 100644 --- a/code/q3_ui/ui_teamorders.c +++ b/code/q3_ui/ui_teamorders.c @@ -349,7 +349,7 @@ static void UI_TeamOrdersMenu_ListEvent( void *ptr, int event ) int selection; char message[256]; - if (event != QM_ACTIVATED || !UI_IsATeamGametype(teamOrdersMenuInfo.gametype)) + if (event != QM_ACTIVATED) return; id = ((menulist_s *)ptr)->generic.id; @@ -357,21 +357,21 @@ static void UI_TeamOrdersMenu_ListEvent( void *ptr, int event ) if( id == ID_LIST_BOTS ) { teamOrdersMenuInfo.selectedBot = selection; - if( UI_UsesTeamFlags(teamOrdersMenuInfo.gametype) && !UI_UsesTheWhiteFlag(teamOrdersMenuInfo.gametype) ) { + if( teamOrdersMenuInfo.gametype == GT_CTF || teamOrdersMenuInfo.gametype == GT_CTF_ELIMINATION ) { UI_TeamOrdersMenu_SetList( ID_LIST_CTF_ORDERS ); } - if( UI_UsesTeamFlags(teamOrdersMenuInfo.gametype) && UI_UsesTheWhiteFlag(teamOrdersMenuInfo.gametype) ) { + if( teamOrdersMenuInfo.gametype == GT_1FCTF ) { UI_TeamOrdersMenu_SetList( ID_LIST_CTF1F_ORDERS ); } - if( teamOrdersMenuInfo.gametype == GT_HARVESTER || teamOrdersMenuInfo.gametype == GT_OBELISK ) { + if( teamOrdersMenuInfo.gametype == GT_OBELISK || teamOrdersMenuInfo.gametype == GT_HARVESTER ) { UI_TeamOrdersMenu_SetList( ID_LIST_BASE_ORDERS ); } + if( teamOrdersMenuInfo.gametype == GT_TEAM || teamOrdersMenuInfo.gametype == GT_ELIMINATION || teamOrdersMenuInfo.gametype == GT_DOMINATION ) { + UI_TeamOrdersMenu_SetList( ID_LIST_TEAM_ORDERS ); + } if( teamOrdersMenuInfo.gametype == GT_DOUBLE_D ) { UI_TeamOrdersMenu_SetList( ID_LIST_DD_ORDERS ); } - else { - UI_TeamOrdersMenu_SetList( ID_LIST_TEAM_ORDERS ); - } return; } @@ -550,7 +550,7 @@ void UI_TeamOrdersMenu_f( void ) // make sure it's a team game trap_GetConfigString( CS_SERVERINFO, info, sizeof(info) ); teamOrdersMenuInfo.gametype = atoi( Info_ValueForKey( info, "g_gametype" ) ); - if(!UI_IsATeamGametype(teamOrdersMenuInfo.gametype)) { + if( teamOrdersMenuInfo.gametype < GT_TEAM || teamOrdersMenuInfo.gametype == GT_LMS || teamOrdersMenuInfo.gametype == GT_POSSESSION) { return; } diff --git a/code/qcommon/surfaceflags.h b/code/qcommon/surfaceflags.h index b7c10a17..34dc41d5 100644 --- a/code/qcommon/surfaceflags.h +++ b/code/qcommon/surfaceflags.h @@ -78,3 +78,11 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define SURF_ALPHASHADOW 0x10000 // do per-pixel light shadow casting in q3map #define SURF_NODLIGHT 0x20000 // don't dlight even if solid (solid lava, skies) #define SURF_DUST 0x40000 // leave a dust trail when walking on this surface +// leilei - new surfaceflags +#define SURF_SNOW 0x80000 +#define SURF_WOOD 0x100000 +#define SURF_SAND 0x200000 +#define SURF_GRAVEL 0x400000 +#define SURF_ICE 0x800000 +#define SURF_GLASS 0x1000000 +#define SURF_LEAVES 0x2000000 diff --git a/code/renderer/tr_types.h b/code/renderer/tr_types.h index aa0e02b3..5cb802d2 100644 --- a/code/renderer/tr_types.h +++ b/code/renderer/tr_types.h @@ -117,6 +117,8 @@ typedef struct { vec3_t eyepos[2]; // looking from vec3_t eyelook; // looking from + int glow; + int glowcol; } refEntity_t; diff --git a/code/ui/ui_gameinfo.c b/code/ui/ui_gameinfo.c index abf423be..8247f897 100644 --- a/code/ui/ui_gameinfo.c +++ b/code/ui/ui_gameinfo.c @@ -139,10 +139,16 @@ void UI_LoadArenas( void ) { char dirlist[1024]; char* dirptr; int i; + int n; int dirlen; + char *type; // rfactory changes + // Changed RD + char specialgame[100]; + // end changed RD ui_numArenas = 0; + uiInfo.mapCount = 0; trap_Cvar_Register( &arenasFile, "g_arenasFile", "", CVAR_INIT|CVAR_ROM ); if( *arenasFile.string ) { @@ -166,19 +172,6 @@ void UI_LoadArenas( void ) { trap_Print(S_COLOR_YELLOW"WARNING: not anough memory in pool to load all arenas\n"); } -} -/* -=============== -UI_LoadArenasIntoMapList -=============== -*/ -void UI_LoadArenasIntoMapList( void ) { - int n; - char *type; - // Changed RD - char specialgame[100]; - // end changed RD - uiInfo.mapCount = 0; for( n = 0; n < ui_numArenas; n++ ) { // determine type diff --git a/code/ui/ui_local.h b/code/ui/ui_local.h index a96428d5..e02c8dc5 100644 --- a/code/ui/ui_local.h +++ b/code/ui/ui_local.h @@ -147,9 +147,6 @@ extern vmCvar_t ui_serverStatusTimeOut; extern vmCvar_t ui_humansonly; extern vmCvar_t ui_introPlayed; extern vmCvar_t ui_colors; -/* Neon_Knight: Additional missionpack check */ -extern vmCvar_t ui_missionpackChecks; -/* /Neon_Knight */ extern vmCvar_t ui_findPlayer; extern vmCvar_t ui_Q3Model; extern vmCvar_t ui_hudFiles; @@ -209,7 +206,7 @@ extern vmCvar_t ui_developer; #define MAX_EDIT_LINE 256 #define MAX_MENUDEPTH 8 -#define MAX_MENUITEMS 128 // was 96 - rfactory change +#define MAX_MENUITEMS 256 // was 96 - rfactory change #define MTYPE_NULL 0 #define MTYPE_SLIDER 1 @@ -425,7 +422,6 @@ int UI_AdjustTimeByGame(int time); void UI_ShowPostGame(qboolean newHigh); void UI_ClearScores( void ); void UI_LoadArenas(void); -void UI_LoadArenasIntoMapList(void); // rfactory change // Changed RD qboolean SP_LoadGame(char *load_game, char *loadmap); @@ -776,8 +772,8 @@ typedef struct { #define GAMES_CTF 4 #define MAPS_PER_TIER 3 #define MAX_TIERS 16 -#define MAX_MODS 64 -#define MAX_DEMOS 256 +#define MAX_MODS 128 +#define MAX_DEMOS 512 #define MAX_MOVIES 256 //#define MAX_PLAYERMODELS 256 #define MAX_PLAYERMODELS 1024 @@ -1290,7 +1286,7 @@ extern int wideAdjustX; // new ui #define ASSET_BACKGROUND "uiBackground" - +void RefreshHexColors( void ); // for tracking sp game info in Team Arena typedef struct postGameInfo_s { int score; @@ -1315,9 +1311,3 @@ typedef struct postGameInfo_s { #endif -/* Neon_Knight: Useful check in order to have code consistency. */ -qboolean UI_IsATeamGametype(int check); /* Whether the gametype is team-based or not.*/ -qboolean UI_UsesTeamFlags(int check); /* Whether the gametype uses the red and blue flags. */ -qboolean UI_UsesTheWhiteFlag(int check); /* Whether the gametype uses the neutral flag. */ -qboolean UI_IsARoundBasedGametype(int check); /* Whether the gametype uses the neutral flag. */ -/* /Neon_Knight */ diff --git a/code/ui/ui_main.c b/code/ui/ui_main.c index 3c7ec234..f9006307 100644 --- a/code/ui/ui_main.c +++ b/code/ui/ui_main.c @@ -1596,7 +1596,7 @@ static void UI_DrawTeamMember(rectDef_t *rect, float scale, vec4_t color, qboole else { value -= 2; - if (UI_IsATeamGametype(ui_actualNetGameType.integer)) { + if (ui_actualNetGameType.integer >= GT_TEAM && ui_actualNetGameType.integer != GT_LMS && ui_actualNetGameType.integer != GT_POSSESSION ) { if (value >= uiInfo.characterCount) { value = 0; } @@ -1686,7 +1686,8 @@ static void UI_DrawMapCinematic(rectDef_t *rect, float scale, vec4_t color, qboo } if (uiInfo.mapList[map].cinematic >= 0) { trap_CIN_RunCinematic(uiInfo.mapList[map].cinematic); - UI_DrawCinematic(uiInfo.mapList[map].cinematic, rect->x, rect->y, rect->w, rect->h); + trap_CIN_SetExtents(uiInfo.mapList[map].cinematic, rect->x, rect->y, rect->w, rect->h); + trap_CIN_DrawCinematic(uiInfo.mapList[map].cinematic); } else { uiInfo.mapList[map].cinematic = -2; @@ -1711,16 +1712,10 @@ static void UI_DrawPlayerModel(rectDef_t *rect) vec3_t viewangles; vec3_t moveangles; - /* Neon_Knight: First pass the MP checker. */ - if(ui_missionpackChecks.integer != 0) { - Q_strncpyz(model, UI_Cvar_VariableString("team_model"), sizeof(model)); - Q_strncpyz(head, UI_Cvar_VariableString("team_headmodel"), sizeof(head)); - } - else { - Q_strncpyz(model, UI_Cvar_VariableString("model"), sizeof(model)); - Q_strncpyz(head, UI_Cvar_VariableString("headmodel"), sizeof(head)); - } if (trap_Cvar_VariableValue("ui_Q3Model")) { + // leilei - and do the team too + strcpy(model, UI_Cvar_VariableString("team_model")); + strcpy(head, UI_Cvar_VariableString("team_headmodel")); if (!q3Model) { q3Model = qtrue; updateModel = qtrue; @@ -1728,7 +1723,10 @@ static void UI_DrawPlayerModel(rectDef_t *rect) team[0] = '\0'; } else { - Q_strncpyz(team, UI_Cvar_VariableString("ui_teamName"), sizeof(team)); + + strcpy(team, UI_Cvar_VariableString("ui_teamName")); + strcpy(model, UI_Cvar_VariableString("team_model")); + strcpy(head, UI_Cvar_VariableString("team_headmodel")); if (q3Model) { q3Model = qfalse; updateModel = qtrue; @@ -1759,16 +1757,9 @@ static void UI_DrawPlayerModel2(rectDef_t *rect) vec3_t viewangles; vec3_t moveangles; - /* Neon_Knight: First pass the MP checker. */ - if(ui_missionpackChecks.integer != 0) { - Q_strncpyz(model, UI_Cvar_VariableString("team_model"), sizeof(model)); - Q_strncpyz(head, UI_Cvar_VariableString("team_headmodel"), sizeof(head)); - } - else { - Q_strncpyz(model, UI_Cvar_VariableString("model"), sizeof(model)); - Q_strncpyz(head, UI_Cvar_VariableString("headmodel"), sizeof(head)); - } if (trap_Cvar_VariableValue("ui_Q3Model")) { + strcpy(model, UI_Cvar_VariableString("model")); + strcpy(head, UI_Cvar_VariableString("headmodel")); if (!q3Model) { q3Model = qtrue; updateModel = qtrue; @@ -1776,7 +1767,10 @@ static void UI_DrawPlayerModel2(rectDef_t *rect) team[0] = '\0'; } else { - Q_strncpyz(team, UI_Cvar_VariableString("ui_teamName"), sizeof(team)); + + strcpy(team, UI_Cvar_VariableString("ui_teamName")); + strcpy(model, UI_Cvar_VariableString("team_model")); + strcpy(head, UI_Cvar_VariableString("team_headmodel")); if (q3Model) { q3Model = qfalse; updateModel = qtrue; @@ -1977,7 +1971,7 @@ static const char *UI_AIFromName(const char *name) return uiInfo.aliasList[j].ai; } } - return "sergei"; + return "sarge"; } #ifndef MISSIONPACK // bk001206 @@ -2025,7 +2019,7 @@ static const char *UI_OpponentLeaderModel(void) return uiInfo.characterList[i].base; } } - return "sergei"; + return "sarge"; } #endif @@ -2411,11 +2405,17 @@ static void UI_DrawBotName(rectDef_t *rect, float scale, vec4_t color, int textS { int value = uiInfo.botIndex; int game = trap_Cvar_VariableValue("g_gametype"); - const char *text; - if (UI_IsATeamGametype(game)) { + const char *text = ""; + if (game >= GT_TEAM && game != GT_LMS && game != GT_POSSESSION) { + if (value >= uiInfo.characterCount) { + value = 0; + } text = uiInfo.characterList[value].name; } else { + if (value >= UI_GetNumBots()) { + value = 0; + } text = UI_GetBotNameByNumber(value); } Text_Paint(rect->x, rect->y, scale, color, text, 0, 0, textStyle); @@ -2861,14 +2861,14 @@ static qboolean UI_OwnerDrawVisible(int flags) while (flags) { if (flags & UI_SHOW_FFA) { - if (UI_IsATeamGametype(trap_Cvar_VariableValue("g_gametype")) || trap_Cvar_VariableValue("g_gametype") == GT_TOURNAMENT) { + if (trap_Cvar_VariableValue("g_gametype") != GT_FFA || trap_Cvar_VariableValue("g_gametype") != GT_LMS || trap_Cvar_VariableValue("g_gametype") != GT_POSSESSION ) { vis = qfalse; } flags &= ~UI_SHOW_FFA; } if (flags & UI_SHOW_NOTFFA) { - if (!UI_IsATeamGametype(trap_Cvar_VariableValue("g_gametype")) && trap_Cvar_VariableValue("g_gametype") != GT_TOURNAMENT) { + if (trap_Cvar_VariableValue("g_gametype") == GT_FFA || trap_Cvar_VariableValue("g_gametype") == GT_LMS || trap_Cvar_VariableValue("g_gametype") == GT_POSSESSION ) { vis = qfalse; } flags &= ~UI_SHOW_NOTFFA; @@ -2913,25 +2913,25 @@ static qboolean UI_OwnerDrawVisible(int flags) flags &= ~UI_SHOW_NOTFAVORITESERVERS; } if (flags & UI_SHOW_ANYTEAMGAME) { - if (!UI_IsATeamGametype(uiInfo.gameTypes[ui_gameType.integer].gtEnum)) { + if (uiInfo.gameTypes[ui_gameType.integer].gtEnum <= GT_TEAM || uiInfo.gameTypes[ui_gameType.integer].gtEnum == GT_LMS || uiInfo.gameTypes[ui_gameType.integer].gtEnum == GT_POSSESSION ) { vis = qfalse; } flags &= ~UI_SHOW_ANYTEAMGAME; } if (flags & UI_SHOW_ANYNONTEAMGAME) { - if (UI_IsATeamGametype(uiInfo.gameTypes[ui_gameType.integer].gtEnum)) { + if (uiInfo.gameTypes[ui_gameType.integer].gtEnum > GT_TEAM && uiInfo.gameTypes[ui_gameType.integer].gtEnum != GT_LMS && uiInfo.gameTypes[ui_gameType.integer].gtEnum != GT_POSSESSION ) { vis = qfalse; } flags &= ~UI_SHOW_ANYNONTEAMGAME; } if (flags & UI_SHOW_NETANYTEAMGAME) { - if (!UI_IsATeamGametype(uiInfo.gameTypes[ui_netGameType.integer].gtEnum)) { + if (uiInfo.gameTypes[ui_netGameType.integer].gtEnum <= GT_TEAM || uiInfo.gameTypes[ui_gameType.integer].gtEnum == GT_LMS || uiInfo.gameTypes[ui_gameType.integer].gtEnum == GT_POSSESSION ) { vis = qfalse; } flags &= ~UI_SHOW_NETANYTEAMGAME; } if (flags & UI_SHOW_NETANYNONTEAMGAME) { - if (UI_IsATeamGametype(uiInfo.gameTypes[ui_netGameType.integer].gtEnum)) { + if (uiInfo.gameTypes[ui_netGameType.integer].gtEnum > GT_TEAM && uiInfo.gameTypes[ui_gameType.integer].gtEnum != GT_LMS && uiInfo.gameTypes[ui_gameType.integer].gtEnum != GT_POSSESSION ) { vis = qfalse; } flags &= ~UI_SHOW_NETANYNONTEAMGAME; @@ -2963,78 +2963,6 @@ static qboolean UI_OwnerDrawVisible(int flags) } flags &= ~UI_SHOW_DEMOAVAILABLE; } - if (flags & UI_SHOW_ANYTEAMOBJECTIVEGAME) { - if (!UI_IsATeamGametype(uiInfo.gameTypes[ui_gameType.integer].gtEnum)) { - vis = qfalse; - } - flags &= ~UI_SHOW_ANYTEAMOBJECTIVEGAME; - } - if (flags & UI_SHOW_ANYNONTEAMOBJECTIVEGAME) { - if (UI_IsATeamGametype(uiInfo.gameTypes[ui_gameType.integer].gtEnum)) { - vis = qfalse; - } - flags &= ~UI_SHOW_ANYNONTEAMOBJECTIVEGAME; - } - if (flags & UI_SHOW_NETANYTEAMOBJECTIVEGAME) { - if (!UI_IsATeamGametype(uiInfo.gameTypes[ui_netGameType.integer].gtEnum)) { - vis = qfalse; - } - flags &= ~UI_SHOW_NETANYTEAMOBJECTIVEGAME; - } - if (flags & UI_SHOW_NETANYNONTEAMOBJECTIVEGAME) { - if (UI_IsATeamGametype(uiInfo.gameTypes[ui_netGameType.integer].gtEnum)) { - vis = qfalse; - } - flags &= ~UI_SHOW_NETANYNONTEAMOBJECTIVEGAME; - } - if (flags & UI_SHOW_ANYROUNDGAME) { - if (!UI_IsARoundBasedGametype(uiInfo.gameTypes[ui_gameType.integer].gtEnum)) { - vis = qfalse; - } - flags &= ~UI_SHOW_ANYROUNDGAME; - } - if (flags & UI_SHOW_ANYNONROUNDGAME) { - if (UI_IsARoundBasedGametype(uiInfo.gameTypes[ui_gameType.integer].gtEnum)) { - vis = qfalse; - } - flags &= ~UI_SHOW_ANYNONROUNDGAME; - } - if (flags & UI_SHOW_NETANYROUNDGAME) { - if (!UI_IsARoundBasedGametype(uiInfo.gameTypes[ui_netGameType.integer].gtEnum)) { - vis = qfalse; - } - flags &= ~UI_SHOW_NETANYROUNDGAME; - } - if (flags & UI_SHOW_NETANYNONROUNDGAME) { - if (UI_IsARoundBasedGametype(uiInfo.gameTypes[ui_netGameType.integer].gtEnum)) { - vis = qfalse; - } - flags &= ~UI_SHOW_NETANYNONROUNDGAME; - } - if (flags & UI_SHOW_ANYTEAMROUNDGAME) { - if (!(UI_IsARoundBasedGametype(uiInfo.gameTypes[ui_gameType.integer].gtEnum) && UI_IsATeamGametype(uiInfo.gameTypes[ui_gameType.integer].gtEnum))) { - vis = qfalse; - } - flags &= ~UI_SHOW_ANYTEAMROUNDGAME; - } - if (flags & UI_SHOW_ANYNONTEAMROUNDGAME) { - if (UI_IsARoundBasedGametype(uiInfo.gameTypes[ui_gameType.integer].gtEnum) && UI_IsATeamGametype(uiInfo.gameTypes[ui_gameType.integer].gtEnum)) { - vis = qfalse; - } - flags &= ~UI_SHOW_ANYNONTEAMROUNDGAME; - } - if (flags & UI_SHOW_NETANYTEAMROUNDGAME) { - if (!(UI_IsARoundBasedGametype(uiInfo.gameTypes[ui_netGameType.integer].gtEnum) && UI_IsATeamGametype(uiInfo.gameTypes[ui_gameType.integer].gtEnum))) { - vis = qfalse; - } - flags &= ~UI_SHOW_NETANYTEAMROUNDGAME; - } - if (flags & UI_SHOW_NETANYNONTEAMROUNDGAME) { - if (UI_IsARoundBasedGametype(uiInfo.gameTypes[ui_netGameType.integer].gtEnum) && UI_IsATeamGametype(uiInfo.gameTypes[ui_gameType.integer].gtEnum)) { - vis = qfalse; - } - flags &= ~UI_SHOW_NETANYNONTEAMROUNDGAME; - } else { flags = 0; } @@ -3140,14 +3068,14 @@ static qboolean UI_GameType_HandleKey(int flags, float *special, int key, qboole } // end changed RD - if (!UI_IsATeamGametype(uiInfo.gameTypes[ui_gameType.integer].gtEnum)) { - trap_Cvar_SetValue( "ui_Q3Model", 1 ); + if (uiInfo.gameTypes[ui_gameType.integer].gtEnum == GT_TOURNAMENT) { + trap_Cvar_Set("ui_Q3Model", "1"); } else { - trap_Cvar_SetValue( "ui_Q3Model", 0 ); + trap_Cvar_Set("ui_Q3Model", "0"); } - trap_Cvar_SetValue("ui_gameType", ui_gameType.integer); + trap_Cvar_Set("ui_gameType", va("%d", ui_gameType.integer)); UI_SetCapFragLimits(qtrue); UI_LoadBestScores(uiInfo.mapList[ui_currentMap.integer].mapLoadName, uiInfo.gameTypes[ui_gameType.integer].gtEnum); if (resetMap && oldCount != UI_MapCountByGameType(qtrue)) { @@ -3252,9 +3180,13 @@ static qboolean UI_TeamMember_HandleKey(int flags, float *special, int key, qboo char *cvar = va(blue ? "ui_blueteam%i" : "ui_redteam%i", num); int value = trap_Cvar_VariableValue(cvar); - value += select; - - if (UI_IsATeamGametype(ui_actualNetGameType.integer)) { + if (key == K_MOUSE2) { + value--; + } + else { + value++; + } + if (ui_actualNetGameType.integer >= GT_TEAM && ui_actualNetGameType.integer != GT_LMS && ui_actualNetGameType.integer != GT_POSSESSION) { if (value >= uiInfo.characterCount + 2) { value = 0; } @@ -3340,7 +3272,7 @@ static qboolean UI_BotName_HandleKey(int flags, float *special, int key) value += select; - if (UI_IsATeamGametype(game)) { + if (game >= GT_TEAM && game != GT_LMS && game != GT_POSSESSION) { if (value >= uiInfo.characterCount) { value = 0; } @@ -3552,50 +3484,8 @@ void UI_ServersSort(int column, qboolean force) qsort( &uiInfo.serverStatus.displayServers[0], uiInfo.serverStatus.numDisplayServers, sizeof(int), UI_ServersQsortCompare); // update displayed levelshot - UI_FeederSelection( FEEDER_SERVERS, uiInfo.serverStatus.currentServer ); } -/* Neon_Knight: Readding this here. May be useful in a future. */ -/* -static void UI_StartSinglePlayer(void) { - int i,j, k, skill; - char buff[1024]; - i = trap_Cvar_VariableValue( "ui_currentTier" ); - if (i < 0 || i >= tierCount) { - i = 0; - } - j = trap_Cvar_VariableValue("ui_currentMap"); - if (j < 0 || j >= MAPS_PER_TIER) { - j = 0; - } - - trap_Cvar_SetValue( "singleplayer", 1 ); - trap_Cvar_SetValue( "g_gametype", Com_Clamp( 0, GT_MAX_GAME_TYPE-1, tierList[i].gameTypes[j] ) ); - trap_Cmd_ExecuteText( EXEC_APPEND, va( "wait ; wait ; map %s\n", tierList[i].maps[j] ) ); - skill = trap_Cvar_VariableValue( "g_spSkill" ); - - if (j == MAPS_PER_TIER-1) { - k = UI_TeamIndexFromName(UI_Cvar_VariableString("ui_opponentName")); - Com_sprintf( buff, sizeof(buff), "wait ; addbot %s %i %s 250 %s\n", UI_AIFromName(teamList[k].teamMembers[0]), skill, "", teamList[k].teamMembers[0]); - } else { - k = UI_TeamIndexFromName(UI_Cvar_VariableString("ui_opponentName")); - for (i = 0; i < PLAYERS_PER_TEAM; i++) { - Com_sprintf( buff, sizeof(buff), "wait ; addbot %s %i %s 250 %s\n", UI_AIFromName(teamList[k].teamMembers[i]), skill, "Blue", teamList[k].teamMembers[i]); - trap_Cmd_ExecuteText( EXEC_APPEND, buff ); - } - - k = UI_TeamIndexFromName(UI_Cvar_VariableString("ui_teamName")); - for (i = 1; i < PLAYERS_PER_TEAM; i++) { - Com_sprintf( buff, sizeof(buff), "wait ; addbot %s %i %s 250 %s\n", UI_AIFromName(teamList[k].teamMembers[i]), skill, "Red", teamList[k].teamMembers[i]); - trap_Cmd_ExecuteText( EXEC_APPEND, buff ); - } - trap_Cmd_ExecuteText( EXEC_APPEND, "wait 5; team Red\n" ); - } - - -} -*/ - /* =============== @@ -3772,9 +3662,6 @@ static void UI_StartSkirmish(qboolean next, char *name) trap_Cvar_Set("ui_saveCaptureLimit", va("%i", temp)); temp = trap_Cvar_VariableValue( "fraglimit" ); trap_Cvar_Set("ui_saveFragLimit", va("%i", temp)); - /* Neon_Knight: Since the SP uses custom time limits, pass it as well. */ - temp = trap_Cvar_VariableValue( "timelimit" ); - trap_Cvar_Set("ui_saveTimeLimit", va("%i", temp)); UI_SetCapFragLimits(qfalse); @@ -3782,38 +3669,14 @@ static void UI_StartSkirmish(qboolean next, char *name) trap_Cvar_Set("ui_drawTimer", va("%i", temp)); temp = trap_Cvar_VariableValue( "g_doWarmup" ); trap_Cvar_Set("ui_doWarmup", va("%i", temp)); - /* Neon_Knight: Since the SP uses bot_minplayers, pass it as well. */ - temp = trap_Cvar_VariableValue( "bot_minPlayers" ); - trap_Cvar_Set("ui_minPlayers", va("%i", temp)); + temp = trap_Cvar_VariableValue( "g_friendlyFire" ); + trap_Cvar_Set("ui_friendlyFire", va("%i", temp)); temp = trap_Cvar_VariableValue( "sv_maxClients" ); trap_Cvar_Set("ui_maxClients", va("%i", temp)); temp = trap_Cvar_VariableValue( "g_warmup" ); trap_Cvar_Set("ui_Warmup", va("%i", temp)); temp = trap_Cvar_VariableValue( "sv_pure" ); trap_Cvar_Set("ui_pure", va("%i", temp)); - /* Neon_Knight: Since the SP uses game options, pass them as well. */ - temp = trap_Cvar_VariableValue( "g_friendlyFire" ); - trap_Cvar_Set("ui_friendlyFire", va("%i", temp)); - temp = trap_Cvar_VariableValue( "g_vampire" ); - trap_Cvar_Set("ui_vampire", va("%i", temp)); - temp = trap_Cvar_VariableValue( "g_lms_lives" ); - trap_Cvar_Set("ui_lmsLives", va("%i", temp)); - temp = trap_Cvar_VariableValue( "g_ddCaptureTime" ); - trap_Cvar_Set("ui_ddCaptureTime", va("%i", temp)); - temp = trap_Cvar_VariableValue( "g_ddRespawnDelay" ); - trap_Cvar_Set("ui_ddRespawnDelay", va("%i", temp)); - temp = trap_Cvar_VariableValue( "g_obeliskHealth" ); - trap_Cvar_Set("ui_obeliskHealth", va("%i", temp)); - temp = trap_Cvar_VariableValue( "g_rockets" ); - trap_Cvar_Set("ui_rockets", va("%i", temp)); - temp = trap_Cvar_VariableValue( "g_gravityModifier" ); - trap_Cvar_Set("ui_gravityModifier", va("%i", temp)); - temp = trap_Cvar_VariableValue( "elimination_ctf_oneway" ); - trap_Cvar_Set("ui_eCTFOneWayMode", va("%i", temp)); - temp = trap_Cvar_VariableValue( "g_instantgib" ); - trap_Cvar_Set("ui_instaGib", va("%i", temp)); - temp = trap_Cvar_VariableValue( "g_harvesterFromBodies" ); - trap_Cvar_Set("ui_harvesterFromBodies", va("%i", temp)); trap_Cvar_Set("cg_cameraOrbit", "0"); trap_Cvar_Set("cg_thirdPerson", "0"); @@ -3821,8 +3684,7 @@ static void UI_StartSkirmish(qboolean next, char *name) trap_Cvar_Set("g_doWarmup", "1"); trap_Cvar_Set("g_warmup", "15"); trap_Cvar_Set("sv_pure", "0"); - /* Neon_Knight: This interferes. Commenting. */ - /* trap_Cvar_Set("g_friendlyFire", "0"); */ + trap_Cvar_Set("g_friendlyFire", "0"); trap_Cvar_Set("g_redTeam", UI_Cvar_VariableString("ui_teamName")); trap_Cvar_Set("g_blueTeam", UI_Cvar_VariableString("ui_opponentName")); @@ -3838,7 +3700,7 @@ static void UI_StartSkirmish(qboolean next, char *name) Com_sprintf( buff, sizeof(buff), "addbot %s %f "", %i \n", uiInfo.mapList[ui_currentMap.integer].opponentName, skill, delay); trap_Cmd_ExecuteText( EXEC_APPEND, buff ); } - else if (!UI_IsATeamGametype(g) && g != GT_TOURNAMENT) { // leilei - parse the opponentname as a list of bots instead like q3_ui's arena parsing + else if (g == GT_FFA || g == GT_LMS || g == GT_POSSESSION) { // leilei - parse the opponentname as a list of bots instead like q3_ui's arena parsing char *p; char *bot; const char *botInfo; @@ -3889,32 +3751,21 @@ static void UI_StartSkirmish(qboolean next, char *name) } else { temp = uiInfo.mapList[ui_currentMap.integer].teamMembers * 2; - /* Neon_Knight: Missionpack checks, if != 0, enables this. */ - if(ui_missionpackChecks.integer) { - trap_Cvar_Set("sv_maxClients", va("%i", temp)); - for (i =0; i < uiInfo.mapList[ui_currentMap.integer].teamMembers; i++) { - Com_sprintf( buff, sizeof(buff), "addbot %s %f %s %i %s\n", UI_AIFromName(uiInfo.teamList[k].teamMembers[i]), skill, (g == GT_FFA) ? "" : "Blue", delay, uiInfo.teamList[k].teamMembers[i]); - trap_Cmd_ExecuteText( EXEC_APPEND, buff ); - delay += 500; - } - k = UI_TeamIndexFromName(UI_Cvar_VariableString("ui_teamName")); - for (i =0; i < uiInfo.mapList[ui_currentMap.integer].teamMembers-1; i++) { - Com_sprintf( buff, sizeof(buff), "addbot %s %f %s %i %s\n", UI_AIFromName(uiInfo.teamList[k].teamMembers[i]), skill, (g == GT_FFA) ? "" : "Red", delay, uiInfo.teamList[k].teamMembers[i]); - trap_Cmd_ExecuteText( EXEC_APPEND, buff ); - delay += 500; - } + trap_Cvar_Set("sv_maxClients", va("%d", temp)); + for (i =0; i < uiInfo.mapList[ui_currentMap.integer].teamMembers; i++) { + Com_sprintf( buff, sizeof(buff), "addbot %s %f %s %i %s\n", UI_AIFromName(uiInfo.teamList[k].teamMembers[i]), skill, (g == GT_FFA) ? "" : "Blue", delay, uiInfo.teamList[k].teamMembers[i]); + trap_Cmd_ExecuteText( EXEC_APPEND, buff ); + delay += 500; } - else { - trap_Cvar_Set("sv_maxClients", va("%i", temp+2)); - trap_Cvar_Set("bot_minplayers", va("%i", temp)); - trap_Cvar_Set("skill", va("%f", skill)); - Com_sprintf( buff, sizeof(buff), "wait ;\n"); + k = UI_TeamIndexFromName(UI_Cvar_VariableString("ui_teamName")); + for (i =0; i < uiInfo.mapList[ui_currentMap.integer].teamMembers-1; i++) { + Com_sprintf( buff, sizeof(buff), "addbot %s %f %s %i %s\n", UI_AIFromName(uiInfo.teamList[k].teamMembers[i]), skill, (g == GT_FFA) ? "" : "Red", delay, uiInfo.teamList[k].teamMembers[i]); trap_Cmd_ExecuteText( EXEC_APPEND, buff ); + delay += 500; } - /* /Neon_Knight */ } - if (UI_IsATeamGametype(g)) { - trap_Cvar_Set( "g_localTeamPref", "Red" ); + if (g >= GT_TEAM ) { + trap_Cmd_ExecuteText( EXEC_APPEND, "wait 5; team Red\n" ); } } @@ -4127,7 +3978,7 @@ static void UI_RunMenuScript(char **args) for (i = 0; i < PLAYERS_PER_TEAM; i++) { int bot = trap_Cvar_VariableValue( va("ui_blueteam%i", i+1)); if (bot > 1) { - if (UI_IsATeamGametype(ui_actualNetGameType.integer)) { + if (ui_actualNetGameType.integer >= GT_TEAM && ui_actualNetGameType.integer != GT_LMS && ui_actualNetGameType.integer != GT_POSSESSION ) { Com_sprintf( buff, sizeof(buff), "addbot %s %f %s\n", uiInfo.characterList[bot-2].name, skill, "Blue"); } else { @@ -4137,7 +3988,7 @@ static void UI_RunMenuScript(char **args) } bot = trap_Cvar_VariableValue( va("ui_redteam%i", i+1)); if (bot > 1) { - if (UI_IsATeamGametype(ui_actualNetGameType.integer)) { + if (ui_actualNetGameType.integer >= GT_TEAM && ui_actualNetGameType.integer != GT_LMS && ui_actualNetGameType.integer != GT_POSSESSION ) { Com_sprintf( buff, sizeof(buff), "addbot %s %f %s\n", uiInfo.characterList[bot-2].name, skill, "Red"); } else { @@ -4222,7 +4073,7 @@ static void UI_RunMenuScript(char **args) } } else if (Q_strequal(name, "loadArenas") ) { - UI_LoadArenasIntoMapList(); + UI_LoadArenas(); UI_MapCountByGameType(qfalse); Menu_SetFeederSelection(NULL, FEEDER_ALLMAPS, 0, "createserver"); } @@ -4258,6 +4109,9 @@ static void UI_RunMenuScript(char **args) else if (Q_strequal(name, "resetScores") ) { UI_ClearScores(); } + else if (Q_stricmp(name, "updateColors") == 0) { + RefreshHexColors(); + } else if (Q_stricmp(name, "RefreshServers") == 0) { UI_StartServerRefresh(qtrue); UI_BuildServerDisplayList(qtrue, qtrue); @@ -4470,14 +4324,12 @@ static void UI_RunMenuScript(char **args) } } else if (Q_strequal(name, "addBot") ) { - /* Neon_Knight: Missionpack checks, if != 0, enables this. */ - if (ui_missionpackChecks.integer) { - if (UI_IsATeamGametype(trap_Cvar_VariableValue("g_gametype"))) { - trap_Cmd_ExecuteText( EXEC_APPEND, va("addbot %s %i %s\n", UI_GetBotNameByNumber(uiInfo.botIndex), uiInfo.skillIndex+1, (uiInfo.redBlue == 0) ? "Red" : "Blue") ); - } - } else { + if (trap_Cvar_VariableValue("g_gametype") >= GT_TEAM || GT_LMS || GT_POSSESSION ) { trap_Cmd_ExecuteText( EXEC_APPEND, va("addbot %s %i %s\n", uiInfo.characterList[uiInfo.botIndex].name, uiInfo.skillIndex+1, (uiInfo.redBlue == 0) ? "Red" : "Blue") ); } + else { + trap_Cmd_ExecuteText( EXEC_APPEND, va("addbot %s %i %s\n", UI_GetBotNameByNumber(uiInfo.botIndex), uiInfo.skillIndex+1, (uiInfo.redBlue == 0) ? "Red" : "Blue") ); + } // Changed RD } else if (Q_stricmp(name, "getHostName") == 0) { @@ -5647,6 +5499,8 @@ static void UI_FeederSelection(float feederID, int index) } else if (feederID == FEEDER_Q3HEADS) { if (index >= 0 && index < uiInfo.q3HeadCount) { + trap_Cvar_Set( "team_model", uiInfo.q3HeadNames[index]); + trap_Cvar_Set( "team_headmodel", uiInfo.q3HeadNames[index]); trap_Cvar_Set( "model", uiInfo.q3HeadNames[index]); trap_Cvar_Set( "headmodel", uiInfo.q3HeadNames[index]); updateModel = qtrue; @@ -5654,6 +5508,8 @@ static void UI_FeederSelection(float feederID, int index) } else if (feederID == FEEDER_Q3HEADS_FULL) { if (index >= 0 && index < uiInfo.q3HeadCount2) { + trap_Cvar_Set( "team_model", uiInfo.q3HeadNames[index]); + trap_Cvar_Set( "team_headmodel", uiInfo.q3HeadNames[index]); trap_Cvar_Set( "model", uiInfo.q3HeadNames2[index]); trap_Cvar_Set( "headmodel", uiInfo.q3HeadNames2[index]); updateModel = qtrue; @@ -5833,10 +5689,10 @@ static qboolean Character_Parse(char **p) uiInfo.characterList[uiInfo.characterCount].imageName = String_Alloc(va("models/players/heads/%s/icon_default.tga", uiInfo.characterList[uiInfo.characterCount].name)); if (tempStr && Q_strequal(tempStr, "female")) { - uiInfo.characterList[uiInfo.characterCount].base = String_Alloc(va("kyonshi")); + uiInfo.characterList[uiInfo.characterCount].base = String_Alloc(va("sarge")); } else if (tempStr && Q_strequal(tempStr, "male")) { - uiInfo.characterList[uiInfo.characterCount].base = String_Alloc(va("sergei")); + uiInfo.characterList[uiInfo.characterCount].base = String_Alloc(va("sarge")); } else { uiInfo.characterList[uiInfo.characterCount].base = String_Alloc(va("%s",tempStr)); @@ -7160,7 +7016,7 @@ vmCvar_t gameover; // ai script vmCvar_t ui_introPlayed; vmCvar_t ui_colors; vmCvar_t ui_humansonly; -vmCvar_t ui_missionpackChecks; + vmCvar_t ui_new; vmCvar_t ui_leidebug; vmCvar_t ui_debug; @@ -7280,7 +7136,7 @@ static cvarTable_t cvarTable[] = { { &ui_blueteam3, "ui_blueteam3", "0", CVAR_ARCHIVE }, { &ui_blueteam4, "ui_blueteam4", "0", CVAR_ARCHIVE }, { &ui_blueteam5, "ui_blueteam5", "0", CVAR_ARCHIVE }, - { &ui_netSource, "ui_netSource", "1", CVAR_ARCHIVE }, + { &ui_netSource, "ui_netSource", "0", CVAR_ARCHIVE }, { &ui_menuFiles, "ui_menuFiles", "ui/menus.txt", CVAR_ARCHIVE }, { &ui_currentTier, "ui_currentTier", "0", CVAR_ARCHIVE }, { &ui_currentMap, "ui_currentMap", "0", CVAR_ARCHIVE }, @@ -7344,7 +7200,6 @@ static cvarTable_t cvarTable[] = { { &gameover, "gameover", "0", CVAR_INIT}, // ai script // end changed RD { &ui_introPlayed, "ui_introPlayed", "0", CVAR_INIT }, - { &ui_missionpackChecks, "missionpackChecks", "1", CVAR_INIT }, // leilei { &ui_colors, "ui_colors", "0x1e3072 0x7286d0 0x1fd1b2 0x606060", CVAR_ARCHIVE}, { &ui_developer, "developer", "0", CVAR_CHEAT }, @@ -7526,46 +7381,3 @@ static void UI_StartServerRefresh(qboolean full) } } -/* Neon_Knight: Useful check in order to have code consistency. */ -/* -=================== -UI_IsATeamGametype - -Checks if the gametype is a team-based game. -(UI_IsATeamGame(check,qtrue)) -=================== - */ -qboolean UI_IsATeamGametype(int check) { - return GAMETYPE_IS_A_TEAM_GAME(check); -} -/* -=================== -UI_UsesTeamFlags - -Checks if the gametype makes use of the red and blue flags. -=================== - */ -qboolean UI_UsesTeamFlags(int check) { - return GAMETYPE_USES_RED_AND_BLUE_FLAG(check); -} -/* -=================== -UI_UsesTheWhiteFlag - -Checks if the gametype makes use of the neutral flag. -=================== - */ -qboolean UI_UsesTheWhiteFlag(int check) { - return GAMETYPE_USES_WHITE_FLAG(check); -} -/* -=================== -UI_IsARoundBasedGametype - -Checks if the gametype has a round-based system. -=================== - */ -qboolean UI_IsARoundBasedGametype(int check) { - return GAMETYPE_IS_ROUND_BASED(check); -} -/* /Neon_Knight */ \ No newline at end of file diff --git a/code/ui/ui_players.c b/code/ui/ui_players.c index 912ce5c6..faa685c1 100644 --- a/code/ui/ui_players.c +++ b/code/ui/ui_players.c @@ -2041,11 +2041,11 @@ qboolean UI_RegisterClientModelname( playerInfo_t *pi, const char *modelSkinName // load the animations Com_sprintf( filename, sizeof( filename ), "models/players/%s/animation.cfg", modelName ); if ( !UI_ParseAnimationFile( filename, pi ) ) { - Com_sprintf( filename, sizeof( filename ), "models/players/characters/%s/animation.cfg", modelName ); - if ( !UI_ParseAnimationFile( filename, pi ) ) { +// Com_sprintf( filename, sizeof( filename ), "models/players/characters/%s/animation.cfg", modelName ); +// if ( !UI_ParseAnimationFile( filename, pi ) ) { Com_Printf( "Failed to load animation file %s\n", filename ); - return qfalse; - } +// return qfalse; +// } } // load eyes diff --git a/code/ui/ui_shared.c b/code/ui/ui_shared.c index 118e39a9..7b3ecc12 100644 --- a/code/ui/ui_shared.c +++ b/code/ui/ui_shared.c @@ -269,6 +269,9 @@ static void PC_SourceError(int handle, const char *format, ...) { va_list argptr; static char string[4096]; + // leilei - suppress on non-developer mode because we do a lot of tricks that make errors upset.... + if (DC->getCVarValue("developer")) + { va_start(argptr, format); Q_vsnprintf(string, sizeof (string), format, argptr); va_end(argptr); @@ -278,6 +281,7 @@ static void PC_SourceError(int handle, const char *format, ...) { trap_PC_SourceFileAndLine(handle, filename, &line); Com_Printf(S_COLOR_RED "ERROR: %s, line %d: %s\n", filename, line, string); + } } /* @@ -4408,6 +4412,13 @@ void Item_Model_Paint(itemDef_t *item) { ent.renderfx = RF_LIGHTING_ORIGIN | RF_NOSHADOW; VectorCopy(ent.origin, ent.oldorigin); + // leilei - colorable models + if (item->window.flags & WINDOW_FORECOLORSET) { + ent.shaderRGBA[0] = item->window.foreColor[0] * 255; + ent.shaderRGBA[1] = item->window.foreColor[1] * 255; + ent.shaderRGBA[2] = item->window.foreColor[2] * 255; + + } DC->addRefEntityToScene(&ent); // changed RD @@ -4951,6 +4962,7 @@ qboolean Menus_AnyFullScreenVisible(void) { return qfalse; } +void RefreshHexColors ( void ); menuDef_t *Menus_ActivateByName(const char *p) { int i; menuDef_t *m = NULL; @@ -5696,6 +5708,12 @@ qboolean ItemParse_textstyle(itemDef_t *item, int handle) { } +qboolean ItemParse_bitflag(itemDef_t *item, int handle) { + if (!PC_Int_Parse(handle, &item->bitflag)) { + return qfalse; + } + return qtrue; +} // Changed RD qboolean ItemParse_boxcolor(itemDef_t *item, int handle) { @@ -5766,14 +5784,16 @@ static char *Both_Cvar_VariableString( const char *var_name ) { return buffer; } -#define MAX_HEXCOLORS 8 +#define MAX_HEXCOLORS 16 vec4_t hexcol[MAX_HEXCOLORS]; void UpdateHexColors ( void ){ // Parse ui_colors to update our vectors from the hex values in the cvar const char *token; int col[MAX_HEXCOLORS]; - int i; + int i, j, k; + menuDef_t *menu; + char *thecolors = Both_Cvar_VariableString("ui_colors"); for (i=0;i> 8 ) & 0xFF) / 255; hexcol[i][2] = (float)(col[i] & 0xFF) / 255; } + + + +} + + +void ItemRefresh_hexcolor(itemDef_t *item) { + int i; + int j; + float f; + int hecks[MAX_HEXCOLORS]; + UpdateHexColors(); + for (j = 0; j < 3; j++) { // ignore alpha + item->window.backColor[j] = hexcol[item->window.choshex[0]][j]; + item->window.foreColor[j] = hexcol[item->window.choshex[1]][j]; + item->window.outlineColor[j] = hexcol[item->window.choshex[2]][j]; + item->window.borderColor[j] = hexcol[item->window.choshex[3]][j]; + } } + qboolean ItemParse_hexcolor(itemDef_t *item, int handle) { int i; int j; float f; - int hecks[4]; + int hecks[MAX_HEXCOLORS]; UpdateHexColors(); // TODO: Move to a uiscript command so scheme changes // can update everything @@ -5812,27 +5851,52 @@ qboolean ItemParse_hexcolor(itemDef_t *item, int handle) { // // - for (i = 0; i < 4; i++) { + for (i = 0; i < 3; i++) { if (!PC_Float_Parse(handle, &f)) { return qfalse; } hecks[i] = (int)f; - } + } + + item->window.choshex[0] = hecks[0]; + item->window.choshex[1] = hecks[1]; + item->window.choshex[2] = hecks[2]; + item->window.choshex[3] = hecks[3]; + item->window.flags |= WINDOW_HEXCOLORSET; + for (j = 0; j < 3; j++) { // ignore alpha + item->window.backColor[j] = hexcol[hecks[0]][j]; + item->window.foreColor[j] = hexcol[hecks[1]][j]; + item->window.outlineColor[j] = hexcol[hecks[2]][j]; + item->window.borderColor[j] = hexcol[hecks[3]][j]; + } - for (i = 0; i < 4; i++) { - for (j = 0; j < 3; j++) { // ignore alpha - item->window.backColor[j] = hexcol[hecks[0]][j]; - item->window.foreColor[j] = hexcol[hecks[1]][j]; - item->window.outlineColor[j] = hexcol[hecks[2]][j]; - item->window.borderColor[j] = hexcol[hecks[3]][j]; + return qtrue; +} + +void RefreshHexColors ( void ){ + // Parse ui_colors to update our vectors from the hex values in the cvar + const char *token; + int col[MAX_HEXCOLORS]; + int i, j, k; + menuDef_t *menu; + + // Now go through all of the menu options and check their hex colors and change them all + for (i = 0; i < Menu_Count(); i++) { + menu = &Menus[i]; + if (menu != NULL) { + for (j = 0; j < menu->itemCount; j++) { + if (menu->items[j]->window.flags & WINDOW_HEXCOLORSET) { + ItemRefresh_hexcolor(menu->items[j]); + } + } } - } - return qtrue; + } + qboolean ItemParse_bordercolor(itemDef_t *item, int handle) { int i; float f; @@ -6361,6 +6425,7 @@ keywordHash_t itemParseKeywords[] = { {"cinematic", ItemParse_cinematic, NULL}, {"doubleclick", ItemParse_doubleClick, NULL}, {"hexcolor", ItemParse_hexcolor, NULL}, + {"bitflag", ItemParse_bitflag, NULL}, {NULL, 0, NULL} }; diff --git a/code/ui/ui_shared.h b/code/ui/ui_shared.h index b88b704c..d6d85260 100644 --- a/code/ui/ui_shared.h +++ b/code/ui/ui_shared.h @@ -33,10 +33,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define MAX_ITEMTEXT 64 #define MAX_ITEMACTION 64 #define MAX_MENUDEFFILE 4096 -#define MAX_MENUFILE 32768 +#define MAX_MENUFILE 65535 #define MAX_MENUS 64 // Changed RD -#define MAX_MENUITEMS 128 +#define MAX_MENUITEMS 256 #define MAX_SCRIPTSIZE 4096 // end changed RD #define MAX_COLOR_RANGES 10 @@ -165,6 +165,7 @@ typedef struct { vec4_t outlineColor; // border color qhandle_t background; // background asset vec4_t hexColor; // leilei - defined colors + int choshex[16]; // leilei - chosen hex colors } windowDef_t; typedef windowDef_t Window; @@ -316,6 +317,7 @@ typedef struct itemDef_s { float scralignfactor; // leilei - factor of adjustment int viewsizemin; // leilei - hide this if viewsize int viewsizemax; // leilei - hide this if viewsize + int bitflag; // leilei - check for bits } itemDef_t; typedef struct {