Pre start bulbs

This commit is contained in:
Sally Coolatta 2020-07-29 01:19:53 -04:00
parent 69b6ba2f18
commit c45a67c3f9
4 changed files with 170 additions and 2 deletions

View file

@ -482,8 +482,13 @@ extern UINT16 extralifetics;
// SRB2kart
extern tic_t introtime;
extern tic_t starttime;
extern const tic_t bulbtime;
extern UINT8 numbulbs;
extern tic_t raceexittime;
extern tic_t battleexittime;
extern INT32 hyudorotime;
extern INT32 stealtime;
extern INT32 sneakertime;

View file

@ -226,8 +226,13 @@ UINT16 extralifetics = 4*TICRATE;
// SRB2kart
tic_t introtime = 0;
tic_t starttime = 0;
const tic_t bulbtime = TICRATE/2;
UINT8 numbulbs = 0;
tic_t raceexittime = 5*TICRATE + (2*TICRATE/3);
tic_t battleexittime = 8*TICRATE;
INT32 hyudorotime = 7*TICRATE;
INT32 stealtime = TICRATE/2;
INT32 sneakertime = TICRATE + (TICRATE/3);

View file

@ -7882,6 +7882,9 @@ static patch_t *kp_karmasticker;
static patch_t *kp_splitkarmabomb;
static patch_t *kp_timeoutsticker;
static patch_t *kp_prestartbulb[15];
static patch_t *kp_prestartletters[7];
static patch_t *kp_startcountdown[16];
static patch_t *kp_racefault[6];
static patch_t *kp_racefinish[6];
@ -7999,6 +8002,24 @@ void K_LoadKartHUDGraphics(void)
kp_splitkarmabomb = W_CachePatchName("K_SPTKRM", PU_HUDGFX);
kp_timeoutsticker = W_CachePatchName("K_STTOUT", PU_HUDGFX);
// Pre-start countdown bulbs
sprintf(buffer, "K_BULBxx");
for (i = 0; i < 15; i++)
{
buffer[6] = '0'+((i+1)/10);
buffer[7] = '0'+((i+1)%10);
kp_prestartbulb[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX);
}
// Pre-start position letters
kp_prestartletters[0] = W_CachePatchName("K_PL_P", PU_HUDGFX);
kp_prestartletters[1] = W_CachePatchName("K_PL_O", PU_HUDGFX);
kp_prestartletters[2] = W_CachePatchName("K_PL_S", PU_HUDGFX);
kp_prestartletters[3] = W_CachePatchName("K_PL_I", PU_HUDGFX);
kp_prestartletters[4] = W_CachePatchName("K_PL_T", PU_HUDGFX);
kp_prestartletters[5] = W_CachePatchName("K_PL_N", PU_HUDGFX);
kp_prestartletters[6] = W_CachePatchName("K_PL_EX", PU_HUDGFX);
// Starting countdown
kp_startcountdown[0] = W_CachePatchName("K_CNT3A", PU_HUDGFX);
kp_startcountdown[1] = W_CachePatchName("K_CNT2A", PU_HUDGFX);
@ -10586,6 +10607,130 @@ static void K_drawKartMinimap(void)
}
}
static void K_drawKartStartBulbs(void)
{
const UINT8 start_animation[14] = {
1, 2, 3, 4, 5, 6, 7, 8,
7, 6,
9, 10, 11, 12
};
const UINT8 loop_animation[4] = {
12, 13, 12, 14
};
const UINT8 chillloop_animation[2] = {
11, 12
};
const UINT8 letters_order[10] = {
0, 1, 2, 3, 4, 3, 1, 5, 6, 6
};
const UINT8 letters_transparency[40] = {
0, 2, 4, 6, 8,
10, 10, 10, 10, 10,
10, 10, 10, 10, 10,
10, 10, 10, 10, 10,
10, 10, 10, 10, 10,
10, 10, 10, 10, 10,
10, 10, 10, 10, 10,
10, 8, 6, 4, 2
};
fixed_t spacing = 24*FRACUNIT;
fixed_t startx = (BASEVIDWIDTH/2)*FRACUNIT + (spacing/2);
fixed_t x, y = 48*FRACUNIT;
UINT8 numperrow = numbulbs/2;
UINT8 i;
if (numbulbs <= 10)
{
// No second row
numperrow = numbulbs;
}
else
{
if (numbulbs & 1)
{
numperrow++;
}
y -= (spacing/2);
}
startx -= (spacing/2) * numperrow;
x = startx;
for (i = 0; i < numbulbs; i++)
{
UINT8 patchnum = 0;
INT32 bulbtic = (leveltime - introtime - TICRATE) - (bulbtime * i);
if (i == numperrow)
{
y += spacing;
x = startx + (spacing/2);
}
if (bulbtic > 0)
{
if (bulbtic < 14)
{
patchnum = start_animation[bulbtic];
}
else
{
const INT32 length = (bulbtime * 3);
bulbtic -= 14;
if (bulbtic > length)
{
bulbtic -= length;
patchnum = chillloop_animation[bulbtic % 2];
}
else
{
patchnum = loop_animation[bulbtic % 4];
}
}
}
V_DrawFixedPatch(x, y, FRACUNIT, V_SNAPTOTOP, kp_prestartbulb[patchnum], NULL);
x += spacing;
}
x = 70*FRACUNIT;
y = 48*FRACUNIT;
for (i = 0; i < 10; i++)
{
UINT8 patchnum = letters_order[i];
INT32 transflag = letters_transparency[(leveltime - i) % 40];
if (transflag >= 10)
;
else
{
if (transflag != 0)
transflag = transflag << FF_TRANSSHIFT;
V_DrawFixedPatch(x, y, FRACUNIT, V_SNAPTOTOP|transflag, kp_prestartletters[patchnum], NULL);
}
if (i < 9)
{
x += (SHORT(kp_prestartletters[patchnum]->width)/2) * FRACUNIT;
patchnum = letters_order[i+1];
x += (SHORT(kp_prestartletters[patchnum]->width)/2) * FRACUNIT;
}
}
}
static void K_drawKartStartCountdown(void)
{
INT32 pnum = 0, splitflags = K_calcSplitFlags(0); // 3
@ -11451,9 +11596,15 @@ void K_drawKartHUD(void)
}
// Draw the countdowns after everything else.
if (leveltime >= starttime-(3*TICRATE)
if (leveltime >= introtime && leveltime < starttime-(3*TICRATE))
{
K_drawKartStartBulbs();
}
else if (leveltime >= starttime-(3*TICRATE)
&& leveltime < starttime+TICRATE)
{
K_drawKartStartCountdown();
}
else if (racecountdown && (!r_splitscreen || !stplyr->exiting))
{
char *countstr = va("%d", racecountdown/TICRATE);

View file

@ -2481,7 +2481,14 @@ static void P_LevelInitStuff(void)
introtime = (108) + 5; // 108 for rotation, + 5 for white fade
}
starttime = introtime + (6*TICRATE) + (max(p-2, 0) * (TICRATE/2)); // Start countdown time, + buffer time
numbulbs = 5;
if (p > 2)
{
numbulbs += (p-2);
}
starttime = (introtime + (3*TICRATE)) + ((2*TICRATE) + (numbulbs * bulbtime)); // Start countdown time, + buffer time
// SRB2Kart: map load variables
if (grandprixinfo.gp == true)