- consolidated the 3 nearly identical code fragments handling the weapon's YAdjust for the different renderers into a utility function in DPSprite.

This commit is contained in:
Christoph Oelckers 2018-11-24 22:40:14 +01:00
commit ead28db007
5 changed files with 31 additions and 39 deletions

View file

@ -44,6 +44,7 @@
#include "cmdlib.h"
#include "g_levellocals.h"
#include "vm.h"
#include "sbar.h"
// MACROS ------------------------------------------------------------------
@ -1348,6 +1349,32 @@ void DPSprite::OnDestroy()
//
//------------------------------------------------------------------------
float DPSprite::GetYAdjust(bool fullscreen)
{
AWeapon *weapon = dyn_cast<AWeapon>(GetCaller());
if (weapon != nullptr)
{
float fYAd = weapon->YAdjust;
if (fYAd != 0)
{
if (fullscreen)
{
return fYAd;
}
else
{
return StatusBar->GetDisplacement() * fYAd;
}
}
}
}
//------------------------------------------------------------------------
//
//
//
//------------------------------------------------------------------------
ADD_STAT(psprites)
{
FString out;