mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-18 23:41:48 +00:00
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
This commit is contained in:
parent
28ec48c02c
commit
81a077b9af
12 changed files with 37 additions and 35 deletions
|
@ -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.
|
||||
|
|
|
@ -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",
|
||||
/*
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
/*
|
||||
|
|
|
@ -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,
|
||||
/*
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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"))
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue