diff --git a/source/games/blood/src/actor.cpp b/source/games/blood/src/actor.cpp index 8226ff31f..fe3cade9a 100644 --- a/source/games/blood/src/actor.cpp +++ b/source/games/blood/src/actor.cpp @@ -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: diff --git a/source/games/blood/src/animatesprite.cpp b/source/games/blood/src/animatesprite.cpp index 18d208440..f54af0f6d 100644 --- a/source/games/blood/src/animatesprite.cpp +++ b/source/games/blood/src/animatesprite.cpp @@ -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); diff --git a/source/games/blood/src/blood.cpp b/source/games/blood/src/blood.cpp index cbc3ebd9d..18a9cf4ee 100644 --- a/source/games/blood/src/blood.cpp +++ b/source/games/blood/src/blood.cpp @@ -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) diff --git a/source/games/blood/src/view.cpp b/source/games/blood/src/view.cpp index 60b2a5bb1..360e7c16c 100644 --- a/source/games/blood/src/view.cpp +++ b/source/games/blood/src/view.cpp @@ -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);