From 9bfd67678330da477c3bf996536b6eaa2e33ff66 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 29 Nov 2015 11:28:26 +0100 Subject: [PATCH] - allow setting the FloatbobPhase through UDMF. --- specs/udmf_zdoom.txt | 1 + src/doomdata.h | 1 + src/namedef.h | 1 + src/p_buildmap.cpp | 1 + src/p_mobj.cpp | 1 + src/p_setup.cpp | 2 ++ src/p_udmf.cpp | 6 ++++++ 7 files changed, 13 insertions(+) diff --git a/specs/udmf_zdoom.txt b/specs/udmf_zdoom.txt index 6541e9a02..d501cb884 100644 --- a/specs/udmf_zdoom.txt +++ b/specs/udmf_zdoom.txt @@ -237,6 +237,7 @@ Note: All fields default to false unless mentioned otherwise. scalex = ; // Vertical scaling on thing. Default = 0 (ignored). scaley = ; // Horizontal scaling on thing. Default = 0 (ignored). scale = ; // Vertical and horizontal scaling on thing. Default = 0 (ignored). + floatbobphase = ; // Sets the thing's floatbobphase. Valid phase values are 0-63. Default = -1 (use actor class default). * Note about arg0str diff --git a/src/doomdata.h b/src/doomdata.h index 71e581e26..0877aee90 100644 --- a/src/doomdata.h +++ b/src/doomdata.h @@ -365,6 +365,7 @@ struct FMapThing short pitch; short roll; DWORD RenderStyle; + int FloatbobPhase; }; diff --git a/src/namedef.h b/src/namedef.h index 0d49bba76..22dbe1b51 100644 --- a/src/namedef.h +++ b/src/namedef.h @@ -396,6 +396,7 @@ xx(Roll) xx(Scale) xx(ScaleX) xx(ScaleY) +xx(Floatbobphase) xx(Blocking) xx(Blockmonsters) diff --git a/src/p_buildmap.cpp b/src/p_buildmap.cpp index 46c2b9f4c..670f53751 100644 --- a/src/p_buildmap.cpp +++ b/src/p_buildmap.cpp @@ -707,6 +707,7 @@ static int LoadSprites (spritetype *sprites, Xsprite *xsprites, int numsprites, mapthings[count].RenderStyle = STYLE_Count; mapthings[count].alpha = -1; mapthings[count].health = -1; + mapthings[count].FloatbobPhase = -1; if (xsprites != NULL && sprites[i].lotag == 710) { // Blood ambient sound diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index d5c5eb5d9..ab89ae04c 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -4917,6 +4917,7 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position) mobj->SpawnPoint[2] = mthing->z; mobj->SpawnAngle = mthing->angle; mobj->SpawnFlags = mthing->flags; + if (mthing->FloatbobPhase >= 0 && mthing->FloatbobPhase < 64) mobj->FloatBobPhase = mthing->FloatbobPhase; if (mthing->gravity < 0) mobj->gravity = -mthing->gravity; else if (mthing->gravity > 0) mobj->gravity = FixedMul(mobj->gravity, mthing->gravity); else mobj->flags &= ~MF_NOGRAVITY; diff --git a/src/p_setup.cpp b/src/p_setup.cpp index 311bf8fc4..50e7f41d6 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -1758,6 +1758,7 @@ void P_LoadThings (MapData * map) mti[i].RenderStyle = STYLE_Count; mti[i].alpha = -1; mti[i].health = 1; + mti[i].FloatbobPhase = -1; flags &= ~MTF_SKILLMASK; mti[i].flags = (short)((flags & 0xf) | 0x7e0); if (gameinfo.gametype == GAME_Strife) @@ -1842,6 +1843,7 @@ void P_LoadThings2 (MapData * map) mti[i].RenderStyle = STYLE_Count; mti[i].alpha = -1; mti[i].health = 1; + mti[i].FloatbobPhase = -1; } delete[] mtp; } diff --git a/src/p_udmf.cpp b/src/p_udmf.cpp index 0434d8bce..269ce7e3d 100644 --- a/src/p_udmf.cpp +++ b/src/p_udmf.cpp @@ -474,6 +474,7 @@ public: th->RenderStyle = STYLE_Count; th->alpha = -1; th->health = 1; + th->FloatbobPhase = -1; sc.MustGetToken('{'); while (!sc.CheckToken('}')) { @@ -631,6 +632,11 @@ public: Flag(th->flags, MTF_SECRET, key); break; + case NAME_Floatbobphase: + CHECK_N(Zd | Zdt) + th->FloatbobPhase = CheckInt(key); + break; + case NAME_Renderstyle: { FName style = CheckString(key);