- eliminated all cases of calling DrawTexture with an FTexture.

Everything uses FGameTexture now.
This commit is contained in:
Christoph Oelckers 2020-04-14 01:01:29 +02:00
commit d9928b51a8
13 changed files with 68 additions and 71 deletions

View file

@ -168,7 +168,7 @@ class Wiper_Burn : public Wiper
public:
~Wiper_Burn();
bool Run(int ticks) override;
void SetTextures(FTexture *startscreen, FTexture *endscreen) override;
void SetTextures(FGameTexture *startscreen, FGameTexture *endscreen) override;
private:
static const int WIDTH = 64, HEIGHT = 64;
@ -307,8 +307,8 @@ bool Wiper_Melt::Run(int ticks)
// Only draw for the final tick.
// No need for optimization. Wipes won't ever be drawn with anything else.
int w = startScreen->GetDisplayWidth();
int h = startScreen->GetDisplayHeight();
int w = startScreen->GetTexelWidth();
int h = startScreen->GetTexelHeight();
dpt.x = i * w / WIDTH;
dpt.y = MAX(0, y[i] * h / HEIGHT);
rect.left = dpt.x;
@ -331,12 +331,12 @@ bool Wiper_Melt::Run(int ticks)
//
//==========================================================================
void Wiper_Burn::SetTextures(FTexture *startscreen, FTexture *endscreen)
void Wiper_Burn::SetTextures(FGameTexture *startscreen, FGameTexture *endscreen)
{
startScreen = startscreen;
endScreen = endscreen;
BurnTexture = new FBurnTexture(WIDTH, HEIGHT);
auto mat = FMaterial::ValidateTexture(endScreen, false);
auto mat = FMaterial::ValidateTexture(endScreen->GetTexture(), false);
mat->AddTextureLayer(BurnTexture);
}
@ -374,7 +374,7 @@ bool Wiper_Burn::Run(int ticks)
}
BurnTexture->CleanHardwareTextures(true, true);
endScreen->CleanHardwareTextures(false, false);
endScreen->GetTexture()->CleanHardwareTextures(false, false);
const uint8_t *src = BurnArray;
uint32_t *dest = (uint32_t *)BurnTexture->GetBuffer();

View file

@ -43,11 +43,11 @@ enum
class Wiper
{
protected:
FTexture *startScreen = nullptr, *endScreen = nullptr;
FGameTexture *startScreen = nullptr, *endScreen = nullptr;
public:
virtual ~Wiper();
virtual bool Run(int ticks) = 0;
virtual void SetTextures(FTexture *startscreen, FTexture *endscreen)
virtual void SetTextures(FGameTexture *startscreen, FGameTexture *endscreen)
{
startScreen = startscreen;
endScreen = endscreen;

View file

@ -116,7 +116,7 @@ sector_t *SWSceneDrawer::RenderView(player_t *player)
systemTexture->CreateTexture(nullptr, screen->GetWidth(), screen->GetHeight(), 0, false, "swbuffer");
auto map = swrenderer::CameraLight::Instance()->ShaderColormap();
DrawTexture(twod, fbtex.get(), 0, 0, DTA_SpecialColormap, map, TAG_DONE);
DrawTexture(twod, reinterpret_cast<FGameTexture*>(fbtex.get()), 0, 0, DTA_SpecialColormap, map, TAG_DONE);
screen->Draw2D();
screen->Clear2D();
screen->PostProcessScene(CM_DEFAULT, [&]() {

View file

@ -522,7 +522,7 @@ IHardwareTexture* CreateHardwareTexture()
void DrawFrame(F2DDrawer* drawer, int left, int top, int width, int height)
{
FTexture* p;
FGameTexture* p;
const gameborder_t* border = &gameinfo.Border;
// Sanity check for incomplete gameinfo
if (border == NULL)
@ -532,22 +532,22 @@ void DrawFrame(F2DDrawer* drawer, int left, int top, int width, int height)
int bottom = top + height;
// Draw top and bottom sides.
p = TexMan.GetTextureByName(border->t);
drawer->AddFlatFill(left, top - p->GetDisplayHeight(), right, top, p, true);
p = TexMan.GetTextureByName(border->b);
drawer->AddFlatFill(left, bottom, right, bottom + p->GetDisplayHeight(), p, true);
p = TexMan.GetGameTextureByName(border->t);
drawer->AddFlatFill(left, top - (int)p->GetDisplayHeight(), right, top, p, true);
p = TexMan.GetGameTextureByName(border->b);
drawer->AddFlatFill(left, bottom, right, bottom + (int)p->GetDisplayHeight(), p, true);
// Draw left and right sides.
p = TexMan.GetTextureByName(border->l);
drawer->AddFlatFill(left - p->GetDisplayWidth(), top, left, bottom, p, true);
p = TexMan.GetTextureByName(border->r);
drawer->AddFlatFill(right, top, right + p->GetDisplayWidth(), bottom, p, true);
p = TexMan.GetGameTextureByName(border->l);
drawer->AddFlatFill(left - (int)p->GetDisplayWidth(), top, left, bottom, p, true);
p = TexMan.GetGameTextureByName(border->r);
drawer->AddFlatFill(right, top, right + (int)p->GetDisplayWidth(), bottom, p, true);
// Draw beveled corners.
DrawTexture(drawer, TexMan.GetTextureByName(border->tl), left - offset, top - offset, TAG_DONE);
DrawTexture(drawer, TexMan.GetTextureByName(border->tr), left + width, top - offset, TAG_DONE);
DrawTexture(drawer, TexMan.GetTextureByName(border->bl), left - offset, top + height, TAG_DONE);
DrawTexture(drawer, TexMan.GetTextureByName(border->br), left + width, top + height, TAG_DONE);
DrawTexture(drawer, TexMan.GetGameTextureByName(border->tl), left - offset, top - offset, TAG_DONE);
DrawTexture(drawer, TexMan.GetGameTextureByName(border->tr), left + width, top - offset, TAG_DONE);
DrawTexture(drawer, TexMan.GetGameTextureByName(border->bl), left - offset, top + height, TAG_DONE);
DrawTexture(drawer, TexMan.GetGameTextureByName(border->br), left + width, top + height, TAG_DONE);
}
DEFINE_ACTION_FUNCTION(_Screen, DrawFrame)