- fixed: gView references gViewIndex, not myconnectindex.

This commit is contained in:
Christoph Oelckers 2022-09-24 12:42:05 +02:00
parent 59bee2f9f6
commit 96a5954c80
4 changed files with 9 additions and 8 deletions

View file

@ -4927,11 +4927,11 @@ void MoveDude(DBloodActor* actor)
switch (nLink)
{
case kMarkerLowStack:
if (pPlayer->nPlayer == myconnectindex)
if (pPlayer && pPlayer->nPlayer == gViewIndex)
gotpic.Set(actor->sector()->floorpicnum);
break;
case kMarkerUpStack:
if (pPlayer->nPlayer == myconnectindex)
if (pPlayer && pPlayer->nPlayer == gViewIndex)
gotpic.Set(actor->sector()->ceilingpicnum);
break;
case kMarkerLowWater:

View file

@ -477,13 +477,14 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF
auto& nVoxel = voxelIndex[nTile];
if (cl_showweapon == 2 && r_voxels && nVoxel != -1)
{
pNSprite->angle = (pPlayer->actor->spr.angle + DAngle90).Normalized360(); // always face viewer
auto gView = &gPlayer[gViewIndex];
pNSprite->set_int_ang((gView->actor->int_ang() + 512) & 2047); // always face viewer
pNSprite->cstat |= CSTAT_SPRITE_ALIGNMENT_SLAB;
pNSprite->cstat &= ~CSTAT_SPRITE_YFLIP;
pNSprite->picnum = nVoxel;
if (pPlayer->curWeapon == kWeapLifeLeech) // position lifeleech behind player
{
pNSprite->pos.XY() += pPlayer->actor->spr.angle.ToVector() * 8;
pNSprite->pos.XY() += gView->actor->spr.angle.ToVector() * 8;
}
if ((pPlayer->curWeapon == kWeapLifeLeech) || (pPlayer->curWeapon == kWeapVoodooDoll)) // make lifeleech/voodoo doll always face viewer like sprite
pNSprite->set_int_ang((pNSprite->int_ang() + 512) & 2047); // offset angle 90 degrees
@ -524,7 +525,7 @@ static int GetOctant(int x, int y)
void viewProcessSprites(tspriteArray& tsprites, int32_t cX, int32_t cY, int32_t cZ, DAngle cA, double interpfrac)
{
PLAYER* pPlayer = &gPlayer[myconnectindex];
PLAYER* pPlayer = &gPlayer[gViewIndex];
int nViewSprites = tsprites.Size();
// shift before interpolating to increase precision.
DAngle myclock = DAngle::fromDeg(((PlayClock << 3) + (4 << 3) * interpfrac) * BAngToDegree);

View file

@ -773,7 +773,7 @@ DEFINE_ACTION_FUNCTION(_Blood, PowerupIcon)
DEFINE_ACTION_FUNCTION(_Blood, GetViewPlayer)
{
PARAM_PROLOGUE;
ACTION_RETURN_POINTER(&gPlayer[myconnectindex]);
ACTION_RETURN_POINTER(&gPlayer[gViewIndex]);
}
DEFINE_ACTION_FUNCTION(_BloodPlayer, GetHealth)

View file

@ -610,7 +610,7 @@ void renderCrystalBall()
void viewDrawScreen(bool sceneonly)
{
PLAYER* pPlayer = &gPlayer[myconnectindex];
PLAYER* pPlayer = &gPlayer[gViewIndex];
if (testgotpic(2342, true))
{
@ -841,7 +841,7 @@ bool GameInterface::DrawAutomapPlayer(const DVector2& mxy, const DVector2& cpos,
for (int i = connecthead; i >= 0; i = connectpoint2[i])
{
if (i == myconnectindex || gGameOptions.nGameType == 1)
if (i == gViewIndex || gGameOptions.nGameType == 1)
{
auto actor = gPlayer[i].actor;
auto vect = OutAutomapVector(mxy - cpos, cangvect, czoom, xydim);