Merge branch 'player-animations'

SPR_PLAY now calls up a secondary spritedef for all animations for all players. Old character wads (including player.dta) are no longer compatible.

git-svn-id: https://code.orospakr.ca/svn/srb2/trunk@8993 6de4a73c-47e2-0310-b8c1-93d6ecd3f8cd
This commit is contained in:
JTE 2015-01-22 15:23:45 +00:00 committed by Ronald Kinard
parent c15153053c
commit b2681984a6
19 changed files with 431 additions and 424 deletions

View File

@ -273,11 +273,11 @@ void B_RespawnBot(INT32 playernum)
P_TeleportMove(tails, x, y, z); P_TeleportMove(tails, x, y, z);
if (player->charability == CA_FLY) if (player->charability == CA_FLY)
{ {
P_SetPlayerMobjState(tails, S_PLAY_ABL1); P_SetPlayerMobjState(tails, S_PLAY_FLY);
tails->player->powers[pw_tailsfly] = (UINT16)-1; tails->player->powers[pw_tailsfly] = (UINT16)-1;
} }
else else
P_SetPlayerMobjState(tails, S_PLAY_FALL1); P_SetPlayerMobjState(tails, S_PLAY_FALL);
P_SetScale(tails, sonic->scale); P_SetScale(tails, sonic->scale);
tails->destscale = sonic->destscale; tails->destscale = sonic->destscale;
} }

View File

@ -3739,7 +3739,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_PLAY_STND", "S_PLAY_STND",
"S_PLAY_TAP1", "S_PLAY_TAP1",
"S_PLAY_TAP2", "S_PLAY_TAP2",
"S_PLAY_RUN1", "S_PLAY_WALK",
"S_PLAY_RUN2", "S_PLAY_RUN2",
"S_PLAY_RUN3", "S_PLAY_RUN3",
"S_PLAY_RUN4", "S_PLAY_RUN4",
@ -3751,12 +3751,12 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_PLAY_SPD2", "S_PLAY_SPD2",
"S_PLAY_SPD3", "S_PLAY_SPD3",
"S_PLAY_SPD4", "S_PLAY_SPD4",
"S_PLAY_ATK1", "S_PLAY_SPIN",
"S_PLAY_ATK2", "S_PLAY_ATK2",
"S_PLAY_ATK3", "S_PLAY_ATK3",
"S_PLAY_ATK4", "S_PLAY_ATK4",
"S_PLAY_SPRING", "S_PLAY_SPRING",
"S_PLAY_FALL1", "S_PLAY_FALL",
"S_PLAY_FALL2", "S_PLAY_FALL2",
"S_PLAY_ABL1", "S_PLAY_ABL1",
"S_PLAY_ABL2", "S_PLAY_ABL2",
@ -4534,7 +4534,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
// S_PLAY_TAP1 // S_PLAY_TAP1
"S_METALSONIC_WAIT1", "S_METALSONIC_WAIT1",
"S_METALSONIC_WAIT2", "S_METALSONIC_WAIT2",
// S_PLAY_RUN1 // S_PLAY_WALK
"S_METALSONIC_WALK1", "S_METALSONIC_WALK1",
"S_METALSONIC_WALK2", "S_METALSONIC_WALK2",
"S_METALSONIC_WALK3", "S_METALSONIC_WALK3",

View File

@ -3686,6 +3686,7 @@ static ticcmd_t oldcmd;
#define GZT_SPRITE 0x10 // Animation frame #define GZT_SPRITE 0x10 // Animation frame
#define GZT_EXTRA 0x20 #define GZT_EXTRA 0x20
#define GZT_NIGHTS 0x40 // NiGHTS Mode stuff! #define GZT_NIGHTS 0x40 // NiGHTS Mode stuff!
#define GZT_SPR2 0x80 // Player animations
// GZT_EXTRA flags // GZT_EXTRA flags
#define EZT_THOK 0x01 // Spawned a thok object #define EZT_THOK 0x01 // Spawned a thok object
@ -3889,8 +3890,6 @@ void G_WriteGhostTic(mobj_t *ghost)
char ziptic = 0; char ziptic = 0;
UINT8 *ziptic_p; UINT8 *ziptic_p;
UINT32 i; UINT32 i;
UINT8 sprite;
UINT8 frame;
if (!demo_p) if (!demo_p)
return; return;
@ -3965,19 +3964,25 @@ void G_WriteGhostTic(mobj_t *ghost)
} }
// Store the sprite frame. // Store the sprite frame.
frame = ghost->frame & 0xFF; if ((ghost->frame & 0xFF) != oldghost.frame)
if (frame != oldghost.frame)
{ {
oldghost.frame = frame; oldghost.frame = (ghost->frame & 0xFF);
ziptic |= GZT_SPRITE; ziptic |= GZT_SPRITE;
WRITEUINT8(demo_p,oldghost.frame); WRITEUINT8(demo_p,oldghost.frame);
} }
// Check for sprite set changes if (ghost->sprite == SPR_PLAY
sprite = ghost->sprite; && ghost->sprite2 != oldghost.sprite2)
if (sprite != oldghost.sprite)
{ {
oldghost.sprite = sprite; oldghost.sprite2 = ghost->sprite2;
ziptic |= GZT_SPR2;
WRITEUINT8(demo_p,oldghost.sprite2);
}
// Check for sprite set changes
if (ghost->sprite != oldghost.sprite)
{
oldghost.sprite = ghost->sprite;
ghostext.flags |= EZT_SPRITE; ghostext.flags |= EZT_SPRITE;
} }
@ -4020,7 +4025,7 @@ void G_WriteGhostTic(mobj_t *ghost)
ghostext.hitlist = NULL; ghostext.hitlist = NULL;
} }
if (ghostext.flags & EZT_SPRITE) if (ghostext.flags & EZT_SPRITE)
WRITEUINT8(demo_p,sprite); WRITEUINT8(demo_p,oldghost.sprite);
ghostext.flags = 0; ghostext.flags = 0;
} }
@ -4076,6 +4081,8 @@ void G_ConsGhostTic(void)
demo_p++; demo_p++;
if (ziptic & GZT_SPRITE) if (ziptic & GZT_SPRITE)
demo_p++; demo_p++;
if (ziptic & GZT_SPR2)
demo_p++;
if(ziptic & GZT_NIGHTS) { if(ziptic & GZT_NIGHTS) {
if (!testmo->player || !(testmo->player->pflags & PF_NIGHTSMODE) || !testmo->tracer) if (!testmo->player || !(testmo->player->pflags & PF_NIGHTSMODE) || !testmo->tracer)
nightsfail = true; nightsfail = true;
@ -4207,6 +4214,8 @@ void G_GhostTicker(void)
g->oldmo.angle = READUINT8(g->p)<<24; g->oldmo.angle = READUINT8(g->p)<<24;
if (ziptic & GZT_SPRITE) if (ziptic & GZT_SPRITE)
g->oldmo.frame = READUINT8(g->p); g->oldmo.frame = READUINT8(g->p);
if (ziptic & GZT_SPR2)
g->oldmo.sprite2 = READUINT8(g->p);
// Update ghost // Update ghost
P_UnsetThingPosition(g->mo); P_UnsetThingPosition(g->mo);
@ -4216,6 +4225,7 @@ void G_GhostTicker(void)
P_SetThingPosition(g->mo); P_SetThingPosition(g->mo);
g->mo->angle = g->oldmo.angle; g->mo->angle = g->oldmo.angle;
g->mo->frame = g->oldmo.frame | tr_trans30<<FF_TRANSSHIFT; g->mo->frame = g->oldmo.frame | tr_trans30<<FF_TRANSSHIFT;
g->mo->sprite2 = g->oldmo.sprite2;
if (ziptic & GZT_EXTRA) if (ziptic & GZT_EXTRA)
{ // But wait, there's more! { // But wait, there's more!
@ -4400,6 +4410,8 @@ void G_ReadMetalTic(mobj_t *metal)
oldmetal.angle = READUINT8(metal_p)<<24; oldmetal.angle = READUINT8(metal_p)<<24;
if (ziptic & GZT_SPRITE) if (ziptic & GZT_SPRITE)
metal_p++; // Currently unused. (Metal Sonic figures out what he's doing his own damn self.) metal_p++; // Currently unused. (Metal Sonic figures out what he's doing his own damn self.)
if (ziptic & GZT_SPR2)
metal_p++;
// Set movement, position, and angle // Set movement, position, and angle
// oldmetal contains where you're supposed to be. // oldmetal contains where you're supposed to be.

View File

@ -4581,7 +4581,7 @@ static void HWR_ProjectSprite(mobj_t *thing)
//Fab : 02-08-98: 'skin' override spritedef currently used for skin //Fab : 02-08-98: 'skin' override spritedef currently used for skin
if (thing->skin && thing->sprite == SPR_PLAY) if (thing->skin && thing->sprite == SPR_PLAY)
sprdef = &((skin_t *)thing->skin)->spritedef; sprdef = &((skin_t *)thing->skin)->sprites[thing->sprite2];
else else
sprdef = &sprites[thing->sprite]; sprdef = &sprites[thing->sprite];

View File

@ -1200,7 +1200,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
curr = &md2->model->frames[frame]; curr = &md2->model->frames[frame];
if (cv_grmd2.value == 1 if (cv_grmd2.value == 1
&& spr->mobj->state->nextstate != S_NULL && states[spr->mobj->state->nextstate].sprite != SPR_NULL && spr->mobj->state->nextstate != S_NULL && states[spr->mobj->state->nextstate].sprite != SPR_NULL
&& !(spr->mobj->player && (spr->mobj->state->nextstate == S_PLAY_TAP1 || spr->mobj->state->nextstate == S_PLAY_TAP2) && spr->mobj->state == &states[S_PLAY_STND])) && !(spr->mobj->player && spr->mobj->state->nextstate == S_PLAY_WAIT && spr->mobj->state == &states[S_PLAY_STND]))
{ {
const INT32 nextframe = (states[spr->mobj->state->nextstate].frame & FF_FRAMEMASK) % md2->model->header.numFrames; const INT32 nextframe = (states[spr->mobj->state->nextstate].frame & FF_FRAMEMASK) % md2->model->header.numFrames;
next = &md2->model->frames[nextframe]; next = &md2->model->frames[nextframe];
@ -1216,7 +1216,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
p.z = FIXED_TO_FLOAT(spr->mobj->z); p.z = FIXED_TO_FLOAT(spr->mobj->z);
if (spr->mobj->skin && spr->mobj->sprite == SPR_PLAY) if (spr->mobj->skin && spr->mobj->sprite == SPR_PLAY)
sprdef = &((skin_t *)spr->mobj->skin)->spritedef; sprdef = &((skin_t *)spr->mobj->skin)->sprites[spr->mobj->sprite2];
else else
sprdef = &sprites[spr->mobj->sprite]; sprdef = &sprites[spr->mobj->sprite];

View File

@ -56,6 +56,39 @@ char sprnames[NUMSPRITES + 1][5] =
"SRBJ","SRBK","SRBL","SRBM","SRBN","SRBO", "SRBJ","SRBK","SRBL","SRBM","SRBN","SRBO",
}; };
char spr2names[NUMPLAYERSPRITES][5] =
{
"STND",
"WAIT",
"WALK",
"RUN_",
"PAIN",
"DEAD",
"SPIN",
"GASP",
"JUMP",
"FALL",
"EDGE",
"RIDE",
"SIGN",
"LIFE",
"FLY_",
"TIRE",
"GLID",
"CLNG",
"CLMB",
"TRNS",
"SSTD",
"SWLK",
"SRUN",
"SEDG",
"SHIT"
};
// Doesn't work with g++, needs actionf_p1 (don't modify this comment) // Doesn't work with g++, needs actionf_p1 (don't modify this comment)
state_t states[NUMSTATES] = state_t states[NUMSTATES] =
{ {
@ -81,73 +114,53 @@ state_t states[NUMSTATES] =
{SPR_THOK, FF_TRANS50, 8, {NULL}, 0, 0, S_NULL}, // S_THOK {SPR_THOK, FF_TRANS50, 8, {NULL}, 0, 0, S_NULL}, // S_THOK
// Player // Player
{SPR_PLAY, 0, 105, {NULL}, 0, 0, S_PLAY_TAP1}, // S_PLAY_STND {SPR_PLAY, SPR2_STND, 105, {NULL}, 0, 0, S_PLAY_WAIT}, // S_PLAY_STND
{SPR_PLAY, 1, 16, {NULL}, 0, 0, S_PLAY_TAP2}, // S_PLAY_TAP1 {SPR_PLAY, SPR2_WAIT, 16, {NULL}, 0, 0, S_PLAY_WAIT}, // S_PLAY_WAIT
{SPR_PLAY, 2, 16, {NULL}, 0, 0, S_PLAY_TAP1}, // S_PLAY_TAP2 {SPR_PLAY, SPR2_WALK, 4, {NULL}, 0, 0, S_PLAY_WALK}, // S_PLAY_WALK
{SPR_PLAY, 3, 4, {NULL}, 0, 0, S_PLAY_RUN2}, // S_PLAY_RUN1 {SPR_PLAY, SPR2_RUN , 2, {NULL}, 0, 0, S_PLAY_RUN}, // S_PLAY_RUN
{SPR_PLAY, 4, 4, {NULL}, 0, 0, S_PLAY_RUN3}, // S_PLAY_RUN2 {SPR_PLAY, SPR2_PAIN, 350, {NULL}, 0, 0, S_PLAY_FALL}, // S_PLAY_PAIN
{SPR_PLAY, 5, 4, {NULL}, 0, 0, S_PLAY_RUN4}, // S_PLAY_RUN3 {SPR_PLAY, SPR2_DEAD, 4, {NULL}, 0, 0, S_PLAY_DEAD}, // S_PLAY_DEAD
{SPR_PLAY, 6, 4, {NULL}, 0, 0, S_PLAY_RUN5}, // S_PLAY_RUN4 {SPR_PLAY, SPR2_SPIN, 1, {NULL}, 0, 0, S_PLAY_SPIN}, // S_PLAY_SPIN
{SPR_PLAY, 7, 4, {NULL}, 0, 0, S_PLAY_RUN6}, // S_PLAY_RUN5 {SPR_PLAY, SPR2_GASP, 14, {NULL}, 0, 0, S_PLAY_WALK}, // S_PLAY_GASP
{SPR_PLAY, 8, 4, {NULL}, 0, 0, S_PLAY_RUN7}, // S_PLAY_RUN6 {SPR_PLAY, SPR2_JUMP, -1, {NULL}, 0, 0, S_PLAY_FALL}, // S_PLAY_JUMP
{SPR_PLAY, 9, 4, {NULL}, 0, 0, S_PLAY_RUN8}, // S_PLAY_RUN7 {SPR_PLAY, SPR2_FALL, 2, {NULL}, 0, 0, S_PLAY_FALL}, // S_PLAY_FALL
{SPR_PLAY, 10, 4, {NULL}, 0, 0, S_PLAY_RUN1}, // S_PLAY_RUN8 {SPR_PLAY, SPR2_EDGE, 12, {NULL}, 0, 0, S_PLAY_EDGE}, // S_PLAY_EDGE
{SPR_PLAY, 16, 2, {NULL}, 0, 0, S_PLAY_SPD2}, // S_PLAY_SPD1 {SPR_PLAY, SPR2_RIDE, 4, {NULL}, 0, 0, S_PLAY_RIDE}, // S_PLAY_RIDE
{SPR_PLAY, 17, 2, {NULL}, 0, 0, S_PLAY_SPD3}, // S_PLAY_SPD2
{SPR_PLAY, 18, 2, {NULL}, 0, 0, S_PLAY_SPD4}, // S_PLAY_SPD3 {SPR_PLAY, SPR2_FLY , 2, {NULL}, 0, 0, S_PLAY_FLY}, // S_PLAY_FLY
{SPR_PLAY, 19, 2, {NULL}, 0, 0, S_PLAY_SPD1}, // S_PLAY_SPD4 {SPR_PLAY, SPR2_TIRE, 12, {NULL}, 0, 0, S_PLAY_FLY_TIRED}, // S_PLAY_FLY_TIRED
{SPR_PLAY, 11, 1, {NULL}, 0, 0, S_PLAY_ATK2}, // S_PLAY_ATK1
{SPR_PLAY, 12, 1, {NULL}, 0, 0, S_PLAY_ATK3}, // S_PLAY_ATK2 {SPR_PLAY, SPR2_GLID, 2, {NULL}, 0, 0, S_PLAY_GLIDE}, // S_PLAY_GLIDE
{SPR_PLAY, 13, 1, {NULL}, 0, 0, S_PLAY_ATK4}, // S_PLAY_ATK3 {SPR_PLAY, SPR2_CLNG, 6, {NULL}, 0, 0, S_PLAY_CLING}, // S_PLAY_CLING
{SPR_PLAY, 14, 1, {NULL}, 0, 0, S_PLAY_ATK1}, // S_PLAY_ATK4 {SPR_PLAY, SPR2_CLMB, 5, {NULL}, 0, 0, S_PLAY_CLIMB}, // S_PLAY_CLIMB
{SPR_PLAY, 15, -1, {NULL}, 0, 0, S_PLAY_FALL1}, // S_PLAY_SPRING
{SPR_PLAY, 31, 2, {NULL}, 0, 0, S_PLAY_FALL2}, // S_PLAY_FALL1 {SPR_PLAY, SPR2_SSTD, 7, {NULL}, 0, 0, S_PLAY_SUPER_STND}, // S_PLAY_SUPER_STND
{SPR_PLAY, 32, 2, {NULL}, 0, 0, S_PLAY_FALL1}, // S_PLAY_FALL2 {SPR_PLAY, SPR2_SWLK, 7, {NULL}, 0, 0, S_PLAY_SUPER_WALK}, // S_PLAY_SUPER_WALK
{SPR_PLAY, 20, 2, {NULL}, 0, 0, S_PLAY_ABL2}, // S_PLAY_ABL1 {SPR_PLAY, SPR2_SRUN, 7, {NULL}, 0, 0, S_PLAY_SUPER_RUN}, // S_PLAY_SUPER_RUN
{SPR_PLAY, 21, 2, {NULL}, 0, 0, S_PLAY_ABL1}, // S_PLAY_ABL2 {SPR_PLAY, SPR2_SEDG, 12, {NULL}, 0, 0, S_PLAY_SUPER_EDGE}, // S_PLAY_SUPER_EDGE
{SPR_PLAY, 22, 6, {NULL}, 0, 0, S_PLAY_SPC2}, // S_PLAY_SPC1 {SPR_PLAY, SPR2_SHIT, -1, {NULL}, 0, 0, S_PLAY_SUPER_STND}, // S_PLAY_SUPER_PAIN
{SPR_PLAY, 23, 6, {NULL}, 0, 0, S_PLAY_SPC3}, // S_PLAY_SPC2
{SPR_PLAY, 24, 6, {NULL}, 0, 0, S_PLAY_SPC4}, // S_PLAY_SPC3 {SPR_PLAY, SPR2_TRNS, 4, {NULL}, 0, 0, S_PLAY_SUPER_TRANS2}, // S_PLAY_SUPER_TRANS
{SPR_PLAY, 25, 6, {NULL}, 0, 0, S_PLAY_SPC1}, // S_PLAY_SPC4 {SPR_PLAY, SPR2_TRNS, 4, {NULL}, 0, 0, S_PLAY_SUPER_TRANS3}, // S_PLAY_SUPER_TRANS2
{SPR_PLAY, 22, -1, {NULL}, 0, 0, S_NULL}, // S_PLAY_CLIMB1 {SPR_PLAY, SPR2_TRNS|FF_FULLBRIGHT, 4, {NULL}, 0, 0, S_PLAY_SUPER_TRANS4}, // S_PLAY_SUPER_TRANS3
{SPR_PLAY, 23, 5, {NULL}, 0, 0, S_PLAY_CLIMB3}, // S_PLAY_CLIMB2 {SPR_PLAY, SPR2_TRNS, 3, {NULL}, 0, 0, S_PLAY_SUPER_TRANS5}, // S_PLAY_SUPER_TRANS4
{SPR_PLAY, 24, 5, {NULL}, 0, 0, S_PLAY_CLIMB4}, // S_PLAY_CLIMB3 {SPR_PLAY, SPR2_TRNS, 3, {NULL}, 0, 0, S_PLAY_SUPER_TRANS6}, // S_PLAY_SUPER_TRANS5
{SPR_PLAY, 25, 5, {NULL}, 0, 0, S_PLAY_CLIMB5}, // S_PLAY_CLIMB4 {SPR_PLAY, SPR2_TRNS, 3, {NULL}, 0, 0, S_PLAY_SUPER_TRANS7}, // S_PLAY_SUPER_TRANS6
{SPR_PLAY, 24, 5, {NULL}, 0, 0, S_PLAY_CLIMB2}, // S_PLAY_CLIMB5 {SPR_PLAY, SPR2_TRNS, 3, {NULL}, 0, 0, S_PLAY_SUPER_TRANS8}, // S_PLAY_SUPER_TRANS7
{SPR_PLAY, 26, 14, {NULL}, 0, 0, S_PLAY_RUN1}, // S_PLAY_GASP {SPR_PLAY, SPR2_TRNS, 3, {NULL}, 0, 0, S_PLAY_SUPER_TRANS9}, // S_PLAY_SUPER_TRANS8
{SPR_PLAY, 27, 350, {NULL}, 0, 0, S_PLAY_FALL1}, // S_PLAY_PAIN {SPR_PLAY, SPR2_TRNS, 16, {NULL}, 0, 0, S_PLAY_WALK}, // S_PLAY_SUPER_TRANS9
{SPR_PLAY, 28, -1, {A_Fall}, 0, 0, S_NULL}, // S_PLAY_DIE
{SPR_PLAY, 29, 12, {NULL}, 0, 0, S_PLAY_TEETER2}, // S_PLAY_TEETER1
{SPR_PLAY, 30, 12, {NULL}, 0, 0, S_PLAY_TEETER1}, // S_PLAY_TEETER2
{SPR_PLAY, 33, -1, {NULL}, 0, 0, S_NULL}, // S_PLAY_CARRY
{SPR_PLAY, 20, -1, {NULL}, 0, 0, S_PLAY_SUPERSTAND}, // S_PLAY_SUPERSTAND
{SPR_PLAY, 20, 7, {NULL}, 0, 0, S_PLAY_SUPERWALK2}, // S_PLAY_SUPERWALK1
{SPR_PLAY, 21, 7, {NULL}, 0, 0, S_PLAY_SUPERWALK1}, // S_PLAY_SUPERWALK2
{SPR_PLAY, 22, 7, {NULL}, 0, 0, S_PLAY_SUPERFLY2}, // S_PLAY_SUPERFLY1
{SPR_PLAY, 23, 7, {NULL}, 0, 0, S_PLAY_SUPERFLY1}, // S_PLAY_SUPERFLY2
{SPR_PLAY, 24, 12, {NULL}, 0, 0, S_PLAY_SUPERTEETER}, // S_PLAY_SUPERTEETER
{SPR_PLAY, 25, -1, {NULL}, 0, 0, S_PLAY_SUPERSTAND}, // S_PLAY_SUPERHIT
{SPR_PLAY, 36, 4, {NULL}, 0, 0, S_PLAY_SUPERTRANS2}, // S_PLAY_SUPERTRANS1
{SPR_PLAY, 37, 4, {NULL}, 0, 0, S_PLAY_SUPERTRANS3}, // S_PLAY_SUPERTRANS2
{SPR_PLAY, 32806, 4, {NULL}, 0, 0, S_PLAY_SUPERTRANS4}, // S_PLAY_SUPERTRANS3
{SPR_PLAY, 39, 3, {NULL}, 0, 0, S_PLAY_SUPERTRANS5}, // S_PLAY_SUPERTRANS4
{SPR_PLAY, 40, 3, {NULL}, 0, 0, S_PLAY_SUPERTRANS6}, // S_PLAY_SUPERTRANS5
{SPR_PLAY, 41, 3, {NULL}, 0, 0, S_PLAY_SUPERTRANS7}, // S_PLAY_SUPERTRANS6
{SPR_PLAY, 42, 3, {NULL}, 0, 0, S_PLAY_SUPERTRANS8}, // S_PLAY_SUPERTRANS7
{SPR_PLAY, 43, 3, {NULL}, 0, 0, S_PLAY_SUPERTRANS9}, // S_PLAY_SUPERTRANS8
{SPR_PLAY, 44, 16, {NULL}, 0, 0, S_PLAY_RUN1}, // S_PLAY_SUPERTRANS9
{SPR_NULL, 0, -1, {NULL}, 0, 0, S_OBJPLACE_DUMMY}, //S_OBJPLACE_DUMMY {SPR_NULL, 0, -1, {NULL}, 0, 0, S_OBJPLACE_DUMMY}, //S_OBJPLACE_DUMMY
// 1-Up Box Sprites (uses player sprite) // 1-Up Box Sprites (uses player sprite)
{SPR_PLAY, 35, 2, {NULL}, 0, 16, S_PLAY_BOX2}, // S_PLAY_BOX1 {SPR_PLAY, SPR2_LIFE, 2, {NULL}, 0, 16, S_PLAY_BOX2}, // S_PLAY_BOX1
{SPR_NULL, 0, 1, {NULL}, 0, 0, S_PLAY_BOX1}, // S_PLAY_BOX2 {SPR_NULL, 0, 1, {NULL}, 0, 0, S_PLAY_BOX1}, // S_PLAY_BOX2
{SPR_PLAY, 35, 4, {NULL}, 0, 4, S_PLAY_ICON2}, // S_PLAY_ICON1 {SPR_PLAY, SPR2_LIFE, 4, {NULL}, 0, 4, S_PLAY_ICON2}, // S_PLAY_ICON1
{SPR_NULL, 0, 12, {NULL}, 0, 0, S_PLAY_ICON3}, // S_PLAY_ICON2 {SPR_NULL, 0, 12, {NULL}, 0, 0, S_PLAY_ICON3}, // S_PLAY_ICON2
{SPR_PLAY, 35, 18, {NULL}, 0, 4, S_NULL}, // S_PLAY_ICON3 {SPR_PLAY, SPR2_LIFE, 18, {NULL}, 0, 4, S_NULL}, // S_PLAY_ICON3
// Level end sign (uses player sprite) // Level end sign (uses player sprite)
{SPR_PLAY, 34, 1, {NULL}, 0, 24, S_PLAY_SIGN}, // S_PLAY_SIGN {SPR_PLAY, SPR2_SIGN, 1, {NULL}, 0, 24, S_PLAY_SIGN}, // S_PLAY_SIGN
// Blue Crawla // Blue Crawla
{SPR_POSS, 0, 5, {A_Look}, 0, 0, S_POSS_STND2}, // S_POSS_STND {SPR_POSS, 0, 5, {A_Look}, 0, 0, S_POSS_STND2}, // S_POSS_STND
@ -3110,7 +3123,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
-1, // doomednum -1, // doomednum
S_PLAY_STND, // spawnstate S_PLAY_STND, // spawnstate
1, // spawnhealth 1, // spawnhealth
S_PLAY_RUN1, // seestate S_PLAY_WALK, // seestate
sfx_None, // seesound sfx_None, // seesound
0, // reactiontime 0, // reactiontime
sfx_thok, // attacksound sfx_thok, // attacksound
@ -3118,8 +3131,8 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
MT_THOK, // painchance MT_THOK, // painchance
sfx_None, // painsound sfx_None, // painsound
S_NULL, // meleestate S_NULL, // meleestate
S_PLAY_ATK1, // missilestate S_PLAY_SPIN, // missilestate
S_PLAY_DIE, // deathstate S_PLAY_DEAD, // deathstate
S_NULL, // xdeathstate S_NULL, // xdeathstate
sfx_None, // deathsound sfx_None, // deathsound
1, // speed 1, // speed

View File

@ -575,6 +575,41 @@ typedef enum sprite
NUMSPRITES NUMSPRITES
} spritenum_t; } spritenum_t;
enum playersprite
{
SPR2_STND = 0,
SPR2_WAIT,
SPR2_WALK,
SPR2_RUN ,
SPR2_PAIN,
SPR2_DEAD,
SPR2_SPIN,
SPR2_GASP,
SPR2_JUMP,
SPR2_FALL,
SPR2_EDGE,
SPR2_RIDE,
SPR2_SIGN,
SPR2_LIFE,
SPR2_FLY ,
SPR2_TIRE,
SPR2_GLID,
SPR2_CLNG,
SPR2_CLMB,
SPR2_TRNS,
SPR2_SSTD,
SPR2_SWLK,
SPR2_SRUN,
SPR2_SEDG,
SPR2_SHIT,
NUMPLAYERSPRITES
};
typedef enum state typedef enum state
{ {
S_NULL, S_NULL,
@ -592,61 +627,46 @@ typedef enum state
// Thok // Thok
S_THOK, S_THOK,
// Player
S_PLAY_STND, S_PLAY_STND,
S_PLAY_TAP1, S_PLAY_WAIT,
S_PLAY_TAP2, S_PLAY_WALK,
S_PLAY_RUN1, S_PLAY_RUN,
S_PLAY_RUN2,
S_PLAY_RUN3,
S_PLAY_RUN4,
S_PLAY_RUN5,
S_PLAY_RUN6,
S_PLAY_RUN7,
S_PLAY_RUN8,
S_PLAY_SPD1,
S_PLAY_SPD2,
S_PLAY_SPD3,
S_PLAY_SPD4,
S_PLAY_ATK1,
S_PLAY_ATK2,
S_PLAY_ATK3,
S_PLAY_ATK4,
S_PLAY_SPRING,
S_PLAY_FALL1,
S_PLAY_FALL2,
S_PLAY_ABL1,
S_PLAY_ABL2,
S_PLAY_SPC1,
S_PLAY_SPC2,
S_PLAY_SPC3,
S_PLAY_SPC4,
S_PLAY_CLIMB1,
S_PLAY_CLIMB2,
S_PLAY_CLIMB3,
S_PLAY_CLIMB4,
S_PLAY_CLIMB5,
S_PLAY_GASP,
S_PLAY_PAIN, S_PLAY_PAIN,
S_PLAY_DIE, S_PLAY_DEAD,
S_PLAY_TEETER1, S_PLAY_SPIN,
S_PLAY_TEETER2, S_PLAY_GASP,
S_PLAY_CARRY, S_PLAY_JUMP,
S_PLAY_SUPERSTAND, S_PLAY_FALL,
S_PLAY_SUPERWALK1, S_PLAY_EDGE,
S_PLAY_SUPERWALK2, S_PLAY_RIDE,
S_PLAY_SUPERFLY1,
S_PLAY_SUPERFLY2, // CA_FLY
S_PLAY_SUPERTEETER, S_PLAY_FLY,
S_PLAY_SUPERHIT, S_PLAY_FLY_TIRED,
S_PLAY_SUPERTRANS1,
S_PLAY_SUPERTRANS2, // CA_GLIDEANDCLIMB
S_PLAY_SUPERTRANS3, S_PLAY_GLIDE,
S_PLAY_SUPERTRANS4, S_PLAY_CLING,
S_PLAY_SUPERTRANS5, S_PLAY_CLIMB,
S_PLAY_SUPERTRANS6,
S_PLAY_SUPERTRANS7, // SF_SUPERANIMS
S_PLAY_SUPERTRANS8, S_PLAY_SUPER_STND,
S_PLAY_SUPERTRANS9, // This has special significance in the code. If you add more frames, search for it and make the appropriate changes. S_PLAY_SUPER_WALK,
S_PLAY_SUPER_RUN,
S_PLAY_SUPER_EDGE,
S_PLAY_SUPER_PAIN,
// SF_SUPER
S_PLAY_SUPER_TRANS,
S_PLAY_SUPER_TRANS2,
S_PLAY_SUPER_TRANS3,
S_PLAY_SUPER_TRANS4,
S_PLAY_SUPER_TRANS5,
S_PLAY_SUPER_TRANS6,
S_PLAY_SUPER_TRANS7,
S_PLAY_SUPER_TRANS8,
S_PLAY_SUPER_TRANS9,
// technically the player goes here but it's an infinite tic state // technically the player goes here but it's an infinite tic state
S_OBJPLACE_DUMMY, S_OBJPLACE_DUMMY,
@ -1390,7 +1410,7 @@ typedef enum state
// S_PLAY_TAP1 // S_PLAY_TAP1
S_METALSONIC_WAIT1, S_METALSONIC_WAIT1,
S_METALSONIC_WAIT2, S_METALSONIC_WAIT2,
// S_PLAY_RUN1 // S_PLAY_WALK
S_METALSONIC_WALK1, S_METALSONIC_WALK1,
S_METALSONIC_WALK2, S_METALSONIC_WALK2,
S_METALSONIC_WALK3, S_METALSONIC_WALK3,
@ -3488,6 +3508,7 @@ typedef struct
extern state_t states[NUMSTATES]; extern state_t states[NUMSTATES];
extern char sprnames[NUMSPRITES + 1][5]; extern char sprnames[NUMSPRITES + 1][5];
char spr2names[NUMPLAYERSPRITES][5];
extern state_t *astate; extern state_t *astate;
typedef enum mobj_type typedef enum mobj_type

View File

@ -6331,8 +6331,8 @@ static void M_HandleConnectIP(INT32 choice)
#define PLBOXW 8 #define PLBOXW 8
#define PLBOXH 9 #define PLBOXH 9
static INT32 multi_tics; static UINT8 multi_tics;
static state_t *multi_state; static UINT8 multi_frame;
// this is set before entering the MultiPlayer setup menu, // this is set before entering the MultiPlayer setup menu,
// for either player 1 or 2 // for either player 1 or 2
@ -6346,11 +6346,10 @@ static INT32 setupm_fakecolor;
static void M_DrawSetupMultiPlayerMenu(void) static void M_DrawSetupMultiPlayerMenu(void)
{ {
INT32 mx, my, st, flags = 0; INT32 mx, my, flags = 0;
spritedef_t *sprdef; spritedef_t *sprdef;
spriteframe_t *sprframe; spriteframe_t *sprframe;
patch_t *patch; patch_t *patch;
UINT8 frame;
mx = MP_PlayerSetupDef.x; mx = MP_PlayerSetupDef.x;
my = MP_PlayerSetupDef.y; my = MP_PlayerSetupDef.y;
@ -6378,28 +6377,23 @@ static void M_DrawSetupMultiPlayerMenu(void)
// anim the player in the box // anim the player in the box
if (--multi_tics <= 0) if (--multi_tics <= 0)
{ {
st = multi_state->nextstate; multi_frame++;
if (st != S_NULL) multi_tics = 4;
multi_state = &states[st];
multi_tics = multi_state->tics;
if (multi_tics == -1)
multi_tics = 15;
} }
// skin 0 is default player sprite // skin 0 is default player sprite
if (R_SkinAvailable(skins[setupm_fakeskin].name) != -1) if (R_SkinAvailable(skins[setupm_fakeskin].name) != -1)
sprdef = &skins[R_SkinAvailable(skins[setupm_fakeskin].name)].spritedef; sprdef = &skins[R_SkinAvailable(skins[setupm_fakeskin].name)].sprites[SPR2_WALK];
else else
sprdef = &skins[0].spritedef; sprdef = &skins[0].sprites[SPR2_WALK];
if (!sprdef->numframes) // No frames ?? if (!sprdef->numframes) // No frames ??
return; // Can't render! return; // Can't render!
frame = multi_state->frame & FF_FRAMEMASK; if (multi_frame >= sprdef->numframes)
if (frame >= sprdef->numframes) // Walking animation missing multi_frame = 0;
frame = 0; // Try to use standing frame
sprframe = &sprdef->spriteframes[frame]; sprframe = &sprdef->spriteframes[multi_frame];
patch = W_CachePatchNum(sprframe->lumppat[0], PU_CACHE); patch = W_CachePatchNum(sprframe->lumppat[0], PU_CACHE);
if (sprframe->flip & 1) // Only for first sprite if (sprframe->flip & 1) // Only for first sprite
flags |= V_FLIP; // This sprite is left/right flipped! flags |= V_FLIP; // This sprite is left/right flipped!
@ -6533,8 +6527,8 @@ static void M_SetupMultiPlayer(INT32 choice)
{ {
(void)choice; (void)choice;
multi_state = &states[mobjinfo[MT_PLAYER].seestate]; multi_frame = 0;
multi_tics = multi_state->tics; multi_tics = 4;
strcpy(setupm_name, cv_playername.string); strcpy(setupm_name, cv_playername.string);
// set for player 1 // set for player 1
@ -6564,8 +6558,8 @@ static void M_SetupMultiPlayer2(INT32 choice)
{ {
(void)choice; (void)choice;
multi_state = &states[mobjinfo[MT_PLAYER].seestate]; multi_frame = 0;
multi_tics = multi_state->tics; multi_tics = 4;
strcpy (setupm_name, cv_playername2.string); strcpy (setupm_name, cv_playername2.string);
// set for splitscreen secondary player // set for splitscreen secondary player

View File

@ -2513,7 +2513,7 @@ void A_1upThinker(mobj_t *actor)
} }
} }
if (closestplayer == -1 || skins[players[closestplayer].skin].spritedef.numframes <= states[S_PLAY_BOX1].frame) if (closestplayer == -1 || skins[players[closestplayer].skin].sprites[SPR2_LIFE].numframes == 0)
{ // Closest player not found (no players in game?? may be empty dedicated server!), or does not have correct sprite. { // Closest player not found (no players in game?? may be empty dedicated server!), or does not have correct sprite.
actor->frame = 0; actor->frame = 0;
if (actor->tracer) { if (actor->tracer) {
@ -2658,7 +2658,7 @@ for (i = cvar.value; i; --i) spawnchance[numchoices++] = type
if (actor->tracer) // Remove the old lives icon. if (actor->tracer) // Remove the old lives icon.
P_RemoveMobj(actor->tracer); P_RemoveMobj(actor->tracer);
if (!newmobj->target->skin || ((skin_t *)newmobj->target->skin)->spritedef.numframes <= states[S_PLAY_BOX1].frame) if (!newmobj->target->skin || ((skin_t *)newmobj->target->skin)->sprites[SPR2_LIFE].numframes == 0)
newmobj->frame -= 2; // No lives icon for this player, use the default. newmobj->frame -= 2; // No lives icon for this player, use the default.
else else
{ // Spawn the lives icon. { // Spawn the lives icon.

View File

@ -309,7 +309,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|| (toucher->z + toucher->height > special->z + special->height && (toucher->eflags & MFE_VERTICALFLIP))) || (toucher->z + toucher->height > special->z + special->height && (toucher->eflags & MFE_VERTICALFLIP)))
&& player->charability == CA_FLY && player->charability == CA_FLY
&& (player->powers[pw_tailsfly] && (player->powers[pw_tailsfly]
|| (toucher->state >= &states[S_PLAY_SPC1] && toucher->state <= &states[S_PLAY_SPC4]))) // Tails can shred stuff with his propeller. || toucher->state-states == S_PLAY_FLY_TIRED)) // Tails can shred stuff with his propeller.
{ {
toucher->momz = -toucher->momz/2; toucher->momz = -toucher->momz/2;
@ -351,7 +351,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|| (toucher->z + toucher->height > special->z + special->height && (toucher->eflags & MFE_VERTICALFLIP))) // Flame is bad at logic - JTE || (toucher->z + toucher->height > special->z + special->height && (toucher->eflags & MFE_VERTICALFLIP))) // Flame is bad at logic - JTE
&& player->charability == CA_FLY && player->charability == CA_FLY
&& (player->powers[pw_tailsfly] && (player->powers[pw_tailsfly]
|| (toucher->state >= &states[S_PLAY_SPC1] && toucher->state <= &states[S_PLAY_SPC4]))) // Tails can shred stuff with his propeller. || toucher->state-states == S_PLAY_FLY_TIRED)) // Tails can shred stuff with his propeller.
{ {
if (P_MobjFlip(toucher)*toucher->momz < 0) if (P_MobjFlip(toucher)*toucher->momz < 0)
toucher->momz = -toucher->momz/2; toucher->momz = -toucher->momz/2;
@ -875,7 +875,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
P_ResetPlayer(player); P_ResetPlayer(player);
P_SetPlayerMobjState(toucher, S_PLAY_FALL1); P_SetPlayerMobjState(toucher, S_PLAY_FALL);
} }
} }
return; return;
@ -1212,7 +1212,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
if (player->pflags & PF_GLIDING) if (player->pflags & PF_GLIDING)
{ {
player->pflags &= ~(PF_GLIDING|PF_JUMPED); player->pflags &= ~(PF_GLIDING|PF_JUMPED);
P_SetPlayerMobjState(toucher, S_PLAY_FALL1); P_SetPlayerMobjState(toucher, S_PLAY_FALL);
} }
// Play a bounce sound? // Play a bounce sound?
@ -1279,7 +1279,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
if (player->pflags & PF_GLIDING) if (player->pflags & PF_GLIDING)
{ {
player->pflags &= ~(PF_GLIDING|PF_JUMPED); player->pflags &= ~(PF_GLIDING|PF_JUMPED);
P_SetPlayerMobjState(toucher, S_PLAY_FALL1); P_SetPlayerMobjState(toucher, S_PLAY_FALL);
} }
// Play a bounce sound? // Play a bounce sound?
@ -1335,7 +1335,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
{ {
player->pflags |= PF_MACESPIN; player->pflags |= PF_MACESPIN;
S_StartSound(toucher, sfx_spin); S_StartSound(toucher, sfx_spin);
P_SetPlayerMobjState(toucher, S_PLAY_ATK1); P_SetPlayerMobjState(toucher, S_PLAY_SPIN);
} }
else else
player->pflags |= PF_ITEMHANG; player->pflags |= PF_ITEMHANG;
@ -2570,7 +2570,7 @@ static inline void P_SuperDamage(player_t *player, mobj_t *inflictor, mobj_t *so
P_InstaThrust(player->mo, ang, fallbackspeed); P_InstaThrust(player->mo, ang, fallbackspeed);
if (player->charflags & SF_SUPERANIMS) if (player->charflags & SF_SUPERANIMS)
P_SetPlayerMobjState(player->mo, S_PLAY_SUPERHIT); P_SetPlayerMobjState(player->mo, S_PLAY_SUPER_PAIN);
else else
P_SetPlayerMobjState(player->mo, player->mo->info->painstate); P_SetPlayerMobjState(player->mo, player->mo->info->painstate);

View File

@ -192,21 +192,21 @@ void P_DoSpring(mobj_t *spring, mobj_t *object)
P_ResetPlayer(object->player); P_ResetPlayer(object->player);
if (origvertispeed > 0) if (origvertispeed > 0)
P_SetPlayerMobjState(object, S_PLAY_SPRING); P_SetPlayerMobjState(object, S_PLAY_JUMP);
else if (origvertispeed < 0) else if (origvertispeed < 0)
P_SetPlayerMobjState(object, S_PLAY_FALL1); P_SetPlayerMobjState(object, S_PLAY_FALL);
else // horizontal spring else // horizontal spring
{ {
if (pflags & (PF_JUMPED|PF_SPINNING) && object->player->panim == PA_ROLL) if (pflags & (PF_JUMPED|PF_SPINNING) && object->player->panim == PA_ROLL)
object->player->pflags = pflags; object->player->pflags = pflags;
else else
P_SetPlayerMobjState(object, S_PLAY_RUN1); P_SetPlayerMobjState(object, S_PLAY_WALK);
} }
if (spring->info->painchance) if (spring->info->painchance)
{ {
object->player->pflags |= PF_JUMPED; object->player->pflags |= PF_JUMPED;
P_SetPlayerMobjState(object, S_PLAY_ATK1); P_SetPlayerMobjState(object, S_PLAY_SPIN);
} }
} }
} }
@ -255,7 +255,7 @@ static void P_DoFanAndGasJet(mobj_t *spring, mobj_t *object)
{ {
P_ResetPlayer(p); P_ResetPlayer(p);
if (p->panim != PA_FALL) if (p->panim != PA_FALL)
P_SetPlayerMobjState(object, S_PLAY_FALL1); P_SetPlayerMobjState(object, S_PLAY_FALL);
} }
break; break;
case MT_STEAM: // Steam case MT_STEAM: // Steam
@ -270,7 +270,7 @@ static void P_DoFanAndGasJet(mobj_t *spring, mobj_t *object)
{ {
P_ResetPlayer(p); P_ResetPlayer(p);
if (p->panim != PA_FALL) if (p->panim != PA_FALL)
P_SetPlayerMobjState(object, S_PLAY_FALL1); P_SetPlayerMobjState(object, S_PLAY_FALL);
} }
break; break;
default: default:
@ -288,7 +288,7 @@ static void P_DoTailsCarry(player_t *sonic, player_t *tails)
if ((sonic->pflags & PF_CARRIED) && sonic->mo->tracer == tails->mo) if ((sonic->pflags & PF_CARRIED) && sonic->mo->tracer == tails->mo)
return; return;
if (!tails->powers[pw_tailsfly] && !(tails->charability == CA_FLY && (tails->mo->state >= &states[S_PLAY_SPC1] && tails->mo->state <= &states[S_PLAY_SPC4]))) if (!tails->powers[pw_tailsfly] && !(tails->charability == CA_FLY && tails->mo->state-states == S_PLAY_FLY_TIRED))
return; return;
if (tails->bot == 1) if (tails->bot == 1)
@ -1850,7 +1850,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
// Don't 'step up' while springing, // Don't 'step up' while springing,
// Only step up "if needed". // Only step up "if needed".
if (thing->state == &states[S_PLAY_SPRING] if (thing->state-states == S_PLAY_JUMP
&& P_MobjFlip(thing)*thing->momz > FixedMul(FRACUNIT, thing->scale)) && P_MobjFlip(thing)*thing->momz > FixedMul(FRACUNIT, thing->scale))
maxstep = 0; maxstep = 0;
} }

View File

@ -141,42 +141,22 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
switch (state) switch (state)
{ {
case S_PLAY_STND: case S_PLAY_STND:
case S_PLAY_TAP1: case S_PLAY_WAIT:
case S_PLAY_TAP2:
case S_PLAY_GASP: case S_PLAY_GASP:
P_SetPlayerMobjState(mobj, S_PLAY_SUPERSTAND); P_SetPlayerMobjState(mobj, S_PLAY_SUPER_STND);
return true; return true;
case S_PLAY_FALL1: case S_PLAY_FALL:
case S_PLAY_SPRING: case S_PLAY_JUMP:
case S_PLAY_RUN1: case S_PLAY_WALK:
case S_PLAY_RUN2: P_SetPlayerMobjState(mobj, S_PLAY_SUPER_WALK);
case S_PLAY_RUN3:
case S_PLAY_RUN4:
P_SetPlayerMobjState(mobj, S_PLAY_SUPERWALK1);
return true; return true;
case S_PLAY_FALL2: case S_PLAY_RUN:
case S_PLAY_RUN5: P_SetPlayerMobjState(mobj, S_PLAY_SUPER_RUN);
case S_PLAY_RUN6:
case S_PLAY_RUN7:
case S_PLAY_RUN8:
P_SetPlayerMobjState(mobj, S_PLAY_SUPERWALK2);
return true; return true;
case S_PLAY_SPD1: case S_PLAY_EDGE:
case S_PLAY_SPD2: P_SetPlayerMobjState(mobj, S_PLAY_SUPER_EDGE);
P_SetPlayerMobjState(mobj, S_PLAY_SUPERFLY1);
return true; return true;
case S_PLAY_SPD3: case S_PLAY_SPIN:
case S_PLAY_SPD4:
P_SetPlayerMobjState(mobj, S_PLAY_SUPERFLY2);
return true;
case S_PLAY_TEETER1:
case S_PLAY_TEETER2:
P_SetPlayerMobjState(mobj, S_PLAY_SUPERTEETER);
return true;
case S_PLAY_ATK1:
case S_PLAY_ATK2:
case S_PLAY_ATK3:
case S_PLAY_ATK4:
if (!(player->charflags & SF_SUPERSPIN)) if (!(player->charflags & SF_SUPERSPIN))
return true; return true;
break; break;
@ -194,23 +174,38 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
// Set animation state // Set animation state
// The pflags version of this was just as convoluted. // The pflags version of this was just as convoluted.
if ((state >= S_PLAY_STND && state <= S_PLAY_TAP2) || (state >= S_PLAY_TEETER1 && state <= S_PLAY_TEETER2) || state == S_PLAY_CARRY switch(state)
|| state == S_PLAY_SUPERSTAND || state == S_PLAY_SUPERTEETER) {
case S_PLAY_STND:
case S_PLAY_WAIT:
case S_PLAY_EDGE:
case S_PLAY_RIDE:
case S_PLAY_SUPER_STND:
case S_PLAY_SUPER_EDGE:
player->panim = PA_IDLE; player->panim = PA_IDLE;
else if ((state >= S_PLAY_RUN1 && state <= S_PLAY_RUN8) break;
|| (state >= S_PLAY_SUPERWALK1 && state <= S_PLAY_SUPERWALK2)) case S_PLAY_WALK:
case S_PLAY_SUPER_WALK:
player->panim = PA_WALK; player->panim = PA_WALK;
else if ((state >= S_PLAY_SPD1 && state <= S_PLAY_SPD4) break;
|| (state >= S_PLAY_SUPERFLY1 && state <= S_PLAY_SUPERFLY2)) case S_PLAY_RUN:
case S_PLAY_SUPER_RUN:
player->panim = PA_RUN; player->panim = PA_RUN;
else if (state >= S_PLAY_ATK1 && state <= S_PLAY_ATK4) break;
case S_PLAY_SPIN:
player->panim = PA_ROLL; player->panim = PA_ROLL;
else if (state >= S_PLAY_FALL1 && state <= S_PLAY_FALL2) break;
case S_PLAY_FALL:
player->panim = PA_FALL; player->panim = PA_FALL;
else if (state >= S_PLAY_ABL1 && state <= S_PLAY_ABL2) break;
case S_PLAY_FLY:
case S_PLAY_GLIDE:
player->panim = PA_ABILITY; player->panim = PA_ABILITY;
else break;
default:
player->panim = PA_ETC; player->panim = PA_ETC;
break;
}
if (recursion++) // if recursion detected, if (recursion++) // if recursion detected,
memset(seenstate = tempstate, 0, sizeof tempstate); // clear state table memset(seenstate = tempstate, 0, sizeof tempstate); // clear state table
@ -274,8 +269,29 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
} }
} }
mobj->sprite = st->sprite; // Player animations
mobj->frame = st->frame; if (st->sprite == SPR_PLAY)
{
UINT8 spr2 = st->frame & FF_FRAMEMASK;
UINT16 frame = (mobj->frame & FF_FRAMEMASK)+1;
if (mobj->sprite != SPR_PLAY)
{
mobj->sprite = SPR_PLAY;
frame = 0;
}
else if (mobj->sprite2 != spr2)
frame = 0;
mobj->sprite2 = spr2;
if (!mobj->skin || frame >= ((skin_t *)mobj->skin)->sprites[spr2].numframes)
frame = 0;
mobj->frame = frame|(st->frame&~FF_FRAMEMASK);
}
// Regular sprites
else
{
mobj->sprite = st->sprite;
mobj->frame = st->frame;
}
// Modified handling. // Modified handling.
// Call action functions when the state is set // Call action functions when the state is set
@ -341,8 +357,30 @@ boolean P_SetMobjState(mobj_t *mobj, statenum_t state)
st = &states[state]; st = &states[state];
mobj->state = st; mobj->state = st;
mobj->tics = st->tics; mobj->tics = st->tics;
mobj->sprite = st->sprite;
mobj->frame = st->frame; // Player animations
if (st->sprite == SPR_PLAY)
{
UINT8 spr2 = st->frame & FF_FRAMEMASK;
UINT16 frame = (mobj->frame & FF_FRAMEMASK)+1;
if (mobj->sprite != SPR_PLAY)
{
mobj->sprite = SPR_PLAY;
frame = 0;
}
else if (mobj->sprite2 != spr2)
frame = 0;
mobj->sprite2 = spr2;
if (!mobj->skin || frame >= ((skin_t *)mobj->skin)->sprites[spr2].numframes)
frame = 0;
mobj->frame = frame|(st->frame&~FF_FRAMEMASK);
}
// Regular sprites
else
{
mobj->sprite = st->sprite;
mobj->frame = st->frame;
}
// Modified handling. // Modified handling.
// Call action functions when the state is set // Call action functions when the state is set
@ -820,7 +858,7 @@ void P_CheckGravity(mobj_t *mo, boolean affect)
if (mo->player) if (mo->player)
{ {
if (mo->player->charability == CA_FLY && (mo->player->powers[pw_tailsfly] if (mo->player->charability == CA_FLY && (mo->player->powers[pw_tailsfly]
|| (mo->state >= &states[S_PLAY_SPC1] && mo->state <= &states[S_PLAY_SPC4]))) || mo->state-states == S_PLAY_FLY_TIRED))
gravityadd = gravityadd/3; // less gravity while flying gravityadd = gravityadd/3; // less gravity while flying
if (mo->player->pflags & PF_GLIDING) if (mo->player->pflags & PF_GLIDING)
gravityadd = gravityadd/3; // less gravity while gliding gravityadd = gravityadd/3; // less gravity while gliding
@ -2018,7 +2056,7 @@ static void P_PlayerZMovement(mobj_t *mo)
goto nightsdone; goto nightsdone;
} }
// Get up if you fell. // Get up if you fell.
if (mo->state == &states[mo->info->painstate] || mo->state == &states[S_PLAY_SUPERHIT]) if (mo->state == &states[mo->info->painstate] || mo->state-states == S_PLAY_SUPER_PAIN)
P_SetPlayerMobjState(mo, S_PLAY_STND); P_SetPlayerMobjState(mo, S_PLAY_STND);
if (P_MobjFlip(mo)*mo->momz < 0) // falling if (P_MobjFlip(mo)*mo->momz < 0) // falling
@ -2116,23 +2154,23 @@ static void P_PlayerZMovement(mobj_t *mo)
mo->tics = -1; mo->tics = -1;
} }
else if (mo->player->pflags & PF_JUMPED || (mo->player->pflags & (PF_SPINNING|PF_USEDOWN)) != (PF_SPINNING|PF_USEDOWN) else if (mo->player->pflags & PF_JUMPED || (mo->player->pflags & (PF_SPINNING|PF_USEDOWN)) != (PF_SPINNING|PF_USEDOWN)
|| mo->player->powers[pw_tailsfly] || (mo->state >= &states[S_PLAY_SPC1] && mo->state <= &states[S_PLAY_SPC4])) || mo->player->powers[pw_tailsfly] || mo->state-states == S_PLAY_FLY_TIRED)
{ {
if (mo->player->cmomx || mo->player->cmomy) if (mo->player->cmomx || mo->player->cmomy)
{ {
if (mo->player->speed >= FixedMul(mo->player->runspeed, mo->scale) && mo->player->panim != PA_RUN) if (mo->player->speed >= FixedMul(mo->player->runspeed, mo->scale) && mo->player->panim != PA_RUN)
P_SetPlayerMobjState(mo, S_PLAY_SPD1); P_SetPlayerMobjState(mo, S_PLAY_RUN);
else if ((mo->player->rmomx || mo->player->rmomy) && mo->player->panim != PA_WALK) else if ((mo->player->rmomx || mo->player->rmomy) && mo->player->panim != PA_WALK)
P_SetPlayerMobjState(mo, S_PLAY_RUN1); P_SetPlayerMobjState(mo, S_PLAY_WALK);
else if (!mo->player->rmomx && !mo->player->rmomy && mo->player->panim != PA_IDLE) else if (!mo->player->rmomx && !mo->player->rmomy && mo->player->panim != PA_IDLE)
P_SetPlayerMobjState(mo, S_PLAY_STND); P_SetPlayerMobjState(mo, S_PLAY_STND);
} }
else else
{ {
if (mo->player->speed >= FixedMul(mo->player->runspeed, mo->scale) && mo->player->panim != PA_RUN) if (mo->player->speed >= FixedMul(mo->player->runspeed, mo->scale) && mo->player->panim != PA_RUN)
P_SetPlayerMobjState(mo, S_PLAY_SPD1); P_SetPlayerMobjState(mo, S_PLAY_RUN);
else if ((mo->momx || mo->momy) && mo->player->panim != PA_WALK) else if ((mo->momx || mo->momy) && mo->player->panim != PA_WALK)
P_SetPlayerMobjState(mo, S_PLAY_RUN1); P_SetPlayerMobjState(mo, S_PLAY_WALK);
else if (!mo->momx && !mo->momy && mo->player->panim != PA_IDLE) else if (!mo->momx && !mo->momy && mo->player->panim != PA_IDLE)
P_SetPlayerMobjState(mo, S_PLAY_STND); P_SetPlayerMobjState(mo, S_PLAY_STND);
} }
@ -3027,7 +3065,7 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
{ {
mobj->player->secondjump = 0; mobj->player->secondjump = 0;
mobj->player->powers[pw_tailsfly] = 0; mobj->player->powers[pw_tailsfly] = 0;
P_SetPlayerMobjState(mobj, S_PLAY_RUN1); P_SetPlayerMobjState(mobj, S_PLAY_WALK);
} }
} }
mobj->pmomz = 0; mobj->pmomz = 0;
@ -6651,7 +6689,7 @@ for (i = ((mobj->flags2 & MF2_STRONGBOX) ? strongboxamt : weakboxamt); i; --i) s
{ {
mobj->player->secondjump = 0; mobj->player->secondjump = 0;
mobj->player->powers[pw_tailsfly] = 0; mobj->player->powers[pw_tailsfly] = 0;
P_SetPlayerMobjState(mobj, S_PLAY_RUN1); P_SetPlayerMobjState(mobj, S_PLAY_WALK);
} }
} }
mobj->pmomz = 0; // to prevent that weird rocketing gargoyle bug mobj->pmomz = 0; // to prevent that weird rocketing gargoyle bug
@ -6862,7 +6900,7 @@ void P_SceneryThinker(mobj_t *mobj)
{ {
mobj->player->secondjump = 0; mobj->player->secondjump = 0;
mobj->player->powers[pw_tailsfly] = 0; mobj->player->powers[pw_tailsfly] = 0;
P_SetPlayerMobjState(mobj, S_PLAY_RUN1); P_SetPlayerMobjState(mobj, S_PLAY_WALK);
} }
} }
mobj->pmomz = 0; // to prevent that weird rocketing gargoyle bug mobj->pmomz = 0; // to prevent that weird rocketing gargoyle bug

