Curation round 22: every NpcAI below type 400, Repentance bosses and Rotgut, the player's last branches, clots and familiars, bomb tear effects and chain lightning, Mother and Home to Dogma, Greed and Greedier, the new Anm2Ed JSON loader, shared IDs folded (135 duplicates)
This commit is contained in:
1 parent
6a11163842
commit
b9405bfb31
198 files changed
+21859
-2999
No files matched your search
+317
-18
@@ -1,4 +1,5 @@
|
||||
#include "entity_projectile.h"
|
||||
#include "boss_repentance.h"
|
||||
#include "entity_bomb.h"
|
||||
#include "entity_combat.h"
|
||||
#include "entity_effect.h"
|
||||
@@ -15,6 +16,7 @@
|
||||
#include "npc_ai.h"
|
||||
#include "npc_basement.h"
|
||||
#include "room.h"
|
||||
#include "room_grid.h"
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cmath>
|
||||
@@ -48,8 +50,7 @@ constexpr uint64_t CHANGE_BOTH_FLAGS =
|
||||
constexpr uint64_t BURST3_CHILD_CLEARED = PROJECTILE_CURVE_LEFT | PROJECTILE_CURVE_RIGHT | PROJECTILE_SINE_VELOCITY;
|
||||
|
||||
// The flags whose effects belong to the late bosses and items, and are not reconstructed.
|
||||
constexpr uint64_t UNRECONSTRUCTED_FLAGS =
|
||||
PROJECTILE_STASIS | PROJECTILE_LASER_SHOT | PROJECTILE_BROCCOLI | PROJECTILE_SIDE_WAVE;
|
||||
constexpr uint64_t UNRECONSTRUCTED_FLAGS = PROJECTILE_STASIS | PROJECTILE_LASER_SHOT;
|
||||
constexpr uint64_t FIRE_FLAGS = PROJECTILE_FIRE_WAVE | PROJECTILE_FIRE_WAVE_X | PROJECTILE_FIRE_SPAWN;
|
||||
|
||||
// The glow a fiery, Heretic's, blue fire or side wave shot carries.
|
||||
@@ -230,6 +231,10 @@ constexpr float BURST8_CHILD_SCALE = 0.66f;
|
||||
constexpr float BACK_SPLIT_TURN = 24;
|
||||
constexpr float BACK_SPLIT_SPEED = 10;
|
||||
constexpr float BACK_SPLIT_ACCEL = -0.04f;
|
||||
constexpr float SIDE_WAVE_ACCELERATION = 1.12f;
|
||||
constexpr float SIDE_WAVE_FALL = -0.04f;
|
||||
constexpr float SIDE_WAVE_SPEED = 0.15f;
|
||||
constexpr float SIDE_WAVE_TICKS = 8;
|
||||
constexpr int BURSTSPLIT_COUNT = 16;
|
||||
constexpr float BURSTSPLIT_SPEED_MIN = -10;
|
||||
constexpr float BURSTSPLIT_SPEED_MAX = -22;
|
||||
@@ -237,7 +242,6 @@ constexpr float BURSTSPLIT_ANGLE = 70;
|
||||
constexpr float BURSTSPLIT_ACCEL = 0.75f;
|
||||
constexpr float BURSTSPLIT_SCALE_MIN = 0.9f;
|
||||
constexpr ColorMod BURSTSPLIT_SPLASH_COLOR = {{1, 1, 1, 1}, {0.2f, 1.2f, 0, 1}, {0, 0, 0}};
|
||||
constexpr ColorMod BURSTSPLIT_COLOR = {{1, 1, 1, 1}, {2.7f, 3, 2, 1}, {0, 0, 0}};
|
||||
|
||||
// The splash a dead shot leaves: poof sizes and sounds, the creep its flags leave and the explosion.
|
||||
constexpr float POOF_SCALE_SHARE = 0.8f;
|
||||
@@ -332,11 +336,9 @@ constexpr std::array<std::array<float, 3>, CONTINUUM_COLORS> CONTINUUM_COLORIZES
|
||||
{0.66f, 0, 0.66f},
|
||||
{1, 0, 1}}};
|
||||
|
||||
constexpr int ENTITY_TARBOY = 307;
|
||||
constexpr int ENTITY_SHADY = 888;
|
||||
constexpr int MOTHER_BALL = 10;
|
||||
constexpr int BEAST_FIRE_BALL = 20;
|
||||
constexpr int ROTGUT_HEART = 2;
|
||||
|
||||
constexpr int EFFECT_BONE_PARTICLE = 35;
|
||||
constexpr int EFFECT_CORN_POOF = 43;
|
||||
@@ -345,8 +347,21 @@ constexpr int EFFECT_COIN_POOF = 97;
|
||||
constexpr int EFFECT_GODHEAD_AURA = 123;
|
||||
constexpr int EFFECT_DOGMA_POOF = 200;
|
||||
constexpr int GODHEAD_AURA_SUBTYPE = 4;
|
||||
constexpr int BLOOD_EXPLOSION_SPLASH = 3;
|
||||
constexpr int ACID_SPLAT_SUBTYPE = 0;
|
||||
|
||||
// Rotgut's heart's shots: two out of its fire's burst, thirteen out of its spit, each at 6 to 10 up.
|
||||
constexpr float ROTGUT_SHOT_SPEED_MIN = -6;
|
||||
constexpr float ROTGUT_SHOT_SPEED_MAX = -10;
|
||||
constexpr float ROTGUT_BURST_TURN = 30;
|
||||
constexpr float ROTGUT_BURST_RISE = -6;
|
||||
constexpr int ROTGUT_BURST_TIMEOUT = 6;
|
||||
constexpr float ROTGUT_BURST_FALL = 0.2f;
|
||||
constexpr int ROTGUT_SPLIT_SHOTS = 13;
|
||||
constexpr float ROTGUT_SPLIT_TURN = 75;
|
||||
constexpr int ROTGUT_SPLIT_TIMEOUT = 45;
|
||||
constexpr float ROTGUT_SPLIT_FALL = -0.1f;
|
||||
constexpr float ROTGUT_SPLIT_SCALE = 0.8f;
|
||||
constexpr float ROTGUT_SPLIT_SCALE_RANGE = 0.6f;
|
||||
constexpr int FIRE_POOF_SUBTYPE = 1;
|
||||
constexpr int BONE_PARTICLE_SUBTYPE = 1;
|
||||
|
||||
@@ -542,6 +557,203 @@ float Entity_Projectile::time_scale_get()
|
||||
}
|
||||
|
||||
// 00653070 Flies the shot for a frame: its animation, the base update, its flags' steering and wiggles, its fall,
|
||||
|
||||
// A fly ball (a broccoli shot): a shot whose subtype counts the flies (less 100 past 100, which then carry the count)
|
||||
// that orbit it from its first frame, itself unseen. It homes in on the nearest player (not Mother's), goes once its
|
||||
// flies are gone, and bursts them out backwards when it dies.
|
||||
constexpr int FLY_BALL_LIVE = 1000;
|
||||
constexpr int FLY_BALL_NESTED = 100;
|
||||
constexpr uint64_t FLY_FLAGS = PROJECTILE_BROCCOLI | PROJECTILE_NO_WALL_COLLIDE;
|
||||
constexpr float FLY_BRIGHT = 4;
|
||||
constexpr float FLY_RADIUS_X = 20;
|
||||
constexpr float FLY_RADIUS_Y = 8;
|
||||
constexpr float FLY_RADIUS_LEAST = 0.8f;
|
||||
constexpr float FLY_RADIUS_RANGE = 0.2f;
|
||||
constexpr float FLY_SCALE_LEAST = 1.4f;
|
||||
constexpr float FLY_SCALE_RANGE = 0.6f;
|
||||
constexpr int FLY_ORBIT_FRAMES = 30;
|
||||
constexpr float FLY_ORBIT_HEIGHT = -23;
|
||||
constexpr float FLY_BURST_SPREAD = 80;
|
||||
constexpr float FLY_BURST_REACH = 6;
|
||||
constexpr float FLY_BURST_SPEED = 9;
|
||||
constexpr float FLY_BURST_SPEED_RANGE = 3;
|
||||
constexpr float FLY_BURST_FALL = -0.094f;
|
||||
constexpr int FLY_BURST_WIGGLE = 30;
|
||||
constexpr float FLY_BALL_MARGIN = 3;
|
||||
constexpr ColorMod FLY_POP_COLOR = {{1, 1, 1, 1}, {4, 5, 1, 1}, {0, 0, 0}};
|
||||
constexpr ColorMod FLY_SPLAT_COLOR = {{0, 0, 0, 1}, {0, 0, 0, 0}, {81 / 255.0f, 112 / 255.0f, 29 / 255.0f}};
|
||||
constexpr float FLY_POP_SCALE = 1.5f;
|
||||
constexpr float FLY_POP_RISE = -20;
|
||||
constexpr float FLY_POP_DEPTH = 4;
|
||||
constexpr int FLY_MAGGOTS = 6;
|
||||
constexpr float FLY_MAGGOT_REACH = 80;
|
||||
constexpr float FLY_MAGGOT_FREE_REACH = 64;
|
||||
constexpr float FLY_MAGGOT_JITTER = 38;
|
||||
constexpr float FLY_MAGGOT_HEIGHT = -30;
|
||||
constexpr float FLY_MAGGOT_HEIGHT_RANGE = 15;
|
||||
constexpr float FLY_MAGGOT_STEP = 15;
|
||||
constexpr float FLY_SPLAT_SIZE = 1.5f;
|
||||
constexpr int FLY_BURST_SHAKE = 5;
|
||||
|
||||
// The flies still orbiting a fly ball.
|
||||
static std::vector<Entity_Projectile*> fly_ball_flies(Entity_Projectile& ball)
|
||||
{
|
||||
std::vector<Entity_Projectile*> flies;
|
||||
for (Entity* fly : g_game->room->entityList.updateEL)
|
||||
if (fly->type == ENTITY_PROJECTILE && fly->target == &ball)
|
||||
flies.push_back(static_cast<Entity_Projectile*>(fly));
|
||||
return flies;
|
||||
}
|
||||
|
||||
// Its first frame: the flies spawn about it, each bright one time in two, on an orbit of its own, and it hides.
|
||||
static void fly_ball_init(Entity_Projectile& ball)
|
||||
{
|
||||
if (!(ball.projectileFlags & PROJECTILE_BROCCOLI) || ball.subtype < 1 || ball.subtype >= FLY_BALL_LIVE) return;
|
||||
|
||||
int count = ball.subtype > FLY_BALL_NESTED ? ball.subtype - FLY_BALL_NESTED : ball.subtype;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
auto* fly = static_cast<Entity_Projectile*>(g_game->Spawn(
|
||||
{.position = ball.pos, .spawner = ball.spawnerEntity, .type = ENTITY_PROJECTILE, .seed = Random()}));
|
||||
fly->target = &ball;
|
||||
fly->parent = ball.parent.get();
|
||||
ColorMod color = ball.sprite.color;
|
||||
float bright = random_below(2) == 0 ? FLY_BRIGHT : 1;
|
||||
color._tint[0] = color._tint[1] = color._tint[2] = bright;
|
||||
fly->SetColor(color, -1, COLOR_PRIORITY_DEFAULT, false, true);
|
||||
fly->projectileFlags = FLY_FLAGS;
|
||||
fly->homingStrength = random_unit() * FULL_TURN_DEGREES;
|
||||
float radius = random_unit() * FLY_RADIUS_RANGE + FLY_RADIUS_LEAST;
|
||||
fly->targetPosition = vector_scale(vector_make(FLY_RADIUS_X * ball.scale, FLY_RADIUS_Y * ball.scale), radius);
|
||||
fly->scale = random_unit() * FLY_SCALE_RANGE + FLY_SCALE_LEAST;
|
||||
if (ball.subtype > FLY_BALL_NESTED) fly->subtype = count;
|
||||
}
|
||||
ball.sprite.color._tint[3] = 0;
|
||||
ball.subtype = FLY_BALL_LIVE;
|
||||
}
|
||||
|
||||
// A fly circles its ball on an ellipse turned by its own angle (its homing strength), once every 30 frames.
|
||||
static void fly_orbit_update(Entity_Projectile& fly)
|
||||
{
|
||||
Entity* ball = fly.target;
|
||||
if (!(fly.projectileFlags & PROJECTILE_BROCCOLI) || !ball || !ball->IsProjectile()) return;
|
||||
|
||||
Vector across = vector_scale(vector_from_angle(fly.homingStrength), fly.targetPosition.x);
|
||||
Vector along = vector_scale(vector_from_angle(fly.homingStrength + RIGHT_ANGLE_DEGREES), fly.targetPosition.y);
|
||||
float turn =
|
||||
(float)((uint32_t)(g_game->frameCount + (int)fly.initSeed) % FLY_ORBIT_FRAMES) * TAU / FLY_ORBIT_FRAMES;
|
||||
Vector spot =
|
||||
vector_add(vector_add(ball->pos, vector_scale(across, std::cos(turn))), vector_scale(along, std::sin(turn)));
|
||||
fly.velocity = vector_sub(spot, fly.pos);
|
||||
fly.friction = 1;
|
||||
fly.fallingSpeed = 0;
|
||||
fly.height = FLY_ORBIT_HEIGHT;
|
||||
}
|
||||
|
||||
// The ball dies: its flies burst out backwards across 160 degrees (any way when it was still), with maggots and green
|
||||
// creep but for Mother's, and a splat.
|
||||
static void fly_ball_burst(Entity_Projectile& ball)
|
||||
{
|
||||
ball.subtype = 0;
|
||||
npc_sound_play(SOUND_DEATH_BURST_SMALL, 1, 2, 1);
|
||||
Entity* pop = g_game->Spawn({.position = ball.pos,
|
||||
.subType = 3,
|
||||
.type = ENTITY_EFFECT,
|
||||
.variant = EFFECT_BLOOD_EXPLOSION,
|
||||
.seed = Random()});
|
||||
pop->sprite.scale = vector_make(FLY_POP_SCALE, FLY_POP_SCALE);
|
||||
pop->posOffset = vector_make(0, FLY_POP_RISE);
|
||||
pop->renderDepthOffset = FLY_POP_DEPTH;
|
||||
pop->SetColor(FLY_POP_COLOR, -1, COLOR_PRIORITY_DEFAULT, false, true);
|
||||
|
||||
std::vector<Entity_Projectile*> flies = fly_ball_flies(ball);
|
||||
Vector back = vector_scale(vector_normalized(ball.velocity), -1);
|
||||
float first = -FLY_BURST_SPREAD;
|
||||
float last = FLY_BURST_SPREAD;
|
||||
if (vector_is_zero(back))
|
||||
{
|
||||
back = random_direction();
|
||||
first = -HALF_TURN_DEGREES;
|
||||
last = HALF_TURN_DEGREES;
|
||||
}
|
||||
float step = 0;
|
||||
if (flies.size() < 2) first = 0;
|
||||
else step = (last - first) / (float)(flies.size() - 1);
|
||||
for (size_t i = 0; i < flies.size(); i++)
|
||||
{
|
||||
Entity_Projectile& fly = *flies[i];
|
||||
Vector direction = vector_rotated(back, (float)i * step + first);
|
||||
fly.pos = vector_add(ball.pos, vector_scale(direction, FLY_BURST_REACH));
|
||||
fly.velocity = vector_scale(direction, random_unit() * FLY_BURST_SPEED_RANGE + FLY_BURST_SPEED);
|
||||
fly.projectileFlags = PROJECTILE_HIT_ENEMIES;
|
||||
if (fly.subtype == FLY_BALL_LIVE) fly.projectileFlags |= PROJECTILE_BROCCOLI;
|
||||
fly.entityGridCollisionClass = GRIDCOLL_NOPITS;
|
||||
fly.fallingAccel = FLY_BURST_FALL;
|
||||
fly.target = nullptr;
|
||||
fly.wiggleFrameOffset = random_below(FLY_BURST_WIGGLE);
|
||||
}
|
||||
|
||||
ball.pos = g_game->room->GetClampedPositionImpl(ball.pos, FLY_BALL_MARGIN, FLY_BALL_MARGIN, FLY_BALL_MARGIN,
|
||||
FLY_BALL_MARGIN);
|
||||
if (ball.spawnerType != ENTITY_MOTHER)
|
||||
{
|
||||
for (int i = 0; i < FLY_MAGGOTS; i++)
|
||||
{
|
||||
Vector spot = random_direction();
|
||||
spot = vector_add(ball.pos, vector_scale(spot, random_unit() * FLY_MAGGOT_REACH));
|
||||
if (room_grid_collision_at(spot) > 0)
|
||||
{
|
||||
float jitterY = random_unit() * FLY_MAGGOT_JITTER - FLY_MAGGOT_JITTER * HALF;
|
||||
float jitterX = random_unit() * FLY_MAGGOT_JITTER - FLY_MAGGOT_JITTER * HALF;
|
||||
spot = vector_add(room_free_tile_position_find(spot, FLY_MAGGOT_FREE_REACH),
|
||||
vector_make(jitterX, jitterY));
|
||||
}
|
||||
Vector away = vector_normalized(vector_sub(spot, ball.pos));
|
||||
float height = random_unit() * FLY_MAGGOT_HEIGHT_RANGE + FLY_MAGGOT_HEIGHT;
|
||||
float reach = random_unit() * FLY_MAGGOT_STEP;
|
||||
small_maggot_jump_spawn(vector_add(ball.pos, vector_scale(away, reach)), height, ball.pos);
|
||||
}
|
||||
Entity* creep = g_game->Spawn({.position = ball.pos,
|
||||
.spawner = &ball,
|
||||
.type = ENTITY_EFFECT,
|
||||
.variant = EFFECT_CREEP_GREEN,
|
||||
.seed = Random()});
|
||||
creep->sprite.scale = vector_make(FLY_POP_SCALE, FLY_POP_SCALE);
|
||||
}
|
||||
float size = (random_unit() * HALF + HALF) * FLY_SPLAT_SIZE;
|
||||
Entity* splat = spawn_at(ENTITY_EFFECT, EFFECT_BLOOD_SPLAT, 0, ball.pos, &ball);
|
||||
splat->sprite.scale = vector_make(size, size);
|
||||
splat->Update();
|
||||
splat->SetColor(FLY_SPLAT_COLOR, -1, COLOR_PRIORITY_DEFAULT, false, true);
|
||||
splat->Update();
|
||||
game_shake_screen(FLY_BURST_SHAKE);
|
||||
}
|
||||
|
||||
// A live fly ball homes in on the nearest player (Mother's flies straight), goes when its flies are all gone, and
|
||||
// bursts when it dies.
|
||||
static void fly_ball_update(Entity_Projectile& ball)
|
||||
{
|
||||
if (!(ball.projectileFlags & PROJECTILE_BROCCOLI) || ball.subtype != FLY_BALL_LIVE) return;
|
||||
if (ball.isDead) return fly_ball_burst(ball);
|
||||
|
||||
if (ball.spawnerType != ENTITY_MOTHER)
|
||||
{
|
||||
if (!ball.target)
|
||||
if (Entity_Player* player = game_nearest_player(ball.pos)) ball.target = player;
|
||||
if (Entity* target = ball.target)
|
||||
{
|
||||
Vector aim = vector_normalized(vector_sub(target->pos, ball.pos));
|
||||
if (vector_dot(ball.velocity, aim) > 0)
|
||||
{
|
||||
float speed = vector_length(ball.velocity);
|
||||
ball.velocity =
|
||||
vector_resized(vector_add(ball.velocity, vector_scale(aim, ball.speedMultiplier)), speed);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ball.GetIntervalTicks(4, 0) && fly_ball_flies(ball).empty()) ball.Remove();
|
||||
}
|
||||
|
||||
// and its splash once it has died. A shot the Broken Modem froze waits, then vanishes.
|
||||
void Entity_Projectile::Update()
|
||||
{
|
||||
@@ -565,13 +777,18 @@ void Entity_Projectile::Update()
|
||||
projectileFlags &= ~(PROJECTILE_GHOST | PROJECTILE_NO_WALL_COLLIDE);
|
||||
}
|
||||
Entity::Update();
|
||||
if (FrameCount() == 1) first_frame_update();
|
||||
if (FrameCount() == 1)
|
||||
{
|
||||
first_frame_update();
|
||||
fly_ball_init(*this);
|
||||
}
|
||||
|
||||
if (projectileFlags & PROJECTILE_BURST8)
|
||||
{
|
||||
bool isBloodfly = subtype == 0 && spawnerType == ENTITY_SUCKER && spawnerVariant == SUCKER_BLOODFLY;
|
||||
if (updateTime > (isBloodfly ? BURST8_BLOODFLY_LIFE : BURST8_LIFE)) isDead = true;
|
||||
}
|
||||
fly_orbit_update(*this);
|
||||
trails_update();
|
||||
if (isDead) return death_update();
|
||||
|
||||
@@ -894,19 +1111,60 @@ void Entity_Projectile::glow_trail_spawn(bool isPurple)
|
||||
particle->Update();
|
||||
}
|
||||
|
||||
// The trails shots leave: a blue fire spawning shot's and a Necro bone's glow. The Beast's and Mother's are not
|
||||
// reconstructed.
|
||||
// A side wave shot sheds two speeding shots off its sides every 8 ticks, of its color and height.
|
||||
static void side_wave_spawn(Entity_Projectile& shot)
|
||||
{
|
||||
Vector across = vector_rotated(shot.velocity, RIGHT_ANGLE_DEGREES);
|
||||
for (int side = -1; side < 2; side += 2)
|
||||
{
|
||||
uint32_t seed = Random();
|
||||
Vector velocity = vector_scale(across, SIDE_WAVE_SPEED * (float)side);
|
||||
auto* wave = static_cast<Entity_Projectile*>(
|
||||
g_game->Spawn({.position = shot.pos, .velocity = velocity, .type = ENTITY_PROJECTILE, .seed = seed}));
|
||||
wave->spawnerEntity = shot.spawnerEntity.get();
|
||||
wave->spawnerType = shot.spawnerType;
|
||||
wave->spawnerVariant = shot.spawnerVariant;
|
||||
wave->SetColor(shot.color, -1, COLOR_PRIORITY_DEFAULT, false, true);
|
||||
wave->height = shot.height;
|
||||
wave->projectileFlags = PROJECTILE_ACCELERATE;
|
||||
wave->fallingAccel = SIDE_WAVE_FALL;
|
||||
wave->acceleration = SIDE_WAVE_ACCELERATION;
|
||||
wave->Update();
|
||||
}
|
||||
}
|
||||
|
||||
// The trails shots leave: a blue fire spawning shot's and a Necro bone's glow, a side wave's shots, and the drops
|
||||
// Mother's pound shots leave. The Beast's is not reconstructed.
|
||||
void Entity_Projectile::trails_update()
|
||||
{
|
||||
if ((projectileFlags & PROJECTILE_BLUE_FIRE_SPAWN) && GetIntervalTicks(TRAIL_TICKS, 0)) glow_trail_spawn(false);
|
||||
else if (spawnerType == ENTITY_NECRO && variant == PROJECTILE_BONE && GetIntervalTicks(TRAIL_TICKS, 0))
|
||||
glow_trail_spawn(true);
|
||||
if ((projectileFlags & PROJECTILE_SIDE_WAVE) && GetIntervalTicks(SIDE_WAVE_TICKS, 0)) side_wave_spawn(*this);
|
||||
|
||||
bool isBeastFire = (projectileFlags & PROJECTILE_EXPLODE) && spawnerType == ENTITY_BEAST &&
|
||||
spawnerVariant == BEAST_FIRE_BALL;
|
||||
if (isBeastFire) reconstruction_missing("Entity_Projectile::Update 00653070: the Beast's fire trail");
|
||||
fly_ball_update(*this);
|
||||
|
||||
// Mother's pound shots drop a falling shot of their color every 4 frames.
|
||||
constexpr float MOTHER_TRAIL_SPEED = 0.2f;
|
||||
constexpr float MOTHER_TRAIL_RISE = -6;
|
||||
constexpr float MOTHER_TRAIL_FALL = 1;
|
||||
bool isMotherShot = spawnerType == ENTITY_MOTHER && spawnerVariant == 0 && subtype == 1;
|
||||
if (isBeastFire || isMotherShot)
|
||||
reconstruction_missing("Entity_Projectile::Update 00653070: a late boss's shot trail");
|
||||
if (!isMotherShot || !GetIntervalTicks(4, 0)) return;
|
||||
uint32_t seed = Random();
|
||||
auto* drop = static_cast<Entity_Projectile*>(g_game->Spawn({.position = pos,
|
||||
.velocity = vector_scale(velocity, MOTHER_TRAIL_SPEED),
|
||||
.type = ENTITY_PROJECTILE,
|
||||
.seed = seed}));
|
||||
drop->spawnerEntity = spawnerEntity.get();
|
||||
drop->spawnerType = spawnerType;
|
||||
drop->spawnerVariant = spawnerVariant;
|
||||
drop->SetColor(color, -1, COLOR_PRIORITY_DEFAULT, false, true);
|
||||
drop->fallingSpeed = MOTHER_TRAIL_RISE;
|
||||
drop->fallingAccel = MOTHER_TRAIL_FALL;
|
||||
drop->Update();
|
||||
}
|
||||
|
||||
// Its splash: a poof by its variant or an explosion, the creep and splits its flags leave, then it is removed.
|
||||
@@ -1176,15 +1434,57 @@ void Entity_Projectile::death_flags_apply()
|
||||
if (isPin) npc_sound_play(SOUND_PIN_GOO, 1, 2, 1);
|
||||
}
|
||||
|
||||
// Rotgut's heart's fire bursting into two shots, 30 degrees either side of up, that start bouncing after 6 frames.
|
||||
static void rotgut_burst_spawn(Entity_Projectile& shot)
|
||||
{
|
||||
for (int side = -1; side <= 1; side += 2)
|
||||
{
|
||||
uint32_t seed = Random();
|
||||
float speed = lerp(ROTGUT_SHOT_SPEED_MIN, ROTGUT_SHOT_SPEED_MAX, random_unit());
|
||||
Vector velocity = vector_rotated(vector_make(0, speed), (float)side * ROTGUT_BURST_TURN);
|
||||
Entity_Projectile* child = child_spawn(shot, {.position = vector_add(shot.pos, vector_make(0, ROTGUT_BURST_RISE)),
|
||||
.velocity = velocity,
|
||||
.spawner = shot.spawnerEntity,
|
||||
.type = ENTITY_PROJECTILE,
|
||||
.seed = seed});
|
||||
child->projectileFlags = PROJECTILE_NO_WALL_COLLIDE | PROJECTILE_CHANGE_FLAGS_AFTER_TIMEOUT;
|
||||
child->changeFlags = 0;
|
||||
child->changeTimeout = ROTGUT_BURST_TIMEOUT;
|
||||
child->fallingAccel = ROTGUT_BURST_FALL;
|
||||
child->SetColor(SHOT_COLOR_FIERY, COLOR_PRIORITY_NONE, COLOR_PRIORITY, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
// Rotgut's heart's spit splitting into a fan of 13 shots up across 150 degrees that bounce after 45 frames, keeping
|
||||
// its other flags.
|
||||
static void rotgut_split_spawn(Entity_Projectile& shot)
|
||||
{
|
||||
uint64_t kept = shot.projectileFlags & ~PROJECTILE_BURSTSPLIT;
|
||||
for (int i = 0; i < ROTGUT_SPLIT_SHOTS; i++)
|
||||
{
|
||||
float speed = lerp(ROTGUT_SHOT_SPEED_MIN, ROTGUT_SHOT_SPEED_MAX, random_unit());
|
||||
float angle = lerp_range((float)i, {.inMax = ROTGUT_SPLIT_SHOTS - 1, .outMin = -ROTGUT_SPLIT_TURN, .outMax = ROTGUT_SPLIT_TURN});
|
||||
Entity_Projectile* child = child_spawn(shot, {.position = shot.pos,
|
||||
.velocity = vector_rotated(vector_make(0, speed), angle),
|
||||
.spawner = shot.spawnerEntity,
|
||||
.type = ENTITY_PROJECTILE,
|
||||
.seed = Random()});
|
||||
child->projectileFlags = kept | PROJECTILE_CHANGE_FLAGS_AFTER_TIMEOUT | PROJECTILE_BOUNCE;
|
||||
child->changeFlags = kept;
|
||||
child->changeTimeout = ROTGUT_SPLIT_TIMEOUT;
|
||||
child->fallingAccel = ROTGUT_SPLIT_FALL;
|
||||
child->scale = random_unit() * ROTGUT_SPLIT_SCALE_RANGE + ROTGUT_SPLIT_SCALE;
|
||||
}
|
||||
}
|
||||
|
||||
// The shots a dead shot splits into: four for BURST (a cross from Pin's), eight or six for BURST8, two back for
|
||||
// BACK_SPLIT and a fan of sixteen for BURSTSPLIT.
|
||||
void Entity_Projectile::death_bursts_spawn()
|
||||
{
|
||||
if (projectileFlags & PROJECTILE_BURST)
|
||||
bool isRotgutHeart = spawnerType == ENTITY_ROTGUT && spawnerVariant == ROTGUT_HEART;
|
||||
if ((projectileFlags & PROJECTILE_BURST) && isRotgutHeart) rotgut_burst_spawn(*this);
|
||||
else if (projectileFlags & PROJECTILE_BURST)
|
||||
{
|
||||
if (spawnerType == ENTITY_ROTGUT && spawnerVariant == ROTGUT_HEART)
|
||||
reconstruction_missing("Entity_Projectile::Update 00653070: Rotgut's bursting shot");
|
||||
|
||||
bool isPin = spawnerType == ENTITY_PIN;
|
||||
float speed = vector_length(velocity);
|
||||
Vector shot = isPin ? vector_make(speed, 0) : vector_scale(random_direction(), speed);
|
||||
@@ -1280,12 +1580,11 @@ void Entity_Projectile::death_bursts_spawn()
|
||||
}
|
||||
|
||||
if (!(projectileFlags & PROJECTILE_BURSTSPLIT)) return;
|
||||
if (spawnerType == ENTITY_ROTGUT && spawnerVariant == ROTGUT_HEART)
|
||||
reconstruction_missing("Entity_Projectile::Update 00653070: Rotgut's split shot");
|
||||
|
||||
sound_play(SOUND_BLOOD_SPLASH, 1, 1);
|
||||
Entity_Effect* splash = effect_spawn(EFFECT_BLOOD_EXPLOSION, pos, nullptr, BLOOD_EXPLOSION_SPLASH);
|
||||
if (splash) splash->SetColor(BURSTSPLIT_SPLASH_COLOR, COLOR_PRIORITY_NONE, COLOR_PRIORITY, false, true);
|
||||
if (isRotgutHeart) return rotgut_split_spawn(*this);
|
||||
for (int i = 0; i < BURSTSPLIT_COUNT; i++)
|
||||
{
|
||||
float speed = lerp(BURSTSPLIT_SPEED_MIN, BURSTSPLIT_SPEED_MAX, random_unit());
|
||||
@@ -1298,7 +1597,7 @@ void Entity_Projectile::death_bursts_spawn()
|
||||
.seed = Random()});
|
||||
if (!child) continue;
|
||||
|
||||
child->SetColor(BURSTSPLIT_COLOR, COLOR_PRIORITY_NONE, COLOR_PRIORITY, false, true);
|
||||
child->SetColor(SHOT_COLOR_SICK_PALE, COLOR_PRIORITY_NONE, COLOR_PRIORITY, false, true);
|
||||
child->projectileFlags = projectileFlags & ~(PROJECTILE_BURSTSPLIT | PROJECTILE_EXPLODE);
|
||||
child->fallingAccel = BURSTSPLIT_ACCEL;
|
||||
child->scale = random_unit() * BURST_SCALE_SHARE + BURSTSPLIT_SCALE_MIN;
|
||||
|
||||
Reference in new issue
Block a user