From 754c8bd9c1e40c8f300de9a282787d5a5e050652 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 6 May 2020 09:56:13 +0200 Subject: [PATCH] - lotsofstuff --- source/games/duke/src/actors.cpp | 38 +++++++++++++++++++++++++++++- source/games/duke/src/actors.h | 6 ++--- source/games/duke/src/actors_e.cpp | 13 +++------- source/games/duke/src/game.h | 1 + source/games/duke/src/global.h | 4 ++++ 5 files changed, 48 insertions(+), 14 deletions(-) diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index b20aa1916..4096057ae 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -730,7 +730,7 @@ int movesprite(short spritenum, int xchange, int ychange, int zchange, unsigned // //--------------------------------------------------------------------------- -short ssp(short i, unsigned int cliptype) //The set sprite function +int ssp(short i, unsigned int cliptype) //The set sprite function { spritetype* s; int movetype; @@ -745,6 +745,42 @@ short ssp(short i, unsigned int cliptype) //The set sprite function return (movetype == 0); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void insertspriteq(int i) +{ + if (spriteqamount > 0) + { + if (spriteq[spriteqloc] >= 0) + sprite[spriteq[spriteqloc]].xrepeat = 0; + spriteq[spriteqloc] = i; + spriteqloc = (spriteqloc + 1) % spriteqamount; + } + else sprite[i].xrepeat = sprite[i].yrepeat = 0; +} + +//--------------------------------------------------------------------------- +// +// consolidation of several nearly identical functions +// lotsofmoney -> MONEY +// lotsofmail -> MAIL +// lotsofpaper -> PAPER +// +//--------------------------------------------------------------------------- + +void lotsofstuff(spritetype* s, short n, int spawntype) +{ + short i, j; + for (i = n; i > 0; i--) + { + j = EGS(s->sectnum, s->x, s->y, s->z - (krand() % (47 << 8)), spawntype, -32, 8, 8, krand() & 2047, 0, 0, 0, 5); + sprite[j].cstat = krand() & 12; + } +} //--------------------------------------------------------------------------- // diff --git a/source/games/duke/src/actors.h b/source/games/duke/src/actors.h index cce643f64..b551cc7e8 100644 --- a/source/games/duke/src/actors.h +++ b/source/games/duke/src/actors.h @@ -313,11 +313,11 @@ ACTOR_INLINE int A_CheckEnemyTile(int const tileNum) return ((g_tile[tileNum].flags & (SFLAG_BADGUY_TILE | SFLAG_BADGUY)) != 0); } +int ssp(short i, unsigned int cliptype); //The set sprite function + ACTOR_INLINE int A_SetSprite(int const spriteNum, uint32_t cliptype) { - vec3_t davect = { (sprite[spriteNum].xvel * (sintable[(sprite[spriteNum].ang + 512) & 2047])) >> 14, - (sprite[spriteNum].xvel * (sintable[sprite[spriteNum].ang & 2047])) >> 14, sprite[spriteNum].zvel }; - return (A_MoveSprite(spriteNum, &davect, cliptype) == 0); + return ssp(spriteNum, cliptype); } # endif diff --git a/source/games/duke/src/actors_e.cpp b/source/games/duke/src/actors_e.cpp index 8d22f2237..29c0810f9 100644 --- a/source/games/duke/src/actors_e.cpp +++ b/source/games/duke/src/actors_e.cpp @@ -187,18 +187,11 @@ void A_DeleteSprite(int spriteNum) deletesprite(spriteNum); } +void insertspriteq(int i); + void A_AddToDeleteQueue(int spriteNum) { - if (g_deleteQueueSize == 0) - { - A_DeleteSprite(spriteNum); - return; - } - - if (SpriteDeletionQueue[g_spriteDeleteQueuePos] >= 0) - sprite[SpriteDeletionQueue[g_spriteDeleteQueuePos]].xrepeat = 0; - SpriteDeletionQueue[g_spriteDeleteQueuePos] = spriteNum; - g_spriteDeleteQueuePos = (g_spriteDeleteQueuePos+1)%g_deleteQueueSize; + insertspriteq(spriteNum); } void A_SpawnMultiple(int spriteNum, int tileNum, int spawnCnt) diff --git a/source/games/duke/src/game.h b/source/games/duke/src/game.h index b4824fa29..551ed4eee 100644 --- a/source/games/duke/src/game.h +++ b/source/games/duke/src/game.h @@ -226,6 +226,7 @@ extern int32_t voting; int32_t A_CheckInventorySprite(spritetype *s); int32_t A_InsertSprite(int16_t whatsect, int32_t s_x, int32_t s_y, int32_t s_z, int16_t s_pn, int8_t s_s, uint8_t s_xr, uint8_t s_yr, int16_t s_a, int16_t s_ve, int16_t s_zv, int16_t s_ow, int16_t s_ss); +#define EGS A_InsertSprite int A_Spawn(int spriteNum,int tileNum); int G_DoMoveThings(void); //int32_t G_EndOfLevel(void); diff --git a/source/games/duke/src/global.h b/source/games/duke/src/global.h index e6a05b576..abf261980 100644 --- a/source/games/duke/src/global.h +++ b/source/games/duke/src/global.h @@ -320,6 +320,10 @@ struct psaccess }; extern psaccess ps; +#define spriteqamount g_deleteQueueSize +#define spriteq SpriteDeletionQueue +#define spriteqloc g_spriteDeleteQueuePos + END_DUKE_NS #endif