mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-12-01 00:12:27 +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);
|
pnum = int(pawn->player - players);
|
||||||
pawn->ChangeStatNum (STAT_PLAYER);
|
pawn->ChangeStatNum (STAT_PLAYER);
|
||||||
pawndup = pawn->player->mo;
|
pawndup = pawn->player->mo;
|
||||||
start = NULL;
|
|
||||||
assert (pawn != pawndup);
|
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
start = G_PickPlayerStart(pnum, 0);
|
||||||
if (start == NULL)
|
if (start == NULL)
|
||||||
{
|
{
|
||||||
start = G_PickPlayerStart(pnum, 0);
|
if (pawndup != nullptr)
|
||||||
if (start == NULL)
|
|
||||||
{
|
{
|
||||||
Printf(TEXTCOLOR_RED "No player %d start to travel to!\n", pnum + 1);
|
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.
|
// Move to the coordinates this player had when they left the level.
|
||||||
pawn->SetXYZ(pawndup->Pos());
|
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;
|
oldpawn = pawndup;
|
||||||
|
|
||||||
|
@ -1266,8 +1260,11 @@ void G_FinishTravel ()
|
||||||
pawn->player->camera = pawn;
|
pawn->player->camera = pawn;
|
||||||
pawn->player->viewheight = pawn->ViewHeight;
|
pawn->player->viewheight = pawn->ViewHeight;
|
||||||
pawn->flags2 &= ~MF2_BLASTED;
|
pawn->flags2 &= ~MF2_BLASTED;
|
||||||
DObject::StaticPointerSubstitution (oldpawn, pawn);
|
if (oldpawn != nullptr)
|
||||||
oldpawn->Destroy();
|
{
|
||||||
|
DObject::StaticPointerSubstitution (oldpawn, pawn);
|
||||||
|
oldpawn->Destroy();
|
||||||
|
}
|
||||||
if (pawndup != NULL)
|
if (pawndup != NULL)
|
||||||
{
|
{
|
||||||
pawndup->Destroy();
|
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);
|
return OSSwapLittleToHostInt16((uint16_t)x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline unsigned short LittleShort(unsigned int x)
|
||||||
|
{
|
||||||
|
return OSSwapLittleToHostInt16((uint16_t)x);
|
||||||
|
}
|
||||||
|
|
||||||
inline int LittleLong(int x)
|
inline int LittleLong(int x)
|
||||||
{
|
{
|
||||||
return OSSwapLittleToHostInt32((uint32_t)x);
|
return OSSwapLittleToHostInt32((uint32_t)x);
|
||||||
|
@ -56,6 +61,16 @@ inline unsigned int LittleLong(unsigned int x)
|
||||||
return OSSwapLittleToHostInt32(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)
|
inline short BigShort(short x)
|
||||||
{
|
{
|
||||||
return (short)OSSwapBigToHostInt16((uint16_t)x);
|
return (short)OSSwapBigToHostInt16((uint16_t)x);
|
||||||
|
|
|
@ -70,6 +70,7 @@
|
||||||
#include "p_spec.h"
|
#include "p_spec.h"
|
||||||
#include "p_checkposition.h"
|
#include "p_checkposition.h"
|
||||||
#include "serializer.h"
|
#include "serializer.h"
|
||||||
|
#include "r_utility.h"
|
||||||
|
|
||||||
// MACROS ------------------------------------------------------------------
|
// MACROS ------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -1040,10 +1041,10 @@ bool AActor::IsInsideVisibleAngles() const
|
||||||
if (players[consoleplayer].camera == nullptr)
|
if (players[consoleplayer].camera == nullptr)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
DAngle anglestart = VisibleStartAngle.Normalized180();
|
DAngle anglestart = VisibleStartAngle;
|
||||||
DAngle angleend = VisibleEndAngle.Normalized180();
|
DAngle angleend = VisibleEndAngle;
|
||||||
DAngle pitchstart = VisibleStartPitch.Normalized180();
|
DAngle pitchstart = VisibleStartPitch;
|
||||||
DAngle pitchend = VisibleEndPitch.Normalized180();
|
DAngle pitchend = VisibleEndPitch;
|
||||||
|
|
||||||
if (anglestart > angleend)
|
if (anglestart > angleend)
|
||||||
{
|
{
|
||||||
|
@ -1052,28 +1053,26 @@ bool AActor::IsInsideVisibleAngles() const
|
||||||
angleend = temp;
|
angleend = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pitchstart > angleend)
|
if (pitchstart > pitchend)
|
||||||
{
|
{
|
||||||
DAngle temp = pitchstart;
|
DAngle temp = pitchstart;
|
||||||
pitchstart = pitchend;
|
pitchstart = pitchend;
|
||||||
pitchend = temp;
|
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();
|
DAngle to = diffang.Angle();
|
||||||
|
|
||||||
if (!(renderflags & RF_ABSMASKANGLE))
|
if (!(renderflags & RF_ABSMASKANGLE))
|
||||||
to = deltaangle(Angles.Yaw, to);
|
to = deltaangle(Angles.Yaw, to);
|
||||||
|
|
||||||
// Note that this check is inversed due to only being able to vectorize
|
if ((to >= anglestart && to <= angleend))
|
||||||
// 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))
|
|
||||||
{
|
{
|
||||||
to = diffang.Pitch();
|
to = diffang.Pitch();
|
||||||
if (!(renderflags & RF_ABSMASKPITCH))
|
if (!(renderflags & RF_ABSMASKPITCH))
|
||||||
|
|
|
@ -539,7 +539,7 @@ void P_SerializeSounds(FSerializer &arc)
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
void CopyPlayer(player_t *dst, player_t *src, const char *name);
|
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 ReadMultiplePlayers(FSerializer &arc, int numPlayers, int numPlayersNow, bool skipload);
|
||||||
static void SpawnExtraPlayers();
|
static void SpawnExtraPlayers();
|
||||||
|
|
||||||
|
@ -596,7 +596,7 @@ void P_SerializePlayers(FSerializer &arc, bool skipload)
|
||||||
// first player present, no matter what their name.
|
// first player present, no matter what their name.
|
||||||
if (numPlayers == 1)
|
if (numPlayers == 1)
|
||||||
{
|
{
|
||||||
ReadOnePlayer(arc, skipload);
|
ReadOnePlayer(arc);
|
||||||
}
|
}
|
||||||
else
|
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;
|
int i;
|
||||||
const char *name = NULL;
|
const char *name = NULL;
|
||||||
|
@ -638,10 +638,7 @@ static void ReadOnePlayer(FSerializer &arc, bool skipload)
|
||||||
didIt = true;
|
didIt = true;
|
||||||
player_t playerTemp;
|
player_t playerTemp;
|
||||||
playerTemp.Serialize(arc);
|
playerTemp.Serialize(arc);
|
||||||
if (!skipload)
|
CopyPlayer(&players[i], &playerTemp, name);
|
||||||
{
|
|
||||||
CopyPlayer(&players[i], &playerTemp, name);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -1294,7 +1294,7 @@ FSerializer &SerializePointer(FSerializer &arc, const char *key, T *&value, T **
|
||||||
assert(base != nullptr);
|
assert(base != nullptr);
|
||||||
if (arc.isReading() || !arc.w->inObject() || defval == nullptr || value != *defval)
|
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);
|
Serialize(arc, key, vv, nullptr);
|
||||||
value = vv < 0 ? nullptr : base + vv;
|
value = vv < 0 ? nullptr : base + vv;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1437,7 +1437,7 @@ DEFINE_PROPERTY(spriterotation, F, Actor)
|
||||||
DEFINE_PROPERTY(visibleangles, Ff, Actor)
|
DEFINE_PROPERTY(visibleangles, Ff, Actor)
|
||||||
{
|
{
|
||||||
PROP_DOUBLE_PARM(visstart, 0);
|
PROP_DOUBLE_PARM(visstart, 0);
|
||||||
PROP_DOUBLE_PARM(visend, 0);
|
PROP_DOUBLE_PARM(visend, 1);
|
||||||
defaults->VisibleStartAngle = visstart;
|
defaults->VisibleStartAngle = visstart;
|
||||||
defaults->VisibleEndAngle = visend;
|
defaults->VisibleEndAngle = visend;
|
||||||
}
|
}
|
||||||
|
@ -1448,7 +1448,7 @@ DEFINE_PROPERTY(visibleangles, Ff, Actor)
|
||||||
DEFINE_PROPERTY(visiblepitch, Ff, Actor)
|
DEFINE_PROPERTY(visiblepitch, Ff, Actor)
|
||||||
{
|
{
|
||||||
PROP_DOUBLE_PARM(visstart, 0);
|
PROP_DOUBLE_PARM(visstart, 0);
|
||||||
PROP_DOUBLE_PARM(visend, 0);
|
PROP_DOUBLE_PARM(visend, 1);
|
||||||
defaults->VisibleStartPitch = visstart;
|
defaults->VisibleStartPitch = visstart;
|
||||||
defaults->VisibleEndPitch = visend;
|
defaults->VisibleEndPitch = visend;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue