From 28ec48c02ccc8c5deb97b535be4ab70aac323731 Mon Sep 17 00:00:00 2001 From: Sryder13 Date: Sat, 4 Nov 2017 13:33:38 +0000 Subject: [PATCH 1/6] Make the bump and item throw graphics fullbright. --- src/info.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/info.c b/src/info.c index dcc932db..62a7f565 100644 --- a/src/info.c +++ b/src/info.c @@ -2841,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, @@ -2856,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 #ifdef SEENAMES {SPR_NULL, 0, 1, {NULL}, 0, 0, S_NULL}, // S_NAMECHECK From 81a077b9af6828f8e4389a1a86866bcb9cee1ca5 Mon Sep 17 00:00:00 2001 From: Sryder13 Date: Sat, 4 Nov 2017 14:07:53 +0000 Subject: [PATCH 2/6] New player frameangle used instead of mobj angle for players Set to mobj angle except when spinning where it's set to spin Only 1 spin frame needed now --- src/d_player.h | 1 + src/dehacked.c | 9 +-------- src/hardware/hw_main.c | 7 ++++++- src/hardware/hw_md2.c | 6 +++++- src/info.c | 9 +-------- src/info.h | 9 +-------- src/k_kart.c | 8 ++++---- src/lua_playerlib.c | 2 ++ src/p_mobj.c | 4 ++-- src/p_saveg.c | 4 ++++ src/p_user.c | 8 ++++++-- src/r_things.c | 5 ++++- 12 files changed, 37 insertions(+), 35 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 12061c36..a84c2ccd 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -366,6 +366,7 @@ typedef struct player_s // SRB2kart stuff INT32 kartstuff[NUMKARTSTUFF]; boolean collide[MAXPLAYERS]; + angle_t frameangle; // for the player add the ability to have the sprite only face other angles // Bit flags. // See pflags_t, above. diff --git a/src/dehacked.c b/src/dehacked.c index 93029b6c..6c35a66d 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -3823,14 +3823,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "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_SPIN", "S_KART_PAIN", "S_KART_SQUISH", /* 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..caa46edd 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1501,7 +1501,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 62a7f565..83fb784c 100644 --- a/src/info.c +++ b/src/info.c @@ -106,14 +106,7 @@ state_t states[NUMSTATES] = {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, -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 /* diff --git a/src/info.h b/src/info.h index c1a9e1b1..0bb5272f 100644 --- a/src/info.h +++ b/src/info.h @@ -662,14 +662,7 @@ typedef enum state 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_SPIN, S_KART_PAIN, S_KART_SQUISH, /* diff --git a/src/k_kart.c b/src/k_kart.c index 75b6a652..ce7c1832 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1640,8 +1640,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; @@ -1697,8 +1697,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; diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index 44a27cd1..55ceaa18 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -132,6 +132,8 @@ static int player_get(lua_State *L) LUA_PushUserdata(L, plr->kartstuff, META_KARTSTUFF); else if (fastcmp(field,"collide")) LUA_PushUserdata(L, plr->collide, META_COLLIDE); + 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/p_mobj.c b/src/p_mobj.c index 5e2c25f3..a44a4035 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -226,7 +226,7 @@ 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_STND && state <= S_KART_STND_R) || state == S_KART_SQUISH || state == S_KART_SPIN) player->panim = PA_IDLE; else if (state >= S_KART_WALK1 && state <= S_KART_WALK_R2) player->panim = PA_WALK; @@ -2762,7 +2762,7 @@ 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); diff --git a/src/p_saveg.c b/src/p_saveg.c index e04ee39c..d5a84136 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -141,6 +141,8 @@ static void P_NetArchivePlayers(void) for (j = 0; j < MAXPLAYERS; j++) WRITEUINT8(save_p, players[i].collide[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); @@ -324,6 +326,8 @@ static void P_NetUnArchivePlayers(void) for (j = 0; j < MAXPLAYERS; j++) players[i].collide[j] = (boolean)READUINT8(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_user.c b/src/p_user.c index 007e3a55..a51a1d12 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -6679,8 +6679,10 @@ static void P_MovePlayer(player_t *player) } 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); + 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) { @@ -6726,6 +6728,8 @@ static void P_MovePlayer(player_t *player) 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; } } //} diff --git a/src/r_things.c b/src/r_things.c index 0643dfd5..2be08001 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)); } From c9ddb7a4b54a30d82428b80eff7ab64f6d258a03 Mon Sep 17 00:00:00 2001 From: Sryder13 Date: Sat, 4 Nov 2017 17:32:47 +0000 Subject: [PATCH 3/6] Re-add lost player vibration frames Separate sprites for fast moving frames Rename some frames for a more sensible naming convention --- src/b_bot.c | 4 +- src/dehacked.c | 33 +++++++------ src/g_game.c | 2 +- src/hardware/hw_md2.c | 3 +- src/info.c | 49 ++++++++++--------- src/info.h | 33 +++++++------ src/k_kart.c | 53 +++++++++++++++++++++ src/k_kart.h | 1 + src/m_cheat.c | 2 +- src/p_inter.c | 8 ++-- src/p_mobj.c | 59 +++-------------------- src/p_spec.c | 4 +- src/p_telept.c | 4 +- src/p_user.c | 108 +++++++++++++----------------------------- 14 files changed, 169 insertions(+), 194 deletions(-) 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]--; From 33beff0d5fe3eeb0774edb7d06cb2aac396beff6 Mon Sep 17 00:00:00 2001 From: Sryder13 Date: Sat, 4 Nov 2017 17:49:14 +0000 Subject: [PATCH 4/6] Slow and Fast states use 1 tic duration animation Disable adjusting of frame speed (can be re-enabled through MAINCFG if people want it for whatever reason) --- src/g_game.c | 2 +- src/info.c | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index ecd456fb..bc391e77 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; diff --git a/src/info.c b/src/info.c index c21aad35..43b293c4 100644 --- a/src/info.c +++ b/src/info.c @@ -93,18 +93,18 @@ state_t states[NUMSTATES] = {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, 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, 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 From 51af54d0ffa47b3b55750eb044b47fac4d94ef78 Mon Sep 17 00:00:00 2001 From: Sryder13 Date: Sat, 4 Nov 2017 20:42:01 +0000 Subject: [PATCH 5/6] Voices for when you hit someone else Not totally sure on them, but it's worth a try, would make it more obvious when you hit someone with a trap item in battle anyway --- src/k_kart.c | 7 ++++++- src/sounds.c | 11 ++++++----- src/sounds.h | 2 ++ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index e60bc02a..a6afef1e 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1662,7 +1662,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; @@ -1670,6 +1669,12 @@ void K_SpinPlayer(player_t *player, mobj_t *source) || player->kartstuff[k_startimer] > 0 || player->kartstuff[k_growshrinktimer] > 0 || player->kartstuff[k_bootaketimer] > 0) 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; 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, From bb35f222c9ba03e51b988ac2da5476a616d67b50 Mon Sep 17 00:00:00 2001 From: Sryder13 Date: Sat, 4 Nov 2017 21:58:21 +0000 Subject: [PATCH 6/6] 1 tid duration on drifting too --- src/info.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/info.c b/src/info.c index 43b293c4..0c241613 100644 --- a/src/info.c +++ b/src/info.c @@ -105,10 +105,10 @@ state_t states[NUMSTATES] = {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, 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, 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