View File

@ -265,6 +265,7 @@ typedef struct mobj_s
angle_t angle; // orientation angle_t angle; // orientation
spritenum_t sprite; // used to find patch_t and flip value spritenum_t sprite; // used to find patch_t and flip value
UINT32 frame; // frame number, plus bits see p_pspr.h UINT32 frame; // frame number, plus bits see p_pspr.h
UINT8 sprite2; // player sprites
struct msecnode_s *touching_sectorlist; // a linked list of sectors where this object appears struct msecnode_s *touching_sectorlist; // a linked list of sectors where this object appears

View File

@ -1169,8 +1169,11 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
WRITEUINT16(save_p, mobj->state-states); WRITEUINT16(save_p, mobj->state-states);
if (diff & MD_TICS) if (diff & MD_TICS)
WRITEINT32(save_p, mobj->tics); WRITEINT32(save_p, mobj->tics);
if (diff & MD_SPRITE) if (diff & MD_SPRITE) {
WRITEUINT16(save_p, mobj->sprite); WRITEUINT16(save_p, mobj->sprite);
if (mobj->sprite == SPR_PLAY)
WRITEUINT8(save_p, mobj->sprite2);
}
if (diff & MD_FRAME) if (diff & MD_FRAME)
WRITEUINT32(save_p, mobj->frame); WRITEUINT32(save_p, mobj->frame);
if (diff & MD_EFLAGS) if (diff & MD_EFLAGS)
@ -1991,10 +1994,16 @@ static void LoadMobjThinker(actionf_p1 thinker)
mobj->tics = READINT32(save_p); mobj->tics = READINT32(save_p);
else else
mobj->tics = mobj->state->tics; mobj->tics = mobj->state->tics;
if (diff & MD_SPRITE) if (diff & MD_SPRITE) {
mobj->sprite = READUINT16(save_p); mobj->sprite = READUINT16(save_p);
else if (mobj->sprite == SPR_PLAY)
mobj->sprite2 = READUINT8(save_p);
}
else {
mobj->sprite = mobj->state->sprite; mobj->sprite = mobj->state->sprite;
if (mobj->sprite == SPR_PLAY)
mobj->sprite2 = mobj->state->frame&FF_FRAMEMASK;
}
if (diff & MD_FRAME) if (diff & MD_FRAME)
mobj->frame = READUINT32(save_p); mobj->frame = READUINT32(save_p);
else else

