From 365311ec361f68f828bb45081d23ea7a8086682f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 12 Mar 2012 14:30:45 +0000 Subject: [PATCH] - added SMMU/Eternity method of defining warped textures (Patch by Gez) SVN r3433 (trunk) --- src/textures/animations.cpp | 68 +++++++++++++++++++++---------------- 1 file changed, 38 insertions(+), 30 deletions(-) diff --git a/src/textures/animations.cpp b/src/textures/animations.cpp index c843b1270..8ac05cc52 100644 --- a/src/textures/animations.cpp +++ b/src/textures/animations.cpp @@ -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); } } }