Preparing for the inevitable gametype rule that will handle cooplives...
This commit is contained in:
parent
ed29efd9eb
commit
1f96f70173
|
@ -3800,7 +3800,7 @@ static void CoopLives_OnChange(void)
|
||||||
{
|
{
|
||||||
INT32 i;
|
INT32 i;
|
||||||
|
|
||||||
if (!(netgame || multiplayer) || gametype != GT_COOP)
|
if (!(netgame || multiplayer) || !G_GametypeUsesCoopLives())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch (cv_cooplives.value)
|
switch (cv_cooplives.value)
|
||||||
|
|
14
src/g_game.c
14
src/g_game.c
|
@ -3439,6 +3439,20 @@ boolean G_GametypeUsesLives(void)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// G_GametypeUsesCoopLives
|
||||||
|
//
|
||||||
|
// Returns true if the current gametype uses
|
||||||
|
// the cooplives CVAR. False otherwise.
|
||||||
|
//
|
||||||
|
boolean G_GametypeUsesCoopLives(void)
|
||||||
|
{
|
||||||
|
// Preparing for the inevitable
|
||||||
|
// gametype rule that will
|
||||||
|
// handle cooplives...
|
||||||
|
return (gametype == GT_COOP);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// G_GametypeHasTeams
|
// G_GametypeHasTeams
|
||||||
//
|
//
|
||||||
|
|
|
@ -218,6 +218,7 @@ void G_SetGametypeDescription(INT16 gtype, char *descriptiontext, UINT8 leftcolo
|
||||||
INT32 G_GetGametypeByName(const char *gametypestr);
|
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_GametypeHasTeams(void);
|
boolean G_GametypeHasTeams(void);
|
||||||
boolean G_GametypeHasSpectators(void);
|
boolean G_GametypeHasSpectators(void);
|
||||||
boolean G_RingSlingerGametype(void);
|
boolean G_RingSlingerGametype(void);
|
||||||
|
|
|
@ -2434,7 +2434,7 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (G_GametypeUsesLives() && !(gametyperankings[gametype] == GT_COOP && (cv_cooplives.value == 0 || cv_cooplives.value == 3)) && (players[tab[i].num].lives != INFLIVES)) //show lives
|
if (G_GametypeUsesLives() && !(G_GametypeUsesCoopLives() && (cv_cooplives.value == 0 || cv_cooplives.value == 3)) && (players[tab[i].num].lives != INFLIVES)) //show lives
|
||||||
V_DrawRightAlignedString(x, y+4, V_ALLOWLOWERCASE|(greycheck ? V_60TRANS : 0), va("%dx", players[tab[i].num].lives));
|
V_DrawRightAlignedString(x, y+4, V_ALLOWLOWERCASE|(greycheck ? V_60TRANS : 0), va("%dx", players[tab[i].num].lives));
|
||||||
else if (G_TagGametype() && players[tab[i].num].pflags & PF_TAGIT)
|
else if (G_TagGametype() && players[tab[i].num].pflags & PF_TAGIT)
|
||||||
{
|
{
|
||||||
|
@ -2743,7 +2743,7 @@ void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scoreline
|
||||||
| (greycheck ? V_TRANSLUCENT : 0)
|
| (greycheck ? V_TRANSLUCENT : 0)
|
||||||
| V_ALLOWLOWERCASE, name);
|
| V_ALLOWLOWERCASE, name);
|
||||||
|
|
||||||
if (G_GametypeUsesLives() && !(gametyperankings[gametype] == GT_COOP && (cv_cooplives.value == 0 || cv_cooplives.value == 3)) && (players[tab[i].num].lives != INFLIVES)) //show lives
|
if (G_GametypeUsesLives() && !(G_GametypeUsesCoopLives() && (cv_cooplives.value == 0 || cv_cooplives.value == 3)) && (players[tab[i].num].lives != INFLIVES)) //show lives
|
||||||
V_DrawRightAlignedString(x, y+4, V_ALLOWLOWERCASE, va("%dx", players[tab[i].num].lives));
|
V_DrawRightAlignedString(x, y+4, V_ALLOWLOWERCASE, va("%dx", players[tab[i].num].lives));
|
||||||
else if (G_TagGametype() && players[tab[i].num].pflags & PF_TAGIT)
|
else if (G_TagGametype() && players[tab[i].num].pflags & PF_TAGIT)
|
||||||
V_DrawSmallScaledPatch(x-28, y-4, 0, tagico);
|
V_DrawSmallScaledPatch(x-28, y-4, 0, tagico);
|
||||||
|
|
|
@ -2854,6 +2854,14 @@ static int lib_gGametypeUsesLives(lua_State *L)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int lib_gGametypeUsesCoopLives(lua_State *L)
|
||||||
|
{
|
||||||
|
//HUDSAFE
|
||||||
|
INLEVEL
|
||||||
|
lua_pushboolean(L, G_GametypeUsesCoopLives());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static int lib_gGametypeHasTeams(lua_State *L)
|
static int lib_gGametypeHasTeams(lua_State *L)
|
||||||
{
|
{
|
||||||
//HUDSAFE
|
//HUDSAFE
|
||||||
|
@ -2894,6 +2902,14 @@ static int lib_gTagGametype(lua_State *L)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int lib_gCompetitionGametype(lua_State *L)
|
||||||
|
{
|
||||||
|
//HUDSAFE
|
||||||
|
INLEVEL
|
||||||
|
lua_pushboolean(L, G_CompetitionGametype());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static int lib_gTicsToHours(lua_State *L)
|
static int lib_gTicsToHours(lua_State *L)
|
||||||
{
|
{
|
||||||
tic_t rtic = luaL_checkinteger(L, 1);
|
tic_t rtic = luaL_checkinteger(L, 1);
|
||||||
|
@ -3139,11 +3155,13 @@ static luaL_Reg lib[] = {
|
||||||
{"G_ExitLevel",lib_gExitLevel},
|
{"G_ExitLevel",lib_gExitLevel},
|
||||||
{"G_IsSpecialStage",lib_gIsSpecialStage},
|
{"G_IsSpecialStage",lib_gIsSpecialStage},
|
||||||
{"G_GametypeUsesLives",lib_gGametypeUsesLives},
|
{"G_GametypeUsesLives",lib_gGametypeUsesLives},
|
||||||
|
{"G_GametypeUsesCoopLives",lib_gGametypeUsesCoopLives},
|
||||||
{"G_GametypeHasTeams",lib_gGametypeHasTeams},
|
{"G_GametypeHasTeams",lib_gGametypeHasTeams},
|
||||||
{"G_GametypeHasSpectators",lib_gGametypeHasSpectators},
|
{"G_GametypeHasSpectators",lib_gGametypeHasSpectators},
|
||||||
{"G_RingSlingerGametype",lib_gRingSlingerGametype},
|
{"G_RingSlingerGametype",lib_gRingSlingerGametype},
|
||||||
{"G_PlatformGametype",lib_gPlatformGametype},
|
{"G_PlatformGametype",lib_gPlatformGametype},
|
||||||
{"G_TagGametype",lib_gTagGametype},
|
{"G_TagGametype",lib_gTagGametype},
|
||||||
|
{"G_CompetitionGametype",lib_gCompetitionGametype},
|
||||||
{"G_TicsToHours",lib_gTicsToHours},
|
{"G_TicsToHours",lib_gTicsToHours},
|
||||||
{"G_TicsToMinutes",lib_gTicsToMinutes},
|
{"G_TicsToMinutes",lib_gTicsToMinutes},
|
||||||
{"G_TicsToSeconds",lib_gTicsToSeconds},
|
{"G_TicsToSeconds",lib_gTicsToSeconds},
|
||||||
|
|
|
@ -2523,7 +2523,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
|
||||||
target->colorized = false;
|
target->colorized = false;
|
||||||
G_GhostAddColor(GHC_NORMAL);
|
G_GhostAddColor(GHC_NORMAL);
|
||||||
|
|
||||||
if ((target->player->lives <= 1) && (netgame || multiplayer) && (gametype == GT_COOP) && (cv_cooplives.value == 0))
|
if ((target->player->lives <= 1) && (netgame || multiplayer) && G_GametypeUsesCoopLives() && (cv_cooplives.value == 0))
|
||||||
;
|
;
|
||||||
else if (!target->player->bot && !target->player->spectator && (target->player->lives != INFLIVES)
|
else if (!target->player->bot && !target->player->spectator && (target->player->lives != INFLIVES)
|
||||||
&& G_GametypeUsesLives())
|
&& G_GametypeUsesLives())
|
||||||
|
@ -2533,7 +2533,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
|
||||||
if (target->player->lives <= 0) // Tails 03-14-2000
|
if (target->player->lives <= 0) // Tails 03-14-2000
|
||||||
{
|
{
|
||||||
boolean gameovermus = false;
|
boolean gameovermus = false;
|
||||||
if ((netgame || multiplayer) && (gametype == GT_COOP) && (cv_cooplives.value != 1))
|
if ((netgame || multiplayer) && G_GametypeUsesCoopLives() && (cv_cooplives.value != 1))
|
||||||
{
|
{
|
||||||
INT32 i;
|
INT32 i;
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
|
|
|
@ -1236,7 +1236,7 @@ void P_GivePlayerLives(player_t *player, INT32 numlives)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((netgame || multiplayer) && gametype == GT_COOP && cv_cooplives.value == 0)
|
if ((netgame || multiplayer) && G_GametypeUsesCoopLives() && cv_cooplives.value == 0)
|
||||||
{
|
{
|
||||||
P_GivePlayerRings(player, 100*numlives);
|
P_GivePlayerRings(player, 100*numlives);
|
||||||
if (player->lives - prevlives >= numlives)
|
if (player->lives - prevlives >= numlives)
|
||||||
|
@ -1267,7 +1267,7 @@ docooprespawn:
|
||||||
|
|
||||||
void P_GiveCoopLives(player_t *player, INT32 numlives, boolean sound)
|
void P_GiveCoopLives(player_t *player, INT32 numlives, boolean sound)
|
||||||
{
|
{
|
||||||
if (!((netgame || multiplayer) && gametype == GT_COOP))
|
if (!((netgame || multiplayer) && G_GametypeUsesCoopLives()))
|
||||||
{
|
{
|
||||||
P_GivePlayerLives(player, numlives);
|
P_GivePlayerLives(player, numlives);
|
||||||
if (sound)
|
if (sound)
|
||||||
|
@ -9298,7 +9298,7 @@ boolean P_GetLives(player_t *player)
|
||||||
{
|
{
|
||||||
INT32 i, maxlivesplayer = -1, livescheck = 1;
|
INT32 i, maxlivesplayer = -1, livescheck = 1;
|
||||||
if (!(netgame || multiplayer)
|
if (!(netgame || multiplayer)
|
||||||
|| (gametype != GT_COOP)
|
|| !G_GametypeUsesCoopLives()
|
||||||
|| (player->lives == INFLIVES))
|
|| (player->lives == INFLIVES))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
|
@ -887,7 +887,7 @@ static void ST_drawLivesArea(void)
|
||||||
if (G_GametypeUsesLives())
|
if (G_GametypeUsesLives())
|
||||||
{
|
{
|
||||||
// Handle cooplives here
|
// Handle cooplives here
|
||||||
if ((netgame || multiplayer) && gametype == GT_COOP && cv_cooplives.value == 3)
|
if ((netgame || multiplayer) && G_GametypeUsesCoopLives() && cv_cooplives.value == 3)
|
||||||
{
|
{
|
||||||
INT32 i;
|
INT32 i;
|
||||||
livescount = 0;
|
livescount = 0;
|
||||||
|
@ -914,7 +914,7 @@ static void ST_drawLivesArea(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
livescount = (((netgame || multiplayer) && gametype == GT_COOP && cv_cooplives.value == 0) ? INFLIVES : stplyr->lives);
|
livescount = (((netgame || multiplayer) && G_GametypeUsesCoopLives() && cv_cooplives.value == 0) ? INFLIVES : stplyr->lives);
|
||||||
notgreyedout = true;
|
notgreyedout = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2246,7 +2246,7 @@ static void ST_drawTextHUD(void)
|
||||||
textHUDdraw(M_GetText("\x82""Wait for the stage to end..."))
|
textHUDdraw(M_GetText("\x82""Wait for the stage to end..."))
|
||||||
else if (G_PlatformGametype())
|
else if (G_PlatformGametype())
|
||||||
{
|
{
|
||||||
if (gametype == GT_COOP)
|
if (G_GametypeUsesCoopLives())
|
||||||
{
|
{
|
||||||
if (stplyr->lives <= 0
|
if (stplyr->lives <= 0
|
||||||
&& cv_cooplives.value == 2
|
&& cv_cooplives.value == 2
|
||||||
|
@ -2657,7 +2657,7 @@ static void ST_overlayDrawer(void)
|
||||||
INT32 i = MAXPLAYERS;
|
INT32 i = MAXPLAYERS;
|
||||||
INT32 deadtimer = stplyr->spectator ? TICRATE : (stplyr->deadtimer-(TICRATE<<1));
|
INT32 deadtimer = stplyr->spectator ? TICRATE : (stplyr->deadtimer-(TICRATE<<1));
|
||||||
|
|
||||||
if ((gametype == GT_COOP)
|
if (G_GametypeUsesCoopLives()
|
||||||
&& (netgame || multiplayer)
|
&& (netgame || multiplayer)
|
||||||
&& (cv_cooplives.value != 1))
|
&& (cv_cooplives.value != 1))
|
||||||
{
|
{
|
||||||
|
|
|
@ -1977,7 +1977,7 @@ static void Y_AwardCoopBonuses(void)
|
||||||
|
|
||||||
if (i == consoleplayer)
|
if (i == consoleplayer)
|
||||||
{
|
{
|
||||||
data.coop.gotlife = (((netgame || multiplayer) && gametype == GT_COOP && cv_cooplives.value == 0) ? 0 : ptlives);
|
data.coop.gotlife = (((netgame || multiplayer) && G_GametypeUsesCoopLives() && cv_cooplives.value == 0) ? 0 : ptlives);
|
||||||
M_Memcpy(&data.coop.bonuses, &localbonuses, sizeof(data.coop.bonuses));
|
M_Memcpy(&data.coop.bonuses, &localbonuses, sizeof(data.coop.bonuses));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2032,7 +2032,7 @@ static void Y_AwardSpecialStageBonus(void)
|
||||||
|
|
||||||
if (i == consoleplayer)
|
if (i == consoleplayer)
|
||||||
{
|
{
|
||||||
data.spec.gotlife = (((netgame || multiplayer) && gametype == GT_COOP && cv_cooplives.value == 0) ? 0 : ptlives);
|
data.spec.gotlife = (((netgame || multiplayer) && G_GametypeUsesCoopLives() && cv_cooplives.value == 0) ? 0 : ptlives);
|
||||||
M_Memcpy(&data.spec.bonuses, &localbonuses, sizeof(data.spec.bonuses));
|
M_Memcpy(&data.spec.bonuses, &localbonuses, sizeof(data.spec.bonuses));
|
||||||
|
|
||||||
// Continues related
|
// Continues related
|
||||||
|
|
Loading…
Reference in New Issue