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/d_player.h b/src/d_player.h index f0360f30..7cb28aa9 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -371,6 +371,8 @@ typedef struct player_s // SRB2kart stuff INT32 kartstuff[NUMKARTSTUFF]; + angle_t frameangle; // for the player add the ability to have the sprite only face other angles + // Bit flags. // See pflags_t, above. pflags_t pflags; diff --git a/src/dehacked.c b/src/dehacked.c index 82786d17..2991286a 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -3804,33 +3804,29 @@ 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_SPIN1", - "S_KART_SPIN2", - "S_KART_SPIN3", - "S_KART_SPIN4", - "S_KART_SPIN5", - "S_KART_SPIN6", - "S_KART_SPIN7", - "S_KART_SPIN8", + "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 4d2c386a..6637a77d 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -87,7 +87,7 @@ boolean modifiedgame; // Set if homebrew PWAD stuff has been added. boolean savemoddata = false; UINT8 paused; UINT8 modeattacking = ATTACKING_NONE; -boolean disableSpeedAdjust = false; +boolean disableSpeedAdjust = true; boolean imcontinuing = false; boolean runemeraldmanager = false; @@ -5473,7 +5473,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_main.c b/src/hardware/hw_main.c index ac601c9f..a4785f12 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -5144,7 +5144,12 @@ static void HWR_ProjectSprite(mobj_t *thing) } } else if (sprframe->rotate != SRF_SINGLE) - ang = R_PointToAngle (thing->x, thing->y) - thing->angle; + { + if (thing->player) + ang = R_PointToAngle (thing->x, thing->y) - thing->player->frameangle; + else + ang = R_PointToAngle (thing->x, thing->y) - thing->angle; + } if (sprframe->rotate == SRF_SINGLE) { diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index e61177e8..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]; @@ -1501,7 +1500,11 @@ void HWR_DrawMD2(gr_vissprite_t *spr) if (sprframe->rotate) { - const fixed_t anglef = AngleFixed(spr->mobj->angle); + fixed_t anglef; + if (spr->mobj->player) + anglef = AngleFixed(spr->mobj->player->frameangle); + else + anglef = AngleFixed(spr->mobj->angle); p.angley = FIXED_TO_FLOAT(anglef); } else diff --git a/src/info.c b/src/info.c index e9e5548e..f532187d 100644 --- a/src/info.c +++ b/src/info.c @@ -87,35 +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, 2, {NULL}, 0, 0, S_KART_SPIN2}, // S_KART_SPIN1 N - {SPR_PLAY, 14, 2, {NULL}, 0, 0, S_KART_SPIN3}, // S_KART_SPIN2 O - {SPR_PLAY, 15, 2, {NULL}, 0, 0, S_KART_SPIN4}, // S_KART_SPIN3 P - {SPR_PLAY, 16, 2, {NULL}, 0, 0, S_KART_SPIN5}, // S_KART_SPIN4 Q - {SPR_PLAY, 17, 2, {NULL}, 0, 0, S_KART_SPIN6}, // S_KART_SPIN5 R - {SPR_PLAY, 18, 2, {NULL}, 0, 0, S_KART_SPIN7}, // S_KART_SPIN6 S - {SPR_PLAY, 19, 2, {NULL}, 0, 0, S_KART_SPIN8}, // S_KART_SPIN7 T - {SPR_PLAY, 20, 2, {NULL}, 0, 0, S_KART_SPIN1}, // S_KART_SPIN8 U - {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, 1, {NULL}, 0, 0, S_KART_WALK2}, // S_KART_WALK1 G + {SPR_PLAY, 7, 1, {NULL}, 0, 0, S_KART_WALK1}, // S_KART_WALK2 H + {SPR_PLAY, 8, 1, {NULL}, 0, 0, S_KART_WALK2_L}, // S_KART_WALK1_L I + {SPR_PLAY, 9, 1, {NULL}, 0, 0, S_KART_WALK1_L}, // S_KART_WALK2_L J + {SPR_PLAY, 10, 1, {NULL}, 0, 0, S_KART_WALK2_R}, // S_KART_WALK1_R K + {SPR_PLAY, 11, 1, {NULL}, 0, 0, S_KART_WALK1_R}, // S_KART_WALK2_R L + {SPR_PLAY, 12, 1, {NULL}, 0, 0, S_KART_RUN2}, // S_KART_RUN1 M + {SPR_PLAY, 13, 1, {NULL}, 0, 0, S_KART_RUN1}, // S_KART_RUN2 N + {SPR_PLAY, 14, 1, {NULL}, 0, 0, S_KART_RUN2_L}, // S_KART_RUN1_L O + {SPR_PLAY, 15, 1, {NULL}, 0, 0, S_KART_RUN1_L}, // S_KART_RUN2_L P + {SPR_PLAY, 16, 1, {NULL}, 0, 0, S_KART_RUN2_R}, // S_KART_RUN1_R Q + {SPR_PLAY, 17, 1, {NULL}, 0, 0, S_KART_RUN1_R}, // S_KART_RUN2_R R + {SPR_PLAY, 18, 1, {NULL}, 0, 0, S_KART_DRIFT2_L}, // S_KART_DRIFT1_L S + {SPR_PLAY, 19, 1, {NULL}, 0, 0, S_KART_DRIFT1_L}, // S_KART_DRIFT2_L T + {SPR_PLAY, 20, 1, {NULL}, 0, 0, S_KART_DRIFT2_R}, // S_KART_DRIFT1_R U + {SPR_PLAY, 21, 1, {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 @@ -2845,9 +2841,9 @@ state_t states[NUMSTATES] = {SPR_SHAD, FF_TRANS50, -1, {NULL}, 0, 0, S_NULL}, // S_SHADOW {SPR_SHAD, FF_FULLBRIGHT|FF_TRANS50|1, -1, {NULL}, 0, 0, S_NULL}, // S_WHITESHADOW - {SPR_BUMP, 0, 3, {NULL}, 0, 0, S_BUMP2}, // S_BUMP1 - {SPR_BUMP, 1, 3, {NULL}, 0, 0, S_BUMP3}, // S_BUMP2 - {SPR_BUMP, 2, 3, {NULL}, 0, 0, S_NULL}, // S_BUMP3 + {SPR_BUMP, FF_FULLBRIGHT, 3, {NULL}, 0, 0, S_BUMP2}, // S_BUMP1 + {SPR_BUMP, FF_FULLBRIGHT|1, 3, {NULL}, 0, 0, S_BUMP3}, // S_BUMP2 + {SPR_BUMP, FF_FULLBRIGHT|2, 3, {NULL}, 0, 0, S_NULL}, // S_BUMP3 {SPR_FLEN, FF_FULLBRIGHT, 3, {NULL}, 0, 0, S_FLINGENERGY2}, // S_FLINGENERGY1, {SPR_FLEN, FF_FULLBRIGHT|1, 3, {NULL}, 0, 0, S_FLINGENERGY3}, // S_FLINGENERGY2, @@ -2860,10 +2856,10 @@ state_t states[NUMSTATES] = {SPR_CLAS, FF_FULLBRIGHT|FF_TRANS30|4, 2, {NULL}, 0, 0, S_CLASH6}, // S_CLASH5 {SPR_CLAS, FF_FULLBRIGHT|FF_TRANS30|5, 2, {NULL}, 0, 0, S_NULL}, // S_CLASH6 - {SPR_PSHW, 0, 3, {NULL}, 0, 0, S_FIREDITEM2}, // S_FIREDITEM1 - {SPR_PSHW, 1, 3, {NULL}, 0, 0, S_FIREDITEM3}, // S_FIREDITEM2 - {SPR_PSHW, 2, 3, {NULL}, 0, 0, S_FIREDITEM4}, // S_FIREDITEM3 - {SPR_PSHW, 3, 3, {NULL}, 0, 0, S_NULL}, // S_FIREDITEM4 + {SPR_PSHW, FF_FULLBRIGHT, 3, {NULL}, 0, 0, S_FIREDITEM2}, // S_FIREDITEM1 + {SPR_PSHW, FF_FULLBRIGHT|1, 3, {NULL}, 0, 0, S_FIREDITEM3}, // S_FIREDITEM2 + {SPR_PSHW, FF_FULLBRIGHT|2, 3, {NULL}, 0, 0, S_FIREDITEM4}, // S_FIREDITEM3 + {SPR_PSHW, FF_FULLBRIGHT|3, 3, {NULL}, 0, 0, S_NULL}, // S_FIREDITEM4 // Above player arrow {SPR_ARRO, FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_NULL}, // S_PLAYERARROW @@ -2977,7 +2973,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 be4a58f2..2624f16e 100644 --- a/src/info.h +++ b/src/info.h @@ -648,33 +648,29 @@ 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_SPIN1, - S_KART_SPIN2, - S_KART_SPIN3, - S_KART_SPIN4, - S_KART_SPIN5, - S_KART_SPIN6, - S_KART_SPIN7, - S_KART_SPIN8, + 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 d558fc23..4fcca8ab 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1283,6 +1283,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 @@ -1588,7 +1641,6 @@ fixed_t K_3dKartMovement(player_t *player, boolean onground, fixed_t forwardmove void K_SpinPlayer(player_t *player, mobj_t *source) { - //(void) source; if (player->health <= 0) return; @@ -1597,6 +1649,12 @@ void K_SpinPlayer(player_t *player, mobj_t *source) || (gametype != GT_RACE && (player->kartstuff[k_balloon] <= 0 && player->kartstuff[k_comebacktimer]))) return; + if (source && source->player && !source->player->kartstuff[k_sounds]) + { + S_StartSound(source, sfx_hitem); + source->player->kartstuff[k_sounds] = 50; + } + player->kartstuff[k_mushroomtimer] = 0; player->kartstuff[k_driftboost] = 0; player->kartstuff[k_comebacktimer] = comebacktime; @@ -1637,8 +1695,8 @@ void K_SpinPlayer(player_t *player, mobj_t *source) player->kartstuff[k_spinout] = player->kartstuff[k_spinouttimer]; - if (!(player->mo->state >= &states[S_KART_SPIN1] && player->mo->state <= &states[S_KART_SPIN8])) - P_SetPlayerMobjState(player->mo, S_KART_SPIN1); + if (player->mo->state != &states[S_KART_SPIN]) + P_SetPlayerMobjState(player->mo, S_KART_SPIN); player->kartstuff[k_spinouttype] = 0; @@ -1647,7 +1705,6 @@ void K_SpinPlayer(player_t *player, mobj_t *source) void K_SquishPlayer(player_t *player, mobj_t *source) { - //(void) source; if (player->health <= 0) return; @@ -1692,7 +1749,6 @@ void K_SquishPlayer(player_t *player, mobj_t *source) void K_ExplodePlayer(player_t *player, mobj_t *source) // A bit of a hack, we just throw the player up higher here and extend their spinout timer { - //(void) source; if (player->health <= 0) return; @@ -1730,8 +1786,8 @@ void K_ExplodePlayer(player_t *player, mobj_t *source) // A bit of a hack, we ju player->powers[pw_flashing] = flashingtics; - if (!(player->mo->state >= &states[S_KART_SPIN1] && player->mo->state <= &states[S_KART_SPIN8])) - P_SetPlayerMobjState(player->mo, S_KART_SPIN1); + if (player->mo->state != &states[S_KART_SPIN]) + P_SetPlayerMobjState(player->mo, S_KART_SPIN); player->kartstuff[k_spinouttype] = 0; @@ -1753,7 +1809,6 @@ void K_StealBalloon(player_t *player, player_t *victim) fixed_t newx, newy; mobj_t *newmo; - //(void) source; if (gametype == GT_RACE) return; diff --git a/src/k_kart.h b/src/k_kart.h index 8e5a9186..86820dda 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -16,7 +16,8 @@ UINT8 K_GetKartColorByName(const char *name); void K_RegisterKartStuff(void); UINT8 K_GetKartCC(void); -void K_KartBilliards(mobj_t *mobj1, mobj_t *mobj2, boolean bounce); +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/lua_playerlib.c b/src/lua_playerlib.c index 06cc69e0..d6de2e24 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -130,6 +130,8 @@ static int player_get(lua_State *L) LUA_PushUserdata(L, plr->powers, META_POWERS); else if (fastcmp(field,"kartstuff")) LUA_PushUserdata(L, plr->kartstuff, META_KARTSTUFF); + else if (fastcmp(field,"frameangle")) + lua_pushangle(L, plr->frameangle); else if (fastcmp(field,"pflags")) lua_pushinteger(L, plr->pflags); else if (fastcmp(field,"panim")) 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 3e3899a2..a75c4e53 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -924,7 +924,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; @@ -1269,7 +1269,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? @@ -1336,7 +1336,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? @@ -1392,7 +1392,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 5d1206dd..b11ca79b 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_SPIN1 && state <= S_KART_SPIN8)) + 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; @@ -1494,7 +1494,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; } @@ -1813,7 +1813,7 @@ void P_XYMovement(mobj_t *mo) } else if (player || mo->flags & (MF_SLIDEME|MF_PUSHABLE)) { // try to slide along it - P_SlideMove(mo); + P_SlideMove(mo, false); xmove = ymove = 0; } else if (mo->type == MT_SPINFIRE) @@ -1994,7 +1994,7 @@ static void P_RingXYMovement(mobj_t *mo) I_Assert(!P_MobjWasRemoved(mo)); if (!P_SceneryTryMove(mo, mo->x + mo->momx, mo->y + mo->momy)) - P_SlideMove(mo); + P_SlideMove(mo, false); } static void P_SceneryXYMovement(mobj_t *mo) @@ -2008,7 +2008,7 @@ static void P_SceneryXYMovement(mobj_t *mo) oldy = mo->y; if (!P_SceneryTryMove(mo, mo->x + mo->momx, mo->y + mo->momy)) - P_SlideMove(mo); + P_SlideMove(mo, false); if ((!(mo->eflags & MFE_VERTICALFLIP) && mo->z > mo->floorz) || (mo->eflags & MFE_VERTICALFLIP && mo->z+mo->height < mo->ceilingz)) return; // no friction when airborne @@ -2766,9 +2766,9 @@ static void P_PlayerZMovement(mobj_t *mo) goto nightsdone; } // Get up if you fell. - if ((mo->state == &states[mo->info->painstate] || (mo->state >= &states[S_KART_SPIN1] && mo->state <= &states[S_KART_SPIN8])) + 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)) { @@ -2881,52 +2881,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) @@ -6623,14 +6578,13 @@ void P_MobjThinker(mobj_t *mobj) // Shrink your items if the player shrunk too. mobj->scale = mobj->target->scale; - P_UnsetThingPosition(mobj); - { - const angle_t fa = mobj->angle>>ANGLETOFINESHIFT; - mobj->x = mobj->target->x + FixedMul(FINECOSINE(fa),radius); - mobj->y = mobj->target->y + FixedMul(FINESINE(fa), radius); - mobj->z = mobj->target->z + HEIGHT; - P_SetThingPosition(mobj); - } + P_TeleportMove(mobj, mobj->target->x, mobj->target->y, mobj->target->z); + mobj->momx = FixedMul(FINECOSINE(mobj->angle>>ANGLETOFINESHIFT),radius); + mobj->momy = FixedMul(FINESINE(mobj->angle>>ANGLETOFINESHIFT), radius); + if (!P_TryMove(mobj, mobj->target->x + mobj->momx, mobj->target->y + mobj->momy, false)) + P_SlideMove(mobj, true); + mobj->z = mobj->floorz; + mobj->momx = mobj->momy = 0; // Was this so hard? if ((mobj->type == MT_GREENSHIELD && !(mobj->target->player->kartstuff[k_greenshell] & 1)) @@ -9530,7 +9484,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_saveg.c b/src/p_saveg.c index d813337b..847ba1a9 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -139,6 +139,8 @@ static void P_NetArchivePlayers(void) for (j = 0; j < NUMKARTSTUFF; j++) WRITEINT32(save_p, players[i].kartstuff[j]); + WRITEANGLE(save_p, players[i].frameangle); + WRITEUINT8(save_p, players[i].playerstate); WRITEUINT32(save_p, players[i].pflags); WRITEUINT8(save_p, players[i].panim); @@ -320,6 +322,8 @@ static void P_NetUnArchivePlayers(void) for (j = 0; j < NUMKARTSTUFF; j++) players[i].kartstuff[j] = READINT32(save_p); + players[i].frameangle = READANGLE(save_p); + players[i].playerstate = READUINT8(save_p); players[i].pflags = READUINT32(save_p); players[i].panim = READUINT8(save_p); diff --git a/src/p_spec.c b/src/p_spec.c index 40c60d9f..8830e007 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 935d61bd..e56ee5f3 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2833,7 +2833,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 } } @@ -3482,7 +3482,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); @@ -3886,7 +3886,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; } @@ -4427,7 +4427,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 } } @@ -4619,7 +4619,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 } } @@ -6654,6 +6654,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, @@ -6665,72 +6666,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_SPIN1] && player->mo->state <= &states[S_KART_SPIN8])) - P_SetPlayerMobjState(player->mo, S_KART_SPIN1); - } - 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); - } - } - } - //} + */ // 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) @@ -6739,11 +6680,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. @@ -6790,7 +6752,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 @@ -9455,7 +9417,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]--; diff --git a/src/r_things.c b/src/r_things.c index 7a7573ec..292bc5fd 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1210,7 +1210,10 @@ static void R_ProjectSprite(mobj_t *thing) if (sprframe->rotate != SRF_SINGLE || papersprite) { - ang = R_PointToAngle (thing->x, thing->y) - thing->angle; + if (thing->player) + ang = R_PointToAngle (thing->x, thing->y) - thing->player->frameangle; + else + ang = R_PointToAngle (thing->x, thing->y) - thing->angle; if (papersprite) ang_scale = abs(FINESINE(ang>>ANGLETOFINESHIFT)); } diff --git a/src/sounds.c b/src/sounds.c index 9e50bb84..75b5e259 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -506,11 +506,12 @@ sfxinfo_t S_sfx[NUMSFX] = // SRB2kart - Skin sounds {"kwin", false, 64, 0, -1, NULL, 0, SKSWIN, -1, LUMPERROR}, {"klose", false, 64, 0, -1, NULL, 0, SKSLOSE, -1, LUMPERROR}, - {"slow", false, 128, 0, -1, NULL, 0, SKSSLOW, -1, LUMPERROR}, - {"taunt1", false, 64, 64, -1, NULL, 0, SKSPLTNT1, -1, LUMPERROR}, - {"taunt2", false, 64, 64, -1, NULL, 0, SKSPLTNT2, -1, LUMPERROR}, - {"taunt3", false, 64, 64, -1, NULL, 0, SKSPLTNT3, -1, LUMPERROR}, - {"taunt4", false, 64, 64, -1, NULL, 0, SKSPLTNT4, -1, LUMPERROR}, + {"slow", false, 128, 32, -1, NULL, 0, SKSSLOW, -1, LUMPERROR}, + {"taunt1", false, 64, 96, -1, NULL, 0, SKSPLTNT1, -1, LUMPERROR}, + {"taunt2", false, 64, 96, -1, NULL, 0, SKSPLTNT2, -1, LUMPERROR}, + {"taunt3", false, 64, 96, -1, NULL, 0, SKSPLTNT3, -1, LUMPERROR}, + {"taunt4", false, 64, 96, -1, NULL, 0, SKSPLTNT4, -1, LUMPERROR}, + {"hitem", false, 64, 32, -1, NULL, 0, SKSHITEM, -1, LUMPERROR}, // skin sounds free slots to add sounds at run time (Boris HACK!!!) // initialized to NULL diff --git a/src/sounds.h b/src/sounds.h index c61ddfb0..20084985 100644 --- a/src/sounds.h +++ b/src/sounds.h @@ -46,6 +46,7 @@ typedef enum SKSPLTNT2, SKSPLTNT3, SKSPLTNT4, + SKSHITEM, NUMSKINSOUNDS } skinsound_t; @@ -583,6 +584,7 @@ typedef enum sfx_taunt2, sfx_taunt3, sfx_taunt4, + sfx_hitem, // free slots for S_AddSoundFx() at run-time -------------------- sfx_freeslot0,