View File

@ -3684,7 +3684,7 @@ DoneSection2:
if (!(player->pflags & PF_SPINNING)) if (!(player->pflags & PF_SPINNING))
player->pflags |= PF_SPINNING; player->pflags |= PF_SPINNING;
P_SetPlayerMobjState(player->mo, S_PLAY_ATK1); P_SetPlayerMobjState(player->mo, S_PLAY_SPIN);
} }
player->powers[pw_flashing] = TICRATE/3; player->powers[pw_flashing] = TICRATE/3;
@ -3826,7 +3826,7 @@ DoneSection2:
P_ResetPlayer(player); P_ResetPlayer(player);
if (player->panim != PA_FALL) if (player->panim != PA_FALL)
P_SetPlayerMobjState(player->mo, S_PLAY_FALL1); P_SetPlayerMobjState(player->mo, S_PLAY_FALL);
break; break;
case 6: // Super Sonic transformer case 6: // Super Sonic transformer
@ -3838,7 +3838,7 @@ DoneSection2:
if (!(player->pflags & PF_SPINNING) && P_IsObjectOnGround(player->mo) && (player->charability2 == CA2_SPINDASH)) if (!(player->pflags & PF_SPINNING) && P_IsObjectOnGround(player->mo) && (player->charability2 == CA2_SPINDASH))
{ {
player->pflags |= PF_SPINNING; player->pflags |= PF_SPINNING;
P_SetPlayerMobjState(player->mo, S_PLAY_ATK1); P_SetPlayerMobjState(player->mo, S_PLAY_SPIN);
S_StartAttackSound(player->mo, sfx_spin); S_StartAttackSound(player->mo, sfx_spin);
if (abs(player->rmomx) < FixedMul(5*FRACUNIT, player->mo->scale) if (abs(player->rmomx) < FixedMul(5*FRACUNIT, player->mo->scale)
@ -3912,9 +3912,9 @@ DoneSection2:
player->pflags &= ~PF_GLIDING; player->pflags &= ~PF_GLIDING;
player->climbing = 0; player->climbing = 0;
if (!(player->mo->state >= &states[S_PLAY_ATK1] && player->mo->state <= &states[S_PLAY_ATK4])) if (player->mo->state-states != S_PLAY_SPIN)
{ {
P_SetPlayerMobjState(player->mo, S_PLAY_ATK1); P_SetPlayerMobjState(player->mo, S_PLAY_SPIN);
S_StartSound(player->mo, sfx_spin); S_StartSound(player->mo, sfx_spin);
} }
} }
@ -3984,9 +3984,9 @@ DoneSection2:
player->pflags |= PF_SPINNING; player->pflags |= PF_SPINNING;
player->pflags &= ~PF_JUMPED; player->pflags &= ~PF_JUMPED;
if (!(player->mo->state >= &states[S_PLAY_ATK1] && player->mo->state <= &states[S_PLAY_ATK4])) if (player->mo->state-states != S_PLAY_SPIN)
{ {
P_SetPlayerMobjState(player->mo, S_PLAY_ATK1); P_SetPlayerMobjState(player->mo, S_PLAY_SPIN);
S_StartSound(player->mo, sfx_spin); S_StartSound(player->mo, sfx_spin);
} }
} }
@ -4289,7 +4289,7 @@ DoneSection2:
player->pflags &= ~PF_SLIDING; player->pflags &= ~PF_SLIDING;
player->climbing = 0; player->climbing = 0;
P_SetThingPosition(player->mo); P_SetThingPosition(player->mo);
P_SetPlayerMobjState(player->mo, S_PLAY_CARRY); P_SetPlayerMobjState(player->mo, S_PLAY_RIDE);
} }
break; break;
case 12: // Camera noclip case 12: // Camera noclip

