Reaper new anim + fast spawn for testing

This commit is contained in:
Latapostrophe 2018-10-24 21:07:25 +02:00
parent 5224461184
commit 553013ddbf
2 changed files with 51 additions and 46 deletions

View File

@ -3085,7 +3085,7 @@ state_t states[NUMSTATES] =
{SPR_MARR, 0, 1, {A_MayonakaArrow}, 0, 0, S_MAYONAKAARROW}, //S_MAYONAKAARROW
//Mementos stuff
{SPR_NULL, 0, TICRATE*130, {NULL}, 0, 0, S_REAPER}, //S_REAPER_INVIS
{SPR_NULL, 0, TICRATE*20, {NULL}, 0, 0, S_REAPER}, //S_REAPER_INVIS TODO: DON'T FORGET TO CHANGE THAT BACK TO 130*TICRATE WHEN TESTING IS OVER
{SPR_REAP, 0, 1, {A_ReaperThinker}, 0, 0, S_REAPER}, //S_REAPER
{SPR_NULL, 0, 1, {A_MementosTPParticles}, 0, 0, S_MEMENTOSTP}, //S_MEMENTOSTP

View File

@ -8438,7 +8438,7 @@ void A_RandomShadowFrame(mobj_t *actor)
#endif
if (!actor->extravalue1) // Hack that spawns thoks that look like random shadows. Otherwise the state would overwrite our frame and that's a pain.
{
{
fake = P_SpawnMobj(actor->x, actor->y, actor->z, MT_THOK);
fake->sprite = SPR_ENM1;
fake->frame = P_RandomRange(0, 6);
@ -8450,9 +8450,9 @@ void A_RandomShadowFrame(mobj_t *actor)
actor->flags2 |= MF2_DONTDRAW;
actor->extravalue1 = 1;
}
P_SetScale(actor, FRACUNIT*3/2);
// I have NO CLUE how to hardcode all of that fancy Linedef Executor shit so the fire spinout will be done by these entities directly.
if (P_LookForPlayers(actor, false, false, 512<<FRACBITS)) // got target
{
@ -8487,7 +8487,7 @@ void A_RoamingShadowThinker(mobj_t *actor)
#endif
// extravalue1 replaces "movetimer"
// extravalue2 replaces "stoptimer"
P_SetScale(actor, FRACUNIT*3/2);
if (!actor->extravalue2)
{
@ -8499,7 +8499,7 @@ void A_RoamingShadowThinker(mobj_t *actor)
actor->extravalue2 = 60;
}
// Search for and attack Players venturing too close in front of us.
if (P_LookForPlayers(actor, false, false, 256<<FRACBITS)) // got target
{
if (actor->target && !actor->target->player->powers[pw_flashing]
@ -8545,7 +8545,7 @@ void A_MayonakaArrow(mobj_t *actor)
// "animtimer" is replaced by "extravalue1" here.
actor->extravalue1 = ((actor->extravalue1) ? (actor->extravalue1+1) : (P_RandomRange(0, TICRATE*3)));
flip = ((actor->spawnpoint->options & 1) ? (3) : (0)); // flip adds 3 frames, which is the flipped version of the sign.
actor->frame = flip;
if (actor->extravalue1 >= TICRATE*7/2)
actor->extravalue1 = 0; // reset to 0 and start a new cycle.
@ -8553,10 +8553,10 @@ void A_MayonakaArrow(mobj_t *actor)
actor->frame = flip+2;
else if (actor->extravalue1 > TICRATE*3 && leveltime%2 > 0)
actor->frame = flip+1;
actor->frame |= FF_PAPERSPRITE;
actor->momz = 0;
return;
return;
}
// A_MementosTPParticles
@ -8568,21 +8568,21 @@ void A_MementosTPParticles(mobj_t *actor)
mobj_t *mo2;
int i = 0;
thinker_t *th;
#ifdef HAVE_BLUA
if (LUA_CallAction("A_MementosTPParticles", (actor)))
return;
#endif
for (; i<4; i++)
{
{
particle = P_SpawnMobj(actor->x + (P_RandomRange(-256, 256)<<FRACBITS), actor->y + (P_RandomRange(-256, 256)<<FRACBITS), actor->z + (P_RandomRange(48, 256)<<FRACBITS), MT_MEMENTOSPARTICLE);
particle->frame = 0;
particle->color = ((i%2) ? (SKINCOLOR_RED) : (SKINCOLOR_BLACK));
particle->destscale = 1;
P_HomingAttack(particle, actor);
}
// Although this is mostly used to spawn particles, we will also save the OTHER teleport inside actor->target. That way teleporting doesn't require a thinker iteration.
// Doesn't seem like much given the small amount of mobjs this map has but heh.
if (!actor->target)
@ -8610,75 +8610,80 @@ void A_ReaperThinker(mobj_t *actor)
mobj_t *particle; // particles to spawn
int i = 0; // for loops
angle_t an = ANGLE_22h; // Reminder that angle constants suck.
//Waypoint stuff:
mobj_t *mo2;
thinker_t *th;
//Player targetting stuff:
INT32 maxscore = 0; // we target the player with the highest score so yeah there you go.
player_t *player; // used as a shortcut in a loop.
mobj_t *targetplayermo; // the player mo we can eventually target, or whatever.
#ifdef HAVE_BLUA
if (LUA_CallAction("A_ReaperThinker", (actor)))
return;
#endif
// We don't have custom variables or whatever so we'll do with whatever the fuck we have left.
if (actor->health == 1000) // if health is 1000, set it to a small scale and have it start growing with destscale. Then set the health to uh, not 1000.
{
{
actor->scale = 1;
actor->destscale = 2<<FRACBITS;
actor->scalespeed = FRACUNIT/24; // Should take a bit less than 2 seconds to fully grow.
S_StartSound(NULL, sfx_chain);
actor->health--; // now we have 999 health, so that above won't happen again. Awesome.
}
if (actor->scale < 2<<FRACBITS) // we haven't finished growing YET.
{
// Spawn particles as we grow out of the floor, ゴ ゴ ゴ ゴ
for (; i<16; i++)
{
{
particle = P_SpawnMobj(actor->x + (P_RandomRange(-60, 60)<<FRACBITS), actor->y + (P_RandomRange(-60, 60)<<FRACBITS), actor->z, MT_THOK);
particle->momz = 20<<FRACBITS;
particle->color = ((i%2 !=0) ? (SKINCOLOR_RED) : (SKINCOLOR_BLACK));
particle->frame = 0;
P_SetScale(particle, FRACUNIT/2);
}
// Spawn particles in some edgy circle or w/e.
if (leveltime%5 != 0) // spawn the thing under that every tic.
return;
i=0;
for (; i<15; i++) // spawn in a circle formation or w/e.
{
{
particle = P_SpawnMobj(actor->x, actor->y, actor->z, MT_THOK);
particle->momz = 20<<FRACBITS;
particle->color = ((i%2 !=0) ? (SKINCOLOR_RED) : (SKINCOLOR_BLACK));
particle->frame = 0;
P_SetScale(particle, FRACUNIT/2);
P_InstaThrust(particle, an*i, 30<<FRACBITS);
P_InstaThrust(particle, an*i, 30<<FRACBITS);
}
return; // don't continue, what lies beyond that is the movement code.
}
// We finished growing and can now be a dangerous piece o' garbage scaring the living heck outta players!
actor->flags = MF_NOGRAVITY|MF_PAIN|MF_SPECIAL|MF_NOCLIP|MF_NOCLIPHEIGHT; // set our flags to be a damaging thing.
// Handle animation:
if (!(leveltime%5))
actor->extravalue2 = (actor->extravalue2 < 9) ? (actor->extravalue2+1) : (0); // Ghetto animation, but hey it works for what it's worth
actor->frame = actor->extravalue2; // yes i'm that bad at maths don't @ me.
if (!actor->target)
{
if (actor->hnext)
{
{
P_SetTarget(&actor->target, actor->hnext); // Default back to last waypoint.
return;
}
}
// We have no target and oughta find one, so let's scan through thinkers for a waypoint of angle 0, or something.
for (th = thinkercap.next; th != &thinkercap; th = th->next)
{
@ -8701,28 +8706,28 @@ void A_ReaperThinker(mobj_t *actor)
break;
}
}
}
}
else // Awesome, we now have a target.
{
{
// Follow target:
P_InstaThrust(actor, R_PointToAngle2(actor->x, actor->y, actor->target->x, actor->target->y), 20<<FRACBITS);
actor->angle = R_PointToAngle2(actor->x, actor->y, actor->target->x, actor->target->y);
// The player we should target if it's near us:
for (i=0; i<MAXPLAYERS; i++)
{
{
if (!playeringame[i])
continue;
player = &players[actor->lastlook];
if (player && player->mo && player->kartstuff[k_bumper] && player->score >= maxscore)
{
{
targetplayermo = player->mo;
maxscore = player->score;
}
}
// Try to target that player:
if (targetplayermo)
{
@ -8734,17 +8739,17 @@ void A_ReaperThinker(mobj_t *actor)
&& !actor->target->player->kartstuff[k_spinouttimer]))
P_SetTarget(&actor->target, actor->hnext);
// if the above isn't correct, then we should go back to targetting waypoints or something.
}
}
}
// Waypoint behavior.
if (actor->target->type == MT_REAPERWAYPOINT)
{
{
if (R_PointToDist2(actor->x, actor->y, actor->target->x, actor->target->y) < 22<<FRACBITS)
{
P_SetTarget(&actor->target, NULL); // remove target so we can default back to first waypoint if things go ham.
// If we reach close to a waypoint, then we should go to the NEXT one.
for (th = thinkercap.next; th != &thinkercap; th = th->next)
{
@ -8757,15 +8762,15 @@ void A_ReaperThinker(mobj_t *actor)
continue;
if (mo2->spawnpoint->angle != actor->extravalue1+1)
continue;
P_SetTarget(&actor->target, mo2); // The main target we're pursing.
P_SetTarget(&actor->hnext, mo2); // The last waypoint we hit. We will default back to that if a player goes out of our range!
actor->extravalue1++; // This will store the angle of the last waypoint we touched. This will essentially be useful later on.
break;
}
}
if (!actor->target) // If we have no target, revert back to waypoint 0.
{
actor->extravalue1 = 0;