From 1429a91cd92a134bcffc9ec2b6609ac8ddb91987 Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 28 Jun 2023 16:36:36 +0100 Subject: [PATCH] Increase maximum # of Followers Surprisingly easy as it requires negative values to mark "None", so it was already out of the range of UINT8 --- src/deh_soc.c | 2 +- src/k_follower.c | 2 +- src/k_follower.h | 13 +++++++++++-- src/k_kart.c | 4 +++- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/deh_soc.c b/src/deh_soc.c index 18ba79861..21aa0bb09 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -3602,7 +3602,7 @@ void readfollower(MYFILE *f) INT32 res; INT32 i; - if (numfollowers >= MAXSKINS) + if (numfollowers >= MAXFOLLOWERS) { I_Error("Out of Followers\nLoad less addons to fix this."); } diff --git a/src/k_follower.c b/src/k_follower.c index 937527a49..fa932eb79 100644 --- a/src/k_follower.c +++ b/src/k_follower.c @@ -14,7 +14,7 @@ #include "m_cond.h" INT32 numfollowers = 0; -follower_t followers[MAXSKINS]; +follower_t followers[MAXFOLLOWERS]; INT32 numfollowercategories; followercategory_t followercategories[MAXFOLLOWERCATEGORIES]; diff --git a/src/k_follower.h b/src/k_follower.h index d01939040..3bb819d54 100644 --- a/src/k_follower.h +++ b/src/k_follower.h @@ -20,6 +20,13 @@ extern "C" { #endif +// The important collorary to "Hornmod is universally hated in dev" is +// the simple phrase "this is why" -- 1024 is obscene yet will fill up. +// By the way, this comment will grow stronger and stronger every time +// somebody comes here to double it, so I encourage you to leave a new +// (dated) comment every time you do so. ~toast 280623 +#define MAXFOLLOWERS 1024 + #define FOLLOWERCOLOR_MATCH UINT16_MAX #define FOLLOWERCOLOR_OPPOSITE (UINT16_MAX-1) @@ -85,12 +92,14 @@ struct follower_t statenum_t losestate; // state when the player has lost statenum_t hitconfirmstate; // state for hit confirm tic_t hitconfirmtime; // time to keep the above playing for + + sfxenum_t hornsound; // Press (B) to announce you are pressing (B) }; extern INT32 numfollowers; -extern follower_t followers[MAXSKINS]; +extern follower_t followers[MAXFOLLOWERS]; -#define MAXFOLLOWERCATEGORIES 32 +#define MAXFOLLOWERCATEGORIES 64 struct followercategory_t { diff --git a/src/k_kart.c b/src/k_kart.c index 2adcfa4ea..989948a68 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -2649,7 +2649,9 @@ void K_TryHurtSoundExchange(mobj_t *victim, mobj_t *attacker) attacker->player->confirmVictim = (victim->player - players); attacker->player->confirmVictimDelay = TICRATE/2; - if (attacker->player->follower != NULL) + if (attacker->player->follower != NULL + && attacker->player->followerskin >= 0 + && attacker->player->followerskin < numfollowers) { const follower_t *fl = &followers[attacker->player->followerskin]; attacker->player->follower->movecount = fl->hitconfirmtime; // movecount is used to play the hitconfirm animation for followers.