View File

@ -607,7 +607,7 @@ static void P_DeNightserizePlayer(player_t *player)
if (player->mo->tracer) if (player->mo->tracer)
P_RemoveMobj(player->mo->tracer); P_RemoveMobj(player->mo->tracer);
P_SetPlayerMobjState(player->mo, S_PLAY_FALL1); P_SetPlayerMobjState(player->mo, S_PLAY_FALL);
player->pflags |= PF_NIGHTSFALL; player->pflags |= PF_NIGHTSFALL;
// If in a special stage, add some preliminary exit time. // If in a special stage, add some preliminary exit time.
@ -970,7 +970,7 @@ void P_DoSuperTransformation(player_t *player, boolean giverings)
S_StartSound(NULL, sfx_supert); //let all players hear it -mattw_cfi S_StartSound(NULL, sfx_supert); //let all players hear it -mattw_cfi
// Transformation animation // Transformation animation
P_SetPlayerMobjState(player->mo, S_PLAY_SUPERTRANS1); P_SetPlayerMobjState(player->mo, S_PLAY_SUPER_TRANS);
player->mo->momx = player->mo->momy = player->mo->momz = 0; player->mo->momx = player->mo->momy = player->mo->momz = 0;
@ -1444,6 +1444,7 @@ mobj_t *P_SpawnGhostMobj(mobj_t *mobj)
ghost->angle = mobj->angle; ghost->angle = mobj->angle;
ghost->sprite = mobj->sprite; ghost->sprite = mobj->sprite;
ghost->sprite2 = mobj->sprite2;
ghost->frame = mobj->frame; ghost->frame = mobj->frame;
ghost->tics = -1; ghost->tics = -1;
ghost->frame &= ~FF_TRANSMASK; ghost->frame &= ~FF_TRANSMASK;
@ -1596,7 +1597,7 @@ void P_DoPlayerExit(player_t *player)
{ {
player->climbing = 0; player->climbing = 0;
player->pflags |= PF_JUMPED; player->pflags |= PF_JUMPED;
P_SetPlayerMobjState(player->mo, S_PLAY_ATK1); P_SetPlayerMobjState(player->mo, S_PLAY_SPIN);
} }
player->powers[pw_underwater] = 0; player->powers[pw_underwater] = 0;
player->powers[pw_spacetime] = 0; player->powers[pw_spacetime] = 0;
@ -2596,10 +2597,10 @@ static void P_DoClimbing(player_t *player)
climb = false; climb = false;
if (player->climbing && climb && (player->mo->momx || player->mo->momy || player->mo->momz) if (player->climbing && climb && (player->mo->momx || player->mo->momy || player->mo->momz)
&& !(player->mo->state >= &states[S_PLAY_CLIMB2] && player->mo->state <= &states[S_PLAY_CLIMB5])) && player->mo->state-states != S_PLAY_CLIMB)
P_SetPlayerMobjState(player->mo, S_PLAY_CLIMB2); P_SetPlayerMobjState(player->mo, S_PLAY_CLIMB);
else if ((!(player->mo->momx || player->mo->momy || player->mo->momz) || !climb) && player->mo->state != &states[S_PLAY_CLIMB1]) else if ((!(player->mo->momx || player->mo->momy || player->mo->momz) || !climb) && player->mo->state-states != S_PLAY_CLING)
P_SetPlayerMobjState(player->mo, S_PLAY_CLIMB1); P_SetPlayerMobjState(player->mo, S_PLAY_CLING);
if (!floorclimb) if (!floorclimb)
{ {
@ -2610,21 +2611,21 @@ static void P_DoClimbing(player_t *player)
player->climbing = 0; player->climbing = 0;
player->pflags |= PF_JUMPED; player->pflags |= PF_JUMPED;
P_SetPlayerMobjState(player->mo, S_PLAY_ATK1); P_SetPlayerMobjState(player->mo, S_PLAY_SPIN);
} }
if (skyclimber) if (skyclimber)
{ {
player->climbing = 0; player->climbing = 0;
player->pflags |= PF_JUMPED; player->pflags |= PF_JUMPED;
P_SetPlayerMobjState(player->mo, S_PLAY_ATK1); P_SetPlayerMobjState(player->mo, S_PLAY_SPIN);
} }
} }
else else
{ {
player->climbing = 0; player->climbing = 0;
player->pflags |= PF_JUMPED; player->pflags |= PF_JUMPED;
P_SetPlayerMobjState(player->mo, S_PLAY_ATK1); P_SetPlayerMobjState(player->mo, S_PLAY_SPIN);
} }
if (cmd->sidemove != 0 || cmd->forwardmove != 0) if (cmd->sidemove != 0 || cmd->forwardmove != 0)
@ -2633,16 +2634,16 @@ static void P_DoClimbing(player_t *player)
climb = false; climb = false;
if (player->climbing && climb && (player->mo->momx || player->mo->momy || player->mo->momz) if (player->climbing && climb && (player->mo->momx || player->mo->momy || player->mo->momz)
&& !(player->mo->state >= &states[S_PLAY_CLIMB2] && player->mo->state <= &states[S_PLAY_CLIMB5])) && player->mo->state-states != S_PLAY_CLIMB)
P_SetPlayerMobjState(player->mo, S_PLAY_CLIMB2); P_SetPlayerMobjState(player->mo, S_PLAY_CLIMB);
else if ((!(player->mo->momx || player->mo->momy || player->mo->momz) || !climb) && player->mo->state != &states[S_PLAY_CLIMB1]) else if ((!(player->mo->momx || player->mo->momy || player->mo->momz) || !climb) && player->mo->state-states != S_PLAY_CLING)
P_SetPlayerMobjState(player->mo, S_PLAY_CLIMB1); P_SetPlayerMobjState(player->mo, S_PLAY_CLING);
if (cmd->buttons & BT_USE && !(player->pflags & PF_JUMPSTASIS)) if (cmd->buttons & BT_USE && !(player->pflags & PF_JUMPSTASIS))
{ {
player->climbing = 0; player->climbing = 0;
player->pflags |= PF_JUMPED; player->pflags |= PF_JUMPED;
P_SetPlayerMobjState(player->mo, S_PLAY_ATK1); P_SetPlayerMobjState(player->mo, S_PLAY_SPIN);
P_SetObjectMomZ(player->mo, 4*FRACUNIT, false); P_SetObjectMomZ(player->mo, 4*FRACUNIT, false);
P_InstaThrust(player->mo, player->mo->angle, FixedMul(-4*FRACUNIT, player->mo->scale)); P_InstaThrust(player->mo, player->mo->angle, FixedMul(-4*FRACUNIT, player->mo->scale));
} }
@ -2653,7 +2654,7 @@ static void P_DoClimbing(player_t *player)
localangle2 = player->mo->angle; localangle2 = player->mo->angle;
if (player->climbing == 0) if (player->climbing == 0)
P_SetPlayerMobjState(player->mo, S_PLAY_ATK1); P_SetPlayerMobjState(player->mo, S_PLAY_SPIN);
if (player->climbing && P_IsObjectOnGround(player->mo)) if (player->climbing && P_IsObjectOnGround(player->mo))
{ {
@ -3081,10 +3082,10 @@ teeterdone:
} }
if (teeter) if (teeter)
{ {
if ((player->mo->state == &states[S_PLAY_STND] || player->mo->state == &states[S_PLAY_TAP1] || player->mo->state == &states[S_PLAY_TAP2] || player->mo->state == &states[S_PLAY_SUPERSTAND])) if (player->panim == PA_IDLE && player->mo->state-states != S_PLAY_EDGE)
P_SetPlayerMobjState(player->mo, S_PLAY_TEETER1); P_SetPlayerMobjState(player->mo, S_PLAY_EDGE);
} }
else if (checkedforteeter && (player->mo->state == &states[S_PLAY_TEETER1] || player->mo->state == &states[S_PLAY_TEETER2] || player->mo->state == &states[S_PLAY_SUPERTEETER])) else if (checkedforteeter && (player->mo->state-states == S_PLAY_EDGE || player->mo->state-states == S_PLAY_SUPER_EDGE))
P_SetPlayerMobjState(player->mo, S_PLAY_STND); P_SetPlayerMobjState(player->mo, S_PLAY_STND);
} }
@ -3331,7 +3332,7 @@ firenormal:
static void P_DoSuperStuff(player_t *player) static void P_DoSuperStuff(player_t *player)
{ {
ticcmd_t *cmd = &player->cmd; ticcmd_t *cmd = &player->cmd;
if (player->mo->state >= &states[S_PLAY_SUPERTRANS1] && player->mo->state <= &states[S_PLAY_SUPERTRANS9]) if (player->mo->state >= &states[S_PLAY_SUPER_TRANS] && player->mo->state <= &states[S_PLAY_SUPER_TRANS9])
return; // don't do anything right now, we're in the middle of transforming! return; // don't do anything right now, we're in the middle of transforming!
if (player->pflags & PF_NIGHTSMODE) if (player->pflags & PF_NIGHTSMODE)
@ -3426,11 +3427,11 @@ static void P_DoSuperStuff(player_t *player)
if (player->mo->health > 0) if (player->mo->health > 0)
{ {
if ((player->pflags & PF_JUMPED) || (player->pflags & PF_SPINNING)) if ((player->pflags & PF_JUMPED) || (player->pflags & PF_SPINNING))
P_SetPlayerMobjState(player->mo, S_PLAY_ATK1); P_SetPlayerMobjState(player->mo, S_PLAY_SPIN);
else if (player->panim == PA_RUN) else if (player->panim == PA_RUN)
P_SetPlayerMobjState(player->mo, S_PLAY_SPD1); P_SetPlayerMobjState(player->mo, S_PLAY_RUN);
else if (player->panim == PA_WALK) else if (player->panim == PA_WALK)
P_SetPlayerMobjState(player->mo, S_PLAY_RUN1); P_SetPlayerMobjState(player->mo, S_PLAY_WALK);
else else
P_SetPlayerMobjState(player->mo, S_PLAY_STND); P_SetPlayerMobjState(player->mo, S_PLAY_STND);
@ -3633,9 +3634,9 @@ void P_DoJump(player_t *player, boolean soundandstate)
S_StartSound(player->mo, sfx_jump); // Play jump sound! S_StartSound(player->mo, sfx_jump); // Play jump sound!
if (!(player->charability2 == CA2_SPINDASH)) if (!(player->charability2 == CA2_SPINDASH))
P_SetPlayerMobjState(player->mo, S_PLAY_SPRING); P_SetPlayerMobjState(player->mo, S_PLAY_JUMP);
else else
P_SetPlayerMobjState(player->mo, S_PLAY_ATK1); P_SetPlayerMobjState(player->mo, S_PLAY_SPIN);
} }
} }
@ -3668,7 +3669,7 @@ static void P_DoSpinDash(player_t *player, ticcmd_t *cmd)
player->pflags |= PF_STARTDASH|PF_SPINNING; player->pflags |= PF_STARTDASH|PF_SPINNING;
player->dashspeed = FixedMul(FRACUNIT, player->mo->scale); player->dashspeed = FixedMul(FRACUNIT, player->mo->scale);
player->dashtime = 0; player->dashtime = 0;
P_SetPlayerMobjState(player->mo, S_PLAY_ATK1); P_SetPlayerMobjState(player->mo, S_PLAY_SPIN);
player->pflags |= PF_USEDOWN; player->pflags |= PF_USEDOWN;
} }
else if ((cmd->buttons & BT_USE) && (player->pflags & PF_STARTDASH)) else if ((cmd->buttons & BT_USE) && (player->pflags & PF_STARTDASH))
@ -3693,7 +3694,7 @@ static void P_DoSpinDash(player_t *player, ticcmd_t *cmd)
&& !player->climbing && !player->mo->momz && onground && player->speed > FixedMul(5<<FRACBITS, player->mo->scale) && !(player->pflags & PF_USEDOWN) && !(player->pflags & PF_SPINNING)) && !player->climbing && !player->mo->momz && onground && player->speed > FixedMul(5<<FRACBITS, player->mo->scale) && !(player->pflags & PF_USEDOWN) && !(player->pflags & PF_SPINNING))
{ {
player->pflags |= PF_SPINNING; player->pflags |= PF_SPINNING;
P_SetPlayerMobjState(player->mo, S_PLAY_ATK1); P_SetPlayerMobjState(player->mo, S_PLAY_SPIN);
if (!player->spectator) if (!player->spectator)
S_StartSound(player->mo, sfx_spin); S_StartSound(player->mo, sfx_spin);
player->pflags |= PF_USEDOWN; player->pflags |= PF_USEDOWN;
@ -3733,7 +3734,7 @@ static void P_DoSpinDash(player_t *player, ticcmd_t *cmd)
} }
if (onground && (player->pflags & PF_SPINNING) && !(player->panim == PA_ROLL)) if (onground && (player->pflags & PF_SPINNING) && !(player->panim == PA_ROLL))
P_SetPlayerMobjState(player->mo, S_PLAY_ATK1); P_SetPlayerMobjState(player->mo, S_PLAY_SPIN);
} }
// //
@ -3753,7 +3754,7 @@ void P_DoJumpShield(player_t *player)
player->jumping = 0; player->jumping = 0;
player->pflags |= PF_THOKKED; player->pflags |= PF_THOKKED;
player->pflags &= ~PF_SPINNING; player->pflags &= ~PF_SPINNING;
P_SetPlayerMobjState(player->mo, S_PLAY_FALL1); P_SetPlayerMobjState(player->mo, S_PLAY_FALL);
S_StartSound(player->mo, sfx_wdjump); S_StartSound(player->mo, sfx_wdjump);
} }
@ -3980,7 +3981,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
; // Can't do anything if you're a fish out of water! ; // Can't do anything if you're a fish out of water!
else if (!(player->pflags & PF_THOKKED) && !(player->powers[pw_tailsfly])) else if (!(player->pflags & PF_THOKKED) && !(player->powers[pw_tailsfly]))
{ {
P_SetPlayerMobjState(player->mo, S_PLAY_ABL1); // Change to the flying animation P_SetPlayerMobjState(player->mo, S_PLAY_FLY); // Change to the flying animation
player->powers[pw_tailsfly] = tailsflytics + 1; // Set the fly timer player->powers[pw_tailsfly] = tailsflytics + 1; // Set the fly timer
@ -4006,7 +4007,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
player->pflags &= ~PF_THOKKED; player->pflags &= ~PF_THOKKED;
} }
P_SetPlayerMobjState(player->mo, S_PLAY_ABL1); P_SetPlayerMobjState(player->mo, S_PLAY_GLIDE);
P_InstaThrust(player->mo, player->mo->angle, FixedMul(glidespeed, player->mo->scale)); P_InstaThrust(player->mo, player->mo->angle, FixedMul(glidespeed, player->mo->scale));
player->pflags &= ~(PF_SPINNING|PF_STARTDASH); player->pflags &= ~(PF_SPINNING|PF_STARTDASH);
} }
@ -4240,7 +4241,7 @@ static void P_2dMovement(player_t *player)
else if (player->exiting) else if (player->exiting)
{ {
player->pflags &= ~PF_GLIDING; player->pflags &= ~PF_GLIDING;
P_SetPlayerMobjState(player->mo, S_PLAY_RUN1); P_SetPlayerMobjState(player->mo, S_PLAY_WALK);
player->skidtime = 0; player->skidtime = 0;
} }
} }
@ -4427,7 +4428,7 @@ static void P_3dMovement(player_t *player)
else if (player->exiting) else if (player->exiting)
{ {
player->pflags &= ~PF_GLIDING; player->pflags &= ~PF_GLIDING;
P_SetPlayerMobjState(player->mo, S_PLAY_RUN1); P_SetPlayerMobjState(player->mo, S_PLAY_WALK);
player->skidtime = 0; player->skidtime = 0;
} }
} }
@ -6165,7 +6166,7 @@ static void P_SkidStuff(player_t *player)
{ {
player->skidtime = 0; player->skidtime = 0;
player->pflags &= ~(PF_GLIDING|PF_JUMPED); player->pflags &= ~(PF_GLIDING|PF_JUMPED);
P_SetPlayerMobjState(player->mo, S_PLAY_FALL1); P_SetPlayerMobjState(player->mo, S_PLAY_FALL);
} }
// Get up and brush yourself off, idiot. // Get up and brush yourself off, idiot.
else if (player->glidetime > 15) else if (player->glidetime > 15)
@ -6231,7 +6232,7 @@ static void P_SkidStuff(player_t *player)
player->skidtime = TICRATE/2; player->skidtime = TICRATE/2;
S_StartSound(player->mo, sfx_skid); S_StartSound(player->mo, sfx_skid);
if (player->panim != PA_WALK) if (player->panim != PA_WALK)
P_SetPlayerMobjState(player->mo, S_PLAY_RUN4); // this switches to S_PLAY_SUPERWALK1 for superanims P_SetPlayerMobjState(player->mo, S_PLAY_WALK);
player->mo->tics = player->skidtime; player->mo->tics = player->skidtime;
} }
} }
@ -6256,7 +6257,7 @@ static void P_MovePlayer(player_t *player)
if (countdowntimeup) if (countdowntimeup)
return; return;
if (player->mo->state >= &states[S_PLAY_SUPERTRANS1] && player->mo->state <= &states[S_PLAY_SUPERTRANS9]) if (player->mo->state >= &states[S_PLAY_SUPER_TRANS] && player->mo->state <= &states[S_PLAY_SUPER_TRANS9])
{ {
player->mo->momx = player->mo->momy = player->mo->momz = 0; player->mo->momx = player->mo->momy = player->mo->momz = 0;
return; return;
@ -6405,23 +6406,23 @@ static void P_MovePlayer(player_t *player)
// If the player is moving fast enough, // If the player is moving fast enough,
// break into a run! // break into a run!
if (player->speed >= runspd && player->panim == PA_WALK && !player->skidtime && (onground || player->powers[pw_super])) if (player->speed >= runspd && player->panim == PA_WALK && !player->skidtime && (onground || player->powers[pw_super]))
P_SetPlayerMobjState (player->mo, S_PLAY_SPD1); P_SetPlayerMobjState (player->mo, S_PLAY_RUN);
// Otherwise, just walk. // Otherwise, just walk.
else if ((player->rmomx || player->rmomy) && player->panim == PA_IDLE) else if ((player->rmomx || player->rmomy) && player->panim == PA_IDLE)
P_SetPlayerMobjState (player->mo, S_PLAY_RUN1); P_SetPlayerMobjState (player->mo, S_PLAY_WALK);
} }
// If your running animation is playing, and you're // If your running animation is playing, and you're
// going too slow, switch back to the walking frames. // going too slow, switch back to the walking frames.
if (player->panim == PA_RUN && player->speed < runspd) if (player->panim == PA_RUN && player->speed < runspd)
P_SetPlayerMobjState(player->mo, S_PLAY_RUN1); P_SetPlayerMobjState(player->mo, S_PLAY_WALK);
// If Springing, but travelling DOWNWARD, change back! // If Springing, but travelling DOWNWARD, change back!
if (player->mo->state == &states[S_PLAY_SPRING] && P_MobjFlip(player->mo)*player->mo->momz < 0) if (player->mo->state == &states[S_PLAY_JUMP] && P_MobjFlip(player->mo)*player->mo->momz < 0)
P_SetPlayerMobjState(player->mo, S_PLAY_FALL1); P_SetPlayerMobjState(player->mo, S_PLAY_FALL);
// If Springing but on the ground, change back! // If Springing but on the ground, change back!
else if (onground && (player->mo->state == &states[S_PLAY_SPRING] || player->panim == PA_FALL || player->mo->state == &states[S_PLAY_CARRY]) && !player->mo->momz) else if (onground && (player->mo->state == &states[S_PLAY_JUMP] || player->panim == PA_FALL || player->mo->state == &states[S_PLAY_RIDE]) && !player->mo->momz)
P_SetPlayerMobjState(player->mo, S_PLAY_STND); P_SetPlayerMobjState(player->mo, S_PLAY_STND);
// If you are stopped and are still walking, stand still! // If you are stopped and are still walking, stand still!
@ -6456,11 +6457,11 @@ static void P_MovePlayer(player_t *player)
if (player->pflags & PF_GLIDING || player->climbing) if (player->pflags & PF_GLIDING || player->climbing)
{ {
if (onground) if (onground)
P_SetPlayerMobjState(player->mo, S_PLAY_RUN1); P_SetPlayerMobjState(player->mo, S_PLAY_WALK);
else else
{ {
player->pflags |= PF_JUMPED; player->pflags |= PF_JUMPED;
P_SetPlayerMobjState(player->mo, S_PLAY_ATK1); P_SetPlayerMobjState(player->mo, S_PLAY_SPIN);
} }
} }
player->pflags &= ~PF_GLIDING; player->pflags &= ~PF_GLIDING;
@ -6513,19 +6514,19 @@ static void P_MovePlayer(player_t *player)
{ {
P_ResetPlayer(player); // down, stop gliding. P_ResetPlayer(player); // down, stop gliding.
if (onground) if (onground)
P_SetPlayerMobjState(player->mo, S_PLAY_RUN1); P_SetPlayerMobjState(player->mo, S_PLAY_WALK);
else if ((player->charability2 == CA2_MULTIABILITY) else if ((player->charability2 == CA2_MULTIABILITY)
|| (player->powers[pw_super] && ALL7EMERALDS(player->powers[pw_emeralds]) && player->charability == CA_GLIDEANDCLIMB)) || (player->powers[pw_super] && ALL7EMERALDS(player->powers[pw_emeralds]) && player->charability == CA_GLIDEANDCLIMB))
{ {
player->pflags |= PF_JUMPED; player->pflags |= PF_JUMPED;
P_SetPlayerMobjState(player->mo, S_PLAY_ATK1); P_SetPlayerMobjState(player->mo, S_PLAY_SPIN);
} }
else else
{ {
player->pflags |= PF_THOKKED; player->pflags |= PF_THOKKED;
player->mo->momx >>= 1; player->mo->momx >>= 1;
player->mo->momy >>= 1; player->mo->momy >>= 1;
P_SetPlayerMobjState(player->mo, S_PLAY_FALL1); P_SetPlayerMobjState(player->mo, S_PLAY_FALL);
} }
} }
} }
@ -6581,14 +6582,14 @@ static void P_MovePlayer(player_t *player)
if (!(player->charability == CA_FLY || player->charability == CA_SWIM)) // why are you flying when you cannot fly?! if (!(player->charability == CA_FLY || player->charability == CA_SWIM)) // why are you flying when you cannot fly?!
{ {
if (player->powers[pw_tailsfly] if (player->powers[pw_tailsfly]
|| (player->mo->state >= &states[S_PLAY_SPC1] && player->mo->state <= &states[S_PLAY_SPC4])) || player->mo->state-states == S_PLAY_FLY_TIRED)
{ {
if (onground) if (onground)
P_SetPlayerMobjState(player->mo, S_PLAY_RUN1); P_SetPlayerMobjState(player->mo, S_PLAY_WALK);
else else
{ {
player->pflags |= PF_JUMPED; player->pflags |= PF_JUMPED;
P_SetPlayerMobjState(player->mo, S_PLAY_ATK1); P_SetPlayerMobjState(player->mo, S_PLAY_SPIN);
} }
} }
player->powers[pw_tailsfly] = 0; player->powers[pw_tailsfly] = 0;
@ -6640,11 +6641,10 @@ static void P_MovePlayer(player_t *player)
{ {
// Tails-gets-tired Stuff // Tails-gets-tired Stuff
if (player->panim == PA_ABILITY) if (player->panim == PA_ABILITY)
P_SetPlayerMobjState(player->mo, S_PLAY_SPC4); P_SetPlayerMobjState(player->mo, S_PLAY_FLY_TIRED);
if (player->charability == CA_FLY && (leveltime % 10 == 0) if (player->charability == CA_FLY && (leveltime % 10 == 0)
&& player->mo->state >= &states[S_PLAY_SPC1] && player->mo->state-states == S_PLAY_FLY_TIRED
&& player->mo->state <= &states[S_PLAY_SPC4]
&& !player->spectator) && !player->spectator)
S_StartSound(player->mo, sfx_pudpud); S_StartSound(player->mo, sfx_pudpud);
} }
@ -6739,7 +6739,7 @@ static void P_MovePlayer(player_t *player)
} }
// Otherwise, face the direction you're travelling. // Otherwise, face the direction you're travelling.
else if (player->panim == PA_WALK || player->panim == PA_RUN || player->panim == PA_ROLL else if (player->panim == PA_WALK || player->panim == PA_RUN || player->panim == PA_ROLL
|| ((player->mo->state >= &states[S_PLAY_ABL1] && player->mo->state <= &states[S_PLAY_SPC4]) && player->charability == CA_FLY)) || (player->mo->state-states == S_PLAY_FLY || player->mo->state-states == S_PLAY_FLY_TIRED))
player->mo->angle = R_PointToAngle2(0, 0, player->rmomx, player->rmomy); player->mo->angle = R_PointToAngle2(0, 0, player->rmomx, player->rmomy);
// Update the local angle control. // Update the local angle control.
@ -6787,8 +6787,8 @@ static void P_MovePlayer(player_t *player)
if (player->charflags & SF_SUPER && player->powers[pw_super] && player->speed > FixedMul(5<<FRACBITS, player->mo->scale) if (player->charflags & SF_SUPER && player->powers[pw_super] && player->speed > FixedMul(5<<FRACBITS, player->mo->scale)
&& P_MobjFlip(player->mo)*player->mo->momz <= 0) && P_MobjFlip(player->mo)*player->mo->momz <= 0)
{ {
if (player->panim == PA_ROLL || player->mo->state == &states[S_PLAY_PAIN]) if (player->panim == PA_ROLL || player->mo->state-states == S_PLAY_PAIN)
P_SetPlayerMobjState(player->mo, S_PLAY_SUPERWALK1); P_SetPlayerMobjState(player->mo, S_PLAY_SUPER_WALK);
player->mo->momz = 0; player->mo->momz = 0;
player->pflags &= ~PF_SPINNING; player->pflags &= ~PF_SPINNING;
@ -6847,7 +6847,7 @@ static void P_MovePlayer(player_t *player)
} }
// Make sure you're not teetering when you shouldn't be. // Make sure you're not teetering when you shouldn't be.
if ((player->mo->state == &states[S_PLAY_TEETER1] || player->mo->state == &states[S_PLAY_TEETER2] || player->mo->state == &states[S_PLAY_SUPERTEETER]) if ((player->mo->state-states == S_PLAY_EDGE || player->mo->state-states == S_PLAY_SUPER_EDGE)
&& (player->mo->momx || player->mo->momy || player->mo->momz)) && (player->mo->momx || player->mo->momy || player->mo->momz))
P_SetPlayerMobjState(player->mo, S_PLAY_STND); P_SetPlayerMobjState(player->mo, S_PLAY_STND);
@ -6873,10 +6873,10 @@ static void P_MovePlayer(player_t *player)
fixed_t oldheight = player->mo->height; fixed_t oldheight = player->mo->height;
// Less height while spinning. Good for spinning under things...? // Less height while spinning. Good for spinning under things...?
if ((player->mo->state == &states[player->mo->info->painstate] || player->mo->state == &states[S_PLAY_SUPERHIT]) if ((player->mo->state == &states[player->mo->info->painstate] || player->mo->state == &states[S_PLAY_SUPER_PAIN])
|| (player->charability2 == CA2_SPINDASH && (player->pflags & (PF_SPINNING|PF_JUMPED))) || (player->charability2 == CA2_SPINDASH && (player->pflags & (PF_SPINNING|PF_JUMPED)))
|| player->powers[pw_tailsfly] || player->pflags & PF_GLIDING || player->powers[pw_tailsfly] || player->pflags & PF_GLIDING
|| (player->charability == CA_FLY && (player->mo->state >= &states[S_PLAY_SPC1] && player->mo->state <= &states[S_PLAY_SPC4]))) || (player->charability == CA_FLY && player->mo->state-states == S_PLAY_FLY_TIRED))
player->mo->height = P_GetPlayerSpinHeight(player); player->mo->height = P_GetPlayerSpinHeight(player);
else else
player->mo->height = P_GetPlayerHeight(player); player->mo->height = P_GetPlayerHeight(player);
@ -6892,7 +6892,7 @@ static void P_MovePlayer(player_t *player)
if ((player->charability2 == CA2_SPINDASH) && !(player->pflags & PF_SPINNING)) if ((player->charability2 == CA2_SPINDASH) && !(player->pflags & PF_SPINNING))
{ {
player->pflags |= PF_SPINNING; player->pflags |= PF_SPINNING;
P_SetPlayerMobjState(player->mo, S_PLAY_ATK1); P_SetPlayerMobjState(player->mo, S_PLAY_SPIN);
} }
else if (player->mo->ceilingz - player->mo->floorz < player->mo->height) else if (player->mo->ceilingz - player->mo->floorz < player->mo->height)
{ {
@ -7173,7 +7173,7 @@ static void P_DoRopeHang(player_t *player)
if (!(player->pflags & PF_SLIDING) && (player->pflags & PF_JUMPED) if (!(player->pflags & PF_SLIDING) && (player->pflags & PF_JUMPED)
&& !(player->panim == PA_ROLL) && player->charability2 == CA2_SPINDASH) && !(player->panim == PA_ROLL) && player->charability2 == CA2_SPINDASH)
P_SetPlayerMobjState(player->mo, S_PLAY_ATK1); P_SetPlayerMobjState(player->mo, S_PLAY_SPIN);
return; return;
} }
@ -7290,7 +7290,7 @@ static void P_DoRopeHang(player_t *player)
if (!(player->pflags & PF_SLIDING) && (player->pflags & PF_JUMPED) if (!(player->pflags & PF_SLIDING) && (player->pflags & PF_JUMPED)
&& !(player->panim == PA_ROLL) && player->charability2 == CA2_SPINDASH) && !(player->panim == PA_ROLL) && player->charability2 == CA2_SPINDASH)
P_SetPlayerMobjState(player->mo, S_PLAY_ATK1); P_SetPlayerMobjState(player->mo, S_PLAY_SPIN);
} }
P_SetTarget(&player->mo->tracer, NULL); P_SetTarget(&player->mo->tracer, NULL);
@ -8601,10 +8601,10 @@ void P_PlayerThink(player_t *player)
if (player->pflags & PF_GLIDING) if (player->pflags & PF_GLIDING)
{ {
if (player->panim != PA_ABILITY) if (player->panim != PA_ABILITY)
P_SetPlayerMobjState(player->mo, S_PLAY_ABL1); P_SetPlayerMobjState(player->mo, S_PLAY_GLIDE);
} }
else if ((player->pflags & PF_JUMPED) && !player->powers[pw_super] && player->panim != PA_ROLL && player->charability2 == CA2_SPINDASH) else if ((player->pflags & PF_JUMPED) && !player->powers[pw_super] && player->panim != PA_ROLL && player->charability2 == CA2_SPINDASH)
P_SetPlayerMobjState(player->mo, S_PLAY_ATK1); P_SetPlayerMobjState(player->mo, S_PLAY_SPIN);
if (player->flashcount) if (player->flashcount)
player->flashcount--; player->flashcount--;
@ -8844,14 +8844,14 @@ void P_PlayerThink(player_t *player)
ticmiss++; ticmiss++;
P_DoRopeHang(player); P_DoRopeHang(player);
P_SetPlayerMobjState(player->mo, S_PLAY_CARRY); P_SetPlayerMobjState(player->mo, S_PLAY_RIDE);
P_DoJumpStuff(player, &player->cmd); P_DoJumpStuff(player, &player->cmd);
} }
else else
{ {
P_DoZoomTube(player); P_DoZoomTube(player);
if (!(player->panim == PA_ROLL) && player->charability2 == CA2_SPINDASH) if (!(player->panim == PA_ROLL) && player->charability2 == CA2_SPINDASH)
P_SetPlayerMobjState(player->mo, S_PLAY_ATK1); P_SetPlayerMobjState(player->mo, S_PLAY_SPIN);
} }
player->rmomx = player->rmomy = 0; // no actual momentum from your controls player->rmomx = player->rmomy = 0; // no actual momentum from your controls
P_ResetScore(player); P_ResetScore(player);
@ -9225,7 +9225,7 @@ void P_PlayerAfterThink(player_t *player)
if (player->pflags & PF_GLIDING) if (player->pflags & PF_GLIDING)
{ {
if (player->panim != PA_ABILITY) if (player->panim != PA_ABILITY)
P_SetPlayerMobjState(player->mo, S_PLAY_ABL1); P_SetPlayerMobjState(player->mo, S_PLAY_GLIDE);
} }
else if (player->pflags & PF_SLIDING) else if (player->pflags & PF_SLIDING)
P_SetPlayerMobjState(player->mo, player->mo->info->painstate); P_SetPlayerMobjState(player->mo, player->mo->info->painstate);
@ -9233,17 +9233,15 @@ void P_PlayerAfterThink(player_t *player)
&& ((!player->powers[pw_super] && player->panim != PA_ROLL) && ((!player->powers[pw_super] && player->panim != PA_ROLL)
|| player->mo->state == &states[player->mo->info->painstate]) || player->mo->state == &states[player->mo->info->painstate])
&& player->charability2 == CA2_SPINDASH) && player->charability2 == CA2_SPINDASH)
P_SetPlayerMobjState(player->mo, S_PLAY_ATK1); P_SetPlayerMobjState(player->mo, S_PLAY_SPIN);
if (player->pflags & PF_CARRIED && player->mo->tracer) if (player->pflags & PF_CARRIED && player->mo->tracer)
{ {
player->mo->height = FixedDiv(P_GetPlayerHeight(player), FixedDiv(14*FRACUNIT,10*FRACUNIT)); player->mo->height = FixedDiv(P_GetPlayerHeight(player), FixedDiv(14*FRACUNIT,10*FRACUNIT));
// State check for the carrier - Flame
// You are an IDIOT, those aren't even the right frames! >_> - JTE
if (player->mo->tracer->player if (player->mo->tracer->player
&& !(player->mo->tracer->state >= &states[S_PLAY_ABL1] && player->mo->tracer->state-states != S_PLAY_FLY
&& player->mo->tracer->state <= &states[S_PLAY_SPC4])) && player->mo->tracer->state-states != S_PLAY_FLY_TIRED)
player->pflags &= ~PF_CARRIED; player->pflags &= ~PF_CARRIED;
if (player->mo->eflags & MFE_VERTICALFLIP) if (player->mo->eflags & MFE_VERTICALFLIP)
@ -9286,7 +9284,7 @@ void P_PlayerAfterThink(player_t *player)
if (P_AproxDistance(player->mo->x - player->mo->tracer->x, player->mo->y - player->mo->tracer->y) > player->mo->radius) if (P_AproxDistance(player->mo->x - player->mo->tracer->x, player->mo->y - player->mo->tracer->y) > player->mo->radius)
player->pflags &= ~PF_CARRIED; player->pflags &= ~PF_CARRIED;
P_SetPlayerMobjState(player->mo, S_PLAY_CARRY); P_SetPlayerMobjState(player->mo, S_PLAY_RIDE);
if (player-players == consoleplayer && botingame) if (player-players == consoleplayer && botingame)
CV_SetValue(&cv_analog2, !(player->pflags & PF_CARRIED)); CV_SetValue(&cv_analog2, !(player->pflags & PF_CARRIED));
@ -9303,7 +9301,7 @@ void P_PlayerAfterThink(player_t *player)
player->mo->z = player->mo->tracer->z - FixedDiv(player->mo->height, 3*FRACUNIT/2); player->mo->z = player->mo->tracer->z - FixedDiv(player->mo->height, 3*FRACUNIT/2);
player->mo->momx = player->mo->momy = player->mo->momz = 0; player->mo->momx = player->mo->momy = player->mo->momz = 0;
P_SetThingPosition(player->mo); P_SetThingPosition(player->mo);
P_SetPlayerMobjState(player->mo, S_PLAY_CARRY); P_SetPlayerMobjState(player->mo, S_PLAY_RIDE);
// Controllable missile // Controllable missile
if (player->mo->tracer->type == MT_BLACKEGGMAN_MISSILE) if (player->mo->tracer->type == MT_BLACKEGGMAN_MISSILE)

View File

@ -338,6 +338,10 @@ void R_AddSpriteDefs(UINT16 wadnum)
else else
start++; // just after S_START start++; // just after S_START
// ignore skin wads (we don't want skin sprites interfering with vanilla sprites)
if (start == 0 && W_CheckNumForNamePwad("S_SKIN", wadnum, 0) != INT16_MAX)
return;
end = W_CheckNumForNamePwad("S_END",wadnum,start); end = W_CheckNumForNamePwad("S_END",wadnum,start);
if (end == INT16_MAX) if (end == INT16_MAX)
end = W_CheckNumForNamePwad("SS_END",wadnum,start); //deutex compatib. end = W_CheckNumForNamePwad("SS_END",wadnum,start); //deutex compatib.
@ -1088,9 +1092,14 @@ static void R_ProjectSprite(mobj_t *thing)
//Fab : 02-08-98: 'skin' override spritedef currently used for skin //Fab : 02-08-98: 'skin' override spritedef currently used for skin
if (thing->skin && thing->sprite == SPR_PLAY) if (thing->skin && thing->sprite == SPR_PLAY)
{ {
sprdef = &((skin_t *)thing->skin)->spritedef; sprdef = &((skin_t *)thing->skin)->sprites[thing->sprite2];
if (rot >= sprdef->numframes) if (rot >= sprdef->numframes) {
CONS_Alert(CONS_ERROR, M_GetText("R_ProjectSprite: invalid skins[\"%s\"].sprites[SPR2_%s] frame %d\n"), ((skin_t *)thing->skin)->name, spr2names[thing->sprite2], rot);
thing->sprite = states[S_UNKNOWN].sprite;
thing->frame = states[S_UNKNOWN].frame;
sprdef = &sprites[thing->sprite]; sprdef = &sprites[thing->sprite];
rot = thing->frame&FF_FRAMEMASK;
}
} }
else else
sprdef = &sprites[thing->sprite]; sprdef = &sprites[thing->sprite];
@ -2225,7 +2234,6 @@ static void Sk_SetDefaultValue(skin_t *skin)
sizeof skin->name, "skin %u", (UINT32)(skin-skins)); sizeof skin->name, "skin %u", (UINT32)(skin-skins));
skin->name[sizeof skin->name - 1] = '\0'; skin->name[sizeof skin->name - 1] = '\0';
skin->wadnum = INT16_MAX; skin->wadnum = INT16_MAX;
strcpy(skin->sprite, "");
skin->flags = 0; skin->flags = 0;
@ -2267,7 +2275,6 @@ static void Sk_SetDefaultValue(skin_t *skin)
// //
void R_InitSkins(void) void R_InitSkins(void)
{ {
skin_t *skin;
#ifdef SKINVALUES #ifdef SKINVALUES
INT32 i; INT32 i;
@ -2278,43 +2285,8 @@ void R_InitSkins(void)
} }
#endif #endif
// skin[0] = Sonic skin // no default skin!
skin = &skins[0]; numskins = 0;
numskins = 1;
Sk_SetDefaultValue(skin);
// Hardcoded S_SKIN customizations for Sonic.
strcpy(skin->name, DEFAULTSKIN);
#ifdef SKINVALUES
skin_cons_t[0].strvalue = skins[0].name;
#endif
skin->flags = SF_SUPER|SF_SUPERANIMS|SF_SUPERSPIN;
strcpy(skin->realname, "Sonic");
strcpy(skin->hudname, "SONIC");
strncpy(skin->charsel, "CHRSONIC", 8);
strncpy(skin->face, "LIVSONIC", 8);
strncpy(skin->superface, "LIVSUPER", 8);
skin->prefcolor = SKINCOLOR_BLUE;
skin->ability = CA_THOK;
skin->actionspd = 60<<FRACBITS;
skin->normalspeed = 36<<FRACBITS;
skin->runspeed = 28<<FRACBITS;
skin->thrustfactor = 5;
skin->accelstart = 96;
skin->acceleration = 40;
skin->spritedef.numframes = sprites[SPR_PLAY].numframes;
skin->spritedef.spriteframes = sprites[SPR_PLAY].spriteframes;
ST_LoadFaceGraphics(skin->face, skin->superface, 0);
//MD2 for sonic doesn't want to load in Linux.
#ifdef HWRENDER
if (rendermode == render_opengl)
HWR_AddPlayerMD2(0);
#endif
} }
// returns true if the skin name is found (loaded from pwad) // returns true if the skin name is found (loaded from pwad)
@ -2559,11 +2531,6 @@ void R_AddSkins(UINT16 wadnum)
STRBUFCPY(skin->realname, skin->hudname); STRBUFCPY(skin->realname, skin->hudname);
} }
else if (!stricmp(stoken, "sprite"))
{
strupr(value);
strncpy(skin->sprite, value, sizeof skin->sprite);
}
else if (!stricmp(stoken, "charsel")) else if (!stricmp(stoken, "charsel"))
{ {
strupr(value); strupr(value);
@ -2645,71 +2612,25 @@ next_token:
} }
free(buf2); free(buf2);
// Not in vanilla, you don't. if (skin != &skins[0])
skin->flags &= ~SF_SUPER; skin->flags &= ~SF_SUPER;
lump++; // if no sprite defined use spirte just after this one // Add sprites
if (skin->sprite[0] == '\0')
{ {
const char *csprname = W_CheckNameForNumPwad(wadnum, lump); UINT16 z;
UINT8 sprite2;
// skip to end of this skin's frames lump++; // start after S_SKIN
lastlump = lump; lastlump = W_CheckNumForNamePwad("S_END",wadnum,lump); // stop at S_END
while (W_CheckNameForNumPwad(wadnum,lastlump) && memcmp(W_CheckNameForNumPwad(wadnum, lastlump),csprname,4)==0) // old wadding practices die hard -- stop at S_SKIN or S_START if they come before S_END.
lastlump++; z = W_CheckNumForNamePwad("S_SKIN",wadnum,lump);
// allocate (or replace) sprite frames, and set spritedef if (z < lastlump) lastlump = z;
R_AddSingleSpriteDef(csprname, &skin->spritedef, wadnum, lump, lastlump); z = W_CheckNumForNamePwad("S_START",wadnum,lump);
} if (z < lastlump) lastlump = z;
else
{
// search in the normal sprite tables
size_t name;
boolean found = false;
const char *sprname = skin->sprite;
for (name = 0;sprnames[name][0] != '\0';name++)
if (strncmp(sprnames[name], sprname, 4) == 0)
{
found = true;
skin->spritedef = sprites[name];
}
// not found so make a new one // load all sprite sets we are aware of.
// go through the entire current wad looking for our sprite for (sprite2 = 0; sprite2 < NUMPLAYERSPRITES; sprite2++)
// don't just mass add anything beginning with our four letters. R_AddSingleSpriteDef(spr2names[sprite2], &skin->sprites[sprite2], wadnum, lump, lastlump);
// "HOODFACE" is not a sprite name.
if (!found)
{
UINT16 localllump = 0, lstart = UINT16_MAX, lend = UINT16_MAX;
const char *lname;
while ((lname = W_CheckNameForNumPwad(wadnum,localllump)))
{
// If this is a valid sprite...
if (!memcmp(lname,sprname,4) && lname[4] && lname[5] && lname[5] >= '0' && lname[5] <= '8')
{
if (lstart == UINT16_MAX)
lstart = localllump;
// If already set do nothing
}
else
{
if (lstart != UINT16_MAX)
{
lend = localllump;
break;
}
// If not already set do nothing
}
++localllump;
}
R_AddSingleSpriteDef(sprname, &skin->spritedef, wadnum, lstart, lend);
}
// I don't particularly care about skipping to the end of the used frames.
// We could be using frames from ANYWHERE in the current WAD file, including
// right before us, which is a terrible idea.
// So just let the function in the while loop take care of it for us.
} }
R_FlushTranslationColormapCache(); R_FlushTranslationColormapCache();

