From 58ec0e4594d2cd112e9da5ba1d5f764edc35290f Mon Sep 17 00:00:00 2001 From: Marisa Heit Date: Sat, 15 Oct 2016 20:57:56 -0500 Subject: [PATCH 1/4] Add OF_Transient flag for objects that shouldn't be written to disk --- src/dobject.h | 4 ++++ src/serializer.cpp | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/dobject.h b/src/dobject.h index 51102bc4c2..91a80f9d07 100644 --- a/src/dobject.h +++ b/src/dobject.h @@ -201,6 +201,7 @@ enum EObjectFlags OF_EuthanizeMe = 1 << 5, // Object wants to die OF_Cleanup = 1 << 6, // Object is now being deleted by the collector OF_YesReallyDelete = 1 << 7, // Object is being deleted outside the collector, and this is okay, so don't print a warning + OF_Transient = 1 << 11, // Object should not be archived (references to it will be nulled on disk) OF_WhiteBits = OF_White0 | OF_White1, OF_MarkBits = OF_WhiteBits | OF_Black, @@ -573,6 +574,9 @@ protected: } }; +// When you write to a pointer to an Object, you must call this for +// proper bookkeeping in case the Object holding this pointer has +// already been processed by the GC. static inline void GC::WriteBarrier(DObject *pointing, DObject *pointed) { if (pointed != NULL && pointed->IsWhite() && pointing->IsBlack()) diff --git a/src/serializer.cpp b/src/serializer.cpp index 7861701c01..3a66a8397c 100644 --- a/src/serializer.cpp +++ b/src/serializer.cpp @@ -1451,7 +1451,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, DObject *&value, DObje { ndx = -1; } - else if (value->ObjectFlags & OF_EuthanizeMe) + else if (value->ObjectFlags & (OF_EuthanizeMe | OF_Transient)) { return arc; } From ae14993ba44dff703a190782bcf03594fb74d901 Mon Sep 17 00:00:00 2001 From: Marisa Heit Date: Sat, 15 Oct 2016 21:14:34 -0500 Subject: [PATCH 2/4] Fixed: Possible invalid processing for Crash states that immediately destroy the actor - Setting an actor's Crash state has the potential to destroy the actor if the Crash state has one or more 0-tic states that end with Stop. This was not taken into account when the object's Z velocity was 0, but it was under the floor anyway. --- src/p_mobj.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 1ebec242ed..8f926ea77f 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -3799,6 +3799,8 @@ void AActor::Tick () else if (Z() <= floorz) { Crash(); + if (ObjectFlags & OF_EuthanizeMe) + return; // actor was destroyed } CheckPortalTransition(true); From e4281454ceebb8714020e6bf1a2c0274d72e5723 Mon Sep 17 00:00:00 2001 From: Marisa Heit Date: Sat, 15 Oct 2016 21:40:24 -0500 Subject: [PATCH 3/4] Split ANIMATED into three parts, filtered by game that uses them - ANIMATED contained definitions for Doom, Heretic, and Strife, all crammed into a single file. This meant that animations from one game could erroneously make their way into maps for another game that provided custom textures with names that matched textures that animated in the other game. There are now three separate ANIMATED lumps with only the animations defined for the original game and no others. The one that gets loaded depends on the game being played. - Added documentation for the ANIMATED file format to the comment for FTextureManager::InitAnimated(), since I had to figure it out from the code. --- src/textures/animations.cpp | 10 ++++++++++ wadsrc/static/animated.lmp | Bin 1450 -> 0 bytes wadsrc/static/filter/game-doomchex/animated.lmp | Bin 0 -> 507 bytes wadsrc/static/filter/game-heretic/animated.lmp | Bin 0 -> 185 bytes wadsrc/static/filter/game-strife/animated.lmp | Bin 0 -> 760 bytes 5 files changed, 10 insertions(+) delete mode 100644 wadsrc/static/animated.lmp create mode 100644 wadsrc/static/filter/game-doomchex/animated.lmp create mode 100644 wadsrc/static/filter/game-heretic/animated.lmp create mode 100644 wadsrc/static/filter/game-strife/animated.lmp diff --git a/src/textures/animations.cpp b/src/textures/animations.cpp index 74f9b1f557..f46289f073 100644 --- a/src/textures/animations.cpp +++ b/src/textures/animations.cpp @@ -161,6 +161,16 @@ FAnimDef *FTextureManager::AddComplexAnim (FTextureID picnum, const TArray entries, terminated by a 0xFF byte. Each entry +// is 23 bytes long and consists of the following fields: +// Byte 0: Bit 1 set for wall texture, clear for flat texture. +// Bytes 1-9: '\0'-terminated name of first texture. +// Bytes 10-18: '\0'-terminated name of last texture. +// Bytes 19-22: Tics per frame (stored in little endian order). +// //========================================================================== CVAR(Bool, debuganimated, false, 0) diff --git a/wadsrc/static/animated.lmp b/wadsrc/static/animated.lmp deleted file mode 100644 index 100c804c8a8aa4148ed05df34bccf8de671248b8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1450 zcmY+E%Z{Tk5Jio8G@939J|zbFwKN2iC=Nu11oevl|B9J=t89|A6zTYM<+^N&nBjVI zeODQyV2$}<@aGpdcd^cp^^~7!(CG$m{~M7V#J=lfas9lD$r?8{&uY3a?qSY==%( zf!z0c;gVXwn%@s0=tM&_yI?XW(+FVJB)gcFIi7oDCwQ#p(~)Z4HybS4@qFPN8-Zud zY|+e?Q*y;QR*gB91|`J4C2jc<{lQ0cxy$`HfTY3S<*vjvT7r+VR>F5f_P{5_A#)Ib}j0fN}D{5Xx}B0vMhK8OOVQ;iq5~*h1po1-!3*6;S=}KTg2= AssI20 diff --git a/wadsrc/static/filter/game-doomchex/animated.lmp b/wadsrc/static/filter/game-doomchex/animated.lmp new file mode 100644 index 0000000000000000000000000000000000000000..016ce1fa3ff2b51f2f3f9b30f7919609cfdae182 GIT binary patch literal 507 zcmY+AOAdlS5Ja1}@i@R>qRU1GLKwizfZYEi+S4DRtR63wqA6JR2?y^01S)_l(9<8d z`PdkkPNoG+2Ye%C0Wy%(k~XYsN7cZPJ$J{rKBw{yAaGNi!Z`bqY6PrX-Y6~bm#%8l z4=K6Om%1U}EubZr6tIiq%TWnK#g}lJbi-)^(M3N-e_#lpfRY~4*00OvK;b8y|C`eU zj?-K+ccd{sk=7fxKN9LZu0p8 Dh$dJa literal 0 HcmV?d00001 diff --git a/wadsrc/static/filter/game-heretic/animated.lmp b/wadsrc/static/filter/game-heretic/animated.lmp new file mode 100644 index 0000000000000000000000000000000000000000..80102c88e203ad1ccffd5f13a6e480f81111b5b1 GIT binary patch literal 185 zcmYL>K@NZ*39gl6-&O=>w zaqkjr+>67nou_Jyd12t)o9dpPTEM#x)e=%#h?kIzGT);>U;|)wHcVr@o{*j3e|2fq z-m2@{wa=*q)|%O(nf;0{AdKiKfp z*s$slR8Q5V$I%9tz`HND#A-uUUFr&BDBw_3T`)6Rs{5-Wr Date: Sun, 16 Oct 2016 09:12:43 +0200 Subject: [PATCH 4/4] - use the newly added OF_Transient flag to avoid writing out the owned dynamic lights to savegames instead of destroying and recreating them each time. --- src/gl/dynlights/gl_dynlight.cpp | 1 + src/gl/scene/gl_scene.cpp | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/gl/dynlights/gl_dynlight.cpp b/src/gl/dynlights/gl_dynlight.cpp index 3fffe3641f..ae19ecf608 100644 --- a/src/gl/dynlights/gl_dynlight.cpp +++ b/src/gl/dynlights/gl_dynlight.cpp @@ -1081,6 +1081,7 @@ void gl_AttachLight(AActor *actor, unsigned int count, const FLightDefaults *lig light = Spawn(actor->Pos(), NO_REPLACE); light->target = actor; light->owned = true; + light->ObjectFlags |= OF_Transient; actor->dynamiclights.Push(light); } light->flags2&=~MF2_DORMANT; diff --git a/src/gl/scene/gl_scene.cpp b/src/gl/scene/gl_scene.cpp index 4b7bc762f5..b53be4aaa6 100644 --- a/src/gl/scene/gl_scene.cpp +++ b/src/gl/scene/gl_scene.cpp @@ -1199,7 +1199,6 @@ void FGLInterface::StateChanged(AActor *actor) void FGLInterface::StartSerialize(FSerializer &arc) { - gl_DeleteAllAttachedLights(); if (arc.BeginObject("glinfo")) { arc("fogdensity", fogdensity) @@ -1211,8 +1210,11 @@ void FGLInterface::StartSerialize(FSerializer &arc) void FGLInterface::EndSerialize(FSerializer &arc) { - gl_RecreateAllAttachedLights(); - if (arc.isReading()) gl_InitPortals(); + if (arc.isReading()) + { + gl_RecreateAllAttachedLights(); + gl_InitPortals(); + } } //===========================================================================