From 8d19d18200ae66da2518b58a35ad2637131f6cc2 Mon Sep 17 00:00:00 2001 From: ZTsukei Date: Sun, 16 Jul 2017 12:04:33 -0400 Subject: [PATCH] v1.3.17 ------- Lakitu returns from his ironically-not-pillowshaded-cloud grave Dropboosting works on respawn Players respawn "automatically after 2 seconds" instead of "*instantaneously* while accel is held" --- src/d_player.h | 1 + src/doomdef.h | 10 ++-- src/g_game.c | 13 +++-- src/info.c | 32 ++++++++++- src/info.h | 11 +++- src/k_kart.c | 145 +++++++++++++++++++++++++++++++++++++++++++------ src/p_mobj.c | 7 ++- src/p_user.c | 25 +++++---- 8 files changed, 201 insertions(+), 43 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 0be753ac..12061c36 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -241,6 +241,7 @@ typedef enum k_nextcheck, // Next checkpoint distance; for p_user.c (was "pw_ncd") k_waypoint, // Waypoints. k_starpostwp, // Temporarily stores player waypoint for... some reason. Used when respawning and finishing. + k_lakitu, // Timer for Lakitu to carry and drop the player 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 diff --git a/src/doomdef.h b/src/doomdef.h index ff3cbbcd..0fdce69e 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -143,16 +143,16 @@ extern FILE *logstream; #define DEVELOP // Disable this for release builds to remove excessive cheat commands and enable MD5 checking and stuff, all in one go. :3 #ifdef DEVELOP #define VERSION 103 // Game version -#define SUBVERSION 16 // more precise version number +#define SUBVERSION 17 // more precise version number #define VERSIONSTRING "Development EXE" -#define VERSIONSTRINGW "v1.3.16" +#define VERSIONSTRINGW "v1.3.17" // most interface strings are ignored in development mode. // we use comprevision and compbranch instead. #else #define VERSION 103 // Game version -#define SUBVERSION 16 // more precise version number -#define VERSIONSTRING "DevEXE v1.3.16" -#define VERSIONSTRINGW L"v1.3.16" +#define SUBVERSION 17 // more precise version number +#define VERSIONSTRING "DevEXE v1.3.17" +#define VERSIONSTRINGW L"v1.3.17" // Hey! If you change this, add 1 to the MODVERSION below! // Otherwise we can't force updates! #endif diff --git a/src/g_game.c b/src/g_game.c index dc563c68..33b8e2a2 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2194,8 +2194,8 @@ void G_PlayerReborn(INT32 player) SINT8 pity; // SRB2kart - //INT32 starpostwp; - //INT32 offroad; + INT32 starpostwp; + INT32 offroad; score = players[player].score; lives = players[player].lives; @@ -2248,8 +2248,8 @@ void G_PlayerReborn(INT32 player) pity = players[player].pity; // SRB2kart - //starpostwp = players[player].kartstuff[k_starpostwp]; - //offroad = players[player].kartstuff[k_offroad]; + starpostwp = players[player].kartstuff[k_starpostwp]; + offroad = players[player].kartstuff[k_offroad]; p = &players[player]; memset(p, 0, sizeof (*p)); @@ -2303,8 +2303,8 @@ void G_PlayerReborn(INT32 player) p->pity = pity; // SRB2kart - //p->kartstuff[k_starpostwp] = starpostwp; - //p->kartstuff[k_offroad] = offroad; + p->kartstuff[k_starpostwp] = starpostwp; + p->kartstuff[k_offroad] = offroad; // Don't do anything immediately p->pflags |= PF_USEDOWN; @@ -2332,6 +2332,7 @@ void G_PlayerReborn(INT32 player) S_ChangeMusic(mapmusname, mapmusflags, true); if (p->laps == (unsigned)(cv_numlaps.value - 1)) S_SpeedMusic(1.2f); + p->kartstuff[k_lakitu] = 64; // Lakitu Spawner } } diff --git a/src/info.c b/src/info.c index 7aa6c42d..c070137e 100644 --- a/src/info.c +++ b/src/info.c @@ -57,7 +57,7 @@ char sprnames[NUMSPRITES + 1][5] = //SRB2kart Sprites "SPRG","BSPR","RNDM","RPOP","KFRE","DRIF","DSMO","FITM","DFAK","BANA", "DBAN","GSHE","GSTR","DGSH","RSHE","RSTR","DRSH","BOMB","BLIG","LIGH", - "SINK","SITR","POKE" + "SINK","SITR","LAKI","POKE" }; // Doesn't work with g++, needs actionf_p1 (don't modify this comment) @@ -2717,6 +2717,9 @@ state_t states[NUMSTATES] = {SPR_SITR, 1, 5, {NULL}, 0, 0, S_SINKTRAIL3}, // S_SINKTRAIL2 {SPR_SITR, 2, 3, {NULL}, 0, 0, S_NULL}, // S_SINKTRAIL3 + {SPR_LAKI, 0, 64, {NULL}, 1, 0, S_LAKITU2}, // S_LAKITU1 + {SPR_LAKI, 1, 35, {NULL}, 0, 0, S_NULL}, // S_LAKITU2 + {SPR_POKE, 0, 2, {A_MoveAbsolute}, 0, 2, S_POKEY2}, // S_POKEY1 {SPR_POKE, 1, 2, {A_MoveAbsolute}, 0, 2, S_POKEY3}, // S_POKEY2 {SPR_POKE, 2, 2, {A_MoveAbsolute}, 0, 2, S_POKEY4}, // S_POKEY3 @@ -15009,6 +15012,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, + { // MT_LAKITU + -1, // doomednum + S_LAKITU1, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 8, // speed + 64*FRACUNIT, // radius + 57*FRACUNIT, // height + 0, // display offset + 16, // mass + 0, // damage + sfx_None, // activesound + MF_NOGRAVITY, // flags + S_NULL // raisestate + }, + { // MT_POKEY 2100, // doomednum S_POKEY1, // spawnstate diff --git a/src/info.h b/src/info.h index 3caf51df..bb34a1a7 100644 --- a/src/info.h +++ b/src/info.h @@ -601,8 +601,10 @@ typedef enum sprite SPR_SINK, // Kitchen Sink SPR_SITR, // Kitchen Sink Trail + SPR_LAKI, // Lakitu + // Additional Kart Objects - SPR_POKE, // Lightning + SPR_POKE, // Pokey SPR_FIRSTFREESLOT, SPR_LASTFREESLOT = SPR_FIRSTFREESLOT + NUMSPRITEFREESLOTS - 1, @@ -3210,6 +3212,10 @@ typedef enum state S_SINKTRAIL2, S_SINKTRAIL3, + // Lakitu + S_LAKITU1, + S_LAKITU2, + // Pokey S_POKEY1, S_POKEY2, @@ -3796,7 +3802,10 @@ typedef enum mobj_type MT_SINK, // Kitchen Sink Stuff MT_SINKTRAIL, + MT_LAKITU, + MT_POKEY, // Huh, thought this was a default asset for some reason, guess not. + MT_ENEMYFLIP, MT_WAYPOINT, diff --git a/src/k_kart.c b/src/k_kart.c index 861989b0..0202e070 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1230,6 +1230,73 @@ static void K_UpdateOffroad(player_t *player) player->kartstuff[k_offroad] = 0; } +/** \brief Calculates the lakitu timer and drop-boosting + + \param player player object passed from K_KartPlayerThink + + \return void +*/ +void K_LakituChecker(player_t *player) +{ + ticcmd_t *cmd = &player->cmd; + + if (player->kartstuff[k_lakitu] == 60) + { + mobj_t *mo; + angle_t newangle; + fixed_t newx; + fixed_t newy; + fixed_t newz; + newangle = player->mo->angle; + newx = player->mo->x + P_ReturnThrustX(player->mo, newangle, 0); + newy = player->mo->y + P_ReturnThrustY(player->mo, newangle, 0); + if (player->mo->eflags & MFE_VERTICALFLIP) + newz = player->mo->z - 128*FRACUNIT; + else + newz = player->mo->z + 64*FRACUNIT; + mo = P_SpawnMobj(newx, newy, newz, MT_LAKITU); + if (mo) + { + if (player->mo->eflags & MFE_VERTICALFLIP) + mo->eflags |= MFE_VERTICALFLIP; + mo->angle = newangle+ANGLE_180; + P_SetTarget(&mo->target, player->mo); + } + } + + if (player->kartstuff[k_lakitu] > 3) + { + player->kartstuff[k_lakitu]--; + player->mo->momz = 0; + player->powers[pw_flashing] = 2; + player->powers[pw_nocontrol] = 2; + if (leveltime % 15 == 0) + S_StartSound(player->mo, sfx_lkt3); + } + // That's enough pointless fishing for now. + if (player->kartstuff[k_lakitu] > 0 && player->kartstuff[k_lakitu] <= 3) + { + if (!P_IsObjectOnGround(player->mo)) + { + player->powers[pw_flashing] = 2; + // If you tried to boost while in the air, + // you lose your chance of boosting at all. + if (cmd->buttons & BT_ACCELERATE) + { + player->powers[pw_flashing] = 0; + player->kartstuff[k_lakitu] = 0; + } + } + else + { + player->kartstuff[k_lakitu]--; + // Quick! You only have three tics to boost! + if (cmd->buttons & BT_ACCELERATE) + K_DoMushroom(player, true); + } + } +} + /** \brief Decreases various kart timers and powers per frame. Called in P_PlayerThink in p_user.c \param player player object passed from P_PlayerThink @@ -1318,6 +1385,10 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) else player->kartstuff[k_jmp] = 0; + // Lakitu Checker + if (player->kartstuff[k_lakitu]) + K_LakituChecker(player); + // Roulette Code //K_KartItemRouletteByPosition(player, cmd); // Old, position-based K_KartItemRouletteByDistance(player, cmd); // New, distance-based @@ -3027,7 +3098,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_lakitulaps[17]; static patch_t *kp_positionnum[NUMPOSNUMS][NUMPOSFRAMES]; static patch_t *kp_facenull; static patch_t *kp_facefirst; @@ -3139,6 +3210,14 @@ void K_LoadKartHUDGraphics(void) 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); + kp_lakitulaps[9] = W_CachePatchName("K_LAKIF1", PU_HUDGFX); + kp_lakitulaps[10] = W_CachePatchName("K_LAKIF2", PU_HUDGFX); + kp_lakitulaps[11] = W_CachePatchName("K_LAKIF3", PU_HUDGFX); + kp_lakitulaps[12] = W_CachePatchName("K_LAKIF4", PU_HUDGFX); + kp_lakitulaps[13] = W_CachePatchName("K_LAKIF5", PU_HUDGFX); + kp_lakitulaps[14] = W_CachePatchName("K_LAKIF6", PU_HUDGFX); + kp_lakitulaps[15] = W_CachePatchName("K_LAKIF7", PU_HUDGFX); + kp_lakitulaps[16] = W_CachePatchName("K_LAKIF8", PU_HUDGFX); // Position numbers for (i = 0; i < NUMPOSNUMS; i++) @@ -3848,6 +3927,7 @@ static void K_drawLapLakitu(void) 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) + boolean finishLine = false; if (stplyr->laps < (UINT8)(cv_numlaps.value - 1)) { @@ -3863,8 +3943,33 @@ static void K_drawLapLakitu(void) case 8: localpatch = kp_lakitulaps[7]; break; } } - else + else if (stplyr->laps == (UINT8)(cv_numlaps.value - 1)) localpatch = kp_lakitulaps[8]; + else + { + // Change flag frame every 4 frames + switch (leveltime % 32) + { + case 0: case 1: case 2: case 3: + localpatch = kp_lakitulaps[9]; break; + case 4: case 5: case 6: case 7: + localpatch = kp_lakitulaps[10]; break; + case 8: case 9: case 10: case 11: + localpatch = kp_lakitulaps[11]; break; + case 12: case 13: case 14: case 15: + localpatch = kp_lakitulaps[12]; break; + case 16: case 17: case 18: case 19: + localpatch = kp_lakitulaps[13]; break; + case 20: case 21: case 22: case 23: + localpatch = kp_lakitulaps[14]; break; + case 24: case 25: case 26: case 27: + localpatch = kp_lakitulaps[15]; break; + case 28: case 29: case 30: case 31: + localpatch = kp_lakitulaps[16]; break; + } + finishLine = true; + finalOffset = 226; + } if (swoopTimer <= numFrames) adjustY = (finalOffset - 1) - FixedMul((finalOffset), FRACUNIT / (swoopTimer + 3)); @@ -3874,9 +3979,14 @@ static void K_drawLapLakitu(void) adjustY = (finalOffset - 1) - FixedMul((finalOffset), FRACUNIT / (numFrames + 3 - templeveltime)); } else - adjustY = 200; + { + if (finishLine) + adjustY = 220; + else + adjustY = 200; + } - V_DrawSmallScaledPatch(LAKI_X+24, STRINGY(LAKI_Y + adjustY), V_SNAPTOTOP, localpatch); + V_DrawSmallScaledPatch(LAKI_X+14+(swoopTimer/4), STRINGY(LAKI_Y + adjustY), V_SNAPTOTOP, localpatch); } void K_drawKartHUD(void) @@ -3885,6 +3995,18 @@ void K_drawKartHUD(void) // This is handled by console/menu values K_initKartHUD(); + // Draw Lakitu + // This is done first so that regardless of HUD layers, + // he'll appear to be in the 'real world' + if (!splitscreen) + { + if (leveltime < 178) + K_drawStartLakitu(); + + if (stplyr->kartstuff[k_lapanimation]) + K_drawLapLakitu(); + } + // If the item window is closing, draw it closing! if (stplyr->kartstuff[k_itemclose]) K_drawKartItemClose(); @@ -3901,18 +4023,10 @@ void K_drawKartHUD(void) // If not splitscreen, draw... // The little triple-item icons at the bottom // The top-four faces on the left - // Lakitu! if (!splitscreen) { //K_DrawKartTripleItem(); K_drawKartPositionFaces(); - - if (leveltime < 178) - K_drawStartLakitu(); - - if (stplyr->kartstuff[k_lapanimation]) - K_drawLapLakitu(); - } // Draw the timestamp @@ -3928,12 +4042,9 @@ void K_drawKartHUD(void) // Draw the numerical position K_DrawKartPositionNum(stplyr->kartstuff[k_position]); + // Draw the speedometer + // TODO: Make a better speedometer. K_drawKartSpeedometer(); } //} - - - - - diff --git a/src/p_mobj.c b/src/p_mobj.c index 28800412..497633a5 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -9002,12 +9002,16 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing) z = ceiling - mobjinfo[MT_PLAYER].height; if (mthing->options >> ZSHIFT) z -= ((mthing->options >> ZSHIFT) << FRACBITS); + if (p->kartstuff[k_lakitu]) + z -= 128*FRACUNIT; } else { z = floor; if (mthing->options >> ZSHIFT) z += ((mthing->options >> ZSHIFT) << FRACBITS); + if (p->kartstuff[k_lakitu]) + z += 128*FRACUNIT; } if (mthing->options & MTF_OBJECTFLIP) // flip the player! @@ -9068,8 +9072,7 @@ void P_MovePlayerToStarpost(INT32 playernum) #endif sector->ceilingheight; - - z = p->starpostz << FRACBITS; + z = (p->starpostz + 128) << FRACBITS; // Lakitu spawns you off the ground if (z < floor) z = floor; else if (z > ceiling - mobjinfo[MT_PLAYER].height) diff --git a/src/p_user.c b/src/p_user.c index eb66ecc9..ff690476 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -7898,7 +7898,6 @@ void P_FindEmerald(void) // Fall on your face when dying. // Decrease POV height to floor height. // - static void P_DeathThink(player_t *player) { ticcmd_t *cmd = &player->cmd; @@ -7919,19 +7918,23 @@ static void P_DeathThink(player_t *player) // Force respawn if idle for more than 30 seconds in shooter modes. if (player->deadtimer > 30*TICRATE && !G_PlatformGametype()) player->playerstate = PST_REBORN; - else if (player->lives > 0 && !G_IsSpecialStage(gamemap)) // Don't allow "click to respawn" in special stages! + else if (player->lives > 0 && !G_IsSpecialStage(gamemap) && leveltime >= 140) // Don't allow "click to respawn" in special stages! { - // Respawn with jump button, force respawn time (3 second default, cheat protected) in shooter modes. - if ((cmd->buttons & BT_JUMP || cmd->buttons & BT_ACCELERATE) && player->deadtimer > cv_respawntime.value*TICRATE - && gametype != GT_RACE && gametype != GT_COOP) + // SRB2kart + if (player->spectator) + { + CONS_Printf("%s entered the game.\n", player_names[player-players]); + player->spectator = false; + } + //player->kartstuff[k_lakitu] = 64; // See G_PlayerReborn in g_game.c + + // SRB2kart - spawn automatically after 2 seconds + if (player->deadtimer > 2*TICRATE && (gametype == GT_RACE || player->spectator)) player->playerstate = PST_REBORN; - // Instant respawn in race or if you're spectating. - if ((cmd->buttons & BT_JUMP || cmd->buttons & BT_ACCELERATE) && (gametype == GT_RACE || player->spectator)) - player->playerstate = PST_REBORN; - - // One second respawn in coop. // SRB2kart - Race maybe? - if ((cmd->buttons & BT_JUMP || cmd->buttons & BT_ACCELERATE) && player->deadtimer > TICRATE && gametype == GT_RACE)//(gametype == GT_COOP || gametype == GT_COMPETITION)) + // SRB2kart - spawn after 2 seconds & Button press + if ((cmd->buttons & BT_JUMP || cmd->buttons & BT_ACCELERATE) && player->deadtimer > 2*TICRATE + && (gametype == GT_RACE || player->spectator)) player->playerstate = PST_REBORN; // Single player auto respawn