From c15212ca82cc715ff4b6dc1bd92cc8f18760db68 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 30 Jan 2019 01:04:30 +0100 Subject: [PATCH] -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 --- src/hwrenderer/scene/hw_flats.cpp | 2 -- src/hwrenderer/scene/hw_portal.cpp | 1 - src/hwrenderer/scene/hw_sprites.cpp | 4 ---- src/hwrenderer/scene/hw_weapon.cpp | 4 ++-- 4 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/hwrenderer/scene/hw_flats.cpp b/src/hwrenderer/scene/hw_flats.cpp index d4bc79ee2c..9d2c13633f 100644 --- a/src/hwrenderer/scene/hw_flats.cpp +++ b/src/hwrenderer/scene/hw_flats.cpp @@ -615,8 +615,6 @@ void GLFlat::ProcessSector(HWDrawInfo *di, sector_t * frontsector, int which) stack = false; if ((which & SSRF_RENDER3DPLANES) && x.ffloors.Size()) { - player_t * player = players[consoleplayer].camera->player; - renderflags = SSRF_RENDER3DPLANES; srf |= SSRF_RENDER3DPLANES; // 3d-floors must not overlap! diff --git a/src/hwrenderer/scene/hw_portal.cpp b/src/hwrenderer/scene/hw_portal.cpp index b052c26769..a9b0b25150 100644 --- a/src/hwrenderer/scene/hw_portal.cpp +++ b/src/hwrenderer/scene/hw_portal.cpp @@ -948,7 +948,6 @@ void HWHorizonPortal::DrawContents(HWDrawInfo *di, FRenderState &state) Clocker c(PortalAll); FMaterial * gltexture; - player_t * player = &players[consoleplayer]; GLSectorPlane * sp = &origin->plane; auto &vp = di->Viewpoint; diff --git a/src/hwrenderer/scene/hw_sprites.cpp b/src/hwrenderer/scene/hw_sprites.cpp index eb0874e7b2..14c6d60f0a 100644 --- a/src/hwrenderer/scene/hw_sprites.cpp +++ b/src/hwrenderer/scene/hw_sprites.cpp @@ -753,7 +753,6 @@ void GLSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t else Angles = thing->Angles; - player_t *player = &players[consoleplayer]; FloatRect r; 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) && (actor->renderflags & RF_SPRITETYPEMASK) == RF_FACESPRITE - && players[consoleplayer].camera && (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) { - player_t *player=&players[consoleplayer]; - if (particle->alpha==0) return; lightlevel = hw_ClampLight(sector->GetTexture(sector_t::ceiling) == skyflatnum ? diff --git a/src/hwrenderer/scene/hw_weapon.cpp b/src/hwrenderer/scene/hw_weapon.cpp index 96bd52b630..db45bb2bb2 100644 --- a/src/hwrenderer/scene/hw_weapon.cpp +++ b/src/hwrenderer/scene/hw_weapon.cpp @@ -488,8 +488,7 @@ void HWDrawInfo::PreparePlayerSprites(sector_t * viewsector, area_t in_area) bool brightflash = false; AActor * playermo = players[consoleplayer].camera; player_t * player = playermo->player; - const bool hudModelStep = IsHUDModelForPlayerAvailable(player); - + const auto &vp = Viewpoint; AActor *camera = vp.camera; @@ -502,6 +501,7 @@ void HWDrawInfo::PreparePlayerSprites(sector_t * viewsector, area_t in_area) (r_deathcamera && camera->health <= 0)) return; + const bool hudModelStep = IsHUDModelForPlayerAvailable(camera->player); WeaponPosition weap = GetWeaponPosition(camera->player, vp.TicFrac); WeaponLighting light = GetWeaponLighting(viewsector, vp.Pos, isFullbrightScene(), in_area, camera->Pos());