Fix issues and formatting from adding LCS

See "NEW GAME MODE: LAST CAR STANDING"
commit 227e401356
This commit is contained in:
Zack Middleton 2023-12-27 16:06:59 -06:00
parent 4561b7e035
commit 89c4886605
9 changed files with 46 additions and 83 deletions

View file

@ -417,7 +417,7 @@ static float CG_DrawTimes( float y ) {
// Best Time
//
if ( cgs.gametype != GT_DERBY || cgs.gametype != GT_LCS ){
if ( cgs.gametype != GT_DERBY && cgs.gametype != GT_LCS ){
time = getStringForTime( cent->bestLapTime );
Com_sprintf(s, sizeof(s), "B: %s", time);
@ -436,7 +436,7 @@ static float CG_DrawTimes( float y ) {
if (cgs.gametype != GT_DERBY || cgs.gametype != GT_LCS ){
if ( cgs.gametype != GT_DERBY && cgs.gametype != GT_LCS ){
time = getStringForTime(lapTime);
Com_sprintf(s, sizeof(s), "L: %s", time);

View file

@ -1572,7 +1572,7 @@ void ClientThink_real( gentity_t *ent ) {
if ( g_forcerespawn.integer > 0 &&
( level.time - client->respawnTime ) > g_forcerespawn.integer * 1000 ) {
// STONELANCE
if (g_gametype.integer != GT_DERBY || g_gametype.integer != GT_LCS || !ent->client->finishRaceTime)
if ((g_gametype.integer != GT_DERBY && g_gametype.integer != GT_LCS) || !ent->client->finishRaceTime)
// END
ClientRespawn( ent );
return;
@ -1581,7 +1581,7 @@ void ClientThink_real( gentity_t *ent ) {
// pressing attack or use is the normal respawn method
if ( ucmd->buttons & ( BUTTON_ATTACK | BUTTON_USE_HOLDABLE ) ) {
// STONELANCE
if (g_gametype.integer != GT_DERBY || g_gametype.integer != GT_LCS || !ent->client->finishRaceTime)
if ((g_gametype.integer != GT_DERBY && g_gametype.integer != GT_LCS) || !ent->client->finishRaceTime)
// END
ClientRespawn( ent );
}

View file

@ -530,7 +530,7 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
self->client->ps.pm_type = PM_DEAD;
// STONELANCE
if (g_gametype.integer == GT_DERBY || g_gametype.integer == GT_LCS || level.startRaceTime){
if ((g_gametype.integer == GT_DERBY || g_gametype.integer == GT_LCS) && level.startRaceTime){
self->client->finishRaceTime = level.time;
trap_SendServerCommand( -1, va("raceFinishTime %i %i", self->s.number, self->client->finishRaceTime) );
}

View file

@ -926,7 +926,7 @@ int QDECL SortRanks( const void *a, const void *b ) {
}
}
// sort by finish time if derby
else if (g_gametype.integer == GT_DERBY && g_gametype.integer == GT_LCS ){
else if (g_gametype.integer == GT_DERBY || g_gametype.integer == GT_LCS ){
if ( ca->finishRaceTime && cb->finishRaceTime ) {
if (ca->finishRaceTime < cb->finishRaceTime)
return 1;
@ -1705,7 +1705,7 @@ void CheckExitRules( void ) {
return;
}
if (g_gametype.integer == GT_LCS && level.startRaceTime && !level.finishRaceTime) {
gclient_t *winner = NULL;
@ -1730,31 +1730,6 @@ void CheckExitRules( void ) {
return;
}
if (g_gametype.integer == GT_LCS && level.startRaceTime && !level.finishRaceTime) {
gclient_t *winner = NULL;
for ( i=0, count = 0 ; i< g_maxclients.integer ; i++ ) {
cl = level.clients + i;
if ( cl->pers.connected != CON_CONNECTED ) continue;
if ( cl->sess.sessionTeam == TEAM_SPECTATOR ) continue;
if ( isRaceObserver( cl->ps.clientNum ) ) continue;
if ( cl->ps.stats[STAT_HEALTH] <= 0 ) continue;
count++;
winner = cl;
}
if (winner && count == 1) {
level.winnerNumber = winner->ps.clientNum;
level.finishRaceTime = level.time;
trap_SendServerCommand( -1, va("print \"%s won the last car standing!\n\"", winner->pers.netname ));
trap_SendServerCommand( level.winnerNumber, "cp \"You won the last car standing!\n\"");
}
return;
}
for ( i = 0, count = 0 ; i< g_maxclients.integer ; i++ ) {

View file

@ -436,7 +436,7 @@ void RallyStarter_Think( gentity_t *ent ){
Rally_Sound( ent, EV_GLOBAL_SOUND, CHAN_ANNOUNCER, G_SoundIndex("sound/rally/race/go.wav") );
if (g_gametype.integer != GT_DERBY || g_gametype.integer != GT_LCS)
if (g_gametype.integer != GT_DERBY && g_gametype.integer != GT_LCS)
ent->think = RallyRace_Think;
}
else if ( level.time > ent->pain_debounce_time + 4000 ){

View file

@ -200,7 +200,7 @@ static char* gamenames[] = {
"Race DM",
"SP ",
"Derby",
"LCS ",
"LCS",
"DM ",
"TRace",
"TRace DM",

View file

@ -148,7 +148,7 @@ static const char *gametype_items[] = {
// STONELANCE
// gametype_items[gametype_remap2[s_serveroptions.gametype]]
static int gametype_remap[] = {GT_RACING, GT_RACING_DM, GT_DERBY, GT_LCS, GT_DEATHMATCH, GT_TEAM, GT_TEAM_RACING, GT_TEAM_RACING_DM, GT_CTF, GT_DOMINATION};
static int gametype_remap2[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
static int gametype_remap2[] = {0, 1, 0, 2, 3, 4, 5, 6, 7, 8, 9};
int allowLength[3];
int reversable;
@ -2188,56 +2188,50 @@ if (s_serveroptions.gametype == GT_DOMINATION) {
}
}
// STONELANCE
if( s_serveroptions.gametype == GT_DERBY || s_serveroptions.gametype == GT_LCS ) {
// Your code here
}
// END
// STONELANCE
if( s_serveroptions.gametype == GT_CTF || s_serveroptions.gametype == GT_DOMINATION ) {
Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.flaglimit );
}
else if( s_serveroptions.gametype != GT_DERBY && s_serveroptions.gametype != GT_LCS ) {
Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.fraglimit );
}
// END
if( s_serveroptions.gametype != GT_CTF && s_serveroptions.gametype != GT_DOMINATION
&& s_serveroptions.gametype != GT_DERBY && s_serveroptions.gametype != GT_LCS ) {
Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.fraglimit );
}
else if( s_serveroptions.gametype == GT_CTF || s_serveroptions.gametype == GT_DOMINATION ) {
Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.flaglimit );
}
Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.timelimit );
Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.timelimit );
if( s_serveroptions.gametype >= GT_TEAM ) {
Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.friendlyfire );
}
if( s_serveroptions.gametype >= GT_TEAM ) {
Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.friendlyfire );
}
Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.pure );
Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.pure );
// STONELANCE
if( s_serveroptions.gametype == GT_RACING || s_serveroptions.gametype == GT_RACING_DM
|| s_serveroptions.gametype == GT_TEAM_RACING || s_serveroptions.gametype == GT_TEAM_RACING_DM) {
Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.trackLength );
// STONELANCE
if( s_serveroptions.gametype == GT_RACING || s_serveroptions.gametype == GT_RACING_DM
|| s_serveroptions.gametype == GT_TEAM_RACING || s_serveroptions.gametype == GT_TEAM_RACING_DM) {
Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.trackLength );
if ( reversable )
Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.reversed );
}
// END
if ( reversable )
Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.reversed );
}
// END
if( s_serveroptions.multiplayer ) {
Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.dedicated );
}
if( s_serveroptions.multiplayer ) {
Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.dedicated );
}
if( s_serveroptions.multiplayer ) {
Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.hostname );
}
if( s_serveroptions.multiplayer ) {
Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.hostname );
}
if (s_serveroptions.gametype == GT_DOMINATION) {
Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.dominationSpawnStyle );
Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.sigillocator );
}
if (s_serveroptions.gametype == GT_DOMINATION) {
Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.dominationSpawnStyle );
Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.sigillocator );
}
Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.back );
Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.go );
Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.back );
Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.go );
ServerOptions_SetMenuItems();
ServerOptions_SetMenuItems();
}
/*

View file

@ -97,15 +97,14 @@ static startserver_t s_startserver;
static const char *gametype_items[] = {
"Free For All",
"Team Deathmatch",
"Demolition Derby",
"Last Car Standing",
"Tournament",
"Capture the Flag",
0
};
// STONELANCE - removed gametype
// static int gametype_remap[] = {GT_FFA, GT_TEAM, GT_TOURNAMENT, GT_CTF};
static int gametype_remap[] = {GT_RACING, GT_TEAM, GT_DERBY, GT_LCS, GT_CTF};
static int gametype_remap[] = {GT_RACING, GT_TEAM, GT_DERBY, GT_CTF};
// END
static int gametype_remap2[] = {0, 2, 0, 1, 3};

View file

@ -210,11 +210,6 @@ void TeamMain_MenuInit( void ) {
case GT_RACING_DM:
case GT_DEATHMATCH:
case GT_DERBY:
s_teammain.joinred.generic.flags |= QMF_GRAYED;
s_teammain.joinblue.generic.flags |= QMF_GRAYED;
s_teammain.joingreen.generic.flags |= QMF_GRAYED;
s_teammain.joinyellow.generic.flags |= QMF_GRAYED;
break;
case GT_LCS:
s_teammain.joinred.generic.flags |= QMF_GRAYED;
s_teammain.joinblue.generic.flags |= QMF_GRAYED;