From fd0e9824b60a8cae288102551f0f3134a221cf3c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 26 Mar 2021 15:06:14 +0100 Subject: [PATCH] - call the game specific analyzesprites functions. --- source/build/include/build.h | 1 + source/build/include/buildtypes.h | 1 + source/build/src/engine.cpp | 2 ++ source/core/rendering/scene/hw_drawinfo.cpp | 7 +++++++ source/core/savegamehelp.cpp | 1 + source/games/blood/src/db.cpp | 1 + 6 files changed, 13 insertions(+) diff --git a/source/build/include/build.h b/source/build/include/build.h index f28aea79c..d54d887ca 100644 --- a/source/build/include/build.h +++ b/source/build/include/build.h @@ -156,6 +156,7 @@ EXTERN sectortype *sector; EXTERN walltype *wall; EXTERN spritetype *sprite; EXTERN tspriteptr_t tsprite; +EXTERN int leveltimer; extern sectortype sectorbackup[MAXSECTORS]; extern walltype wallbackup[MAXWALLS]; diff --git a/source/build/include/buildtypes.h b/source/build/include/buildtypes.h index d06f03cda..b57e49917 100644 --- a/source/build/include/buildtypes.h +++ b/source/build/include/buildtypes.h @@ -255,6 +255,7 @@ struct spritetype }; int16_t extra; int16_t detail; + int time; #if 0 // make sure we do not accidentally copy this diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index 0de1ad172..21c33c44a 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -344,6 +344,7 @@ int32_t insertsprite(int16_t sectnum, int16_t statnum) Numsprites++; } + sprite[newspritenum].time = leveltimer++; return newspritenum; } @@ -702,6 +703,7 @@ int32_t engineInit(void) void (*initspritelists_replace)(void) = NULL; void initspritelists(void) { + leveltimer = 0; if (initspritelists_replace) { initspritelists_replace(); diff --git a/source/core/rendering/scene/hw_drawinfo.cpp b/source/core/rendering/scene/hw_drawinfo.cpp index f1d27106f..a84c88648 100644 --- a/source/core/rendering/scene/hw_drawinfo.cpp +++ b/source/core/rendering/scene/hw_drawinfo.cpp @@ -39,6 +39,7 @@ #include "hw_clipper.h" #include "v_draw.h" #include "gamecvars.h" +#include "gamestruct.h" EXTERN_CVAR(Float, r_visibility) CVAR(Bool, gl_bandedswlight, false, CVAR_ARCHIVE) @@ -306,6 +307,8 @@ void HWDrawInfo::CreateScene() screen->mVertexData->Map(); screen->mLights->Map(); + spritesortcnt = 0; + vec2_t view = { int(vp.Pos.X * 16), int(vp.Pos.Y * -16) }; mDrawer.Init(this, mClipper, view); if (vp.SectNums) @@ -313,6 +316,10 @@ void HWDrawInfo::CreateScene() else mDrawer.RenderScene(&vp.SectCount, 1); + SetupSprite.Clock(); + gi->processSprites(view.x, view.y, vp.Pos.Z * -256, bamang(vp.RotAngle), vp.TicFrac * 65536); + SetupSprite.Unclock(); + screen->mLights->Unmap(); screen->mVertexData->Unmap(); diff --git a/source/core/savegamehelp.cpp b/source/core/savegamehelp.cpp index 5c506d2d5..030e9234a 100644 --- a/source/core/savegamehelp.cpp +++ b/source/core/savegamehelp.cpp @@ -496,6 +496,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, spritetype &c, spritet ("hitag", c.hitag, def->hitag) ("extra", c.extra, def->extra) ("detail", c.detail, def->detail) + ("time", c.time, def->time) .EndObject(); } return arc; diff --git a/source/games/blood/src/db.cpp b/source/games/blood/src/db.cpp index 4900a9614..ff5441f29 100644 --- a/source/games/blood/src/db.cpp +++ b/source/games/blood/src/db.cpp @@ -201,6 +201,7 @@ int InsertSprite(int nSector, int nStat) Numsprites++; + sprite[nSprite].time = leveltimer++; return nSprite; }