mirror of
https://github.com/DrBeef/Raze.git
synced 2025-03-22 01:01:04 +00:00
- Exhumed: Eliminate inita
global.
This commit is contained in:
parent
401236980c
commit
5fe4b0fdb1
11 changed files with 19 additions and 41 deletions
|
@ -22,6 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "sequence.h"
|
||||
#include "mapinfo.h"
|
||||
#include <assert.h>
|
||||
#include "player.h"
|
||||
|
||||
BEGIN_PS_NS
|
||||
|
||||
|
@ -53,6 +54,7 @@ DExhumedActor* BuildBubble(const DVector3& pos, sectortype* pSector)
|
|||
}
|
||||
|
||||
auto pActor = insertActor(pSector, 402);
|
||||
auto pPlayerActor = PlayerList[nLocalPlayer].pActor;
|
||||
|
||||
pActor->spr.pos = pos;
|
||||
pActor->spr.cstat = 0;
|
||||
|
@ -63,7 +65,7 @@ DExhumedActor* BuildBubble(const DVector3& pos, sectortype* pSector)
|
|||
pActor->spr.xoffset = 0;
|
||||
pActor->spr.yoffset = 0;
|
||||
pActor->spr.picnum = 1;
|
||||
pActor->spr.Angles.Yaw = inita;
|
||||
pActor->spr.Angles.Yaw = pPlayerActor->spr.Angles.Yaw;
|
||||
pActor->vel.X = 0;
|
||||
pActor->vel.Y = 0;
|
||||
pActor->vel.Z = -1200 / 256.;
|
||||
|
|
|
@ -57,7 +57,6 @@ enum {
|
|||
};
|
||||
|
||||
extern DVector3 initpos;
|
||||
extern DAngle inita;
|
||||
extern sectortype* initsectp;
|
||||
|
||||
extern int nCurChunkNum;
|
||||
|
|
|
@ -369,7 +369,6 @@ void GameInterface::Ticker()
|
|||
{
|
||||
// this must be done before the view is backed up.
|
||||
PlayerList[nLocalPlayer].Angles.resetCameraAngles();
|
||||
UpdatePlayerSpriteAngle(&PlayerList[nLocalPlayer]);
|
||||
|
||||
// disable synchronised input if set by game.
|
||||
resetForcedSyncInput();
|
||||
|
@ -381,7 +380,7 @@ void GameInterface::Ticker()
|
|||
|
||||
auto& lPlayerVel = PlayerList[nLocalPlayer].vel;
|
||||
|
||||
auto inputvect = DVector2(PlayerList[nLocalPlayer].input.fvel, PlayerList[nLocalPlayer].input.svel).Rotated(inita) * 0.375;
|
||||
auto inputvect = DVector2(PlayerList[nLocalPlayer].input.fvel, PlayerList[nLocalPlayer].input.svel).Rotated(PlayerList[nLocalPlayer].pActor->spr.Angles.Yaw) * 0.375;
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
|
|
|
@ -40,7 +40,6 @@ enum
|
|||
};
|
||||
|
||||
DVector3 initpos;
|
||||
DAngle inita;
|
||||
sectortype* initsectp;
|
||||
|
||||
int nCurChunkNum = 0;
|
||||
|
@ -147,7 +146,6 @@ uint8_t LoadLevel(MapRecord* map)
|
|||
SpawnSpriteDef spawned;
|
||||
int16_t mapang;
|
||||
loadMap(currentLevel->fileName, 0, &initpos, &mapang, &initsect, spawned);
|
||||
inita = DAngle::fromBuild(mapang);
|
||||
initsectp = initsect;
|
||||
auto actors = spawnactors(spawned);
|
||||
|
||||
|
@ -164,6 +162,13 @@ uint8_t LoadLevel(MapRecord* map)
|
|||
precache();
|
||||
|
||||
LoadObjects(actors);
|
||||
|
||||
for (int i = 0; i < nTotalPlayers; i++)
|
||||
{
|
||||
SetSavePoint(i, initpos, initsectp, DAngle::fromBuild(mapang));
|
||||
RestartPlayer(i);
|
||||
InitPlayerKeys(i);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -180,13 +185,6 @@ void InitLevel(MapRecord* map)
|
|||
if (!LoadLevel(map)) {
|
||||
I_Error("Cannot load %s...\n", map->fileName.GetChars());
|
||||
}
|
||||
|
||||
for (int i = 0; i < nTotalPlayers; i++)
|
||||
{
|
||||
SetSavePoint(i, initpos, initsectp, inita);
|
||||
RestartPlayer(i);
|
||||
InitPlayerKeys(i);
|
||||
}
|
||||
EndLevel = 0;
|
||||
ResetView();
|
||||
ResetEngine();
|
||||
|
@ -854,7 +852,6 @@ void SerializeInit(FSerializer& arc)
|
|||
if (arc.BeginObject("init"))
|
||||
{
|
||||
arc("init", initpos)
|
||||
("inita", inita)
|
||||
("initsect", initsectp)
|
||||
("curchunk", nCurChunkNum)
|
||||
.Array("counters", Counters, kNumCounters)
|
||||
|
|
|
@ -85,8 +85,6 @@ void GameInterface::GetInput(const double scaleAdjust, InputPacket* packet)
|
|||
{
|
||||
pPlayer->bPlayerPan = pPlayer->bLockPan = true;
|
||||
}
|
||||
|
||||
UpdatePlayerSpriteAngle(pPlayer);
|
||||
}
|
||||
|
||||
if (packet)
|
||||
|
|
|
@ -945,7 +945,6 @@ void MoveSector(sectortype* pSector, DAngle nAngle, DVector2& nVel)
|
|||
*/
|
||||
auto pActor = PlayerList[nLocalPlayer].pActor;
|
||||
initpos = pActor->spr.pos;
|
||||
inita = pActor->spr.Angles.Yaw;
|
||||
initsectp = pActor->sector();
|
||||
}
|
||||
|
||||
|
|
|
@ -73,13 +73,16 @@ static int osdcmd_doors(CCmdFuncPtr parm)
|
|||
|
||||
static int osdcmd_spawn(CCmdFuncPtr parm)
|
||||
{
|
||||
auto pActor = PlayerList[nLocalPlayer].pActor;
|
||||
if (parm->numparms != 1) return CCMD_SHOWHELP;
|
||||
if (!pActor) return CCMD_SHOWHELP;
|
||||
auto c = parm->parms[0];
|
||||
auto sectp = initsectp;
|
||||
auto inita = pActor->spr.Angles.Yaw;
|
||||
if (!stricmp(c, "anubis")) BuildAnubis(nullptr, initpos, sectp, inita, false);
|
||||
else if (!stricmp(c, "spider")) BuildSpider(nullptr, initpos, sectp, inita);
|
||||
else if (!stricmp(c, "mummy")) BuildMummy(nullptr, initpos, sectp, inita);
|
||||
else if (!stricmp(c, "fish")) BuildFish(nullptr, initpos.plusZ(PlayerList[nLocalPlayer].pActor->viewzoffset), sectp, inita);
|
||||
else if (!stricmp(c, "fish")) BuildFish(nullptr, initpos.plusZ(pActor->viewzoffset), sectp, inita);
|
||||
else if (!stricmp(c, "lion")) BuildLion(nullptr, initpos, sectp, inita);
|
||||
else if (!stricmp(c, "lava")) BuildLava(nullptr, initpos, sectp, inita, nNetPlayerCount);
|
||||
else if (!stricmp(c, "rex")) BuildRex(nullptr, initpos, sectp, inita, nNetPlayerCount);
|
||||
|
|
|
@ -664,17 +664,6 @@ static void pickupMessage(int no)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void UpdatePlayerSpriteAngle(Player* pPlayer)
|
||||
{
|
||||
if (pPlayer->pActor) inita = pPlayer->pActor->spr.Angles.Yaw.Normalized360();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void AIPlayer::Draw(RunListEvent* ev)
|
||||
{
|
||||
int nPlayer = RunData[ev->nRun].nObjIndex;
|
||||
|
@ -987,7 +976,6 @@ void AIPlayer::Tick(RunListEvent* ev)
|
|||
}
|
||||
|
||||
PlayerList[nPlayer].Angles.doYawKeys(&PlayerList[nLocalPlayer].input);
|
||||
UpdatePlayerSpriteAngle(&PlayerList[nPlayer]);
|
||||
|
||||
// player.zvel is modified within Gravity()
|
||||
double zVel = pPlayerActor->vel.Z;
|
||||
|
@ -2600,7 +2588,6 @@ sectdone:
|
|||
{
|
||||
initpos = pPlayerActor->spr.pos;
|
||||
initsectp = pPlayerActor->sector();
|
||||
inita = pPlayerActor->spr.Angles.Yaw;
|
||||
}
|
||||
|
||||
if (!PlayerList[nPlayer].nHealth)
|
||||
|
|
|
@ -122,7 +122,6 @@ int GetPlayerFromActor(DExhumedActor* actor);
|
|||
void SetPlayerMummified(int nPlayer, int bIsMummified);
|
||||
int AddAmmo(int nPlayer, int nWeapon, int nAmmoAmount);
|
||||
void ShootStaff(int nPlayer);
|
||||
void UpdatePlayerSpriteAngle(Player* pPlayer);
|
||||
|
||||
END_PS_NS
|
||||
|
||||
|
|
|
@ -500,6 +500,8 @@ void GameInterface::UpdateSounds()
|
|||
if (nFreeze)
|
||||
return;
|
||||
|
||||
const auto pActor = PlayerList[nLocalPlayer].pActor;
|
||||
|
||||
DVector3 pos;
|
||||
DAngle ang;
|
||||
if (nSnakeCam > -1)
|
||||
|
@ -508,10 +510,10 @@ void GameInterface::UpdateSounds()
|
|||
pos = pSnake->pSprites[0]->spr.pos;
|
||||
ang = pSnake->pSprites[0]->spr.Angles.Yaw;
|
||||
}
|
||||
else
|
||||
else if (pActor)
|
||||
{
|
||||
pos = initpos;
|
||||
ang = inita;
|
||||
ang = pActor->spr.Angles.Yaw;
|
||||
}
|
||||
SoundListener listener;
|
||||
listener.angle = float(-ang.Radians()); // Build uses a period of 2048.
|
||||
|
|
|
@ -204,7 +204,6 @@ void DrawView(double interpfrac, bool sceneonly)
|
|||
|
||||
// update render angles.
|
||||
pPlayer->Angles.updateCameraAngles(interpfrac);
|
||||
UpdatePlayerSpriteAngle(pPlayer);
|
||||
|
||||
if (nSnakeCam >= 0 && !sceneonly)
|
||||
{
|
||||
|
@ -342,12 +341,6 @@ void DrawView(double interpfrac, bool sceneonly)
|
|||
if (ang2.Degrees() < 0)
|
||||
ang2 = -ang2;
|
||||
|
||||
if (ang2 > mapangle(10))
|
||||
{
|
||||
inita -= ang2 * (1. / 8.);
|
||||
return;
|
||||
}
|
||||
|
||||
if (bSubTitles)
|
||||
{
|
||||
subtitleOverlay.Start(I_GetTimeNS() * (120. / 1'000'000'000));
|
||||
|
|
Loading…
Reference in a new issue