From 2bb7cecf27a5bce1d076a9585c2af6b31f63faa2 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 30 Dec 2021 17:55:17 +0100 Subject: [PATCH] - eliminated spritetype::clear. Most uses were bad anyway, and the legitimate ones are just clearing the object. --- source/core/maploader.cpp | 2 +- source/core/maptypes.h | 11 ----------- source/games/blood/src/db.cpp | 2 +- source/games/sw/src/bunny.cpp | 2 -- source/games/sw/src/ripper.cpp | 1 - source/games/sw/src/ripper2.cpp | 1 - source/games/sw/src/rooms.cpp | 1 - source/games/sw/src/sprite.cpp | 4 ---- 8 files changed, 2 insertions(+), 22 deletions(-) diff --git a/source/core/maploader.cpp b/source/core/maploader.cpp index b1840389d..1cef5a0c8 100644 --- a/source/core/maploader.cpp +++ b/source/core/maploader.cpp @@ -280,7 +280,7 @@ void validateSprite(spritetype& spr, int sectnum, int index) } if (bugged) { - spr.clear(); + spr = {}; spr.statnum = MAXSTATUS; sectnum = -1; } diff --git a/source/core/maptypes.h b/source/core/maptypes.h index 5cf977b77..7169b5390 100644 --- a/source/core/maptypes.h +++ b/source/core/maptypes.h @@ -455,17 +455,6 @@ struct spritetype : public spritetypebase int16_t wall; // wall and wdist are for Polymost only. int8_t wdist; - void clear() - { - auto sect = sectp; - int stat = statnum; - int save = time; // this may not be cleared ever!!! - memset(this, 0, sizeof(*this)); - time = save; - sectp = sect; - statnum = stat; - } - }; //============================================================================= diff --git a/source/games/blood/src/db.cpp b/source/games/blood/src/db.cpp index f3444ed92..56885cdf3 100644 --- a/source/games/blood/src/db.cpp +++ b/source/games/blood/src/db.cpp @@ -476,7 +476,7 @@ void dbLoadMap(const char* pPath, int* pX, int* pY, int* pZ, short* pAngle, sect dbCrypt((char*)&load, sizeof(spritetypedisk), (gMapRev * sizeof(spritetypedisk)) | 0x7474614d); } auto pSprite = &sprites.sprites[i]; - pSprite->clear(); + *pSprite = {}; pSprite->pos.X = LittleLong(load.x); pSprite->pos.Y = LittleLong(load.y); pSprite->pos.Z = LittleLong(load.z); diff --git a/source/games/sw/src/bunny.cpp b/source/games/sw/src/bunny.cpp index a047918db..56eb82a34 100644 --- a/source/games/sw/src/bunny.cpp +++ b/source/games/sw/src/bunny.cpp @@ -1113,7 +1113,6 @@ void BunnyHatch(DSWActor* actor) for (int i = 0; i < MAX_BUNNYS; i++) { auto actorNew = insertActor(actor->sector(), STAT_DEFAULT); - actorNew->spr.clear(); actorNew->spr.pos = actor->spr.pos; actorNew->spr.xrepeat = 30; // Baby size actorNew->spr.yrepeat = 24; @@ -1170,7 +1169,6 @@ DSWActor* BunnyHatch2(DSWActor* actor) { auto actorNew = insertActor(actor->sector(), STAT_DEFAULT); - actorNew->spr.clear(); actorNew->spr.pos.X = actor->spr.pos.X; actorNew->spr.pos.Y = actor->spr.pos.Y; actorNew->spr.pos.Z = actor->spr.pos.Z; diff --git a/source/games/sw/src/ripper.cpp b/source/games/sw/src/ripper.cpp index b5305d0f4..9fe8f37e2 100644 --- a/source/games/sw/src/ripper.cpp +++ b/source/games/sw/src/ripper.cpp @@ -1173,7 +1173,6 @@ void RipperHatch(DSWActor* actor) for (int i = 0; i < MAX_RIPPERS; i++) { auto actorNew = insertActor(actor->sector(), STAT_DEFAULT); - actorNew->spr.clear(); ClearOwner(actorNew); actorNew->spr.pos.X = actor->spr.pos.X; actorNew->spr.pos.Y = actor->spr.pos.Y; diff --git a/source/games/sw/src/ripper2.cpp b/source/games/sw/src/ripper2.cpp index aca280a89..30f547821 100644 --- a/source/games/sw/src/ripper2.cpp +++ b/source/games/sw/src/ripper2.cpp @@ -1198,7 +1198,6 @@ void Ripper2Hatch(DSWActor* actor) for (int i = 0; i < MAX_RIPPER2S; i++) { auto actorNew = insertActor(actor->sector(), STAT_DEFAULT); - actorNew->spr.clear(); ClearOwner(actorNew); actorNew->spr.pos = actor->spr.pos; diff --git a/source/games/sw/src/rooms.cpp b/source/games/sw/src/rooms.cpp index d1a6aaea8..bc89fd14f 100644 --- a/source/games/sw/src/rooms.cpp +++ b/source/games/sw/src/rooms.cpp @@ -62,7 +62,6 @@ DSWActor* insertActor(sectortype* sect, int statnum) { auto pActor = static_cast(::InsertActor(RUNTIME_CLASS(DSWActor), sect, statnum)); - pActor->spr.clear(); pActor->spr.owner = -1; return pActor; } diff --git a/source/games/sw/src/sprite.cpp b/source/games/sw/src/sprite.cpp index 2ea4f9491..19508cc5d 100644 --- a/source/games/sw/src/sprite.cpp +++ b/source/games/sw/src/sprite.cpp @@ -756,11 +756,7 @@ void KillActor(DSWActor* actor) { SetSuicide(actor->user.flameActor); } - actor->clearUser(); } - - // shred your garbage - actor->spr.clear(); actor->Destroy(); }