Swoopy Start & Lap Lakitu

This commit is contained in:
ZTsukei 2017-06-03 18:19:06 -04:00
parent 192647d4f1
commit 6381791ca6
3 changed files with 81 additions and 32 deletions

View File

@ -244,6 +244,7 @@ typedef enum
k_throwdir, // Held dir of controls; 1 = forward, 0 = none, -1 = backward (was "player->heldDir")
k_camspin, // Used to 180 the camera while a button is held
k_lapanimation, // Used to make a swoopy lap lakitu, maybe other effects in the future
k_sounds, // Used this to stop and then force music restores as it hits zero
k_boosting, // Determines if you're currently shroom-boosting

View File

@ -1296,6 +1296,9 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
if (player->kartstuff[k_laserwisptimer])
player->kartstuff[k_laserwisptimer]--;
if (player->kartstuff[k_lapanimation])
player->kartstuff[k_lapanimation]--;
if (player->kartstuff[k_sounds])
player->kartstuff[k_sounds]--;
@ -3024,6 +3027,7 @@ static patch_t *kp_timestickerwide;
static patch_t *kp_lapsticker;
static patch_t *kp_lapstickernarrow;
static patch_t *kp_lakitustart[NUMLAKIFRAMES];
static patch_t *kp_lakitulaps[9];
static patch_t *kp_positionnum[NUMPOSNUMS][NUMPOSFRAMES];
static patch_t *kp_facenull;
static patch_t *kp_facefirst;
@ -3125,6 +3129,17 @@ void K_LoadKartHUDGraphics(void)
kp_lakitustart[11] = W_CachePatchName("K_LAKISL", PU_HUDGFX);
kp_lakitustart[12] = W_CachePatchName("K_LAKISM", PU_HUDGFX);
// Lakitu Lap Frames
kp_lakitulaps[0] = W_CachePatchName("K_LAKIL2", PU_HUDGFX);
kp_lakitulaps[1] = W_CachePatchName("K_LAKIL3", PU_HUDGFX);
kp_lakitulaps[2] = W_CachePatchName("K_LAKIL4", PU_HUDGFX);
kp_lakitulaps[3] = W_CachePatchName("K_LAKIL5", PU_HUDGFX);
kp_lakitulaps[4] = W_CachePatchName("K_LAKIL6", PU_HUDGFX);
kp_lakitulaps[5] = W_CachePatchName("K_LAKIL7", PU_HUDGFX);
kp_lakitulaps[6] = W_CachePatchName("K_LAKIL8", PU_HUDGFX);
kp_lakitulaps[7] = W_CachePatchName("K_LAKIL9", PU_HUDGFX);
kp_lakitulaps[8] = W_CachePatchName("K_LAKILF", PU_HUDGFX);
// Position numbers
for (i = 0; i < NUMPOSNUMS; i++)
{
@ -3302,7 +3317,7 @@ static void K_initKartHUD(void)
FACE_Y = 92; // 92
// Lakitu
LAKI_X = 136; // 138
LAKI_Y = -44; // -34
LAKI_Y = 58 - 200; // 58
break;
}
}
@ -3518,6 +3533,7 @@ static void K_drawKartNeoItem(void)
}
*/
/*
static void K_DrawKartTripleItem(void)
{
// TRIP_X = 143; // 143
@ -3528,7 +3544,7 @@ static void K_DrawKartTripleItem(void)
patch_t *localpatch = kp_nodraw;
INT32 thisitem;
/*if ()
if ()
{
thisitem = stplyr->kartstuff[k_triplebanana];
if (thisitem & 1) localpatch = kp_singleneobananaicon;
@ -3544,8 +3560,8 @@ static void K_DrawKartTripleItem(void)
if (thisitem & 1) localpatch = kp_singlejawsicon;
else if (thisitem & 2) localpatch = kp_doublejawsicon;
}
else*/
//{
else
{
thisitem = stplyr->kartstuff[k_triplebanana];
if (thisitem & 4) localpatch = kp_triplebananaicon;
else if (thisitem & 2) localpatch = kp_doublebananaicon;
@ -3564,11 +3580,12 @@ static void K_DrawKartTripleItem(void)
if (stplyr->kartstuff[k_banana] & 1) localpatch = kp_singlebananaicon;
if (stplyr->kartstuff[k_greenshell] & 1) localpatch = kp_singlegreenshellicon;
if (stplyr->kartstuff[k_redshell] & 1) localpatch = kp_singleredshellicon;
//}
}
if (localpatch != kp_nodraw)
V_DrawScaledPatch(TRIP_X, STRINGY(TRIP_Y), V_SNAPTOBOTTOM, localpatch);
}
*/
static void K_drawKartTimestamp(void)
{
@ -3791,10 +3808,10 @@ static void K_drawKartSpeedometer(void)
static void K_drawStartLakitu(void)
{
patch_t *localpatch = kp_nodraw;
INT16 adjustY;
if (leveltime >= 158)
return;
fixed_t adjustY;
fixed_t numFrames = 32; // Number of frames for the animation
fixed_t finalOffset = 206; // Number of pixels to offset the patch (This is actually 200, the 6 is a buffer for the parabola)
if (leveltime >= 0 && leveltime < 52) localpatch = kp_lakitustart[0];
if (leveltime >= 52 && leveltime < 56) localpatch = kp_lakitustart[1];
@ -3808,36 +3825,60 @@ static void K_drawStartLakitu(void)
if (leveltime >= 130 && leveltime < 134) localpatch = kp_lakitustart[9];
if (leveltime >= 134 && leveltime < 138) localpatch = kp_lakitustart[10];
if (leveltime >= 138 && leveltime < 142) localpatch = kp_lakitustart[11];
if (leveltime >= 142 && leveltime < 158) localpatch = kp_lakitustart[12];
if (leveltime >= 142 && leveltime < 178) localpatch = kp_lakitustart[12];
// I am sorry for this mess, I can't math right now.
if (leveltime <= 33)
{
switch (leveltime)
{
case 0: adjustY = 0; break;
case 1: adjustY = 4; break; case 2: adjustY = 10; break; case 3: adjustY = 16; break;
case 4: adjustY = 22; break; case 5: adjustY = 27; break; case 6: adjustY = 32; break;
case 7: adjustY = 37; break; case 8: adjustY = 42; break; case 9: adjustY = 46; break;
case 10: adjustY = 50; break; case 11: adjustY = 54; break; case 12: adjustY = 58; break;
case 13: adjustY = 62; break; case 14: adjustY = 65; break; case 15: adjustY = 68; break;
case 16: adjustY = 71; break; case 17: adjustY = 74; break; case 18: adjustY = 77; break;
case 19: adjustY = 80; break; case 20: adjustY = 82; break; case 21: adjustY = 84; break;
case 22: adjustY = 86; break; case 23: adjustY = 88; break; case 24: adjustY = 90; break;
case 25: adjustY = 92; break; case 26: adjustY = 94; break; case 27: adjustY = 95; break;
case 28: adjustY = 96; break; case 29: adjustY = 97; break; case 30: adjustY = 98; break;
case 31: adjustY = 99; break; case 32: adjustY = 100; break; case 33: adjustY = 101; break;
default: adjustY = 102; break;
}
}
if (leveltime <= numFrames)
adjustY = (finalOffset - 1) - FixedMul((finalOffset), FRACUNIT / (leveltime + 3));
else if (leveltime >= 146)
adjustY = (158 - leveltime)*8;
{
fixed_t templeveltime = leveltime - 145;
adjustY = (finalOffset - 1) - FixedMul((finalOffset), FRACUNIT / (numFrames + 3 - templeveltime));
}
else
adjustY = 102;
adjustY = 200;
V_DrawSmallScaledPatch(LAKI_X, STRINGY(LAKI_Y + adjustY), V_SNAPTOTOP, localpatch);
}
static void K_drawLapLakitu(void)
{
patch_t *localpatch = kp_nodraw;
fixed_t swoopTimer = 80 - stplyr->kartstuff[k_lapanimation]; // Starts at 80, goes down by 1 per frame
fixed_t adjustY;
fixed_t numFrames = 32; // Number of frames for the animation
fixed_t finalOffset = 206; // Number of pixels to offset the patch (This is actually 200, the 6 is a buffer for the parabola)
if (stplyr->laps < (UINT8)(cv_numlaps.value - 1))
{
switch (stplyr->laps)
{
case 1: localpatch = kp_lakitulaps[0]; break;
case 2: localpatch = kp_lakitulaps[1]; break;
case 3: localpatch = kp_lakitulaps[2]; break;
case 4: localpatch = kp_lakitulaps[3]; break;
case 5: localpatch = kp_lakitulaps[4]; break;
case 6: localpatch = kp_lakitulaps[5]; break;
case 7: localpatch = kp_lakitulaps[6]; break;
case 8: localpatch = kp_lakitulaps[7]; break;
}
}
else
localpatch = kp_lakitulaps[8];
if (swoopTimer <= numFrames)
adjustY = (finalOffset - 1) - FixedMul((finalOffset), FRACUNIT / (swoopTimer + 3));
else if (swoopTimer >= 48)
{
fixed_t templeveltime = swoopTimer - 47;
adjustY = (finalOffset - 1) - FixedMul((finalOffset), FRACUNIT / (numFrames + 3 - templeveltime));
}
else
adjustY = 200;
V_DrawSmallScaledPatch(LAKI_X+24, STRINGY(LAKI_Y + adjustY), V_SNAPTOTOP, localpatch);
}
void K_drawKartHUD(void)
{
// Define the X and Y for each drawn object
@ -3865,7 +3906,13 @@ void K_drawKartHUD(void)
{
//K_DrawKartTripleItem();
K_drawKartPositionFaces();
K_drawStartLakitu();
if (leveltime < 178)
K_drawStartLakitu();
if (stplyr->kartstuff[k_lapanimation])
K_drawLapLakitu();
}
// Draw the timestamp

View File

@ -4060,6 +4060,7 @@ DoneSection2:
if (player->starpostnum == numstarposts) // Must have touched all the starposts
{
player->laps++;
player->kartstuff[k_lapanimation] = 80;
if (player->pflags & PF_NIGHTSMODE)
player->drillmeter += 48*20;