mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 23:01:59 +00:00
- moved CheckRealHeight from wi_stuff.cpp to texture code.
This commit is contained in:
parent
c4f6a54753
commit
d423ad0d18
5 changed files with 40 additions and 47 deletions
|
@ -839,15 +839,6 @@ void DoReadyWeaponToGeneric(AActor *self, int paramflags)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function replaces calls to A_WeaponReady in other codepointers.
|
|
||||||
void DoReadyWeapon(AActor *self)
|
|
||||||
{
|
|
||||||
DoReadyWeaponToBob(self);
|
|
||||||
DoReadyWeaponToFire(self);
|
|
||||||
DoReadyWeaponToSwitch(self);
|
|
||||||
DoReadyWeaponToGeneric(self, ~0);
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION(AStateProvider, A_WeaponReady)
|
DEFINE_ACTION_FUNCTION(AStateProvider, A_WeaponReady)
|
||||||
{
|
{
|
||||||
PARAM_ACTION_PROLOGUE(AStateProvider);
|
PARAM_ACTION_PROLOGUE(AStateProvider);
|
||||||
|
|
|
@ -119,7 +119,6 @@ void P_BobWeapon (player_t *player, float *x, float *y, double ticfrac);
|
||||||
DAngle P_BulletSlope (AActor *mo, FTranslatedLineTarget *pLineTarget = NULL, int aimflags = 0);
|
DAngle P_BulletSlope (AActor *mo, FTranslatedLineTarget *pLineTarget = NULL, int aimflags = 0);
|
||||||
AActor *P_AimTarget(AActor *mo);
|
AActor *P_AimTarget(AActor *mo);
|
||||||
|
|
||||||
void DoReadyWeapon(AActor *self);
|
|
||||||
void DoReadyWeaponToBob(AActor *self);
|
void DoReadyWeaponToBob(AActor *self);
|
||||||
void DoReadyWeaponToFire(AActor *self, bool primary = true, bool secondary = true);
|
void DoReadyWeaponToFire(AActor *self, bool primary = true, bool secondary = true);
|
||||||
void DoReadyWeaponToSwitch(AActor *self, bool switchable = true);
|
void DoReadyWeaponToSwitch(AActor *self, bool switchable = true);
|
||||||
|
|
|
@ -912,6 +912,44 @@ PalEntry FTexture::GetSkyCapColor(bool bottom)
|
||||||
return bottom ? FloorSkyColor : CeilingSkyColor;
|
return bottom ? FloorSkyColor : CeilingSkyColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//====================================================================
|
||||||
|
//
|
||||||
|
// CheckRealHeight
|
||||||
|
//
|
||||||
|
// Checks the posts in a texture and returns the lowest row (plus one)
|
||||||
|
// of the texture that is actually used.
|
||||||
|
//
|
||||||
|
//====================================================================
|
||||||
|
|
||||||
|
int FTexture::CheckRealHeight()
|
||||||
|
{
|
||||||
|
const FTexture::Span *span;
|
||||||
|
int maxy = 0, miny = GetHeight();
|
||||||
|
|
||||||
|
for (int i = 0; i < GetWidth(); ++i)
|
||||||
|
{
|
||||||
|
GetColumn(i, &span);
|
||||||
|
while (span->Length != 0)
|
||||||
|
{
|
||||||
|
if (span->TopOffset < miny)
|
||||||
|
{
|
||||||
|
miny = span->TopOffset;
|
||||||
|
}
|
||||||
|
if (span->TopOffset + span->Length > maxy)
|
||||||
|
{
|
||||||
|
maxy = span->TopOffset + span->Length;
|
||||||
|
}
|
||||||
|
span++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Scale maxy before returning it
|
||||||
|
maxy = int((maxy * 2) / Scale.Y);
|
||||||
|
maxy = (maxy >> 1) + (maxy & 1);
|
||||||
|
return maxy;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
FDummyTexture::FDummyTexture ()
|
FDummyTexture::FDummyTexture ()
|
||||||
{
|
{
|
||||||
|
|
|
@ -358,6 +358,7 @@ public:
|
||||||
static bool SmoothEdges(unsigned char * buffer,int w, int h);
|
static bool SmoothEdges(unsigned char * buffer,int w, int h);
|
||||||
void CheckTrans(unsigned char * buffer, int size, int trans);
|
void CheckTrans(unsigned char * buffer, int size, int trans);
|
||||||
bool ProcessData(unsigned char * buffer, int w, int h, bool ispatch);
|
bool ProcessData(unsigned char * buffer, int w, int h, bool ispatch);
|
||||||
|
int CheckRealHeight();
|
||||||
};
|
};
|
||||||
|
|
||||||
class FxAddSub;
|
class FxAddSub;
|
||||||
|
|
|
@ -778,42 +778,6 @@ public:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//====================================================================
|
|
||||||
//
|
|
||||||
// CheckRealHeight
|
|
||||||
//
|
|
||||||
// Checks the posts in a texture and returns the lowest row (plus one)
|
|
||||||
// of the texture that is actually used.
|
|
||||||
//
|
|
||||||
//====================================================================
|
|
||||||
|
|
||||||
int CheckRealHeight(FTexture *tex)
|
|
||||||
{
|
|
||||||
const FTexture::Span *span;
|
|
||||||
int maxy = 0, miny = tex->GetHeight();
|
|
||||||
|
|
||||||
for (int i = 0; i < tex->GetWidth(); ++i)
|
|
||||||
{
|
|
||||||
tex->GetColumn(i, &span);
|
|
||||||
while (span->Length != 0)
|
|
||||||
{
|
|
||||||
if (span->TopOffset < miny)
|
|
||||||
{
|
|
||||||
miny = span->TopOffset;
|
|
||||||
}
|
|
||||||
if (span->TopOffset + span->Length > maxy)
|
|
||||||
{
|
|
||||||
maxy = span->TopOffset + span->Length;
|
|
||||||
}
|
|
||||||
span++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Scale maxy before returning it
|
|
||||||
maxy = int((maxy *2) / tex->Scale.Y);
|
|
||||||
maxy = (maxy >> 1) + (maxy & 1);
|
|
||||||
return maxy;
|
|
||||||
}
|
|
||||||
|
|
||||||
//====================================================================
|
//====================================================================
|
||||||
//
|
//
|
||||||
// Draws a single character with a shadow
|
// Draws a single character with a shadow
|
||||||
|
@ -847,7 +811,7 @@ public:
|
||||||
if (h > 50)
|
if (h > 50)
|
||||||
{ // Fix for Deus Vult II and similar wads that decide to make these hugely tall
|
{ // Fix for Deus Vult II and similar wads that decide to make these hugely tall
|
||||||
// patches with vast amounts of empty space at the bottom.
|
// patches with vast amounts of empty space at the bottom.
|
||||||
h = CheckRealHeight(tex);
|
h = tex->CheckRealHeight();
|
||||||
}
|
}
|
||||||
return y + (h + BigFont->GetHeight()/4) * CleanYfac;
|
return y + (h + BigFont->GetHeight()/4) * CleanYfac;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue