Curation round 15: restart and mods, Brimstone and Tech X, room gaps, eight bosses, the Womb and Mom's Heart, the Forgotten and tainted starts, alt path enemies and exits
This commit is contained in:
1 parent
6e3da161fc
commit
78a2680134
128 files changed
+13196
-2933
No files matched your search
@@ -0,0 +1,176 @@
|
||||
#include "npc_depths.h"
|
||||
#include "entity_effect.h"
|
||||
#include "game.h"
|
||||
#include "room_grid.h"
|
||||
#include "sfx_manager.h"
|
||||
|
||||
// The Fat Sack walks its grid path at 0.3, groaning one time in 50. One time in 50 it leaps where its prey will be
|
||||
// in 10 frames (or the nearest free spot within 120), gliding there 0.02 of the way more each frame after 10 frames
|
||||
// up, and lands in a ring of 6 shots at 12 and 5 puddles of red creep twice as big within 50.
|
||||
constexpr float FAT_SACK_PATH_SPEED = 0.3f;
|
||||
constexpr int FAT_SACK_PATH_MARKER = 900;
|
||||
constexpr float FAT_SACK_WALK_THRESHOLD = 0.1f;
|
||||
constexpr float FAT_SACK_FEAR_FRICTION = 0.8f;
|
||||
constexpr uint32_t FAT_SACK_GROAN_ODDS = 50;
|
||||
constexpr float FAT_SACK_GROAN_VOLUME = 0.8f;
|
||||
constexpr int FAT_SACK_GROAN_DELAY = 40;
|
||||
constexpr uint32_t FAT_SACK_LEAP_ODDS = 50;
|
||||
constexpr float FAT_SACK_LEAD_FRAMES = 10;
|
||||
constexpr float FAT_SACK_LANDING_SEARCH = 120;
|
||||
constexpr int FAT_SACK_GLIDE_AFTER = 10;
|
||||
constexpr float FAT_SACK_GLIDE_STEP = 0.02f;
|
||||
constexpr float FAT_SACK_JUMP_FRICTION = 0.8f;
|
||||
constexpr float FAT_SACK_LAND_FRICTION = 0.7f;
|
||||
constexpr float FAT_SACK_RING_SPEED = 12;
|
||||
constexpr float FAT_SACK_RING_SHOTS = 6;
|
||||
constexpr int FAT_SACK_PUDDLES = 5;
|
||||
constexpr float FAT_SACK_PUDDLE_RANGE = 50;
|
||||
constexpr float FAT_SACK_PUDDLE_SCALE = 2;
|
||||
constexpr float FAT_SACK_THUD_VOLUME = 2;
|
||||
|
||||
// A controlled Fat Sack steers its leap, and the longer it holds a direction (up to 30 frames) the farther it goes.
|
||||
constexpr float FAT_SACK_DEADZONE = 0.1f;
|
||||
constexpr float FAT_SACK_HOLD_MAX = 30;
|
||||
constexpr float FAT_SACK_STEER = 0.1f;
|
||||
|
||||
// Dying (unless blown apart past 25 overkill), it rises again as a Blubber one time in 3, waiting 20 to 39 frames.
|
||||
constexpr float FAT_SACK_GIBBED_HEALTH = -25;
|
||||
constexpr uint32_t FAT_SACK_RISE_ODDS = 3;
|
||||
constexpr uint32_t FAT_SACK_RISE_WAIT_RANGE = 20;
|
||||
constexpr int FAT_SACK_RISE_WAIT = 20;
|
||||
|
||||
// Walking after its prey, and leaping now and then.
|
||||
static void fat_sack_walk(Entity_NPC& npc)
|
||||
{
|
||||
npc.AnimWalkFrame("WalkHori", "WalkVert", FAT_SACK_WALK_THRESHOLD);
|
||||
npc.aiFloat = FAT_SACK_PATH_SPEED;
|
||||
if (!npc.HasEntityFlags(FLAG_FEAR | FLAG_SHRINK) || npc.controllerID != -1)
|
||||
npc.pathfinder.FindGridPath(npc.CalcTargetPosition(0), FAT_SACK_PATH_SPEED, FAT_SACK_PATH_MARKER,
|
||||
DIRECT_PATH_FAR);
|
||||
else
|
||||
{
|
||||
npc.pathfinder.EvadeTarget(npc.GetPlayerTarget()->pos, STATUS_OBEYED);
|
||||
npc.friction *= FAT_SACK_FEAR_FRICTION;
|
||||
if (npc.pathfinder.evadeMovementCountdown > 0) npc.friction *= FAT_SACK_FEAR_FRICTION;
|
||||
}
|
||||
|
||||
if (Random() % FAT_SACK_GROAN_ODDS == 0)
|
||||
npc.PlaySound(SOUND_MONSTER_ROAR_1, FAT_SACK_GROAN_VOLUME, FAT_SACK_GROAN_DELAY, false, 1);
|
||||
bool isLeaping = npc.controllerID == -1 ? Random() % FAT_SACK_LEAP_ODDS == 0
|
||||
: npc.IsControllerActionPressed(CONTROLLER_ACTION_SHOOT);
|
||||
if (!isLeaping || npc.HasEntityFlags(FLAG_DISTRACTED)) return;
|
||||
|
||||
npc.PlaySound(SOUND_FETUS_JUMP, 1, 2, false, 1);
|
||||
npc.state = NPC_STATE_JUMP;
|
||||
Vector at = npc.GetPlayerTarget()->pos;
|
||||
Entity* target = npc.GetPlayerTarget();
|
||||
npc.targetPosition = vector_make(target->velocity.x * FAT_SACK_LEAD_FRAMES + at.x,
|
||||
target->velocity.y * FAT_SACK_LEAD_FRAMES + at.y);
|
||||
if (room_grid_collision_at(npc.targetPosition) != 0)
|
||||
npc.targetPosition = room_free_pickup_position_find({npc.targetPosition, FAT_SACK_LANDING_SEARCH});
|
||||
npc.v1.x = 0;
|
||||
npc.stateFrame = 0;
|
||||
}
|
||||
|
||||
// The landing's splash: a ring of shots and puddles of creep around it.
|
||||
static void fat_sack_splash(Entity_NPC& npc)
|
||||
{
|
||||
npc.PlaySound(SOUND_BLOODSHOOT, 1, 2, false, 1);
|
||||
ProjectileParams params;
|
||||
Random();
|
||||
params = ProjectileParams();
|
||||
npc.FireProjectiles(npc.pos, vector_make(FAT_SACK_RING_SPEED, FAT_SACK_RING_SHOTS), PROJECTILES_RING, params);
|
||||
|
||||
for (int i = 0; i < FAT_SACK_PUDDLES; i++)
|
||||
{
|
||||
uint32_t seed = Random();
|
||||
float angle = random_unit() * RANDOM_HALF_TURN;
|
||||
angle += angle;
|
||||
float distance = random_unit() * FAT_SACK_PUDDLE_RANGE;
|
||||
Vector at = vector_make(std::cos(angle) * distance + npc.pos.x, std::sin(angle) * distance + npc.pos.y);
|
||||
Entity* creep = g_game->Spawn(
|
||||
{.position = at, .spawner = &npc, .type = ENTITY_EFFECT, .variant = EFFECT_CREEP_RED, .seed = seed});
|
||||
creep->sprite.scale = vector_make(FAT_SACK_PUDDLE_SCALE, FAT_SACK_PUDDLE_SCALE);
|
||||
}
|
||||
}
|
||||
|
||||
// Leaping: gliding toward its landing spot (or steered), then landing with a splash.
|
||||
static void fat_sack_leap(Entity_NPC& npc)
|
||||
{
|
||||
if (npc.stateFrame > FAT_SACK_GLIDE_AFTER)
|
||||
{
|
||||
npc.v1.x = std::min(npc.v1.x + FAT_SACK_GLIDE_STEP, 1.0f);
|
||||
float glide = npc.v1.x;
|
||||
if (npc.controllerID == -1)
|
||||
{
|
||||
npc.pos.y = (1 - glide) * npc.pos.y + glide * npc.targetPosition.y;
|
||||
npc.pos.x = glide * npc.targetPosition.x + (1 - glide) * npc.pos.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!npc.sprite.WasEventTriggered("Hit"))
|
||||
reconstruction_missing("NpcAI::ENTITY_FAT_SACK 00530a80: apply_controller_movement 006d9320");
|
||||
else
|
||||
{
|
||||
Vector input = npc.GetControllerInput(0);
|
||||
npc.velocity.x = input.x * FAT_SACK_STEER * npc.speedMultiplier + npc.velocity.x;
|
||||
npc.velocity.y = input.y * FAT_SACK_STEER * npc.speedMultiplier + npc.velocity.y;
|
||||
}
|
||||
npc.targetPosition = npc.pos;
|
||||
}
|
||||
}
|
||||
npc.stateFrame += npc_ticks_get(npc);
|
||||
|
||||
AnimationState& anim = npc.sprite.animState;
|
||||
if (npc.state == NPC_STATE_JUMP)
|
||||
{
|
||||
npc.sprite.Play("Jump");
|
||||
npc.entityCollisionClass = ENTCOLL_NONE;
|
||||
npc.entityGridCollisionClass = GRIDCOLL_WALLS;
|
||||
npc.friction *= FAT_SACK_JUMP_FRICTION;
|
||||
if (!anim.animData || !anim.isPlaying) npc.state = NPC_STATE_STOMP;
|
||||
return;
|
||||
}
|
||||
if (npc.state != NPC_STATE_STOMP) return;
|
||||
|
||||
npc.sprite.Play("Land");
|
||||
npc.friction *= FAT_SACK_LAND_FRICTION;
|
||||
if (npc.sprite.IsEventTriggered("Splash")) fat_sack_splash(npc);
|
||||
if (anim.animData && anim.IsEventTriggered("Hit"))
|
||||
{
|
||||
npc.entityCollisionClass = ENTCOLL_ALL;
|
||||
npc.entityGridCollisionClass = GRIDCOLL_GROUND;
|
||||
npc.PlaySound(SOUND_MEAT_JUMPS, FAT_SACK_THUD_VOLUME, 2, false, 1);
|
||||
}
|
||||
if (!anim.animData || !anim.isPlaying) npc.state = NPC_STATE_MOVE;
|
||||
}
|
||||
|
||||
// 00530a80 The Fat Sack's AI: it walks after its prey and leaps onto where it will be, landing in a splash of shots
|
||||
// and creep. It may rise again as a Blubber.
|
||||
void npc_fat_sack_update(Entity_NPC& npc)
|
||||
{
|
||||
if (npc.state == NPC_STATE_INIT)
|
||||
{
|
||||
npc.state = NPC_STATE_MOVE;
|
||||
return;
|
||||
}
|
||||
if (npc.isDead)
|
||||
{
|
||||
if (npc.health <= FAT_SACK_GIBBED_HEALTH || Random() % FAT_SACK_RISE_ODDS != 0) return;
|
||||
npc.entityCollisionClass = ENTCOLL_ALL;
|
||||
npc.entityGridCollisionClass = GRIDCOLL_GROUND;
|
||||
npc.Morph(ENTITY_BLUBBER, 0, 0, -1);
|
||||
npc.isDead = false;
|
||||
npc.health = npc.maxHitPoints;
|
||||
npc.projectileCooldown = (int)(Random() % FAT_SACK_RISE_WAIT_RANGE) + FAT_SACK_RISE_WAIT;
|
||||
return;
|
||||
}
|
||||
|
||||
if (npc.controllerID != -1)
|
||||
{
|
||||
bool isHeld = !vector_is_zero(npc.GetControllerInput(FAT_SACK_DEADZONE));
|
||||
npc.v2.x = isHeld ? std::min(npc.v2.x + 1, FAT_SACK_HOLD_MAX) : 0;
|
||||
}
|
||||
if (npc.state == NPC_STATE_MOVE) fat_sack_walk(npc);
|
||||
else fat_sack_leap(npc);
|
||||
}
|
||||
Reference in new issue
Block a user