- switched the entire status bar code to use FGameTexture.

- scale the automap parchment to clean 320x200 dimensions.
This commit is contained in:
Christoph Oelckers 2020-04-14 00:55:16 +02:00
parent 5d8adb90c4
commit c7db5b932e
16 changed files with 129 additions and 105 deletions

View file

@ -1239,8 +1239,8 @@ void DAutomap::ScrollParchment (double dmapx, double dmapy)
if (backtex != nullptr)
{
int pwidth = backtex->GetDisplayWidth();
int pheight = backtex->GetDisplayHeight();
int pwidth = int(backtex->GetDisplayWidth() * CleanXfac);
int pheight = int(backtex->GetDisplayHeight() * CleanYfac);
while(mapxstart > 0)
mapxstart -= pwidth;
@ -1591,8 +1591,8 @@ void DAutomap::clearFB (const AMColor &color)
auto backtex = TexMan.GetGameTexture(mapback);
if (backtex != nullptr)
{
int pwidth = backtex->GetDisplayWidth();
int pheight = backtex->GetDisplayHeight();
int pwidth = int(backtex->GetDisplayWidth() * CleanXfac);
int pheight = int(backtex->GetDisplayHeight() * CleanYfac);
int x, y;
//blit the automap background to the screen.
@ -1600,7 +1600,7 @@ void DAutomap::clearFB (const AMColor &color)
{
for (x = int(mapxstart); x < f_w; x += pwidth)
{
DrawTexture(twod, backtex, x, y, DTA_ClipBottom, f_h, DTA_TopOffset, 0, DTA_LeftOffset, 0, TAG_DONE);
DrawTexture(twod, backtex, x, y, DTA_ClipBottom, f_h, DTA_TopOffset, 0, DTA_LeftOffset, 0, DTA_DestWidth, pwidth, DTA_DestHeight, pheight, TAG_DONE);
}
}
}

View file

@ -183,6 +183,11 @@ public:
void FillPolygon(int* rx1, int* ry1, int* xb1, int32_t npoints, int picnum, int palette, int shade, int props, const FVector2& xtex, const FVector2& ytex, const FVector2& otex,
int clipx1, int clipy1, int clipx2, int clipy2);
void AddFlatFill(int left, int top, int right, int bottom, FTexture *src, bool local_origin = false);
void AddFlatFill(int left, int top, int right, int bottom, FGameTexture* src, bool local_origin = false)
{
AddFlatFill(left, top, right, bottom, src->GetTexture(), local_origin);
}
void AddColorOnlyQuad(int left, int top, int width, int height, PalEntry color, FRenderStyle *style = nullptr);
void ClearScreen(PalEntry color = 0xff000000);

View file

@ -868,3 +868,9 @@ FWrapperTexture::FWrapperTexture(int w, int h, int bits)
SystemTextures.AddHardwareTexture(0, false, hwtex);
}
bool FGameTexture::isUserContent() const
{
int filenum = fileSystem.GetFileContainer(wrapped.GetSourceLump());
return (filenum > fileSystem.GetMaxIwadNum());
}

View file

@ -40,6 +40,11 @@ public:
return InternalGetTexture(texnum.GetIndex(), animate, true, false);
}
FGameTexture* GetGameTextureByName(const char *name, bool animate = false)
{
return reinterpret_cast<FGameTexture*>(GetTextureByName(name, animate));
}
FTexture *GetTexture(FTextureID texnum, bool animate = false)
{
return InternalGetTexture(texnum.GetIndex(), animate, true, false);
@ -67,6 +72,12 @@ public:
}
FTexture *FindTexture(const char *texname, ETextureType usetype = ETextureType::MiscPatch, BITFIELD flags = TEXMAN_TryAny);
FGameTexture* FindGameTexture(const char* texname, ETextureType usetype = ETextureType::MiscPatch, BITFIELD flags = TEXMAN_TryAny)
{
return reinterpret_cast<FGameTexture*>(FindTexture(texname, usetype, flags));
}
bool OkForLocalization(FTextureID texnum, const char *substitute, int locnum);
void FlushAll();

View file

