From b3558d8925ace21303094085d54b14d97f7eb91d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 31 Oct 2021 11:41:04 +0100 Subject: [PATCH] - eliminated SetEnemy(In)active. Both were only used once, so they are now inlined. --- source/games/sw/src/ai.cpp | 2 +- source/games/sw/src/sprite.cpp | 30 ++---------------------------- source/games/sw/src/sprite.h | 1 - 3 files changed, 3 insertions(+), 30 deletions(-) diff --git a/source/games/sw/src/ai.cpp b/source/games/sw/src/ai.cpp index 9c87da581..d8a97094e 100644 --- a/source/games/sw/src/ai.cpp +++ b/source/games/sw/src/ai.cpp @@ -613,7 +613,7 @@ ANIMATORp DoActorActionDecide(DSWActor* actor) // Enemy goes inactive - he is still allowed to roam about for about // 5 seconds trying to find another player before his active_range is // bumped down - SetEnemyInactive(SpriteNum); + RESET(u->Flags, SPR_ACTIVE); // You've lost the player - now decide what to do action = ChooseAction(u->Personality->LostTarget); diff --git a/source/games/sw/src/sprite.cpp b/source/games/sw/src/sprite.cpp index 1514f9aed..999038851 100644 --- a/source/games/sw/src/sprite.cpp +++ b/source/games/sw/src/sprite.cpp @@ -6466,33 +6466,6 @@ KeyMain: return 0; } - -/* - - !AIC KEY - Set Active and Inactive code is here. It was tough to make this - fast. Just know that the main flag is SPR_ACTIVE. Should not need to be - changed except for possibly the u->active_range settings in the future. - -*/ - -void -SetEnemyActive(short SpriteNum) -{ - USERp u = User[SpriteNum].Data(); - - SET(u->Flags, SPR_ACTIVE); - u->inactive_time = 0; -} - -void -SetEnemyInactive(short SpriteNum) -{ - USERp u = User[SpriteNum].Data(); - - RESET(u->Flags, SPR_ACTIVE); -} - - // This function mostly only adjust the active_range field void @@ -6555,7 +6528,8 @@ AdjustActiveRange(PLAYERp pp, short SpriteNum, int dist) // some huge distance u->active_range = 75000; // sprite is AWARE - SetEnemyActive(SpriteNum); + SET(u->Flags, SPR_ACTIVE); + u->inactive_time = 0; } } diff --git a/source/games/sw/src/sprite.h b/source/games/sw/src/sprite.h index 041358c56..53d09603e 100644 --- a/source/games/sw/src/sprite.h +++ b/source/games/sw/src/sprite.h @@ -49,7 +49,6 @@ bool CanMoveHere(int16_t spritenum); bool SpriteOverlap(int16_t spritenum_a, int16_t spritenum_b); int DoActorDie(DSWActor* actor, DSWActor* weapActor, int meansofdeath); void SpriteControl(void); -void SetEnemyInactive(short SpriteNum); void DoActorZrange(short SpriteNum); void PreMapCombineFloors(void); void SpriteSetupPost(void);