Same deal, but for starposts.
This commit is contained in:
parent
1f96f70173
commit
3b341245f1
24
src/g_game.c
24
src/g_game.c
|
@ -2890,11 +2890,11 @@ void G_DoReborn(INT32 playernum)
|
||||||
|
|
||||||
if (countdowntimeup || (!(netgame || multiplayer) && gametype == GT_COOP))
|
if (countdowntimeup || (!(netgame || multiplayer) && gametype == GT_COOP))
|
||||||
resetlevel = true;
|
resetlevel = true;
|
||||||
else if (gametype == GT_COOP && (netgame || multiplayer) && !G_IsSpecialStage(gamemap))
|
else if ((G_GametypeUsesCoopLives() || G_GametypeUsesCoopStarposts()) && (netgame || multiplayer) && !G_IsSpecialStage(gamemap))
|
||||||
{
|
{
|
||||||
boolean notgameover = true;
|
boolean notgameover = true;
|
||||||
|
|
||||||
if (cv_cooplives.value != 0 && player->lives <= 0) // consider game over first
|
if (G_GametypeUsesCoopLives() && (cv_cooplives.value != 0 && player->lives <= 0)) // consider game over first
|
||||||
{
|
{
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
{
|
{
|
||||||
|
@ -2929,7 +2929,7 @@ void G_DoReborn(INT32 playernum)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (notgameover && cv_coopstarposts.value == 2)
|
if (G_GametypeUsesCoopStarposts() && (notgameover && cv_coopstarposts.value == 2))
|
||||||
{
|
{
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
{
|
{
|
||||||
|
@ -3005,7 +3005,7 @@ void G_DoReborn(INT32 playernum)
|
||||||
}
|
}
|
||||||
|
|
||||||
// restore time in netgame (see also p_setup.c)
|
// restore time in netgame (see also p_setup.c)
|
||||||
if ((netgame || multiplayer) && gametype == GT_COOP && cv_coopstarposts.value == 2)
|
if ((netgame || multiplayer) && G_GametypeUsesCoopStarposts() && cv_coopstarposts.value == 2)
|
||||||
{
|
{
|
||||||
// is this a hack? maybe
|
// is this a hack? maybe
|
||||||
tic_t maxstarposttime = 0;
|
tic_t maxstarposttime = 0;
|
||||||
|
@ -3076,7 +3076,7 @@ void G_AddPlayer(INT32 playernum)
|
||||||
if (!players[i].exiting)
|
if (!players[i].exiting)
|
||||||
notexiting++;
|
notexiting++;
|
||||||
|
|
||||||
if (!(cv_coopstarposts.value && (gametype == GT_COOP) && (p->starpostnum < players[i].starpostnum)))
|
if (!(cv_coopstarposts.value && G_GametypeUsesCoopStarposts() && (p->starpostnum < players[i].starpostnum)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
p->starpostscale = players[i].starpostscale;
|
p->starpostscale = players[i].starpostscale;
|
||||||
|
@ -3453,6 +3453,20 @@ boolean G_GametypeUsesCoopLives(void)
|
||||||
return (gametype == GT_COOP);
|
return (gametype == GT_COOP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// G_GametypeUsesCoopStarposts
|
||||||
|
//
|
||||||
|
// Returns true if the current gametype uses
|
||||||
|
// the coopstarposts CVAR. False otherwise.
|
||||||
|
//
|
||||||
|
boolean G_GametypeUsesCoopStarposts(void)
|
||||||
|
{
|
||||||
|
// Preparing for the inevitable
|
||||||
|
// gametype rule that will
|
||||||
|
// handle coopstarposts...
|
||||||
|
return (gametype == GT_COOP);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// G_GametypeHasTeams
|
// G_GametypeHasTeams
|
||||||
//
|
//
|
||||||
|
|
|
@ -219,6 +219,7 @@ INT32 G_GetGametypeByName(const char *gametypestr);
|
||||||
boolean G_IsSpecialStage(INT32 mapnum);
|
boolean G_IsSpecialStage(INT32 mapnum);
|
||||||
boolean G_GametypeUsesLives(void);
|
boolean G_GametypeUsesLives(void);
|
||||||
boolean G_GametypeUsesCoopLives(void);
|
boolean G_GametypeUsesCoopLives(void);
|
||||||
|
boolean G_GametypeUsesCoopStarposts(void);
|
||||||
boolean G_GametypeHasTeams(void);
|
boolean G_GametypeHasTeams(void);
|
||||||
boolean G_GametypeHasSpectators(void);
|
boolean G_GametypeHasSpectators(void);
|
||||||
boolean G_RingSlingerGametype(void);
|
boolean G_RingSlingerGametype(void);
|
||||||
|
|
|
@ -2862,6 +2862,14 @@ static int lib_gGametypeUsesCoopLives(lua_State *L)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int lib_gGametypeUsesCoopStarposts(lua_State *L)
|
||||||
|
{
|
||||||
|
//HUDSAFE
|
||||||
|
INLEVEL
|
||||||
|
lua_pushboolean(L, G_GametypeUsesCoopStarposts());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static int lib_gGametypeHasTeams(lua_State *L)
|
static int lib_gGametypeHasTeams(lua_State *L)
|
||||||
{
|
{
|
||||||
//HUDSAFE
|
//HUDSAFE
|
||||||
|
@ -3156,6 +3164,7 @@ static luaL_Reg lib[] = {
|
||||||
{"G_IsSpecialStage",lib_gIsSpecialStage},
|
{"G_IsSpecialStage",lib_gIsSpecialStage},
|
||||||
{"G_GametypeUsesLives",lib_gGametypeUsesLives},
|
{"G_GametypeUsesLives",lib_gGametypeUsesLives},
|
||||||
{"G_GametypeUsesCoopLives",lib_gGametypeUsesCoopLives},
|
{"G_GametypeUsesCoopLives",lib_gGametypeUsesCoopLives},
|
||||||
|
{"G_GametypeUsesCoopStarposts",lib_gGametypeUsesCoopStarposts},
|
||||||
{"G_GametypeHasTeams",lib_gGametypeHasTeams},
|
{"G_GametypeHasTeams",lib_gGametypeHasTeams},
|
||||||
{"G_GametypeHasSpectators",lib_gGametypeHasSpectators},
|
{"G_GametypeHasSpectators",lib_gGametypeHasSpectators},
|
||||||
{"G_RingSlingerGametype",lib_gRingSlingerGametype},
|
{"G_RingSlingerGametype",lib_gRingSlingerGametype},
|
||||||
|
|
|
@ -1451,7 +1451,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||||
if (player->starpostnum >= special->health)
|
if (player->starpostnum >= special->health)
|
||||||
return; // Already hit this post
|
return; // Already hit this post
|
||||||
|
|
||||||
if (cv_coopstarposts.value && gametype == GT_COOP && (netgame || multiplayer))
|
if (cv_coopstarposts.value && G_GametypeUsesCoopStarposts() && (netgame || multiplayer))
|
||||||
{
|
{
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2141,7 +2141,7 @@ static void P_LevelInitStuff(void)
|
||||||
// earthquake camera
|
// earthquake camera
|
||||||
memset(&quake,0,sizeof(struct quake));
|
memset(&quake,0,sizeof(struct quake));
|
||||||
|
|
||||||
if ((netgame || multiplayer) && gametype == GT_COOP && cv_coopstarposts.value == 2)
|
if ((netgame || multiplayer) && G_GametypeUsesCoopStarposts() && cv_coopstarposts.value == 2)
|
||||||
{
|
{
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
{
|
{
|
||||||
|
@ -2848,7 +2848,7 @@ boolean P_SetupLevel(boolean skipprecip)
|
||||||
}
|
}
|
||||||
|
|
||||||
// restore time in netgame (see also g_game.c)
|
// restore time in netgame (see also g_game.c)
|
||||||
if ((netgame || multiplayer) && gametype == GT_COOP && cv_coopstarposts.value == 2)
|
if ((netgame || multiplayer) && G_GametypeUsesCoopStarposts() && cv_coopstarposts.value == 2)
|
||||||
{
|
{
|
||||||
// is this a hack? maybe
|
// is this a hack? maybe
|
||||||
tic_t maxstarposttime = 0;
|
tic_t maxstarposttime = 0;
|
||||||
|
|
|
@ -9447,7 +9447,7 @@ static void P_DeathThink(player_t *player)
|
||||||
player->playerstate = PST_REBORN;
|
player->playerstate = PST_REBORN;
|
||||||
else if ((player->lives > 0 || j != MAXPLAYERS) && !(!(netgame || multiplayer) && G_IsSpecialStage(gamemap))) // Don't allow "click to respawn" in special stages!
|
else if ((player->lives > 0 || j != MAXPLAYERS) && !(!(netgame || multiplayer) && G_IsSpecialStage(gamemap))) // Don't allow "click to respawn" in special stages!
|
||||||
{
|
{
|
||||||
if (gametype == GT_COOP && (netgame || multiplayer) && cv_coopstarposts.value == 2)
|
if (G_GametypeUsesCoopStarposts() && (netgame || multiplayer) && cv_coopstarposts.value == 2)
|
||||||
{
|
{
|
||||||
P_ConsiderAllGone();
|
P_ConsiderAllGone();
|
||||||
if ((player->deadtimer > TICRATE<<1) || ((cmd->buttons & BT_JUMP) && (player->deadtimer > TICRATE)))
|
if ((player->deadtimer > TICRATE<<1) || ((cmd->buttons & BT_JUMP) && (player->deadtimer > TICRATE)))
|
||||||
|
@ -11537,7 +11537,7 @@ void P_PlayerThink(player_t *player)
|
||||||
#else
|
#else
|
||||||
if (player->spectator &&
|
if (player->spectator &&
|
||||||
#endif
|
#endif
|
||||||
gametype == GT_COOP && (netgame || multiplayer) && cv_coopstarposts.value == 2)
|
G_GametypeUsesCoopStarposts() && (netgame || multiplayer) && cv_coopstarposts.value == 2)
|
||||||
P_ConsiderAllGone();
|
P_ConsiderAllGone();
|
||||||
|
|
||||||
if (player->playerstate == PST_DEAD)
|
if (player->playerstate == PST_DEAD)
|
||||||
|
|
Loading…
Reference in a new issue