GTR_FRIENDLYFIRE, renamed GTR_HIDETIMEFROZEN, fixed other mistakes

This commit is contained in:
Jaime Passos 2019-12-18 20:12:52 -03:00
parent 04ee98a1a1
commit d0e18444fb
7 changed files with 22 additions and 21 deletions

View File

@ -2419,7 +2419,7 @@ static void Command_Teamchange_f(void)
} }
//additional check for hide and seek. Don't allow change of status after hidetime ends. //additional check for hide and seek. Don't allow change of status after hidetime ends.
if ((gametyperules & GTR_HIDETIMEFROZEN) && leveltime >= (hidetime * TICRATE)) if ((gametyperules & GTR_HIDEFROZEN) && leveltime >= (hidetime * TICRATE))
{ {
CONS_Alert(CONS_NOTICE, M_GetText("Hiding time expired; no Hide and Seek status changes allowed!\n")); CONS_Alert(CONS_NOTICE, M_GetText("Hiding time expired; no Hide and Seek status changes allowed!\n"));
return; return;
@ -2516,7 +2516,7 @@ static void Command_Teamchange2_f(void)
} }
//additional check for hide and seek. Don't allow change of status after hidetime ends. //additional check for hide and seek. Don't allow change of status after hidetime ends.
if ((gametyperules & GTR_HIDETIMEFROZEN) && leveltime >= (hidetime * TICRATE)) if ((gametyperules & GTR_HIDEFROZEN) && leveltime >= (hidetime * TICRATE))
{ {
CONS_Alert(CONS_NOTICE, M_GetText("Hiding time expired; no Hide and Seek status changes allowed!\n")); CONS_Alert(CONS_NOTICE, M_GetText("Hiding time expired; no Hide and Seek status changes allowed!\n"));
return; return;
@ -2645,7 +2645,7 @@ static void Command_ServerTeamChange_f(void)
} }
//additional check for hide and seek. Don't allow change of status after hidetime ends. //additional check for hide and seek. Don't allow change of status after hidetime ends.
if ((gametyperules & GTR_HIDETIMEFROZEN) && leveltime >= (hidetime * TICRATE)) if ((gametyperules & GTR_HIDEFROZEN) && leveltime >= (hidetime * TICRATE))
{ {
CONS_Alert(CONS_NOTICE, M_GetText("Hiding time expired; no Hide and Seek status changes allowed!\n")); CONS_Alert(CONS_NOTICE, M_GetText("Hiding time expired; no Hide and Seek status changes allowed!\n"));
return; return;
@ -2735,7 +2735,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
} }
//no status changes after hidetime //no status changes after hidetime
if ((gametyperules & GTR_HIDETIMEFROZEN) && (leveltime >= (hidetime * TICRATE))) if ((gametyperules & GTR_HIDEFROZEN) && (leveltime >= (hidetime * TICRATE)))
error = true; error = true;
//Make sure that the right team number is sent. Keep in mind that normal clients cannot change to certain teams in certain gametypes. //Make sure that the right team number is sent. Keep in mind that normal clients cannot change to certain teams in certain gametypes.

View File

@ -60,12 +60,9 @@ extern consvar_t cv_flagtime;
extern consvar_t cv_touchtag; extern consvar_t cv_touchtag;
extern consvar_t cv_hidetime; extern consvar_t cv_hidetime;
extern consvar_t cv_friendlyfire;
extern consvar_t cv_pointlimit; extern consvar_t cv_pointlimit;
extern consvar_t cv_timelimit; extern consvar_t cv_timelimit;
extern INT32 pointlimits[NUMGAMETYPES];
extern INT32 timelimits[NUMGAMETYPES];
extern consvar_t cv_friendlyfire;
extern consvar_t cv_numlaps; extern consvar_t cv_numlaps;
extern consvar_t cv_basenumlaps; extern consvar_t cv_basenumlaps;
extern UINT32 timelimitintics; extern UINT32 timelimitintics;

View File

