mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-01-10 08:44:25 +00:00
Wrongwarp: Randomised SMK character drivealong
Eggman always leads the pack
This commit is contained in:
parent
4cd1f894a2
commit
d7b46b967a
3 changed files with 128 additions and 0 deletions
10
src/k_menu.h
10
src/k_menu.h
|
|
@ -1239,8 +1239,18 @@ void M_Statistics(INT32 choice);
|
|||
void M_DrawStatistics(void);
|
||||
boolean M_StatisticsInputs(INT32 ch);
|
||||
|
||||
#define MAXWRONGPLAYER MAXSPLITSCREENPLAYERS
|
||||
#define WRONGPLAYEROFFSCREEN 48
|
||||
|
||||
extern struct wrongwarp_s {
|
||||
INT32 ticker;
|
||||
tic_t delaytowrongplayer;
|
||||
struct wrongplayer_s
|
||||
{
|
||||
UINT8 skin;
|
||||
INT16 across;
|
||||
boolean spinout;
|
||||
} wrongplayers[MAXWRONGPLAYER];
|
||||
} wrongwarp;
|
||||
|
||||
void M_WrongWarp(INT32 choice);
|
||||
|
|
|
|||
|
|
@ -5920,6 +5920,26 @@ static INT32 M_WrongWarpFallingHelper(INT32 y, INT32 falltime)
|
|||
return y;
|
||||
}
|
||||
|
||||
static void M_DrawWrongPlayer(UINT8 i)
|
||||
{
|
||||
#define wrongpl wrongwarp.wrongplayers[i]
|
||||
if (wrongpl.skin >= numskins)
|
||||
return;
|
||||
|
||||
UINT8 *colormap = R_GetTranslationColormap(wrongpl.skin, skins[wrongpl.skin].prefcolor, GTC_MENUCACHE);
|
||||
|
||||
M_DrawCharacterSprite(
|
||||
wrongpl.across,
|
||||
160 - ((i & 1) ? 0 : 32),
|
||||
wrongpl.skin,
|
||||
wrongpl.spinout ? SPR2_SPIN : SPR2_SLWN,
|
||||
wrongpl.spinout ? ((wrongpl.across/8) & 7) : 6,
|
||||
(wrongwarp.ticker+i),
|
||||
0, colormap
|
||||
);
|
||||
#undef wrongpl
|
||||
}
|
||||
|
||||
void M_DrawWrongWarp(void)
|
||||
{
|
||||
INT32 titleoffset = 0, titlewidth, x, y;
|
||||
|
|
@ -5984,6 +6004,17 @@ void M_DrawWrongWarp(void)
|
|||
|
||||
V_DrawFadeScreen(31, min((wrongwarp.ticker - 2*TICRATE/3), 5));
|
||||
|
||||
// SMK title screen recreation!?
|
||||
|
||||
if (wrongwarp.ticker >= 2*TICRATE)
|
||||
{
|
||||
// Done as four calls and not a loop for the sake of render order
|
||||
M_DrawWrongPlayer(0);
|
||||
M_DrawWrongPlayer(2);
|
||||
M_DrawWrongPlayer(1);
|
||||
M_DrawWrongPlayer(3);
|
||||
}
|
||||
|
||||
y = 20;
|
||||
|
||||
x = BASEVIDWIDTH - 8;
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include "../k_menu.h"
|
||||
#include "../s_sound.h"
|
||||
#include "../m_random.h"
|
||||
#include "../r_skins.h"
|
||||
|
||||
struct wrongwarp_s wrongwarp;
|
||||
|
||||
|
|
@ -26,10 +28,95 @@ void M_WrongWarp(INT32 choice)
|
|||
|
||||
static void M_WrongWarpTick(void)
|
||||
{
|
||||
static boolean firsteggman = true;
|
||||
|
||||
UINT8 i, j;
|
||||
|
||||
wrongwarp.ticker++;
|
||||
if (wrongwarp.ticker < 2*TICRATE)
|
||||
return;
|
||||
|
||||
if (wrongwarp.ticker == 2*TICRATE)
|
||||
{
|
||||
S_ShowMusicCredit();
|
||||
|
||||
for (i = 0; i < MAXWRONGPLAYER; i++)
|
||||
wrongwarp.wrongplayers[i].skin = MAXSKINS;
|
||||
|
||||
firsteggman = true;
|
||||
}
|
||||
|
||||
// SMK title screen recreation!?
|
||||
|
||||
for (i = 0; i < MAXWRONGPLAYER; i++)
|
||||
{
|
||||
if (wrongwarp.wrongplayers[i].skin == MAXSKINS)
|
||||
continue;
|
||||
|
||||
wrongwarp.wrongplayers[i].across += 5;
|
||||
if (wrongwarp.wrongplayers[i].across < BASEVIDWIDTH + WRONGPLAYEROFFSCREEN)
|
||||
continue;
|
||||
|
||||
wrongwarp.wrongplayers[i].skin = MAXSKINS;
|
||||
}
|
||||
|
||||
if (wrongwarp.delaytowrongplayer)
|
||||
{
|
||||
wrongwarp.delaytowrongplayer--;
|
||||
return;
|
||||
}
|
||||
|
||||
wrongwarp.delaytowrongplayer = M_RandomRange(TICRATE/3, 2*TICRATE/3);
|
||||
|
||||
if (wrongwarp.ticker == 2*TICRATE)
|
||||
return;
|
||||
|
||||
UINT32 rskin = 0;
|
||||
|
||||
if (firsteggman == true)
|
||||
{
|
||||
// Eggman always leads the pack. It's not Sonic's game anymore...
|
||||
firsteggman = false;
|
||||
|
||||
i = 0;
|
||||
wrongwarp.wrongplayers[i].spinout = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
rskin = R_GetLocalRandomSkin();
|
||||
|
||||
for (i = 0; i < MAXWRONGPLAYER; i++)
|
||||
{
|
||||
// Already in use.
|
||||
if (wrongwarp.wrongplayers[i].skin == rskin)
|
||||
return;
|
||||
|
||||
// Slot isn't free.
|
||||
if (wrongwarp.wrongplayers[i].skin != MAXSKINS)
|
||||
continue;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
// No free slots.
|
||||
if (i == MAXWRONGPLAYER)
|
||||
return;
|
||||
|
||||
// Check to see if any later entry uses the skin too
|
||||
for (j = i+1; j < MAXWRONGPLAYER; j++)
|
||||
{
|
||||
if (wrongwarp.wrongplayers[j].skin != rskin)
|
||||
continue;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
wrongwarp.wrongplayers[i].spinout = M_RandomChance(FRACUNIT/10);
|
||||
}
|
||||
|
||||
// Add the new character!
|
||||
wrongwarp.wrongplayers[i].skin = rskin;
|
||||
wrongwarp.wrongplayers[i].across = -WRONGPLAYEROFFSCREEN;
|
||||
}
|
||||
|
||||
static boolean M_WrongWarpInputs(INT32 ch)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue