- added SMMU/Eternity method of defining warped textures (Patch by Gez)

SVN r3433 (trunk)
This commit is contained in:
Christoph Oelckers 2012-03-12 14:30:45 +00:00
parent ce43552ebb
commit 365311ec36
1 changed files with 38 additions and 30 deletions

View File

@ -198,44 +198,52 @@ void FTextureManager::InitAnimated (void)
!(pic2 = CheckForTexture (anim_p + 1 /* .startname */, FTexture::TEX_Flat, texflags)).Exists())
continue;
}
if (pic1 == pic2)
{
// This animation only has one frame. Skip it. (Doom aborted instead.)
Printf ("Animation %s in ANIMATED has only one frame\n", anim_p + 10);
continue;
}
FTexture *tex1 = Texture(pic1);
FTexture *tex2 = Texture(pic2);
if (tex1->UseType != tex2->UseType)
animspeed = (BYTE(anim_p[19]) << 0) | (BYTE(anim_p[20]) << 8) |
(BYTE(anim_p[21]) << 16) | (BYTE(anim_p[22]) << 24);
// SMMU-style swirly hack? Don't apply on already-warping texture
if (animspeed > 65535 && tex1 != null && !tex1->bWarped)
{
// not the same type -
continue;
FTexture *warper = new FWarp2Texture (tex1);
ReplaceTexture (pic1, warper, false);
}
if (debuganimated)
// These tests were not really relevant for swirling textures, or even potentially
// harmful, so they have been moved to the else block.
else
{
Printf("Defining animation '%s' (texture %d, lump %d, file %d) to '%s' (texture %d, lump %d, file %d)\n",
tex1->Name, pic1.GetIndex(), tex1->GetSourceLump(), Wads.GetLumpFile(tex1->GetSourceLump()),
tex2->Name, pic2.GetIndex(), tex2->GetSourceLump(), Wads.GetLumpFile(tex2->GetSourceLump()));
if (tex1->UseType != tex2->UseType)
{
// not the same type -
continue;
}
if (debuganimated)
{
Printf("Defining animation '%s' (texture %d, lump %d, file %d) to '%s' (texture %d, lump %d, file %d)\n",
tex1->Name, pic1.GetIndex(), tex1->GetSourceLump(), Wads.GetLumpFile(tex1->GetSourceLump()),
tex2->Name, pic2.GetIndex(), tex2->GetSourceLump(), Wads.GetLumpFile(tex2->GetSourceLump()));
}
if (pic1 == pic2)
{
// This animation only has one frame. Skip it. (Doom aborted instead.)
Printf ("Animation %s in ANIMATED has only one frame\n", anim_p + 10);
continue;
}
// [RH] Allow for backward animations as well as forward.
else if (pic1 > pic2)
{
swapvalues (pic1, pic2);
animtype = FAnimDef::ANIM_Backward;
}
// Speed is stored as tics, but we want ms so scale accordingly.
AddSimpleAnim (pic1, pic2 - pic1 + 1, animtype, Scale (animspeed, 1000, 35));
}
// [RH] Allow for backward animations as well as forward.
if (pic1 > pic2)
{
swapvalues (pic1, pic2);
animtype = FAnimDef::ANIM_Backward;
}
// Speed is stored as tics, but we want ms so scale accordingly.
animspeed = /* .speed */
Scale ((BYTE(anim_p[19]) << 0) |
(BYTE(anim_p[20]) << 8) |
(BYTE(anim_p[21]) << 16) |
(BYTE(anim_p[22]) << 24), 1000, 35);
AddSimpleAnim (pic1, pic2 - pic1 + 1, animtype, animspeed);
}
}
}