View File

@ -68,9 +68,7 @@ void R_DrawMasked(void);
typedef struct typedef struct
{ {
char name[SKINNAMESIZE+1]; // INT16 descriptive name of the skin char name[SKINNAMESIZE+1]; // INT16 descriptive name of the skin
spritedef_t spritedef;
UINT16 wadnum; UINT16 wadnum;
char sprite[4]; // Sprite name, if seperated from S_SKIN.
skinflags_t flags; skinflags_t flags;
char realname[SKINNAMESIZE+1]; // Display name for level completion. char realname[SKINNAMESIZE+1]; // Display name for level completion.
@ -102,6 +100,8 @@ typedef struct
// specific sounds per skin // specific sounds per skin
sfxenum_t soundsid[NUMSKINSOUNDS]; // sound # in S_sfx table sfxenum_t soundsid[NUMSKINSOUNDS]; // sound # in S_sfx table
spritedef_t sprites[NUMPLAYERSPRITES];
} skin_t; } skin_t;
// ----------- // -----------

View File

@ -635,7 +635,7 @@ void V_DrawContinueIcon(INT32 x, INT32 y, INT32 flags, INT32 skinnum, UINT8 skin
V_DrawScaledPatch(x - 10, y - 14, flags, W_CachePatchName("CONTINS", PU_CACHE)); V_DrawScaledPatch(x - 10, y - 14, flags, W_CachePatchName("CONTINS", PU_CACHE));
else else
{ {
spriteframe_t *sprframe = &skins[skinnum].spritedef.spriteframes[2 & FF_FRAMEMASK]; spriteframe_t *sprframe = &skins[skinnum].sprites[SPR2_WAIT].spriteframes[0];
patch_t *patch = W_CachePatchNum(sprframe->lumppat[0], PU_CACHE); patch_t *patch = W_CachePatchNum(sprframe->lumppat[0], PU_CACHE);
const UINT8 *colormap = R_GetTranslationColormap(skinnum, skincolor, GTC_CACHE); const UINT8 *colormap = R_GetTranslationColormap(skinnum, skincolor, GTC_CACHE);