-fixed: The HUD model info was taken from the wrong player

It used the current console player's camera, not the actual camera being used for rendering. Although this is the same most of the time, let's better do it right.

This also removes a few leftover references to the player array elsewhwere in the hardware renderer
This commit is contained in:
Christoph Oelckers 2019-01-30 01:04:30 +01:00
parent b12de04258
commit c15212ca82
4 changed files with 2 additions and 9 deletions

View file

@ -615,8 +615,6 @@ void GLFlat::ProcessSector(HWDrawInfo *di, sector_t * frontsector, int which)
stack = false; stack = false;
if ((which & SSRF_RENDER3DPLANES) && x.ffloors.Size()) if ((which & SSRF_RENDER3DPLANES) && x.ffloors.Size())
{ {
player_t * player = players[consoleplayer].camera->player;
renderflags = SSRF_RENDER3DPLANES; renderflags = SSRF_RENDER3DPLANES;
srf |= SSRF_RENDER3DPLANES; srf |= SSRF_RENDER3DPLANES;
// 3d-floors must not overlap! // 3d-floors must not overlap!

View file

@ -948,7 +948,6 @@ void HWHorizonPortal::DrawContents(HWDrawInfo *di, FRenderState &state)
Clocker c(PortalAll); Clocker c(PortalAll);
FMaterial * gltexture; FMaterial * gltexture;
player_t * player = &players[consoleplayer];
GLSectorPlane * sp = &origin->plane; GLSectorPlane * sp = &origin->plane;
auto &vp = di->Viewpoint; auto &vp = di->Viewpoint;

View file

@ -753,7 +753,6 @@ void GLSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t
else else
Angles = thing->Angles; Angles = thing->Angles;
player_t *player = &players[consoleplayer];
FloatRect r; FloatRect r;
if (sector->sectornum != thing->Sector->sectornum && !thruportal) if (sector->sectornum != thing->Sector->sectornum && !thruportal)
@ -1069,7 +1068,6 @@ void GLSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t
const bool drawWithXYBillboard = (!(actor->renderflags & RF_FORCEYBILLBOARD) const bool drawWithXYBillboard = (!(actor->renderflags & RF_FORCEYBILLBOARD)
&& (actor->renderflags & RF_SPRITETYPEMASK) == RF_FACESPRITE && (actor->renderflags & RF_SPRITETYPEMASK) == RF_FACESPRITE
&& players[consoleplayer].camera
&& (gl_billboard_mode == 1 || actor->renderflags & RF_FORCEXYBILLBOARD)); && (gl_billboard_mode == 1 || actor->renderflags & RF_FORCEXYBILLBOARD));
@ -1113,8 +1111,6 @@ void GLSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t
void GLSprite::ProcessParticle (HWDrawInfo *di, particle_t *particle, sector_t *sector)//, int shade, int fakeside) void GLSprite::ProcessParticle (HWDrawInfo *di, particle_t *particle, sector_t *sector)//, int shade, int fakeside)
{ {
player_t *player=&players[consoleplayer];
if (particle->alpha==0) return; if (particle->alpha==0) return;
lightlevel = hw_ClampLight(sector->GetTexture(sector_t::ceiling) == skyflatnum ? lightlevel = hw_ClampLight(sector->GetTexture(sector_t::ceiling) == skyflatnum ?

View file

@ -488,8 +488,7 @@ void HWDrawInfo::PreparePlayerSprites(sector_t * viewsector, area_t in_area)
bool brightflash = false; bool brightflash = false;
AActor * playermo = players[consoleplayer].camera; AActor * playermo = players[consoleplayer].camera;
player_t * player = playermo->player; player_t * player = playermo->player;
const bool hudModelStep = IsHUDModelForPlayerAvailable(player);
const auto &vp = Viewpoint; const auto &vp = Viewpoint;
AActor *camera = vp.camera; AActor *camera = vp.camera;
@ -502,6 +501,7 @@ void HWDrawInfo::PreparePlayerSprites(sector_t * viewsector, area_t in_area)
(r_deathcamera && camera->health <= 0)) (r_deathcamera && camera->health <= 0))
return; return;
const bool hudModelStep = IsHUDModelForPlayerAvailable(camera->player);
WeaponPosition weap = GetWeaponPosition(camera->player, vp.TicFrac); WeaponPosition weap = GetWeaponPosition(camera->player, vp.TicFrac);
WeaponLighting light = GetWeaponLighting(viewsector, vp.Pos, isFullbrightScene(), in_area, camera->Pos()); WeaponLighting light = GetWeaponLighting(viewsector, vp.Pos, isFullbrightScene(), in_area, camera->Pos());