mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 09:11:48 +00:00
Call P_ResetCamera Upon Switching To/From an Away View Camera
This commit is contained in:
parent
d6d424f102
commit
aa43aa7c8c
3 changed files with 22 additions and 4 deletions
|
@ -710,6 +710,10 @@ static int player_set(lua_State *L)
|
|||
if (!lua_isnil(L, 3))
|
||||
mo = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ));
|
||||
P_SetTarget(&plr->awayviewmobj, mo);
|
||||
if (plr == &players[displayplayer])
|
||||
P_ResetCamera(plr, &camera); // reset p1 camera on p1 getting an awayviewmobj
|
||||
else if (splitscreen && plr == &players[secondarydisplayplayer])
|
||||
P_ResetCamera(plr, &camera2); // reset p2 camera on p2 getting an awayviewmobj
|
||||
}
|
||||
else if (fastcmp(field,"awayviewtics"))
|
||||
{
|
||||
|
|
|
@ -2669,6 +2669,11 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
|||
{
|
||||
P_SetTarget(&mo->player->awayviewmobj, altview);
|
||||
mo->player->awayviewtics = line->args[1];
|
||||
|
||||
if (mo->player == &players[displayplayer])
|
||||
P_ResetCamera(mo->player, &camera); // reset p1 camera on p1 getting an awayviewmobj
|
||||
else if (splitscreen && mo->player == &players[secondarydisplayplayer])
|
||||
P_ResetCamera(mo->player, &camera2); // reset p2 camera on p2 getting an awayviewmobj
|
||||
}
|
||||
|
||||
aim = udmf ? altview->spawnpoint->pitch : line->args[2];
|
||||
|
|
17
src/p_user.c
17
src/p_user.c
|
@ -11507,15 +11507,24 @@ void P_PlayerThink(player_t *player)
|
|||
if (player->awayviewmobj && P_MobjWasRemoved(player->awayviewmobj))
|
||||
{
|
||||
P_SetTarget(&player->awayviewmobj, NULL); // remove awayviewmobj asap if invalid
|
||||
player->awayviewtics = 0; // reset to zero
|
||||
player->awayviewtics = 1; // reset to one, the below code will immediately set it to zero
|
||||
}
|
||||
|
||||
if (player->awayviewtics && player->awayviewtics != -1)
|
||||
{
|
||||
player->awayviewtics--;
|
||||
if (!(player->awayviewtics))
|
||||
{
|
||||
if (player == &players[displayplayer])
|
||||
P_ResetCamera(player, &camera); // reset p1 camera on p1 running out of awayviewtics
|
||||
else if (splitscreen && player == &players[secondarydisplayplayer])
|
||||
P_ResetCamera(player, &camera2); // reset p2 camera on p2 running out of awayviewtics
|
||||
}
|
||||
}
|
||||
|
||||
if (player->flashcount)
|
||||
player->flashcount--;
|
||||
|
||||
if (player->awayviewtics && player->awayviewtics != -1)
|
||||
player->awayviewtics--;
|
||||
|
||||
/// \note do this in the cheat code
|
||||
if (player->pflags & PF_NOCLIP)
|
||||
player->mo->flags |= MF_NOCLIP;
|
||||
|
|
Loading…
Reference in a new issue