mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-30 21:20:54 +00:00
* Add Skid SPR2/state in preperation for directionchar.
* Clean up spr2 md2 code. * Experimented but then commented out some stuff for homing attack.
This commit is contained in:
parent
79dab78fd3
commit
3c785cbe94
6 changed files with 23 additions and 14 deletions
|
@ -3356,6 +3356,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
|
|||
"S_PLAY_STND",
|
||||
"S_PLAY_WAIT",
|
||||
"S_PLAY_WALK",
|
||||
"S_PLAY_SKID",
|
||||
"S_PLAY_RUN",
|
||||
"S_PLAY_DASH",
|
||||
"S_PLAY_PAIN",
|
||||
|
|
|
@ -1313,29 +1313,28 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
|||
{
|
||||
UINT8 spr2 = P_GetModelSprite2(md2, spr->mobj->skin, spr->mobj->sprite2, spr->mobj->player);
|
||||
UINT8 mod = md2->model->spr2frames[spr2*2 + 1] ? md2->model->spr2frames[spr2*2 + 1] : md2->model->header.numFrames;
|
||||
if (mod > ((skin_t *)spr->mobj->skin)->sprites[spr2].numframes)
|
||||
mod = ((skin_t *)spr->mobj->skin)->sprites[spr2].numframes;
|
||||
//FIXME: this is not yet correct
|
||||
frame = md2->model->spr2frames[spr2*2] + ((spr->mobj->frame & FF_FRAMEMASK) % mod);
|
||||
frame = (spr->mobj->frame & FF_FRAMEMASK);
|
||||
if (frame >= mod)
|
||||
frame = 0;
|
||||
buff = md2->model->glCommandBuffer;
|
||||
curr = &md2->model->frames[frame];
|
||||
curr = &md2->model->frames[md2->model->spr2frames[spr2*2] + frame];
|
||||
if (cv_grmd2.value == 1 && tics <= INTERPOLERATION_LIMIT)
|
||||
{
|
||||
if (durs > INTERPOLERATION_LIMIT)
|
||||
durs = INTERPOLERATION_LIMIT;
|
||||
|
||||
if (spr->mobj->player && spr->mobj->player->skidtime && spr->mobj->state-states == S_PLAY_WALK) // temporary hack
|
||||
;
|
||||
else if (spr->mobj->frame & FF_ANIMATE
|
||||
if (spr->mobj->frame & FF_ANIMATE
|
||||
|| (spr->mobj->state->nextstate != S_NULL
|
||||
&& states[spr->mobj->state->nextstate].sprite == spr->mobj->sprite
|
||||
&& (states[spr->mobj->state->nextstate].frame & FF_FRAMEMASK) == spr->mobj->sprite2))
|
||||
{
|
||||
UINT32 nextframe = (spr->mobj->frame & FF_FRAMEMASK) + 1;
|
||||
nextframe %= mod;
|
||||
if (nextframe || !(spr->mobj->state->frame & FF_SPR2ENDSTATE))
|
||||
{
|
||||
nextframe += md2->model->spr2frames[spr2*2];
|
||||
next = &md2->model->frames[nextframe];
|
||||
}
|
||||
if (++frame >= mod)
|
||||
frame = 0;
|
||||
if (frame || !(spr->mobj->state->frame & FF_SPR2ENDSTATE))
|
||||
next = &md2->model->frames[md2->model->spr2frames[spr2*2] + frame];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -405,6 +405,7 @@ char spr2names[NUMPLAYERSPRITES][5] =
|
|||
"STND",
|
||||
"WAIT",
|
||||
"WALK",
|
||||
"SKID",
|
||||
"RUN_",
|
||||
"DASH",
|
||||
"PAIN",
|
||||
|
@ -487,6 +488,7 @@ playersprite_t spr2defaults[NUMPLAYERSPRITES] = {
|
|||
0, // SPR2_STND,
|
||||
0, // SPR2_WAIT,
|
||||
0, // SPR2_WALK,
|
||||
SPR2_WALK, // SPR2_SKID,
|
||||
SPR2_WALK, // SPR2_RUN ,
|
||||
SPR2_FRUN, // SPR2_DASH,
|
||||
0, // SPR2_PAIN,
|
||||
|
@ -593,6 +595,7 @@ state_t states[NUMSTATES] =
|
|||
{SPR_PLAY, SPR2_STND|FF_ANIMATE, 105, {NULL}, 0, 7, S_PLAY_WAIT}, // S_PLAY_STND
|
||||
{SPR_PLAY, SPR2_WAIT|FF_ANIMATE, -1, {NULL}, 0, 16, S_NULL}, // S_PLAY_WAIT
|
||||
{SPR_PLAY, SPR2_WALK, 4, {NULL}, 0, 0, S_PLAY_WALK}, // S_PLAY_WALK
|
||||
{SPR_PLAY, SPR2_SKID, 1, {NULL}, 0, 0, S_PLAY_WALK}, // S_PLAY_SKID
|
||||
{SPR_PLAY, SPR2_RUN , 2, {NULL}, 0, 0, S_PLAY_RUN}, // S_PLAY_RUN
|
||||
{SPR_PLAY, SPR2_DASH, 2, {NULL}, 0, 0, S_PLAY_DASH}, // S_PLAY_DASH
|
||||
{SPR_PLAY, SPR2_PAIN|FF_ANIMATE, 350, {NULL}, 0, 4, S_PLAY_FALL}, // S_PLAY_PAIN
|
||||
|
|
|
@ -609,6 +609,7 @@ typedef enum playersprite
|
|||
SPR2_STND = 0,
|
||||
SPR2_WAIT,
|
||||
SPR2_WALK,
|
||||
SPR2_SKID,
|
||||
SPR2_RUN ,
|
||||
SPR2_DASH,
|
||||
SPR2_PAIN,
|
||||
|
@ -713,6 +714,7 @@ typedef enum state
|
|||
S_PLAY_STND,
|
||||
S_PLAY_WAIT,
|
||||
S_PLAY_WALK,
|
||||
S_PLAY_SKID,
|
||||
S_PLAY_RUN,
|
||||
S_PLAY_DASH,
|
||||
S_PLAY_PAIN,
|
||||
|
|
|
@ -250,6 +250,7 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
|
|||
player->panim = PA_EDGE;
|
||||
break;
|
||||
case S_PLAY_WALK:
|
||||
case S_PLAY_SKID:
|
||||
case S_PLAY_FLOAT:
|
||||
player->panim = PA_WALK;
|
||||
break;
|
||||
|
|
|
@ -4370,6 +4370,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
|
|||
P_SetTarget(&player->mo->target, P_SetTarget(&player->mo->tracer, lockon));
|
||||
if (lockon)
|
||||
{
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_ROLL);
|
||||
player->mo->angle = R_PointToAngle2(player->mo->x, player->mo->y, lockon->x, lockon->y);
|
||||
player->homing = 3*TICRATE;
|
||||
}
|
||||
|
@ -6674,8 +6675,8 @@ static void P_SkidStuff(player_t *player)
|
|||
// If your push angle is more than this close to a full 180 degrees, trigger a skid.
|
||||
if (dang > ANGLE_157h)
|
||||
{
|
||||
if (player->panim != PA_WALK)
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_WALK);
|
||||
if (player->mo->state-states != S_PLAY_SKID)
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_SKID);
|
||||
player->mo->tics = player->skidtime = (player->mo->movefactor == FRACUNIT) ? TICRATE/2 : (FixedDiv(35<<(FRACBITS-1), FixedSqrt(player->mo->movefactor)))>>FRACBITS;
|
||||
S_StartSound(player->mo, sfx_skid);
|
||||
}
|
||||
|
@ -7418,6 +7419,8 @@ static void P_MovePlayer(player_t *player)
|
|||
|
||||
if (!(player->mo->tracer->flags & MF_BOSS))
|
||||
player->pflags &= ~PF_THOKKED;
|
||||
|
||||
// P_SetPlayerMobjState(player->mo, S_PLAY_SPRING); -- Speed didn't like it, RIP
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue