Ironman: Randomize every lap and after intro

This commit is contained in:
AJ Martinez 2022-10-30 17:04:19 -07:00
parent c2224d2edc
commit 8cc535925b
6 changed files with 32 additions and 14 deletions

View file

@ -3145,7 +3145,7 @@ void G_DoPlayDemo(char *defdemoname)
// it would only break the replay if we clipped them. // it would only break the replay if we clipped them.
players[i].kartspeed = kartspeed[i]; players[i].kartspeed = kartspeed[i];
players[i].kartweight = kartweight[i]; players[i].kartweight = kartweight[i];
players[i].fakeskin = lastfakeskin[i]; players[i].lastfakeskin = lastfakeskin[i];
} }
demo.deferstart = true; demo.deferstart = true;

View file

@ -1700,6 +1700,7 @@ static boolean K_drawKartPositionFaces(void)
INT32 rankplayer[MAXPLAYERS]; INT32 rankplayer[MAXPLAYERS];
INT32 bumperx, emeraldx, numplayersingame = 0; INT32 bumperx, emeraldx, numplayersingame = 0;
INT32 xoff, yoff, flipflag = 0; INT32 xoff, yoff, flipflag = 0;
UINT8 workingskin;
UINT8 *colormap; UINT8 *colormap;
ranklines = 0; ranklines = 0;
@ -1797,13 +1798,18 @@ static boolean K_drawKartPositionFaces(void)
if (players[rankplayer[i]].mo->color) if (players[rankplayer[i]].mo->color)
{ {
colormap = R_GetTranslationColormap(((skin_t*)players[rankplayer[i]].mo->skin) - skins, players[rankplayer[i]].mo->color, GTC_CACHE); if ((skin_t*)players[rankplayer[i]].mo->skin)
workingskin = (skin_t*)players[rankplayer[i]].mo->skin - skins;
else
workingskin = players[rankplayer[i]].skin;
colormap = R_GetTranslationColormap(workingskin, players[rankplayer[i]].mo->color, GTC_CACHE);
if (players[rankplayer[i]].mo->colorized) if (players[rankplayer[i]].mo->colorized)
colormap = R_GetTranslationColormap(TC_RAINBOW, players[rankplayer[i]].mo->color, GTC_CACHE); colormap = R_GetTranslationColormap(TC_RAINBOW, players[rankplayer[i]].mo->color, GTC_CACHE);
else else
colormap = R_GetTranslationColormap(((skin_t*)players[rankplayer[i]].mo->skin) - skins, players[rankplayer[i]].mo->color, GTC_CACHE); colormap = R_GetTranslationColormap(workingskin, players[rankplayer[i]].mo->color, GTC_CACHE);
V_DrawMappedPatch(FACE_X + xoff, Y + yoff, V_HUDTRANS|V_SLIDEIN|V_SNAPTOLEFT|flipflag, faceprefix[((skin_t*)players[rankplayer[i]].mo->skin) - skins][FACE_RANK], colormap); V_DrawMappedPatch(FACE_X + xoff, Y + yoff, V_HUDTRANS|V_SLIDEIN|V_SNAPTOLEFT|flipflag, faceprefix[workingskin][FACE_RANK], colormap);
if (LUA_HudEnabled(hud_battlebumpers)) if (LUA_HudEnabled(hud_battlebumpers))
{ {

View file

@ -1919,6 +1919,9 @@ static void K_HandleLapIncrement(player_t *player)
player->karthud[khud_lapanimation] = 80; player->karthud[khud_lapanimation] = 80;
} }
if (skins[player->skin].flags & SF_IRONMAN)
SetRandomFakePlayerSkin(player);
if (rainbowstartavailable == true) if (rainbowstartavailable == true)
{ {
S_StartSound(player->mo, sfx_s23c); S_StartSound(player->mo, sfx_s23c);

View file

@ -4168,7 +4168,7 @@ void P_PlayerThink(player_t *player)
player->stairjank--; player->stairjank--;
} }
// Random skin / "ironman" // Random skin / "ironman"
if (((skin_t *)player->mo->skin)->flags & SF_IRONMAN) if (leveltime >= introtime && ((skin_t *)player->mo->skin)->flags & SF_IRONMAN)
{ {
if (player->mo) { if (player->mo) {
if (player->fakeskin != MAXSKINS) if (player->fakeskin != MAXSKINS)
@ -4177,15 +4177,7 @@ void P_PlayerThink(player_t *player)
} }
else else
{ {
INT32 i; SetRandomFakePlayerSkin(player);
do {
i = P_RandomKey(PR_RANDOMSKIN, numskins);
} while (skins[i].flags & SF_IRONMAN || i == player->lastfakeskin);
SetFakePlayerSkin(player, i);
S_StartSound(NULL, sfx_kc33);
K_SpawnDriftElectricSparks(player, player->skincolor, false);
} }
} }
} }

View file

@ -27,6 +27,8 @@
#include "p_local.h" #include "p_local.h"
#include "dehacked.h" // get_number (for thok) #include "dehacked.h" // get_number (for thok)
#include "m_cond.h" #include "m_cond.h"
#include "k_kart.h"
#include "m_random.h"
#if 0 #if 0
#include "k_kart.h" // K_KartResetPlayerColor #include "k_kart.h" // K_KartResetPlayerColor
#endif #endif
@ -345,6 +347,20 @@ void SetFakePlayerSkin(player_t* player, INT32 skinnum)
player->charflags = skins[skinnum].flags; player->charflags = skins[skinnum].flags;
} }
// Loudly rerandomize
void SetRandomFakePlayerSkin(player_t* player)
{
INT32 i;
do {
i = P_RandomKey(PR_RANDOMSKIN, numskins);
} while (skins[i].flags & SF_IRONMAN || i == player->lastfakeskin);
SetFakePlayerSkin(player, i);
S_StartSound(NULL, sfx_kc33);
K_SpawnDriftElectricSparks(player, player->skincolor, false);
}
// //
// Add skins from a pwad, each skin preceded by 'S_SKIN' marker // Add skins from a pwad, each skin preceded by 'S_SKIN' marker
// //

View file

@ -82,6 +82,7 @@ void R_InitSkins(void);
void SetPlayerSkin(INT32 playernum,const char *skinname); void SetPlayerSkin(INT32 playernum,const char *skinname);
void SetPlayerSkinByNum(INT32 playernum,INT32 skinnum); // Tails 03-16-2002 void SetPlayerSkinByNum(INT32 playernum,INT32 skinnum); // Tails 03-16-2002
void SetFakePlayerSkin(player_t* player, INT32 skinnum); void SetFakePlayerSkin(player_t* player, INT32 skinnum);
void SetRandomFakePlayerSkin(player_t* player);
boolean R_SkinUsable(INT32 playernum, INT32 skinnum); boolean R_SkinUsable(INT32 playernum, INT32 skinnum);
UINT32 R_GetSkinAvailabilities(void); UINT32 R_GetSkinAvailabilities(void);
INT32 R_SkinAvailable(const char *name); INT32 R_SkinAvailable(const char *name);