@ -8900,9 +8900,9 @@ static const char *const GAMETYPERULE_LIST[] = {
"LIVES", "LIVES",
"RACE", "RACE",
"CHASECAM", "CHASECAM",
"\x01", // 1<<8, empty "FRIENDLYFIRE",
"HIDETIME", "HIDETIME",
"HIDETIMEFROZEN", "HIDEFROZEN",
"BLINDFOLDED", "BLINDFOLDED",
"EMERALDS", "EMERALDS",
"TEAMFLAGS", "TEAMFLAGS",

View File

@ -402,9 +402,9 @@ enum GameTypeRules
// flexibility! Those will replace some straight-up gametype checks scattered around the source code! // flexibility! Those will replace some straight-up gametype checks scattered around the source code!
GTR_CHASECAM = 1<<7, // Prefer chasecam at map load (All platform gametypes) GTR_CHASECAM = 1<<7, // Prefer chasecam at map load (All platform gametypes)
// 1<<8, empty GTR_FRIENDLYFIRE = 1<<8, // Always allow friendly fire
GTR_HIDETIME = 1<<9, // Tag and Hide and Seek GTR_HIDETIME = 1<<9, // Hide time (Tag and Hide and Seek)
GTR_HIDETIMEFROZEN = 1<<10, // Hide and Seek, but not Tag GTR_HIDEFROZEN = 1<<10, // Frozen after hide time (Hide and Seek, but not Tag)
GTR_BLINDFOLDED = 1<<11, // Blindfolded view (Tag and Hide and Seek) GTR_BLINDFOLDED = 1<<11, // Blindfolded view (Tag and Hide and Seek)
GTR_EMERALDS = 1<<12, // Ringslinger emeralds (Match and CTF) GTR_EMERALDS = 1<<12, // Ringslinger emeralds (Match and CTF)
GTR_TEAMFLAGS = 1<<13, // Gametype has team flags (CTF) GTR_TEAMFLAGS = 1<<13, // Gametype has team flags (CTF)
@ -425,6 +425,10 @@ enum GameTypeRules
extern const char *Gametype_Names[NUMGAMETYPES]; extern const char *Gametype_Names[NUMGAMETYPES];
extern const char *Gametype_ConstantNames[NUMGAMETYPES]; extern const char *Gametype_ConstantNames[NUMGAMETYPES];
// Point and time limits for every gametype
extern INT32 pointlimits[NUMGAMETYPES];
extern INT32 timelimits[NUMGAMETYPES];
enum TypeOfLevel enum TypeOfLevel
{ {
TOL_SP = 0x01, ///< Single Player TOL_SP = 0x01, ///< Single Player

View File

@ -3092,7 +3092,7 @@ UINT32 gametypedefaultrules[NUMGAMETYPES] =
// Tag // Tag
GTR_RINGSLINGER|GTR_TAG|GTR_SPECTATORS|GTR_POINTLIMIT|GTR_TIMELIMIT|GTR_HIDETIME|GTR_BLINDFOLDED|GTR_ROUNDENDMESSAGE, GTR_RINGSLINGER|GTR_TAG|GTR_SPECTATORS|GTR_POINTLIMIT|GTR_TIMELIMIT|GTR_HIDETIME|GTR_BLINDFOLDED|GTR_ROUNDENDMESSAGE,
// Hide and Seek // Hide and Seek
GTR_RINGSLINGER|GTR_TAG|GTR_SPECTATORS|GTR_POINTLIMIT||GTR_TIMELIMIT|GTR_HIDETIME|GTR_BLINDFOLDED|GTR_ROUNDENDMESSAGE, GTR_RINGSLINGER|GTR_TAG|GTR_SPECTATORS|GTR_POINTLIMIT|GTR_TIMELIMIT|GTR_HIDETIME|GTR_BLINDFOLDED|GTR_ROUNDENDMESSAGE,
// CTF // CTF
GTR_RINGSLINGER|GTR_TEAMS|GTR_SPECTATORS|GTR_POINTLIMIT|GTR_TIMELIMIT|GTR_EMERALDS|GTR_TEAMFLAGS|GTR_PITYSHIELD|GTR_ROUNDENDMESSAGE, GTR_RINGSLINGER|GTR_TEAMS|GTR_SPECTATORS|GTR_POINTLIMIT|GTR_TIMELIMIT|GTR_EMERALDS|GTR_TEAMFLAGS|GTR_PITYSHIELD|GTR_ROUNDENDMESSAGE,

View File

@ -3042,7 +3042,7 @@ static inline boolean P_TagDamage(mobj_t *target, mobj_t *inflictor, mobj_t *sou
return false; return false;
// Ignore IT players shooting each other, unless friendlyfire is on. // Ignore IT players shooting each other, unless friendlyfire is on.
if ((player->pflags & PF_TAGIT && !((cv_friendlyfire.value || (damagetype & DMG_CANHURTSELF)) && if ((player->pflags & PF_TAGIT && !((cv_friendlyfire.value || (gametyperules & GTR_FRIENDLYFIRE) || (damagetype & DMG_CANHURTSELF)) &&
source && source->player && source->player->pflags & PF_TAGIT))) source && source->player && source->player->pflags & PF_TAGIT)))
{ {
if (inflictor->type == MT_LHRT && !(player->powers[pw_shield] & SH_NOSTACK)) if (inflictor->type == MT_LHRT && !(player->powers[pw_shield] & SH_NOSTACK))
@ -3058,7 +3058,7 @@ static inline boolean P_TagDamage(mobj_t *target, mobj_t *inflictor, mobj_t *sou
// Don't allow players on the same team to hurt one another, // Don't allow players on the same team to hurt one another,
// unless cv_friendlyfire is on. // unless cv_friendlyfire is on.
if (!(cv_friendlyfire.value || (damagetype & DMG_CANHURTSELF)) && (player->pflags & PF_TAGIT) == (source->player->pflags & PF_TAGIT)) if (!(cv_friendlyfire.value || (gametyperules & GTR_FRIENDLYFIRE) || (damagetype & DMG_CANHURTSELF)) && (player->pflags & PF_TAGIT) == (source->player->pflags & PF_TAGIT))
{ {
if (inflictor->type == MT_LHRT && !(player->powers[pw_shield] & SH_NOSTACK)) if (inflictor->type == MT_LHRT && !(player->powers[pw_shield] & SH_NOSTACK))
{ {
@ -3143,7 +3143,7 @@ static inline boolean P_PlayerHitsPlayer(mobj_t *target, mobj_t *inflictor, mobj
return false; return false;
// In COOP/RACE, you can't hurt other players unless cv_friendlyfire is on // In COOP/RACE, you can't hurt other players unless cv_friendlyfire is on
if (!cv_friendlyfire.value && (G_PlatformGametype())) if (!(cv_friendlyfire.value || (gametyperules & GTR_FRIENDLYFIRE)) && (G_PlatformGametype()))
{ {
if (gametype == GT_COOP && inflictor->type == MT_LHRT && !(player->powers[pw_shield] & SH_NOSTACK)) // co-op only if (gametype == GT_COOP && inflictor->type == MT_LHRT && !(player->powers[pw_shield] & SH_NOSTACK)) // co-op only
{ {
@ -3166,7 +3166,7 @@ static inline boolean P_PlayerHitsPlayer(mobj_t *target, mobj_t *inflictor, mobj
{ {
// Don't allow players on the same team to hurt one another, // Don't allow players on the same team to hurt one another,
// unless cv_friendlyfire is on. // unless cv_friendlyfire is on.
if (!cv_friendlyfire.value && target->player->ctfteam == source->player->ctfteam) if (!(cv_friendlyfire.value || (gametyperules & GTR_FRIENDLYFIRE)) && target->player->ctfteam == source->player->ctfteam)
{ {
if (inflictor->type == MT_LHRT && !(player->powers[pw_shield] & SH_NOSTACK)) if (inflictor->type == MT_LHRT && !(player->powers[pw_shield] & SH_NOSTACK))
{ {
@ -3593,7 +3593,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
{ {
if (source == target) if (source == target)
return false; // Don't hit yourself with your own paraloop, baka return false; // Don't hit yourself with your own paraloop, baka
if (source && source->player && !cv_friendlyfire.value if (source && source->player && !(cv_friendlyfire.value || (gametyperules & GTR_FRIENDLYFIRE))
&& (gametype == GT_COOP && (gametype == GT_COOP
|| (G_GametypeHasTeams() && player->ctfteam == source->player->ctfteam))) || (G_GametypeHasTeams() && player->ctfteam == source->player->ctfteam)))
return false; // Don't run eachother over in special stages and team games and such return false; // Don't run eachother over in special stages and team games and such
@ -3688,7 +3688,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
// by friendly fire. Spilling their rings and other items is enough. // by friendly fire. Spilling their rings and other items is enough.
else if (!force && G_GametypeHasTeams() else if (!force && G_GametypeHasTeams()
&& source && source->player && (source->player->ctfteam == player->ctfteam) && source && source->player && (source->player->ctfteam == player->ctfteam)
&& cv_friendlyfire.value) && (cv_friendlyfire.value || (gametyperules & GTR_FRIENDLYFIRE)))
{ {
damage = 0; damage = 0;
P_ShieldDamage(player, inflictor, source, damage, damagetype); P_ShieldDamage(player, inflictor, source, damage, damagetype);

View File

@ -2298,7 +2298,7 @@ static void ST_drawTextHUD(void)
textHUDdraw(M_GetText("\x82""VIEWPOINT:""\x80 Switch view")) textHUDdraw(M_GetText("\x82""VIEWPOINT:""\x80 Switch view"))
donef12 = true; donef12 = true;
} }
if (gametyperules & GTR_HIDETIMEFROZEN) if (gametyperules & GTR_HIDEFROZEN)
textHUDdraw(M_GetText("You cannot move while hiding.")) textHUDdraw(M_GetText("You cannot move while hiding."))
} }
} }