diff --git a/src/b_bot.c b/src/b_bot.c index c06b23ed..25204188 100644 --- a/src/b_bot.c +++ b/src/b_bot.c @@ -273,11 +273,11 @@ void B_RespawnBot(INT32 playernum) P_TeleportMove(tails, x, y, z); if (player->charability == CA_FLY) { - P_SetPlayerMobjState(tails, S_KART_STND); // SRB2kart - was S_PLAY_ABL1 + P_SetPlayerMobjState(tails, S_KART_STND1); // SRB2kart - was S_PLAY_ABL1 tails->player->powers[pw_tailsfly] = (UINT16)-1; } else - P_SetPlayerMobjState(tails, S_KART_STND); // SRB2kart - was S_PLAY_FALL1 + P_SetPlayerMobjState(tails, S_KART_STND1); // SRB2kart - was S_PLAY_FALL1 P_SetScale(tails, sonic->scale); tails->destscale = sonic->destscale; } diff --git a/src/dehacked.c b/src/dehacked.c index 6c35a66d..68daf775 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -3804,25 +3804,28 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_THOK", // SRB2kart Frames - "S_KART_STND", - "S_KART_STND_L", - "S_KART_STND_R", + "S_KART_STND1", + "S_KART_STND2", + "S_KART_STND1_L", + "S_KART_STND2_L", + "S_KART_STND1_R", + "S_KART_STND2_R", "S_KART_WALK1", "S_KART_WALK2", - "S_KART_WALK_L1", - "S_KART_WALK_L2", - "S_KART_WALK_R1", - "S_KART_WALK_R2", + "S_KART_WALK1_L", + "S_KART_WALK2_L", + "S_KART_WALK1_R", + "S_KART_WALK2_R", "S_KART_RUN1", "S_KART_RUN2", - "S_KART_RUN_L1", - "S_KART_RUN_L2", - "S_KART_RUN_R1", - "S_KART_RUN_R2", - "S_KART_DRIFT_L1", - "S_KART_DRIFT_L2", - "S_KART_DRIFT_R1", - "S_KART_DRIFT_R2", + "S_KART_RUN1_L", + "S_KART_RUN2_L", + "S_KART_RUN1_R", + "S_KART_RUN2_R", + "S_KART_DRIFT1_L", + "S_KART_DRIFT2_L", + "S_KART_DRIFT1_R", + "S_KART_DRIFT2_R", "S_KART_SPIN", "S_KART_PAIN", "S_KART_SQUISH", diff --git a/src/g_game.c b/src/g_game.c index effd2127..ecd456fb 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -5464,7 +5464,7 @@ void G_AddGhost(char *defdemoname) gh->mo = P_SpawnMobj(x, y, z, MT_GHOST); gh->mo->angle = FixedAngle(mthing->angle*FRACUNIT); } - gh->mo->state = states+S_KART_STND; // SRB2kart - was S_PLAY_STND + gh->mo->state = states+S_KART_STND1; // SRB2kart - was S_PLAY_STND gh->mo->sprite = gh->mo->state->sprite; gh->mo->frame = (gh->mo->state->frame & FF_FRAMEMASK) | tr_trans20<mo->tics = -1; diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index caa46edd..76de8246 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1474,8 +1474,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr) } else { - if (spr->mobj->state->nextstate != S_NULL && states[spr->mobj->state->nextstate].sprite != SPR_NULL - && !(spr->mobj->player && spr->mobj->state == &states[S_KART_STND])) // SRB2kart + if (spr->mobj->state->nextstate != S_NULL && states[spr->mobj->state->nextstate].sprite != SPR_NULL) { const UINT32 nextframe = (states[spr->mobj->state->nextstate].frame & FF_FRAMEMASK) % md2->model->header.numFrames; next = &md2->model->frames[nextframe]; diff --git a/src/info.c b/src/info.c index 83fb784c..c21aad35 100644 --- a/src/info.c +++ b/src/info.c @@ -87,28 +87,31 @@ state_t states[NUMSTATES] = {SPR_THOK, FF_TRANS50, 8, {NULL}, 0, 0, S_NULL}, // S_THOK // Player // SRB2kart - {SPR_PLAY, 0, -1, {NULL}, 0, 0, S_KART_STND}, // S_KART_STND A - {SPR_PLAY, 1, -1, {NULL}, 0, 0, S_KART_STND_L}, // S_KART_STND_L B - {SPR_PLAY, 2, -1, {NULL}, 0, 0, S_KART_STND_R}, // S_KART_STND_R C - {SPR_PLAY, 3, 4, {NULL}, 0, 0, S_KART_WALK2}, // S_KART_WALK1 D - {SPR_PLAY, 4, 4, {NULL}, 0, 0, S_KART_WALK1}, // S_KART_WALK2 E - {SPR_PLAY, 5, 4, {NULL}, 0, 0, S_KART_WALK_L2}, // S_KART_WALK_L1 F - {SPR_PLAY, 6, 4, {NULL}, 0, 0, S_KART_WALK_L1}, // S_KART_WALK_L2 G - {SPR_PLAY, 7, 4, {NULL}, 0, 0, S_KART_WALK_R2}, // S_KART_WALK_R1 H - {SPR_PLAY, 8, 4, {NULL}, 0, 0, S_KART_WALK_R1}, // S_KART_WALK_R2 I - {SPR_PLAY, 0, 2, {NULL}, 0, 0, S_KART_RUN2}, // S_KART_RUN1 A - {SPR_PLAY, 3, 2, {NULL}, 0, 0, S_KART_RUN1}, // S_KART_RUN2 D - {SPR_PLAY, 1, 2, {NULL}, 0, 0, S_KART_RUN_L2}, // S_KART_RUN_L1 B - {SPR_PLAY, 5, 2, {NULL}, 0, 0, S_KART_RUN_L1}, // S_KART_RUN_L2 F - {SPR_PLAY, 2, 2, {NULL}, 0, 0, S_KART_RUN_R2}, // S_KART_RUN_R1 C - {SPR_PLAY, 7, 2, {NULL}, 0, 0, S_KART_RUN_R1}, // S_KART_RUN_R2 H - {SPR_PLAY, 9, 2, {NULL}, 0, 0, S_KART_DRIFT_L2}, // S_KART_DRIFT_L1 J - {SPR_PLAY, 10, 2, {NULL}, 0, 0, S_KART_DRIFT_L1}, // S_KART_DRIFT_L2 K - {SPR_PLAY, 11, 2, {NULL}, 0, 0, S_KART_DRIFT_R2}, // S_KART_DRIFT_R1 L - {SPR_PLAY, 12, 2, {NULL}, 0, 0, S_KART_DRIFT_R1}, // S_KART_DRIFT_R2 M - {SPR_PLAY, 13, -1, {NULL}, 0, 0, S_KART_SPIN}, // S_KART_SPIN N - {SPR_PLAY, 13, 350, {NULL}, 0, 0, S_KART_STND}, // S_KART_PAIN N - {SPR_PLAY, 21, 350, {NULL}, 0, 0, S_KART_STND}, // S_KART_SQUISH V + {SPR_PLAY, 0, 1, {NULL}, 0, 0, S_KART_STND2}, // S_KART_STND1 A + {SPR_PLAY, 1, 1, {NULL}, 0, 0, S_KART_STND1}, // S_KART_STND2 B + {SPR_PLAY, 2, 1, {NULL}, 0, 0, S_KART_STND2_L}, // S_KART_STND1_L C + {SPR_PLAY, 3, 1, {NULL}, 0, 0, S_KART_STND1_L}, // S_KART_STND2_L D + {SPR_PLAY, 4, 1, {NULL}, 0, 0, S_KART_STND2_R}, // S_KART_STND1_R E + {SPR_PLAY, 5, 1, {NULL}, 0, 0, S_KART_STND1_R}, // S_KART_STND2_R F + {SPR_PLAY, 6, 4, {NULL}, 0, 0, S_KART_WALK2}, // S_KART_WALK1 G + {SPR_PLAY, 7, 4, {NULL}, 0, 0, S_KART_WALK1}, // S_KART_WALK2 H + {SPR_PLAY, 8, 4, {NULL}, 0, 0, S_KART_WALK2_L}, // S_KART_WALK1_L I + {SPR_PLAY, 9, 4, {NULL}, 0, 0, S_KART_WALK1_L}, // S_KART_WALK2_L J + {SPR_PLAY, 10, 4, {NULL}, 0, 0, S_KART_WALK2_R}, // S_KART_WALK1_R K + {SPR_PLAY, 11, 4, {NULL}, 0, 0, S_KART_WALK1_R}, // S_KART_WALK2_R L + {SPR_PLAY, 12, 2, {NULL}, 0, 0, S_KART_RUN2}, // S_KART_RUN1 M + {SPR_PLAY, 13, 2, {NULL}, 0, 0, S_KART_RUN1}, // S_KART_RUN2 N + {SPR_PLAY, 14, 2, {NULL}, 0, 0, S_KART_RUN2_L}, // S_KART_RUN1_L O + {SPR_PLAY, 15, 2, {NULL}, 0, 0, S_KART_RUN1_L}, // S_KART_RUN2_L P + {SPR_PLAY, 16, 2, {NULL}, 0, 0, S_KART_RUN2_R}, // S_KART_RUN1_R Q + {SPR_PLAY, 17, 2, {NULL}, 0, 0, S_KART_RUN1_R}, // S_KART_RUN2_R R + {SPR_PLAY, 18, 2, {NULL}, 0, 0, S_KART_DRIFT2_L}, // S_KART_DRIFT1_L S + {SPR_PLAY, 19, 2, {NULL}, 0, 0, S_KART_DRIFT1_L}, // S_KART_DRIFT2_L T + {SPR_PLAY, 20, 2, {NULL}, 0, 0, S_KART_DRIFT2_R}, // S_KART_DRIFT1_R U + {SPR_PLAY, 21, 2, {NULL}, 0, 0, S_KART_DRIFT1_R}, // S_KART_DRIFT2_R V + {SPR_PLAY, 22, -1, {NULL}, 0, 0, S_KART_SPIN}, // S_KART_SPIN W + {SPR_PLAY, 22, 350, {NULL}, 0, 0, S_KART_STND1}, // S_KART_PAIN W + {SPR_PLAY, 23, 350, {NULL}, 0, 0, S_KART_STND1}, // S_KART_SQUISH X /* {SPR_PLAY, 0, 105, {NULL}, 0, 0, S_PLAY_TAP1}, // S_PLAY_STND {SPR_PLAY, 1, 16, {NULL}, 0, 0, S_PLAY_TAP2}, // S_PLAY_TAP1 @@ -2944,7 +2947,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { // MT_PLAYER -1, // doomednum - S_KART_STND, // spawnstate + S_KART_STND1, // spawnstate 1, // spawnhealth S_KART_WALK1, // seestate sfx_None, // seesound diff --git a/src/info.h b/src/info.h index 0bb5272f..9675ea89 100644 --- a/src/info.h +++ b/src/info.h @@ -643,25 +643,28 @@ typedef enum state S_THOK, // SRB2kart Frames - S_KART_STND, - S_KART_STND_L, - S_KART_STND_R, + S_KART_STND1, + S_KART_STND2, + S_KART_STND1_L, + S_KART_STND2_L, + S_KART_STND1_R, + S_KART_STND2_R, S_KART_WALK1, S_KART_WALK2, - S_KART_WALK_L1, - S_KART_WALK_L2, - S_KART_WALK_R1, - S_KART_WALK_R2, + S_KART_WALK1_L, + S_KART_WALK2_L, + S_KART_WALK1_R, + S_KART_WALK2_R, S_KART_RUN1, S_KART_RUN2, - S_KART_RUN_L1, - S_KART_RUN_L2, - S_KART_RUN_R1, - S_KART_RUN_R2, - S_KART_DRIFT_L1, - S_KART_DRIFT_L2, - S_KART_DRIFT_R1, - S_KART_DRIFT_R2, + S_KART_RUN1_L, + S_KART_RUN2_L, + S_KART_RUN1_R, + S_KART_RUN2_R, + S_KART_DRIFT1_L, + S_KART_DRIFT2_L, + S_KART_DRIFT1_R, + S_KART_DRIFT2_R, S_KART_SPIN, S_KART_PAIN, S_KART_SQUISH, diff --git a/src/k_kart.c b/src/k_kart.c index ce7c1832..e60bc02a 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1315,6 +1315,59 @@ void K_LakituChecker(player_t *player) } } +/** \brief Handles the state changing for moving players, moved here to eliminate duplicate code + + \param player player data + + \return void +*/ +void K_KartMoveAnimation(player_t *player) +{ + ticcmd_t *cmd = &player->cmd; + // Standing frames - S_KART_STND1 S_KART_STND1_L S_KART_STND1_R + if (player->speed == 0) + { + if (cmd->buttons & BT_DRIFTRIGHT && !(player->mo->state >= &states[S_KART_STND1_R] && player->mo->state <= &states[S_KART_STND2_R])) + P_SetPlayerMobjState(player->mo, S_KART_STND1_R); + else if (cmd->buttons & BT_DRIFTLEFT && !(player->mo->state >= &states[S_KART_STND1_L] && player->mo->state <= &states[S_KART_STND2_L])) + P_SetPlayerMobjState(player->mo, S_KART_STND1_L); + else if (!(cmd->buttons & BT_DRIFTRIGHT || cmd->buttons & BT_DRIFTLEFT) && !(player->mo->state >= &states[S_KART_STND1] && player->mo->state <= &states[S_KART_STND2])) + P_SetPlayerMobjState(player->mo, S_KART_STND1); + } + // Drifting Left - S_KART_DRIFT1_L + else if (player->kartstuff[k_drift] > 0 && P_IsObjectOnGround(player->mo)) + { + if (!(player->mo->state >= &states[S_KART_DRIFT1_L] && player->mo->state <= &states[S_KART_DRIFT2_L])) + P_SetPlayerMobjState(player->mo, S_KART_DRIFT1_L); + } + // Drifting Right - S_KART_DRIFT1_R + else if (player->kartstuff[k_drift] < 0 && P_IsObjectOnGround(player->mo)) + { + if (!(player->mo->state >= &states[S_KART_DRIFT1_R] && player->mo->state <= &states[S_KART_DRIFT2_R])) + P_SetPlayerMobjState(player->mo, S_KART_DRIFT1_R); + } + // Run frames - S_KART_RUN1 S_KART_RUN1_L S_KART_RUN1_R + else if (player->speed > FixedMul(player->runspeed, player->mo->scale)) + { + if (cmd->buttons & BT_DRIFTRIGHT && !(player->mo->state >= &states[S_KART_RUN1_R] && player->mo->state <= &states[S_KART_RUN2_R])) + P_SetPlayerMobjState(player->mo, S_KART_RUN1_R); + else if (cmd->buttons & BT_DRIFTLEFT && !(player->mo->state >= &states[S_KART_RUN1_L] && player->mo->state <= &states[S_KART_RUN2_L])) + P_SetPlayerMobjState(player->mo, S_KART_RUN1_L); + else if (!(cmd->buttons & BT_DRIFTRIGHT || cmd->buttons & BT_DRIFTLEFT) && !(player->mo->state >= &states[S_KART_RUN1] && player->mo->state <= &states[S_KART_RUN2])) + P_SetPlayerMobjState(player->mo, S_KART_RUN1); + } + // Walk frames - S_KART_WALK1 S_KART_WALK1_L S_KART_WALK1_R + else if (player->speed <= FixedMul(player->runspeed, player->mo->scale)) + { + if (cmd->buttons & BT_DRIFTRIGHT && !(player->mo->state >= &states[S_KART_WALK1_R] && player->mo->state <= &states[S_KART_WALK2_R])) + P_SetPlayerMobjState(player->mo, S_KART_WALK1_R); + else if (cmd->buttons & BT_DRIFTLEFT && !(player->mo->state >= &states[S_KART_WALK1_L] && player->mo->state <= &states[S_KART_WALK2_L])) + P_SetPlayerMobjState(player->mo, S_KART_WALK1_L); + else if (!(cmd->buttons & BT_DRIFTRIGHT || cmd->buttons & BT_DRIFTLEFT) && !(player->mo->state >= &states[S_KART_WALK1] && player->mo->state <= &states[S_KART_WALK2])) + P_SetPlayerMobjState(player->mo, S_KART_WALK1); + } +} + /** \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 diff --git a/src/k_kart.h b/src/k_kart.h index 1cc5e9a1..9319a227 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -16,6 +16,7 @@ UINT8 K_GetKartColorByName(const char *name); void K_RegisterKartStuff(void); void K_KartBouncer(void); +void K_KartMoveAnimation(player_t *player); void K_KartPlayerThink(player_t *player, ticcmd_t *cmd); void K_SpinPlayer(player_t *player, mobj_t *source); void K_SquishPlayer(player_t *player, mobj_t *source); diff --git a/src/m_cheat.c b/src/m_cheat.c index bf069b18..cad35431 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -1279,7 +1279,7 @@ void Command_ObjectPlace_f(void) op_oldmomy = players[0].mo->momy; op_oldmomz = players[0].mo->momz; op_oldheight = players[0].mo->height; - op_oldstate = S_KART_STND; // SRB2kart - was S_PLAY_STND + op_oldstate = S_KART_STND1; // SRB2kart - was S_PLAY_STND op_oldcolor = players[0].mo->color; // save color too in case of super/fireflower // Remove ALL flags and motion. diff --git a/src/p_inter.c b/src/p_inter.c index e059c858..bcf7a8ef 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -906,7 +906,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) P_ResetPlayer(player); - P_SetPlayerMobjState(toucher, S_KART_STND); // SRB2kart - was S_PLAY_FALL1 + P_SetPlayerMobjState(toucher, S_KART_STND1); // SRB2kart - was S_PLAY_FALL1 } } return; @@ -1251,7 +1251,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) if (player->pflags & PF_GLIDING) { player->pflags &= ~(PF_GLIDING|PF_JUMPED); - P_SetPlayerMobjState(toucher, S_KART_STND); // SRB2kart - was S_PLAY_FALL1 + P_SetPlayerMobjState(toucher, S_KART_STND1); // SRB2kart - was S_PLAY_FALL1 } // Play a bounce sound? @@ -1318,7 +1318,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) if (player->pflags & PF_GLIDING) { player->pflags &= ~(PF_GLIDING|PF_JUMPED); - P_SetPlayerMobjState(toucher, S_KART_STND); // SRB2kart - was S_PLAY_FALL1 + P_SetPlayerMobjState(toucher, S_KART_STND1); // SRB2kart - was S_PLAY_FALL1 } // Play a bounce sound? @@ -1374,7 +1374,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) { player->pflags |= PF_MACESPIN; S_StartSound(toucher, sfx_spin); - P_SetPlayerMobjState(toucher, S_KART_STND); // SRB2kart - was S_PLAY_ATK1 + P_SetPlayerMobjState(toucher, S_KART_STND1); // SRB2kart - was S_PLAY_ATK1 } else player->pflags |= PF_ITEMHANG; diff --git a/src/p_mobj.c b/src/p_mobj.c index a44a4035..db812519 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -226,11 +226,11 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state) // Set animation state // The pflags version of this was just as convoluted. // Rewriten for SRB2kart ... though I don't know what this is. - if ((state >= S_KART_STND && state <= S_KART_STND_R) || state == S_KART_SQUISH || state == S_KART_SPIN) + if ((state >= S_KART_STND1 && state <= S_KART_STND2_R) || state == S_KART_SQUISH || state == S_KART_SPIN) player->panim = PA_IDLE; - else if (state >= S_KART_WALK1 && state <= S_KART_WALK_R2) + else if (state >= S_KART_WALK1 && state <= S_KART_WALK2_R) player->panim = PA_WALK; - else if (state >= S_KART_RUN1 && state <= S_KART_DRIFT_R2) + else if (state >= S_KART_RUN1 && state <= S_KART_DRIFT2_R) player->panim = PA_RUN; //else if (state >= S_PLAY_ATK1 && state <= S_PLAY_ATK4) // player->panim = PA_ROLL; @@ -1490,7 +1490,7 @@ static void P_XYFriction(mobj_t *mo, fixed_t oldx, fixed_t oldy) { // if in a walking frame, stop moving if (player->panim == PA_WALK && player->kartstuff[k_spinouttimer] == 0) - P_SetPlayerMobjState(mo, S_KART_STND); // SRB2kart - was S_PLAY_STND + P_SetPlayerMobjState(mo, S_KART_STND1); // SRB2kart - was S_PLAY_STND mo->momx = player->cmomx; mo->momy = player->cmomy; } @@ -2764,7 +2764,7 @@ static void P_PlayerZMovement(mobj_t *mo) // Get up if you fell. if ((mo->state == &states[mo->info->painstate] || mo->state == &states[S_KART_SPIN]) && mo->player->kartstuff[k_spinouttimer] == 0 && mo->player->kartstuff[k_squishedtimer] == 0) // SRB2kart - P_SetPlayerMobjState(mo, S_KART_STND); + P_SetPlayerMobjState(mo, S_KART_STND1); #ifdef ESLOPE if (!mo->standingslope && (mo->eflags & MFE_VERTICALFLIP ? tmceilingslope : tmfloorslope)) { @@ -2877,52 +2877,7 @@ static void P_PlayerZMovement(mobj_t *mo) else if ((mo->player->pflags & PF_JUMPED || (mo->player->pflags & (PF_SPINNING|PF_USEDOWN)) != (PF_SPINNING|PF_USEDOWN) || mo->player->powers[pw_tailsfly]) && (mo->player->kartstuff[k_spinouttimer] == 0)) // SRB2kart { - ticcmd_t *cmd; - - cmd = &mo->player->cmd; - - // Standing frames - S_KART_STND S_KART_STND_L S_KART_STND_R - if (mo->player->speed == 0) - { - if (cmd->buttons & BT_DRIFTRIGHT && !(mo->state == &states[S_KART_STND_R])) - P_SetPlayerMobjState(mo, S_KART_STND_R); - else if (cmd->buttons & BT_DRIFTLEFT && !(mo->state == &states[S_KART_STND_L])) - P_SetPlayerMobjState(mo, S_KART_STND_L); - else if (!(cmd->buttons & BT_DRIFTRIGHT || cmd->buttons & BT_DRIFTLEFT) && !(mo->state == &states[S_KART_STND])) - P_SetPlayerMobjState(mo, S_KART_STND); - } - // Drifting Left - S_KART_DRIFT_L1 - else if (mo->player->kartstuff[k_drift] > 0 && P_IsObjectOnGround(mo)) - { - if (!(mo->state == &states[S_KART_DRIFT_L1] || mo->state == &states[S_KART_DRIFT_L2])) - P_SetPlayerMobjState(mo, S_KART_DRIFT_L1); - } - // Drifting Right - S_KART_DRIFT_R1 - else if (mo->player->kartstuff[k_drift] < 0 && P_IsObjectOnGround(mo)) - { - if (!(mo->state == &states[S_KART_DRIFT_R1] || mo->state == &states[S_KART_DRIFT_R2])) - P_SetPlayerMobjState(mo, S_KART_DRIFT_R1); - } - // Run frames - S_KART_RUN1 S_KART_RUN_L1 S_KART_RUN_R1 - else if (mo->player->speed > FixedMul(mo->player->runspeed, mo->scale)) - { - if (cmd->buttons & BT_DRIFTRIGHT && !(mo->state == &states[S_KART_RUN_R1] || mo->state == &states[S_KART_RUN_R2])) - P_SetPlayerMobjState(mo, S_KART_RUN_R1); - else if (cmd->buttons & BT_DRIFTLEFT && !(mo->state == &states[S_KART_RUN_L1] || mo->state == &states[S_KART_RUN_L2])) - P_SetPlayerMobjState(mo, S_KART_RUN_L1); - else if (!(cmd->buttons & BT_DRIFTRIGHT || cmd->buttons & BT_DRIFTLEFT) && !(mo->state == &states[S_KART_RUN1] || mo->state == &states[S_KART_RUN2])) - P_SetPlayerMobjState(mo, S_KART_RUN1); - } - // Walk frames - S_KART_WALK1 S_KART_WALK_L1 S_KART_WALK_R1 - else if (mo->player->speed <= FixedMul(mo->player->runspeed, mo->scale)) - { - if (cmd->buttons & BT_DRIFTRIGHT && !(mo->state == &states[S_KART_WALK_R1] || mo->state == &states[S_KART_WALK_R2])) - P_SetPlayerMobjState(mo, S_KART_WALK_R1); - else if (cmd->buttons & BT_DRIFTLEFT && !(mo->state == &states[S_KART_WALK_L1] || mo->state == &states[S_KART_WALK_L2])) - P_SetPlayerMobjState(mo, S_KART_WALK_L1); - else if (!(cmd->buttons & BT_DRIFTRIGHT || cmd->buttons & BT_DRIFTLEFT) && !(mo->state == &states[S_KART_WALK1] || mo->state == &states[S_KART_WALK2])) - P_SetPlayerMobjState(mo, S_KART_WALK1); - } + K_KartMoveAnimation(mo->player); } if (mo->player->pflags & PF_JUMPED) @@ -9218,7 +9173,7 @@ void P_AfterPlayerSpawn(INT32 playernum) else p->viewz = p->mo->z + p->viewheight; - P_SetPlayerMobjState(p->mo, S_KART_STND); // SRB2kart - was S_PLAY_STND + P_SetPlayerMobjState(p->mo, S_KART_STND1); // SRB2kart - was S_PLAY_STND p->pflags &= ~PF_SPINNING; if (playernum == consoleplayer) diff --git a/src/p_spec.c b/src/p_spec.c index 275d6f08..a1e2a843 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2784,7 +2784,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) mo->player->rmomx = mo->player->rmomy = 1; mo->player->cmomx = mo->player->cmomy = 0; P_ResetPlayer(mo->player); - P_SetPlayerMobjState(mo, S_KART_STND); // SRB2kart - was S_PLAY_STND + P_SetPlayerMobjState(mo, S_KART_STND1); // SRB2kart - was S_PLAY_STND // Reset bot too. if (bot) { @@ -2795,7 +2795,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) bot->player->rmomx = bot->player->rmomy = 1; bot->player->cmomx = bot->player->cmomy = 0; P_ResetPlayer(bot->player); - P_SetPlayerMobjState(bot, S_KART_STND); // SRB2kart - was S_PLAY_STND + P_SetPlayerMobjState(bot, S_KART_STND1); // SRB2kart - was S_PLAY_STND } } break; diff --git a/src/p_telept.c b/src/p_telept.c index 318ac718..d7248857 100644 --- a/src/p_telept.c +++ b/src/p_telept.c @@ -96,7 +96,7 @@ void P_MixUp(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle, P_ClearStarPost(starpostnum); P_ResetPlayer(thing->player); - P_SetPlayerMobjState(thing, S_KART_STND); // SRB2kart - was S_PLAY_STND + P_SetPlayerMobjState(thing, S_KART_STND1); // SRB2kart - was S_PLAY_STND P_FlashPal(thing->player, PAL_MIXUP, 10); } @@ -169,7 +169,7 @@ boolean P_Teleport(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle thing->player->rmomx = thing->player->rmomy = 0; thing->player->speed = 0; P_ResetPlayer(thing->player); - P_SetPlayerMobjState(thing, S_KART_STND); // SRB2kart - was S_PLAY_STND + P_SetPlayerMobjState(thing, S_KART_STND1); // SRB2kart - was S_PLAY_STND } if (flash) diff --git a/src/p_user.c b/src/p_user.c index a51a1d12..f70d589b 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2836,7 +2836,7 @@ static void P_DoClimbing(player_t *player) // SRB2kart - unused if (player->climbing && P_IsObjectOnGround(player->mo)) { P_ResetPlayer(player); - P_SetPlayerMobjState(player->mo, S_KART_STND); // SRB2kart + P_SetPlayerMobjState(player->mo, S_KART_STND1); // SRB2kart } } @@ -3485,7 +3485,7 @@ static void P_DoSuperStuff(player_t *player) if (!((ALL7EMERALDS(emeralds)) && (player->charflags & SF_SUPER)) && !(ALL7EMERALDS(player->powers[pw_emeralds]))) { player->powers[pw_super] = 0; - P_SetPlayerMobjState(player->mo, S_KART_STND); + P_SetPlayerMobjState(player->mo, S_KART_STND1); P_RestoreMusic(player); P_SpawnShieldOrb(player); @@ -3889,7 +3889,7 @@ static void P_DoSpinDash(player_t *player, ticcmd_t *cmd) // SRB2kart - unused. { player->skidtime = 0; player->pflags &= ~PF_SPINNING; - P_SetPlayerMobjState(player->mo, S_KART_STND); + P_SetPlayerMobjState(player->mo, S_KART_STND1); player->mo->momx = player->cmomx; player->mo->momy = player->cmomy; } @@ -4430,7 +4430,7 @@ static void P_2dMovement(player_t *player) if (player->pflags & PF_SPINNING && !player->exiting) { player->pflags &= ~PF_SPINNING; - P_SetPlayerMobjState(player->mo, S_KART_STND); // SRB2kart - was S_PLAY_STND + P_SetPlayerMobjState(player->mo, S_KART_STND1); // SRB2kart - was S_PLAY_STND } } @@ -4622,7 +4622,7 @@ static void P_3dMovement(player_t *player) if (player->pflags & PF_SPINNING && !player->exiting) { player->pflags &= ~PF_SPINNING; - P_SetPlayerMobjState(player->mo, S_KART_STND); // SRB2kart - was S_PLAY_STND + P_SetPlayerMobjState(player->mo, S_KART_STND1); // SRB2kart - was S_PLAY_STND } } @@ -6657,6 +6657,7 @@ static void P_MovePlayer(player_t *player) // MOVEMENT ANIMATIONS // ///////////////////////// + /* if ((cmd->forwardmove != 0 || cmd->sidemove != 0) || (player->powers[pw_super] && player->mo->z > player->mo->floorz)) { // If the player is moving fast enough, @@ -6668,76 +6669,12 @@ static void P_MovePlayer(player_t *player) else if ((player->rmomx || player->rmomy) && player->panim == PA_IDLE) P_SetPlayerMobjState (player->mo, S_KART_WALK1); // SRB2kart - was S_PLAY_RUN1 } - - //{ SRB2kart - // Kart frames - { - if (player->kartstuff[k_squishedtimer] > 0) - { - if (player->mo->state != &states[S_KART_SQUISH]) - P_SetPlayerMobjState(player->mo, S_KART_SQUISH); - } - else if (player->kartstuff[k_spinouttimer] > 0) - { - if (player->mo->state != &states[S_KART_SPIN]) - P_SetPlayerMobjState(player->mo, S_KART_SPIN); - - player->frameangle -= ANGLE_22h; - } - else if (player->kartstuff[k_spinouttimer] == 0 && player->kartstuff[k_squishedtimer] == 0) - { - // Standing frames - S_KART_STND S_KART_STND_L S_KART_STND_R - if (player->speed == 0) - { - if (cmd->buttons & BT_DRIFTRIGHT && !(player->mo->state == &states[S_KART_STND_R])) - P_SetPlayerMobjState(player->mo, S_KART_STND_R); - else if (cmd->buttons & BT_DRIFTLEFT && !(player->mo->state == &states[S_KART_STND_L])) - P_SetPlayerMobjState(player->mo, S_KART_STND_L); - else if (!(cmd->buttons & BT_DRIFTRIGHT || cmd->buttons & BT_DRIFTLEFT) && !(player->mo->state == &states[S_KART_STND])) - P_SetPlayerMobjState(player->mo, S_KART_STND); - } - // Drifting Left - S_KART_DRIFT_L1 - else if (player->kartstuff[k_drift] > 0 && onground) - { - if (!(player->mo->state == &states[S_KART_DRIFT_L1] || player->mo->state == &states[S_KART_DRIFT_L2])) - P_SetPlayerMobjState(player->mo, S_KART_DRIFT_L1); - } - // Drifting Right - S_KART_DRIFT_R1 - else if (player->kartstuff[k_drift] < 0 && onground) - { - if (!(player->mo->state == &states[S_KART_DRIFT_R1] || player->mo->state == &states[S_KART_DRIFT_R2])) - P_SetPlayerMobjState(player->mo, S_KART_DRIFT_R1); - } - // Run frames - S_KART_RUN1 S_KART_RUN_L1 S_KART_RUN_R1 - else if (player->speed > runspd) - { - if (cmd->buttons & BT_DRIFTRIGHT && !(player->mo->state == &states[S_KART_RUN_R1] || player->mo->state == &states[S_KART_RUN_R2])) - P_SetPlayerMobjState(player->mo, S_KART_RUN_R1); - else if (cmd->buttons & BT_DRIFTLEFT && !(player->mo->state == &states[S_KART_RUN_L1] || player->mo->state == &states[S_KART_RUN_L2])) - P_SetPlayerMobjState(player->mo, S_KART_RUN_L1); - else if (!(cmd->buttons & BT_DRIFTRIGHT || cmd->buttons & BT_DRIFTLEFT) && !(player->mo->state == &states[S_KART_RUN1] || player->mo->state == &states[S_KART_RUN2])) - P_SetPlayerMobjState(player->mo, S_KART_RUN1); - } - // Walk frames - S_KART_WALK1 S_KART_WALK_L1 S_KART_WALK_R1 - else if (player->speed <= runspd) - { - if (cmd->buttons & BT_DRIFTRIGHT && !(player->mo->state == &states[S_KART_WALK_R1] || player->mo->state == &states[S_KART_WALK_R2])) - P_SetPlayerMobjState(player->mo, S_KART_WALK_R1); - else if (cmd->buttons & BT_DRIFTLEFT && !(player->mo->state == &states[S_KART_WALK_L1] || player->mo->state == &states[S_KART_WALK_L2])) - P_SetPlayerMobjState(player->mo, S_KART_WALK_L1); - else if (!(cmd->buttons & BT_DRIFTRIGHT || cmd->buttons & BT_DRIFTLEFT) && !(player->mo->state == &states[S_KART_WALK1] || player->mo->state == &states[S_KART_WALK2])) - P_SetPlayerMobjState(player->mo, S_KART_WALK1); - } - - player->frameangle = player->mo->angle; - } - } - //} + */ // If your running animation is playing, and you're // going too slow, switch back to the walking frames. - if (player->panim == PA_RUN && player->speed < runspd && player->kartstuff[k_spinouttimer] == 0) - P_SetPlayerMobjState(player->mo, S_KART_WALK1); // SRB2kart - was S_PLAY_RUN1 + //if (player->panim == PA_RUN && player->speed < runspd && player->kartstuff[k_spinouttimer] == 0) + //P_SetPlayerMobjState(player->mo, S_KART_WALK1); // SRB2kart - was S_PLAY_RUN1 // If Springing, but travelling DOWNWARD, change back! //if (player->mo->state == &states[S_PLAY_SPRING] && P_MobjFlip(player->mo)*player->mo->momz < 0) @@ -6746,11 +6683,32 @@ static void P_MovePlayer(player_t *player) //else if (onground && (player->mo->state == &states[S_PLAY_SPRING] || player->panim == PA_FALL || player->mo->state == &states[S_PLAY_CARRY]) && !player->mo->momz) // P_SetPlayerMobjState(player->mo, S_PLAY_STND); + // Kart frames + if (player->kartstuff[k_squishedtimer] > 0) + { + if (player->mo->state != &states[S_KART_SQUISH]) + P_SetPlayerMobjState(player->mo, S_KART_SQUISH); + } + else if (player->kartstuff[k_spinouttimer] > 0) + { + if (player->mo->state != &states[S_KART_SPIN]) + P_SetPlayerMobjState(player->mo, S_KART_SPIN); + + player->frameangle -= ANGLE_22h; + } + else if (player->kartstuff[k_spinouttimer] == 0 && player->kartstuff[k_squishedtimer] == 0) + { + K_KartMoveAnimation(player); + + player->frameangle = player->mo->angle; + } + + player->mo->movefactor = FRACUNIT; // We're not going to do any more with this, so let's change it back for the next frame. // If you are stopped and are still walking, stand still! if (!player->mo->momx && !player->mo->momy && !player->mo->momz && player->panim == PA_WALK) - P_SetPlayerMobjState(player->mo, S_KART_STND); // SRB2kart - was S_PLAY_STND + P_SetPlayerMobjState(player->mo, S_KART_STND1); // SRB2kart - was S_PLAY_STND //{ SRB2kart // Engine Sounds. @@ -6797,7 +6755,7 @@ static void P_MovePlayer(player_t *player) player->jumping = 0; player->secondjump = 0; player->pflags &= ~PF_THOKKED; - P_SetPlayerMobjState(player->mo, S_KART_STND); // SRB2kart - was S_PLAY_STND + P_SetPlayerMobjState(player->mo, S_KART_STND1); // SRB2kart - was S_PLAY_STND } // Cap the speed limit on a spindash @@ -9480,7 +9438,7 @@ void P_PlayerThink(player_t *player) if (player->powers[pw_ingoop]) { - if (player->mo->state == &states[S_KART_STND]) // SRB2kart - was S_PLAY_STND + if (player->mo->state == &states[S_KART_STND1]) // SRB2kart - was S_PLAY_STND player->mo->tics = 2; player->powers[pw_ingoop]--;