mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-24 13:01:48 +00:00
This commit is contained in:
commit
1c25ad7ce4
6 changed files with 48 additions and 40 deletions
|
@ -1207,29 +1207,23 @@ void G_FinishTravel ()
|
|||
pnum = int(pawn->player - players);
|
||||
pawn->ChangeStatNum (STAT_PLAYER);
|
||||
pawndup = pawn->player->mo;
|
||||
start = NULL;
|
||||
assert (pawn != pawndup);
|
||||
if (pawndup == NULL)
|
||||
{ // Oh no! there was no start for this player!
|
||||
start = G_PickPlayerStart(pnum, PPS_FORCERANDOM);
|
||||
if (start != NULL) pawndup = P_SpawnPlayer(start, pnum, (level.flags2 & LEVEL2_PRERAISEWEAPON) ? SPF_WEAPONFULLYUP : 0);
|
||||
if (pawndup == NULL)
|
||||
{
|
||||
pawn->flags |= MF_NOSECTOR | MF_NOBLOCKMAP;
|
||||
pawn->Destroy();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (start == NULL)
|
||||
{
|
||||
start = G_PickPlayerStart(pnum, 0);
|
||||
if (start == NULL)
|
||||
{
|
||||
if (pawndup != nullptr)
|
||||
{
|
||||
Printf(TEXTCOLOR_RED "No player %d start to travel to!\n", pnum + 1);
|
||||
// Move to the coordinates this player had when they left the level.
|
||||
pawn->SetXYZ(pawndup->Pos());
|
||||
}
|
||||
else
|
||||
{
|
||||
// Could not find a start for this player at all. This really should never happen but if it does, let's better abort.
|
||||
DThinker::DestroyThinkersInList(STAT_TRAVELLING);
|
||||
I_Error ("No player %d start to travel to!\n", pnum + 1);
|
||||
}
|
||||
}
|
||||
oldpawn = pawndup;
|
||||
|
||||
|
@ -1266,8 +1260,11 @@ void G_FinishTravel ()
|
|||
pawn->player->camera = pawn;
|
||||
pawn->player->viewheight = pawn->ViewHeight;
|
||||
pawn->flags2 &= ~MF2_BLASTED;
|
||||
if (oldpawn != nullptr)
|
||||
{
|
||||
DObject::StaticPointerSubstitution (oldpawn, pawn);
|
||||
oldpawn->Destroy();
|
||||
}
|
||||
if (pawndup != NULL)
|
||||
{
|
||||
pawndup->Destroy();
|
||||
|
|
15
src/m_swap.h
15
src/m_swap.h
|
@ -46,6 +46,11 @@ inline short LittleShort(int x)
|
|||
return OSSwapLittleToHostInt16((uint16_t)x);
|
||||
}
|
||||
|
||||
inline unsigned short LittleShort(unsigned int x)
|
||||
{
|
||||
return OSSwapLittleToHostInt16((uint16_t)x);
|
||||
}
|
||||
|
||||
inline int LittleLong(int x)
|
||||
{
|
||||
return OSSwapLittleToHostInt32((uint32_t)x);
|
||||
|
@ -56,6 +61,16 @@ inline unsigned int LittleLong(unsigned int x)
|
|||
return OSSwapLittleToHostInt32(x);
|
||||
}
|
||||
|
||||
inline int LittleLong(long x)
|
||||
{
|
||||
return OSSwapLittleToHostInt32((uint32_t)x);
|
||||
}
|
||||
|
||||
inline unsigned int LittleLong(unsigned long x)
|
||||
{
|
||||
return OSSwapLittleToHostInt32((uint32_t)x);
|
||||
}
|
||||
|
||||
inline short BigShort(short x)
|
||||
{
|
||||
return (short)OSSwapBigToHostInt16((uint16_t)x);
|
||||
|
|
|
@ -70,6 +70,7 @@
|
|||
#include "p_spec.h"
|
||||
#include "p_checkposition.h"
|
||||
#include "serializer.h"
|
||||
#include "r_utility.h"
|
||||
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
||||
|
@ -1040,10 +1041,10 @@ bool AActor::IsInsideVisibleAngles() const
|
|||
if (players[consoleplayer].camera == nullptr)
|
||||
return true;
|
||||
|
||||
DAngle anglestart = VisibleStartAngle.Normalized180();
|
||||
DAngle angleend = VisibleEndAngle.Normalized180();
|
||||
DAngle pitchstart = VisibleStartPitch.Normalized180();
|
||||
DAngle pitchend = VisibleEndPitch.Normalized180();
|
||||
DAngle anglestart = VisibleStartAngle;
|
||||
DAngle angleend = VisibleEndAngle;
|
||||
DAngle pitchstart = VisibleStartPitch;
|
||||
DAngle pitchend = VisibleEndPitch;
|
||||
|
||||
if (anglestart > angleend)
|
||||
{
|
||||
|
@ -1052,28 +1053,26 @@ bool AActor::IsInsideVisibleAngles() const
|
|||
angleend = temp;
|
||||
}
|
||||
|
||||
if (pitchstart > angleend)
|
||||
if (pitchstart > pitchend)
|
||||
{
|
||||
DAngle temp = pitchstart;
|
||||
pitchstart = pitchend;
|
||||
pitchend = temp;
|
||||
}
|
||||
|
||||
player_t* pPlayer = players[consoleplayer].camera->player;
|
||||
|
||||
if (pPlayer && pPlayer->mo)
|
||||
AActor *mo = players[consoleplayer].camera;
|
||||
|
||||
if (mo != nullptr)
|
||||
{
|
||||
AActor *mo = pPlayer->mo;
|
||||
DVector3 diffang = Vec3To(mo);
|
||||
|
||||
DVector3 diffang = ViewPos - Pos();
|
||||
DAngle to = diffang.Angle();
|
||||
|
||||
if (!(renderflags & RF_ABSMASKANGLE))
|
||||
to = deltaangle(Angles.Yaw, to);
|
||||
|
||||
// Note that this check is inversed due to only being able to vectorize
|
||||
// from one way (this actor to the player). It still means to pass
|
||||
// if the player is within the visible angles.
|
||||
if ((to <= anglestart || to >= angleend))
|
||||
if ((to >= anglestart && to <= angleend))
|
||||
{
|
||||
to = diffang.Pitch();
|
||||
if (!(renderflags & RF_ABSMASKPITCH))
|
||||
|
|
|
@ -539,7 +539,7 @@ void P_SerializeSounds(FSerializer &arc)
|
|||
//==========================================================================
|
||||
|
||||
void CopyPlayer(player_t *dst, player_t *src, const char *name);
|
||||
static void ReadOnePlayer(FSerializer &arc, bool skipload);
|
||||
static void ReadOnePlayer(FSerializer &arc);
|
||||
static void ReadMultiplePlayers(FSerializer &arc, int numPlayers, int numPlayersNow, bool skipload);
|
||||
static void SpawnExtraPlayers();
|
||||
|
||||
|
@ -596,7 +596,7 @@ void P_SerializePlayers(FSerializer &arc, bool skipload)
|
|||
// first player present, no matter what their name.
|
||||
if (numPlayers == 1)
|
||||
{
|
||||
ReadOnePlayer(arc, skipload);
|
||||
ReadOnePlayer(arc);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -619,7 +619,7 @@ void P_SerializePlayers(FSerializer &arc, bool skipload)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
static void ReadOnePlayer(FSerializer &arc, bool skipload)
|
||||
static void ReadOnePlayer(FSerializer &arc)
|
||||
{
|
||||
int i;
|
||||
const char *name = NULL;
|
||||
|
@ -638,11 +638,8 @@ static void ReadOnePlayer(FSerializer &arc, bool skipload)
|
|||
didIt = true;
|
||||
player_t playerTemp;
|
||||
playerTemp.Serialize(arc);
|
||||
if (!skipload)
|
||||
{
|
||||
CopyPlayer(&players[i], &playerTemp, name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (players[i].mo != NULL)
|
||||
|
|
|
@ -1294,7 +1294,7 @@ FSerializer &SerializePointer(FSerializer &arc, const char *key, T *&value, T **
|
|||
assert(base != nullptr);
|
||||
if (arc.isReading() || !arc.w->inObject() || defval == nullptr || value != *defval)
|
||||
{
|
||||
ptrdiff_t vv = value == nullptr ? -1 : value - base;
|
||||
int64_t vv = value == nullptr ? -1 : value - base;
|
||||
Serialize(arc, key, vv, nullptr);
|
||||
value = vv < 0 ? nullptr : base + vv;
|
||||
}
|
||||
|
|
|
@ -1437,7 +1437,7 @@ DEFINE_PROPERTY(spriterotation, F, Actor)
|
|||
DEFINE_PROPERTY(visibleangles, Ff, Actor)
|
||||
{
|
||||
PROP_DOUBLE_PARM(visstart, 0);
|
||||
PROP_DOUBLE_PARM(visend, 0);
|
||||
PROP_DOUBLE_PARM(visend, 1);
|
||||
defaults->VisibleStartAngle = visstart;
|
||||
defaults->VisibleEndAngle = visend;
|
||||
}
|
||||
|
@ -1448,7 +1448,7 @@ DEFINE_PROPERTY(visibleangles, Ff, Actor)
|
|||
DEFINE_PROPERTY(visiblepitch, Ff, Actor)
|
||||
{
|
||||
PROP_DOUBLE_PARM(visstart, 0);
|
||||
PROP_DOUBLE_PARM(visend, 0);
|
||||
PROP_DOUBLE_PARM(visend, 1);
|
||||
defaults->VisibleStartPitch = visstart;
|
||||
defaults->VisibleEndPitch = visend;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue