From b1d36182c472c114c171b20becc223ebe556784d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 12 Aug 2008 09:57:59 +0000 Subject: [PATCH] - Changed handling of AUTOPAGE texture so that it is properly inserted into the texture manager even if it is from Raven's IWADs. - Removed code related to internal ActorInfo definitions from dobjtype.cpp. - removed unneeded file dehackedactions.h SVN r1162 (trunk) --- docs/rh-log.txt | 6 ++ src/am_map.cpp | 70 ++++++++--------- src/d_dehackedactions.h | 108 --------------------------- src/dobjtype.cpp | 53 ++++++------- src/dobjtype.h | 2 +- src/textures/automaptexture.cpp | 7 +- src/textures/texture.cpp | 2 +- src/thingdef/thingdef_properties.cpp | 6 +- 8 files changed, 70 insertions(+), 184 deletions(-) delete mode 100644 src/d_dehackedactions.h diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 28ae704ca..6976873c6 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,9 @@ +August 12, 2008 (Changes by Graf Zahl) +- Changed handling of AUTOPAGE texture so that it is properly inserted into + the texture manager even if it is from Raven's IWADs. +- Removed code related to internal ActorInfo definitions from dobjtype.cpp. +- removed unneeded file dehackedactions.h + August 11, 2008 - Ported asm_x86_64/tmap3.nas to AT&T syntax so it can be compiled with gas. After finding out that gas does have directives to describe the .eh_frame diff --git a/src/am_map.cpp b/src/am_map.cpp index ced5a69d6..f3aaf19b4 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -337,7 +337,7 @@ static int markpointnum = 0; // next point to be assigned static int followplayer = 1; // specifies whether to follow the player around -static FTexture *mapback; // the automap background +static FTextureID mapback; // the automap background static fixed_t mapystart=0; // y-value for the start of the map bitmap...used in the parallax stuff. static fixed_t mapxstart=0; //x-value for the bitmap. @@ -534,19 +534,24 @@ static void AM_ScrollParchment (fixed_t dmapx, fixed_t dmapy) mapxstart -= MulScale12 (dmapx, scale_mtof); mapystart -= MulScale12 (dmapy, scale_mtof); - if (mapback != NULL) + if (mapback.isValid()) { - int pwidth = mapback->GetWidth() << MAPBITS; - int pheight = mapback->GetHeight() << MAPBITS; + FTexture *backtex = TexMan[mapback]; - while(mapxstart > 0) - mapxstart -= pwidth; - while(mapxstart <= -pwidth) - mapxstart += pwidth; - while(mapystart > 0) - mapystart -= pheight; - while(mapystart <= -pheight) - mapystart += pheight; + if (backtex != NULL) + { + int pwidth = backtex->GetWidth() << MAPBITS; + int pheight = backtex->GetHeight() << MAPBITS; + + while(mapxstart > 0) + mapxstart -= pwidth; + while(mapxstart <= -pwidth) + mapxstart += pwidth; + while(mapystart > 0) + mapystart -= pheight; + while(mapystart <= -pheight) + mapystart += pheight; + } } } @@ -737,23 +742,7 @@ void AM_loadPics () marknums[i] = TexMan.CheckForTexture (namebuf, FTexture::TEX_MiscPatch); } - if (mapback == NULL) - { - i = Wads.CheckNumForName ("AUTOPAGE"); - if (i >= 0) - { - mapback = FTexture::CreateTexture(i, FTexture::TEX_Autopage); - } - } -} - -void AM_unloadPics () -{ - if (mapback != NULL) - { - delete mapback; - mapback = NULL; - } + mapback = TexMan.CheckForTexture("AUTOPAGE", FTexture::TEX_MiscPatch); } bool AM_clearMarks () @@ -788,7 +777,6 @@ void AM_LevelInit () // void AM_Stop () { - AM_unloadPics (); automapactive = false; stopped = true; BorderNeedRefresh = screen->GetPageCount (); @@ -1063,22 +1051,26 @@ void AM_Ticker () // void AM_clearFB (const AMColor &color) { - if (mapback == NULL || !am_drawmapback) + if (!mapback.isValid() || !am_drawmapback) { screen->Clear (0, 0, f_w, f_h, color.Index, color.RGB); } else { - int pwidth = mapback->GetWidth(); - int pheight = mapback->GetHeight(); - int x, y; - - //blit the automap background to the screen. - for (y = mapystart >> MAPBITS; y < f_h; y += pheight) + FTexture *backtex = TexMan[mapback]; + if (backtex != NULL) { - for (x = mapxstart >> MAPBITS; x < f_w; x += pwidth) + int pwidth = backtex->GetWidth(); + int pheight = backtex->GetHeight(); + int x, y; + + //blit the automap background to the screen. + for (y = mapystart >> MAPBITS; y < f_h; y += pheight) { - screen->DrawTexture (mapback, x, y, DTA_ClipBottom, f_h, DTA_TopOffset, 0, DTA_LeftOffset, 0, TAG_DONE); + for (x = mapxstart >> MAPBITS; x < f_w; x += pwidth) + { + screen->DrawTexture (backtex, x, y, DTA_ClipBottom, f_h, DTA_TopOffset, 0, DTA_LeftOffset, 0, TAG_DONE); + } } } } diff --git a/src/d_dehackedactions.h b/src/d_dehackedactions.h deleted file mode 100644 index f182a72a6..000000000 --- a/src/d_dehackedactions.h +++ /dev/null @@ -1,108 +0,0 @@ -// This file is included by d_dehacked.cpp twice. -// The first time is to prototype these functions, and the second -// time is to define them in the CodePtrs list. The macros are -// defined appropriately to get the desired effect each time. - -ACTOR(MonsterRail) - -WEAPON(FireRailgun) -WEAPON(FireRailgunLeft) -WEAPON(FireRailgunRight) -WEAPON(RailWait) -WEAPON(Light0) -WEAPON(WeaponReady) -WEAPON(Lower) -WEAPON(Raise) -WEAPON(Punch) -WEAPON(ReFire) -WEAPON(FirePistol) -WEAPON(Light1) -WEAPON(FireShotgun) -WEAPON(Light2) -WEAPON(FireShotgun2) -WEAPON(CheckReload) -WEAPON(OpenShotgun2) -WEAPON(LoadShotgun2) -WEAPON(CloseShotgun2) -WEAPON(FireCGun) -WEAPON(GunFlash) -WEAPON(FireMissile) -WEAPON(Saw) -WEAPON(FirePlasma) -WEAPON(BFGsound) -WEAPON(FireBFG) - -ACTOR(BFGSpray) -ACTOR(Explode) -ACTOR(Pain) -ACTOR(PlayerScream) -ACTOR(NoBlocking) -ACTOR(XScream) -ACTOR(Look) -ACTOR(Chase) -ACTOR(FaceTarget) -ACTOR(PosAttack) -ACTOR(Scream) -ACTOR(SPosAttack) -ACTOR(VileChase) -ACTOR(VileStart) -ACTOR(VileTarget) -ACTOR(VileAttack) -ACTOR(StartFire) -ACTOR(Fire) -ACTOR(FireCrackle) -ACTOR(Tracer) -ACTOR(SkelWhoosh) -ACTOR(SkelFist) -ACTOR(SkelMissile) -ACTOR(FatRaise) -ACTOR(FatAttack1) -ACTOR(FatAttack2) -ACTOR(FatAttack3) -ACTOR(BossDeath) -ACTOR(CPosAttack) -ACTOR(CPosRefire) -ACTOR(TroopAttack) -ACTOR(SargAttack) -ACTOR(HeadAttack) -ACTOR(BruisAttack) -ACTOR(SkullAttack) -ACTOR(Metal) -ACTOR(SpidRefire) -ACTOR(BabyMetal) -ACTOR(BspiAttack) -ACTOR(Hoof) -ACTOR(CyberAttack) -ACTOR(PainAttack) -ACTOR(PainDie) -ACTOR(KeenDie) -ACTOR(BrainPain) -ACTOR(BrainScream) -ACTOR(BrainDie) -ACTOR(BrainAwake) -ACTOR(BrainSpit) -ACTOR(SpawnSound) -ACTOR(SpawnFly) -ACTOR(BrainExplode) -ACTOR(Die) -ACTOR(Detonate) -ACTOR(Mushroom) - -ACTOR(SetFloorClip) -ACTOR(UnSetFloorClip) -ACTOR(HideThing) -ACTOR(UnHideThing) -ACTOR(SetInvulnerable) -ACTOR(UnSetInvulnerable) -ACTOR(SetReflective) -ACTOR(UnSetReflective) -ACTOR(SetReflectiveInvulnerable) -ACTOR(UnSetReflectiveInvulnerable) -ACTOR(SetShootable) -ACTOR(UnSetShootable) -ACTOR(NoGravity) -ACTOR(Gravity) -ACTOR(LowGravity) - -#undef WEAPON -#undef ACTOR diff --git a/src/dobjtype.cpp b/src/dobjtype.cpp index 070b8b556..8be76f0d6 100644 --- a/src/dobjtype.cpp +++ b/src/dobjtype.cpp @@ -123,36 +123,29 @@ void PClass::StaticFreeData (PClass *type) } type->FreeStateList (); + if (type->ActorInfo != NULL) + { + if (type->ActorInfo->OwnedStates != NULL) + { + delete[] type->ActorInfo->OwnedStates; + type->ActorInfo->OwnedStates = NULL; + } + if (type->ActorInfo->DamageFactors != NULL) + { + delete type->ActorInfo->DamageFactors; + type->ActorInfo->DamageFactors = NULL; + } + if (type->ActorInfo->PainChances != NULL) + { + delete type->ActorInfo->PainChances; + type->ActorInfo->PainChances = NULL; + } + delete type->ActorInfo; + type->ActorInfo = NULL; + } if (type->bRuntimeClass) { - if (type->ActorInfo != NULL) - { - if (type->ActorInfo->OwnedStates != NULL) - { - delete[] type->ActorInfo->OwnedStates; - type->ActorInfo->OwnedStates = NULL; - } - if (type->ActorInfo->DamageFactors != NULL) - { - delete type->ActorInfo->DamageFactors; - type->ActorInfo->DamageFactors = NULL; - } - if (type->ActorInfo->PainChances != NULL) - { - delete type->ActorInfo->PainChances; - type->ActorInfo->PainChances = NULL; - } - delete type->ActorInfo; - type->ActorInfo = NULL; - } - if (type->bRuntimeClass != 2) - { - delete type; - } - else - { - type->Symbols.ReleaseSymbols(); - } + delete type; } else { @@ -315,8 +308,6 @@ void PClass::InitializeActorInfo () memset (Defaults, 0, Size); } - bRuntimeClass = 2; // Class is internal but actor data external - FActorInfo *info = ActorInfo = new FActorInfo; info->Class = this; info->GameFilter = GAME_Any; @@ -398,7 +389,7 @@ const PClass *PClass::NativeClass() const { const PClass *cls = this; - while (cls && cls->bRuntimeClass == 1) + while (cls && cls->bRuntimeClass) cls = cls->ParentClass; return cls; diff --git a/src/dobjtype.h b/src/dobjtype.h index 0d37f32af..5ea7c34ef 100644 --- a/src/dobjtype.h +++ b/src/dobjtype.h @@ -103,7 +103,7 @@ struct PClass PClass *HashNext; FMetaTable Meta; BYTE *Defaults; - BYTE bRuntimeClass; // class was defined at run-time, not compile-time + bool bRuntimeClass; // class was defined at run-time, not compile-time unsigned short ClassIndex; PSymbolTable Symbols; diff --git a/src/textures/automaptexture.cpp b/src/textures/automaptexture.cpp index 5980aaa38..8155b1643 100644 --- a/src/textures/automaptexture.cpp +++ b/src/textures/automaptexture.cpp @@ -70,13 +70,15 @@ private: //========================================================================== // -// +// This texture type will only be used for the AUTOPAGE lump if no other +// format matches. // //========================================================================== FTexture *AutomapTexture_TryCreate(FileReader &data, int lumpnum) { if (data.GetLength() < 320) return NULL; + if (!Wads.CheckLumpName(lumpnum, "AUTOPAGE")) return NULL; return new FAutomapTexture(lumpnum); } @@ -89,6 +91,9 @@ FTexture *AutomapTexture_TryCreate(FileReader &data, int lumpnum) FAutomapTexture::FAutomapTexture (int lumpnum) : Pixels(NULL), LumpNum(lumpnum) { + Wads.GetLumpName (Name, lumpnum); + Name[8] = 0; + Width = 320; Height = WORD(Wads.LumpLength(lumpnum) / 320); CalcBitSize (); diff --git a/src/textures/texture.cpp b/src/textures/texture.cpp index 9bff37b44..e6e8ce48f 100644 --- a/src/textures/texture.cpp +++ b/src/textures/texture.cpp @@ -87,7 +87,7 @@ FTexture * FTexture::CreateTexture (int lumpnum, int usetype) { RawPageTexture_TryCreate, TEX_MiscPatch }, { FlatTexture_TryCreate, TEX_Flat }, { PatchTexture_TryCreate, TEX_Any }, - { AutomapTexture_TryCreate, TEX_Autopage }, + { AutomapTexture_TryCreate, TEX_MiscPatch }, }; if (lumpnum == -1) return NULL; diff --git a/src/thingdef/thingdef_properties.cpp b/src/thingdef/thingdef_properties.cpp index 9a057ad70..5b8704c53 100644 --- a/src/thingdef/thingdef_properties.cpp +++ b/src/thingdef/thingdef_properties.cpp @@ -2172,7 +2172,7 @@ static void PowerupColor (FScanner &sc, APowerupGiver *defaults, Baggage &bag) } else { - sc.ScriptError("\"%s\" requires an actor of type \"Powerup\"\n", sc.String); + sc.ScriptError("\"%s\" requires an actor of type \"Powerup\"\n", sc.String); return; } @@ -2232,7 +2232,7 @@ static void PowerupDuration (FScanner &sc, APowerupGiver *defaults, Baggage &bag { int *pEffectTics; - + if (bag.Info->Class->IsDescendantOf(RUNTIME_CLASS(APowerup))) { pEffectTics = &((APowerup*)defaults)->EffectTics; @@ -2243,7 +2243,7 @@ static void PowerupDuration (FScanner &sc, APowerupGiver *defaults, Baggage &bag } else { - sc.ScriptError("\"%s\" requires an actor of type \"Powerup\"\n", sc.String); + sc.ScriptError("\"%s\" requires an actor of type \"Powerup\"\n", sc.String); return; }