- animator transitioned.

This commit is contained in:
Christoph Oelckers 2020-04-15 19:41:15 +02:00
parent 83817080bb
commit c605359b0e
3 changed files with 30 additions and 24 deletions

View file

@ -158,6 +158,7 @@ public:
} }
FTexture* Texture(FTextureID id) { return Textures[id.GetIndex()].Texture; } FTexture* Texture(FTextureID id) { return Textures[id.GetIndex()].Texture; }
FGameTexture* GameTexture(FTextureID id) { return reinterpret_cast<FGameTexture*>(Textures[id.GetIndex()].Texture); }
void SetTranslation(FTextureID fromtexnum, FTextureID totexnum); void SetTranslation(FTextureID fromtexnum, FTextureID totexnum);
private: private:

View file

@ -668,7 +668,8 @@ public:
double GetDisplayTopOffset(int adjusted = 0) /*const*/ { return wrapped.GetDisplayTopOffsetDouble(adjusted); } double GetDisplayTopOffset(int adjusted = 0) /*const*/ { return wrapped.GetDisplayTopOffsetDouble(adjusted); }
bool isValid() { return wrapped.isValid(); } bool isValid() { return wrapped.isValid(); }
bool isWarped() { return wrapped.isWarped(); } int isWarped() { return wrapped.isWarped(); }
void SetWarpStyle(int style) { wrapped.bWarped = style; }
bool isMasked() { return wrapped.isMasked(); } bool isMasked() { return wrapped.isMasked(); }
bool isHardwareCanvas() const { return wrapped.isHardwareCanvas(); } // There's two here so that this can deal with software canvases in the hardware renderer later. bool isHardwareCanvas() const { return wrapped.isHardwareCanvas(); } // There's two here so that this can deal with software canvases in the hardware renderer later.
bool isSoftwareCanvas() const { return wrapped.isCanvas(); } bool isSoftwareCanvas() const { return wrapped.isCanvas(); }
@ -678,7 +679,9 @@ public:
bool isFullbright() const { return wrapped.isFullbright(); } bool isFullbright() const { return wrapped.isFullbright(); }
bool expandSprites() const { return wrapped.bExpandSprite; } bool expandSprites() const { return wrapped.bExpandSprite; }
bool useWorldPanning() const { return wrapped.UseWorldPanning(); } bool useWorldPanning() const { return wrapped.UseWorldPanning(); }
void SetWorldPanning(bool on) { wrapped.SetWorldPanning(on); }
bool allowNoDecals() const { return wrapped.allowNoDecals(); } bool allowNoDecals() const { return wrapped.allowNoDecals(); }
void SetNoDecals(bool on) { wrapped.bNoDecals = on; }
void SetTranslucent(bool on) { wrapped.bTranslucent = on; } void SetTranslucent(bool on) { wrapped.bTranslucent = on; }
ETextureType GetUseType() const { return wrapped.GetUseType(); } ETextureType GetUseType() const { return wrapped.GetUseType(); }
void SetUseType(ETextureType type) { wrapped.SetUseType(type); } void SetUseType(ETextureType type) { wrapped.SetUseType(type); }
@ -686,6 +689,7 @@ public:
float GetShaderSpeed() const { return wrapped.GetShaderSpeed(); } float GetShaderSpeed() const { return wrapped.GetShaderSpeed(); }
uint16_t GetRotations() const { return wrapped.GetRotations(); } uint16_t GetRotations() const { return wrapped.GetRotations(); }
void SetRotations(int index) { wrapped.SetRotations(index); } void SetRotations(int index) { wrapped.SetRotations(index); }
void SetSkyOffset(int ofs) { wrapped.SetSkyOffset(ofs); }
int GetSkyOffset() const { return wrapped.GetSkyOffset(); } int GetSkyOffset() const { return wrapped.GetSkyOffset(); }
FTextureID GetID() const { return wrapped.GetID(); } FTextureID GetID() const { return wrapped.GetID(); }
ISoftwareTexture* GetSoftwareTexture() { return wrapped.GetSoftwareTexture(); } ISoftwareTexture* GetSoftwareTexture() { return wrapped.GetSoftwareTexture(); }
@ -739,6 +743,7 @@ public:
int CheckRealHeight() { return wrapped.CheckRealHeight(); } int CheckRealHeight() { return wrapped.CheckRealHeight(); }
bool isSkybox() const { return wrapped.isSkybox(); } bool isSkybox() const { return wrapped.isSkybox(); }
void SetSize(int x, int y) { wrapped.SetSize(x, y); } void SetSize(int x, int y) { wrapped.SetSize(x, y); }
void SetDisplaySize(float w, float h) { wrapped.SetSize((int)w, (int)h); }
void SetSpriteRect() { wrapped.SetSpriteRect(); } void SetSpriteRect() { wrapped.SetSpriteRect(); }
const SpritePositioningInfo& GetSpritePositioning(int which) { /* todo: keep two sets of positioning infd*/ if (wrapped.mTrimResult == -1) wrapped.SetupSpriteData(); return wrapped.spi; } const SpritePositioningInfo& GetSpritePositioning(int which) { /* todo: keep two sets of positioning infd*/ if (wrapped.mTrimResult == -1) wrapped.SetupSpriteData(); return wrapped.spi; }

