diff --git a/cmake/Comptime.cmake b/cmake/Comptime.cmake index 5b1156627..dc709c248 100644 --- a/cmake/Comptime.cmake +++ b/cmake/Comptime.cmake @@ -15,3 +15,4 @@ git_latest_commit(SRB2_COMP_REVISION) git_subject(SRB2_COMP_LASTCOMMIT) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in" "${CMAKE_CURRENT_SOURCE_DIR}/src/config.h") +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in" "${CMAKE_CURRENT_SOURCE_DIR}/build/src/config.h") diff --git a/src/Sourcefile b/src/Sourcefile index c1e29e119..07b28d815 100644 --- a/src/Sourcefile +++ b/src/Sourcefile @@ -103,7 +103,6 @@ k_kart.c k_respawn.c k_collide.c k_color.c -k_race.c k_battle.c k_pwrlv.c k_waypoint.c diff --git a/src/config.h b/src/config.h index 95777cdca..4f73ffe75 100644 --- a/src/config.h +++ b/src/config.h @@ -20,7 +20,7 @@ #define ASSET_HASH_PATCH_PK3 "" #endif -#define SRB2_COMP_REVISION "209e81c9b" +#define SRB2_COMP_REVISION "80f496667" #define SRB2_COMP_BRANCH "v2dev3" // This is done with configure_file instead of defines in order to avoid // recompiling the whole target whenever the working directory state changes @@ -29,7 +29,7 @@ #define COMPVERSION_UNCOMMITTED #endif -#define SRB2_COMP_LASTCOMMIT "Add support to cmake for uncommited changes text and clean up git utils" +#define SRB2_COMP_LASTCOMMIT "Add support to cmake for showing commit info" #define CMAKE_ASSETS_DIR "/home/maple/build/blankart/assets" diff --git a/src/d_player.h b/src/d_player.h index bf878b60f..0cd3530a7 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -72,7 +72,7 @@ typedef enum PF_WANTSTOJOIN = 1<<7, // Spectator that wants to join PF_STASIS = 1<<8, // Player is not allowed to move - PF_FAULT = 1<<9, // F A U L T + PF_SKIDDOWN = 1<<9, // SKIDDOWN PF_ELIMINATED = 1<<10, // Battle-style elimination, no extra penalty PF_NOCONTEST = 1<<11, // Did not finish (last place explosion) PF_LOSTLIFE = 1<<12, // Do not lose life more than once @@ -234,9 +234,6 @@ typedef enum khud_lapanimation, // Used to show the lap start wing logo animation khud_laphand, // Lap hand gfx to use; 0 = none, 1 = :ok_hand:, 2 = :thumbs_up:, 3 = :thumps_down: - // Start - khud_fault, // Set when faulting during the starting countdown - // Camera khud_boostcam, // Camera push forward on boost khud_destboostcam, // Ditto @@ -491,6 +488,8 @@ typedef struct player_s UINT8 numsneakers; // Number of stacked sneaker effects UINT8 floorboost; // (0 to 3) - Prevents Sneaker sounds for a brief duration when triggered by a floor panel + UINT8 boostcharge; // Charge during race start + INT16 growshrinktimer; // > 0 = Big, < 0 = small INT16 growcancel; // Duration of grow canceling UINT16 rocketsneakertimer; // Rocket Sneaker duration timer diff --git a/src/doomstat.h b/src/doomstat.h index 5e0fc7503..b78de7169 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -647,9 +647,6 @@ extern UINT16 nightslinktics; extern tic_t introtime; extern tic_t starttime; -extern const tic_t bulbtime; -extern UINT8 numbulbs; - extern tic_t raceexittime; extern tic_t battleexittime; @@ -713,7 +710,6 @@ extern tic_t mapreset; extern boolean thwompsactive; extern UINT8 lastLowestLap; extern SINT8 spbplace; -extern boolean rainbowstartavailable; extern tic_t bombflashtimer; // Used to avoid causing seizures if multiple mines explode close to you :) extern boolean legitimateexit; diff --git a/src/g_game.c b/src/g_game.c index 7c0566f9d..13e9396e1 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -254,9 +254,6 @@ UINT8 ammoremovaltics = 2*TICRATE; tic_t introtime = 3; tic_t starttime = 3; -const tic_t bulbtime = TICRATE/2; -UINT8 numbulbs = 1; - tic_t raceexittime = 5*TICRATE + (2*TICRATE/3); tic_t battleexittime = 8*TICRATE; @@ -323,7 +320,6 @@ tic_t mapreset; // Map reset delay when enough players have joined an empty game boolean thwompsactive; // Thwomps activate on lap 2 UINT8 lastLowestLap; // Last lowest lap, for activating race lap executors SINT8 spbplace; // SPB exists, give the person behind better items -boolean rainbowstartavailable; // Boolean, keeps track of if the rainbow start was gotten // Client-sided, unsynched variables (NEVER use in anything that needs to be synced with other players) tic_t bombflashtimer = 0; // Cooldown before another FlashPal can be intialized by a bomb exploding near a displayplayer. Avoids seizures. @@ -1338,16 +1334,6 @@ void G_StartTitleCard(void) // prepare status bar ST_startTitleCard(); - // play the sound - { - sfxenum_t kstart = sfx_kstart; - if (bossinfo.boss) - kstart = sfx_ssa021; - else if (encoremode) - kstart = sfx_ruby2; - S_StartSound(NULL, kstart); - } - // start the title card WipeStageTitle = (!titlemapinaction); } @@ -2264,8 +2250,7 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps) rings = players[player].rings; spheres = players[player].spheres; kickstartaccel = players[player].kickstartaccel; - - khudfault = players[player].karthud[khud_fault]; + nocontrol = players[player].nocontrol; laps = players[player].laps; @@ -2283,7 +2268,7 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps) follower = players[player].follower; - pflags |= (players[player].pflags & (PF_STASIS|PF_ELIMINATED|PF_NOCONTEST|PF_FAULT|PF_LOSTLIFE)); + pflags |= (players[player].pflags & (PF_STASIS|PF_ELIMINATED|PF_NOCONTEST|PF_LOSTLIFE)); } // As long as we're not in multiplayer, carry over cheatcodes from map to map @@ -2349,7 +2334,6 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps) p->overtimekarma = 0; p->eggmanblame = -1; p->lastdraft = -1; - p->karthud[khud_fault] = khudfault; p->nocontrol = nocontrol; p->kickstartaccel = kickstartaccel; diff --git a/src/k_bot.c b/src/k_bot.c index 7bf85a945..67fd92f66 100644 --- a/src/k_bot.c +++ b/src/k_bot.c @@ -26,7 +26,6 @@ #include "d_ticcmd.h" #include "m_random.h" #include "r_things.h" // numskins -#include "k_race.h" // finishBeamLine #include "k_boss.h" #include "m_perfstats.h" @@ -1307,98 +1306,14 @@ void K_BuildBotTiccmd(player_t *player, ticcmd_t *cmd) predict->y = player->mo->y + FixedMul(dist, FINESINE(destangle >> ANGLETOFINESHIFT)); predict->radius = (DEFAULT_WAYPOINT_RADIUS / 4) * mapobjectscale; } - - if (leveltime <= starttime && finishBeamLine != NULL) + if (leveltime <= starttime) { - // Handle POSITION!! - const fixed_t distBase = 384*mapobjectscale; - const fixed_t distAdjust = 64*mapobjectscale; - - const fixed_t closeDist = distBase + (distAdjust * (9 - player->kartweight)); - const fixed_t farDist = closeDist + (distAdjust * 2); - - const tic_t futureSight = (TICRATE >> 1); - - fixed_t distToFinish = K_DistanceOfLineFromPoint( - finishBeamLine->v1->x, finishBeamLine->v1->y, - finishBeamLine->v2->x, finishBeamLine->v2->y, - player->mo->x, player->mo->y - ) - (K_BotSpeedScaled(player, player->speed) * futureSight); - - // Don't run the spindash code at all until we're in the right place trySpindash = false; - if (distToFinish < closeDist) + if (leveltime >= starttime-TICRATE-TICRATE/7) { - // We're too close, we need to start backing up. - turnamt = K_HandleBotReverse(player, cmd, predict, destangle); - } - else if (distToFinish < farDist) - { - INT32 bullyTurn = INT32_MAX; - - // We're in about the right place, let's do whatever we want to. - - if (player->kartspeed >= 5) - { - // Faster characters want to spindash. - // Slower characters will use their momentum. - trySpindash = true; - } - - // Look for characters to bully. - bullyTurn = K_PositionBully(player); - if (bullyTurn == INT32_MAX) - { - // No one to bully, just go for a spindash as anyone. - if (predict == NULL) - { - // Create a prediction. - if (player->nextwaypoint != NULL - && player->nextwaypoint->mobj != NULL - && !P_MobjWasRemoved(player->nextwaypoint->mobj)) - { - predict = K_CreateBotPrediction(player); - K_NudgePredictionTowardsObjects(predict, player); - destangle = R_PointToAngle2(player->mo->x, player->mo->y, predict->x, predict->y); - } - } - - turnamt = K_HandleBotTrack(player, cmd, predict, destangle); - cmd->buttons &= ~(BT_ACCELERATE|BT_BRAKE); - cmd->forwardmove = 0; - trySpindash = true; - } - else - { - turnamt = bullyTurn; - - // If already spindashing, wait until we get a relatively OK charge first. - if (player->spindash == 0 || player->spindash > TICRATE) - { - trySpindash = false; - cmd->buttons |= BT_ACCELERATE; - cmd->forwardmove = MAXPLMOVE; - } - } - } - else - { - // Too far away, we need to just drive up. - if (predict == NULL) - { - // Create a prediction. - if (player->nextwaypoint != NULL - && player->nextwaypoint->mobj != NULL - && !P_MobjWasRemoved(player->nextwaypoint->mobj)) - { - predict = K_CreateBotPrediction(player); - K_NudgePredictionTowardsObjects(predict, player); - destangle = R_PointToAngle2(player->mo->x, player->mo->y, predict->x, predict->y); - } - } - - turnamt = K_HandleBotTrack(player, cmd, predict, destangle); + cmd->buttons |= BT_ACCELERATE; + cmd->forwardmove = MAXPLMOVE; } } else diff --git a/src/k_hud.c b/src/k_hud.c index 8ae29870f..c08af1359 100644 --- a/src/k_hud.c +++ b/src/k_hud.c @@ -198,40 +198,6 @@ void K_LoadKartHUDGraphics(void) HU_UpdatePatch(&kp_splitkarmabomb, "K_SPTKRM"); HU_UpdatePatch(&kp_timeoutsticker, "K_STTOUT"); - // 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); - HU_UpdatePatch(&kp_prestartbulb[i], "%s", buffer); - } - - sprintf(buffer, "K_SBLBxx"); - for (i = 0; i < 15; i++) - { - buffer[6] = '0'+((i+1)/10); - buffer[7] = '0'+((i+1)%10); - HU_UpdatePatch(&kp_prestartbulb_split[i], "%s", buffer); - } - - // Pre-start position letters - HU_UpdatePatch(&kp_prestartletters[0], "K_PL_P"); - HU_UpdatePatch(&kp_prestartletters[1], "K_PL_O"); - HU_UpdatePatch(&kp_prestartletters[2], "K_PL_S"); - HU_UpdatePatch(&kp_prestartletters[3], "K_PL_I"); - HU_UpdatePatch(&kp_prestartletters[4], "K_PL_T"); - HU_UpdatePatch(&kp_prestartletters[5], "K_PL_N"); - HU_UpdatePatch(&kp_prestartletters[6], "K_PL_EX"); - - HU_UpdatePatch(&kp_prestartletters_split[0], "K_SPL_P"); - HU_UpdatePatch(&kp_prestartletters_split[1], "K_SPL_O"); - HU_UpdatePatch(&kp_prestartletters_split[2], "K_SPL_S"); - HU_UpdatePatch(&kp_prestartletters_split[3], "K_SPL_I"); - HU_UpdatePatch(&kp_prestartletters_split[4], "K_SPL_T"); - HU_UpdatePatch(&kp_prestartletters_split[5], "K_SPL_N"); - HU_UpdatePatch(&kp_prestartletters_split[6], "K_SPL_EX"); - // Starting countdown HU_UpdatePatch(&kp_startcountdown[0], "K_CNT3A"); HU_UpdatePatch(&kp_startcountdown[1], "K_CNT2A"); @@ -255,16 +221,6 @@ void K_LoadKartHUDGraphics(void) HU_UpdatePatch(&kp_startcountdown[18], "K_SMCGOB"); HU_UpdatePatch(&kp_startcountdown[19], "K_SDUEL2"); - // Fault - HU_UpdatePatch(&kp_racefault[0], "K_FAULTA"); - HU_UpdatePatch(&kp_racefault[1], "K_FAULTB"); - // Splitscreen - HU_UpdatePatch(&kp_racefault[2], "K_SMFLTA"); - HU_UpdatePatch(&kp_racefault[3], "K_SMFLTB"); - // 2P splitscreen - HU_UpdatePatch(&kp_racefault[4], "K_2PFLTA"); - HU_UpdatePatch(&kp_racefault[5], "K_2PFLTB"); - // Finish HU_UpdatePatch(&kp_racefinish[0], "K_FINA"); HU_UpdatePatch(&kp_racefinish[1], "K_FINB"); @@ -3682,206 +3638,11 @@ 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; - fixed_t starty = 48*FRACUNIT; - fixed_t x, y; - - UINT8 numperrow = numbulbs/2; - UINT8 i; - - if (r_splitscreen >= 1) - { - spacing /= 2; - starty /= 3; - - if (r_splitscreen > 1) - { - startx /= 2; - } - } - - startx += (spacing/2); - - if (numbulbs <= 10) - { - // No second row - numperrow = numbulbs; - } - else - { - if (numbulbs & 1) - { - numperrow++; - } - - starty -= (spacing/2); - } - - startx -= (spacing/2) * numperrow; - - x = startx; - y = starty; - - 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|V_SPLITSCREEN, - (r_splitscreen ? kp_prestartbulb_split[patchnum] : kp_prestartbulb[patchnum]), NULL); - x += spacing; - } - - x = 70*FRACUNIT; - y = starty; - - if (r_splitscreen == 1) - { - x = 106*FRACUNIT; - } - else if (r_splitscreen > 1) - { - x = 28*FRACUNIT; - } - - if (timeinmap < 16) - return; // temporary for current map start behaviour - - for (i = 0; i < 10; i++) - { - UINT8 patchnum = letters_order[i]; - INT32 transflag = letters_transparency[(leveltime - i) % 40]; - patch_t *patch = (r_splitscreen ? kp_prestartletters_split[patchnum] : kp_prestartletters[patchnum]); - - if (transflag >= 10) - ; - else - { - if (transflag != 0) - transflag = transflag << FF_TRANSSHIFT; - - V_DrawFixedPatch(x, y, FRACUNIT, V_SNAPTOTOP|V_SPLITSCREEN|transflag, patch, NULL); - } - - if (i < 9) - { - x += (SHORT(patch->width)) * FRACUNIT/2; - - patchnum = letters_order[i+1]; - patch = (r_splitscreen ? kp_prestartletters_split[patchnum] : kp_prestartletters[patchnum]); - x += (SHORT(patch->width)) * FRACUNIT/2; - - if (r_splitscreen) - x -= FRACUNIT; - } - } -} - static void K_drawKartStartCountdown(void) { INT32 pnum = 0; - if (stplyr->karthud[khud_fault] != 0) - { - INT32 x, xval; - - if (r_splitscreen > 1) // 3/4p, stationary FIN - { - pnum += 2; - } - else if (r_splitscreen == 1) // wide splitscreen - { - pnum += 4; - } - - if ((leveltime % (2*5)) / 5) // blink - pnum += 1; - - if (r_splitscreen == 0) - { - x = ((vid.width<width)<karthud[khud_fault])*(xval > x ? xval : x))/TICRATE; - - V_DrawFixedPatch(x + (STCD_X<>1), - (STCD_Y<height)<<(FRACBITS-1)), - FRACUNIT, - V_SPLITSCREEN, kp_racefault[pnum], NULL); - } - else - { - V_DrawScaledPatch(STCD_X - (SHORT(kp_racefault[pnum]->width)/2), STCD_Y - (SHORT(kp_racefault[pnum]->height)/2), V_SPLITSCREEN, kp_racefault[pnum]); - } - } - else if (leveltime >= introtime && leveltime < starttime-(3*TICRATE)) - { - if (bossinfo.boss == false) - K_drawKartStartBulbs(); - } - else + if (leveltime > starttime-(3*TICRATE)) { if (leveltime >= starttime-(2*TICRATE)) // 2 diff --git a/src/k_kart.c b/src/k_kart.c index 27bd33257..1cc08895e 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -5,6 +5,7 @@ /// All of the SRB2kart-unique stuff. #include "k_kart.h" +#include "d_player.h" #include "k_battle.h" #include "k_boss.h" #include "k_pwrlv.h" @@ -49,16 +50,12 @@ // indirectitemcooldown is timer before anyone's allowed another Shrink/SPB // mapreset is set when enough players fill an empty server -void K_TimerReset(void) -{ - starttime = introtime = 3; - numbulbs = 1; -} - void K_TimerInit(void) { UINT8 i; UINT8 numPlayers = 0;//, numspec = 0; + + starttime = introtime = 0; if (!bossinfo.boss) { @@ -78,35 +75,17 @@ void K_TimerInit(void) numPlayers++; } - if (numPlayers >= 2) - { - rainbowstartavailable = true; - } - else - { - rainbowstartavailable = false; - } - // No intro in Record Attack / 1v1 - // Leave unset for the value in K_TimerReset if (numPlayers > 2) { introtime = (108) + 5; // 108 for rotation, + 5 for white fade } - numbulbs = 5; - - if (numPlayers > 2) - { - numbulbs += (numPlayers-2); - } - - starttime = (introtime + (3*TICRATE)) + ((2*TICRATE) + (numbulbs * bulbtime)); // Start countdown time, + buffer time + starttime = 6*TICRATE + (3*TICRATE/4); } // NOW you can try to spawn in the Battle capsules, if there's not enough players for a match K_BattleInit(); - //CONS_Printf("numbulbs set to %d (%d players, %d spectators) on tic %d\n", numbulbs, numPlayers, numspec, leveltime); } UINT32 K_GetPlayerDontDrawFlag(player_t *player) @@ -4648,7 +4627,7 @@ void K_DriftDustHandling(mobj_t *spawner) if (spawner->player) { - if (spawner->player->pflags & PF_FAULT) + if (spawner->player->pflags & PF_SKIDDOWN) { anglediff = abs((signed)(spawner->angle - spawner->player->drawangle)); if (leveltime % 6 == 0) @@ -6768,11 +6747,6 @@ void K_KartPlayerHUDUpdate(player_t *player) if (player->karthud[khud_trickcool]) player->karthud[khud_trickcool]--; - if (!(player->pflags & PF_FAULT)) - player->karthud[khud_fault] = 0; - else if (player->karthud[khud_fault] > 0 && player->karthud[khud_fault] < 2*TICRATE) - player->karthud[khud_fault]++; - if (player->karthud[khud_itemblink] && player->karthud[khud_itemblink]-- <= 0) { player->karthud[khud_itemblinkmode] = 0; @@ -7024,6 +6998,84 @@ static void K_UpdateTripwire(player_t *player) } } +static void K_RaceStart(player_t *player) +{ + + if (leveltime <= starttime) + player->nocontrol = 1; + + // Start charging once you're given the opportunity. + if (leveltime >= starttime-(2*TICRATE) && leveltime <= starttime) + { + if (player->cmd.buttons & BT_ACCELERATE) + { + if (player->boostcharge == 0) + player->boostcharge = player->cmd.latency; + + player->boostcharge++; + } + else + player->boostcharge = 0; + } + + // Increase your size while charging your engine. + if (leveltime < starttime+10) + { + player->mo->scalespeed = mapobjectscale/12; + player->mo->destscale = mapobjectscale + (FixedMul(mapobjectscale, player->boostcharge*131)); + if ((player->pflags & PF_SHRINKME) && !modeattacking && !player->bot) + player->mo->destscale = (6*player->mo->destscale)/8; + } + + // Determine the outcome of your charge. + if (leveltime > starttime && player->boostcharge) + { + // Not even trying? + if (player->boostcharge < 35) + { + if (player->boostcharge > 17) + S_StartSound(player->mo, sfx_cdfm00); // chosen instead of a conventional skid because it's more engine-like + } + // Get an instant boost! + else if (player->boostcharge <= 50) + { + player->startboost = (50-player->boostcharge)+20; + + if (player->boostcharge <= 36) + { + player->startboost = 0; + K_DoSneaker(player, 0); + player->sneakertimer = 70; // PERFECT BOOST!! + + if (!player->floorboost || player->floorboost == 3) // Let everyone hear this one + S_StartSound(player->mo, sfx_s25f); + } + else + { + K_SpawnDashDustRelease(player); // already handled for perfect boosts by K_DoSneaker + if ((!player->floorboost || player->floorboost == 3) && P_IsLocalPlayer(player)) + { + if (player->boostcharge <= 40) + S_StartSound(player->mo, sfx_cdfm01); // You were almost there! + else + S_StartSound(player->mo, sfx_s23c); // Nope, better luck next time. + } + } + } + // You overcharged your engine? Those things are expensive!!! + else if (player->boostcharge > 50) + { + player->nocontrol = 40; + //S_StartSound(player->mo, sfx_kc34); + S_StartSound(player->mo, sfx_s3k83); + player->pflags |= PF_SKIDDOWN; // cheeky pflag reuse + } + + player->boostcharge = 0; + } + +} + /** \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 @@ -7501,6 +7553,8 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) } K_HandleDelayedHitByEm(player); + + K_RaceStart(player); } void K_KartResetPlayerColor(player_t *player) @@ -8155,6 +8209,12 @@ INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue) // No turning during the intro return 0; } + + if (leveltime <= starttime) + { + // No turning during Race Start + return 0; + } if (player->respawn.state == RESPAWNST_MOVE) { @@ -8218,36 +8278,12 @@ INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue) turnfixed = FixedMul(turnfixed, FRACUNIT + player->handleboost); } - if ((player->mo->eflags & MFE_UNDERWATER) && - player->speed > 11 * player->mo->scale) - { - turnfixed /= 2; - } - // Weight has a small effect on turning turnfixed = FixedMul(turnfixed, weightadjust); return (turnfixed / FRACUNIT); } -INT32 K_GetUnderwaterTurnAdjust(player_t *player) -{ - if ((player->mo->eflags & MFE_UNDERWATER) && - player->speed > 11 * player->mo->scale) - { - INT32 steer = (K_GetKartTurnValue(player, - player->steering) << TICCMD_REDUCE); - - if (!player->drift) - steer = 9 * steer / 5; - - return FixedMul(steer, 8 * FixedDiv(player->speed, - 2 * K_GetKartSpeed(player, false, true) / 3)); - } - else - return 0; -} - INT32 K_GetKartDriftSparkValue(player_t *player) { return (26*4 + player->kartspeed*2 + (9 - player->kartweight))*8; @@ -9177,17 +9213,6 @@ void K_AdjustPlayerFriction(player_t *player) } */ - // Water gets ice physics too - if ((player->mo->eflags & MFE_TOUCHWATER) && - !player->offroad) - { - player->mo->friction += 614; - } - else if (player->mo->eflags & MFE_UNDERWATER) - { - player->mo->friction += 312; - } - // Wipeout slowdown if (player->speed > 0 && player->spinouttimer && player->wipeoutslow) { diff --git a/src/k_kart.h b/src/k_kart.h index c9f23ead1..75683f3b0 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -27,7 +27,6 @@ angle_t K_ReflectAngle(angle_t angle, angle_t against, fixed_t maxspeed, fixed_t void K_RegisterKartStuff(void); -void K_TimerReset(void); void K_TimerInit(void); UINT32 K_GetPlayerDontDrawFlag(player_t *player); boolean K_IsPlayerLosing(player_t *player); @@ -71,7 +70,6 @@ void K_DestroyBumpers(player_t *player, UINT8 amount); void K_TakeBumpersFromPlayer(player_t *player, player_t *victim, UINT8 amount); void K_MineFlashScreen(mobj_t *source); void K_SpawnMineExplosion(mobj_t *source, UINT8 color); -void K_RunFinishLineBeam(void); UINT16 K_DriftSparkColor(player_t *player, INT32 charge); void K_SpawnBoostTrail(player_t *player); void K_SpawnSparkleTrail(mobj_t *mo); @@ -95,7 +93,6 @@ void K_UpdateDistanceFromFinishLine(player_t *const player); boolean K_CheckPlayersRespawnColliding(INT32 playernum, fixed_t x, fixed_t y); INT16 K_UpdateSteeringValue(INT16 inputSteering, INT16 destSteering); INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue); -INT32 K_GetUnderwaterTurnAdjust(player_t *player); INT32 K_GetKartDriftSparkValue(player_t *player); INT32 K_GetKartDriftSparkValueForStage(player_t *player, UINT8 stage); void K_SpawnDriftBoostExplosion(player_t *player, int stage); diff --git a/src/k_race.c b/src/k_race.c deleted file mode 100644 index fde4c9be2..000000000 --- a/src/k_race.c +++ /dev/null @@ -1,421 +0,0 @@ -// SONIC ROBO BLAST 2 KART -//----------------------------------------------------------------------------- -// Copyright (C) 2018-2020 by Kart Krew -// -// This program is free software distributed under the -// terms of the GNU General Public License, version 2. -// See the 'LICENSE' file for more details. -//----------------------------------------------------------------------------- -/// \file k_race.c -/// \brief Race Mode specific code. - -#include "k_race.h" - -#include "k_kart.h" -#include "k_battle.h" -#include "k_pwrlv.h" -#include "k_color.h" -#include "k_respawn.h" -#include "doomdef.h" -#include "hu_stuff.h" -#include "g_game.h" -#include "m_random.h" -#include "p_local.h" -#include "p_slopes.h" -#include "p_setup.h" -#include "r_draw.h" -#include "r_local.h" -#include "s_sound.h" -#include "st_stuff.h" -#include "v_video.h" -#include "z_zone.h" -#include "m_misc.h" -#include "m_cond.h" -#include "f_finale.h" -#include "lua_hud.h" // For Lua hud checks -#include "lua_hook.h" // For MobjDamage and ShouldDamage -#include "m_cheat.h" // objectplacing -#include "p_spec.h" - -#include "k_waypoint.h" -#include "k_bot.h" -#include "k_hud.h" - -line_t *finishBeamLine = NULL; - -static mobj_t *beamPoints[2]; -static UINT8 numBeamPoints = 0; - -/*-------------------------------------------------- - void K_ClearFinishBeamLine(void) - - See header file for description. ---------------------------------------------------*/ -void K_ClearFinishBeamLine(void) -{ - size_t i; - - finishBeamLine = NULL; - - for (i = 0; i < 2; i++) - { - beamPoints[i] = NULL; - } - - numBeamPoints = 0; -} - -/*-------------------------------------------------- - static void K_FreeFinishBeamLine(void) - - See header file for description. ---------------------------------------------------*/ -static void K_FreeFinishBeamLine(void) -{ - if (finishBeamLine != NULL) - { - if (finishBeamLine->v1 != NULL) - { - Z_Free(finishBeamLine->v1); - } - - if (finishBeamLine->v2 != NULL) - { - Z_Free(finishBeamLine->v2); - } - - Z_Free(finishBeamLine); - } - - K_ClearFinishBeamLine(); -} - -/*-------------------------------------------------- - static void K_CreateFinishLineFromPoints(fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2) - - See header file for description. ---------------------------------------------------*/ -static void K_CreateFinishLineFromPoints(fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2) -{ - I_Assert(finishBeamLine == NULL); // Needs to be NULL - - finishBeamLine = Z_Calloc(sizeof (*finishBeamLine), PU_LEVEL, NULL); - - finishBeamLine->v1 = Z_Calloc(sizeof (*finishBeamLine->v1), PU_LEVEL, NULL); - finishBeamLine->v1->x = x1; - finishBeamLine->v1->y = y1; - - finishBeamLine->v2 = Z_Calloc(sizeof (*finishBeamLine->v2), PU_LEVEL, NULL); - finishBeamLine->v2->x = x2; - finishBeamLine->v2->y = y2; - - finishBeamLine->dx = x2 - x1; - finishBeamLine->dy = y2 - y1; - - finishBeamLine->flags = 0; -} - -/*-------------------------------------------------- - boolean K_GenerateFinishBeamLine(void) - - See header file for description. ---------------------------------------------------*/ -boolean K_GenerateFinishBeamLine(void) -{ - mapthing_t *mt; - - INT64 bounds[4]; - angle_t angle = 0; - - boolean valid = false; - size_t i; - - // Ensure everything's freed by this time. - K_FreeFinishBeamLine(); - - // First: attempt to create from beam point objects - for (i = 0, mt = mapthings; i < nummapthings; i++, mt++) - { - if (numBeamPoints >= 2) - { - break; - } - - if (mt->type == mobjinfo[MT_BEAMPOINT].doomednum) - { - beamPoints[numBeamPoints] = mt->mobj; - numBeamPoints++; - } - } - - if (numBeamPoints == 2) - { - // Found 'em! Really easy to generate a line out of these :) - - K_CreateFinishLineFromPoints( - beamPoints[0]->x, beamPoints[0]->y, - beamPoints[1]->x, beamPoints[1]->y - ); - - return true; - } - - bounds[0] = INT64_MAX; // min x - bounds[1] = INT64_MIN; // max x - bounds[2] = INT64_MAX; // min y - bounds[3] = INT64_MIN; // max y - - for (i = 0; i < numlines; i++) - { - angle_t thisAngle; - - if (lines[i].special != 2001) - { - continue; - } - - thisAngle = R_PointToAngle2(0, 0, lines[i].dx, lines[i].dy); - - bounds[0] = min(bounds[0], min(lines[i].v1->x, lines[i].v2->x)); // min x - bounds[1] = max(bounds[1], max(lines[i].v1->x, lines[i].v2->x)); // max x - bounds[2] = min(bounds[2], min(lines[i].v1->y, lines[i].v2->y)); // min y - bounds[3] = max(bounds[3], max(lines[i].v1->y, lines[i].v2->y)); // max y - - if (valid == false) - { - angle = thisAngle; - valid = true; - } - else if (angle != thisAngle) - { - // Do not even attempt to bother with curved finish lines. - // Will likely just crash. - valid = false; - - break; - } - } - - if (valid == true) - { - fixed_t span = P_AproxDistance(bounds[1] - bounds[0], bounds[3] - bounds[2]) / 2; - - fixed_t cx = (bounds[0] + bounds[1]) / 2; - fixed_t cy = (bounds[2] + bounds[3]) / 2; - - fixed_t spanC = FixedMul(span, FINECOSINE(angle >> ANGLETOFINESHIFT)); - fixed_t spanS = FixedMul(span, FINESINE(angle >> ANGLETOFINESHIFT)); - - K_CreateFinishLineFromPoints( - cx - spanC, cy - spanS, - cx + spanC, cy + spanS - ); - - return true; - } - - return false; -} - -/*-------------------------------------------------- - static void K_DrawFinishLineBeamForLine(fixed_t offset, angle_t aiming, line_t *line, boolean reverse) - - Draws a helix out of rainbow colored orbs along a line, unique for each display player. - Called twice for the finish line beam effect. - - Input Arguments:- - offset - Offset value for positioning. Changed every tick to make it animate. - aiming - Starting vertical angle value. Changed every tick to make it animate. - line - Linedef to draw along. - reverse - Draw in reverse. Call twice with this toggled to make a double helix. - - Return:- - None ---------------------------------------------------*/ - -static void K_DrawFinishLineBeamForLine(fixed_t offset, angle_t aiming, line_t *line, boolean reverse) -{ - const fixed_t linelength = P_AproxDistance(line->dx, line->dy); - const fixed_t xstep = FixedDiv(line->dx, linelength); - const fixed_t ystep = FixedDiv(line->dy, linelength); - - fixed_t linex = line->v1->x; - fixed_t liney = line->v1->y; - angle_t lineangle = R_PointToAngle2(0, 0, line->dx, line->dy) + ANGLE_90; - - UINT8 i; - - if (line->flags & ML_NOCLIMB) - { - // Line is flipped - lineangle += ANGLE_180; - } - - linex += FixedMul(offset, xstep); - liney += FixedMul(offset, ystep); - - while (offset < linelength) - { -#define COLORCYCLELEN 10 - const UINT8 colorcycle[COLORCYCLELEN] = { - SKINCOLOR_PERIWINKLE, - SKINCOLOR_SLATE, - SKINCOLOR_BLOSSOM, - SKINCOLOR_RASPBERRY, - SKINCOLOR_ORANGE, - SKINCOLOR_YELLOW, - SKINCOLOR_LIME, - SKINCOLOR_TURTLE, - SKINCOLOR_ROBIN, - SKINCOLOR_JAWZ - }; - - const UINT8 numframes = 5; - const angle_t framethreshold = ANGLE_180 / (numframes-1); - const angle_t frameaim = aiming + (framethreshold / 2); - - fixed_t x, y, z; - UINT8 spriteframe = 0; - - x = linex + FixedMul(FixedMul(FINISHLINEBEAM_SPACING, FINECOSINE(lineangle >> ANGLETOFINESHIFT)), FINECOSINE(aiming >> ANGLETOFINESHIFT)); - y = liney + FixedMul(FixedMul(FINISHLINEBEAM_SPACING, FINESINE(lineangle >> ANGLETOFINESHIFT)), FINECOSINE(aiming >> ANGLETOFINESHIFT)); - z = FINISHLINEBEAM_SPACING + FixedMul(FINISHLINEBEAM_SPACING, FINESINE(aiming >> ANGLETOFINESHIFT)); - - if (leveltime >= starttime) - { - spriteframe = 4; // Weakest sprite when passable - } - else if (frameaim > ANGLE_180) - { - spriteframe = (ANGLE_MAX - frameaim) / framethreshold; - } - else - { - spriteframe = frameaim / framethreshold; - } - - for (i = 0; i <= r_splitscreen; i++) - { - if (playeringame[displayplayers[i]] && players[displayplayers[i]].mo && !P_MobjWasRemoved(players[displayplayers[i]].mo)) - { - mobj_t *beam; - - beam = P_SpawnMobj(x, y, players[displayplayers[i]].mo->z + z, MT_THOK); - P_SetMobjState(beam, S_FINISHBEAM1 + spriteframe); - - beam->colorized = true; - beam->renderflags = RF_DONTDRAW & ~K_GetPlayerDontDrawFlag(&players[displayplayers[i]]); - - if (reverse) - { - beam->color = colorcycle[((leveltime / 4) + (COLORCYCLELEN/2)) % COLORCYCLELEN]; - } - else - { - beam->color = colorcycle[(leveltime / 4) % COLORCYCLELEN]; - } - } - } - - offset += FINISHLINEBEAM_SPACING; - linex += FixedMul(FINISHLINEBEAM_SPACING, xstep); - liney += FixedMul(FINISHLINEBEAM_SPACING, ystep); - - if (reverse) - { - aiming -= ANGLE_45; - } - else - { - aiming += ANGLE_45; - } - } - - for (i = 0; i <= r_splitscreen; i++) - { - if (playeringame[displayplayers[i]] && players[displayplayers[i]].mo && !P_MobjWasRemoved(players[displayplayers[i]].mo)) - { - UINT8 j; - for (j = 0; j < 2; j++) - { - vertex_t *v = line->v1; - mobj_t *end1, *end2; - angle_t a = R_PointToAngle2(0, 0, line->dx, line->dy); - fixed_t sx; - fixed_t sy; - - /* - if (line->flags & ML_NOCLIMB) - { - a += ANGLE_180; - } - */ - - sx = FixedMul(3*mapobjectscale, FINECOSINE(a >> ANGLETOFINESHIFT)); - sy = FixedMul(3*mapobjectscale, FINESINE(a >> ANGLETOFINESHIFT)); - - if (j == 1) - { - v = line->v2; - sx = -sx; - sy = -sy; - } - - end1 = P_SpawnMobj( - v->x + sx, - v->y + sy, - players[displayplayers[i]].mo->z + FINISHLINEBEAM_SPACING, - MT_THOK - ); - - P_SetMobjState(end1, S_FINISHBEAMEND1); - end1->renderflags = RF_DONTDRAW & ~K_GetPlayerDontDrawFlag(&players[displayplayers[i]]); - P_InitAngle(end1, lineangle); - - end2 = P_SpawnMobj( - v->x + (8*sx), - v->y + (8*sy), - players[displayplayers[i]].mo->z + FINISHLINEBEAM_SPACING, - MT_THOK - ); - - P_SetMobjState(end2, S_FINISHBEAMEND2); - end2->renderflags = RF_DONTDRAW & ~K_GetPlayerDontDrawFlag(&players[displayplayers[i]]); - P_InitAngle(end2, lineangle); - - P_SetTarget(&end2->tracer, end1); - end2->flags2 |= MF2_LINKDRAW; - } - } - } -} - -/*-------------------------------------------------- - void K_RunFinishLineBeam(void) - - See header file for description. ---------------------------------------------------*/ - -void K_RunFinishLineBeam(void) -{ - if (!(leveltime < starttime || rainbowstartavailable == true)) - { - return; - } - - if (finishBeamLine != NULL) - { - const angle_t angoffset = ANGLE_45; - const angle_t angadd = ANGLE_11hh; - const fixed_t speed = 6 * mapobjectscale; - - fixed_t offseta = (leveltime * speed) % FINISHLINEBEAM_SPACING; - angle_t aiminga = (angoffset * -((leveltime * speed) / FINISHLINEBEAM_SPACING)) + (angadd * leveltime); - - fixed_t offsetb = FINISHLINEBEAM_SPACING - offseta; - angle_t aimingb = (angoffset * -((leveltime * speed) / FINISHLINEBEAM_SPACING)) - (angadd * leveltime); - - K_DrawFinishLineBeamForLine(offseta, aiminga, finishBeamLine, false); - K_DrawFinishLineBeamForLine(offsetb, aimingb, finishBeamLine, true); - } -} diff --git a/src/k_race.h b/src/k_race.h deleted file mode 100644 index b9021893e..000000000 --- a/src/k_race.h +++ /dev/null @@ -1,69 +0,0 @@ -// SONIC ROBO BLAST 2 KART -//----------------------------------------------------------------------------- -// Copyright (C) 2018-2020 by Kart Krew -// -// This program is free software distributed under the -// terms of the GNU General Public License, version 2. -// See the 'LICENSE' file for more details. -//----------------------------------------------------------------------------- -/// \file k_race.h -/// \brief Race Mode specific code. - -#ifndef __K_RACE__ -#define __K_RACE__ - -#include "r_defs.h" - -extern line_t *finishBeamLine; - -#define FINISHLINEBEAM_SPACING (48*mapobjectscale) - -/*-------------------------------------------------- - void K_ClearFinishBeamLine(void); - - Clears variables for finishBeamLine. - Separate from K_FreeFinishBeamLine since this - needs called when PU_LEVEL is freed. - - Input Arguments:- - None - - Return:- - None ---------------------------------------------------*/ - -void K_ClearFinishBeamLine(void); - - -/*-------------------------------------------------- - boolean K_GenerateFinishBeamLine(void); - - Finds pre-placed "beam points" to create a finish line out of, - or tries to automatically create it from a finish linedef in the map. - The result is stored in the "finishBeamLine" variable. - - Input Arguments:- - None - - Return:- - True if successful, otherwise false. ---------------------------------------------------*/ - -boolean K_GenerateFinishBeamLine(void); - - -/*-------------------------------------------------- - void K_RunFinishLineBeam(void); - - Updates the finish line beam effect. - - Input Arguments:- - None - - Return:- - None ---------------------------------------------------*/ - -void K_RunFinishLineBeam(void); - -#endif diff --git a/src/k_respawn.c b/src/k_respawn.c index 0364d6b65..513d6ee44 100644 --- a/src/k_respawn.c +++ b/src/k_respawn.c @@ -105,23 +105,6 @@ static void K_RespawnAtWaypoint(player_t *player, waypoint_t *waypoint) } } -/*-------------------------------------------------- - void K_DoFault(player_t *player) - - See header file for description. ---------------------------------------------------*/ - -void K_DoFault(player_t *player) -{ - player->nocontrol = (starttime - leveltime) + 50; - if (!(player->pflags & PF_FAULT)) - { - S_StartSound(player->mo, sfx_s3k83); - player->karthud[khud_fault] = 1; - player->pflags |= PF_FAULT; - } -} - /*-------------------------------------------------- void K_DoIngameRespawn(player_t *player) @@ -134,21 +117,11 @@ void K_DoIngameRespawn(player_t *player) return; } - if (player->respawn.state != RESPAWNST_NONE && - ( player->pflags & PF_FAULT ) == 0) - { - return; - } - if (leveltime <= introtime) { return; } - // FAULT - if (leveltime < starttime) - K_DoFault(player); - player->ringboost = 0; player->driftboost = player->strongdriftboost = 0; diff --git a/src/k_respawn.h b/src/k_respawn.h index 81ee16b77..2455c7dc3 100644 --- a/src/k_respawn.h +++ b/src/k_respawn.h @@ -38,21 +38,6 @@ fixed_t K_RespawnOffset(player_t *player, boolean flip); -/*-------------------------------------------------- - void K_DoFault(player_t *player); - - Faults the specified player. - - Input Arguments:- - player - Player to preform this for. - - Return:- - None ---------------------------------------------------*/ - -void K_DoFault(player_t *player); - - /*-------------------------------------------------- void K_DoIngameRespawn(player_t *player); diff --git a/src/p_inter.c b/src/p_inter.c index f410b8639..283dcc1d4 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1740,10 +1740,6 @@ static boolean P_KillPlayer(player_t *player, mobj_t *inflictor, mobj_t *source, break; default: // Everything else REALLY kills - if (leveltime < starttime) - { - K_DoFault(player); - } break; } diff --git a/src/p_mobj.c b/src/p_mobj.c index 8b56ef983..141d21dab 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -11414,11 +11414,20 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing) mobj->angle = angle; - // FAULT - if (leveltime > introtime && !p->spectator) + if (gamestate == GS_LEVEL && leveltime > introtime && !p->spectator) { K_DoIngameRespawn(p); } + else + { + // This is important for spectators. If you are + // a spectator now, then when you enter the game, + // respawn back at this point. + p->respawn.pointx = x; + p->respawn.pointy = y; + p->respawn.pointz = z; + //p->respawn.pointangle = angle; + } P_AfterPlayerSpawn(playernum); } diff --git a/src/p_saveg.c b/src/p_saveg.c index d1530a770..3679f10c1 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -329,6 +329,8 @@ static void P_NetArchivePlayers(void) WRITEUINT16(save_p, players[i].sneakertimer); WRITEUINT8(save_p, players[i].numsneakers); WRITEUINT8(save_p, players[i].floorboost); + + WRITEUINT8(save_p, players[i].boostcharge); WRITEINT16(save_p, players[i].growshrinktimer); WRITEINT16(save_p, players[i].growcancel); @@ -618,6 +620,8 @@ static void P_NetUnArchivePlayers(void) players[i].sneakertimer = READUINT16(save_p); players[i].numsneakers = READUINT8(save_p); players[i].floorboost = READUINT8(save_p); + + players[i].boostcharge = READUINT8(save_p); players[i].growshrinktimer = READINT16(save_p); players[i].growcancel = READINT16(save_p); @@ -4535,11 +4539,9 @@ static void P_NetArchiveMisc(boolean resending) WRITEUINT8(save_p, thwompsactive); WRITEUINT8(save_p, lastLowestLap); WRITESINT8(save_p, spbplace); - WRITEUINT8(save_p, rainbowstartavailable); WRITEUINT32(save_p, introtime); WRITEUINT32(save_p, starttime); - WRITEUINT8(save_p, numbulbs); // Is it paused? if (paused) @@ -4684,11 +4686,9 @@ static inline boolean P_NetUnArchiveMisc(boolean reloading) thwompsactive = (boolean)READUINT8(save_p); lastLowestLap = READUINT8(save_p); spbplace = READSINT8(save_p); - rainbowstartavailable = (boolean)READUINT8(save_p); introtime = READUINT32(save_p); starttime = READUINT32(save_p); - numbulbs = READUINT8(save_p); // Is it paused? if (READUINT8(save_p) == 0x2f) diff --git a/src/p_setup.c b/src/p_setup.c index 81b4ea20f..686e219d2 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -87,7 +87,6 @@ // SRB2Kart #include "k_kart.h" -#include "k_race.h" #include "k_battle.h" // K_BattleInit #include "k_pwrlv.h" #include "k_waypoint.h" @@ -4067,6 +4066,7 @@ static void P_InitGametype(void) spectateGriefed = 0; K_CashInPowerLevels(); // Pushes power level changes even if intermission was skipped + K_TimerInit(); P_InitPlayers(); if (modeattacking && !demo.playback) @@ -4293,7 +4293,7 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate) // As oddly named as this is, this handles music only. // We should be fine starting it here. // Don't do this during titlemap, because the menu code handles music by itself. - S_Start(); + S_StartEx(true); } } @@ -4410,7 +4410,6 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate) // The waypoint data that's in PU_LEVEL needs to be reset back to 0/NULL now since PU_LEVEL was cleared K_ClearWaypoints(); - K_ClearFinishBeamLine(); // Load the waypoints please! if (gametyperules & GTR_CIRCUIT) @@ -4419,11 +4418,6 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate) { CONS_Alert(CONS_ERROR, "Waypoints were not able to be setup! Player positions will not work correctly.\n"); } - - if (K_GenerateFinishBeamLine() == false) - { - CONS_Alert(CONS_ERROR, "No valid finish line beam setup could be found.\n"); - } } #ifdef HWRENDER // not win32 only 19990829 by Kin @@ -4540,8 +4534,6 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate) P_MapEnd(); // just in case MapLoad modifies tmthing } - K_TimerReset(); - // No render mode or reloading gamestate, stop here. if (rendermode == render_none || reloadinggamestate) return true; diff --git a/src/p_spec.c b/src/p_spec.c index c0e8ce10a..5b5d28cf6 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -1869,12 +1869,7 @@ static void K_HandleLapIncrement(player_t *player) { if (player) { - if (leveltime < starttime) - { - // Will fault the player - K_DoIngameRespawn(player); - } - else if ((player->starpostnum == numstarposts) || (player->laps == 0)) + if ((player->starpostnum == numstarposts) || (player->laps == 0)) { size_t i = 0; UINT8 nump = 0; @@ -1910,17 +1905,6 @@ static void K_HandleLapIncrement(player_t *player) player->karthud[khud_lapanimation] = 80; } - if (rainbowstartavailable == true) - { - S_StartSound(player->mo, sfx_s23c); - player->startboost = 125; - - K_SpawnDriftBoostExplosion(player, 4); - K_SpawnDriftElectricSparks(player); - - rainbowstartavailable = false; - } - if (netgame && player->laps >= numlaps) CON_LogMessage(va(M_GetText("%s has finished the race.\n"), player_names[player-players])); diff --git a/src/p_tick.c b/src/p_tick.c index 843461db6..05f797d94 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -31,7 +31,6 @@ // SRB2Kart #include "k_kart.h" -#include "k_race.h" #include "k_battle.h" #include "k_boss.h" #include "k_waypoint.h" @@ -343,9 +342,6 @@ static inline void P_RunThinkers(void) ps_thlist_times[i] = I_GetPreciseTime() - ps_thlist_times[i]; } - if (gametyperules & GTR_CIRCUIT) - K_RunFinishLineBeam(); - if (gametyperules & GTR_PAPERITEMS) K_RunPaperItemSpawners(); @@ -626,7 +622,7 @@ void P_Ticker(boolean run) { if (leveltime == 3) { - S_ChangeMusic(mapmusname, mapmusflags, true); + S_ChangeMusicEx(mapmusname, mapmusflags, true, mapmusposition, 0, 0); S_ShowMusicCredit(); } } @@ -635,22 +631,9 @@ void P_Ticker(boolean run) { if (leveltime == (starttime + (TICRATE/2))) { - S_ChangeMusic(mapmusname, mapmusflags, true); + S_ChangeMusicEx(mapmusname, mapmusflags, true, mapmusposition, 0, 0); S_ShowMusicCredit(); } - - if (encoremode) - { - // Encore humming starts immediately. - if (leveltime == 3) - S_ChangeMusicInternal("encore", true); - } - else - { - // Plays the POSITION music after the camera spin - if (leveltime == introtime) - S_ChangeMusicInternal("postn", true); - } } ps_lua_thinkframe_time = I_GetPreciseTime(); @@ -761,13 +744,6 @@ void P_Ticker(boolean run) if (demo.playback) G_StoreRewindInfo(); - if (leveltime == 2) - { - // The values needed to set this properly are not correct at map load, - // so we have to do it at the second tick instead... - K_TimerInit(); - } - // Z_CheckMemCleanup(); } diff --git a/src/p_user.c b/src/p_user.c index 01527280c..89d5b2f50 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -14,6 +14,7 @@ /// Bobbing POV/weapon, movement. /// Pending weapon. +#include "d_player.h" #include "doomdef.h" #include "i_system.h" #include "d_event.h" @@ -453,7 +454,7 @@ UINT8 P_FindHighestLap(void) // boolean P_PlayerInPain(player_t *player) { - if (player->spinouttimer || (player->pflags & PF_FAULT)) + if (player->spinouttimer) return true; return false; @@ -1849,55 +1850,6 @@ static void P_3dMovement(player_t *player) if (player->mo->movefactor != FRACUNIT) // Friction-scaled acceleration... movepushforward = FixedMul(movepushforward, player->mo->movefactor); - { - INT32 a = K_GetUnderwaterTurnAdjust(player); - INT32 adj = 0; - - if (a) - { - const fixed_t maxadj = ANG10/4; - - adj = a / 4; - - if (adj > 0) - { - if (adj > maxadj) - adj = maxadj; - } - else if (adj < 0) - { - if (adj < -(maxadj)) - adj = -(maxadj); - } - - if (abs(player->underwatertilt + adj) > abs(a)) - adj = (a - player->underwatertilt); - - if (abs(a) < abs(player->underwatertilt)) - adj = 0; - - movepushangle += a; - } - - if (adj) - { - player->underwatertilt += adj; - - if (abs(player->underwatertilt) > ANG30) - { - player->underwatertilt = - player->underwatertilt > 0 ? ANG30 - : -(ANG30); - } - } - else - { - player->underwatertilt = - FixedMul(player->underwatertilt, - 7*FRACUNIT/8); - } - } - totalthrust.x += P_ReturnThrustX(player->mo, movepushangle, movepushforward); totalthrust.y += P_ReturnThrustY(player->mo, movepushangle, movepushforward); } @@ -2197,9 +2149,9 @@ void P_MovePlayer(player_t *player) player->glanceDir = 0; player->pflags &= ~PF_LOOKDOWN; } - else if ((player->pflags & PF_FAULT) || (player->spinouttimer > 0)) + else if ((player->spinouttimer > 0)) { - UINT16 speed = ((player->pflags & PF_FAULT) ? player->nocontrol : player->spinouttimer)/8; + UINT16 speed = player->spinouttimer/8; if (speed > 8) speed = 8; else if (speed < 1) @@ -2214,6 +2166,16 @@ void P_MovePlayer(player_t *player) player->mo->rollangle = 0; } + else if (player->nocontrol && player->pflags & PF_SKIDDOWN) + { + if (player->mo->state != &states[S_KART_SPINOUT]) + P_SetPlayerMobjState(player->mo, S_KART_SPINOUT); + + if (((player->nocontrol + 5) % 20) < 10) + player->drawangle += ANGLE_11hh; + else + player->drawangle -= ANGLE_11hh; + } else { K_KartMoveAnimation(player); @@ -4381,7 +4343,7 @@ void P_PlayerThink(player_t *player) if (player->nocontrol && player->nocontrol < UINT16_MAX) { if (!(--player->nocontrol)) - player->pflags &= ~PF_FAULT; + player->pflags &= ~PF_SKIDDOWN; } else player->nocontrol = 0; diff --git a/src/s_sound.c b/src/s_sound.c index 9d3456f59..e197a9e7c 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -2369,10 +2369,8 @@ void S_StartEx(boolean reset) if (leveltime < (starttime + (TICRATE/2))) // SRB2Kart { - ; + S_ChangeMusicEx((encoremode ? "estart" : "kstart"), 0, false, mapmusposition, 0, 0); } - else - S_ChangeMusicEx(mapmusname, mapmusflags, true, mapmusposition, 0, 0); S_ResetMusicStack(); music_stack_noposition = false; diff --git a/src/s_sound.h b/src/s_sound.h index 515fcd4f4..90cfe3e54 100644 --- a/src/s_sound.h +++ b/src/s_sound.h @@ -118,7 +118,6 @@ void S_InitSfxChannels(INT32 sfxVolume); void S_StopSounds(void); void S_ClearSfx(void); void S_StartEx(boolean reset); -#define S_Start() S_StartEx(false) // // Basically a W_GetNumForName that adds "ds" at the beginning of the string. Returns a lumpnum.