mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 17:01:51 +00:00
Factor out common handling of the end-of-level between sectors tagged 65535 and 65534, switches tagged 65535, and nukebuttons.
This fixes the bug with user maps ending in 65534-tagged sectors, reported by FistMarine: https://forums.duke4.net/topic/8367-end-of-level-bug/ It also eliminates dead code belonging to the nukebutton. git-svn-id: https://svn.eduke32.com/eduke32@5463 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
cbcef42656
commit
0ddba3388f
3 changed files with 34 additions and 64 deletions
|
@ -4368,6 +4368,27 @@ static void P_ProcessWeapon(int32_t snum)
|
|||
}
|
||||
}
|
||||
|
||||
void P_EndLevel(void)
|
||||
{
|
||||
int32_t i;
|
||||
|
||||
for (TRAVERSE_CONNECT(i))
|
||||
g_player[i].ps->gm = MODE_EOL;
|
||||
|
||||
if (ud.from_bonus)
|
||||
{
|
||||
ud.m_level_number = ud.level_number = ud.from_bonus;
|
||||
ud.from_bonus = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
ud.level_number++;
|
||||
if (ud.level_number >= MAXLEVELS)
|
||||
ud.level_number = 0;
|
||||
ud.m_level_number = ud.level_number;
|
||||
}
|
||||
}
|
||||
|
||||
static int32_t P_DoFist(DukePlayer_t *p)
|
||||
{
|
||||
// the fist punching NUKEBUTTON
|
||||
|
@ -4382,13 +4403,13 @@ static int32_t P_DoFist(DukePlayer_t *p)
|
|||
|
||||
if (p->fist_incs > 42)
|
||||
{
|
||||
int32_t i;
|
||||
|
||||
for (TRAVERSE_CONNECT(i))
|
||||
g_player[i].ps->gm = MODE_EOL;
|
||||
|
||||
if (p->buttonpalette && ud.from_bonus == 0)
|
||||
{
|
||||
int32_t i;
|
||||
|
||||
for (TRAVERSE_CONNECT(i))
|
||||
g_player[i].ps->gm = MODE_EOL;
|
||||
|
||||
ud.from_bonus = ud.level_number+1;
|
||||
if (ud.secretlevel > 0 && ud.secretlevel <= MAXLEVELS)
|
||||
ud.level_number = ud.secretlevel-1;
|
||||
|
@ -4396,21 +4417,7 @@ static int32_t P_DoFist(DukePlayer_t *p)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (ud.from_bonus)
|
||||
{
|
||||
ud.m_level_number = ud.level_number = ud.from_bonus;
|
||||
ud.from_bonus = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ud.level_number == ud.secretlevel && ud.from_bonus > 0)
|
||||
ud.level_number = ud.from_bonus;
|
||||
else ud.level_number++;
|
||||
|
||||
if (ud.level_number > MAXLEVELS-1)
|
||||
ud.level_number = 0;
|
||||
ud.m_level_number = ud.level_number;
|
||||
}
|
||||
P_EndLevel();
|
||||
}
|
||||
|
||||
p->fist_incs = 0;
|
||||
|
@ -4613,16 +4620,7 @@ void P_ProcessInput(int32_t snum)
|
|||
}
|
||||
else if (p->timebeforeexit == 1)
|
||||
{
|
||||
for (TRAVERSE_CONNECT(i))
|
||||
g_player[i].ps->gm = MODE_EOL;
|
||||
|
||||
ud.m_level_number = ud.level_number++;
|
||||
|
||||
if (ud.from_bonus)
|
||||
{
|
||||
ud.m_level_number = ud.level_number = ud.from_bonus;
|
||||
ud.from_bonus = 0;
|
||||
}
|
||||
P_EndLevel();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -395,6 +395,7 @@ void P_ProcessInput(int32_t snum);
|
|||
void P_QuickKill(DukePlayer_t *p);
|
||||
void P_SelectNextInvItem(DukePlayer_t *p);
|
||||
void P_UpdateScreenPal(DukePlayer_t *p);
|
||||
void P_EndLevel(void);
|
||||
|
||||
void P_CheckWeaponI(int32_t snum);
|
||||
int32_t P_GetHudPal(const DukePlayer_t *p);
|
||||
|
|
|
@ -1390,24 +1390,9 @@ int32_t P_ActivateSwitch(int32_t snum, int32_t w, int32_t switchissprite)
|
|||
}
|
||||
}
|
||||
|
||||
if (lotag == 65535)
|
||||
if (lotag == UINT16_MAX)
|
||||
{
|
||||
g_player[myconnectindex].ps->gm = MODE_EOL;
|
||||
|
||||
if (ud.from_bonus)
|
||||
{
|
||||
ud.level_number = ud.from_bonus;
|
||||
ud.m_level_number = ud.level_number;
|
||||
ud.from_bonus = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
ud.level_number++;
|
||||
if (ud.level_number > MAXLEVELS-1)
|
||||
ud.level_number = 0;
|
||||
ud.m_level_number = ud.level_number;
|
||||
}
|
||||
|
||||
P_EndLevel();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -2978,7 +2963,6 @@ static void G_ClearCameras(DukePlayer_t *p)
|
|||
|
||||
void P_CheckSectors(int32_t snum)
|
||||
{
|
||||
int32_t i = -1;
|
||||
DukePlayer_t *const p = g_player[snum].ps;
|
||||
|
||||
if (p->cursectnum > -1)
|
||||
|
@ -2991,22 +2975,8 @@ void P_CheckSectors(int32_t snum)
|
|||
return;
|
||||
|
||||
case UINT16_MAX:
|
||||
for (TRAVERSE_CONNECT(i))
|
||||
g_player[i].ps->gm = MODE_EOL;
|
||||
sector[p->cursectnum].lotag = 0;
|
||||
if (ud.from_bonus)
|
||||
{
|
||||
ud.level_number = ud.from_bonus;
|
||||
ud.m_level_number = ud.level_number;
|
||||
ud.from_bonus = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
ud.level_number++;
|
||||
if (ud.level_number > MAXLEVELS-1)
|
||||
ud.level_number = 0;
|
||||
ud.m_level_number = ud.level_number;
|
||||
}
|
||||
P_EndLevel();
|
||||
return;
|
||||
|
||||
case UINT16_MAX-1:
|
||||
|
@ -3068,7 +3038,7 @@ void P_CheckSectors(int32_t snum)
|
|||
p->toggle_key_flag = 1;
|
||||
hitscanwall = -1;
|
||||
|
||||
i = P_FindWall(p,&hitscanwall);
|
||||
int32_t i = P_FindWall(p,&hitscanwall);
|
||||
|
||||
if (hitscanwall >= 0 && i < 1280 && wall[hitscanwall].overpicnum == MIRROR)
|
||||
if (wall[hitscanwall].lotag > 0 && !A_CheckSoundPlaying(p->i,wall[hitscanwall].lotag) && snum == screenpeek)
|
||||
|
@ -3291,6 +3261,7 @@ void P_CheckSectors(int32_t snum)
|
|||
if (neartagsector >= 0 && (sector[neartagsector].lotag&16384) == 0 &&
|
||||
isanearoperator(sector[neartagsector].lotag))
|
||||
{
|
||||
int32_t i;
|
||||
for (SPRITES_OF_SECT(neartagsector, i))
|
||||
{
|
||||
if (PN == ACTIVATOR || PN == MASTERSWITCH)
|
||||
|
|
Loading…
Reference in a new issue