View file

@ -245,8 +245,8 @@ void FTextureAnimator::InitAnimated (void)
// [RH] Bit 1 set means allow decals on walls with this texture // [RH] Bit 1 set means allow decals on walls with this texture
bool nodecals = !(*anim_p & 2); bool nodecals = !(*anim_p & 2);
TexMan.Texture(pic2)->SetNoDecals(nodecals); TexMan.GameTexture(pic2)->SetNoDecals(nodecals);
TexMan.Texture(pic1)->SetNoDecals(nodecals); TexMan.GameTexture(pic1)->SetNoDecals(nodecals);
} }
else else
{ {
@ -255,8 +255,8 @@ void FTextureAnimator::InitAnimated (void)
continue; continue;
} }
FTexture *tex1 = TexMan.Texture(pic1); auto tex1 = TexMan.GameTexture(pic1);
FTexture *tex2 = TexMan.Texture(pic2); auto tex2 = TexMan.GameTexture(pic2);
animspeed = (anim_p[19] << 0) | (anim_p[20] << 8) | animspeed = (anim_p[19] << 0) | (anim_p[20] << 8) |
(anim_p[21] << 16) | (anim_p[22] << 24); (anim_p[21] << 16) | (anim_p[22] << 24);
@ -355,7 +355,7 @@ void FTextureAnimator::InitAnimDefs ()
sc.MustGetNumber(); sc.MustGetNumber();
if (picnum.Exists()) if (picnum.Exists())
{ {
TexMan.Texture(picnum)->SetSkyOffset(sc.Number); TexMan.GameTexture(picnum)->SetSkyOffset(sc.Number);
} }
} }
else else
@ -408,7 +408,7 @@ void FTextureAnimator::ParseAnim (FScanner &sc, ETextureType usetype)
// no decals on animating textures, by default // no decals on animating textures, by default
if (picnum.isValid()) if (picnum.isValid())
{ {
TexMan.Texture(picnum)->SetNoDecals(true); TexMan.GameTexture(picnum)->SetNoDecals(true);
} }
while (sc.GetString ()) while (sc.GetString ())
@ -417,7 +417,7 @@ void FTextureAnimator::ParseAnim (FScanner &sc, ETextureType usetype)
{ {
if (picnum.isValid()) if (picnum.isValid())
{ {
TexMan.Texture(picnum)->SetNoDecals(false); TexMan.GameTexture(picnum)->SetNoDecals(false);
} }
continue; continue;
} }
@ -439,7 +439,7 @@ void FTextureAnimator::ParseAnim (FScanner &sc, ETextureType usetype)
} }
else if (sc.Compare ("range")) else if (sc.Compare ("range"))
{ {
if (picnum.Exists() && TexMan.Texture(picnum)->GetName().IsEmpty()) if (picnum.Exists() && TexMan.GameTexture(picnum)->GetName().IsEmpty())
{ {
// long texture name: We cannot do ranged anims on these because they have no defined order // long texture name: We cannot do ranged anims on these because they have no defined order
sc.ScriptError ("You cannot use \"range\" for long texture names."); sc.ScriptError ("You cannot use \"range\" for long texture names.");
@ -513,7 +513,7 @@ FAnimDef *FTextureAnimator::ParseRangeAnim (FScanner &sc, FTextureID picnum, ETe
return NULL; // Animation is only one frame or does not exist return NULL; // Animation is only one frame or does not exist
} }
if (TexMan.Texture(framenum)->GetName().IsEmpty()) if (TexMan.GameTexture(framenum)->GetName().IsEmpty())
{ {
// long texture name: We cannot do ranged anims on these because they have no defined order // long texture name: We cannot do ranged anims on these because they have no defined order
sc.ScriptError ("You cannot use \"range\" for long texture names."); sc.ScriptError ("You cannot use \"range\" for long texture names.");
@ -522,7 +522,7 @@ FAnimDef *FTextureAnimator::ParseRangeAnim (FScanner &sc, FTextureID picnum, ETe
if (framenum < picnum) if (framenum < picnum)
{ {
type = FAnimDef::ANIM_Backward; type = FAnimDef::ANIM_Backward;
TexMan.Texture(framenum)->SetNoDecals(TexMan.Texture(picnum)->allowNoDecals()); TexMan.GameTexture(framenum)->SetNoDecals(TexMan.GameTexture(picnum)->allowNoDecals());
std::swap (framenum, picnum); std::swap (framenum, picnum);
} }
FAnimDef *ani = AddSimpleAnim (picnum, framenum - picnum + 1, min, max - min); FAnimDef *ani = AddSimpleAnim (picnum, framenum - picnum + 1, min, max - min);
@ -649,7 +649,7 @@ void FTextureAnimator::ParseWarp(FScanner &sc)
if (picnum.isValid()) if (picnum.isValid())
{ {
FTexture *warper = TexMan.Texture(picnum); auto warper = TexMan.GameTexture(picnum);
if (warper->GetName().IsEmpty()) if (warper->GetName().IsEmpty())
{ {
@ -666,7 +666,7 @@ void FTextureAnimator::ParseWarp(FScanner &sc)
if (sc.CheckFloat()) if (sc.CheckFloat())
{ {
warper->SetSpeed(float(sc.Float)); warper->SetShaderSpeed(float(sc.Float));
} }
// No decals on warping textures, by default. // No decals on warping textures, by default.
@ -699,7 +699,7 @@ void FTextureAnimator::ParseCameraTexture(FScanner &sc)
{ {
const BITFIELD texflags = FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_TryAny | FTextureManager::TEXMAN_ShortNameOnly; const BITFIELD texflags = FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_TryAny | FTextureManager::TEXMAN_ShortNameOnly;
int width, height; int width, height;
int fitwidth, fitheight; double fitwidth, fitheight;
FString picname; FString picname;
sc.MustGetString (); sc.MustGetString ();
@ -709,14 +709,14 @@ void FTextureAnimator::ParseCameraTexture(FScanner &sc)
sc.MustGetNumber (); sc.MustGetNumber ();
height = sc.Number; height = sc.Number;
FTextureID picnum = TexMan.CheckForTexture (picname, ETextureType::Flat, texflags); FTextureID picnum = TexMan.CheckForTexture (picname, ETextureType::Flat, texflags);
FTexture *viewer = new FCanvasTexture (picname, width, height); FGameTexture *viewer = reinterpret_cast<FGameTexture*>(new FCanvasTexture (picname, width, height));
if (picnum.Exists()) if (picnum.Exists())
{ {
FTexture *oldtex = TexMan.Texture(picnum); auto oldtex = TexMan.GameTexture(picnum);
fitwidth = oldtex->GetDisplayWidth (); fitwidth = oldtex->GetDisplayWidth ();
fitheight = oldtex->GetDisplayHeight (); fitheight = oldtex->GetDisplayHeight ();
viewer->SetUseType(oldtex->GetUseType()); viewer->SetUseType(oldtex->GetUseType());
TexMan.ReplaceTexture (picnum, viewer, true); TexMan.ReplaceTexture (picnum, viewer->GetTexture(), true);
} }
else else
{ {
@ -724,7 +724,7 @@ void FTextureAnimator::ParseCameraTexture(FScanner &sc)
fitheight = height; fitheight = height;
// [GRB] No need for oldtex // [GRB] No need for oldtex
viewer->SetUseType(ETextureType::Wall); viewer->SetUseType(ETextureType::Wall);
TexMan.AddTexture (viewer); TexMan.AddTexture (viewer->GetTexture());
} }
if (sc.GetString()) if (sc.GetString())
{ {
@ -751,7 +751,7 @@ void FTextureAnimator::ParseCameraTexture(FScanner &sc)
sc.UnGet(); sc.UnGet();
} }
} }
viewer->SetDisplaySize(fitwidth, fitheight); viewer->SetDisplaySize((float)fitwidth, (float)fitheight);
} }
//========================================================================== //==========================================================================
@ -778,11 +778,11 @@ void FTextureAnimator::FixAnimations ()
bool noremap = false; bool noremap = false;
const char *name; const char *name;
name = TexMan.Texture(anim->BasePic)->GetName(); name = TexMan.GameTexture(anim->BasePic)->GetName();
nodecals = TexMan.Texture(anim->BasePic)->allowNoDecals(); nodecals = TexMan.GameTexture(anim->BasePic)->allowNoDecals();
for (j = 0; j < anim->NumFrames; ++j) for (j = 0; j < anim->NumFrames; ++j)
{ {
FTexture *tex = TexMan.Texture(anim->BasePic + j); auto tex = TexMan.GameTexture(anim->BasePic + j);
tex->SetNoDecals(nodecals); tex->SetNoDecals(nodecals);
} }
} }
@ -815,7 +815,7 @@ void FTextureAnimator::ParseAnimatedDoor(FScanner &sc)
} }
else else
{ {
TexMan.Texture(anim.BaseTexture)->SetNoDecals(true); TexMan.GameTexture(anim.BaseTexture)->SetNoDecals(true);
} }
while (sc.GetString()) while (sc.GetString())
{ {
@ -848,7 +848,7 @@ void FTextureAnimator::ParseAnimatedDoor(FScanner &sc)
} }
else if (sc.Compare("allowdecals")) else if (sc.Compare("allowdecals"))
{ {
if (anim.BaseTexture.Exists()) TexMan.Texture(anim.BaseTexture)->SetNoDecals(false); if (anim.BaseTexture.Exists()) TexMan.GameTexture(anim.BaseTexture)->SetNoDecals(false);
} }
else else
{ {