diff --git a/src/b_bot.c b/src/b_bot.c index 5e62e58e6..0636d9366 100644 --- a/src/b_bot.c +++ b/src/b_bot.c @@ -273,11 +273,11 @@ void B_RespawnBot(INT32 playernum) P_TeleportMove(tails, x, y, z); if (player->charability == CA_FLY) { - P_SetPlayerMobjState(tails, S_PLAY_ABL1); + P_SetPlayerMobjState(tails, S_PLAY_FLY); tails->player->powers[pw_tailsfly] = (UINT16)-1; } else - P_SetPlayerMobjState(tails, S_PLAY_FALL1); + P_SetPlayerMobjState(tails, S_PLAY_FALL); P_SetScale(tails, sonic->scale); tails->destscale = sonic->destscale; } diff --git a/src/dehacked.c b/src/dehacked.c index a332da5df..aaf3f03a8 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -3739,7 +3739,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_PLAY_STND", "S_PLAY_TAP1", "S_PLAY_TAP2", - "S_PLAY_RUN1", + "S_PLAY_WALK", "S_PLAY_RUN2", "S_PLAY_RUN3", "S_PLAY_RUN4", @@ -3751,12 +3751,12 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_PLAY_SPD2", "S_PLAY_SPD3", "S_PLAY_SPD4", - "S_PLAY_ATK1", + "S_PLAY_SPIN", "S_PLAY_ATK2", "S_PLAY_ATK3", "S_PLAY_ATK4", "S_PLAY_SPRING", - "S_PLAY_FALL1", + "S_PLAY_FALL", "S_PLAY_FALL2", "S_PLAY_ABL1", "S_PLAY_ABL2", @@ -4534,7 +4534,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit // S_PLAY_TAP1 "S_METALSONIC_WAIT1", "S_METALSONIC_WAIT2", - // S_PLAY_RUN1 + // S_PLAY_WALK "S_METALSONIC_WALK1", "S_METALSONIC_WALK2", "S_METALSONIC_WALK3", diff --git a/src/g_game.c b/src/g_game.c index 931388d87..3765c7868 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -3686,6 +3686,7 @@ static ticcmd_t oldcmd; #define GZT_SPRITE 0x10 // Animation frame #define GZT_EXTRA 0x20 #define GZT_NIGHTS 0x40 // NiGHTS Mode stuff! +#define GZT_SPR2 0x80 // Player animations // GZT_EXTRA flags #define EZT_THOK 0x01 // Spawned a thok object @@ -3889,8 +3890,6 @@ void G_WriteGhostTic(mobj_t *ghost) char ziptic = 0; UINT8 *ziptic_p; UINT32 i; - UINT8 sprite; - UINT8 frame; if (!demo_p) return; @@ -3965,19 +3964,25 @@ void G_WriteGhostTic(mobj_t *ghost) } // Store the sprite frame. - frame = ghost->frame & 0xFF; - if (frame != oldghost.frame) + if ((ghost->frame & 0xFF) != oldghost.frame) { - oldghost.frame = frame; + oldghost.frame = (ghost->frame & 0xFF); ziptic |= GZT_SPRITE; WRITEUINT8(demo_p,oldghost.frame); } - // Check for sprite set changes - sprite = ghost->sprite; - if (sprite != oldghost.sprite) + if (ghost->sprite == SPR_PLAY + && ghost->sprite2 != oldghost.sprite2) { - 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; } @@ -4020,7 +4025,7 @@ void G_WriteGhostTic(mobj_t *ghost) ghostext.hitlist = NULL; } if (ghostext.flags & EZT_SPRITE) - WRITEUINT8(demo_p,sprite); + WRITEUINT8(demo_p,oldghost.sprite); ghostext.flags = 0; } @@ -4076,6 +4081,8 @@ void G_ConsGhostTic(void) demo_p++; if (ziptic & GZT_SPRITE) demo_p++; + if (ziptic & GZT_SPR2) + demo_p++; if(ziptic & GZT_NIGHTS) { if (!testmo->player || !(testmo->player->pflags & PF_NIGHTSMODE) || !testmo->tracer) nightsfail = true; @@ -4207,6 +4214,8 @@ void G_GhostTicker(void) g->oldmo.angle = READUINT8(g->p)<<24; if (ziptic & GZT_SPRITE) g->oldmo.frame = READUINT8(g->p); + if (ziptic & GZT_SPR2) + g->oldmo.sprite2 = READUINT8(g->p); // Update ghost P_UnsetThingPosition(g->mo); @@ -4216,6 +4225,7 @@ void G_GhostTicker(void) P_SetThingPosition(g->mo); g->mo->angle = g->oldmo.angle; g->mo->frame = g->oldmo.frame | tr_trans30<mo->sprite2 = g->oldmo.sprite2; if (ziptic & GZT_EXTRA) { // But wait, there's more! @@ -4400,6 +4410,8 @@ void G_ReadMetalTic(mobj_t *metal) oldmetal.angle = READUINT8(metal_p)<<24; if (ziptic & GZT_SPRITE) 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 // oldmetal contains where you're supposed to be. diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index bc86c1295..a7b11b922 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -4581,7 +4581,7 @@ static void HWR_ProjectSprite(mobj_t *thing) //Fab : 02-08-98: 'skin' override spritedef currently used for skin if (thing->skin && thing->sprite == SPR_PLAY) - sprdef = &((skin_t *)thing->skin)->spritedef; + sprdef = &((skin_t *)thing->skin)->sprites[thing->sprite2]; else sprdef = &sprites[thing->sprite]; diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index 6d2a1d4a3..6c85baa77 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1200,7 +1200,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr) curr = &md2->model->frames[frame]; if (cv_grmd2.value == 1 && 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; next = &md2->model->frames[nextframe]; @@ -1216,7 +1216,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr) p.z = FIXED_TO_FLOAT(spr->mobj->z); 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 sprdef = &sprites[spr->mobj->sprite]; diff --git a/src/info.c b/src/info.c index fb30258c3..28dbd2fe7 100644 --- a/src/info.c +++ b/src/info.c @@ -56,6 +56,39 @@ char sprnames[NUMSPRITES + 1][5] = "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) state_t states[NUMSTATES] = { @@ -81,73 +114,53 @@ state_t states[NUMSTATES] = {SPR_THOK, FF_TRANS50, 8, {NULL}, 0, 0, S_NULL}, // S_THOK // Player - {SPR_PLAY, 0, 105, {NULL}, 0, 0, S_PLAY_TAP1}, // S_PLAY_STND - {SPR_PLAY, 1, 16, {NULL}, 0, 0, S_PLAY_TAP2}, // S_PLAY_TAP1 - {SPR_PLAY, 2, 16, {NULL}, 0, 0, S_PLAY_TAP1}, // S_PLAY_TAP2 - {SPR_PLAY, 3, 4, {NULL}, 0, 0, S_PLAY_RUN2}, // S_PLAY_RUN1 - {SPR_PLAY, 4, 4, {NULL}, 0, 0, S_PLAY_RUN3}, // S_PLAY_RUN2 - {SPR_PLAY, 5, 4, {NULL}, 0, 0, S_PLAY_RUN4}, // S_PLAY_RUN3 - {SPR_PLAY, 6, 4, {NULL}, 0, 0, S_PLAY_RUN5}, // S_PLAY_RUN4 - {SPR_PLAY, 7, 4, {NULL}, 0, 0, S_PLAY_RUN6}, // S_PLAY_RUN5 - {SPR_PLAY, 8, 4, {NULL}, 0, 0, S_PLAY_RUN7}, // S_PLAY_RUN6 - {SPR_PLAY, 9, 4, {NULL}, 0, 0, S_PLAY_RUN8}, // S_PLAY_RUN7 - {SPR_PLAY, 10, 4, {NULL}, 0, 0, S_PLAY_RUN1}, // S_PLAY_RUN8 - {SPR_PLAY, 16, 2, {NULL}, 0, 0, S_PLAY_SPD2}, // S_PLAY_SPD1 - {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, 19, 2, {NULL}, 0, 0, S_PLAY_SPD1}, // S_PLAY_SPD4 - {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, 13, 1, {NULL}, 0, 0, S_PLAY_ATK4}, // S_PLAY_ATK3 - {SPR_PLAY, 14, 1, {NULL}, 0, 0, S_PLAY_ATK1}, // S_PLAY_ATK4 - {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, 32, 2, {NULL}, 0, 0, S_PLAY_FALL1}, // S_PLAY_FALL2 - {SPR_PLAY, 20, 2, {NULL}, 0, 0, S_PLAY_ABL2}, // S_PLAY_ABL1 - {SPR_PLAY, 21, 2, {NULL}, 0, 0, S_PLAY_ABL1}, // S_PLAY_ABL2 - {SPR_PLAY, 22, 6, {NULL}, 0, 0, S_PLAY_SPC2}, // S_PLAY_SPC1 - {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, 25, 6, {NULL}, 0, 0, S_PLAY_SPC1}, // S_PLAY_SPC4 - {SPR_PLAY, 22, -1, {NULL}, 0, 0, S_NULL}, // S_PLAY_CLIMB1 - {SPR_PLAY, 23, 5, {NULL}, 0, 0, S_PLAY_CLIMB3}, // S_PLAY_CLIMB2 - {SPR_PLAY, 24, 5, {NULL}, 0, 0, S_PLAY_CLIMB4}, // S_PLAY_CLIMB3 - {SPR_PLAY, 25, 5, {NULL}, 0, 0, S_PLAY_CLIMB5}, // S_PLAY_CLIMB4 - {SPR_PLAY, 24, 5, {NULL}, 0, 0, S_PLAY_CLIMB2}, // S_PLAY_CLIMB5 - {SPR_PLAY, 26, 14, {NULL}, 0, 0, S_PLAY_RUN1}, // S_PLAY_GASP - {SPR_PLAY, 27, 350, {NULL}, 0, 0, S_PLAY_FALL1}, // S_PLAY_PAIN - {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_PLAY, SPR2_STND, 105, {NULL}, 0, 0, S_PLAY_WAIT}, // S_PLAY_STND + {SPR_PLAY, SPR2_WAIT, 16, {NULL}, 0, 0, S_PLAY_WAIT}, // S_PLAY_WAIT + {SPR_PLAY, SPR2_WALK, 4, {NULL}, 0, 0, S_PLAY_WALK}, // S_PLAY_WALK + {SPR_PLAY, SPR2_RUN , 2, {NULL}, 0, 0, S_PLAY_RUN}, // S_PLAY_RUN + {SPR_PLAY, SPR2_PAIN, 350, {NULL}, 0, 0, S_PLAY_FALL}, // S_PLAY_PAIN + {SPR_PLAY, SPR2_DEAD, 4, {NULL}, 0, 0, S_PLAY_DEAD}, // S_PLAY_DEAD + {SPR_PLAY, SPR2_SPIN, 1, {NULL}, 0, 0, S_PLAY_SPIN}, // S_PLAY_SPIN + {SPR_PLAY, SPR2_GASP, 14, {NULL}, 0, 0, S_PLAY_WALK}, // S_PLAY_GASP + {SPR_PLAY, SPR2_JUMP, -1, {NULL}, 0, 0, S_PLAY_FALL}, // S_PLAY_JUMP + {SPR_PLAY, SPR2_FALL, 2, {NULL}, 0, 0, S_PLAY_FALL}, // S_PLAY_FALL + {SPR_PLAY, SPR2_EDGE, 12, {NULL}, 0, 0, S_PLAY_EDGE}, // S_PLAY_EDGE + {SPR_PLAY, SPR2_RIDE, 4, {NULL}, 0, 0, S_PLAY_RIDE}, // S_PLAY_RIDE + + {SPR_PLAY, SPR2_FLY , 2, {NULL}, 0, 0, S_PLAY_FLY}, // S_PLAY_FLY + {SPR_PLAY, SPR2_TIRE, 12, {NULL}, 0, 0, S_PLAY_FLY_TIRED}, // S_PLAY_FLY_TIRED + + {SPR_PLAY, SPR2_GLID, 2, {NULL}, 0, 0, S_PLAY_GLIDE}, // S_PLAY_GLIDE + {SPR_PLAY, SPR2_CLNG, 6, {NULL}, 0, 0, S_PLAY_CLING}, // S_PLAY_CLING + {SPR_PLAY, SPR2_CLMB, 5, {NULL}, 0, 0, S_PLAY_CLIMB}, // S_PLAY_CLIMB + + {SPR_PLAY, SPR2_SSTD, 7, {NULL}, 0, 0, S_PLAY_SUPER_STND}, // S_PLAY_SUPER_STND + {SPR_PLAY, SPR2_SWLK, 7, {NULL}, 0, 0, S_PLAY_SUPER_WALK}, // S_PLAY_SUPER_WALK + {SPR_PLAY, SPR2_SRUN, 7, {NULL}, 0, 0, S_PLAY_SUPER_RUN}, // S_PLAY_SUPER_RUN + {SPR_PLAY, SPR2_SEDG, 12, {NULL}, 0, 0, S_PLAY_SUPER_EDGE}, // S_PLAY_SUPER_EDGE + {SPR_PLAY, SPR2_SHIT, -1, {NULL}, 0, 0, S_PLAY_SUPER_STND}, // S_PLAY_SUPER_PAIN + + {SPR_PLAY, SPR2_TRNS, 4, {NULL}, 0, 0, S_PLAY_SUPER_TRANS2}, // S_PLAY_SUPER_TRANS + {SPR_PLAY, SPR2_TRNS, 4, {NULL}, 0, 0, S_PLAY_SUPER_TRANS3}, // S_PLAY_SUPER_TRANS2 + {SPR_PLAY, SPR2_TRNS|FF_FULLBRIGHT, 4, {NULL}, 0, 0, S_PLAY_SUPER_TRANS4}, // S_PLAY_SUPER_TRANS3 + {SPR_PLAY, SPR2_TRNS, 3, {NULL}, 0, 0, S_PLAY_SUPER_TRANS5}, // S_PLAY_SUPER_TRANS4 + {SPR_PLAY, SPR2_TRNS, 3, {NULL}, 0, 0, S_PLAY_SUPER_TRANS6}, // S_PLAY_SUPER_TRANS5 + {SPR_PLAY, SPR2_TRNS, 3, {NULL}, 0, 0, S_PLAY_SUPER_TRANS7}, // S_PLAY_SUPER_TRANS6 + {SPR_PLAY, SPR2_TRNS, 3, {NULL}, 0, 0, S_PLAY_SUPER_TRANS8}, // S_PLAY_SUPER_TRANS7 + {SPR_PLAY, SPR2_TRNS, 3, {NULL}, 0, 0, S_PLAY_SUPER_TRANS9}, // S_PLAY_SUPER_TRANS8 + {SPR_PLAY, SPR2_TRNS, 16, {NULL}, 0, 0, S_PLAY_WALK}, // S_PLAY_SUPER_TRANS9 {SPR_NULL, 0, -1, {NULL}, 0, 0, S_OBJPLACE_DUMMY}, //S_OBJPLACE_DUMMY // 1-Up Box Sprites (uses player sprite) - {SPR_PLAY, 35, 2, {NULL}, 0, 16, S_PLAY_BOX2}, // S_PLAY_BOX1 - {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_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, 2, {NULL}, 0, 16, S_PLAY_BOX2}, // S_PLAY_BOX1 + {SPR_NULL, 0, 1, {NULL}, 0, 0, S_PLAY_BOX1}, // S_PLAY_BOX2 + {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_PLAY, SPR2_LIFE, 18, {NULL}, 0, 4, S_NULL}, // S_PLAY_ICON3 // 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 {SPR_POSS, 0, 5, {A_Look}, 0, 0, S_POSS_STND2}, // S_POSS_STND @@ -3110,7 +3123,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = -1, // doomednum S_PLAY_STND, // spawnstate 1, // spawnhealth - S_PLAY_RUN1, // seestate + S_PLAY_WALK, // seestate sfx_None, // seesound 0, // reactiontime sfx_thok, // attacksound @@ -3118,8 +3131,8 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = MT_THOK, // painchance sfx_None, // painsound S_NULL, // meleestate - S_PLAY_ATK1, // missilestate - S_PLAY_DIE, // deathstate + S_PLAY_SPIN, // missilestate + S_PLAY_DEAD, // deathstate S_NULL, // xdeathstate sfx_None, // deathsound 1, // speed diff --git a/src/info.h b/src/info.h index 0c73281df..1a0b4b0bc 100644 --- a/src/info.h +++ b/src/info.h @@ -575,6 +575,41 @@ typedef enum sprite NUMSPRITES } 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 { S_NULL, @@ -592,61 +627,46 @@ typedef enum state // Thok S_THOK, + // Player S_PLAY_STND, - S_PLAY_TAP1, - S_PLAY_TAP2, - S_PLAY_RUN1, - 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_WAIT, + S_PLAY_WALK, + S_PLAY_RUN, S_PLAY_PAIN, - S_PLAY_DIE, - S_PLAY_TEETER1, - S_PLAY_TEETER2, - S_PLAY_CARRY, - S_PLAY_SUPERSTAND, - S_PLAY_SUPERWALK1, - S_PLAY_SUPERWALK2, - S_PLAY_SUPERFLY1, - S_PLAY_SUPERFLY2, - S_PLAY_SUPERTEETER, - S_PLAY_SUPERHIT, - S_PLAY_SUPERTRANS1, - S_PLAY_SUPERTRANS2, - S_PLAY_SUPERTRANS3, - S_PLAY_SUPERTRANS4, - S_PLAY_SUPERTRANS5, - S_PLAY_SUPERTRANS6, - S_PLAY_SUPERTRANS7, - S_PLAY_SUPERTRANS8, - 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_DEAD, + S_PLAY_SPIN, + S_PLAY_GASP, + S_PLAY_JUMP, + S_PLAY_FALL, + S_PLAY_EDGE, + S_PLAY_RIDE, + + // CA_FLY + S_PLAY_FLY, + S_PLAY_FLY_TIRED, + + // CA_GLIDEANDCLIMB + S_PLAY_GLIDE, + S_PLAY_CLING, + S_PLAY_CLIMB, + + // SF_SUPERANIMS + S_PLAY_SUPER_STND, + 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 S_OBJPLACE_DUMMY, @@ -1390,7 +1410,7 @@ typedef enum state // S_PLAY_TAP1 S_METALSONIC_WAIT1, S_METALSONIC_WAIT2, - // S_PLAY_RUN1 + // S_PLAY_WALK S_METALSONIC_WALK1, S_METALSONIC_WALK2, S_METALSONIC_WALK3, @@ -3488,6 +3508,7 @@ typedef struct extern state_t states[NUMSTATES]; extern char sprnames[NUMSPRITES + 1][5]; +char spr2names[NUMPLAYERSPRITES][5]; extern state_t *astate; typedef enum mobj_type diff --git a/src/m_menu.c b/src/m_menu.c index 06aaac0ef..2bd992e1f 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -6331,8 +6331,8 @@ static void M_HandleConnectIP(INT32 choice) #define PLBOXW 8 #define PLBOXH 9 -static INT32 multi_tics; -static state_t *multi_state; +static UINT8 multi_tics; +static UINT8 multi_frame; // this is set before entering the MultiPlayer setup menu, // for either player 1 or 2 @@ -6346,11 +6346,10 @@ static INT32 setupm_fakecolor; static void M_DrawSetupMultiPlayerMenu(void) { - INT32 mx, my, st, flags = 0; + INT32 mx, my, flags = 0; spritedef_t *sprdef; spriteframe_t *sprframe; patch_t *patch; - UINT8 frame; mx = MP_PlayerSetupDef.x; my = MP_PlayerSetupDef.y; @@ -6378,28 +6377,23 @@ static void M_DrawSetupMultiPlayerMenu(void) // anim the player in the box if (--multi_tics <= 0) { - st = multi_state->nextstate; - if (st != S_NULL) - multi_state = &states[st]; - multi_tics = multi_state->tics; - if (multi_tics == -1) - multi_tics = 15; + multi_frame++; + multi_tics = 4; } // skin 0 is default player sprite 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 - sprdef = &skins[0].spritedef; + sprdef = &skins[0].sprites[SPR2_WALK]; if (!sprdef->numframes) // No frames ?? return; // Can't render! - frame = multi_state->frame & FF_FRAMEMASK; - if (frame >= sprdef->numframes) // Walking animation missing - frame = 0; // Try to use standing frame + if (multi_frame >= sprdef->numframes) + multi_frame = 0; - sprframe = &sprdef->spriteframes[frame]; + sprframe = &sprdef->spriteframes[multi_frame]; patch = W_CachePatchNum(sprframe->lumppat[0], PU_CACHE); if (sprframe->flip & 1) // Only for first sprite flags |= V_FLIP; // This sprite is left/right flipped! @@ -6533,8 +6527,8 @@ static void M_SetupMultiPlayer(INT32 choice) { (void)choice; - multi_state = &states[mobjinfo[MT_PLAYER].seestate]; - multi_tics = multi_state->tics; + multi_frame = 0; + multi_tics = 4; strcpy(setupm_name, cv_playername.string); // set for player 1 @@ -6564,8 +6558,8 @@ static void M_SetupMultiPlayer2(INT32 choice) { (void)choice; - multi_state = &states[mobjinfo[MT_PLAYER].seestate]; - multi_tics = multi_state->tics; + multi_frame = 0; + multi_tics = 4; strcpy (setupm_name, cv_playername2.string); // set for splitscreen secondary player diff --git a/src/p_enemy.c b/src/p_enemy.c index 2a8ab5bb9..5ae11320c 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -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. actor->frame = 0; if (actor->tracer) { @@ -2658,7 +2658,7 @@ for (i = cvar.value; i; --i) spawnchance[numchoices++] = type if (actor->tracer) // Remove the old lives icon. 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. else { // Spawn the lives icon. diff --git a/src/p_inter.c b/src/p_inter.c index 8eaa4765a..ef16ba631 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -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))) && player->charability == CA_FLY && (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; @@ -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 && player->charability == CA_FLY && (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) toucher->momz = -toucher->momz/2; @@ -875,7 +875,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) P_ResetPlayer(player); - P_SetPlayerMobjState(toucher, S_PLAY_FALL1); + P_SetPlayerMobjState(toucher, S_PLAY_FALL); } } return; @@ -1212,7 +1212,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) if (player->pflags & PF_GLIDING) { player->pflags &= ~(PF_GLIDING|PF_JUMPED); - P_SetPlayerMobjState(toucher, S_PLAY_FALL1); + P_SetPlayerMobjState(toucher, S_PLAY_FALL); } // Play a bounce sound? @@ -1279,7 +1279,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) if (player->pflags & PF_GLIDING) { player->pflags &= ~(PF_GLIDING|PF_JUMPED); - P_SetPlayerMobjState(toucher, S_PLAY_FALL1); + P_SetPlayerMobjState(toucher, S_PLAY_FALL); } // Play a bounce sound? @@ -1335,7 +1335,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) { player->pflags |= PF_MACESPIN; S_StartSound(toucher, sfx_spin); - P_SetPlayerMobjState(toucher, S_PLAY_ATK1); + P_SetPlayerMobjState(toucher, S_PLAY_SPIN); } else 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); if (player->charflags & SF_SUPERANIMS) - P_SetPlayerMobjState(player->mo, S_PLAY_SUPERHIT); + P_SetPlayerMobjState(player->mo, S_PLAY_SUPER_PAIN); else P_SetPlayerMobjState(player->mo, player->mo->info->painstate); diff --git a/src/p_map.c b/src/p_map.c index 342aa0868..45d249e06 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -192,21 +192,21 @@ void P_DoSpring(mobj_t *spring, mobj_t *object) P_ResetPlayer(object->player); if (origvertispeed > 0) - P_SetPlayerMobjState(object, S_PLAY_SPRING); + P_SetPlayerMobjState(object, S_PLAY_JUMP); else if (origvertispeed < 0) - P_SetPlayerMobjState(object, S_PLAY_FALL1); + P_SetPlayerMobjState(object, S_PLAY_FALL); else // horizontal spring { if (pflags & (PF_JUMPED|PF_SPINNING) && object->player->panim == PA_ROLL) object->player->pflags = pflags; else - P_SetPlayerMobjState(object, S_PLAY_RUN1); + P_SetPlayerMobjState(object, S_PLAY_WALK); } if (spring->info->painchance) { 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); if (p->panim != PA_FALL) - P_SetPlayerMobjState(object, S_PLAY_FALL1); + P_SetPlayerMobjState(object, S_PLAY_FALL); } break; case MT_STEAM: // Steam @@ -270,7 +270,7 @@ static void P_DoFanAndGasJet(mobj_t *spring, mobj_t *object) { P_ResetPlayer(p); if (p->panim != PA_FALL) - P_SetPlayerMobjState(object, S_PLAY_FALL1); + P_SetPlayerMobjState(object, S_PLAY_FALL); } break; 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) 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; 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, // 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)) maxstep = 0; } diff --git a/src/p_mobj.c b/src/p_mobj.c index cac4bc24b..6fd501124 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -141,42 +141,22 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state) switch (state) { case S_PLAY_STND: - case S_PLAY_TAP1: - case S_PLAY_TAP2: + case S_PLAY_WAIT: case S_PLAY_GASP: - P_SetPlayerMobjState(mobj, S_PLAY_SUPERSTAND); + P_SetPlayerMobjState(mobj, S_PLAY_SUPER_STND); return true; - case S_PLAY_FALL1: - case S_PLAY_SPRING: - case S_PLAY_RUN1: - case S_PLAY_RUN2: - case S_PLAY_RUN3: - case S_PLAY_RUN4: - P_SetPlayerMobjState(mobj, S_PLAY_SUPERWALK1); + case S_PLAY_FALL: + case S_PLAY_JUMP: + case S_PLAY_WALK: + P_SetPlayerMobjState(mobj, S_PLAY_SUPER_WALK); return true; - case S_PLAY_FALL2: - case S_PLAY_RUN5: - case S_PLAY_RUN6: - case S_PLAY_RUN7: - case S_PLAY_RUN8: - P_SetPlayerMobjState(mobj, S_PLAY_SUPERWALK2); + case S_PLAY_RUN: + P_SetPlayerMobjState(mobj, S_PLAY_SUPER_RUN); return true; - case S_PLAY_SPD1: - case S_PLAY_SPD2: - P_SetPlayerMobjState(mobj, S_PLAY_SUPERFLY1); + case S_PLAY_EDGE: + P_SetPlayerMobjState(mobj, S_PLAY_SUPER_EDGE); return true; - case S_PLAY_SPD3: - 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: + case S_PLAY_SPIN: if (!(player->charflags & SF_SUPERSPIN)) return true; break; @@ -194,23 +174,38 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state) // Set animation state // 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 - || state == S_PLAY_SUPERSTAND || state == S_PLAY_SUPERTEETER) + switch(state) + { + 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; - else if ((state >= S_PLAY_RUN1 && state <= S_PLAY_RUN8) - || (state >= S_PLAY_SUPERWALK1 && state <= S_PLAY_SUPERWALK2)) + break; + case S_PLAY_WALK: + case S_PLAY_SUPER_WALK: player->panim = PA_WALK; - else if ((state >= S_PLAY_SPD1 && state <= S_PLAY_SPD4) - || (state >= S_PLAY_SUPERFLY1 && state <= S_PLAY_SUPERFLY2)) + break; + case S_PLAY_RUN: + case S_PLAY_SUPER_RUN: player->panim = PA_RUN; - else if (state >= S_PLAY_ATK1 && state <= S_PLAY_ATK4) + break; + case S_PLAY_SPIN: player->panim = PA_ROLL; - else if (state >= S_PLAY_FALL1 && state <= S_PLAY_FALL2) + break; + case S_PLAY_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; - else + break; + default: player->panim = PA_ETC; + break; + } if (recursion++) // if recursion detected, 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; - 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. // Call action functions when the state is set @@ -341,8 +357,30 @@ boolean P_SetMobjState(mobj_t *mobj, statenum_t state) st = &states[state]; mobj->state = st; 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. // 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->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 if (mo->player->pflags & PF_GLIDING) gravityadd = gravityadd/3; // less gravity while gliding @@ -2018,7 +2056,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_PLAY_SUPERHIT]) + if (mo->state == &states[mo->info->painstate] || mo->state-states == S_PLAY_SUPER_PAIN) P_SetPlayerMobjState(mo, S_PLAY_STND); if (P_MobjFlip(mo)*mo->momz < 0) // falling @@ -2116,23 +2154,23 @@ static void P_PlayerZMovement(mobj_t *mo) mo->tics = -1; } 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->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) - 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) P_SetPlayerMobjState(mo, S_PLAY_STND); } else { 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) - P_SetPlayerMobjState(mo, S_PLAY_RUN1); + P_SetPlayerMobjState(mo, S_PLAY_WALK); else if (!mo->momx && !mo->momy && mo->player->panim != PA_IDLE) P_SetPlayerMobjState(mo, S_PLAY_STND); } @@ -3027,7 +3065,7 @@ static void P_PlayerMobjThinker(mobj_t *mobj) { mobj->player->secondjump = 0; mobj->player->powers[pw_tailsfly] = 0; - P_SetPlayerMobjState(mobj, S_PLAY_RUN1); + P_SetPlayerMobjState(mobj, S_PLAY_WALK); } } mobj->pmomz = 0; @@ -6651,7 +6689,7 @@ for (i = ((mobj->flags2 & MF2_STRONGBOX) ? strongboxamt : weakboxamt); i; --i) s { mobj->player->secondjump = 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 @@ -6862,7 +6900,7 @@ void P_SceneryThinker(mobj_t *mobj) { mobj->player->secondjump = 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 diff --git a/src/p_mobj.h b/src/p_mobj.h index 6d120c473..15dd440f5 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -265,6 +265,7 @@ typedef struct mobj_s angle_t angle; // orientation spritenum_t sprite; // used to find patch_t and flip value 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 diff --git a/src/p_saveg.c b/src/p_saveg.c index 851d653fa..9f15e90b4 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -1169,8 +1169,11 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type) WRITEUINT16(save_p, mobj->state-states); if (diff & MD_TICS) WRITEINT32(save_p, mobj->tics); - if (diff & MD_SPRITE) + if (diff & MD_SPRITE) { WRITEUINT16(save_p, mobj->sprite); + if (mobj->sprite == SPR_PLAY) + WRITEUINT8(save_p, mobj->sprite2); + } if (diff & MD_FRAME) WRITEUINT32(save_p, mobj->frame); if (diff & MD_EFLAGS) @@ -1991,10 +1994,16 @@ static void LoadMobjThinker(actionf_p1 thinker) mobj->tics = READINT32(save_p); else mobj->tics = mobj->state->tics; - if (diff & MD_SPRITE) + if (diff & MD_SPRITE) { mobj->sprite = READUINT16(save_p); - else + if (mobj->sprite == SPR_PLAY) + mobj->sprite2 = READUINT8(save_p); + } + else { mobj->sprite = mobj->state->sprite; + if (mobj->sprite == SPR_PLAY) + mobj->sprite2 = mobj->state->frame&FF_FRAMEMASK; + } if (diff & MD_FRAME) mobj->frame = READUINT32(save_p); else diff --git a/src/p_spec.c b/src/p_spec.c index 8228c60b3..a988df36f 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -3684,7 +3684,7 @@ DoneSection2: if (!(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; @@ -3826,7 +3826,7 @@ DoneSection2: P_ResetPlayer(player); if (player->panim != PA_FALL) - P_SetPlayerMobjState(player->mo, S_PLAY_FALL1); + P_SetPlayerMobjState(player->mo, S_PLAY_FALL); break; case 6: // Super Sonic transformer @@ -3838,7 +3838,7 @@ DoneSection2: if (!(player->pflags & PF_SPINNING) && P_IsObjectOnGround(player->mo) && (player->charability2 == CA2_SPINDASH)) { player->pflags |= PF_SPINNING; - P_SetPlayerMobjState(player->mo, S_PLAY_ATK1); + P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); S_StartAttackSound(player->mo, sfx_spin); if (abs(player->rmomx) < FixedMul(5*FRACUNIT, player->mo->scale) @@ -3912,9 +3912,9 @@ DoneSection2: player->pflags &= ~PF_GLIDING; 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); } } @@ -3984,9 +3984,9 @@ DoneSection2: player->pflags |= PF_SPINNING; 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); } } @@ -4289,7 +4289,7 @@ DoneSection2: player->pflags &= ~PF_SLIDING; player->climbing = 0; P_SetThingPosition(player->mo); - P_SetPlayerMobjState(player->mo, S_PLAY_CARRY); + P_SetPlayerMobjState(player->mo, S_PLAY_RIDE); } break; case 12: // Camera noclip diff --git a/src/p_user.c b/src/p_user.c index 6844d2cba..69e61d463 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -607,7 +607,7 @@ static void P_DeNightserizePlayer(player_t *player) if (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; // 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 // 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; @@ -1444,6 +1444,7 @@ mobj_t *P_SpawnGhostMobj(mobj_t *mobj) ghost->angle = mobj->angle; ghost->sprite = mobj->sprite; + ghost->sprite2 = mobj->sprite2; ghost->frame = mobj->frame; ghost->tics = -1; ghost->frame &= ~FF_TRANSMASK; @@ -1596,7 +1597,7 @@ void P_DoPlayerExit(player_t *player) { player->climbing = 0; 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_spacetime] = 0; @@ -2596,10 +2597,10 @@ static void P_DoClimbing(player_t *player) climb = false; 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])) - P_SetPlayerMobjState(player->mo, S_PLAY_CLIMB2); - else if ((!(player->mo->momx || player->mo->momy || player->mo->momz) || !climb) && player->mo->state != &states[S_PLAY_CLIMB1]) - P_SetPlayerMobjState(player->mo, S_PLAY_CLIMB1); + && player->mo->state-states != S_PLAY_CLIMB) + 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_CLING) + P_SetPlayerMobjState(player->mo, S_PLAY_CLING); if (!floorclimb) { @@ -2610,21 +2611,21 @@ static void P_DoClimbing(player_t *player) player->climbing = 0; player->pflags |= PF_JUMPED; - P_SetPlayerMobjState(player->mo, S_PLAY_ATK1); + P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); } if (skyclimber) { player->climbing = 0; player->pflags |= PF_JUMPED; - P_SetPlayerMobjState(player->mo, S_PLAY_ATK1); + P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); } } else { player->climbing = 0; 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) @@ -2633,16 +2634,16 @@ static void P_DoClimbing(player_t *player) climb = false; 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])) - P_SetPlayerMobjState(player->mo, S_PLAY_CLIMB2); - else if ((!(player->mo->momx || player->mo->momy || player->mo->momz) || !climb) && player->mo->state != &states[S_PLAY_CLIMB1]) - P_SetPlayerMobjState(player->mo, S_PLAY_CLIMB1); + && player->mo->state-states != S_PLAY_CLIMB) + 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_CLING) + P_SetPlayerMobjState(player->mo, S_PLAY_CLING); if (cmd->buttons & BT_USE && !(player->pflags & PF_JUMPSTASIS)) { player->climbing = 0; 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_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; 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)) { @@ -3081,10 +3082,10 @@ teeterdone: } 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])) - P_SetPlayerMobjState(player->mo, S_PLAY_TEETER1); + if (player->panim == PA_IDLE && player->mo->state-states != S_PLAY_EDGE) + 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); } @@ -3331,7 +3332,7 @@ firenormal: static void P_DoSuperStuff(player_t *player) { 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! if (player->pflags & PF_NIGHTSMODE) @@ -3426,11 +3427,11 @@ static void P_DoSuperStuff(player_t *player) if (player->mo->health > 0) { 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) - P_SetPlayerMobjState(player->mo, S_PLAY_SPD1); + P_SetPlayerMobjState(player->mo, S_PLAY_RUN); else if (player->panim == PA_WALK) - P_SetPlayerMobjState(player->mo, S_PLAY_RUN1); + P_SetPlayerMobjState(player->mo, S_PLAY_WALK); else 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! if (!(player->charability2 == CA2_SPINDASH)) - P_SetPlayerMobjState(player->mo, S_PLAY_SPRING); + P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); 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->dashspeed = FixedMul(FRACUNIT, player->mo->scale); player->dashtime = 0; - P_SetPlayerMobjState(player->mo, S_PLAY_ATK1); + P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); player->pflags |= PF_USEDOWN; } 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<mo->scale) && !(player->pflags & PF_USEDOWN) && !(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) S_StartSound(player->mo, sfx_spin); 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)) - 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->pflags |= PF_THOKKED; player->pflags &= ~PF_SPINNING; - P_SetPlayerMobjState(player->mo, S_PLAY_FALL1); + P_SetPlayerMobjState(player->mo, S_PLAY_FALL); 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! 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 @@ -4006,7 +4007,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd) 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)); player->pflags &= ~(PF_SPINNING|PF_STARTDASH); } @@ -4240,7 +4241,7 @@ static void P_2dMovement(player_t *player) else if (player->exiting) { player->pflags &= ~PF_GLIDING; - P_SetPlayerMobjState(player->mo, S_PLAY_RUN1); + P_SetPlayerMobjState(player->mo, S_PLAY_WALK); player->skidtime = 0; } } @@ -4427,7 +4428,7 @@ static void P_3dMovement(player_t *player) else if (player->exiting) { player->pflags &= ~PF_GLIDING; - P_SetPlayerMobjState(player->mo, S_PLAY_RUN1); + P_SetPlayerMobjState(player->mo, S_PLAY_WALK); player->skidtime = 0; } } @@ -6165,7 +6166,7 @@ static void P_SkidStuff(player_t *player) { player->skidtime = 0; 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. else if (player->glidetime > 15) @@ -6231,7 +6232,7 @@ static void P_SkidStuff(player_t *player) player->skidtime = TICRATE/2; S_StartSound(player->mo, sfx_skid); 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; } } @@ -6256,7 +6257,7 @@ static void P_MovePlayer(player_t *player) if (countdowntimeup) 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; return; @@ -6405,23 +6406,23 @@ static void P_MovePlayer(player_t *player) // If the player is moving fast enough, // break into a run! 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. 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 // going too slow, switch back to the walking frames. 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 (player->mo->state == &states[S_PLAY_SPRING] && P_MobjFlip(player->mo)*player->mo->momz < 0) - P_SetPlayerMobjState(player->mo, S_PLAY_FALL1); + if (player->mo->state == &states[S_PLAY_JUMP] && P_MobjFlip(player->mo)*player->mo->momz < 0) + P_SetPlayerMobjState(player->mo, S_PLAY_FALL); // 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); // 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 (onground) - P_SetPlayerMobjState(player->mo, S_PLAY_RUN1); + P_SetPlayerMobjState(player->mo, S_PLAY_WALK); else { player->pflags |= PF_JUMPED; - P_SetPlayerMobjState(player->mo, S_PLAY_ATK1); + P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); } } player->pflags &= ~PF_GLIDING; @@ -6513,19 +6514,19 @@ static void P_MovePlayer(player_t *player) { P_ResetPlayer(player); // down, stop gliding. if (onground) - P_SetPlayerMobjState(player->mo, S_PLAY_RUN1); + P_SetPlayerMobjState(player->mo, S_PLAY_WALK); else if ((player->charability2 == CA2_MULTIABILITY) || (player->powers[pw_super] && ALL7EMERALDS(player->powers[pw_emeralds]) && player->charability == CA_GLIDEANDCLIMB)) { player->pflags |= PF_JUMPED; - P_SetPlayerMobjState(player->mo, S_PLAY_ATK1); + P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); } else { player->pflags |= PF_THOKKED; player->mo->momx >>= 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->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) - P_SetPlayerMobjState(player->mo, S_PLAY_RUN1); + P_SetPlayerMobjState(player->mo, S_PLAY_WALK); else { player->pflags |= PF_JUMPED; - P_SetPlayerMobjState(player->mo, S_PLAY_ATK1); + P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); } } player->powers[pw_tailsfly] = 0; @@ -6640,11 +6641,10 @@ static void P_MovePlayer(player_t *player) { // Tails-gets-tired Stuff 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) - && player->mo->state >= &states[S_PLAY_SPC1] - && player->mo->state <= &states[S_PLAY_SPC4] + && player->mo->state-states == S_PLAY_FLY_TIRED && !player->spectator) S_StartSound(player->mo, sfx_pudpud); } @@ -6739,7 +6739,7 @@ static void P_MovePlayer(player_t *player) } // Otherwise, face the direction you're travelling. 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); // 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<mo->scale) && P_MobjFlip(player->mo)*player->mo->momz <= 0) { - if (player->panim == PA_ROLL || player->mo->state == &states[S_PLAY_PAIN]) - P_SetPlayerMobjState(player->mo, S_PLAY_SUPERWALK1); + if (player->panim == PA_ROLL || player->mo->state-states == S_PLAY_PAIN) + P_SetPlayerMobjState(player->mo, S_PLAY_SUPER_WALK); player->mo->momz = 0; 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. - 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)) P_SetPlayerMobjState(player->mo, S_PLAY_STND); @@ -6873,10 +6873,10 @@ static void P_MovePlayer(player_t *player) fixed_t oldheight = player->mo->height; // 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->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); else 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)) { 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) { @@ -7173,7 +7173,7 @@ static void P_DoRopeHang(player_t *player) if (!(player->pflags & PF_SLIDING) && (player->pflags & PF_JUMPED) && !(player->panim == PA_ROLL) && player->charability2 == CA2_SPINDASH) - P_SetPlayerMobjState(player->mo, S_PLAY_ATK1); + P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); return; } @@ -7290,7 +7290,7 @@ static void P_DoRopeHang(player_t *player) if (!(player->pflags & PF_SLIDING) && (player->pflags & PF_JUMPED) && !(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); @@ -8601,10 +8601,10 @@ void P_PlayerThink(player_t *player) if (player->pflags & PF_GLIDING) { 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) - P_SetPlayerMobjState(player->mo, S_PLAY_ATK1); + P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); if (player->flashcount) player->flashcount--; @@ -8844,14 +8844,14 @@ void P_PlayerThink(player_t *player) ticmiss++; P_DoRopeHang(player); - P_SetPlayerMobjState(player->mo, S_PLAY_CARRY); + P_SetPlayerMobjState(player->mo, S_PLAY_RIDE); P_DoJumpStuff(player, &player->cmd); } else { P_DoZoomTube(player); 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 P_ResetScore(player); @@ -9225,7 +9225,7 @@ void P_PlayerAfterThink(player_t *player) if (player->pflags & PF_GLIDING) { 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) 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->mo->state == &states[player->mo->info->painstate]) && 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) { 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 - && !(player->mo->tracer->state >= &states[S_PLAY_ABL1] - && player->mo->tracer->state <= &states[S_PLAY_SPC4])) + && player->mo->tracer->state-states != S_PLAY_FLY + && player->mo->tracer->state-states != S_PLAY_FLY_TIRED) player->pflags &= ~PF_CARRIED; 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) player->pflags &= ~PF_CARRIED; - P_SetPlayerMobjState(player->mo, S_PLAY_CARRY); + P_SetPlayerMobjState(player->mo, S_PLAY_RIDE); if (player-players == consoleplayer && botingame) 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->momx = player->mo->momy = player->mo->momz = 0; P_SetThingPosition(player->mo); - P_SetPlayerMobjState(player->mo, S_PLAY_CARRY); + P_SetPlayerMobjState(player->mo, S_PLAY_RIDE); // Controllable missile if (player->mo->tracer->type == MT_BLACKEGGMAN_MISSILE) diff --git a/src/r_things.c b/src/r_things.c index 9a8b1319b..400fd7566 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -338,6 +338,10 @@ void R_AddSpriteDefs(UINT16 wadnum) else 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); if (end == INT16_MAX) 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 if (thing->skin && thing->sprite == SPR_PLAY) { - sprdef = &((skin_t *)thing->skin)->spritedef; - if (rot >= sprdef->numframes) + sprdef = &((skin_t *)thing->skin)->sprites[thing->sprite2]; + 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]; + rot = thing->frame&FF_FRAMEMASK; + } } else sprdef = &sprites[thing->sprite]; @@ -2225,7 +2234,6 @@ static void Sk_SetDefaultValue(skin_t *skin) sizeof skin->name, "skin %u", (UINT32)(skin-skins)); skin->name[sizeof skin->name - 1] = '\0'; skin->wadnum = INT16_MAX; - strcpy(skin->sprite, ""); skin->flags = 0; @@ -2267,7 +2275,6 @@ static void Sk_SetDefaultValue(skin_t *skin) // void R_InitSkins(void) { - skin_t *skin; #ifdef SKINVALUES INT32 i; @@ -2278,43 +2285,8 @@ void R_InitSkins(void) } #endif - // skin[0] = Sonic skin - skin = &skins[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<normalspeed = 36<runspeed = 28<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 + // no default skin! + numskins = 0; } // 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); } - else if (!stricmp(stoken, "sprite")) - { - strupr(value); - strncpy(skin->sprite, value, sizeof skin->sprite); - } else if (!stricmp(stoken, "charsel")) { strupr(value); @@ -2645,71 +2612,25 @@ next_token: } free(buf2); - // Not in vanilla, you don't. - skin->flags &= ~SF_SUPER; + if (skin != &skins[0]) + skin->flags &= ~SF_SUPER; - lump++; // if no sprite defined use spirte just after this one - if (skin->sprite[0] == '\0') + // Add sprites { - const char *csprname = W_CheckNameForNumPwad(wadnum, lump); + UINT16 z; + UINT8 sprite2; - // skip to end of this skin's frames - lastlump = lump; - while (W_CheckNameForNumPwad(wadnum,lastlump) && memcmp(W_CheckNameForNumPwad(wadnum, lastlump),csprname,4)==0) - lastlump++; - // allocate (or replace) sprite frames, and set spritedef - R_AddSingleSpriteDef(csprname, &skin->spritedef, wadnum, lump, lastlump); - } - 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]; - } + lump++; // start after S_SKIN + lastlump = W_CheckNumForNamePwad("S_END",wadnum,lump); // stop at S_END + // old wadding practices die hard -- stop at S_SKIN or S_START if they come before S_END. + z = W_CheckNumForNamePwad("S_SKIN",wadnum,lump); + if (z < lastlump) lastlump = z; + z = W_CheckNumForNamePwad("S_START",wadnum,lump); + if (z < lastlump) lastlump = z; - // not found so make a new one - // go through the entire current wad looking for our sprite - // don't just mass add anything beginning with our four letters. - // "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. + // load all sprite sets we are aware of. + for (sprite2 = 0; sprite2 < NUMPLAYERSPRITES; sprite2++) + R_AddSingleSpriteDef(spr2names[sprite2], &skin->sprites[sprite2], wadnum, lump, lastlump); } R_FlushTranslationColormapCache(); diff --git a/src/r_things.h b/src/r_things.h index 5a7036c6a..054a6497d 100644 --- a/src/r_things.h +++ b/src/r_things.h @@ -68,9 +68,7 @@ void R_DrawMasked(void); typedef struct { char name[SKINNAMESIZE+1]; // INT16 descriptive name of the skin - spritedef_t spritedef; UINT16 wadnum; - char sprite[4]; // Sprite name, if seperated from S_SKIN. skinflags_t flags; char realname[SKINNAMESIZE+1]; // Display name for level completion. @@ -102,6 +100,8 @@ typedef struct // specific sounds per skin sfxenum_t soundsid[NUMSKINSOUNDS]; // sound # in S_sfx table + + spritedef_t sprites[NUMPLAYERSPRITES]; } skin_t; // ----------- diff --git a/src/v_video.c b/src/v_video.c index 64bf825bd..524c15cc7 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -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)); 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); const UINT8 *colormap = R_GetTranslationColormap(skinnum, skincolor, GTC_CACHE);