Skip to content

Commit

Permalink
- captureLimit should not end non-capturing games anymore
Browse files Browse the repository at this point in the history
- bloodExplosion starts the shader (ancient bug/oversight)
- reverted superfluous cruft
  • Loading branch information
leilei- committed May 14, 2024
1 parent 6d57ef0 commit e9e02fc
Show file tree
Hide file tree
Showing 48 changed files with 668 additions and 1,077 deletions.
7 changes: 5 additions & 2 deletions code/cgame/cg_consolecmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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) {
Expand Down
38 changes: 19 additions & 19 deletions code/cgame/cg_draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1261,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));
Expand Down Expand Up @@ -1526,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;
}

Expand Down Expand Up @@ -1665,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 ) {
Expand All @@ -1690,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);*/
Expand Down Expand Up @@ -1748,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;
Expand All @@ -1763,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);

Expand Down Expand Up @@ -1797,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);

Expand Down Expand Up @@ -1833,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;
Expand Down Expand Up @@ -2036,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);
}

Expand Down Expand Up @@ -2091,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);
}

Expand Down Expand Up @@ -3064,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);
}
}
Expand Down Expand Up @@ -3179,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");
Expand All @@ -3203,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;
Expand Down Expand Up @@ -3613,12 +3612,13 @@ 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();
Expand Down
1 change: 1 addition & 0 deletions code/cgame/cg_effects.c
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,7 @@ void CG_Bleed( vec3_t origin, int entityNum ) {
ex->refEntity.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
Expand Down
5 changes: 4 additions & 1 deletion code/cgame/cg_ents.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 1 addition & 3 deletions code/cgame/cg_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down
6 changes: 3 additions & 3 deletions code/cgame/cg_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,16 +292,16 @@ 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 ),
UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorWhite );
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 ),
Expand Down
35 changes: 13 additions & 22 deletions code/cgame/cg_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -1212,6 +1212,9 @@ typedef struct {

int levelStartTime;

//Forced FFA
int ffa_gt;

//Elimination
int roundStartTime;
int roundtime;
Expand Down Expand Up @@ -1481,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 */

/* 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 );
Expand Down Expand Up @@ -2056,11 +2055,3 @@ void trap_R_GetViewPosition( vec3_t point );
#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 */
Loading

0 comments on commit e9e02fc

Please sign in to comment.