@ -579,14 +579,14 @@ class FGameTexture
public:
FTexture* GetTexture() { return &wrapped; }
int GetDisplayWidth() /*const*/ { return wrapped.GetDisplayWidth(); }
int GetDisplayHeight() /*const*/ { return wrapped.GetDisplayHeight(); }
double GetDisplayWidth() /*const*/ { return wrapped.GetDisplayWidthDouble(); }
double GetDisplayHeight() /*const*/ { return wrapped.GetDisplayHeightDouble(); }
int GetTexelWidth() /*const*/ { return wrapped.GetTexelWidth(); }
int GetTexelHeight() /*const*/ { return wrapped.GetTexelHeight(); }
int GetTexelLeftOffset(int adjusted) /*const*/ { return wrapped.GetTexelLeftOffset(adjusted); }
int GetTexelTopOffset(int adjusted) /*const*/ { return wrapped.GetTexelTopOffset(adjusted); }
double GetDisplayLeftOffset(int adjusted) /*const*/ { return wrapped.GetDisplayLeftOffsetDouble(adjusted); }
double GetDisplayTopOffset(int adjusted) /*const*/ { return wrapped.GetDisplayTopOffsetDouble(adjusted); }
int GetTexelLeftOffset(int adjusted = 0) /*const*/ { return wrapped.GetTexelLeftOffset(adjusted); }
int GetTexelTopOffset(int adjusted = 0) /*const*/ { return wrapped.GetTexelTopOffset(adjusted); }
double GetDisplayLeftOffset(int adjusted = 0) /*const*/ { return wrapped.GetDisplayLeftOffsetDouble(adjusted); }
double GetDisplayTopOffset(int adjusted = 0) /*const*/ { return wrapped.GetDisplayTopOffsetDouble(adjusted); }
bool isValid() { return wrapped.isValid(); }
bool isWarped() { return wrapped.isWarped(); }
@ -598,6 +598,8 @@ public:
ISoftwareTexture* GetSoftwareTexture() { return wrapped.GetSoftwareTexture(); }
void SetSoftwareTexture(ISoftwareTexture* swtex) { wrapped.SetSoftwareTextue(swtex); }
bool isUserContent() const;
};

View file

