Fix Auto-Ring follower fallback

- Move `followerready`'s first set from `K_SetFollowerByNum` (which isn't called if your follower is -1, the exact case Goddess is supposed to help us with) to `G_UpdatePlayerPreferences`, which is always called whenever the follower ID is validated on join
- Cache "Goddess"' followerskin ID by cribbing from `r_skins` and `R_DefaultBotSkin`
This commit is contained in:
toaster 2025-08-23 21:49:10 +01:00
parent 8d75727419
commit 48a155f8e7
2 changed files with 26 additions and 6 deletions

View file

@ -1801,6 +1801,8 @@ void G_FixCamera(UINT8 view)
void G_UpdatePlayerPreferences(player_t *const player)
{
player->followerready = true; // we are ready to perform follower related actions in the player thinker, now.
if (demo.playback)
return;

View file

@ -176,8 +176,6 @@ void K_SetFollowerByNum(INT32 playernum, INT32 skinnum)
{
player_t *player = &players[playernum];
player->followerready = true; // we are ready to perform follower related actions in the player thinker, now.
if (skinnum >= -1 && skinnum <= numfollowers) // Make sure it exists!
{
/*
@ -898,6 +896,26 @@ void K_FollowerHornTaunt(player_t *taunter, player_t *victim, boolean mysticmelo
}
}
#define AUTORINGFOLLOWERNAME "goddess"
static INT32 K_AutoRingFollower(void)
{
static INT32 autoringfollower = -2;
if (autoringfollower == -2)
{
autoringfollower = K_FollowerAvailable(AUTORINGFOLLOWERNAME);
if (autoringfollower == -2)
{
// This shouldn't happen, but just in case
autoringfollower = -1;
}
}
return (INT32)autoringfollower;
}
#undef AUTORINGFOLLOWERNAME
/*--------------------------------------------------
INT32 K_GetEffectiveFollowerSkin(const player_t *player);
@ -905,8 +923,8 @@ void K_FollowerHornTaunt(player_t *taunter, player_t *victim, boolean mysticmelo
--------------------------------------------------*/
INT32 K_GetEffectiveFollowerSkin(const player_t *player)
{
if ((player->pflags & PF_AUTORING) && player->followerskin == -1)
return K_FollowerAvailable("Goddess");
else
return player->followerskin;
if (player->followerskin == -1 && ((player->pflags & PF_AUTORING) == PF_AUTORING))
return K_AutoRingFollower();
return player->followerskin;
}