mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-22 04:21:23 +00:00
Fix automatic mode z-target bugs and crashes
This commit is contained in:
parent
b6544efceb
commit
92cccd682c
1 changed files with 12 additions and 9 deletions
21
src/g_game.c
21
src/g_game.c
|
@ -1363,11 +1363,11 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||
axis = PlayerJoyAxis(ssplayer, JA_FIRENORMAL);
|
||||
if (PLAYERINPUTDOWN(ssplayer, GC_FIRENORMAL) || (usejoystick && axis > 0))
|
||||
cmd->buttons |= BT_FIRENORMAL;
|
||||
|
||||
|
||||
// Toss flag button
|
||||
if (PLAYERINPUTDOWN(ssplayer, GC_TOSSFLAG))
|
||||
cmd->buttons |= BT_TOSSFLAG;
|
||||
|
||||
|
||||
// Shield button
|
||||
axis = PlayerJoyAxis(ssplayer, JA_SHIELD);
|
||||
if (PLAYERINPUTDOWN(ssplayer, GC_SHIELD) || (usejoystick && axis > 0))
|
||||
|
@ -1420,7 +1420,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||
|
||||
ticcmd_centerviewdown[forplayer] = true;
|
||||
}
|
||||
else if (ticcmd_centerviewdown[forplayer])
|
||||
else if (ticcmd_centerviewdown[forplayer] || (leveltime < 5))
|
||||
{
|
||||
if (controlstyle == CS_SIMPLE)
|
||||
{
|
||||
|
@ -1435,6 +1435,9 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||
{
|
||||
if (
|
||||
P_MobjWasRemoved(ticcmd_ztargetfocus[forplayer]) ||
|
||||
(leveltime < 5) ||
|
||||
(player->playerstate != PST_LIVE) ||
|
||||
player->exiting ||
|
||||
!ticcmd_ztargetfocus[forplayer]->health ||
|
||||
(ticcmd_ztargetfocus[forplayer]->type == MT_EGGMOBILE3 && !ticcmd_ztargetfocus[forplayer]->movecount) // Sea Egg is moving around underground and shouldn't be tracked
|
||||
)
|
||||
|
@ -1466,7 +1469,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||
P_SetTarget(&newtarget->target, ticcmd_ztargetfocus[forplayer]);
|
||||
newtarget->drawonlyforplayer = player; // Hide it from the other player in splitscreen, and yourself when spectating
|
||||
|
||||
if (player->mo && P_AproxDistance(
|
||||
if (player->mo && R_PointToDist2(0, 0,
|
||||
player->mo->x - ticcmd_ztargetfocus[forplayer]->x,
|
||||
player->mo->y - ticcmd_ztargetfocus[forplayer]->y
|
||||
) > 50*player->mo->scale)
|
||||
|
@ -4018,7 +4021,7 @@ INT16 G_GetNextMap(boolean ignoretokens, boolean silent)
|
|||
INT32 i;
|
||||
INT16 newmapnum;
|
||||
boolean spec = G_IsSpecialStage(gamemap);
|
||||
|
||||
|
||||
// go to next level
|
||||
// newmapnum is 0-based, unlike gamemap
|
||||
if (nextmapoverride != 0)
|
||||
|
@ -4122,7 +4125,7 @@ INT16 G_GetNextMap(boolean ignoretokens, boolean silent)
|
|||
|
||||
if (spec && (!gottoken || ignoretokens) && !nextmapoverride)
|
||||
newmapnum = lastmap; // Exiting from a special stage? Go back to the game. Tails 08-11-2001
|
||||
|
||||
|
||||
if (!(gametyperules & GTR_CAMPAIGN))
|
||||
{
|
||||
if (cv_advancemap.value == 0) // Stay on same map.
|
||||
|
@ -4130,7 +4133,7 @@ INT16 G_GetNextMap(boolean ignoretokens, boolean silent)
|
|||
else if (cv_advancemap.value == 2) // Go to random map.
|
||||
newmapnum = RandMap(G_TOLFlag(gametype_to_use), prevmap);
|
||||
}
|
||||
|
||||
|
||||
return newmapnum;
|
||||
}
|
||||
|
||||
|
@ -4140,7 +4143,7 @@ INT16 G_GetNextMap(boolean ignoretokens, boolean silent)
|
|||
static void G_DoCompleted(void)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
|
||||
tokenlist = 0; // Reset the list
|
||||
|
||||
if (modeattacking && pausedelay)
|
||||
|
@ -4168,7 +4171,7 @@ static void G_DoCompleted(void)
|
|||
//Get and set prevmap/nextmap
|
||||
prevmap = (INT16)(gamemap-1);
|
||||
nextmap = G_GetNextMap(false, false);
|
||||
|
||||
|
||||
automapactive = false;
|
||||
|
||||
// We are committed to this map now.
|
||||
|
|
Loading…
Reference in a new issue