@ -1170,7 +1170,7 @@ void C_DrawConsole ()
else if (ConBottom)
{
int visheight;
FTexture *conpic = TexMan.GetTexture(conback);
FGameTexture *conpic = TexMan.GetGameTexture(conback);
visheight = ConBottom;

View file

@ -894,14 +894,10 @@ bool FLevelLocals::DoCompleted (FString nextlevel, wbstartstruct_t &wminfo)
{
if (texids[i]->isValid() && langtable[i] != FStringTable::default_table)
{
FTexture *tex = TexMan.GetTexture(*texids[i]);
if (tex != nullptr)
FGameTexture *tex = TexMan.GetGameTexture(*texids[i]);
if (tex != nullptr && !tex->isUserContent())
{
int filenum = fileSystem.GetFileContainer(tex->GetSourceLump());
if (filenum >= 0 && filenum <= fileSystem.GetMaxIwadNum())
{
texids[i]->SetInvalid();
}
texids[i]->SetInvalid();
}
}
}

View file

@ -42,6 +42,7 @@
class player_t;
struct FRemapTable;
class FGameTexture;
enum EHudState
{
@ -233,7 +234,7 @@ struct FMugShotFrame
FMugShotFrame();
~FMugShotFrame();
FTexture *GetTexture(const char *default_face, const char *skin_face, int random, int level=0,
FGameTexture *GetTexture(const char *default_face, const char *skin_face, int random, int level=0,
int direction=0, bool usesLevels=false, bool health2=false, bool healthspecial=false,
bool directional=false);
};
@ -256,7 +257,7 @@ struct FMugShotState
void Tick();
void Reset();
FMugShotFrame &GetCurrentFrame() { return Frames[Position]; }
FTexture *GetCurrentFrameTexture(const char *default_face, const char *skin_face, int level=0, int direction=0)
FGameTexture *GetCurrentFrameTexture(const char *default_face, const char *skin_face, int level=0, int direction=0)
{
return GetCurrentFrame().GetTexture(default_face, skin_face, Random, level, direction, bUsesLevels, bHealth2, bHealthSpecial, bDirectional);
}
@ -287,7 +288,7 @@ class FMugShot
void Tick(player_t *player);
bool SetState(const char *state_name, bool wait_till_done=false, bool reset=false);
int UpdateState(player_t *player, StateFlags stateflags=STANDARD);
FTexture *GetFace(player_t *player, const char *default_face, int accuracy, StateFlags stateflags=STANDARD);
FGameTexture *GetFace(player_t *player, const char *default_face, int accuracy, StateFlags stateflags=STANDARD);
private:
FMugShotState *CurrentState;
@ -308,7 +309,7 @@ int FindMugShotStateIndex(FName state);
// Base Status Bar ----------------------------------------------------------
class FTexture;
class FGameTexture;
enum
{
@ -525,7 +526,7 @@ DBaseStatusBar *CreateCustomStatusBar(int script=0);
void ST_LoadCrosshair(bool alwaysload=false);
void ST_Clear();
void ST_CreateStatusBar(bool bTitleLevel);
extern FTexture *CrosshairImage;
extern FGameTexture *CrosshairImage;
int GetInventoryIcon(AActor *item, uint32_t flags, int *applyscale = nullptr);

View file

@ -71,11 +71,11 @@ FMugShotFrame::~FMugShotFrame()
//
// FMugShotFrame :: GetTexture
//
// Assemble a graphic name with the specified prefix and return the FTexture.
// Assemble a graphic name with the specified prefix and return the FGameTexture.
//
//===========================================================================
FTexture *FMugShotFrame::GetTexture(const char *default_face, const char *skin_face, int random, int level,
FGameTexture *FMugShotFrame::GetTexture(const char *default_face, const char *skin_face, int random, int level,
int direction, bool uses_levels, bool health2, bool healthspecial, bool directional)
{
int index = !directional ? random % Graphic.Size() : direction;
@ -97,7 +97,7 @@ FTexture *FMugShotFrame::GetTexture(const char *default_face, const char *skin_f
}
sprite.UnlockBuffer();
}
return TexMan.GetTexture(TexMan.CheckForTexture(sprite, ETextureType::Any, FTextureManager::TEXMAN_TryAny|FTextureManager::TEXMAN_AllowSkins));
return TexMan.GetGameTexture(TexMan.CheckForTexture(sprite, ETextureType::Any, FTextureManager::TEXMAN_TryAny|FTextureManager::TEXMAN_AllowSkins));
}
//===========================================================================
@ -459,7 +459,7 @@ int FMugShot::UpdateState(player_t *player, StateFlags stateflags)
//
//===========================================================================
FTexture *FMugShot::GetFace(player_t *player, const char *default_face, int accuracy, StateFlags stateflags)
FGameTexture *FMugShot::GetFace(player_t *player, const char *default_face, int accuracy, StateFlags stateflags)
{
int angle = UpdateState(player, stateflags);
int level = 0;

View file

@ -1191,7 +1191,7 @@ public:
}
//draws an image with the specified flags
void DrawGraphic(FTexture* texture, SBarInfoCoordinate x, SBarInfoCoordinate y, int xOffset, int yOffset, double Alpha, bool fullScreenOffsets, bool translate=false, bool dim=false, int offsetflags=0, bool alphaMap=false, int forceWidth=-1, int forceHeight=-1, const double *clip = nulclip, bool clearDontDraw=false) const
void DrawGraphic(FGameTexture* texture, SBarInfoCoordinate x, SBarInfoCoordinate y, int xOffset, int yOffset, double Alpha, bool fullScreenOffsets, bool translate=false, bool dim=false, int offsetflags=0, bool alphaMap=false, int forceWidth=-1, int forceHeight=-1, const double *clip = nulclip, bool clearDontDraw=false) const
{
if (texture == NULL)
return;
@ -1201,11 +1201,11 @@ public:
if((offsetflags & SBarInfoCommand::CENTER) == SBarInfoCommand::CENTER)
{
if (forceWidth < 0) dx -= (texture->GetDisplayWidthDouble()/2.0)-texture->GetDisplayLeftOffsetDouble();
else dx -= forceWidth*(0.5-(texture->GetDisplayLeftOffsetDouble()/texture->GetDisplayWidthDouble()));
if (forceWidth < 0) dx -= (texture->GetDisplayWidth()/2.0)-texture->GetDisplayLeftOffset();
else dx -= forceWidth*(0.5-(texture->GetDisplayLeftOffset()/texture->GetDisplayWidth()));
if (forceHeight < 0) dy -= (texture->GetDisplayHeightDouble()/2.0)-texture->GetDisplayTopOffsetDouble();
else dy -= forceHeight*(0.5-(texture->GetDisplayTopOffsetDouble()/texture->GetDisplayHeightDouble()));
if (forceHeight < 0) dy -= (texture->GetDisplayHeight()/2.0)-texture->GetDisplayTopOffset();
else dy -= forceHeight*(0.5-(texture->GetDisplayTopOffset()/texture->GetDisplayHeight()));
}
dx += xOffset;
@ -1214,12 +1214,12 @@ public:
if(!fullScreenOffsets)
{
double tmp = 0;
w = forceWidth < 0 ? texture->GetDisplayWidthDouble() : forceWidth;
h = forceHeight < 0 ? texture->GetDisplayHeightDouble() : forceHeight;
double dcx = clip[0] == 0 ? 0 : dx + clip[0] - texture->GetDisplayLeftOffsetDouble();
double dcy = clip[1] == 0 ? 0 : dy + clip[1] - texture->GetDisplayTopOffsetDouble();
double dcr = clip[2] == 0 ? INT_MAX : dx + w - clip[2] - texture->GetDisplayLeftOffsetDouble();
double dcb = clip[3] == 0 ? INT_MAX : dy + h - clip[3] - texture->GetDisplayTopOffsetDouble();
w = forceWidth < 0 ? texture->GetDisplayWidth() : forceWidth;
h = forceHeight < 0 ? texture->GetDisplayHeight() : forceHeight;
double dcx = clip[0] == 0 ? 0 : dx + clip[0] - texture->GetDisplayLeftOffset();
double dcy = clip[1] == 0 ? 0 : dy + clip[1] - texture->GetDisplayTopOffset();
double dcr = clip[2] == 0 ? INT_MAX : dx + w - clip[2] - texture->GetDisplayLeftOffset();
double dcb = clip[3] == 0 ? INT_MAX : dy + h - clip[3] - texture->GetDisplayTopOffset();
if(clip[0] != 0 || clip[1] != 0)
{
@ -1283,8 +1283,8 @@ public:
bool xright = *x < 0 && !x.RelCenter();
bool ybot = *y < 0 && !y.RelCenter();
w = (forceWidth < 0 ? texture->GetDisplayWidthDouble() : forceWidth);
h = (forceHeight < 0 ? texture->GetDisplayHeightDouble() : forceHeight);
w = (forceWidth < 0 ? texture->GetDisplayWidth() : forceWidth);
h = (forceHeight < 0 ? texture->GetDisplayHeight() : forceHeight);
if(vid_fps && rx < 0 && ry >= 0)
ry += 10;
@ -1301,10 +1301,10 @@ public:
// Check for clipping
if(clip[0] != 0 || clip[1] != 0 || clip[2] != 0 || clip[3] != 0)
{
rcx = clip[0] == 0 ? 0 : rx+((clip[0] - texture->GetDisplayLeftOffsetDouble())*Scale.X);
rcy = clip[1] == 0 ? 0 : ry+((clip[1] - texture->GetDisplayTopOffsetDouble())*Scale.Y);
rcr = clip[2] == 0 ? INT_MAX : rx+w-((clip[2] + texture->GetDisplayLeftOffsetDouble())*Scale.X);
rcb = clip[3] == 0 ? INT_MAX : ry+h-((clip[3] + texture->GetDisplayTopOffsetDouble())*Scale.Y);
rcx = clip[0] == 0 ? 0 : rx+((clip[0] - texture->GetDisplayLeftOffset())*Scale.X);
rcy = clip[1] == 0 ? 0 : ry+((clip[1] - texture->GetDisplayTopOffset())*Scale.Y);
rcr = clip[2] == 0 ? INT_MAX : rx+w-((clip[2] + texture->GetDisplayLeftOffset())*Scale.X);
rcb = clip[3] == 0 ? INT_MAX : ry+h-((clip[3] + texture->GetDisplayTopOffset())*Scale.Y);
}
if(clearDontDraw)
@ -1393,7 +1393,7 @@ public:
else
width = font->GetCharWidth((unsigned char) script->spacingCharacter);
bool redirected = false;
FTexture* c = font->GetChar(ch, fontcolor, &width);
auto c = font->GetChar(ch, fontcolor, &width);
if(c == NULL) //missing character.
{
continue;
@ -1405,8 +1405,8 @@ public:
double rx, ry, rw, rh;
rx = ax + xOffset;
ry = ay + yOffset;
rw = c->GetDisplayWidthDouble();
rh = c->GetDisplayHeightDouble();
rw = c->GetDisplayWidth();
rh = c->GetDisplayHeight();
if(script->spacingCharacter != '\0')
{

View file

@ -69,8 +69,8 @@ class CommandDrawImage : public SBarInfoCommandFlowControl
{
double scale1, scale2;
scale1 = scale2 = 1.0f;
double texwidth = (int) (texture->GetDisplayWidthDouble()*spawnScaleX);
double texheight = (int) (texture->GetDisplayHeightDouble()*spawnScaleY);
double texwidth = (int) (texture->GetDisplayWidth()*spawnScaleX);
double texheight = (int) (texture->GetDisplayHeight()*spawnScaleY);
if (w != -1 && (w<texwidth || (flags & DI_FORCESCALE)))
{
@ -93,8 +93,8 @@ class CommandDrawImage : public SBarInfoCommandFlowControl
}
else if (applyscale)
{
w=(int) (texture->GetDisplayWidthDouble()*spawnScaleX);
h=(int) (texture->GetDisplayHeightDouble()*spawnScaleY);
w=(int) (texture->GetDisplayWidth()*spawnScaleX);
h=(int) (texture->GetDisplayHeight()*spawnScaleY);
}
statusBar->DrawGraphic(texture, imgx, imgy, block->XOffset(), block->YOffset(), frameAlpha, block->FullScreenOffsets(),
translatable, false, offset, false, w, h);
@ -241,7 +241,7 @@ class CommandDrawImage : public SBarInfoCommandFlowControl
applyscale = false;
}
if(type == PLAYERICON)
texture = TexMan.ByIndex(statusBar->CPlayer->mo->IntVar(NAME_ScoreIcon), true);
texture = TexMan.GameByIndex(statusBar->CPlayer->mo->IntVar(NAME_ScoreIcon), true);
else if(type == AMMO1)
{
auto ammo = statusBar->ammo1;
@ -270,7 +270,7 @@ class CommandDrawImage : public SBarInfoCommandFlowControl
{
auto item = statusBar->CPlayer->mo->FindInventory(NAME_Sigil);
if (item != NULL)
texture = TexMan.GetTexture(item->TextureIDVar(NAME_Icon), true);
texture = TexMan.GetGameTexture(item->TextureIDVar(NAME_Icon), true);
}
else if(type == HEXENARMOR_ARMOR || type == HEXENARMOR_SHIELD || type == HEXENARMOR_HELM || type == HEXENARMOR_AMULET)
{
@ -292,9 +292,9 @@ class CommandDrawImage : public SBarInfoCommandFlowControl
}
}
else if(type == INVENTORYICON)
texture = TexMan.GetTexture(sprite, true);
texture = TexMan.GetGameTexture(sprite, true);
else if(type == SELECTEDINVENTORYICON && statusBar->CPlayer->mo->PointerVar<AActor>(NAME_InvSel) != NULL)
texture = TexMan.GetTexture(statusBar->CPlayer->mo->PointerVar<AActor>(NAME_InvSel)->TextureIDVar(NAME_Icon), true);
texture = TexMan.GetGameTexture(statusBar->CPlayer->mo->PointerVar<AActor>(NAME_InvSel)->TextureIDVar(NAME_Icon), true);
else if(image >= 0)
texture = statusBar->Images[image];
@ -316,7 +316,7 @@ class CommandDrawImage : public SBarInfoCommandFlowControl
spawnScaleY = item->Scale.Y;
}
texture = TexMan.GetTexture(icon, true);
texture = TexMan.GetGameTexture(icon, true);
}
enum ImageType
@ -353,7 +353,7 @@ class CommandDrawImage : public SBarInfoCommandFlowControl
SBarInfoCoordinate imgy;
Offset offset;
FTexture *texture;
FGameTexture *texture;
double alpha;
};
@ -1618,7 +1618,7 @@ class CommandDrawMugShot : public SBarInfoCommand
void Draw(const SBarInfoMainBlock *block, const DSBarInfo *statusBar)
{
FTexture *face = statusBar->wrapper->mugshot.GetFace(statusBar->CPlayer, defaultFace, accuracy, stateFlags);
FGameTexture *face = statusBar->wrapper->mugshot.GetFace(statusBar->CPlayer, defaultFace, accuracy, stateFlags);
if (face != NULL)
statusBar->DrawGraphic(face, x, y, block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets());
}
@ -2045,10 +2045,10 @@ class CommandDrawShader : public SBarInfoCommand
}
GetCoordinates(sc, fullScreenOffsets, x, y);
sc.MustGetToken(';');
shaders[0] = TexMan.FindTexture("BarShaderHF");
shaders[1] = TexMan.FindTexture("BarShaderHR");
shaders[2] = TexMan.FindTexture("BarShaderVF");
shaders[3] = TexMan.FindTexture("BarShaderVR");
shaders[0] = TexMan.FindGameTexture("BarShaderHF");
shaders[1] = TexMan.FindGameTexture("BarShaderHR");
shaders[2] = TexMan.FindGameTexture("BarShaderVF");
shaders[3] = TexMan.FindGameTexture("BarShaderVR");
}
protected:
bool vertical;
@ -2059,7 +2059,7 @@ class CommandDrawShader : public SBarInfoCommand
SBarInfoCoordinate y;
private:
FTexture *shaders[4];
FGameTexture *shaders[4];
};
////////////////////////////////////////////////////////////////////////////////
@ -2132,7 +2132,7 @@ class CommandDrawInventoryBar : public SBarInfoCommand
statusBar->DrawGraphic(statusBar->Images[statusBar->invBarOffset + imgARTIBOX], rx, ry, block->XOffset(), block->YOffset(), bgalpha, block->FullScreenOffsets());
if(style != STYLE_Strife) //Strife draws the cursor before the icons
statusBar->DrawGraphic(TexMan.GetTexture(item->TextureIDVar(NAME_Icon), true), rx - (style == STYLE_HexenStrict ? 2 : 0), ry - (style == STYLE_HexenStrict ? 1 : 0), block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets(), false, item->IntVar(NAME_Amount) <= 0);
statusBar->DrawGraphic(TexMan.GetGameTexture(item->TextureIDVar(NAME_Icon), true), rx - (style == STYLE_HexenStrict ? 2 : 0), ry - (style == STYLE_HexenStrict ? 1 : 0), block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets(), false, item->IntVar(NAME_Amount) <= 0);
if(item == statusBar->CPlayer->mo->PointerVar<AActor>(NAME_InvSel))
{
if(style == STYLE_Heretic)
@ -2147,7 +2147,7 @@ class CommandDrawInventoryBar : public SBarInfoCommand
statusBar->DrawGraphic(statusBar->Images[statusBar->invBarOffset + imgSELECTBOX], rx, ry, block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets());
}
if(style == STYLE_Strife)
statusBar->DrawGraphic(TexMan.GetTexture(item->TextureIDVar(NAME_Icon), true), rx, ry, block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets(), false, item->IntVar(NAME_Amount) <= 0);
statusBar->DrawGraphic(TexMan.GetGameTexture(item->TextureIDVar(NAME_Icon), true), rx, ry, block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets(), false, item->IntVar(NAME_Amount) <= 0);
if(counters != NULL && (alwaysShowCounter || item->IntVar(NAME_Amount) != 1))
{
counters[i]->valueArgument = item->IntVar(NAME_Amount);
@ -2255,7 +2255,7 @@ class CommandDrawInventoryBar : public SBarInfoCommand
}
int GetCounterSpacing(const DSBarInfo *statusBar) const
{
FTexture *box = (style != STYLE_Strife)
FGameTexture *box = (style != STYLE_Strife)
? statusBar->Images[statusBar->invBarOffset + imgARTIBOX]
: statusBar->Images[statusBar->invBarOffset + imgCURSOR];
if (box == NULL)
@ -2265,13 +2265,14 @@ class CommandDrawInventoryBar : public SBarInfoCommand
else
{
int spacing;
// Intentionally rounded down.
if (!vertical)
{
spacing = box->GetDisplayWidth();
spacing = (int)box->GetDisplayWidth();
}
else
{
spacing = box->GetDisplayHeight();
spacing = (int)box->GetDisplayHeight();
}
return spacing + ((style != STYLE_Strife) ? 1 : -1);
}
@ -2368,24 +2369,25 @@ class CommandDrawKeyBar : public SBarInfoCommand
}
if(i >= keyOffset) //Should we start drawing?
{
auto tex = TexMan.GetGameTexture(item->TextureIDVar(NAME_Icon), true);
if(!vertical)
{
statusBar->DrawGraphic(TexMan.GetTexture(item->TextureIDVar(NAME_Icon), true), x+slotOffset, y+rowOffset, block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets());
rowWidth = rowIconSize == -1 ? TexMan.GetTexture(item->TextureIDVar(NAME_Icon), true)->GetDisplayHeight()+2 : rowIconSize;
statusBar->DrawGraphic(tex, x+slotOffset, y+rowOffset, block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets());
rowWidth = rowIconSize == -1 ? (int)tex->GetDisplayHeight()+2 : rowIconSize;
}
else
{
statusBar->DrawGraphic(TexMan.GetTexture(item->TextureIDVar(NAME_Icon), true), x+rowOffset, y+slotOffset, block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets());
rowWidth = rowIconSize == -1 ? TexMan.GetTexture(item->TextureIDVar(NAME_Icon), true)->GetDisplayWidth()+2 : rowIconSize;
statusBar->DrawGraphic(tex, x+rowOffset, y+slotOffset, block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets());
rowWidth = rowIconSize == -1 ? (int)tex->GetDisplayWidth()+2 : rowIconSize;
}
// If cmd.special is -1 then the slot size is auto detected
if(iconSize == -1)
{
if(!vertical)
slotOffset += (reverse ? -1 : 1) * (TexMan.GetTexture(item->TextureIDVar(NAME_Icon), true)->GetDisplayWidth() + 2);
slotOffset += (reverse ? -1 : 1) * ((int)tex->GetDisplayWidth() + 2);
else
slotOffset += (reverse ? -1 : 1) * (TexMan.GetTexture(item->TextureIDVar(NAME_Icon), true)->GetDisplayHeight() + 2);
slotOffset += (reverse ? -1 : 1) * ((int)tex->GetDisplayHeight() + 2);
}
else
slotOffset += (reverse ? -iconSize : iconSize);
@ -2491,8 +2493,8 @@ class CommandDrawBar : public SBarInfoCommand
return; //don't draw anything.
assert(statusBar->Images[foreground] != NULL);
FTexture *fg = statusBar->Images[foreground];
FTexture *bg = (background != -1) ? statusBar->Images[background] : NULL;
FGameTexture *fg = statusBar->Images[foreground];
FGameTexture *bg = (background != -1) ? statusBar->Images[background] : NULL;
double value = drawValue;
if(border != 0)
@ -2514,7 +2516,7 @@ class CommandDrawBar : public SBarInfoCommand
// {cx, cy, cr, cb}
double Clip[4] = {0, 0, 0, 0};
int sizeOfImage = (horizontal ? fg->GetDisplayWidth()-border*2 : fg->GetDisplayHeight()-border*2);
double sizeOfImage = (horizontal ? fg->GetDisplayWidth()-border*2 : fg->GetDisplayHeight()-border*2);
Clip[(!horizontal)|((horizontal ? !reverse : reverse)<<1)] = sizeOfImage - sizeOfImage *value;
// Draw background
if(border != 0)
@ -3108,15 +3110,15 @@ class CommandDrawGem : public SBarInfoCommand
void Draw(const SBarInfoMainBlock *block, const DSBarInfo *statusBar)
{
FTexture *chainImg = statusBar->Images[chain];
FTexture *gemImg = statusBar->Images[gem];
FGameTexture *chainImg = statusBar->Images[chain];
FGameTexture *gemImg = statusBar->Images[gem];
if(chainImg == NULL)
return;
SBarInfoCoordinate drawY = y;
if(wiggle && drawValue != goalValue) // Should only wiggle when the value doesn't equal what is being drawn.
drawY += chainWiggle;
int chainWidth = chainImg->GetDisplayWidth();
double chainWidth = chainImg->GetDisplayWidth();
int offset = (int) (((double) (chainWidth-leftPadding-rightPadding)/100)*drawValue);
statusBar->DrawGraphic(chainImg, x+(offset%chainSize), drawY, block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets());
if(gemImg != NULL)

View file

@ -95,7 +95,7 @@ DBaseStatusBar *StatusBar;
extern int setblocks;
FTexture *CrosshairImage;
FGameTexture *CrosshairImage;
static int CrosshairNum;
CVAR (Int, paletteflash, 0, CVAR_ARCHIVE)
@ -192,7 +192,7 @@ void ST_LoadCrosshair(bool alwaysload)
}
}
CrosshairNum = num;
CrosshairImage = TexMan.GetTexture(texid);
CrosshairImage = TexMan.GetGameTexture(texid);
}
//---------------------------------------------------------------------------
@ -1015,11 +1015,12 @@ void DBaseStatusBar::RefreshBackground () const
if (setblocks >= 10)
{
FTexture *p = TexMan.GetTextureByName(gameinfo.Border.b);
FGameTexture *p = TexMan.GetGameTextureByName(gameinfo.Border.b);
if (p != NULL)
{
twod->AddFlatFill(0, y, x, y + p->GetDisplayHeight(), p, true);
twod->AddFlatFill(x2, y, twod->GetWidth(), y + p->GetDisplayHeight(), p, true);
int h = int(0.5 + p->GetDisplayHeight());
twod->AddFlatFill(0, y, x, y + h, p, true);
twod->AddFlatFill(x2, y, twod->GetWidth(), y + h, p, true);
}
}
}
@ -1546,10 +1547,10 @@ void DBaseStatusBar::DrawGraphic(FTextureID texture, double x, double y, int fla
if (!texture.isValid())
return;
FTexture *tex = TexMan.GetTexture(texture, !(flags & DI_DONTANIMATE));
FGameTexture *tex = TexMan.GetGameTexture(texture, !(flags & DI_DONTANIMATE));
double texwidth = tex->GetDisplayWidthDouble() * scaleX;
double texheight = tex->GetDisplayHeightDouble() * scaleY;
double texwidth = tex->GetDisplayWidth() * scaleX;
double texheight = tex->GetDisplayHeight() * scaleY;
if (boxwidth > 0 || boxheight > 0)
{
@ -1601,14 +1602,14 @@ void DBaseStatusBar::DrawGraphic(FTextureID texture, double x, double y, int fla
{
case DI_ITEM_HCENTER: x -= boxwidth / 2; break;
case DI_ITEM_RIGHT: x -= boxwidth; break;
case DI_ITEM_HOFFSET: x -= tex->GetDisplayLeftOffsetDouble() * boxwidth / texwidth; break;
case DI_ITEM_HOFFSET: x -= tex->GetDisplayLeftOffset() * boxwidth / texwidth; break;
}
switch (flags & DI_ITEM_VMASK)
{
case DI_ITEM_VCENTER: y -= boxheight / 2; break;
case DI_ITEM_BOTTOM: y -= boxheight; break;
case DI_ITEM_VOFFSET: y -= tex->GetDisplayTopOffsetDouble() * boxheight / texheight; break;
case DI_ITEM_VOFFSET: y -= tex->GetDisplayTopOffset() * boxheight / texheight; break;
}
if (!fullscreenOffsets)
@ -1737,20 +1738,20 @@ void DBaseStatusBar::DrawString(FFont *font, const FString &cstring, double x, d
}
int width;
FTexture* c = font->GetChar(ch, fontcolor, &width);
auto c = font->GetChar(ch, fontcolor, &width);
if (c == NULL) //missing character.
{
continue;
}
if (!monospaced) //If we are monospaced lets use the offset
x += (c->GetDisplayLeftOffsetDouble() + 1); //ignore x offsets since we adapt to character size
x += (c->GetDisplayLeftOffset() + 1); //ignore x offsets since we adapt to character size
double rx, ry, rw, rh;
rx = x + drawOffset.X;
ry = y + drawOffset.Y;
rw = c->GetDisplayWidthDouble();
rh = c->GetDisplayHeightDouble();
rw = c->GetDisplayWidth();
rh = c->GetDisplayHeight();
if (monospacing == EMonospacing::CellCenter)
rx += (spacing - rw) / 2;

View file

@ -69,8 +69,8 @@ public:
int GetWidthBits() { return WidthBits; }
int GetHeightBits() { return HeightBits; }
int GetScaledWidth () { return mTexture->GetDisplayWidth(); }
int GetScaledHeight () { return mTexture->GetDisplayHeight(); }
double GetScaledWidth () { return mTexture->GetDisplayWidth(); }
double GetScaledHeight () { return mTexture->GetDisplayHeight(); }
// Now with improved offset adjustment.
int GetLeftOffset(int adjusted) { return mTexture->GetTexelLeftOffset(adjusted); }

View file

@ -105,8 +105,8 @@ namespace swrenderer
// but right now, I just want to get them drawing.
tz = (pos.X - thread->Viewport->viewpoint.Pos.X) * thread->Viewport->viewpoint.TanCos + (pos.Y - thread->Viewport->viewpoint.Pos.Y) * thread->Viewport->viewpoint.TanSin;
int scaled_to = pic->GetScaledTopOffsetSW();
int scaled_bo = scaled_to - pic->GetScaledHeight();
double scaled_to = pic->GetScaledTopOffsetSW();
double scaled_bo = scaled_to - pic->GetScaledHeight();
gzt = pos.Z + scale.Y * scaled_to;
gzb = pos.Z + scale.Y * scaled_bo;

View file

@ -72,11 +72,11 @@ void FImageCollection::Uninit ()
ImageMap.Clear();
}
FTexture *FImageCollection::operator[] (int index) const
FGameTexture *FImageCollection::operator[] (int index) const
{
if ((unsigned int)index >= ImageMap.Size())
{
return NULL;
}
return ImageMap[index].Exists()? TexMan.GetPalettedTexture(ImageMap[index], true) : NULL;
return ImageMap[index].Exists()? TexMan.GetGameTexture(ImageMap[index], true) : NULL;
}

View file

@ -37,7 +37,7 @@
#include "doomtype.h"
#include "r_defs.h"
class FTexture;
class FGameTexture;
class FImageCollection
{
@ -49,7 +49,7 @@ public:
void Add(const char **patchnames, int numPatches, ETextureType namespc = ETextureType::Any);
void Uninit();
FTexture *operator[] (int index) const;
FGameTexture *operator[] (int index) const;
protected:
TArray<FTextureID> ImageMap;