Merge branch 'Saturn-Next' into Saturn-Testing
This commit is contained in:
commit
dfe151ccb1
29 files changed
+2005
-195
No files matched your search
+49
-14
@@ -132,20 +132,55 @@ void B_BuildTiccmd(player_t *player, ticcmd_t *cmd)
|
||||
|
||||
void B_KeysToTiccmd(mobj_t *mo, ticcmd_t *cmd, boolean forward, boolean backward, boolean left, boolean right, boolean strafeleft, boolean straferight, boolean jump, boolean spin)
|
||||
{
|
||||
(void)mo;
|
||||
|
||||
if (forward)
|
||||
cmd->forwardmove += MAXPLMOVE<<FRACBITS>>16;
|
||||
if (backward)
|
||||
cmd->forwardmove -= MAXPLMOVE<<FRACBITS>>16;
|
||||
if (left)
|
||||
cmd->angleturn += 1280;
|
||||
if (right)
|
||||
cmd->angleturn -= 1280;
|
||||
if (strafeleft)
|
||||
cmd->sidemove -= MAXPLMOVE<<FRACBITS>>16;
|
||||
if (straferight)
|
||||
cmd->sidemove += MAXPLMOVE<<FRACBITS>>16;
|
||||
// Turn the virtual keypresses into ticcmd_t.
|
||||
if (twodlevel || mo->flags2 & MF2_TWOD) {
|
||||
if (players[consoleplayer].climbing
|
||||
|| mo->player->pflags & PF_GLIDING) {
|
||||
// Don't mess with bot inputs during these unhandled movement conditions.
|
||||
// The normal AI doesn't use abilities, so custom AI should be sending us exactly what it wants anyway.
|
||||
if (forward)
|
||||
cmd->forwardmove += MAXPLMOVE<<FRACBITS>>16;
|
||||
if (backward)
|
||||
cmd->forwardmove -= MAXPLMOVE<<FRACBITS>>16;
|
||||
if (left || strafeleft)
|
||||
cmd->sidemove -= MAXPLMOVE<<FRACBITS>>16;
|
||||
if (right || straferight)
|
||||
cmd->sidemove += MAXPLMOVE<<FRACBITS>>16;
|
||||
} else {
|
||||
// In standard 2D mode, interpret "forward" as "the way you're facing" and everything else as "the way you're not facing"
|
||||
if (left || right)
|
||||
backward = true;
|
||||
left = right = false;
|
||||
if (forward) {
|
||||
if (mo->angle < ANGLE_90 || mo->angle > ANGLE_270)
|
||||
right = true;
|
||||
else
|
||||
left = true;
|
||||
} else if (backward) {
|
||||
if (mo->angle < ANGLE_90 || mo->angle > ANGLE_270)
|
||||
left = true;
|
||||
else
|
||||
right = true;
|
||||
}
|
||||
if (left || strafeleft)
|
||||
cmd->sidemove -= MAXPLMOVE<<FRACBITS>>16;
|
||||
if (right || straferight)
|
||||
cmd->sidemove += MAXPLMOVE<<FRACBITS>>16;
|
||||
}
|
||||
} else {
|
||||
if (forward)
|
||||
cmd->forwardmove += MAXPLMOVE<<FRACBITS>>16;
|
||||
if (backward)
|
||||
cmd->forwardmove -= MAXPLMOVE<<FRACBITS>>16;
|
||||
if (left)
|
||||
cmd->angleturn += 1280;
|
||||
if (right)
|
||||
cmd->angleturn -= 1280;
|
||||
if (strafeleft)
|
||||
cmd->sidemove -= MAXPLMOVE<<FRACBITS>>16;
|
||||
if (straferight)
|
||||
cmd->sidemove += MAXPLMOVE<<FRACBITS>>16;
|
||||
}
|
||||
if (jump)
|
||||
cmd->buttons |= BT_DRIFT;
|
||||
if (spin)
|
||||
|
||||
+125
-3
@@ -846,6 +846,110 @@ static void resynch_read_player(resynch_pak *rsp)
|
||||
P_SetThingPosition(players[i].mo);
|
||||
}
|
||||
|
||||
static inline void resynch_write_ctf(resynchend_pak *rst)
|
||||
{
|
||||
mobj_t *mflag;
|
||||
UINT8 i, j;
|
||||
|
||||
for (i = 0, mflag = redflag; i < 2; ++i, mflag = blueflag)
|
||||
{
|
||||
rst->flagx[i] = rst->flagy[i] = rst->flagz[i] = 0;
|
||||
rst->flagloose[i] = rst->flagflags[i] = 0;
|
||||
rst->flagplayer[i] = -1;
|
||||
|
||||
if (!mflag)
|
||||
{
|
||||
// Should be held by a player
|
||||
for (j = 0; j < MAXPLAYERS; ++j)
|
||||
{
|
||||
// GF_REDFLAG is 1, GF_BLUEFLAG is 2
|
||||
// redflag handling is i=0, blueflag is i=1
|
||||
// so check for gotflag == (i+1)
|
||||
if (!playeringame[j] || players[j].gotflag != (i+1))
|
||||
continue;
|
||||
rst->flagplayer[i] = (SINT8)j;
|
||||
break;
|
||||
}
|
||||
if (j == MAXPLAYERS) // fine, no I_Error
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "One of the flags has gone completely missing...\n");
|
||||
rst->flagplayer[i] = -2;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
rst->flagx[i] = (fixed_t)LONG(mflag->x);
|
||||
rst->flagy[i] = (fixed_t)LONG(mflag->y);
|
||||
rst->flagz[i] = (fixed_t)LONG(mflag->z);
|
||||
rst->flagflags[i] = LONG(mflag->flags2);
|
||||
rst->flagloose[i] = LONG(mflag->fuse); // Dropped or not?
|
||||
}
|
||||
}
|
||||
|
||||
static inline void resynch_read_ctf(resynchend_pak *p)
|
||||
{
|
||||
UINT8 i;
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; ++i)
|
||||
players[i].gotflag = 0;
|
||||
|
||||
// Red flag
|
||||
if (p->flagplayer[0] == -2)
|
||||
; // The server doesn't even know what happened to it...
|
||||
else if (p->flagplayer[0] != -1) // Held by a player
|
||||
{
|
||||
if (!playeringame[p->flagplayer[0]])
|
||||
I_Error("Invalid red flag player %d who isn't in the game!", (INT32)p->flagplayer[0]);
|
||||
players[p->flagplayer[0]].gotflag = GF_REDFLAG;
|
||||
if (redflag)
|
||||
{
|
||||
P_RemoveMobj(redflag);
|
||||
redflag = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!redflag)
|
||||
redflag = P_SpawnMobj(0,0,0,MT_REDFLAG);
|
||||
|
||||
P_UnsetThingPosition(redflag);
|
||||
redflag->x = (fixed_t)LONG(p->flagx[0]);
|
||||
redflag->y = (fixed_t)LONG(p->flagy[0]);
|
||||
redflag->z = (fixed_t)LONG(p->flagz[0]);
|
||||
redflag->flags2 = LONG(p->flagflags[0]);
|
||||
redflag->fuse = LONG(p->flagloose[0]);
|
||||
P_SetThingPosition(redflag);
|
||||
}
|
||||
|
||||
// Blue flag
|
||||
if (p->flagplayer[1] == -2)
|
||||
; // The server doesn't even know what happened to it...
|
||||
else if (p->flagplayer[1] != -1) // Held by a player
|
||||
{
|
||||
if (!playeringame[p->flagplayer[1]])
|
||||
I_Error("Invalid blue flag player %d who isn't in the game!", (INT32)p->flagplayer[1]);
|
||||
players[p->flagplayer[1]].gotflag = GF_BLUEFLAG;
|
||||
if (blueflag)
|
||||
{
|
||||
P_RemoveMobj(blueflag);
|
||||
blueflag = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!blueflag)
|
||||
blueflag = P_SpawnMobj(0,0,0,MT_BLUEFLAG);
|
||||
|
||||
P_UnsetThingPosition(blueflag);
|
||||
blueflag->x = (fixed_t)LONG(p->flagx[1]);
|
||||
blueflag->y = (fixed_t)LONG(p->flagy[1]);
|
||||
blueflag->z = (fixed_t)LONG(p->flagz[1]);
|
||||
blueflag->flags2 = LONG(p->flagflags[1]);
|
||||
blueflag->fuse = LONG(p->flagloose[1]);
|
||||
P_SetThingPosition(blueflag);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void resynch_write_others(resynchend_pak *rst)
|
||||
{
|
||||
UINT8 i;
|
||||
@@ -946,6 +1050,8 @@ static void SV_SendResynch(INT32 node)
|
||||
netbuffer->packettype = PT_RESYNCHEND;
|
||||
|
||||
netbuffer->u.resynchend.randomseed = P_GetRandSeed();
|
||||
if (gametype == GT_CTF)
|
||||
resynch_write_ctf(&netbuffer->u.resynchend);
|
||||
resynch_write_others(&netbuffer->u.resynchend);
|
||||
|
||||
HSendPacket(node, true, 0, (sizeof(resynchend_pak)));
|
||||
@@ -1552,10 +1658,20 @@ static void SV_SendPlayerInfo(INT32 node)
|
||||
//No, don't do that, you fuckface.
|
||||
memset(netbuffer->u.playerinfo[i].address, 0, 4);
|
||||
|
||||
if (players[i].spectator)
|
||||
netbuffer->u.playerinfo[i].team = 255;
|
||||
if (G_GametypeHasTeams())
|
||||
{
|
||||
if (!players[i].ctfteam)
|
||||
netbuffer->u.playerinfo[i].team = 255;
|
||||
else
|
||||
netbuffer->u.playerinfo[i].team = (UINT8)players[i].ctfteam;
|
||||
}
|
||||
else
|
||||
netbuffer->u.playerinfo[i].team = 0;
|
||||
{
|
||||
if (players[i].spectator)
|
||||
netbuffer->u.playerinfo[i].team = 255;
|
||||
else
|
||||
netbuffer->u.playerinfo[i].team = 0;
|
||||
}
|
||||
|
||||
netbuffer->u.playerinfo[i].score = LONG(players[i].score);
|
||||
netbuffer->u.playerinfo[i].timeinserver = SHORT((UINT16)(players[i].jointime / TICRATE));
|
||||
@@ -3132,6 +3248,9 @@ void CL_RemovePlayer(INT32 playernum, INT32 reason)
|
||||
if (K_IsPlayerWanted(&players[playernum]))
|
||||
K_CalculateBattleWanted();
|
||||
|
||||
if (gametype == GT_CTF)
|
||||
P_PlayerFlagBurst(&players[playernum], false); // Don't take the flag with you!
|
||||
|
||||
// If in a special stage, redistribute the player's rings across
|
||||
// the remaining players.
|
||||
if (G_IsSpecialStage(gamemap))
|
||||
@@ -5490,6 +5609,9 @@ static void HandlePacketFromPlayer(SINT8 node)
|
||||
resynch_local_inprogress = false;
|
||||
|
||||
P_SetRandSeed(netbuffer->u.resynchend.randomseed);
|
||||
|
||||
if (gametype == GT_CTF)
|
||||
resynch_read_ctf(&netbuffer->u.resynchend);
|
||||
resynch_read_others(&netbuffer->u.resynchend);
|
||||
|
||||
break;
|
||||
|
||||
@@ -182,6 +182,14 @@ typedef struct
|
||||
{
|
||||
UINT32 randomseed;
|
||||
|
||||
// CTF flag stuff
|
||||
SINT8 flagplayer[2];
|
||||
INT32 flagloose[2];
|
||||
INT32 flagflags[2];
|
||||
fixed_t flagx[2];
|
||||
fixed_t flagy[2];
|
||||
fixed_t flagz[2];
|
||||
|
||||
UINT32 ingame; // Spectator bit for each player
|
||||
INT32 ctfteam[MAXPLAYERS]; // Which team? (can't be 1 bit, since in regular Match there are no teams)
|
||||
|
||||
|
||||
+551
-41
@@ -1530,10 +1530,24 @@ UINT8 CanChangeSkin(INT32 playernum)
|
||||
// Server has skin change restrictions.
|
||||
if (cv_restrictskinchange.value)
|
||||
{
|
||||
if (gametype == GT_COOP)
|
||||
return true;
|
||||
|
||||
// Can change skin during initial countdown.
|
||||
if (leveltime < starttime)
|
||||
return true;
|
||||
|
||||
if (G_TagGametype())
|
||||
{
|
||||
// Can change skin during hidetime.
|
||||
if (leveltime < hidetime * TICRATE)
|
||||
return true;
|
||||
|
||||
// IT players can always change skins to persue players hiding in character only locations.
|
||||
if (players[playernum].pflags & PF_TAGIT)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (players[playernum].spectator || players[playernum].playerstate == PST_DEAD || players[playernum].playerstate == PST_REBORN)
|
||||
return true;
|
||||
|
||||
@@ -1579,6 +1593,15 @@ static void SendNameAndColor(void)
|
||||
|
||||
p = buf;
|
||||
|
||||
// normal player colors
|
||||
if (G_GametypeHasTeams())
|
||||
{
|
||||
if (players[consoleplayer].ctfteam == 1 && cv_playercolor.value != skincolor_redteam)
|
||||
CV_StealthSetValue(&cv_playercolor, skincolor_redteam);
|
||||
else if (players[consoleplayer].ctfteam == 2 && cv_playercolor.value != skincolor_blueteam)
|
||||
CV_StealthSetValue(&cv_playercolor, skincolor_blueteam);
|
||||
}
|
||||
|
||||
// never allow the color "none"
|
||||
if (!cv_playercolor.value)
|
||||
{
|
||||
@@ -1688,6 +1711,15 @@ static void SendNameAndColor2(void)
|
||||
|
||||
p = buf;
|
||||
|
||||
// normal player colors
|
||||
if (G_GametypeHasTeams())
|
||||
{
|
||||
if (players[secondplaya].ctfteam == 1 && cv_playercolor2.value != skincolor_redteam)
|
||||
CV_StealthSetValue(&cv_playercolor2, skincolor_redteam);
|
||||
else if (players[secondplaya].ctfteam == 2 && cv_playercolor2.value != skincolor_blueteam)
|
||||
CV_StealthSetValue(&cv_playercolor2, skincolor_blueteam);
|
||||
}
|
||||
|
||||
// never allow the color "none"
|
||||
if (!cv_playercolor2.value)
|
||||
{
|
||||
@@ -1792,6 +1824,15 @@ static void SendNameAndColor3(void)
|
||||
|
||||
p = buf;
|
||||
|
||||
// normal player colors
|
||||
if (G_GametypeHasTeams())
|
||||
{
|
||||
if (players[thirdplaya].ctfteam == 1 && cv_playercolor3.value != skincolor_redteam)
|
||||
CV_StealthSetValue(&cv_playercolor3, skincolor_redteam);
|
||||
else if (players[thirdplaya].ctfteam == 2 && cv_playercolor3.value != skincolor_blueteam)
|
||||
CV_StealthSetValue(&cv_playercolor3, skincolor_blueteam);
|
||||
}
|
||||
|
||||
// never allow the color "none"
|
||||
if (!cv_playercolor3.value)
|
||||
{
|
||||
@@ -1904,6 +1945,15 @@ static void SendNameAndColor4(void)
|
||||
|
||||
p = buf;
|
||||
|
||||
// normal player colors
|
||||
if (G_GametypeHasTeams())
|
||||
{
|
||||
if (players[fourthplaya].ctfteam == 1 && cv_playercolor4.value != skincolor_redteam)
|
||||
CV_StealthSetValue(&cv_playercolor4, skincolor_redteam);
|
||||
else if (players[fourthplaya].ctfteam == 2 && cv_playercolor4.value != skincolor_blueteam)
|
||||
CV_StealthSetValue(&cv_playercolor4, skincolor_blueteam);
|
||||
}
|
||||
|
||||
// never allow the color "none"
|
||||
if (!cv_playercolor4.value)
|
||||
{
|
||||
@@ -2037,6 +2087,15 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
boolean kick = false;
|
||||
|
||||
// team colors
|
||||
if (G_GametypeHasTeams())
|
||||
{
|
||||
if (p->ctfteam == 1 && p->skincolor != skincolor_redteam)
|
||||
kick = true;
|
||||
else if (p->ctfteam == 2 && p->skincolor != skincolor_blueteam)
|
||||
kick = true;
|
||||
}
|
||||
|
||||
// don't allow color "none"
|
||||
if (!p->skincolor)
|
||||
kick = true;
|
||||
@@ -3268,14 +3327,27 @@ static void Command_Teamchange_f(void)
|
||||
|
||||
if (COM_Argc() <= 1)
|
||||
{
|
||||
if (G_GametypeHasSpectators())
|
||||
if (G_GametypeHasTeams())
|
||||
CONS_Printf(M_GetText("changeteam <team>: switch to a new team (%s)\n"), "red, blue or spectator");
|
||||
else if (G_GametypeHasSpectators())
|
||||
CONS_Printf(M_GetText("changeteam <team>: switch to a new team (%s)\n"), "spectator or playing");
|
||||
else
|
||||
CONS_Alert(CONS_NOTICE, M_GetText("This command cannot be used in this gametype.\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (G_GametypeHasSpectators())
|
||||
if (G_GametypeHasTeams())
|
||||
{
|
||||
if (!strcasecmp(COM_Argv(1), "red") || !strcasecmp(COM_Argv(1), "1"))
|
||||
NetPacket.packet.newteam = 1;
|
||||
else if (!strcasecmp(COM_Argv(1), "blue") || !strcasecmp(COM_Argv(1), "2"))
|
||||
NetPacket.packet.newteam = 2;
|
||||
else if (!strcasecmp(COM_Argv(1), "spectator") || !strcasecmp(COM_Argv(1), "0"))
|
||||
NetPacket.packet.newteam = 0;
|
||||
else
|
||||
error = true;
|
||||
}
|
||||
else if (G_GametypeHasSpectators())
|
||||
{
|
||||
if (!strcasecmp(COM_Argv(1), "spectator") || !strcasecmp(COM_Argv(1), "0"))
|
||||
NetPacket.packet.newteam = 0;
|
||||
@@ -3292,13 +3364,17 @@ static void Command_Teamchange_f(void)
|
||||
|
||||
if (error)
|
||||
{
|
||||
if (G_GametypeHasSpectators())
|
||||
if (G_GametypeHasTeams())
|
||||
CONS_Printf(M_GetText("changeteam <team>: switch to a new team (%s)\n"), "red, blue or spectator");
|
||||
else if (G_GametypeHasSpectators())
|
||||
CONS_Printf(M_GetText("changeteam <team>: switch to a new team (%s)\n"), "spectator or playing");
|
||||
return;
|
||||
}
|
||||
|
||||
if (players[consoleplayer].spectator)
|
||||
error = !(NetPacket.packet.newteam || (players[consoleplayer].pflags & PF_WANTSTOJOIN)); // :lancer:
|
||||
else if (G_GametypeHasTeams())
|
||||
error = (NetPacket.packet.newteam == (unsigned)players[consoleplayer].ctfteam);
|
||||
else if (G_GametypeHasSpectators() && !players[consoleplayer].spectator)
|
||||
error = (NetPacket.packet.newteam == 3);
|
||||
#ifdef PARANOIA
|
||||
@@ -3318,6 +3394,13 @@ static void Command_Teamchange_f(void)
|
||||
return;
|
||||
}
|
||||
|
||||
//additional check for hide and seek. Don't allow change of status after hidetime ends.
|
||||
if (gametype == GT_HIDEANDSEEK && leveltime >= (hidetime * TICRATE))
|
||||
{
|
||||
CONS_Alert(CONS_NOTICE, M_GetText("Hiding time expired; no Hide and Seek status changes allowed!\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
usvalue = SHORT(NetPacket.value.l|NetPacket.value.b);
|
||||
SendNetXCmdForPlayer(0, XD_TEAMCHANGE, &usvalue, sizeof(usvalue));
|
||||
}
|
||||
@@ -3334,14 +3417,27 @@ static void Command_Teamchange2_f(void)
|
||||
|
||||
if (COM_Argc() <= 1)
|
||||
{
|
||||
if (G_GametypeHasSpectators())
|
||||
if (G_GametypeHasTeams())
|
||||
CONS_Printf(M_GetText("changeteam2 <team>: switch to a new team (%s)\n"), "red, blue or spectator");
|
||||
else if (G_GametypeHasSpectators())
|
||||
CONS_Printf(M_GetText("changeteam2 <team>: switch to a new team (%s)\n"), "spectator or playing");
|
||||
else
|
||||
CONS_Alert(CONS_NOTICE, M_GetText("This command cannot be used in this gametype.\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (G_GametypeHasSpectators())
|
||||
if (G_GametypeHasTeams())
|
||||
{
|
||||
if (!strcasecmp(COM_Argv(1), "red") || !strcasecmp(COM_Argv(1), "1"))
|
||||
NetPacket.packet.newteam = 1;
|
||||
else if (!strcasecmp(COM_Argv(1), "blue") || !strcasecmp(COM_Argv(1), "2"))
|
||||
NetPacket.packet.newteam = 2;
|
||||
else if (!strcasecmp(COM_Argv(1), "spectator") || !strcasecmp(COM_Argv(1), "0"))
|
||||
NetPacket.packet.newteam = 0;
|
||||
else
|
||||
error = true;
|
||||
}
|
||||
else if (G_GametypeHasSpectators())
|
||||
{
|
||||
if (!strcasecmp(COM_Argv(1), "spectator") || !strcasecmp(COM_Argv(1), "0"))
|
||||
NetPacket.packet.newteam = 0;
|
||||
@@ -3359,13 +3455,17 @@ static void Command_Teamchange2_f(void)
|
||||
|
||||
if (error)
|
||||
{
|
||||
if (G_GametypeHasSpectators())
|
||||
if (G_GametypeHasTeams())
|
||||
CONS_Printf(M_GetText("changeteam2 <team>: switch to a new team (%s)\n"), "red, blue or spectator");
|
||||
else if (G_GametypeHasSpectators())
|
||||
CONS_Printf(M_GetText("changeteam2 <team>: switch to a new team (%s)\n"), "spectator or playing");
|
||||
return;
|
||||
}
|
||||
|
||||
if (players[displayplayers[1]].spectator)
|
||||
error = !(NetPacket.packet.newteam || (players[displayplayers[1]].pflags & PF_WANTSTOJOIN));
|
||||
else if (G_GametypeHasTeams())
|
||||
error = (NetPacket.packet.newteam == (unsigned)players[displayplayers[1]].ctfteam);
|
||||
else if (G_GametypeHasSpectators() && !players[displayplayers[1]].spectator)
|
||||
error = (NetPacket.packet.newteam == 3);
|
||||
#ifdef PARANOIA
|
||||
@@ -3385,6 +3485,13 @@ static void Command_Teamchange2_f(void)
|
||||
return;
|
||||
}
|
||||
|
||||
//additional check for hide and seek. Don't allow change of status after hidetime ends.
|
||||
if (gametype == GT_HIDEANDSEEK && leveltime >= (hidetime * TICRATE))
|
||||
{
|
||||
CONS_Alert(CONS_NOTICE, M_GetText("Hiding time expired; no Hide and Seek status changes allowed!\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
usvalue = SHORT(NetPacket.value.l|NetPacket.value.b);
|
||||
SendNetXCmdForPlayer(1, XD_TEAMCHANGE, &usvalue, sizeof(usvalue));
|
||||
}
|
||||
@@ -3401,14 +3508,27 @@ static void Command_Teamchange3_f(void)
|
||||
|
||||
if (COM_Argc() <= 1)
|
||||
{
|
||||
if (G_GametypeHasSpectators())
|
||||
if (G_GametypeHasTeams())
|
||||
CONS_Printf(M_GetText("changeteam3 <team>: switch to a new team (%s)\n"), "red, blue or spectator");
|
||||
else if (G_GametypeHasSpectators())
|
||||
CONS_Printf(M_GetText("changeteam3 <team>: switch to a new team (%s)\n"), "spectator or playing");
|
||||
else
|
||||
CONS_Alert(CONS_NOTICE, M_GetText("This command cannot be used in this gametype.\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (G_GametypeHasSpectators())
|
||||
if (G_GametypeHasTeams())
|
||||
{
|
||||
if (!strcasecmp(COM_Argv(1), "red") || !strcasecmp(COM_Argv(1), "1"))
|
||||
NetPacket.packet.newteam = 1;
|
||||
else if (!strcasecmp(COM_Argv(1), "blue") || !strcasecmp(COM_Argv(1), "2"))
|
||||
NetPacket.packet.newteam = 2;
|
||||
else if (!strcasecmp(COM_Argv(1), "spectator") || !strcasecmp(COM_Argv(1), "0"))
|
||||
NetPacket.packet.newteam = 0;
|
||||
else
|
||||
error = true;
|
||||
}
|
||||
else if (G_GametypeHasSpectators())
|
||||
{
|
||||
if (!strcasecmp(COM_Argv(1), "spectator") || !strcasecmp(COM_Argv(1), "0"))
|
||||
NetPacket.packet.newteam = 0;
|
||||
@@ -3426,13 +3546,17 @@ static void Command_Teamchange3_f(void)
|
||||
|
||||
if (error)
|
||||
{
|
||||
if (G_GametypeHasSpectators())
|
||||
if (G_GametypeHasTeams())
|
||||
CONS_Printf(M_GetText("changeteam3 <team>: switch to a new team (%s)\n"), "red, blue or spectator");
|
||||
else if (G_GametypeHasSpectators())
|
||||
CONS_Printf(M_GetText("changeteam3 <team>: switch to a new team (%s)\n"), "spectator or playing");
|
||||
return;
|
||||
}
|
||||
|
||||
if (players[displayplayers[2]].spectator)
|
||||
error = !(NetPacket.packet.newteam || (players[displayplayers[2]].pflags & PF_WANTSTOJOIN));
|
||||
else if (G_GametypeHasTeams())
|
||||
error = (NetPacket.packet.newteam == (unsigned)players[displayplayers[2]].ctfteam);
|
||||
else if (G_GametypeHasSpectators() && !players[displayplayers[2]].spectator)
|
||||
error = (NetPacket.packet.newteam == 3);
|
||||
#ifdef PARANOIA
|
||||
@@ -3452,6 +3576,13 @@ static void Command_Teamchange3_f(void)
|
||||
return;
|
||||
}
|
||||
|
||||
//additional check for hide and seek. Don't allow change of status after hidetime ends.
|
||||
if (gametype == GT_HIDEANDSEEK && leveltime >= (hidetime * TICRATE))
|
||||
{
|
||||
CONS_Alert(CONS_NOTICE, M_GetText("Hiding time expired; no Hide and Seek status changes allowed!\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
usvalue = SHORT(NetPacket.value.l|NetPacket.value.b);
|
||||
SendNetXCmdForPlayer(2, XD_TEAMCHANGE, &usvalue, sizeof(usvalue));
|
||||
}
|
||||
@@ -3468,14 +3599,27 @@ static void Command_Teamchange4_f(void)
|
||||
|
||||
if (COM_Argc() <= 1)
|
||||
{
|
||||
if (G_GametypeHasSpectators())
|
||||
if (G_GametypeHasTeams())
|
||||
CONS_Printf(M_GetText("changeteam4 <team>: switch to a new team (%s)\n"), "red, blue or spectator");
|
||||
else if (G_GametypeHasSpectators())
|
||||
CONS_Printf(M_GetText("changeteam4 <team>: switch to a new team (%s)\n"), "spectator or playing");
|
||||
else
|
||||
CONS_Alert(CONS_NOTICE, M_GetText("This command cannot be used in this gametype.\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (G_GametypeHasSpectators())
|
||||
if (G_GametypeHasTeams())
|
||||
{
|
||||
if (!strcasecmp(COM_Argv(1), "red") || !strcasecmp(COM_Argv(1), "1"))
|
||||
NetPacket.packet.newteam = 1;
|
||||
else if (!strcasecmp(COM_Argv(1), "blue") || !strcasecmp(COM_Argv(1), "2"))
|
||||
NetPacket.packet.newteam = 2;
|
||||
else if (!strcasecmp(COM_Argv(1), "spectator") || !strcasecmp(COM_Argv(1), "0"))
|
||||
NetPacket.packet.newteam = 0;
|
||||
else
|
||||
error = true;
|
||||
}
|
||||
else if (G_GametypeHasSpectators())
|
||||
{
|
||||
if (!strcasecmp(COM_Argv(1), "spectator") || !strcasecmp(COM_Argv(1), "0"))
|
||||
NetPacket.packet.newteam = 0;
|
||||
@@ -3493,13 +3637,17 @@ static void Command_Teamchange4_f(void)
|
||||
|
||||
if (error)
|
||||
{
|
||||
if (G_GametypeHasSpectators())
|
||||
if (G_GametypeHasTeams())
|
||||
CONS_Printf(M_GetText("changeteam4 <team>: switch to a new team (%s)\n"), "red, blue or spectator");
|
||||
else if (G_GametypeHasSpectators())
|
||||
CONS_Printf(M_GetText("changeteam4 <team>: switch to a new team (%s)\n"), "spectator or playing");
|
||||
return;
|
||||
}
|
||||
|
||||
if (players[displayplayers[3]].spectator)
|
||||
error = !(NetPacket.packet.newteam || (players[displayplayers[3]].pflags & PF_WANTSTOJOIN));
|
||||
else if (G_GametypeHasTeams())
|
||||
error = (NetPacket.packet.newteam == (unsigned)players[displayplayers[3]].ctfteam);
|
||||
else if (G_GametypeHasSpectators() && !players[displayplayers[3]].spectator)
|
||||
error = (NetPacket.packet.newteam == 3);
|
||||
#ifdef PARANOIA
|
||||
@@ -3519,6 +3667,13 @@ static void Command_Teamchange4_f(void)
|
||||
return;
|
||||
}
|
||||
|
||||
//additional check for hide and seek. Don't allow change of status after hidetime ends.
|
||||
if (gametype == GT_HIDEANDSEEK && leveltime >= (hidetime * TICRATE))
|
||||
{
|
||||
CONS_Alert(CONS_NOTICE, M_GetText("Hiding time expired; no Hide and Seek status changes allowed!\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
usvalue = SHORT(NetPacket.value.l|NetPacket.value.b);
|
||||
SendNetXCmdForPlayer(3, XD_TEAMCHANGE, &usvalue, sizeof(usvalue));
|
||||
}
|
||||
@@ -3541,14 +3696,42 @@ static void Command_ServerTeamChange_f(void)
|
||||
|
||||
if (COM_Argc() < 3)
|
||||
{
|
||||
if (G_GametypeHasSpectators())
|
||||
if (G_TagGametype())
|
||||
CONS_Printf(M_GetText("serverchangeteam <playernum> <team>: switch player to a new team (%s)\n"), "it, notit, playing, or spectator");
|
||||
else if (G_GametypeHasTeams())
|
||||
CONS_Printf(M_GetText("serverchangeteam <playernum> <team>: switch player to a new team (%s)\n"), "red, blue or spectator");
|
||||
else if (G_GametypeHasSpectators())
|
||||
CONS_Printf(M_GetText("serverchangeteam <playernum> <team>: switch player to a new team (%s)\n"), "spectator or playing");
|
||||
else
|
||||
CONS_Alert(CONS_NOTICE, M_GetText("This command cannot be used in this gametype.\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (G_GametypeHasSpectators())
|
||||
if (G_TagGametype())
|
||||
{
|
||||
if (!strcasecmp(COM_Argv(2), "it") || !strcasecmp(COM_Argv(2), "1"))
|
||||
NetPacket.packet.newteam = 1;
|
||||
else if (!strcasecmp(COM_Argv(2), "notit") || !strcasecmp(COM_Argv(2), "2"))
|
||||
NetPacket.packet.newteam = 2;
|
||||
else if (!strcasecmp(COM_Argv(2), "playing") || !strcasecmp(COM_Argv(2), "3"))
|
||||
NetPacket.packet.newteam = 3;
|
||||
else if (!strcasecmp(COM_Argv(2), "spectator") || !strcasecmp(COM_Argv(2), "0"))
|
||||
NetPacket.packet.newteam = 0;
|
||||
else
|
||||
error = true;
|
||||
}
|
||||
else if (G_GametypeHasTeams())
|
||||
{
|
||||
if (!strcasecmp(COM_Argv(2), "red") || !strcasecmp(COM_Argv(2), "1"))
|
||||
NetPacket.packet.newteam = 1;
|
||||
else if (!strcasecmp(COM_Argv(2), "blue") || !strcasecmp(COM_Argv(2), "2"))
|
||||
NetPacket.packet.newteam = 2;
|
||||
else if (!strcasecmp(COM_Argv(2), "spectator") || !strcasecmp(COM_Argv(2), "0"))
|
||||
NetPacket.packet.newteam = 0;
|
||||
else
|
||||
error = true;
|
||||
}
|
||||
else if (G_GametypeHasSpectators())
|
||||
{
|
||||
if (!strcasecmp(COM_Argv(2), "spectator") || !strcasecmp(COM_Argv(2), "0"))
|
||||
NetPacket.packet.newteam = 0;
|
||||
@@ -3565,7 +3748,11 @@ static void Command_ServerTeamChange_f(void)
|
||||
|
||||
if (error)
|
||||
{
|
||||
if (G_GametypeHasSpectators())
|
||||
if (G_TagGametype())
|
||||
CONS_Printf(M_GetText("serverchangeteam <playernum> <team>: switch player to a new team (%s)\n"), "it, notit, playing, or spectator");
|
||||
else if (G_GametypeHasTeams())
|
||||
CONS_Printf(M_GetText("serverchangeteam <playernum> <team>: switch player to a new team (%s)\n"), "red, blue or spectator");
|
||||
else if (G_GametypeHasSpectators())
|
||||
CONS_Printf(M_GetText("serverchangeteam <playernum> <team>: switch player to a new team (%s)\n"), "spectator or playing");
|
||||
return;
|
||||
}
|
||||
@@ -3578,7 +3765,21 @@ static void Command_ServerTeamChange_f(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if (G_GametypeHasSpectators())
|
||||
if (G_TagGametype())
|
||||
{
|
||||
if (( (players[NetPacket.packet.playernum].pflags & PF_TAGIT) && NetPacket.packet.newteam == 1) ||
|
||||
(!(players[NetPacket.packet.playernum].pflags & PF_TAGIT) && NetPacket.packet.newteam == 2) ||
|
||||
( players[NetPacket.packet.playernum].spectator && !NetPacket.packet.newteam) ||
|
||||
(!players[NetPacket.packet.playernum].spectator && NetPacket.packet.newteam == 3))
|
||||
error = true;
|
||||
}
|
||||
else if (G_GametypeHasTeams())
|
||||
{
|
||||
if (NetPacket.packet.newteam == (unsigned)players[NetPacket.packet.playernum].ctfteam ||
|
||||
(players[NetPacket.packet.playernum].spectator && !NetPacket.packet.newteam))
|
||||
error = true;
|
||||
}
|
||||
else if (G_GametypeHasSpectators())
|
||||
{
|
||||
if ((players[NetPacket.packet.playernum].spectator && !NetPacket.packet.newteam) ||
|
||||
(!players[NetPacket.packet.playernum].spectator && NetPacket.packet.newteam == 3))
|
||||
@@ -3595,6 +3796,13 @@ static void Command_ServerTeamChange_f(void)
|
||||
return;
|
||||
}
|
||||
|
||||
//additional check for hide and seek. Don't allow change of status after hidetime ends.
|
||||
if (gametype == GT_HIDEANDSEEK && leveltime >= (hidetime * TICRATE))
|
||||
{
|
||||
CONS_Alert(CONS_NOTICE, M_GetText("Hiding time expired; no Hide and Seek status changes allowed!\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
NetPacket.packet.verification = true; // This signals that it's a server change
|
||||
|
||||
usvalue = SHORT(NetPacket.value.l|NetPacket.value.b);
|
||||
@@ -3608,7 +3816,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
|
||||
boolean error = false, wasspectator = false;
|
||||
NetPacket.value.l = NetPacket.value.b = READINT16(*cp);
|
||||
|
||||
if (!G_GametypeHasSpectators()) //Make sure you're in the right gametype.
|
||||
if (!G_GametypeHasTeams() && !G_GametypeHasSpectators()) //Make sure you're in the right gametype.
|
||||
{
|
||||
// this should never happen unless the client is hacked/buggy
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal team change received from player %s\n"), player_names[playernum]);
|
||||
@@ -3643,6 +3851,18 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
|
||||
// Prevent multiple changes in one go.
|
||||
if (players[playernum].spectator && !(players[playernum].pflags & PF_WANTSTOJOIN) && !NetPacket.packet.newteam)
|
||||
return;
|
||||
else if (G_TagGametype())
|
||||
{
|
||||
if (((players[playernum].pflags & PF_TAGIT) && NetPacket.packet.newteam == 1) ||
|
||||
(!(players[playernum].pflags & PF_TAGIT) && NetPacket.packet.newteam == 2) ||
|
||||
(!players[playernum].spectator && NetPacket.packet.newteam == 3))
|
||||
return;
|
||||
}
|
||||
else if (G_GametypeHasTeams())
|
||||
{
|
||||
if (NetPacket.packet.newteam && (NetPacket.packet.newteam == (unsigned)players[playernum].ctfteam))
|
||||
return;
|
||||
}
|
||||
else if (G_GametypeHasSpectators())
|
||||
{
|
||||
if (!players[playernum].spectator && NetPacket.packet.newteam == 3)
|
||||
@@ -3665,16 +3885,45 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
|
||||
return;
|
||||
}
|
||||
|
||||
//Make sure that the right team number is sent. Keep in mind that normal clients cannot change to certain teams in certain gametypes.
|
||||
switch (gametype)
|
||||
{
|
||||
case GT_HIDEANDSEEK:
|
||||
//no status changes after hidetime
|
||||
if (leveltime >= (hidetime * TICRATE))
|
||||
{
|
||||
error = true;
|
||||
break;
|
||||
}
|
||||
/* FALLTHRU */
|
||||
case GT_TAG:
|
||||
switch (NetPacket.packet.newteam)
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
case 1: case 2:
|
||||
if (!NetPacket.packet.verification)
|
||||
error = true; //Only admin can change player's IT status' in tag.
|
||||
break;
|
||||
case 3: //Join game via console.
|
||||
if (!NetPacket.packet.verification && !cv_allowteamchange.value)
|
||||
error = true;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
#ifdef PARANOIA
|
||||
if (!G_GametypeHasSpectators())
|
||||
I_Error("Invalid gametype after initial checks!");
|
||||
if (!G_GametypeHasTeams() && !G_GametypeHasSpectators())
|
||||
I_Error("Invalid gametype after initial checks!");
|
||||
#endif
|
||||
|
||||
//Make sure that the right team number is sent. Keep in mind that normal clients cannot change to certain teams in certain gametypes.
|
||||
if (!cv_allowteamchange.value)
|
||||
{
|
||||
if (!NetPacket.packet.verification && NetPacket.packet.newteam)
|
||||
error = true; //Only admin can change status, unless changing to spectator.
|
||||
if (!cv_allowteamchange.value)
|
||||
{
|
||||
if (!NetPacket.packet.verification && NetPacket.packet.newteam)
|
||||
error = true; //Only admin can change status, unless changing to spectator.
|
||||
}
|
||||
break; //Otherwise, you don't need special permissions.
|
||||
}
|
||||
|
||||
if (server && ((NetPacket.packet.newteam < 0 || NetPacket.packet.newteam > 3) || error))
|
||||
@@ -3703,7 +3952,50 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
|
||||
|
||||
//Now that we've done our error checking and killed the player
|
||||
//if necessary, put the player on the correct team/status.
|
||||
if (G_GametypeHasSpectators())
|
||||
if (G_TagGametype())
|
||||
{
|
||||
if (!NetPacket.packet.newteam)
|
||||
{
|
||||
players[playernum].spectator = true;
|
||||
players[playernum].pflags &= ~PF_TAGIT;
|
||||
players[playernum].pflags &= ~PF_TAGGED;
|
||||
}
|
||||
else if (NetPacket.packet.newteam != 3) // .newteam == 1 or 2.
|
||||
{
|
||||
players[playernum].pflags |= PF_WANTSTOJOIN; //players[playernum].spectator = false;
|
||||
players[playernum].pflags &= ~PF_TAGGED;//Just in case.
|
||||
|
||||
if (NetPacket.packet.newteam == 1) //Make the player IT.
|
||||
players[playernum].pflags |= PF_TAGIT;
|
||||
else
|
||||
players[playernum].pflags &= ~PF_TAGIT;
|
||||
}
|
||||
else // Just join the game.
|
||||
{
|
||||
players[playernum].pflags |= PF_WANTSTOJOIN; //players[playernum].spectator = false;
|
||||
|
||||
//If joining after hidetime in normal tag, default to being IT.
|
||||
if (gametype == GT_TAG && (leveltime > (hidetime * TICRATE)))
|
||||
{
|
||||
NetPacket.packet.newteam = 1; //minor hack, causes the "is it" message to be printed later.
|
||||
players[playernum].pflags |= PF_TAGIT; //make the player IT.
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (G_GametypeHasTeams())
|
||||
{
|
||||
if (!NetPacket.packet.newteam)
|
||||
{
|
||||
players[playernum].ctfteam = 0;
|
||||
players[playernum].spectator = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
players[playernum].ctfteam = NetPacket.packet.newteam;
|
||||
players[playernum].pflags |= PF_WANTSTOJOIN; //players[playernum].spectator = false;
|
||||
}
|
||||
}
|
||||
else if (G_GametypeHasSpectators())
|
||||
{
|
||||
if (!NetPacket.packet.newteam)
|
||||
players[playernum].spectator = true;
|
||||
@@ -3727,11 +4019,17 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
|
||||
}
|
||||
else if (NetPacket.packet.newteam == 1)
|
||||
{
|
||||
CONS_Printf(M_GetText("%s switched to the %c%s%c.\n"), player_names[playernum], '\x85', M_GetText("Red Team"), '\x80');
|
||||
if (G_TagGametype())
|
||||
CONS_Printf(M_GetText("%s is now IT!\n"), player_names[playernum]);
|
||||
else
|
||||
CONS_Printf(M_GetText("%s switched to the %c%s%c.\n"), player_names[playernum], '\x85', M_GetText("Red Team"), '\x80');
|
||||
}
|
||||
else if (NetPacket.packet.newteam == 2)
|
||||
{
|
||||
CONS_Printf(M_GetText("%s switched to the %c%s%c.\n"), player_names[playernum], '\x84', M_GetText("Blue Team"), '\x80');
|
||||
if (G_TagGametype())
|
||||
CONS_Printf(M_GetText("%s is no longer IT!\n"), player_names[playernum]);
|
||||
else
|
||||
CONS_Printf(M_GetText("%s switched to the %c%s%c.\n"), player_names[playernum], '\x84', M_GetText("Blue Team"), '\x80');
|
||||
}
|
||||
else if (NetPacket.packet.newteam == 0 && !wasspectator)
|
||||
HU_AddChatText(va("\x82*%s became a spectator.", player_names[playernum]), false); // "entered the game" text was moved to P_SpectatorJoinGame
|
||||
@@ -3740,6 +4038,21 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
|
||||
if (playernum == consoleplayer || displayplayers[0] == playernum)
|
||||
displayplayers[0] = consoleplayer;
|
||||
|
||||
if (G_GametypeHasTeams())
|
||||
{
|
||||
if (NetPacket.packet.newteam)
|
||||
{
|
||||
if (playernum == consoleplayer) //CTF and Team Match colors.
|
||||
CV_SetValue(&cv_playercolor, NetPacket.packet.newteam + 5);
|
||||
else if (playernum == displayplayers[1])
|
||||
CV_SetValue(&cv_playercolor2, NetPacket.packet.newteam + 5);
|
||||
else if (playernum == displayplayers[2])
|
||||
CV_SetValue(&cv_playercolor3, NetPacket.packet.newteam + 5);
|
||||
else if (playernum == displayplayers[3])
|
||||
CV_SetValue(&cv_playercolor4, NetPacket.packet.newteam + 5);
|
||||
}
|
||||
}
|
||||
|
||||
if (gamestate != GS_LEVEL)
|
||||
return;
|
||||
|
||||
@@ -4904,7 +5217,7 @@ static void PointLimit_OnChange(void)
|
||||
if (cv_pointlimit.value)
|
||||
{
|
||||
CONS_Printf(M_GetText("Levels will end after %s scores %d point%s.\n"),
|
||||
M_GetText("someone"),
|
||||
G_GametypeHasTeams() ? M_GetText("a team") : M_GetText("someone"),
|
||||
cv_pointlimit.value,
|
||||
cv_pointlimit.value > 1 ? "s" : "");
|
||||
}
|
||||
@@ -4959,7 +5272,11 @@ static void TimeLimit_OnChange(void)
|
||||
if (cv_timelimit.value != 0)
|
||||
{
|
||||
CONS_Printf(M_GetText("Levels will end after %d minute%s.\n"),cv_timelimit.value,cv_timelimit.value == 1 ? "" : "s"); // Graue 11-17-2003
|
||||
timelimitintics = cv_timelimit.value * 60 * TICRATE;;
|
||||
timelimitintics = cv_timelimit.value * 60 * TICRATE;
|
||||
|
||||
//add hidetime for tag too!
|
||||
if (G_TagGametype())
|
||||
timelimitintics += hidetime * TICRATE;
|
||||
|
||||
// Note the deliberate absence of any code preventing
|
||||
// pointlimit and timelimit from being set simultaneously.
|
||||
@@ -4998,19 +5315,46 @@ void D_GameTypeChanged(INT32 lastgametype)
|
||||
// There will always be a server, and this only needs to be done once.
|
||||
if (server && (multiplayer || netgame))
|
||||
{
|
||||
if (!cv_itemrespawn.changed)
|
||||
if (gametype == GT_COMPETITION || gametype == GT_COOP)
|
||||
CV_SetValue(&cv_itemrespawn, 0);
|
||||
else if (!cv_itemrespawn.changed)
|
||||
CV_SetValue(&cv_itemrespawn, 1);
|
||||
|
||||
if (gametype == GT_MATCH)
|
||||
switch (gametype)
|
||||
{
|
||||
if (!cv_timelimit.changed && !cv_pointlimit.changed) // user hasn't changed limits
|
||||
{
|
||||
// default settings for match: no timelimit, no pointlimit
|
||||
CV_SetValue(&cv_pointlimit, 0);
|
||||
CV_SetValue(&cv_timelimit, 0);
|
||||
}
|
||||
if (!cv_itemrespawntime.changed)
|
||||
CV_Set(&cv_itemrespawntime, cv_itemrespawntime.defaultvalue); // respawn normally
|
||||
case GT_MATCH:
|
||||
case GT_TEAMMATCH:
|
||||
if (!cv_timelimit.changed && !cv_pointlimit.changed) // user hasn't changed limits
|
||||
{
|
||||
// default settings for match: no timelimit, no pointlimit
|
||||
CV_SetValue(&cv_pointlimit, 0);
|
||||
CV_SetValue(&cv_timelimit, 0);
|
||||
}
|
||||
if (!cv_itemrespawntime.changed)
|
||||
CV_Set(&cv_itemrespawntime, cv_itemrespawntime.defaultvalue); // respawn normally
|
||||
break;
|
||||
case GT_TAG:
|
||||
case GT_HIDEANDSEEK:
|
||||
if (!cv_timelimit.changed && !cv_pointlimit.changed) // user hasn't changed limits
|
||||
{
|
||||
// default settings for tag: 5 mins, no pointlimit
|
||||
// Note that tag mode also uses an alternate timing mechanism in tandem with timelimit.
|
||||
CV_SetValue(&cv_timelimit, 5);
|
||||
CV_SetValue(&cv_pointlimit, 0);
|
||||
}
|
||||
if (!cv_itemrespawntime.changed)
|
||||
CV_Set(&cv_itemrespawntime, cv_itemrespawntime.defaultvalue); // respawn normally
|
||||
break;
|
||||
case GT_CTF:
|
||||
if (!cv_timelimit.changed && !cv_pointlimit.changed) // user hasn't changed limits
|
||||
{
|
||||
// default settings for CTF: no timelimit, pointlimit 5
|
||||
CV_SetValue(&cv_timelimit, 0);
|
||||
CV_SetValue(&cv_pointlimit, 5);
|
||||
}
|
||||
if (!cv_itemrespawntime.changed)
|
||||
CV_Set(&cv_itemrespawntime, cv_itemrespawntime.defaultvalue); // respawn normally
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (!multiplayer && !netgame)
|
||||
@@ -5028,6 +5372,29 @@ void D_GameTypeChanged(INT32 lastgametype)
|
||||
if (cv_pointlimit.value)
|
||||
CV_SetValue(&cv_pointlimit, 0);
|
||||
}
|
||||
else if ((cv_pointlimit.changed || cv_timelimit.changed) && cv_pointlimit.value)
|
||||
{
|
||||
if (lastgametype != GT_CTF && gametype == GT_CTF)
|
||||
CV_SetValue(&cv_pointlimit, cv_pointlimit.value / 500);
|
||||
else if (lastgametype == GT_CTF && gametype != GT_CTF)
|
||||
CV_SetValue(&cv_pointlimit, cv_pointlimit.value * 500);
|
||||
}
|
||||
}
|
||||
|
||||
// don't retain teams in other modes or between changes from ctf to team match.
|
||||
// also, stop any and all forms of team scrambling that might otherwise take place.
|
||||
if (G_GametypeHasTeams())
|
||||
{
|
||||
INT32 i;
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
if (playeringame[i])
|
||||
players[i].ctfteam = 0;
|
||||
|
||||
if (server || (IsPlayerAdmin(consoleplayer)))
|
||||
{
|
||||
CV_StealthSetValue(&cv_teamscramble, 0);
|
||||
teamscramble = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5091,6 +5458,14 @@ static void AutoBalance_OnChange(void)
|
||||
|
||||
static void TeamScramble_OnChange(void)
|
||||
{
|
||||
INT16 i = 0, j = 0, playercount = 0;
|
||||
boolean repick = true;
|
||||
INT32 blue = 0, red = 0;
|
||||
INT32 maxcomposition = 0;
|
||||
INT16 newteam = 0;
|
||||
INT32 retries = 0;
|
||||
boolean success = false;
|
||||
|
||||
// Don't trigger outside level or intermission!
|
||||
if (!(gamestate == GS_LEVEL || gamestate == GS_INTERMISSION || gamestate == GS_VOTING))
|
||||
return;
|
||||
@@ -5098,17 +5473,152 @@ static void TeamScramble_OnChange(void)
|
||||
if (!cv_teamscramble.value)
|
||||
teamscramble = 0;
|
||||
|
||||
if (server || IsPlayerAdmin(consoleplayer))
|
||||
if (!G_GametypeHasTeams() && (server || IsPlayerAdmin(consoleplayer)))
|
||||
{
|
||||
CONS_Alert(CONS_NOTICE, M_GetText("This command cannot be used in this gametype.\n"));
|
||||
CV_StealthSetValue(&cv_teamscramble, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
// If a team scramble is already in progress, do not allow another one to be started!
|
||||
if (teamscramble)
|
||||
return;
|
||||
|
||||
retryscramble:
|
||||
|
||||
// Clear related global variables. These will get used again in p_tick.c/y_inter.c as the teams are scrambled.
|
||||
memset(&scrambleplayers, 0, sizeof(scrambleplayers));
|
||||
memset(&scrambleteams, 0, sizeof(scrambleplayers));
|
||||
scrambletotal = scramblecount = 0;
|
||||
blue = red = maxcomposition = newteam = playercount = 0;
|
||||
repick = true;
|
||||
|
||||
// Put each player's node in the array.
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (playeringame[i] && !players[i].spectator)
|
||||
{
|
||||
scrambleplayers[playercount] = i;
|
||||
playercount++;
|
||||
}
|
||||
}
|
||||
|
||||
if (playercount < 2)
|
||||
{
|
||||
CV_StealthSetValue(&cv_teamscramble, 0);
|
||||
return; // Don't scramble one or zero players.
|
||||
}
|
||||
|
||||
// Randomly place players on teams.
|
||||
if (cv_teamscramble.value == 1)
|
||||
{
|
||||
maxcomposition = playercount / 2;
|
||||
|
||||
// Now randomly assign players to teams.
|
||||
// If the teams get out of hand, assign the rest to the other team.
|
||||
for (i = 0; i < playercount; i++)
|
||||
{
|
||||
if (repick)
|
||||
newteam = (INT16)((M_RandomByte() % 2) + 1);
|
||||
|
||||
// One team has the most players they can get, assign the rest to the other team.
|
||||
if (red == maxcomposition || blue == maxcomposition)
|
||||
{
|
||||
if (red == maxcomposition)
|
||||
newteam = 2;
|
||||
else if (blue == maxcomposition)
|
||||
newteam = 1;
|
||||
|
||||
repick = false;
|
||||
}
|
||||
|
||||
scrambleteams[i] = newteam;
|
||||
|
||||
if (newteam == 1)
|
||||
red++;
|
||||
else
|
||||
blue++;
|
||||
}
|
||||
}
|
||||
else if (cv_teamscramble.value == 2) // Same as before, except split teams based on current score.
|
||||
{
|
||||
// Now, sort the array based on points scored.
|
||||
for (i = 1; i < playercount; i++)
|
||||
{
|
||||
for (j = i; j < playercount; j++)
|
||||
{
|
||||
INT16 tempplayer = 0;
|
||||
|
||||
if ((players[scrambleplayers[i-1]].score > players[scrambleplayers[j]].score))
|
||||
{
|
||||
tempplayer = scrambleplayers[i-1];
|
||||
scrambleplayers[i-1] = scrambleplayers[j];
|
||||
scrambleplayers[j] = tempplayer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Now assign players to teams based on score. Scramble in pairs.
|
||||
// If there is an odd number, one team will end up with the unlucky slob who has no points. =(
|
||||
for (i = 0; i < playercount; i++)
|
||||
{
|
||||
if (repick)
|
||||
{
|
||||
newteam = (INT16)((M_RandomByte() % 2) + 1);
|
||||
repick = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// We will only randomly pick the team for the first guy.
|
||||
// Otherwise, just alternate back and forth, distributing players.
|
||||
if (newteam == 1)
|
||||
newteam = 2;
|
||||
else
|
||||
newteam = 1;
|
||||
}
|
||||
|
||||
scrambleteams[i] = newteam;
|
||||
}
|
||||
}
|
||||
|
||||
// Check to see if our random selection actually
|
||||
// changed anybody. If not, we run through and try again.
|
||||
for (i = 0; i < playercount; i++)
|
||||
{
|
||||
if (players[scrambleplayers[i]].ctfteam != scrambleteams[i])
|
||||
success = true;
|
||||
}
|
||||
|
||||
if (!success && retries < 5)
|
||||
{
|
||||
retries++;
|
||||
goto retryscramble; //try again
|
||||
}
|
||||
|
||||
// Display a witty message, but only during scrambles specifically triggered by an admin.
|
||||
if (cv_teamscramble.value)
|
||||
{
|
||||
scrambletotal = playercount;
|
||||
teamscramble = (INT16)cv_teamscramble.value;
|
||||
|
||||
if (!(gamestate == GS_INTERMISSION && cv_scrambleonchange.value))
|
||||
CONS_Printf(M_GetText("Teams will be scrambled next round.\n"));
|
||||
}
|
||||
}
|
||||
|
||||
static void Hidetime_OnChange(void)
|
||||
{
|
||||
if (Playing() && G_TagGametype() && leveltime >= (hidetime * TICRATE))
|
||||
{
|
||||
// Don't allow hidetime changes after it expires.
|
||||
CV_StealthSetValue(&cv_hidetime, hidetime);
|
||||
return;
|
||||
}
|
||||
hidetime = cv_hidetime.value;
|
||||
|
||||
//uh oh, gotta change timelimitintics now too
|
||||
if (G_TagGametype())
|
||||
timelimitintics = (cv_timelimit.value * 60 * TICRATE) + (hidetime * TICRATE);
|
||||
}
|
||||
|
||||
static void Command_Showmap_f(void)
|
||||
@@ -5150,7 +5660,7 @@ static void Command_Mapmd5_f(void)
|
||||
|
||||
static void Command_ExitLevel_f(void)
|
||||
{
|
||||
if (!(netgame || multiplayer) && !cv_debug)
|
||||
if (!(netgame || (multiplayer && gametype != GT_COOP)) && !cv_debug)
|
||||
CONS_Printf(M_GetText("This only works in a netgame.\n"));
|
||||
else if (!(server || (IsPlayerAdmin(consoleplayer))))
|
||||
CONS_Printf(M_GetText("Only the server or a remote admin can use this.\n"));
|
||||
|
||||
+19
-3
@@ -257,6 +257,8 @@ static void clear_levels(void)
|
||||
// Custom map header info
|
||||
// (no need to set num to 0, we're freeing the entire header shortly)
|
||||
Z_Free(mapheaderinfo[i]->customopts);
|
||||
|
||||
P_DeleteGrades(i);
|
||||
Z_Free(mapheaderinfo[i]);
|
||||
mapheaderinfo[i] = NULL;
|
||||
}
|
||||
@@ -800,8 +802,22 @@ static void readlevelheader(MYFILE *f, INT32 num, INT32 wadnum)
|
||||
// Now go to uppercase
|
||||
strupr(word2);
|
||||
|
||||
// NiGHTS grades
|
||||
if (fastncmp(word, "GRADES", 6))
|
||||
{
|
||||
UINT8 mare = (UINT8)atoi(word + 6);
|
||||
|
||||
if (mare <= 0 || mare > 8)
|
||||
{
|
||||
deh_warning("Level header %d: unknown word '%s'", num, word);
|
||||
continue;
|
||||
}
|
||||
|
||||
P_AddGradesForMare((INT16)(num-1), mare-1, word2);
|
||||
}
|
||||
|
||||
// Strings that can be truncated
|
||||
if (fastcmp(word, "SCRIPTNAME"))
|
||||
else if (fastcmp(word, "SCRIPTNAME"))
|
||||
{
|
||||
deh_strlcpy(mapheaderinfo[num-1]->scriptname, word2,
|
||||
sizeof(mapheaderinfo[num-1]->scriptname), va("Level header %d: scriptname", num));
|
||||
@@ -8543,13 +8559,13 @@ static int lua_enumlib_basic_fallback(lua_State* L)
|
||||
|
||||
static int lua_enumlib_mariomode_get(lua_State *L)
|
||||
{
|
||||
lua_pushboolean(L, false);
|
||||
lua_pushboolean(L, mariomode != 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lua_enumlib_twodlevel_get(lua_State *L)
|
||||
{
|
||||
lua_pushboolean(L, false);
|
||||
lua_pushboolean(L, twodlevel);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -328,6 +328,15 @@ enum GameType // SRB2Kart
|
||||
GT_RACE = 0, // also used in record attack
|
||||
GT_MATCH, // battle, but renaming would be silly
|
||||
NUMGAMETYPES,
|
||||
|
||||
// TODO: This is *horrid*. Remove this hack ASAP.
|
||||
// the following have been left in on account of just not wanting to deal with removing all the checks for them
|
||||
GT_COOP,
|
||||
GT_COMPETITION,
|
||||
GT_TEAMMATCH,
|
||||
GT_TAG,
|
||||
GT_HIDEANDSEEK,
|
||||
GT_CTF
|
||||
};
|
||||
// If you alter this list, update dehacked.c, and Gametype_Names in g_game.c
|
||||
|
||||
|
||||
+107
-5
@@ -2335,6 +2335,9 @@ void G_PlayerReborn(INT32 player)
|
||||
if (leveltime > (starttime + (TICRATE/2)) && !p->spectator)
|
||||
p->kartstuff[k_respawn] = 48; // Respawn effect
|
||||
|
||||
if (gametype == GT_COOP)
|
||||
P_FindEmerald(); // scan for emeralds to hunt for
|
||||
|
||||
// Reset Nights score and max link to 0 on death
|
||||
p->maxlink = 0;
|
||||
|
||||
@@ -2405,9 +2408,19 @@ void G_SpawnPlayer(INT32 playernum, boolean starpost)
|
||||
return;
|
||||
}
|
||||
|
||||
// -- CTF --
|
||||
// Order: CTF->DM->Coop
|
||||
if (gametype == GT_CTF && players[playernum].ctfteam)
|
||||
{
|
||||
if (!(spawnpoint = G_FindCTFStart(playernum)) // find a CTF start
|
||||
&& !(spawnpoint = G_FindMatchStart(playernum))) // find a DM start
|
||||
spawnpoint = G_FindRaceStart(playernum); // fallback
|
||||
}
|
||||
|
||||
// -- DM/Tag/CTF-spectator/etc --
|
||||
// Order: DM->CTF->Coop
|
||||
if (gametype == GT_MATCH && !(players[playernum].pflags & PF_TAGIT))
|
||||
else if (gametype == GT_MATCH || gametype == GT_TEAMMATCH || gametype == GT_CTF
|
||||
|| ((gametype == GT_TAG || gametype == GT_HIDEANDSEEK) && !(players[playernum].pflags & PF_TAGIT)))
|
||||
{
|
||||
if (!(spawnpoint = G_FindMatchStart(playernum)) // find a DM start
|
||||
&& !(spawnpoint = G_FindCTFStart(playernum))) // find a CTF start
|
||||
@@ -2721,6 +2734,14 @@ void G_ExitLevel(void)
|
||||
gameaction = ga_completed;
|
||||
lastdraw = true;
|
||||
|
||||
// If you want your teams scrambled on map change, start the process now.
|
||||
// The teams will scramble at the start of the next round.
|
||||
if (cv_scrambleonchange.value && G_GametypeHasTeams())
|
||||
{
|
||||
if (server)
|
||||
CV_SetValue(&cv_teamscramble, cv_scrambleonchange.value);
|
||||
}
|
||||
|
||||
if (netgame || multiplayer)
|
||||
CON_LogMessage(M_GetText("The round has ended.\n"));
|
||||
|
||||
@@ -2766,6 +2787,29 @@ boolean G_IsSpecialStage(INT32 mapnum)
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// G_GametypeUsesLives
|
||||
//
|
||||
// Returns true if the current gametype uses
|
||||
// the lives system. False otherwise.
|
||||
//
|
||||
boolean G_GametypeUsesLives(void)
|
||||
{
|
||||
// SRB2kart NEEDS no lives
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// G_GametypeHasTeams
|
||||
//
|
||||
// Returns true if the current gametype uses
|
||||
// Red/Blue teams. False otherwise.
|
||||
//
|
||||
boolean G_GametypeHasTeams(void)
|
||||
{
|
||||
return (gametype == GT_TEAMMATCH || gametype == GT_CTF);
|
||||
}
|
||||
|
||||
//
|
||||
// G_GametypeHasSpectators
|
||||
//
|
||||
@@ -2883,6 +2927,16 @@ boolean G_RaceGametype(void)
|
||||
return (gametype == GT_RACE);
|
||||
}
|
||||
|
||||
//
|
||||
// G_TagGametype
|
||||
//
|
||||
// For Jazz's Tag/HnS modes that have a lot of special cases...
|
||||
// SRB2Kart: do we actually want to add Kart tag later? :V
|
||||
//
|
||||
boolean G_TagGametype(void)
|
||||
{
|
||||
return (gametype == GT_TAG || gametype == GT_HIDEANDSEEK);
|
||||
}
|
||||
|
||||
/** Get the typeoflevel flag needed to indicate support of a gametype.
|
||||
* In single-player, this always returns TOL_SP.
|
||||
@@ -2893,8 +2947,14 @@ boolean G_RaceGametype(void)
|
||||
INT16 G_TOLFlag(INT32 pgametype)
|
||||
{
|
||||
if (!multiplayer) return TOL_SP;
|
||||
if (pgametype == GT_COOP) return TOL_RACE; // SRB2kart
|
||||
if (pgametype == GT_COMPETITION) return TOL_COMPETITION;
|
||||
if (pgametype == GT_RACE) return TOL_RACE;
|
||||
if (pgametype == GT_MATCH) return TOL_MATCH;
|
||||
if (pgametype == GT_TEAMMATCH) return TOL_MATCH;
|
||||
if (pgametype == GT_TAG) return TOL_TAG;
|
||||
if (pgametype == GT_HIDEANDSEEK) return TOL_TAG;
|
||||
if (pgametype == GT_CTF) return TOL_CTF;
|
||||
|
||||
CONS_Alert(CONS_ERROR, M_GetText("Unknown gametype! %d\n"), pgametype);
|
||||
return INT16_MAX;
|
||||
@@ -3173,15 +3233,42 @@ static void G_DoCompleted(void)
|
||||
if (nextmap >= 1100-1 && nextmap <= 1102-1 && G_RaceGametype())
|
||||
nextmap = (INT16)(spstage_start-1);
|
||||
|
||||
if (gametype == GT_COOP && token)
|
||||
{
|
||||
token--;
|
||||
gottoken = true;
|
||||
|
||||
if (!(emeralds & EMERALD1))
|
||||
nextmap = (INT16)(sstage_start - 1); // Special Stage 1
|
||||
else if (!(emeralds & EMERALD2))
|
||||
nextmap = (INT16)(sstage_start); // Special Stage 2
|
||||
else if (!(emeralds & EMERALD3))
|
||||
nextmap = (INT16)(sstage_start + 1); // Special Stage 3
|
||||
else if (!(emeralds & EMERALD4))
|
||||
nextmap = (INT16)(sstage_start + 2); // Special Stage 4
|
||||
else if (!(emeralds & EMERALD5))
|
||||
nextmap = (INT16)(sstage_start + 3); // Special Stage 5
|
||||
else if (!(emeralds & EMERALD6))
|
||||
nextmap = (INT16)(sstage_start + 4); // Special Stage 6
|
||||
else if (!(emeralds & EMERALD7))
|
||||
nextmap = (INT16)(sstage_start + 5); // Special Stage 7
|
||||
else
|
||||
gottoken = false;
|
||||
}
|
||||
|
||||
if (G_IsSpecialStage(gamemap) && !gottoken)
|
||||
nextmap = lastmap; // Exiting from a special stage? Go back to the game. Tails 08-11-2001
|
||||
|
||||
automapactive = false;
|
||||
|
||||
if (cv_advancemap.value == 0) // Stay on same map.
|
||||
nextmap = prevmap;
|
||||
else if (cv_advancemap.value == 2) // Go to random map.
|
||||
nextmap = G_RandMap(G_TOLFlag(gametype), prevmap, false, 0, false, NULL);
|
||||
if (gametype != GT_COOP)
|
||||
{
|
||||
if (cv_advancemap.value == 0) // Stay on same map.
|
||||
nextmap = prevmap;
|
||||
else if (cv_advancemap.value == 2) // Go to random map.
|
||||
nextmap = G_RandMap(G_TOLFlag(gametype), prevmap, false, 0, false, NULL);
|
||||
}
|
||||
|
||||
|
||||
// We are committed to this map now.
|
||||
// We may as well allocate its header if it doesn't exist
|
||||
@@ -3370,6 +3457,21 @@ void G_EndGame(void)
|
||||
else if (demo.recording)
|
||||
G_ResetDemoRecording();
|
||||
|
||||
// Only do evaluation and credits in coop games.
|
||||
if (gametype == GT_COOP)
|
||||
{
|
||||
if (nextmap == 1102-1) // end game with credits
|
||||
{
|
||||
F_StartCredits();
|
||||
return;
|
||||
}
|
||||
if (nextmap == 1101-1) // end game with evaluation
|
||||
{
|
||||
F_StartGameEvaluation();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 1100 or competitive multiplayer, so go back to title screen.
|
||||
D_StartTitle();
|
||||
}
|
||||
|
||||
@@ -380,11 +380,14 @@ boolean G_DemoTitleResponder(event_t *ev);
|
||||
|
||||
INT32 G_GetGametypeByName(const char *gametypestr);
|
||||
boolean G_IsSpecialStage(INT32 mapnum);
|
||||
boolean G_GametypeUsesLives(void);
|
||||
boolean G_GametypeHasTeams(void);
|
||||
boolean G_GametypeHasSpectators(void);
|
||||
boolean G_BattleGametype(void);
|
||||
UINT8 G_SometimesGetDifferentGametype(UINT8 prefgametype);
|
||||
UINT8 G_GetGametypeColor(INT16 gt);
|
||||
boolean G_RaceGametype(void);
|
||||
boolean G_TagGametype(void);
|
||||
void G_ExitLevel(void);
|
||||
void G_NextLevel(void);
|
||||
void G_Continue(void);
|
||||
|
||||
@@ -4392,9 +4392,9 @@ static void HWR_AddSprites(sector_t *sec)
|
||||
// --------------------------------------------------------------------------
|
||||
static void HWR_AddPrecipitationSprites(void)
|
||||
{
|
||||
//const fixed_t drawdist = cv_drawdist_precip.value * mapobjectscale;
|
||||
fixed_t drawdist;
|
||||
fixed_t precipscale = cv_mobjscaleprecip.value ? mapobjectscale : FRACUNIT;
|
||||
fixed_t precipscale = (cv_mobjscaleprecip.value ? mapobjectscale : FRACUNIT);
|
||||
//const fixed_t drawdist = cv_drawdist_precip.value * mapobjectscale;
|
||||
|
||||
INT32 xl, xh, yl, yh, bx, by;
|
||||
precipmobj_t *th;
|
||||
@@ -4402,7 +4402,7 @@ static void HWR_AddPrecipitationSprites(void)
|
||||
if (current_bsp_culling_distance)
|
||||
drawdist = min((fixed_t)current_bsp_culling_distance, (fixed_t)(cv_drawdist_precip.value) * precipscale);
|
||||
else
|
||||
drawdist = (fixed_t)(cv_drawdist_precip.value) * precipscale;
|
||||
drawdist = ((fixed_t)(cv_drawdist_precip.value) * precipscale);
|
||||
|
||||
// No to infinite precipitation draw distance.
|
||||
if (drawdist == 0 || curWeather == PRECIP_BLANK || curWeather == PRECIP_STORM_NORAIN)
|
||||
@@ -4468,7 +4468,7 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||
angle_t sliptiderollangle = 0;
|
||||
#endif
|
||||
|
||||
if (!thing)
|
||||
if (P_MobjWasRemoved(thing) || thing->subsector == NULL)
|
||||
return;
|
||||
|
||||
// uncapped/interpolation
|
||||
|
||||
+25
-2
@@ -775,7 +775,10 @@ static void Command_Sayteam_f(void)
|
||||
return;
|
||||
}
|
||||
|
||||
DoSayCommand(0, 1, 0);
|
||||
if (G_GametypeHasTeams()) // revert to normal say if we don't have teams in this gametype.
|
||||
DoSayCommand(-1, 1, 0);
|
||||
else
|
||||
DoSayCommand(0, 1, 0);
|
||||
}
|
||||
|
||||
/** Send a message to everyone, to be displayed by CECHO. Only
|
||||
@@ -1392,7 +1395,7 @@ boolean HU_Responder(event_t *ev)
|
||||
chat_on = true;
|
||||
w_chat_buf[0] = 0;
|
||||
M_TextInputInit(&w_chat, w_chat_buf, sizeof w_chat_buf);
|
||||
teamtalk = false;
|
||||
teamtalk = G_GametypeHasTeams(); // Don't teamtalk if we don't have teams.
|
||||
chat_scrollmedown = true;
|
||||
typelines = 1;
|
||||
return true;
|
||||
@@ -2608,6 +2611,7 @@ static inline void HU_DrawSpectatorTicker(void)
|
||||
//
|
||||
static void HU_DrawRankings(void)
|
||||
{
|
||||
patch_t *p;
|
||||
playersort_t tab[MAXPLAYERS];
|
||||
INT32 i, j, scorelines, hilicol, numplayersingame = 0;
|
||||
boolean completed[MAXPLAYERS];
|
||||
@@ -2639,6 +2643,25 @@ static void HU_DrawRankings(void)
|
||||
Z_Free(maptitle);
|
||||
}
|
||||
|
||||
if (G_GametypeHasTeams())
|
||||
{
|
||||
if (gametype == GT_CTF)
|
||||
p = bflagico;
|
||||
else
|
||||
p = bmatcico;
|
||||
|
||||
V_DrawSmallScaledPatch(128 - SHORT(p->width)/4, 4, 0, p);
|
||||
V_DrawCenteredString(128, 16, 0, va("%u", bluescore));
|
||||
|
||||
if (gametype == GT_CTF)
|
||||
p = rflagico;
|
||||
else
|
||||
p = rmatcico;
|
||||
|
||||
V_DrawSmallScaledPatch(192 - SHORT(p->width)/4, 4, 0, p);
|
||||
V_DrawCenteredString(192, 16, 0, va("%u", redscore));
|
||||
}
|
||||
|
||||
if (!G_RaceGametype())
|
||||
{
|
||||
if (cv_timelimit.value && timelimitintics > 0)
|
||||
|
||||
+1
-1
@@ -65,7 +65,7 @@ char sprnames[NUMSPRITES + 1][5] =
|
||||
"CNDL","DOCH","DUCK","GTRE","CHES","CHIM","DRGN","LZMN","PGSS","ZTCH",
|
||||
"MKMA","MKMP","RTCH","BOWL","BOWH","BRRL","BRRR","HRSE","TOAH","BFRT",
|
||||
"OFRT","RFRT","PFRT","ASPK","HBST","HBSO","HBSF","WBLZ","WBLN","OPUL",
|
||||
"TGEM","TCOI","FWRK","XMS4","XMS5","VIEW",
|
||||
"TGEM","TCOI","FWRK","XMS4","XMS5","VIEW"
|
||||
};
|
||||
|
||||
// Doesn't work with g++, needs actionf_p1 (don't modify this comment)
|
||||
|
||||
@@ -4772,6 +4772,10 @@ player_t *K_FindJawzTarget(mobj_t *actor, player_t *source)
|
||||
if (player == source)
|
||||
continue;
|
||||
|
||||
// Don't home in on teammates.
|
||||
if (G_GametypeHasTeams() && source->ctfteam == player->ctfteam)
|
||||
continue;
|
||||
|
||||
// Invisible, don't bother
|
||||
if (player->kartstuff[k_hyudorotimer])
|
||||
continue;
|
||||
|
||||
+19
-7
@@ -587,7 +587,14 @@ static int lib_pSpawnAlteredDirectionMissile(lua_State *L)
|
||||
|
||||
static int lib_pColorTeamMissile(lua_State *L)
|
||||
{
|
||||
(void)L;
|
||||
mobj_t *missile = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
player_t *source = *((player_t **)luaL_checkudata(L, 2, META_PLAYER));
|
||||
NOHUD
|
||||
if (!missile)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
if (!source)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
P_ColorTeamMissile(missile, source);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1383,7 +1390,12 @@ static int lib_pPlayerEmeraldBurst(lua_State *L)
|
||||
|
||||
static int lib_pPlayerFlagBurst(lua_State *L)
|
||||
{
|
||||
(void)L;
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
boolean toss = lua_optboolean(L, 2);
|
||||
NOHUD
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
P_PlayerFlagBurst(player, toss);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1949,7 +1961,7 @@ static int lib_sStartSoundAtVolume(lua_State *L)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
}
|
||||
if (!player || P_IsLocalPlayer(player))
|
||||
S_StartSoundAtVolume(origin, sound_id, volume);
|
||||
S_StartSoundAtVolume(origin, sound_id, volume);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2051,7 +2063,7 @@ static int lib_sChangeMusic(lua_State *L)
|
||||
music_flags = (UINT16)((music_num & 0x7FFF0000) >> 16);
|
||||
else
|
||||
#endif
|
||||
music_flags = (UINT16)luaL_optinteger(L, 4, 0);
|
||||
music_flags = (UINT16)luaL_optinteger(L, 4, 0);
|
||||
|
||||
position = (UINT32)luaL_optinteger(L, 5, 0);
|
||||
prefadems = (UINT32)luaL_optinteger(L, 6, 0);
|
||||
@@ -2578,14 +2590,14 @@ static int lib_gIsSpecialStage(lua_State *L)
|
||||
static int lib_gGametypeUsesLives(lua_State *L)
|
||||
{
|
||||
//HUDSAFE
|
||||
lua_pushboolean(L, false);
|
||||
lua_pushboolean(L, G_GametypeUsesLives());
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_gGametypeHasTeams(lua_State *L)
|
||||
{
|
||||
//HUDSAFE
|
||||
lua_pushboolean(L, false);
|
||||
lua_pushboolean(L, G_GametypeHasTeams());
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -2613,7 +2625,7 @@ static int lib_gRaceGametype(lua_State *L)
|
||||
static int lib_gTagGametype(lua_State *L)
|
||||
{
|
||||
//HUDSAFE
|
||||
lua_pushboolean(L, false);
|
||||
lua_pushboolean(L, G_TagGametype());
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -945,6 +945,9 @@ boolean OP_FreezeObjectplace(void)
|
||||
if (!objectplacing)
|
||||
return false;
|
||||
|
||||
if ((maptol & TOL_NIGHTS) && (players[consoleplayer].pflags & PF_NIGHTSMODE))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+33
-4
@@ -3328,19 +3328,34 @@ static void Newgametype_OnChange(void)
|
||||
P_AllocMapHeader((INT16)(cv_nextmap.value-1));
|
||||
|
||||
if ((cv_newgametype.value == GT_RACE && !(mapheaderinfo[cv_nextmap.value-1]->typeoflevel & TOL_RACE)) || // SRB2kart
|
||||
(cv_newgametype.value == GT_MATCH && !(mapheaderinfo[cv_nextmap.value-1]->typeoflevel & TOL_MATCH)))
|
||||
((cv_newgametype.value == GT_MATCH || cv_newgametype.value == GT_TEAMMATCH) && !(mapheaderinfo[cv_nextmap.value-1]->typeoflevel & TOL_MATCH)))
|
||||
{
|
||||
INT32 value = 0;
|
||||
|
||||
switch (cv_newgametype.value)
|
||||
{
|
||||
case GT_COOP:
|
||||
value = TOL_RACE; // SRB2kart
|
||||
break;
|
||||
case GT_COMPETITION:
|
||||
value = TOL_COMPETITION;
|
||||
break;
|
||||
case GT_RACE:
|
||||
value = TOL_RACE;
|
||||
break;
|
||||
case GT_MATCH:
|
||||
case GT_TEAMMATCH:
|
||||
value = TOL_MATCH;
|
||||
break;
|
||||
case GT_TAG:
|
||||
case GT_HIDEANDSEEK:
|
||||
value = TOL_TAG;
|
||||
break;
|
||||
case GT_CTF:
|
||||
value = TOL_CTF;
|
||||
break;
|
||||
}
|
||||
|
||||
CV_SetValue(&cv_nextmap, M_FindFirstMap(value));
|
||||
}
|
||||
}
|
||||
@@ -4462,6 +4477,9 @@ void M_StartControlPanel(void)
|
||||
{
|
||||
MPauseMenu[mpause_switchmap].status = IT_STRING | IT_CALL;
|
||||
MPauseMenu[mpause_addons].status = IT_STRING | IT_CALL;
|
||||
|
||||
if (G_GametypeHasTeams())
|
||||
MPauseMenu[mpause_scramble].status = IT_STRING | IT_SUBMENU;
|
||||
}
|
||||
|
||||
if (server || (!cv_showlocalskinmenus.value))
|
||||
@@ -4482,7 +4500,16 @@ void M_StartControlPanel(void)
|
||||
|
||||
if (netgame)
|
||||
{
|
||||
if (G_GametypeHasSpectators())
|
||||
if (G_GametypeHasTeams())
|
||||
{
|
||||
MPauseMenu[mpause_switchteam].status = IT_STRING | IT_SUBMENU;
|
||||
MPauseMenu[mpause_switchteam].alphaKey += ((splitscreen+1) * 8);
|
||||
MPauseMenu[mpause_localskin].alphaKey += 8;
|
||||
MPauseMenu[mpause_options].alphaKey += 8;
|
||||
MPauseMenu[mpause_title].alphaKey += 8;
|
||||
MPauseMenu[mpause_quit].alphaKey += 8;
|
||||
}
|
||||
else if (G_GametypeHasSpectators())
|
||||
{
|
||||
MPauseMenu[mpause_switchspectate].status = IT_STRING | IT_SUBMENU;
|
||||
MPauseMenu[mpause_switchspectate].alphaKey += ((splitscreen+1) * 8);
|
||||
@@ -4516,7 +4543,9 @@ void M_StartControlPanel(void)
|
||||
{
|
||||
MPauseMenu[mpause_psetup].status = IT_STRING | IT_CALL;
|
||||
|
||||
if (G_GametypeHasSpectators())
|
||||
if (G_GametypeHasTeams())
|
||||
MPauseMenu[mpause_switchteam].status = IT_STRING | IT_SUBMENU;
|
||||
else if (G_GametypeHasSpectators())
|
||||
{
|
||||
if (!players[consoleplayer].spectator)
|
||||
MPauseMenu[mpause_spectate].status = IT_STRING | IT_CALL;
|
||||
@@ -5659,7 +5688,7 @@ boolean M_CanShowLevelInList(INT32 mapnum, INT32 gt)
|
||||
if (M_MapLocked(mapnum+1)) // not unlocked
|
||||
return cv_showallmaps.value;
|
||||
|
||||
if (gt == GT_MATCH && (mapheaderinfo[mapnum]->typeoflevel & TOL_MATCH))
|
||||
if ((gt == GT_MATCH || gt == GT_TEAMMATCH) && (mapheaderinfo[mapnum]->typeoflevel & TOL_MATCH))
|
||||
return true;
|
||||
|
||||
if (gt == GT_RACE && (mapheaderinfo[mapnum]->typeoflevel & TOL_RACE))
|
||||
|
||||
+41
-16
@@ -452,7 +452,10 @@ boolean P_Move(mobj_t *actor, fixed_t speed)
|
||||
I_Assert(movedir < NUMDIRS);
|
||||
|
||||
tryx = actor->x + FixedMul(speed*xspeed[movedir], actor->scale);
|
||||
tryy = actor->y + FixedMul(speed*yspeed[movedir], actor->scale);
|
||||
if (twodlevel || actor->flags2 & MF2_TWOD)
|
||||
tryy = actor->y;
|
||||
else
|
||||
tryy = actor->y + FixedMul(speed*yspeed[movedir], actor->scale);
|
||||
|
||||
if (actor->type == MT_SKIM && !P_WaterInSector(actor, tryx, tryy)) // bail out if sector lacks water
|
||||
return false;
|
||||
@@ -526,6 +529,8 @@ void P_NewChaseDir(mobj_t *actor)
|
||||
else
|
||||
d[1] = DI_NODIR;
|
||||
|
||||
if (twodlevel || actor->flags2 & MF2_TWOD)
|
||||
d[2] = DI_NODIR;
|
||||
if (deltay < -FixedMul(10*FRACUNIT, actor->scale))
|
||||
d[2] = DI_SOUTH;
|
||||
else if (deltay > FixedMul(10*FRACUNIT, actor->scale))
|
||||
@@ -2943,7 +2948,9 @@ void A_Invincibility(mobj_t *actor)
|
||||
if (P_IsLocalPlayer(player) && !player->powers[pw_super])
|
||||
{
|
||||
S_StopMusic();
|
||||
S_ChangeMusicInternal("invinc", false);
|
||||
if (mariomode)
|
||||
G_GhostAddColor((INT32) (player - players), GHC_INVINCIBLE);
|
||||
S_ChangeMusicInternal((mariomode) ? "minvnc" : "invinc", false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3041,7 +3048,11 @@ void A_ExtraLife(mobj_t *actor)
|
||||
return;
|
||||
}
|
||||
|
||||
P_GivePlayerRings(player, 100);
|
||||
// In shooter gametypes, give the player 100 rings instead of an extra life.
|
||||
if (gametype != GT_COOP && gametype != GT_COMPETITION)
|
||||
P_GivePlayerRings(player, 100);
|
||||
else
|
||||
P_GivePlayerLives(player, 1);
|
||||
P_PlayLivesJingle(player);
|
||||
}
|
||||
|
||||
@@ -3723,6 +3734,11 @@ void A_ThrownRing(mobj_t *actor)
|
||||
if (player->mo == actor->target)
|
||||
continue;
|
||||
|
||||
// Don't home in on teammates.
|
||||
if (gametype == GT_CTF
|
||||
&& actor->target->player->ctfteam == player->ctfteam)
|
||||
continue;
|
||||
|
||||
if (actor->target->player->kartstuff[k_position] < player->kartstuff[k_position]) // SRB2kart - Jawz only go after people ahead of you
|
||||
continue;
|
||||
|
||||
@@ -3783,6 +3799,11 @@ static inline boolean PIT_GrenadeRing(mobj_t *thing)
|
||||
|| (G_BattleGametype() && thing->player && thing->player->kartstuff[k_bumper] <= 0 && thing->player->kartstuff[k_comebacktimer])))
|
||||
return true;
|
||||
|
||||
if ((gametype == GT_CTF || gametype == GT_TEAMMATCH)
|
||||
&& !cv_friendlyfire.value && grenade->target->player && thing->player
|
||||
&& grenade->target->player->ctfteam == thing->player->ctfteam) // Don't blow up at your teammates, unless friendlyfire is on
|
||||
return true;
|
||||
|
||||
// see if it went over / under
|
||||
if (grenade->z - explodedist > thing->z + thing->height)
|
||||
return true; // overhead
|
||||
@@ -4484,7 +4505,12 @@ void A_MouseThink(mobj_t *actor)
|
||||
|| (actor->eflags & MFE_VERTICALFLIP && actor->z + actor->height == actor->ceilingz))
|
||||
&& !actor->reactiontime)
|
||||
{
|
||||
if (P_RandomChance(FRACUNIT/2))
|
||||
if (twodlevel || actor->flags2 & MF2_TWOD)
|
||||
{
|
||||
if (P_RandomChance(FRACUNIT/2))
|
||||
actor->angle += ANGLE_180;
|
||||
}
|
||||
else if (P_RandomChance(FRACUNIT/2))
|
||||
actor->angle += ANGLE_90;
|
||||
else
|
||||
actor->angle -= ANGLE_90;
|
||||
@@ -5291,8 +5317,7 @@ void A_RingExplode(mobj_t *actor)
|
||||
// var1 = object # to explode as debris
|
||||
// var2 = unused
|
||||
//
|
||||
void A_OldRingExplode(mobj_t *actor)
|
||||
{
|
||||
void A_OldRingExplode(mobj_t *actor) {
|
||||
UINT8 i;
|
||||
mobj_t *mo;
|
||||
const fixed_t ns = FixedMul(20 * FRACUNIT, actor->scale);
|
||||
@@ -5326,10 +5351,10 @@ void A_OldRingExplode(mobj_t *actor)
|
||||
|
||||
if (changecolor)
|
||||
{
|
||||
if (actor->target->player->ctfteam == 2)
|
||||
mo->color = skincolor_bluering;
|
||||
else
|
||||
if (gametype != GT_CTF)
|
||||
mo->color = actor->target->color; //copy color
|
||||
else if (actor->target->player->ctfteam == 2)
|
||||
mo->color = skincolor_bluering;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5342,10 +5367,10 @@ void A_OldRingExplode(mobj_t *actor)
|
||||
|
||||
if (changecolor)
|
||||
{
|
||||
if (actor->target->player->ctfteam == 2)
|
||||
mo->color = skincolor_bluering;
|
||||
else
|
||||
if (gametype != GT_CTF)
|
||||
mo->color = actor->target->color; //copy color
|
||||
else if (actor->target->player->ctfteam == 2)
|
||||
mo->color = skincolor_bluering;
|
||||
}
|
||||
|
||||
mo = P_SpawnMobj(actor->x, actor->y, actor->z, locvar1);
|
||||
@@ -5357,10 +5382,10 @@ void A_OldRingExplode(mobj_t *actor)
|
||||
|
||||
if (changecolor)
|
||||
{
|
||||
if (actor->target->player->ctfteam == 2)
|
||||
mo->color = skincolor_bluering;
|
||||
else
|
||||
if (gametype != GT_CTF)
|
||||
mo->color = actor->target->color; //copy color
|
||||
else if (actor->target->player->ctfteam == 2)
|
||||
mo->color = skincolor_bluering;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5384,7 +5409,7 @@ void A_MixUp(mobj_t *actor)
|
||||
|
||||
// No mix-up monitors in hide and seek or time only race.
|
||||
// The random factor is okay for other game modes, but in these, it is cripplingly unfair.
|
||||
if (gametype == GT_RACE)
|
||||
if (gametype == GT_HIDEANDSEEK || gametype == GT_RACE)
|
||||
return;
|
||||
|
||||
numplayers = 0;
|
||||
|
||||
+261
-32
@@ -662,6 +662,9 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
|
||||
special->momx = special->momy = special->momz = 0;
|
||||
P_GivePlayerRings(player, 1);
|
||||
|
||||
if ((maptol & TOL_NIGHTS) && special->type != MT_FLINGRING)
|
||||
P_DoNightsScore(player);
|
||||
break;
|
||||
|
||||
case MT_COIN:
|
||||
@@ -671,6 +674,9 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
|
||||
special->momx = special->momy = 0;
|
||||
P_GivePlayerRings(player, 1);
|
||||
|
||||
if ((maptol & TOL_NIGHTS) && special->type != MT_FLINGCOIN)
|
||||
P_DoNightsScore(player);
|
||||
break;
|
||||
case MT_BLUEBALL:
|
||||
if (!(P_CanPickupItem(player, 0)))
|
||||
@@ -684,6 +690,9 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
special->scalespeed = FixedDiv(FixedDiv(special->destscale, special->scale), states[special->info->deathstate].tics<<FRACBITS);
|
||||
else
|
||||
special->scalespeed = 4*FRACUNIT/5;
|
||||
|
||||
if (maptol & TOL_NIGHTS)
|
||||
P_DoNightsScore(player);
|
||||
break;
|
||||
case MT_AUTOPICKUP:
|
||||
case MT_BOUNCEPICKUP:
|
||||
@@ -833,6 +842,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
return;
|
||||
if (special->fuse == 1)
|
||||
return;
|
||||
// if (special->momz > 0)
|
||||
// return;
|
||||
{
|
||||
UINT8 flagteam = (special->type == MT_REDFLAG) ? 1 : 2;
|
||||
const char *flagtext;
|
||||
@@ -1330,6 +1341,10 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
return; // SRB2kart - don't need bubbles mucking with the player
|
||||
if ((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL)
|
||||
return;
|
||||
if (maptol & TOL_NIGHTS)
|
||||
return;
|
||||
if (mariomode)
|
||||
return;
|
||||
else if (toucher->eflags & MFE_VERTICALFLIP)
|
||||
{
|
||||
if (special->z+special->height < toucher->z + toucher->height / 3
|
||||
@@ -1418,36 +1433,46 @@ void P_CheckTimeLimit(void)
|
||||
if (gamestate == GS_LEVEL && (leveltime == (timelimitintics + TICRATE)))
|
||||
S_StartSound(NULL, sfx_strpst);
|
||||
|
||||
//Store the nodes of participating players in an array.
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
// Normal Match
|
||||
if (!G_GametypeHasTeams())
|
||||
{
|
||||
if (playeringame[i] && !players[i].spectator)
|
||||
//Store the nodes of participating players in an array.
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
playerarray[playercount] = i;
|
||||
playercount++;
|
||||
}
|
||||
}
|
||||
|
||||
if (playercount > MAXPLAYERS)
|
||||
playercount = MAXPLAYERS;
|
||||
|
||||
//Sort 'em.
|
||||
for (i = 1; i < playercount; i++)
|
||||
{
|
||||
for (k = i; k < playercount; k++)
|
||||
{
|
||||
if (players[playerarray[i-1]].marescore < players[playerarray[k]].marescore)
|
||||
if (playeringame[i] && !players[i].spectator)
|
||||
{
|
||||
tempplayer = playerarray[i-1];
|
||||
playerarray[i-1] = playerarray[k];
|
||||
playerarray[k] = tempplayer;
|
||||
playerarray[playercount] = i;
|
||||
playercount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//End the round if the top players aren't tied.
|
||||
if (players[playerarray[0]].marescore == players[playerarray[1]].marescore)
|
||||
return;
|
||||
if (playercount > MAXPLAYERS)
|
||||
playercount = MAXPLAYERS;
|
||||
|
||||
//Sort 'em.
|
||||
for (i = 1; i < playercount; i++)
|
||||
{
|
||||
for (k = i; k < playercount; k++)
|
||||
{
|
||||
if (players[playerarray[i-1]].marescore < players[playerarray[k]].marescore)
|
||||
{
|
||||
tempplayer = playerarray[i-1];
|
||||
playerarray[i-1] = playerarray[k];
|
||||
playerarray[k] = tempplayer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//End the round if the top players aren't tied.
|
||||
if (players[playerarray[0]].marescore == players[playerarray[1]].marescore)
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
//In team match and CTF, determining a tie is much simpler. =P
|
||||
if (redscore == bluescore)
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1694,6 +1719,21 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
|
||||
P_UnsetThingPosition(target);
|
||||
target->flags |= MF_NOBLOCKMAP|MF_NOCLIPHEIGHT;
|
||||
P_SetThingPosition(target);
|
||||
|
||||
if (!target->player->bot && !G_IsSpecialStage(gamemap)
|
||||
&& G_GametypeUsesLives())
|
||||
{
|
||||
target->player->lives -= 1; // Lose a life Tails 03-11-2000
|
||||
|
||||
if (target->player->lives <= 0) // Tails 03-14-2000
|
||||
{
|
||||
if (P_IsLocalPlayer(target->player)/* && target->player == &players[consoleplayer] */)
|
||||
{
|
||||
S_StopMusic(); // Stop the Music! Tails 03-14-2000
|
||||
S_ChangeMusicInternal("gmover", false); // Yousa dead now, Okieday? Tails 03-14-2000
|
||||
}
|
||||
}
|
||||
}
|
||||
target->player->playerstate = PST_DEAD;
|
||||
|
||||
if (cv_birdmusic.value && cv_fading.value && P_IsLocalPlayer(target->player))
|
||||
@@ -1745,7 +1785,8 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
|
||||
// Drop stuff.
|
||||
// This determines the kind of object spawned
|
||||
// during the death frame of a thing.
|
||||
if (target->flags & MF_ENEMY)
|
||||
if (!mariomode // Don't show birds, etc. in Mario Mode Tails 12-23-2001
|
||||
&& target->flags & MF_ENEMY)
|
||||
{
|
||||
if (cv_soniccd.value)
|
||||
item = MT_SEED;
|
||||
@@ -2118,9 +2159,90 @@ static inline void P_NiGHTSDamage(mobj_t *target, mobj_t *source)
|
||||
}
|
||||
}
|
||||
|
||||
static inline boolean P_PlayerHitsPlayer(mobj_t *target, mobj_t *source)
|
||||
static inline boolean P_TagDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage)
|
||||
{
|
||||
player_t *player = target->player;
|
||||
(void)damage; //unused parm
|
||||
|
||||
// If flashing or invulnerable, ignore the tag,
|
||||
if (player->powers[pw_flashing] || player->powers[pw_invulnerability])
|
||||
return false;
|
||||
|
||||
// Ignore IT players shooting each other, unless friendlyfire is on.
|
||||
if ((player->pflags & PF_TAGIT && !(cv_friendlyfire.value &&
|
||||
source && source->player && source->player->pflags & PF_TAGIT)))
|
||||
return false;
|
||||
|
||||
// Don't allow any damage before the round starts.
|
||||
if (leveltime <= hidetime * TICRATE)
|
||||
return false;
|
||||
|
||||
// Don't allow players on the same team to hurt one another,
|
||||
// unless cv_friendlyfire is on.
|
||||
if (!cv_friendlyfire.value && (player->pflags & PF_TAGIT) == (source->player->pflags & PF_TAGIT))
|
||||
{
|
||||
if (!(inflictor->flags & MF_FIRE))
|
||||
P_GivePlayerRings(player, 1);
|
||||
if (inflictor->flags2 & MF2_BOUNCERING)
|
||||
inflictor->fuse = 0; // bounce ring disappears at -1 not 0
|
||||
return false;
|
||||
}
|
||||
|
||||
P_DoPlayerPain(player, source, inflictor);
|
||||
|
||||
// Check for a shield
|
||||
if (player->powers[pw_shield])
|
||||
{
|
||||
P_RemoveShield(player);
|
||||
S_StartSound(target, sfx_shldls);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (target->health <= 1) // Death
|
||||
{
|
||||
P_PlayDeathSound(target);
|
||||
P_PlayVictorySound(source); // Killer laughs at you! LAUGHS! BWAHAHAHHAHAA!!
|
||||
}
|
||||
else if (target->health > 1) // Ring loss
|
||||
{
|
||||
P_PlayRinglossSound(target, source);
|
||||
P_PlayerRingBurst(player, player->mo->health - 1);
|
||||
}
|
||||
|
||||
if (inflictor && ((inflictor->flags & MF_MISSILE) || inflictor->player) && player->powers[pw_super] && ALL7EMERALDS(player->powers[pw_emeralds]))
|
||||
{
|
||||
player->health -= 10;
|
||||
if (player->health < 2)
|
||||
player->health = 2;
|
||||
target->health = player->health;
|
||||
}
|
||||
else
|
||||
player->health = target->health = 1;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline boolean P_PlayerHitsPlayer(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage)
|
||||
{
|
||||
player_t *player = target->player;
|
||||
|
||||
// Tag handling
|
||||
if (G_TagGametype())
|
||||
return P_TagDamage(target, inflictor, source, damage);
|
||||
else if (G_GametypeHasTeams()) // CTF + Team Match
|
||||
{
|
||||
// Don't allow players on the same team to hurt one another,
|
||||
// unless cv_friendlyfire is on.
|
||||
if (!cv_friendlyfire.value && target->player->ctfteam == source->player->ctfteam)
|
||||
{
|
||||
if (!(inflictor->flags & MF_FIRE))
|
||||
P_GivePlayerRings(target->player, 1);
|
||||
if (inflictor->flags2 & MF2_BOUNCERING)
|
||||
inflictor->fuse = 0; // bounce ring disappears at -1 not 0
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Add pity.
|
||||
if (!player->powers[pw_flashing] && !player->powers[pw_invulnerability] && !player->powers[pw_super]
|
||||
@@ -2361,6 +2483,9 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
||||
{
|
||||
if (player->exiting)
|
||||
return false;
|
||||
|
||||
if (!(target->player->pflags & (PF_NIGHTSMODE|PF_NIGHTSFALL)) && (maptol & TOL_NIGHTS))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (player->pflags & PF_NIGHTSMODE) // NiGHTS damage handling
|
||||
@@ -2369,6 +2494,10 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
||||
{
|
||||
if (source == target)
|
||||
return false; // Don't hit yourself with your own paraloop, baka
|
||||
if (source && source->player && !cv_friendlyfire.value
|
||||
&& (gametype == GT_COOP
|
||||
|| (G_GametypeHasTeams() && target->player->ctfteam == source->player->ctfteam)))
|
||||
return false; // Don't run eachother over in special stages and team games and such
|
||||
}
|
||||
|
||||
if (LUA_HookMobjDamage(target, inflictor, source, damage))
|
||||
@@ -2401,7 +2530,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
||||
// Player hits another player
|
||||
if (!force && source && source->player)
|
||||
{
|
||||
if (!P_PlayerHitsPlayer(target, source))
|
||||
if (!P_PlayerHitsPlayer(target, inflictor, source, damage))
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2455,6 +2584,9 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
||||
if (player->health < 2)
|
||||
player->health = 2;
|
||||
}
|
||||
|
||||
if (gametype == GT_CTF && (player->gotflag & (GF_REDFLAG|GF_BLUEFLAG)))
|
||||
P_PlayerFlagBurst(player, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2606,7 +2738,9 @@ void P_PlayerRingBurst(player_t *player, INT32 num_rings)
|
||||
{
|
||||
ns = FixedMul(((i*FRACUNIT)/16)+2*FRACUNIT, mo->scale);
|
||||
mo->momx = FixedMul(FINECOSINE(fa),ns);
|
||||
mo->momy = FixedMul(FINESINE(fa),ns);
|
||||
|
||||
if (!(twodlevel || (player->mo->flags2 & MF2_TWOD)))
|
||||
mo->momy = FixedMul(FINESINE(fa),ns);
|
||||
|
||||
P_SetObjectMomZ(mo, 8*FRACUNIT, false);
|
||||
mo->fuse = 20*TICRATE; // Adjust fuse for NiGHTS
|
||||
@@ -2628,7 +2762,9 @@ void P_PlayerRingBurst(player_t *player, INT32 num_rings)
|
||||
|
||||
ns = FixedMul(momxy, mo->scale);
|
||||
mo->momx = FixedMul(FINECOSINE(fa),ns);
|
||||
mo->momy = FixedMul(FINESINE(fa),ns);
|
||||
|
||||
if (!(twodlevel || (player->mo->flags2 & MF2_TWOD)))
|
||||
mo->momy = FixedMul(FINESINE(fa),ns);
|
||||
|
||||
ns = momz;
|
||||
P_SetObjectMomZ(mo, ns, false);
|
||||
@@ -2733,7 +2869,9 @@ void P_PlayerWeaponPanelBurst(player_t *player)
|
||||
// >16 ring type spillout
|
||||
ns = FixedMul(3*FRACUNIT, mo->scale);
|
||||
mo->momx = FixedMul(FINECOSINE(fa),ns);
|
||||
mo->momy = FixedMul(FINESINE(fa),ns);
|
||||
|
||||
if (!(twodlevel || (player->mo->flags2 & MF2_TWOD)))
|
||||
mo->momy = FixedMul(FINESINE(fa),ns);
|
||||
|
||||
P_SetObjectMomZ(mo, 4*FRACUNIT, false);
|
||||
|
||||
@@ -2815,7 +2953,9 @@ void P_PlayerWeaponAmmoBurst(player_t *player)
|
||||
// Spill them!
|
||||
ns = FixedMul(2*FRACUNIT, mo->scale);
|
||||
mo->momx = FixedMul(FINECOSINE(fa), ns);
|
||||
mo->momy = FixedMul(FINESINE(fa),ns);
|
||||
|
||||
if (!(twodlevel || (player->mo->flags2 & MF2_TWOD)))
|
||||
mo->momy = FixedMul(FINESINE(fa),ns);
|
||||
|
||||
P_SetObjectMomZ(mo, 3*FRACUNIT, false);
|
||||
|
||||
@@ -2929,7 +3069,11 @@ void P_PlayerEmeraldBurst(player_t *player, boolean toss)
|
||||
}
|
||||
|
||||
momx = FixedMul(FINECOSINE(fa), ns);
|
||||
momy = FixedMul(FINESINE(fa),ns);
|
||||
|
||||
if (!(twodlevel || (player->mo->flags2 & MF2_TWOD)))
|
||||
momy = FixedMul(FINESINE(fa),ns);
|
||||
else
|
||||
momy = 0;
|
||||
|
||||
mo = P_SpawnMobj(player->mo->x, player->mo->y, z, MT_FLINGEMERALD);
|
||||
mo->health = 1;
|
||||
@@ -2953,3 +3097,88 @@ void P_PlayerEmeraldBurst(player_t *player, boolean toss)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Makes an injured or dead player lose possession of the flag.
|
||||
*
|
||||
* \param player The player with the flag, about to lose it.
|
||||
* \sa P_PlayerRingBurst
|
||||
*/
|
||||
void P_PlayerFlagBurst(player_t *player, boolean toss)
|
||||
{
|
||||
mobj_t *flag;
|
||||
mobjtype_t type;
|
||||
|
||||
if (!(player->gotflag & (GF_REDFLAG|GF_BLUEFLAG)))
|
||||
return;
|
||||
|
||||
if (player->gotflag & GF_REDFLAG)
|
||||
type = MT_REDFLAG;
|
||||
else
|
||||
type = MT_BLUEFLAG;
|
||||
|
||||
flag = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, type);
|
||||
|
||||
if (player->mo->eflags & MFE_VERTICALFLIP)
|
||||
flag->z += player->mo->height - flag->height;
|
||||
|
||||
if (toss)
|
||||
P_InstaThrust(flag, player->mo->angle, FixedMul(6*FRACUNIT, player->mo->scale));
|
||||
else
|
||||
{
|
||||
angle_t fa = P_RandomByte()*FINEANGLES/256;
|
||||
flag->momx = FixedMul(FINECOSINE(fa), FixedMul(6*FRACUNIT, player->mo->scale));
|
||||
if (!(twodlevel || (player->mo->flags2 & MF2_TWOD)))
|
||||
flag->momy = FixedMul(FINESINE(fa), FixedMul(6*FRACUNIT, player->mo->scale));
|
||||
}
|
||||
|
||||
flag->momz = FixedMul(8*FRACUNIT, player->mo->scale);
|
||||
if (player->mo->eflags & MFE_VERTICALFLIP)
|
||||
flag->momz = -flag->momz;
|
||||
|
||||
if (type == MT_REDFLAG)
|
||||
flag->spawnpoint = rflagpoint;
|
||||
else
|
||||
flag->spawnpoint = bflagpoint;
|
||||
|
||||
flag->fuse = cv_flagtime.value * TICRATE;
|
||||
P_SetTarget(&flag->target, player->mo);
|
||||
|
||||
// Flag text
|
||||
char plname[MAXPLAYERNAME+4];
|
||||
const char *flagtext;
|
||||
char flagcolor;
|
||||
|
||||
snprintf(plname, sizeof(plname), "%s%s%s",
|
||||
CTFTEAMCODE(player),
|
||||
player_names[player - players],
|
||||
CTFTEAMENDCODE(player));
|
||||
|
||||
if (type == MT_REDFLAG)
|
||||
{
|
||||
flagtext = M_GetText("Red flag");
|
||||
flagcolor = '\x85';
|
||||
}
|
||||
else
|
||||
{
|
||||
flagtext = M_GetText("Blue flag");
|
||||
flagcolor = '\x84';
|
||||
}
|
||||
|
||||
if (toss)
|
||||
CONS_Printf(M_GetText("%s tossed the %c%s%c.\n"), plname, flagcolor, flagtext, 0x80);
|
||||
else
|
||||
CONS_Printf(M_GetText("%s dropped the %c%s%c.\n"), plname, flagcolor, flagtext, 0x80);
|
||||
|
||||
player->gotflag = 0;
|
||||
|
||||
// Pointers set for displaying time value and for consistency restoration.
|
||||
if (type == MT_REDFLAG)
|
||||
redflag = flag;
|
||||
else
|
||||
blueflag = flag;
|
||||
|
||||
if (toss)
|
||||
player->tossdelay = 2*TICRATE;
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -57,6 +57,9 @@
|
||||
|
||||
#define AIMINGTOSLOPE(aiming) FINESINE((aiming>>ANGLETOFINESHIFT) & FINEMASK)
|
||||
|
||||
#define mariomode (maptol & TOL_MARIO)
|
||||
#define twodlevel (maptol & TOL_2D)
|
||||
|
||||
//
|
||||
// P_TICK
|
||||
//
|
||||
@@ -289,6 +292,7 @@ mobj_t *P_SPMAngle(mobj_t *source, mobjtype_t type, angle_t angle, UINT8 aimtype
|
||||
#ifdef SEENAMES
|
||||
#define P_SpawnNameFinder(s,t) P_SPMAngle(s,t,s->angle,true,0)
|
||||
#endif
|
||||
void P_ColorTeamMissile(mobj_t *missile, player_t *source);
|
||||
|
||||
// P_MobjFlip
|
||||
// Special utility to return +1 or -1 depending on mobj's gravity
|
||||
@@ -440,6 +444,7 @@ void P_PlayerWeaponAmmoBurst(player_t *player);
|
||||
void P_PlayerEmeraldBurst(player_t *player, boolean toss);
|
||||
|
||||
void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck);
|
||||
void P_PlayerFlagBurst(player_t *player, boolean toss);
|
||||
void P_CheckTimeLimit(void);
|
||||
void P_CheckPointLimit(void);
|
||||
boolean P_CheckRacers(void);
|
||||
|
||||
+32
-3
@@ -371,6 +371,11 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
||||
if (!(thing->flags & (MF_SOLID|MF_SPECIAL|MF_PAIN|MF_SHOOTABLE)) || (thing->flags & MF_NOCLIPTHING))
|
||||
return true;
|
||||
|
||||
// Don't collide with your buddies while NiGHTS-flying.
|
||||
if (tmthing->player && thing->player && (maptol & TOL_NIGHTS)
|
||||
&& ((tmthing->player->pflags & PF_NIGHTSMODE) || (thing->player->pflags & PF_NIGHTSMODE)))
|
||||
return true;
|
||||
|
||||
blockdist = thing->radius + tmthing->radius;
|
||||
|
||||
if (abs(thing->x - tmx) >= blockdist || abs(thing->y - tmy) >= blockdist)
|
||||
@@ -2287,6 +2292,7 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||
{
|
||||
subsector_t *s = R_PointInSubsector(x, y);
|
||||
boolean retval = true;
|
||||
boolean itsatwodlevel = false;
|
||||
UINT8 i;
|
||||
|
||||
floatok = false;
|
||||
@@ -2294,7 +2300,22 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||
if (dedicated) // this crashes so don't even try it
|
||||
return false;
|
||||
|
||||
if (players[displayplayers[0]].mo)
|
||||
if (twodlevel)
|
||||
itsatwodlevel = true;
|
||||
else
|
||||
{
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
if (thiscam == &camera[i] && players[displayplayers[i]].mo
|
||||
&& (players[displayplayers[i]].mo->flags2 & MF2_TWOD))
|
||||
{
|
||||
itsatwodlevel = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!itsatwodlevel && players[displayplayers[0]].mo)
|
||||
{
|
||||
fixed_t tryx = thiscam->x;
|
||||
fixed_t tryy = thiscam->y;
|
||||
@@ -3288,8 +3309,16 @@ stairstep:
|
||||
|
||||
P_HitSlideLine(bestslideline); // clip the moves
|
||||
|
||||
mo->momx = tmxmove;
|
||||
mo->momy = tmymove;
|
||||
if ((twodlevel || (mo->flags2 & MF2_TWOD)) && mo->player)
|
||||
{
|
||||
mo->momx = tmxmove;
|
||||
tmymove = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
mo->momx = tmxmove;
|
||||
mo->momy = tmymove;
|
||||
}
|
||||
|
||||
do {
|
||||
if (tmxmove > mo->radius) {
|
||||
|
||||
+167
-31
@@ -1183,7 +1183,7 @@ static void P_XYFriction(mobj_t *mo, fixed_t oldx, fixed_t oldy)
|
||||
}
|
||||
else if (abs(player->rmomx) < FixedMul(STOPSPEED, mo->scale)
|
||||
&& abs(player->rmomy) < FixedMul(STOPSPEED, mo->scale)
|
||||
&& (!player->cmd.forwardmove && !player->cmd.sidemove && !(player->pflags & PF_SPINNING))
|
||||
&& (!(player->cmd.forwardmove && !(twodlevel || mo->flags2 & MF2_TWOD)) && !player->cmd.sidemove && !(player->pflags & PF_SPINNING))
|
||||
&& !(player->mo->standingslope && (!(player->mo->standingslope->flags & SL_NOPHYSICS)) && (abs(player->mo->standingslope->zdelta) >= FRACUNIT/2))
|
||||
)
|
||||
{
|
||||
@@ -2226,7 +2226,10 @@ static boolean P_ZMovement(mobj_t *mo)
|
||||
|| mo->type == MT_CANNONBALLDECOR
|
||||
|| mo->type == MT_FALLINGROCK)
|
||||
{
|
||||
mom.z = -FixedMul(mom.z, FixedDiv(17*FRACUNIT,20*FRACUNIT));
|
||||
if (maptol & TOL_NIGHTS)
|
||||
mom.z = -FixedDiv(mom.z, 10*FRACUNIT);
|
||||
else
|
||||
mom.z = -FixedMul(mom.z, FixedDiv(17*FRACUNIT,20*FRACUNIT));
|
||||
|
||||
if (mo->type == MT_BIGTUMBLEWEED || mo->type == MT_LITTLETUMBLEWEED)
|
||||
{
|
||||
@@ -2364,7 +2367,12 @@ static boolean P_ZMovement(mobj_t *mo)
|
||||
else
|
||||
// Flags bounce
|
||||
if (mo->type == MT_REDFLAG || mo->type == MT_BLUEFLAG)
|
||||
mo->momz = -FixedMul(mo->momz, FixedDiv(17*FRACUNIT,20*FRACUNIT));
|
||||
{
|
||||
if (maptol & TOL_NIGHTS)
|
||||
mo->momz = -FixedDiv(mo->momz, 10*FRACUNIT);
|
||||
else
|
||||
mo->momz = -FixedMul(mo->momz, FixedDiv(17*FRACUNIT,20*FRACUNIT));
|
||||
}
|
||||
else
|
||||
mo->momz = 0;
|
||||
}
|
||||
@@ -2670,6 +2678,10 @@ nightsdone:
|
||||
} // Ugly ugly billions of braces! Argh!
|
||||
}
|
||||
|
||||
// hit the ceiling
|
||||
if (mariomode)
|
||||
S_StartSound(mo, sfx_mario1);
|
||||
|
||||
if (!mo->player->climbing)
|
||||
mo->momz = 0;
|
||||
}
|
||||
@@ -3233,6 +3245,7 @@ void P_DestroyRobots(void)
|
||||
// the below is chasecam only, if you're curious. check out P_CalcPostImg in p_user.c for first person
|
||||
static void P_CalcChasePostImg(player_t *player, camera_t *thiscam)
|
||||
{
|
||||
boolean itsatwodlevel = false;
|
||||
const boolean flipcam = (player->pflags & PF_FLIPCAM && !(player->pflags & PF_NIGHTSMODE) && player->mo->eflags & MFE_VERTICALFLIP);
|
||||
UINT16 postimgflags = 0;
|
||||
UINT8 i;
|
||||
@@ -3242,6 +3255,21 @@ static void P_CalcChasePostImg(player_t *player, camera_t *thiscam)
|
||||
if (flipcam)
|
||||
postimgflags |= POSTIMG_FLIP;
|
||||
|
||||
if (twodlevel)
|
||||
itsatwodlevel = true;
|
||||
else
|
||||
{
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
if (thiscam == &camera[i] && players[displayplayers[i]].mo
|
||||
&& (players[displayplayers[i]].mo->flags2 & MF2_TWOD))
|
||||
{
|
||||
itsatwodlevel = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (player->awayviewtics && player->awayviewmobj && !P_MobjWasRemoved(player->awayviewmobj)) // Camera must obviously exist
|
||||
{
|
||||
camera_t dummycam;
|
||||
@@ -3315,9 +3343,8 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef NOCLIPCAM
|
||||
if (!itsatwodlevel)
|
||||
P_CheckCameraPosition(thiscam->x, thiscam->y, thiscam);
|
||||
#endif
|
||||
|
||||
thiscam->subsector = R_PointInSubsectorFast(thiscam->x, thiscam->y);
|
||||
thiscam->floorz = tmfloorz;
|
||||
@@ -3329,7 +3356,7 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
|
||||
thiscam->z += thiscam->momz + player->mo->pmomz;
|
||||
|
||||
#ifndef NOCLIPCAM
|
||||
if (!(player->pflags & PF_NOCLIP || leveltime < introtime))
|
||||
if (!itsatwodlevel && !(player->pflags & PF_NOCLIP || leveltime < introtime))
|
||||
{
|
||||
// clip movement
|
||||
if (thiscam->z <= thiscam->floorz) // hit the floor
|
||||
@@ -3372,13 +3399,13 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
|
||||
#endif
|
||||
}
|
||||
|
||||
if (thiscam->ceilingz - thiscam->z < thiscam->height
|
||||
&& thiscam->ceilingz >= thiscam->z)
|
||||
if (itsatwodlevel
|
||||
|| (thiscam->ceilingz - thiscam->z < thiscam->height
|
||||
&& thiscam->ceilingz >= thiscam->z))
|
||||
{
|
||||
thiscam->ceilingz = thiscam->z + thiscam->height;
|
||||
thiscam->floorz = thiscam->z;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -10531,8 +10558,11 @@ void P_RespawnSpecials(void)
|
||||
}
|
||||
|
||||
//CTF rings should continue to respawn as normal rings outside of CTF.
|
||||
if (i == MT_REDTEAMRING || i == MT_BLUETEAMRING)
|
||||
i = MT_RING;
|
||||
if (gametype != GT_CTF)
|
||||
{
|
||||
if (i == MT_REDTEAMRING || i == MT_BLUETEAMRING)
|
||||
i = MT_RING;
|
||||
}
|
||||
|
||||
if (mthing->options & MTF_OBJECTFLIP)
|
||||
{
|
||||
@@ -10605,7 +10635,48 @@ void P_SpawnPlayer(INT32 playernum)
|
||||
}
|
||||
else if (multiplayer && !netgame)
|
||||
{
|
||||
p->spectator = false;
|
||||
// If you're in a team game and you don't have a team assigned yet...
|
||||
if (G_GametypeHasTeams() && p->ctfteam == 0)
|
||||
{
|
||||
changeteam_union NetPacket;
|
||||
UINT16 usvalue;
|
||||
NetPacket.value.l = NetPacket.value.b = 0;
|
||||
|
||||
// Spawn as a spectator,
|
||||
// yes even in splitscreen mode
|
||||
p->spectator = true;
|
||||
p->spectatorreentry = 0; //(cv_spectatorreentry.value * TICRATE);
|
||||
|
||||
if (playernum&1) p->skincolor = skincolor_redteam;
|
||||
else p->skincolor = skincolor_blueteam;
|
||||
|
||||
// but immediately send a team change packet.
|
||||
NetPacket.packet.playernum = playernum;
|
||||
NetPacket.packet.verification = true;
|
||||
NetPacket.packet.newteam = !(playernum&1) + 1;
|
||||
|
||||
usvalue = SHORT(NetPacket.value.l|NetPacket.value.b);
|
||||
SendNetXCmd(XD_TEAMCHANGE, &usvalue, sizeof(usvalue));
|
||||
}
|
||||
else // Otherwise, never spectator.
|
||||
p->spectator = false;
|
||||
}
|
||||
|
||||
if (G_GametypeHasTeams())
|
||||
{
|
||||
// Fix stupid non spectator spectators.
|
||||
if (!p->spectator && !p->ctfteam)
|
||||
{
|
||||
p->spectator = true;
|
||||
p->spectatorreentry = 0; //(cv_spectatorreentry.value * TICRATE);
|
||||
}
|
||||
|
||||
// Fix team colors.
|
||||
// This code isn't being done right somewhere else. Oh well.
|
||||
if (p->ctfteam == 1)
|
||||
p->skincolor = skincolor_redteam;
|
||||
else if (p->ctfteam == 2)
|
||||
p->skincolor = skincolor_blueteam;
|
||||
}
|
||||
|
||||
mobj = P_SpawnMobj(0, 0, 0, MT_PLAYER);
|
||||
@@ -11006,14 +11077,36 @@ void P_SpawnMapThing(mapthing_t *mthing)
|
||||
return;
|
||||
|
||||
if (i >= MT_EMERALD1 && i <= MT_EMERALD7) // Pickupable Emeralds
|
||||
return;
|
||||
{
|
||||
if (gametype != GT_COOP) // Don't place emeralds in non-coop modes
|
||||
return;
|
||||
|
||||
if (metalrecording)
|
||||
return; // Metal Sonic isn't for collecting emeralds.
|
||||
|
||||
if (emeralds & mobjinfo[i].speed) // You already have this emerald!
|
||||
return;
|
||||
}
|
||||
|
||||
if (!G_BattleGametype() || !cv_specialrings.value)
|
||||
if (P_WeaponOrPanel(i))
|
||||
return; // Don't place weapons/panels in non-ringslinger modes
|
||||
|
||||
if (i == MT_EMERHUNT)
|
||||
{
|
||||
// Emerald Hunt is Coop only.
|
||||
if (gametype != GT_COOP)
|
||||
return;
|
||||
|
||||
ss = R_PointInSubsector(mthing->x << FRACBITS, mthing->y << FRACBITS);
|
||||
mthing->z = (INT16)(((
|
||||
ss->sector->f_slope ? P_GetZAt(ss->sector->f_slope, mthing->x << FRACBITS, mthing->y << FRACBITS) :
|
||||
ss->sector->floorheight)>>FRACBITS) + (mthing->options >> ZSHIFT));
|
||||
|
||||
if (numhuntemeralds < MAXHUNTEMERALDS)
|
||||
huntemeralds[numhuntemeralds++] = mthing;
|
||||
return;
|
||||
}
|
||||
|
||||
if (i == MT_EMERALDSPAWN)
|
||||
{
|
||||
@@ -11030,28 +11123,56 @@ void P_SpawnMapThing(mapthing_t *mthing)
|
||||
if ((mobjinfo[i].flags & MF_ENEMY) || (mobjinfo[i].flags & MF_BOSS))
|
||||
return;
|
||||
|
||||
// Set powerup boxes to user settings for other netplay modes
|
||||
if ((mobjinfo[i].flags & MF_MONITOR) && cv_matchboxes.value) // not Normal
|
||||
// Set powerup boxes to user settings for competition.
|
||||
if (gametype == GT_COMPETITION)
|
||||
{
|
||||
if (cv_matchboxes.value == 1) // Random
|
||||
i = MT_QUESTIONBOX;
|
||||
else if (cv_matchboxes.value == 3) // Don't spawn
|
||||
return;
|
||||
else // cv_matchboxes.value == 2, Non-Random
|
||||
if ((mobjinfo[i].flags & MF_MONITOR) && cv_competitionboxes.value) // not Normal
|
||||
{
|
||||
if (i == MT_QUESTIONBOX)
|
||||
return; // don't spawn in Non-Random
|
||||
|
||||
mthing->options &= ~(MTF_AMBUSH|MTF_OBJECTSPECIAL); // no random respawning!
|
||||
if (cv_competitionboxes.value == 1) // Random
|
||||
i = MT_QUESTIONBOX;
|
||||
else if (cv_competitionboxes.value == 2) // Teleports
|
||||
i = MT_MIXUPBOX;
|
||||
else if (cv_competitionboxes.value == 3) // None
|
||||
return; // Don't spawn!
|
||||
}
|
||||
}
|
||||
|
||||
if (i == MT_BLUETEAMRING || i == MT_REDTEAMRING)
|
||||
i = MT_RING;
|
||||
else if (i == MT_BLUERINGBOX || i == MT_REDRINGBOX)
|
||||
i = MT_SUPERRINGBOX;
|
||||
else if (i == MT_BLUEFLAG || i == MT_REDFLAG)
|
||||
return; // No flags in non-CTF modes!
|
||||
// Set powerup boxes to user settings for other netplay modes
|
||||
else if (gametype != GT_COOP)
|
||||
{
|
||||
if ((mobjinfo[i].flags & MF_MONITOR) && cv_matchboxes.value) // not Normal
|
||||
{
|
||||
if (cv_matchboxes.value == 1) // Random
|
||||
i = MT_QUESTIONBOX;
|
||||
else if (cv_matchboxes.value == 3) // Don't spawn
|
||||
return;
|
||||
else // cv_matchboxes.value == 2, Non-Random
|
||||
{
|
||||
if (i == MT_QUESTIONBOX)
|
||||
return; // don't spawn in Non-Random
|
||||
|
||||
mthing->options &= ~(MTF_AMBUSH|MTF_OBJECTSPECIAL); // no random respawning!
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (gametype != GT_CTF) // CTF specific things
|
||||
{
|
||||
if (i == MT_BLUETEAMRING || i == MT_REDTEAMRING)
|
||||
i = MT_RING;
|
||||
else if (i == MT_BLUERINGBOX || i == MT_REDRINGBOX)
|
||||
i = MT_SUPERRINGBOX;
|
||||
else if (i == MT_BLUEFLAG || i == MT_REDFLAG)
|
||||
return; // No flags in non-CTF modes!
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((i == MT_BLUEFLAG && blueflag) || (i == MT_REDFLAG && redflag))
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, M_GetText("Only one flag per team allowed in CTF!\n"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!G_RaceGametype() && (i == MT_SIGN || i == MT_STARPOST))
|
||||
return; // Don't spawn exit signs or starposts in wrong game modes
|
||||
@@ -11082,7 +11203,7 @@ void P_SpawnMapThing(mapthing_t *mthing)
|
||||
return; // No rings in Ultimate mode (except special stages)
|
||||
}
|
||||
|
||||
if (i == MT_EMMY && (ultimatemode || tokenbits == 30 || tokenlist & (1 << tokenbits++)))
|
||||
if (i == MT_EMMY && (gametype != GT_COOP || ultimatemode || tokenbits == 30 || tokenlist & (1 << tokenbits++)))
|
||||
return; // you already got this token, or there are too many, or the gametype's not right
|
||||
|
||||
// Objectplace landing point
|
||||
@@ -12257,6 +12378,21 @@ mobj_t *P_SpawnMissile(mobj_t *source, mobj_t *dest, mobjtype_t type)
|
||||
return dist ? th : NULL;
|
||||
}
|
||||
|
||||
//
|
||||
// P_ColorTeamMissile
|
||||
// Colors a player's ring based on their team
|
||||
//
|
||||
void P_ColorTeamMissile(mobj_t *missile, player_t *source)
|
||||
{
|
||||
if (G_GametypeHasTeams())
|
||||
{
|
||||
if (source->ctfteam == 2)
|
||||
missile->color = skincolor_bluering;
|
||||
else if (source->ctfteam == 1)
|
||||
missile->color = skincolor_redring;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// P_SPMAngle
|
||||
// Fires missile at angle from what is presumably a player
|
||||
|
||||
+138
-1
@@ -319,6 +319,8 @@ static void P_ClearSingleMapHeaderInfo(INT16 i)
|
||||
mapheaderinfo[num]->saveoverride = SAVE_DEFAULT;
|
||||
mapheaderinfo[num]->levelflags = 0;
|
||||
mapheaderinfo[num]->menuflags = (mainwads ? 0 : LF2_EXISTSHACK); // see p_setup.c - prevents replacing maps in addons with easier versions
|
||||
// TODO grades support for delfile (pfft yeah right)
|
||||
P_DeleteGrades(num);
|
||||
// SRB2Kart
|
||||
//mapheaderinfo[num]->automap = false;
|
||||
mapheaderinfo[num]->mobj_scale = FRACUNIT;
|
||||
@@ -350,6 +352,103 @@ void P_AllocMapHeader(INT16 i)
|
||||
P_ClearSingleMapHeaderInfo(i + 1);
|
||||
}
|
||||
|
||||
/** NiGHTS Grades are a special structure,
|
||||
* we initialize them here.
|
||||
*
|
||||
* \param i Index of header to allocate grades for
|
||||
* \param mare The mare we're adding grades for
|
||||
* \param grades the string from DeHackEd, we work with it ourselves
|
||||
*/
|
||||
void P_AddGradesForMare(INT16 i, UINT8 mare, char *gtext)
|
||||
{
|
||||
INT32 g;
|
||||
char *spos = gtext;
|
||||
|
||||
CONS_Debug(DBG_SETUP, "Map %d Mare %d: ", i+1, (UINT16)mare+1);
|
||||
|
||||
if (mapheaderinfo[i]->numGradedMares < mare+1)
|
||||
{
|
||||
mapheaderinfo[i]->numGradedMares = mare+1;
|
||||
mapheaderinfo[i]->grades = Z_Realloc(mapheaderinfo[i]->grades, sizeof(nightsgrades_t) * mapheaderinfo[i]->numGradedMares, PU_STATIC, NULL);
|
||||
}
|
||||
|
||||
for (g = 0; g < 6; ++g)
|
||||
{
|
||||
// Allow "partial" grading systems
|
||||
if (spos != NULL)
|
||||
{
|
||||
mapheaderinfo[i]->grades[mare].grade[g] = atoi(spos);
|
||||
CONS_Debug(DBG_SETUP, "%u ", atoi(spos));
|
||||
// Grab next comma
|
||||
spos = strchr(spos, ',');
|
||||
if (spos)
|
||||
++spos;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Grade not reachable
|
||||
mapheaderinfo[i]->grades[mare].grade[g] = UINT32_MAX;
|
||||
}
|
||||
}
|
||||
|
||||
CONS_Debug(DBG_SETUP, "\n");
|
||||
}
|
||||
|
||||
/** And this removes the grades safely.
|
||||
*
|
||||
* \param i The header to remove grades from
|
||||
*/
|
||||
void P_DeleteGrades(INT16 i)
|
||||
{
|
||||
if (mapheaderinfo[i]->grades)
|
||||
Z_Free(mapheaderinfo[i]->grades);
|
||||
|
||||
mapheaderinfo[i]->grades = NULL;
|
||||
mapheaderinfo[i]->numGradedMares = 0;
|
||||
}
|
||||
|
||||
/** And this fetches the grades
|
||||
*
|
||||
* \param pscore The player's score.
|
||||
* \param map The game map.
|
||||
* \param mare The mare to test.
|
||||
*/
|
||||
UINT8 P_GetGrade(UINT32 pscore, INT16 map, UINT8 mare)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
// Determining the grade
|
||||
if (mapheaderinfo[map-1] && mapheaderinfo[map-1]->grades && mapheaderinfo[map-1]->numGradedMares >= mare + 1)
|
||||
{
|
||||
INT32 pgrade = 0;
|
||||
for (i = 0; i < 6; ++i)
|
||||
{
|
||||
if (pscore >= mapheaderinfo[map-1]->grades[mare].grade[i])
|
||||
++pgrade;
|
||||
}
|
||||
return (UINT8)pgrade;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
UINT8 P_HasGrades(INT16 map, UINT8 mare)
|
||||
{
|
||||
// Determining the grade
|
||||
// Mare 0 is treated as overall and is true if ANY grades exist
|
||||
if (mapheaderinfo[map-1] && mapheaderinfo[map-1]->grades
|
||||
&& (mare == 0 || mapheaderinfo[map-1]->numGradedMares >= mare))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
UINT32 P_GetScoreForGrade(INT16 map, UINT8 mare, UINT8 grade)
|
||||
{
|
||||
// Get the score for the grade... if it exists
|
||||
if (grade == GRADE_F || grade > GRADE_S || !P_HasGrades(map, mare)) return 0;
|
||||
|
||||
return mapheaderinfo[map-1]->grades[mare].grade[grade-1];
|
||||
}
|
||||
|
||||
// Loads the vertexes for a level.
|
||||
FUNCINLINE static ATTRINLINE void P_LoadRawVertexes(UINT8 *data)
|
||||
{
|
||||
@@ -2408,6 +2507,7 @@ static void P_SetupCamera(UINT8 pnum, camera_t *cam)
|
||||
switch (gametype)
|
||||
{
|
||||
case GT_MATCH:
|
||||
case GT_TAG:
|
||||
thing = deathmatchstarts[0];
|
||||
break;
|
||||
|
||||
@@ -2823,7 +2923,44 @@ boolean P_SetupLevel(boolean skipprecip, boolean reloadinggamestate)
|
||||
if (modeattacking == ATTACKING_RECORD && !demo.playback)
|
||||
P_LoadRecordGhosts();
|
||||
|
||||
if (G_RaceGametype() && server)
|
||||
if (G_TagGametype())
|
||||
{
|
||||
INT32 realnumplayers = 0;
|
||||
INT32 playersactive[MAXPLAYERS];
|
||||
|
||||
//I just realized how problematic this code can be.
|
||||
//D_NumPlayers() will not always cover the scope of the netgame.
|
||||
//What if one player is node 0 and the other node 31?
|
||||
//The solution? Make a temp array of all players that are currently playing and pick from them.
|
||||
//Future todo? When a player leaves, shift all nodes down so D_NumPlayers() can be used as intended?
|
||||
//Also, you'd never have to loop through all 32 players slots to find anything ever again.
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (playeringame[i] && !players[i].spectator)
|
||||
{
|
||||
playersactive[realnumplayers] = i; //stores the player's node in the array.
|
||||
realnumplayers++;
|
||||
}
|
||||
}
|
||||
|
||||
if (realnumplayers) //this should also fix the dedicated crash bug. You only pick a player if one exists to be picked.
|
||||
{
|
||||
i = P_RandomKey(realnumplayers);
|
||||
players[playersactive[i]].pflags |= PF_TAGIT; //choose our initial tagger before map starts.
|
||||
|
||||
// Taken and modified from G_DoReborn()
|
||||
// Remove the player so he can respawn elsewhere.
|
||||
// first dissasociate the corpse
|
||||
if (players[playersactive[i]].mo)
|
||||
P_RemoveMobj(players[playersactive[i]].mo);
|
||||
|
||||
G_SpawnPlayer(playersactive[i], false); //respawn the lucky player in his dedicated spawn location.
|
||||
}
|
||||
else
|
||||
CONS_Printf(M_GetText("No player currently available to become IT. Awaiting available players.\n"));
|
||||
|
||||
}
|
||||
else if (G_RaceGametype() && server)
|
||||
CV_StealthSetValue(&cv_numlaps,
|
||||
((netgame || multiplayer) && cv_basenumlaps.value
|
||||
&& (!(mapheaderinfo[gamemap - 1]->levelflags & LF_SECTIONRACE)
|
||||
|
||||
@@ -102,4 +102,11 @@ size_t P_PrecacheLevelFlats(void);
|
||||
void P_ClearDirectionalLightMapHeaderInfo(INT16 i);
|
||||
void P_AllocMapHeader(INT16 i);
|
||||
|
||||
// Needed for NiGHTS
|
||||
void P_DeleteGrades(INT16 i);
|
||||
void P_AddGradesForMare(INT16 i, UINT8 mare, char *gtext);
|
||||
UINT8 P_GetGrade(UINT32 pscore, INT16 map, UINT8 mare);
|
||||
UINT8 P_HasGrades(INT16 map, UINT8 mare);
|
||||
UINT32 P_GetScoreForGrade(INT16 map, UINT8 mare, UINT8 grade);
|
||||
|
||||
#endif
|
||||
+99
-4
@@ -2601,6 +2601,14 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||
mo->flags2 &= ~MF2_TWOD;
|
||||
else
|
||||
mo->flags2 |= MF2_TWOD;
|
||||
|
||||
// Copy effect to bot if necessary
|
||||
// (Teleport them to you so they don't break it.)
|
||||
if (bot && (bot->flags2 & MF2_TWOD) != (mo->flags2 & MF2_TWOD))
|
||||
{
|
||||
bot->flags2 = (bot->flags2 & ~MF2_TWOD) | (mo->flags2 & MF2_TWOD);
|
||||
P_SetOrigin(bot, mo->x, mo->y, mo->z);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -3364,6 +3372,9 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers
|
||||
}
|
||||
|
||||
P_DoPlayerPain(player, NULL, NULL); // this does basically everything that was here before
|
||||
|
||||
if (gametype == GT_CTF && player->gotflag & (GF_REDFLAG|GF_BLUEFLAG))
|
||||
P_PlayerFlagBurst(player, false);
|
||||
break;
|
||||
case 12: // Wall Sector (Don't step-up/down)
|
||||
case 13: // Ramp Sector (Increase step-up/down)
|
||||
@@ -3383,7 +3394,7 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers
|
||||
case 3: // Linedef executor requires all players present // Trigger Linedef Exec (Floor Touch, All Players)
|
||||
/// \todo check continues for proper splitscreen support?
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
if (playeringame[i] && !players[i].bot && players[i].mo && players[i].lives > 0)
|
||||
if (playeringame[i] && !players[i].bot && players[i].mo && (gametype != GT_COOP || players[i].lives > 0))
|
||||
{
|
||||
if (roversector)
|
||||
{
|
||||
@@ -3653,12 +3664,95 @@ DoneSection2:
|
||||
sstimer = 6; // Just let P_Ticker take care of the rest.
|
||||
|
||||
// Exit (for FOF exits; others are handled in P_PlayerThink in p_user.c)
|
||||
P_DoPlayerExit(player);
|
||||
P_SetupSignExit(player);
|
||||
{
|
||||
INT32 lineindex;
|
||||
|
||||
P_DoPlayerExit(player);
|
||||
|
||||
P_SetupSignExit(player);
|
||||
// important: use sector->tag on next line instead of player->mo->subsector->tag
|
||||
// this part is different from in P_PlayerThink, this is what was causing
|
||||
// FOF custom exits not to work.
|
||||
lineindex = P_FindSpecialLineFromTag(2, sector->tag, -1);
|
||||
|
||||
if (gametype == GT_COOP && lineindex != -1) // Custom exit!
|
||||
{
|
||||
// Special goodies with the block monsters flag depending on emeralds collected
|
||||
if ((lines[lineindex].flags & ML_BLOCKMONSTERS) && ALL7EMERALDS(emeralds))
|
||||
nextmapoverride = (INT16)(lines[lineindex].frontsector->ceilingheight>>FRACBITS);
|
||||
else
|
||||
nextmapoverride = (INT16)(lines[lineindex].frontsector->floorheight>>FRACBITS);
|
||||
|
||||
if (lines[lineindex].flags & ML_NOCLIMB)
|
||||
skipstats = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 3: // Red Team's Base
|
||||
if (gametype == GT_CTF && P_IsObjectOnGround(player->mo))
|
||||
{
|
||||
if (player->ctfteam == 1 && (player->gotflag & GF_BLUEFLAG))
|
||||
{
|
||||
mobj_t *mo;
|
||||
|
||||
// Make sure the red team still has their own
|
||||
// flag at their base so they can score.
|
||||
if (!P_IsFlagAtBase(MT_REDFLAG))
|
||||
break;
|
||||
|
||||
HU_SetCEchoFlags(0);
|
||||
HU_SetCEchoDuration(5);
|
||||
HU_DoCEcho(va(M_GetText("%s\\captured the blue flag.\\\\\\\\"), player_names[player-players]));
|
||||
|
||||
if (splitscreen || players[consoleplayer].ctfteam == 1)
|
||||
S_StartSound(NULL, sfx_flgcap);
|
||||
else if (players[consoleplayer].ctfteam == 2)
|
||||
S_StartSound(NULL, sfx_lose);
|
||||
|
||||
mo = P_SpawnMobj(player->mo->x,player->mo->y,player->mo->z,MT_BLUEFLAG);
|
||||
player->gotflag &= ~GF_BLUEFLAG;
|
||||
mo->flags &= ~MF_SPECIAL;
|
||||
mo->fuse = TICRATE;
|
||||
mo->spawnpoint = bflagpoint;
|
||||
mo->flags2 |= MF2_JUSTATTACKED;
|
||||
redscore += 1;
|
||||
P_AddPlayerScore(player, 5);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 4: // Blue Team's Base
|
||||
if (gametype == GT_CTF && P_IsObjectOnGround(player->mo))
|
||||
{
|
||||
if (player->ctfteam == 2 && (player->gotflag & GF_REDFLAG))
|
||||
{
|
||||
mobj_t *mo;
|
||||
|
||||
// Make sure the blue team still has their own
|
||||
// flag at their base so they can score.
|
||||
if (!P_IsFlagAtBase(MT_BLUEFLAG))
|
||||
break;
|
||||
|
||||
HU_SetCEchoFlags(0);
|
||||
HU_SetCEchoDuration(5);
|
||||
HU_DoCEcho(va(M_GetText("%s\\captured the red flag.\\\\\\\\"), player_names[player-players]));
|
||||
|
||||
if (splitscreen || players[consoleplayer].ctfteam == 2)
|
||||
S_StartSound(NULL, sfx_flgcap);
|
||||
else if (players[consoleplayer].ctfteam == 1)
|
||||
S_StartSound(NULL, sfx_lose);
|
||||
|
||||
mo = P_SpawnMobj(player->mo->x,player->mo->y,player->mo->z,MT_REDFLAG);
|
||||
player->gotflag &= ~GF_REDFLAG;
|
||||
mo->flags &= ~MF_SPECIAL;
|
||||
mo->fuse = TICRATE;
|
||||
mo->spawnpoint = rflagpoint;
|
||||
mo->flags2 |= MF2_JUSTATTACKED;
|
||||
bluescore += 1;
|
||||
P_AddPlayerScore(player, 5);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 5: // Fan sector
|
||||
@@ -5964,7 +6058,8 @@ void P_SpawnSpecials(INT32 fromnetsave, boolean reloadinggamestate)
|
||||
// Linedef executor triggers for CTF teams.
|
||||
case 309:
|
||||
case 311:
|
||||
lines[i].special = 0;
|
||||
if (gametype != GT_CTF)
|
||||
lines[i].special = 0;
|
||||
break;
|
||||
|
||||
// Each time executors
|
||||
|
||||
+225
-7
@@ -72,7 +72,9 @@ void P_Thrust(mobj_t *mo, angle_t angle, fixed_t move)
|
||||
angle >>= ANGLETOFINESHIFT;
|
||||
|
||||
mo->momx += FixedMul(move, FINECOSINE(angle));
|
||||
mo->momy += FixedMul(move, FINESINE(angle));
|
||||
|
||||
if (!(twodlevel || (mo->flags2 & MF2_TWOD)))
|
||||
mo->momy += FixedMul(move, FINESINE(angle));
|
||||
}
|
||||
|
||||
|
||||
@@ -87,7 +89,9 @@ void P_InstaThrust(mobj_t *mo, angle_t angle, fixed_t move)
|
||||
angle >>= ANGLETOFINESHIFT;
|
||||
|
||||
mo->momx = FixedMul(move, FINECOSINE(angle));
|
||||
mo->momy = FixedMul(move,FINESINE(angle));
|
||||
|
||||
if (!(twodlevel || (mo->flags2 & MF2_TWOD)))
|
||||
mo->momy = FixedMul(move,FINESINE(angle));
|
||||
}
|
||||
|
||||
void P_InstaThrustEvenIn2D(mobj_t *mo, angle_t angle, fixed_t move)
|
||||
@@ -447,6 +451,24 @@ void P_GivePlayerRings(player_t *player, INT32 num_rings)
|
||||
player->health = 1;
|
||||
}
|
||||
//}
|
||||
|
||||
// Now extra life bonuses are handled here instead of in P_MovePlayer, since why not?
|
||||
if (!ultimatemode && !modeattacking && !G_IsSpecialStage(gamemap) && G_GametypeUsesLives())
|
||||
{
|
||||
INT32 gainlives = 0;
|
||||
|
||||
while (player->xtralife < maxXtraLife && player->health > 100 * (player->xtralife+1))
|
||||
{
|
||||
++gainlives;
|
||||
++player->xtralife;
|
||||
}
|
||||
|
||||
if (gainlives)
|
||||
{
|
||||
P_GivePlayerLives(player, gainlives);
|
||||
P_PlayLivesJingle(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
@@ -494,6 +516,15 @@ void P_AddPlayerScore(player_t *player, UINT32 amount)
|
||||
player->marescore += amount;
|
||||
else
|
||||
player->marescore = MAXSCORE;
|
||||
|
||||
// In team match, all awarded points are incremented to the team's running score.
|
||||
if (gametype == GT_TEAMMATCH)
|
||||
{
|
||||
if (player->ctfteam == 1)
|
||||
redscore += amount;
|
||||
else if (player->ctfteam == 2)
|
||||
bluescore += amount;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
@@ -506,6 +537,8 @@ void P_PlayLivesJingle(player_t *player)
|
||||
|
||||
if (use1upSound)
|
||||
S_StartSound(NULL, sfx_oneup);
|
||||
else if (mariomode)
|
||||
S_StartSound(NULL, sfx_marioa);
|
||||
else
|
||||
{
|
||||
if (player)
|
||||
@@ -537,7 +570,7 @@ void P_PlayRinglossSound(mobj_t *source, mobj_t *damager)
|
||||
S_StartSound(NULL, sfx);
|
||||
}
|
||||
else
|
||||
S_StartSound(source, sfx_khurt1 + key);
|
||||
S_StartSound(source, (mariomode) ? sfx_mario8 : sfx_khurt1 + key);
|
||||
}
|
||||
else
|
||||
S_StartSound(source, sfx_slip);
|
||||
@@ -1711,6 +1744,58 @@ static void P_DoBubbleBreath(player_t *player)
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// P_DoPlayerHeadSigns
|
||||
//
|
||||
// Spawns "IT" and "GOT FLAG" signs for Tag and CTF respectively
|
||||
//
|
||||
static void P_DoPlayerHeadSigns(player_t *player)
|
||||
{
|
||||
if (G_TagGametype())
|
||||
{
|
||||
// If you're "IT", show a big "IT" over your head for others to see.
|
||||
if (player->pflags & PF_TAGIT)
|
||||
{
|
||||
if (!P_IsDisplayPlayer(player)) // Don't display it on your own view.
|
||||
{
|
||||
if (!(player->mo->eflags & MFE_VERTICALFLIP))
|
||||
P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z + player->mo->height, MT_TAG);
|
||||
else
|
||||
P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z - mobjinfo[MT_TAG].height, MT_TAG)->eflags |= MFE_VERTICALFLIP;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (gametype == GT_CTF)
|
||||
{
|
||||
if (player->gotflag & (GF_REDFLAG|GF_BLUEFLAG)) // If you have the flag (duh).
|
||||
{
|
||||
// Spawn a got-flag message over the head of the player that
|
||||
// has it (but not on your own screen if you have the flag).
|
||||
if (splitscreen || player != &players[consoleplayer])
|
||||
{
|
||||
if (player->gotflag & GF_REDFLAG)
|
||||
{
|
||||
if (!(player->mo->eflags & MFE_VERTICALFLIP))
|
||||
P_SpawnMobj(player->mo->x+player->mo->momx, player->mo->y+player->mo->momy,
|
||||
player->mo->z+P_GetPlayerHeight(player)+FixedMul(16*FRACUNIT, player->mo->scale)+player->mo->momz, MT_GOTFLAG);
|
||||
else
|
||||
P_SpawnMobj(player->mo->x+player->mo->momx, player->mo->y+player->mo->momy,
|
||||
player->mo->z+player->mo->height-P_GetPlayerHeight(player)-mobjinfo[MT_GOTFLAG].height-FixedMul(16*FRACUNIT, player->mo->scale)+player->mo->momz, MT_GOTFLAG)->eflags |= MFE_VERTICALFLIP;
|
||||
}
|
||||
if (player->gotflag & GF_BLUEFLAG)
|
||||
{
|
||||
if (!(player->mo->eflags & MFE_VERTICALFLIP))
|
||||
P_SpawnMobj(player->mo->x+player->mo->momx, player->mo->y+player->mo->momy,
|
||||
player->mo->z+P_GetPlayerHeight(player)+FixedMul(16*FRACUNIT, player->mo->scale)+player->mo->momz, MT_GOTFLAG2);
|
||||
else
|
||||
P_SpawnMobj(player->mo->x+player->mo->momx, player->mo->y+player->mo->momy,
|
||||
player->mo->z+player->mo->height-P_GetPlayerHeight(player)-mobjinfo[MT_GOTFLAG2].height-FixedMul(16*FRACUNIT, player->mo->scale)+player->mo->momz, MT_GOTFLAG2)->eflags |= MFE_VERTICALFLIP;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// P_DoJumpShield
|
||||
//
|
||||
@@ -2145,6 +2230,38 @@ static void P_MovePlayer(player_t *player)
|
||||
}
|
||||
// note: don't unset stasis here
|
||||
|
||||
if (!player->spectator && G_TagGametype())
|
||||
{
|
||||
// If we have stasis already here, it's because it's forced on us
|
||||
// by a linedef executor or what have you
|
||||
boolean forcestasis = false;
|
||||
|
||||
//During hide time, taggers cannot move.
|
||||
if (leveltime < hidetime * TICRATE)
|
||||
{
|
||||
if (player->pflags & PF_TAGIT)
|
||||
forcestasis = true;
|
||||
}
|
||||
else if (gametype == GT_HIDEANDSEEK)
|
||||
{
|
||||
if (!(player->pflags & PF_TAGIT))
|
||||
{
|
||||
forcestasis = true;
|
||||
if (player->pflags & PF_TAGGED) // Already hit.
|
||||
player->powers[pw_flashing] = 5;
|
||||
}
|
||||
}
|
||||
|
||||
if (forcestasis)
|
||||
{
|
||||
player->pflags |= PF_FULLSTASIS;
|
||||
// If you're in stasis in tag, you don't drown.
|
||||
/*if (player->powers[pw_underwater] <= 12*TICRATE + 1)
|
||||
P_RestoreMusic(player);*/
|
||||
player->powers[pw_underwater] = player->powers[pw_spacetime] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (player->spectator)
|
||||
{
|
||||
P_SpectatorMovement(player);
|
||||
@@ -2211,6 +2328,9 @@ static void P_MovePlayer(player_t *player)
|
||||
P_3dMovement(player);
|
||||
}
|
||||
|
||||
if (maptol & TOL_2D)
|
||||
runspd = FixedMul(runspd, 2*FRACUNIT/3);
|
||||
|
||||
/////////////////////////
|
||||
// MOVEMENT ANIMATIONS //
|
||||
/////////////////////////
|
||||
@@ -2644,6 +2764,10 @@ boolean P_LookForEnemies(player_t *player)
|
||||
player->mo->z-mo->z) > FixedMul(RING_DIST, player->mo->scale))
|
||||
continue; // out of range
|
||||
|
||||
if ((twodlevel || player->mo->flags2 & MF2_TWOD)
|
||||
&& abs(player->mo->y-mo->y) > player->mo->radius)
|
||||
continue; // not in your 2d plane
|
||||
|
||||
if (mo->type == MT_PLAYER) // Don't chase after other players!
|
||||
continue;
|
||||
|
||||
@@ -3776,7 +3900,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
||||
if (player->playerstate != PST_DEAD && !((player->pflags & PF_NIGHTSMODE) && player->exiting))
|
||||
angle += (focusaiming < ANGLE_180 ? focusaiming/2 : InvAngle(InvAngle(focusaiming)/2)); // overcomplicated version of '((signed)focusaiming)/2;'
|
||||
|
||||
if (!camstill && !timeover) // Keep the view still...
|
||||
if (twodlevel || (mo->flags2 & MF2_TWOD) || (!camstill && !timeover)) // Keep the view still...
|
||||
{
|
||||
G_ClipAimingPitch((INT32 *)&angle);
|
||||
|
||||
@@ -3842,7 +3966,63 @@ boolean P_SpectatorJoinGame(player_t *player)
|
||||
if (P_IsLocalPlayer(player))
|
||||
CONS_Printf(M_GetText("Server does not allow team change.\n"));
|
||||
}
|
||||
else // Joining in game from firing.
|
||||
// Team changing in Team Match and CTF
|
||||
// Pressing fire assigns you to a team that needs players if allowed.
|
||||
// Partial code reproduction from p_tick.c autobalance code.
|
||||
else if (G_GametypeHasTeams())
|
||||
{
|
||||
INT32 changeto = 0;
|
||||
INT32 z, numplayersred = 0, numplayersblue = 0;
|
||||
|
||||
//find a team by num players, score, or random if all else fails.
|
||||
for (z = 0; z < MAXPLAYERS; ++z)
|
||||
if (playeringame[z])
|
||||
{
|
||||
if (players[z].ctfteam == 1)
|
||||
++numplayersred;
|
||||
else if (players[z].ctfteam == 2)
|
||||
++numplayersblue;
|
||||
}
|
||||
// for z
|
||||
|
||||
if (numplayersblue > numplayersred)
|
||||
changeto = 1;
|
||||
else if (numplayersred > numplayersblue)
|
||||
changeto = 2;
|
||||
else if (bluescore > redscore)
|
||||
changeto = 1;
|
||||
else if (redscore > bluescore)
|
||||
changeto = 2;
|
||||
else
|
||||
changeto = (P_RandomFixed() & 1) + 1;
|
||||
|
||||
if (player->mo)
|
||||
{
|
||||
P_RemoveMobj(player->mo);
|
||||
player->mo = NULL;
|
||||
}
|
||||
player->spectator = false;
|
||||
player->pflags &= ~PF_WANTSTOJOIN;
|
||||
player->kartstuff[k_spectatewait] = 0;
|
||||
player->ctfteam = changeto;
|
||||
player->playerstate = PST_REBORN;
|
||||
|
||||
//center camera
|
||||
P_ResetLocalCamAiming(player);
|
||||
|
||||
//Reset away view
|
||||
if (P_IsLocalPlayer(player) && displayplayers[0] != consoleplayer)
|
||||
displayplayers[0] = consoleplayer;
|
||||
|
||||
if (changeto == 1)
|
||||
CONS_Printf(M_GetText("%s switched to the %c%s%c.\n"), player_names[player-players], '\x85', M_GetText("Red team"), '\x80');
|
||||
else if (changeto == 2)
|
||||
CONS_Printf(M_GetText("%s switched to the %c%s%c.\n"), player_names[player-players], '\x84', M_GetText("Blue team"), '\x80');
|
||||
|
||||
return true; // no more player->mo, cannot continue.
|
||||
}
|
||||
// Joining in game from firing.
|
||||
else
|
||||
{
|
||||
if (player->mo)
|
||||
{
|
||||
@@ -4143,7 +4323,8 @@ void P_PlayerThink(player_t *player)
|
||||
{
|
||||
seenplayer = NULL;
|
||||
|
||||
if (cv_seenames.value && cv_allowseenames.value)
|
||||
if (cv_seenames.value && cv_allowseenames.value &&
|
||||
!(G_TagGametype() && (player->pflags & PF_TAGIT)))
|
||||
{
|
||||
mobj_t *mo = P_SpawnNameFinder(player->mo, MT_NAMECHECK);
|
||||
|
||||
@@ -4418,6 +4599,39 @@ void P_PlayerThink(player_t *player)
|
||||
{
|
||||
player->pflags ^= PF_WANTSTOJOIN;
|
||||
player->powers[pw_flashing] = TICRATE/2 + 1;
|
||||
/*if (P_SpectatorJoinGame(player))
|
||||
return; // player->mo was removed.*/
|
||||
}
|
||||
|
||||
// Even if not NiGHTS, pull in nearby objects when walking around as John Q. Elliot.
|
||||
if (!objectplacing && !((netgame || multiplayer) && player->spectator)
|
||||
&& maptol & TOL_NIGHTS && (!(player->pflags & PF_NIGHTSMODE) || player->powers[pw_nights_helper]))
|
||||
{
|
||||
thinker_t *th;
|
||||
mobj_t *mo2;
|
||||
fixed_t x = player->mo->x;
|
||||
fixed_t y = player->mo->y;
|
||||
fixed_t z = player->mo->z;
|
||||
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
if (!(mo2->type == MT_NIGHTSWING || mo2->type == MT_RING || mo2->type == MT_COIN
|
||||
|| mo2->type == MT_BLUEBALL))
|
||||
continue;
|
||||
|
||||
if (P_AproxDistance(P_AproxDistance(mo2->x - x, mo2->y - y), mo2->z - z) > FixedMul(128*FRACUNIT, player->mo->scale))
|
||||
continue;
|
||||
|
||||
// Yay! The thing's in reach! Pull it in!
|
||||
mo2->flags |= MF_NOCLIP|MF_NOCLIPHEIGHT;
|
||||
mo2->flags2 |= MF2_NIGHTSPULL;
|
||||
P_SetTarget(&mo2->tracer, player->mo);
|
||||
}
|
||||
}
|
||||
|
||||
if (player->linktimer && !player->powers[pw_nights_linkfreeze])
|
||||
@@ -4458,7 +4672,9 @@ void P_PlayerThink(player_t *player)
|
||||
|
||||
P_DoBubbleBreath(player); // Spawn Sonic's bubbles
|
||||
P_CheckInvincibilityTimer(player); // Spawn Invincibility Sparkles
|
||||
P_DoPlayerHeadSigns(player); // Spawn Tag/CTF signs over player's head
|
||||
|
||||
#if 1
|
||||
// "Blur" a bit when you have speed shoes and are going fast enough
|
||||
if ((player->powers[pw_super] || player->powers[pw_sneakers]
|
||||
|| player->kartstuff[k_driftboost] || player->kartstuff[k_sneakertimer] || player->kartstuff[k_startboost]) && !player->kartstuff[k_invincibilitytimer] // SRB2kart
|
||||
@@ -4486,6 +4702,7 @@ void P_PlayerThink(player_t *player)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// check for use
|
||||
if (!(player->pflags & PF_NIGHTSMODE))
|
||||
@@ -4694,7 +4911,8 @@ void P_PlayerAfterThink(player_t *player)
|
||||
else if (cmd->forwardmove < 0 && player->mo->tracer->target->lastlook > player->mo->tracer->target->movecount)
|
||||
player->mo->tracer->target->lastlook -= 2;
|
||||
|
||||
if (!(player->mo->tracer->target->flags & MF_SLIDEME)) // Noclimb on chain parameters gives this
|
||||
if (!(player->mo->tracer->target->flags & MF_SLIDEME) // Noclimb on chain parameters gives this
|
||||
&& !(twodlevel || player->mo->flags2 & MF2_TWOD)) // why on earth would you want to turn them in 2D mode?
|
||||
{
|
||||
player->mo->tracer->target->health += cmd->sidemove;
|
||||
player->mo->angle += cmd->sidemove<<ANGLETOFINESHIFT; // 2048 --> ANGLE_MAX
|
||||
|
||||
+18
-13
@@ -1144,8 +1144,6 @@ fixed_t R_GetSpriteDirectionalLighting(angle_t angle)
|
||||
//
|
||||
static void R_ProjectSprite(mobj_t *thing)
|
||||
{
|
||||
mobj_t *oldthing = thing;
|
||||
|
||||
fixed_t tr_x, tr_y;
|
||||
fixed_t gxt, gyt;
|
||||
fixed_t tx, tz;
|
||||
@@ -1163,9 +1161,6 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
size_t rot;
|
||||
UINT8 flip;
|
||||
|
||||
boolean mirrored = thing->mirrored;
|
||||
boolean hflip = (!(thing->frame & FF_HORIZONTALFLIP) != !mirrored);
|
||||
|
||||
INT32 lindex;
|
||||
|
||||
vissprite_t *vis;
|
||||
@@ -1177,7 +1172,6 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
fixed_t iscale;
|
||||
fixed_t scalestep; // toast '16
|
||||
fixed_t offset, offset2;
|
||||
boolean papersprite = (thing->frame & FF_PAPERSPRITE);
|
||||
fixed_t paperoffset = 0, paperdistance = 0; angle_t centerangle = 0;
|
||||
|
||||
INT32 lightnum;
|
||||
@@ -1185,6 +1179,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
//SoM: 3/17/2000
|
||||
fixed_t gz, gzt;
|
||||
INT32 heightsec, phs;
|
||||
INT32 dist = -1;
|
||||
INT32 light = 0;
|
||||
lighttable_t **lights_array = spritelights;
|
||||
fixed_t this_scale;
|
||||
@@ -1201,7 +1196,15 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
angle_t sliptiderollangle = 0;
|
||||
#endif
|
||||
|
||||
INT32 dist = -1;
|
||||
if (P_MobjWasRemoved(thing) || thing->subsector == NULL)
|
||||
return;
|
||||
|
||||
mobj_t *oldthing = thing;
|
||||
|
||||
const boolean mirrored = thing->mirrored;
|
||||
const boolean vflip = (thing->eflags & MFE_VERTICALFLIP);
|
||||
const boolean hflip = (!(thing->frame & FF_HORIZONTALFLIP) != !mirrored);
|
||||
const boolean papersprite = (thing->frame & FF_PAPERSPRITE);
|
||||
|
||||
if (cv_maxinterpdist.value)
|
||||
dist = R_QuickCamDist(thing->x, thing->y);
|
||||
@@ -1572,7 +1575,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
}
|
||||
|
||||
//SoM: 3/17/2000: Disregard sprites that are out of view..
|
||||
if (thing->eflags & MFE_VERTICALFLIP)
|
||||
if (vflip)
|
||||
{
|
||||
// When vertical flipped, draw sprites from the top down, at least as far as offsets are concerned.
|
||||
// sprite height - sprite topoffset is the proper inverse of the vertical offset, of course.
|
||||
@@ -1779,10 +1782,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
|
||||
vis->precip = false;
|
||||
|
||||
if (thing->eflags & MFE_VERTICALFLIP)
|
||||
vis->vflip = true;
|
||||
else
|
||||
vis->vflip = false;
|
||||
vis->vflip = vflip;
|
||||
|
||||
vis->isScaled = false;
|
||||
|
||||
@@ -1816,6 +1816,9 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
|
||||
|
||||
INT32 dist = 1;
|
||||
|
||||
if (!thing || thing->subsector == NULL)
|
||||
return;
|
||||
|
||||
if (cv_maxinterpdist.value)
|
||||
dist = R_QuickCamDist(thing->x, thing->y);
|
||||
|
||||
@@ -2018,6 +2021,7 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel)
|
||||
// Handle all things in sector.
|
||||
// If a limit exists, handle things a tiny bit different.
|
||||
const fixed_t limit_dist = (fixed_t)(cv_drawdist.value) * mapobjectscale;
|
||||
|
||||
for (thing = sec->thinglist; thing; thing = thing->snext)
|
||||
{
|
||||
if (!R_ThingWithinDist(thing, limit_dist))
|
||||
@@ -2037,7 +2041,8 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel)
|
||||
//
|
||||
void R_AddPrecipitationSprites(void)
|
||||
{
|
||||
fixed_t drawdist = (fixed_t)(cv_drawdist_precip.value) * (cv_mobjscaleprecip.value ? mapobjectscale : FRACUNIT);
|
||||
fixed_t precipscale = (cv_mobjscaleprecip.value ? mapobjectscale : FRACUNIT);
|
||||
fixed_t drawdist = ((fixed_t)(cv_drawdist_precip.value) * precipscale);
|
||||
|
||||
INT32 xl, xh, yl, yh, bx, by;
|
||||
precipmobj_t *th, *next;
|
||||
|
||||
@@ -609,6 +609,43 @@ void S_StartSound(const void *origin, sfxenum_t sfx_id)
|
||||
if (S_SoundDisabled())
|
||||
return;
|
||||
|
||||
if (mariomode) // Sounds change in Mario mode!
|
||||
{
|
||||
switch (sfx_id)
|
||||
{
|
||||
case sfx_thok:
|
||||
sfx_id = sfx_mario7;
|
||||
break;
|
||||
case sfx_pop:
|
||||
sfx_id = sfx_mario5;
|
||||
break;
|
||||
case sfx_jump:
|
||||
sfx_id = sfx_mario6;
|
||||
break;
|
||||
case sfx_shield:
|
||||
sfx_id = sfx_mario3;
|
||||
break;
|
||||
case sfx_itemup:
|
||||
sfx_id = sfx_mario4;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (maptol & TOL_XMAS) // Some sounds change for xmas
|
||||
{
|
||||
switch (sfx_id)
|
||||
{
|
||||
case sfx_ideya:
|
||||
case sfx_nbmper:
|
||||
case sfx_ncitem:
|
||||
case sfx_ngdone:
|
||||
++sfx_id;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// the volume is handled 8 bits
|
||||
S_StartSoundAtVolume(origin, sfx_id, 255);
|
||||
}
|
||||
|
||||
+1
-1
@@ -280,7 +280,7 @@ void OglSdlFinishUpdate(boolean waitvbl)
|
||||
// effects that want to take the old screen can do so after this
|
||||
// well we dont need it on native res it seems
|
||||
#ifdef USE_FBO_OGL
|
||||
if (!I_CheckNativeRes() && !usefbo || WipeInAction)
|
||||
if ((!I_CheckNativeRes() && !usefbo) || WipeInAction)
|
||||
#else
|
||||
if (!I_CheckNativeRes() || WipeInAction)
|
||||
#endif
|
||||
|
||||
+11
-2
@@ -220,6 +220,13 @@ boolean ST_SameTeam(player_t *a, player_t *b)
|
||||
if (a->spectator && b->spectator)
|
||||
return true;
|
||||
|
||||
// Team chat.
|
||||
if (G_GametypeHasTeams())
|
||||
return a->ctfteam == b->ctfteam;
|
||||
|
||||
if (G_TagGametype())
|
||||
return ((a->pflags & PF_TAGIT) == (b->pflags & PF_TAGIT));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -743,6 +750,8 @@ static void ST_overlayDrawer(void)
|
||||
itemtxt = M_GetText("Item - . . .");
|
||||
else if (stplyr->pflags & PF_WANTSTOJOIN)
|
||||
itemtxt = M_GetText("Item - Cancel Join");
|
||||
else if (G_GametypeHasTeams())
|
||||
itemtxt = M_GetText("Item - Join Team");
|
||||
|
||||
if (cv_ingamecap.value)
|
||||
{
|
||||
@@ -952,10 +961,10 @@ void ST_Drawer(void)
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2 + 15, V_HUDTRANSHALF, player_names[seenplayer-players]);
|
||||
else if (cv_seenames.value == 2)
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2 + 15, V_HUDTRANSHALF,
|
||||
va("%s%s", "", player_names[seenplayer-players]));
|
||||
va("%s%s", G_GametypeHasTeams() ? ((seenplayer->ctfteam == 1) ? "\x85" : "\x84") : "", player_names[seenplayer-players]));
|
||||
else //if (cv_seenames.value == 3)
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2 + 15, V_HUDTRANSHALF,
|
||||
va("%s%s", !G_BattleGametype()
|
||||
va("%s%s", !G_BattleGametype() || (G_GametypeHasTeams() && players[consoleplayer].ctfteam == seenplayer->ctfteam)
|
||||
? "\x83" : "\x85", player_names[seenplayer-players]));
|
||||
}
|
||||
#endif
|
||||
|
||||
+3
-1
@@ -810,7 +810,9 @@ void Y_StartIntermission(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (demo.playback) // Override inttime (which is pulled from the replay anyway
|
||||
if (cv_inttime.value == 0 && gametype == GT_COOP)
|
||||
timer = 0;
|
||||
else if (demo.playback) // Override inttime (which is pulled from the replay anyway
|
||||
timer = 10*TICRATE;
|
||||
else
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user