Ported CA_HAMMER from new-character-actions in a way that takes advantage of all of the non-hardcodey things I've added in this branch.

Also, it's called CA_TWINSPIN because that's more inoccouous.
This commit is contained in:
toasterbabe 2016-07-16 13:55:12 +01:00
parent df8be73787
commit cc35a5e1c1
8 changed files with 45 additions and 18 deletions

View file

@ -62,7 +62,8 @@ typedef enum
CA_FALLSWITCH,
CA_JUMPBOOST,
CA_AIRDRILL,
CA_JUMPTHOK
CA_JUMPTHOK,
CA_TWINSPIN
} charability_t;
//Secondary skin abilities

View file

@ -3793,6 +3793,9 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_PLAY_CLING",
"S_PLAY_CLIMB",
// CA_TWINSPIN
"S_PLAY_TWINSPIN",
// SF_SUPERANIMS
"S_PLAY_SUPER_STND",
"S_PLAY_SUPER_WALK",
@ -7122,6 +7125,7 @@ struct {
{"CA_JUMPBOOST",CA_JUMPBOOST},
{"CA_AIRDRILL",CA_AIRDRILL},
{"CA_JUMPTHOK",CA_JUMPTHOK},
{"CA_TWINSPIN",CA_TWINSPIN},
// Secondary
{"CA2_NONE",CA2_NONE}, // now slot 0!
{"CA2_SPINDASH",CA2_SPINDASH},

View file

@ -85,6 +85,8 @@ char spr2names[NUMPLAYERSPRITES][5] =
"CLNG",
"CLMB",
"TWIN",
"TRNS",
"SSTD",
"SWLK",
@ -145,17 +147,20 @@ state_t states[NUMSTATES] =
{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
// Tails abilities
// CA_FLY/CA_SWIM
{SPR_PLAY, SPR2_FLY , 2, {NULL}, 0, 0, S_PLAY_FLY}, // S_PLAY_FLY
{SPR_PLAY, SPR2_SWIM, 2, {NULL}, 0, 0, S_PLAY_SWIM}, // S_PLAY_SWIM
{SPR_PLAY, SPR2_TIRE, 12, {NULL}, 0, 0, S_PLAY_FLY_TIRED}, // S_PLAY_FLY_TIRED
// Knuckles abilities
// CA_GLIDEANDCLIMB
{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|FF_MIDDLESTARTCHANCE, 5, {NULL}, 0, 0, S_PLAY_CLIMB}, // S_PLAY_CLIMB
// Super Sonic
// CA_TWINSPIN
{SPR_PLAY, SPR2_TWIN|FF_SPR2ENDSTATE, 2, {NULL}, S_PLAY_JUMP, 0, S_PLAY_TWINSPIN}, // S_PLAY_TWINSPIN
// SF_SUPERANIMS
{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
@ -172,7 +177,7 @@ state_t states[NUMSTATES] =
{SPR_PLAY, SPR2_SRID, 4, {NULL}, 0, 0, S_PLAY_SUPER_RIDE}, // S_PLAY_SUPER_RIDE
{SPR_PLAY, SPR2_SFLT, 7, {NULL}, 0, 0, S_PLAY_SUPER_FLOAT}, // S_PLAY_SUPER_FLOAT
// Transforming into Super
// SF_SUPER
{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

View file

@ -604,6 +604,8 @@ enum playersprite
SPR2_CLNG,
SPR2_CLMB,
SPR2_TWIN, // twinspin
SPR2_TRNS,
SPR2_SSTD,
SPR2_SWLK,
@ -652,13 +654,13 @@ typedef enum state
S_PLAY_SPIN,
S_PLAY_DASH,
S_PLAY_GASP,
S_PLAY_JUMP, // spin jump (todo: make jump separate from spring up for non-spin chars too?)
S_PLAY_JUMP, // spin jump
S_PLAY_SPRING,
S_PLAY_FALL,
S_PLAY_EDGE,
S_PLAY_RIDE,
// CA_FLY
// CA_FLY/SWIM
S_PLAY_FLY,
S_PLAY_SWIM,
S_PLAY_FLY_TIRED,
@ -668,6 +670,9 @@ typedef enum state
S_PLAY_CLING,
S_PLAY_CLIMB,
// CA_TWINSPIN
S_PLAY_TWINSPIN,
// SF_SUPERANIMS
S_PLAY_SUPER_STND,
S_PLAY_SUPER_WALK,

View file

@ -300,7 +300,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
}
if (((player->pflags & PF_NIGHTSMODE) && (player->pflags & PF_DRILLING))
|| ((player->pflags & PF_JUMPED) && !(player->charflags & SF_NOJUMPDAMAGE))
|| ((player->pflags & PF_JUMPED) && !(player->charflags & SF_NOJUMPDAMAGE && !(player->charability == CA_TWINSPIN && player->panim == PA_ABILITY)))
|| (player->pflags & (PF_SPINNING|PF_GLIDING))
|| ((player->charflags & SF_STOMPDAMAGE) && (P_MobjFlip(toucher)*(toucher->z - (special->z + special->height/2)) > 0) && (P_MobjFlip(toucher)*toucher->momz < 0))
|| player->powers[pw_invulnerability] || player->powers[pw_super]) // Do you possess the ability to subdue the object?
@ -345,7 +345,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
P_DamageMobj(toucher, special, special, 1, 0);
}
else if (((player->pflags & PF_NIGHTSMODE) && (player->pflags & PF_DRILLING))
|| ((player->pflags & PF_JUMPED) && !(player->charflags & SF_NOJUMPDAMAGE))
|| ((player->pflags & PF_JUMPED) && !(player->charflags & SF_NOJUMPDAMAGE && !(player->charability == CA_TWINSPIN && player->panim == PA_ABILITY)))
|| (player->pflags & (PF_SPINNING|PF_GLIDING))
|| ((player->charflags & SF_STOMPDAMAGE) && (P_MobjFlip(toucher)*(toucher->z - (special->z + special->height/2)) > 0) && (P_MobjFlip(toucher)*toucher->momz < 0))
|| player->powers[pw_invulnerability] || player->powers[pw_super]) // Do you possess the ability to subdue the object?

View file

@ -939,7 +939,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
{
if (thing->flags & MF_MONITOR
&& (tmthing->player->pflags & (PF_SPINNING|PF_GLIDING)
|| ((tmthing->player->pflags & PF_JUMPED) && !(tmthing->player->charflags & SF_NOJUMPDAMAGE))
|| ((tmthing->player->pflags & PF_JUMPED) && !(tmthing->player->charflags & SF_NOJUMPDAMAGE && !(tmthing->player->charability == CA_TWINSPIN && tmthing->player->panim == PA_ABILITY)))
|| ((tmthing->player->charflags & SF_STOMPDAMAGE) && (P_MobjFlip(tmthing)*(tmthing->z - (thing->z + thing->height/2)) > 0) && (P_MobjFlip(tmthing)*tmthing->momz < 0))))
{
SINT8 flipval = P_MobjFlip(thing); // Save this value in case monitor gets removed.
@ -964,7 +964,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
// unless it's a CTF team monitor and you're on the wrong team
else if (thing->flags & MF_MONITOR && tmthing->player
&& (tmthing->player->pflags & (PF_SPINNING|PF_GLIDING)
|| ((tmthing->player->pflags & PF_JUMPED) && !(tmthing->player->charflags & SF_NOJUMPDAMAGE))
|| ((tmthing->player->pflags & PF_JUMPED) && !(tmthing->player->charflags & SF_NOJUMPDAMAGE && !(tmthing->player->charability == CA_TWINSPIN && tmthing->player->panim == PA_ABILITY)))
|| ((tmthing->player->charflags & SF_STOMPDAMAGE) && (P_MobjFlip(tmthing)*(tmthing->z - (thing->z + thing->height/2)) > 0) && (P_MobjFlip(tmthing)*tmthing->momz < 0)))
&& !((thing->type == MT_REDRINGBOX && tmthing->player->ctfteam != 1) || (thing->type == MT_BLUERINGBOX && tmthing->player->ctfteam != 2)))
;

View file

@ -163,6 +163,10 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
I_Error("P_SetPlayerMobjState used for non-player mobj. Use P_SetMobjState instead!\n(Mobj type: %d, State: %d)", mobj->type, state);
#endif
// Catch falling for nojumpspin
if ((state == S_PLAY_JUMP) && (player->charflags & SF_NOJUMPSPIN) && (P_MobjFlip(mobj)*mobj->momz < 0 || player->pflags & PF_THOKKED))
return P_SetPlayerMobjState(mobj, S_PLAY_FALL);
// Catch state changes for Super Sonic
if (player->powers[pw_super] && (player->charflags & SF_SUPERANIMS))
{
@ -256,6 +260,7 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
case S_PLAY_FLY:
case S_PLAY_SWIM:
case S_PLAY_GLIDE:
case S_PLAY_TWINSPIN:
player->panim = PA_ABILITY;
break;
case S_PLAY_RIDE:
@ -390,6 +395,10 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
spr2 = SPR2_CLMB;
break;
case SPR2_TWIN:
spr2 = SPR2_SPIN;
break;
// Super sprites fallback to regular sprites
case SPR2_SWLK:
spr2 = SPR2_WALK;
@ -591,12 +600,7 @@ boolean P_SetMobjState(mobj_t *mobj, statenum_t state)
if (frame >= numframes)
{
if (st->frame & FF_SPR2ENDSTATE)
{
if (st->var1 == S_NULL)
frame--; // no frame advancement
else
return P_SetPlayerMobjState(mobj, st->var1);
}
return P_SetPlayerMobjState(mobj, st->var1); // Differs from P_SetPlayerMobjState - allows object to be removed via S_NULL
else
frame = 0;
}

View file

@ -4175,7 +4175,6 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
player->pflags |= PF_THOKKED;
}
break;
case CA_AIRDRILL:
if (!(player->pflags & PF_THOKKED) || player->charability2 == CA2_MULTIABILITY)
{
@ -4184,6 +4183,15 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
S_StartSound(player->mo, sfx_spndsh);
}
break;
case CA_TWINSPIN:
if(!(player->pflags & PF_THOKKED))
{
player->pflags |= PF_THOKKED;
S_StartSound(player->mo, sfx_s3k42);
player->mo->frame = 0;
P_SetPlayerMobjState(player->mo, S_PLAY_TWINSPIN);
}
break;
default:
break;
}