Curation round 28 (code only): float pow, log and exp widened to double like the game, inlined HasTrinket preview handling, explicit RNG argument order, update_effects rebuilt in the original's order, weapon vtable slots, null-frame reads, and a parity audit finishing every boss, every enemy, the level and most rooms, grid entities and weapons; misnamed pill and null-item ids corrected (55 duplicates)
This commit is contained in:
1 parent
e66baf4063
commit
719e5ef04d
157 files changed
+1399
-717
No files matched your search
@@ -6273,7 +6273,6 @@ uint32_t * FUN_007df0b0(uint32_t *param_1); // 007df0b0
|
||||
void FUN_007df130(); // 007df130
|
||||
void FUN_007df140(uint32_t *param_1); // 007df140
|
||||
void FUN_007df1d0(); // 007df1d0
|
||||
void FUN_007df1e0(); // 007df1e0
|
||||
void FUN_007e2630(); // 007e2630
|
||||
void FUN_007e2740(); // 007e2740
|
||||
void FUN_007e27a0(char *param_1, char *param_2); // 007e27a0
|
||||
|
||||
@@ -10368,7 +10368,6 @@ uint32_t * FUN_007df0b0(uint32_t *param_1) { generated_stub("FUN_007df0b0 007df0
|
||||
void FUN_007df130() { generated_stub("FUN_007df130 007df130"); }
|
||||
void FUN_007df140(uint32_t *param_1) { generated_stub("FUN_007df140 007df140"); }
|
||||
void FUN_007df1d0() { generated_stub("FUN_007df1d0 007df1d0"); }
|
||||
void FUN_007df1e0() { generated_stub("FUN_007df1e0 007df1e0"); }
|
||||
void FUN_007e2630() { generated_stub("FUN_007e2630 007e2630"); }
|
||||
void FUN_007e2740() { generated_stub("FUN_007e2740 007e2740"); }
|
||||
void FUN_007e27a0(char *param_1, char *param_2) { generated_stub("FUN_007e27a0 007e27a0"); }
|
||||
|
||||
+18
@@ -218,6 +218,24 @@ inline float timescale_factor(float factor, float timeScale)
|
||||
return timeScale == 1 ? factor : factor / ((factor + timeScale) - factor * timeScale);
|
||||
}
|
||||
|
||||
// pow 004e4690 (and pow_wrapper 00505b40): a float power taken in double precision and narrowed back.
|
||||
inline float pow_float(float base, float exponent)
|
||||
{
|
||||
return (float)std::pow((double)base, (double)exponent);
|
||||
}
|
||||
|
||||
// log_precise 006dac30: a float natural log taken in double precision and narrowed back.
|
||||
inline float log_float(float value)
|
||||
{
|
||||
return (float)std::log((double)value);
|
||||
}
|
||||
|
||||
// 007df1e0 A float exponential taken in double precision and narrowed back.
|
||||
inline float exp_float(float value)
|
||||
{
|
||||
return (float)std::exp((double)value);
|
||||
}
|
||||
|
||||
// A value's place in one range carried onto another (assert_lerp_range's arguments), held inside it when clamped.
|
||||
struct LerpRange
|
||||
{
|
||||
|
||||
+3
-3
@@ -9,14 +9,14 @@
|
||||
|
||||
constexpr float BOSS_BLOOD_DEPTH = 10;
|
||||
|
||||
// EntityList::QuerySublist uncached: the updated entities of a type (and variant unless -1) a query may see.
|
||||
inline std::vector<Entity*> entity_query(int type, int variant)
|
||||
// EntityList::QuerySublist uncached: the updated entities of a type (and variant and subtype unless -1) a query may see.
|
||||
inline std::vector<Entity*> entity_query(int type, int variant, int subType = -1)
|
||||
{
|
||||
std::vector<Entity*> found;
|
||||
|
||||
for (Entity* entity : g_game->room->entityList.updateEL)
|
||||
if (entity->type == type && (variant < 0 || entity->variant == variant) &&
|
||||
!entity->HasEntityFlags(FLAG_NO_QUERY))
|
||||
(subType < 0 || entity->subtype == subType) && !entity->HasEntityFlags(FLAG_NO_QUERY))
|
||||
found.push_back(entity);
|
||||
return found;
|
||||
}
|
||||
|
||||
@@ -1120,13 +1120,16 @@ void boss_big_horn_update(Entity_NPC& npc)
|
||||
big_hole_update(npc, isBusy);
|
||||
if (!npc.parent) return;
|
||||
}
|
||||
else if (npc.state == NPC_STATE_INIT)
|
||||
else if (npc.variant == 0)
|
||||
{
|
||||
npc.sprite.Play("Appear");
|
||||
npc.state = HORN_REST;
|
||||
return;
|
||||
if (npc.state == NPC_STATE_INIT)
|
||||
{
|
||||
npc.sprite.Play("Appear");
|
||||
npc.state = HORN_REST;
|
||||
return;
|
||||
}
|
||||
big_horn_head_update(npc, ticks, isBusy);
|
||||
}
|
||||
else big_horn_head_update(npc, ticks, isBusy);
|
||||
|
||||
if (npc.variant != BIG_HORN_HAND || npc.state != HAND_SLAP || npc.stateFrame < 1) npc.friction = 0;
|
||||
}
|
||||
@@ -412,8 +412,8 @@ static void brownie_volley(Entity_NPC& npc, BrownieFrame& frame)
|
||||
{
|
||||
Vector aim = vector_normalized(vector_sub(npc.GetPlayerTarget()->pos, npc.pos));
|
||||
Vector scatter = random_direction();
|
||||
float reach = random_unit() * BROWNIE_VOLLEY_SCATTER;
|
||||
aim = vector_add(aim, vector_scale(scatter, reach));
|
||||
float reach = random_unit();
|
||||
aim = vector_add(vector_scale(vector_scale(scatter, reach), BROWNIE_VOLLEY_SCATTER), aim);
|
||||
npc.FireProjectiles(npc.pos, vector_scale(aim, BROWNIE_VOLLEY_SPEED), PROJECTILES_SINGLE, brownie_shot_params(npc));
|
||||
npc.v2.x *= BROWNIE_VOLLEY_SLOWDOWN;
|
||||
}
|
||||
@@ -461,8 +461,8 @@ static void brownie_steer(Entity_NPC& npc, BrownieFrame& frame)
|
||||
if (npc.state == BROWNIE_FAST_CHASE) npc.v2.x *= 0.5f;
|
||||
}
|
||||
float speed = npc.v2.x;
|
||||
Vector pulled = vector_add(npc.velocity, vector_scale(vector_normalized(toward), speed * BROWNIE_STEER));
|
||||
pulled = vector_add(pulled, vector_scale(vector_normalized(npc.velocity), speed * BROWNIE_STEER));
|
||||
Vector pulled = vector_add(vector_scale(vector_scale(vector_normalized(toward), speed), BROWNIE_STEER), npc.velocity);
|
||||
pulled = vector_add(vector_scale(vector_scale(vector_normalized(npc.velocity), speed), BROWNIE_STEER), pulled);
|
||||
Vector wanted = vector_resized(pulled, speed);
|
||||
float keep = timescale_factor(BROWNIE_STEER_KEEP, npc.speedMultiplier);
|
||||
npc.velocity = vector_add(vector_scale(vector_sub(wanted, npc.velocity), 1 - keep), npc.velocity);
|
||||
@@ -474,8 +474,8 @@ static void brownie_steer(Entity_NPC& npc, BrownieFrame& frame)
|
||||
{
|
||||
uint32_t seed = Random();
|
||||
Vector around = random_direction();
|
||||
float reach = random_unit() * npc.size;
|
||||
Vector spot = vector_add(npc.pos, vector_scale(around, reach));
|
||||
float reach = random_unit();
|
||||
Vector spot = vector_add(vector_scale(vector_scale(around, reach), npc.size), npc.pos);
|
||||
auto* mine = static_cast<Entity_NPC*>(
|
||||
g_game->Spawn({.position = spot, .spawner = &npc, .type = ENTITY_CORN_MINE, .seed = seed}));
|
||||
mine->SetBossColorIdx(npc.bosscoloridx, 0);
|
||||
|
||||
+12
-4
@@ -174,13 +174,21 @@ constexpr float CELL_HALF_STEP = 0.5f;
|
||||
// Its leaving: an item from its list where items spawn, in a poof.
|
||||
constexpr float BUMBINO_LEAVE_FRICTION = 0.5f;
|
||||
|
||||
// How a trail cloud's drift adds to its share of Bumbino's speed: the swipe adds it twice in turn, the ram doubled.
|
||||
enum TrailSum
|
||||
{
|
||||
TRAIL_SWIPE,
|
||||
TRAIL_RAM
|
||||
};
|
||||
|
||||
// A cloud of its trail behind it, every 2 frames.
|
||||
static void bumbino_trail_spawn(Entity_NPC& npc)
|
||||
static void bumbino_trail_spawn(Entity_NPC& npc, TrailSum sum)
|
||||
{
|
||||
if (!npc.GetIntervalTicks(DUST_EVERY, 0)) return;
|
||||
uint32_t seed = Random();
|
||||
Vector drift = random_direction();
|
||||
Vector velocity = vector_add(vector_scale(npc.velocity, DUST_TRAIL_SHARE), vector_add(drift, drift));
|
||||
Vector trail = vector_scale(npc.velocity, DUST_TRAIL_SHARE);
|
||||
Vector velocity = sum == TRAIL_SWIPE ? vector_add(vector_add(trail, drift), drift) : vector_add(vector_add(drift, drift), trail);
|
||||
auto* cloud = static_cast<Entity_Effect*>(g_game->Spawn(
|
||||
{.position = npc.pos, .velocity = velocity, .spawner = &npc, .type = ENTITY_EFFECT, .variant = EFFECT_DUST_CLOUD, .seed = seed}));
|
||||
cloud->rotation = random_between(DUST_SPIN_MIN, DUST_SPIN_RANGE);
|
||||
@@ -419,7 +427,7 @@ static bool bumbino_swipe_update(Entity_NPC& npc, bool& isWallImpact)
|
||||
bool isLunging = false;
|
||||
if (!vector_is_zero(npc.v1))
|
||||
{
|
||||
bumbino_trail_spawn(npc);
|
||||
bumbino_trail_spawn(npc, TRAIL_SWIPE);
|
||||
npc.AddVelocity_divided(npc.v1, false);
|
||||
npc.v1 = vector_scale(npc.v1, timescale_factor(SWIPE_DRAG, npc.speedMultiplier));
|
||||
if (std::abs(npc.v1.x) < SWIPE_STILL) npc.v1 = {};
|
||||
@@ -520,7 +528,7 @@ static bool bumbino_ram_update(Entity_NPC& npc, bool& isWallImpact)
|
||||
return false;
|
||||
}
|
||||
if (npc.stateFrame != 1) return false;
|
||||
bumbino_trail_spawn(npc);
|
||||
bumbino_trail_spawn(npc, TRAIL_RAM);
|
||||
npc.AddVelocity_divided(npc.v1, false);
|
||||
isWallImpact = npc.isCollidesWithGrid;
|
||||
return true;
|
||||
|
||||
+13
-5
@@ -115,7 +115,10 @@ constexpr float CAGE_LASER_QUARTER = 90;
|
||||
constexpr float CAGE_LASER_DEPTH_UP = -10;
|
||||
constexpr float CAGE_LASER_DEPTH = 3000;
|
||||
|
||||
// The green Cage's creep every 30 frames: drawn 2.5 times as big, at 0.75 of its effect scale.
|
||||
constexpr int CAGE_CREEP_FRAMES = 30;
|
||||
constexpr float CAGE_GREEN_CREEP_SIZE = 2.5f;
|
||||
constexpr float CAGE_GREEN_CREEP_SCALE = 0.75f;
|
||||
|
||||
// Starts an animation with its cry, unless it already shows.
|
||||
static void cage_anim_start(Entity_NPC& npc, std::string_view anim, int sound)
|
||||
@@ -452,11 +455,16 @@ void boss_cage_update(Entity_NPC& npc)
|
||||
bool isCreepFrame = (g_game->frameCount + npc.index) % CAGE_CREEP_FRAMES == 0;
|
||||
if (npc.subtype == CAGE_GREEN && !npc.HasEntityFlags(FLAG_INTERPOLATION_UPDATE) && !g_game->IsPaused() &&
|
||||
isCreepFrame)
|
||||
g_game->Spawn({.position = npc.pos,
|
||||
.spawner = &npc,
|
||||
.type = ENTITY_EFFECT,
|
||||
.variant = EFFECT_CREEP_GREEN,
|
||||
.seed = Random()});
|
||||
{
|
||||
auto* creep = static_cast<Entity_Effect*>(g_game->Spawn({.position = npc.pos,
|
||||
.spawner = &npc,
|
||||
.type = ENTITY_EFFECT,
|
||||
.variant = EFFECT_CREEP_GREEN,
|
||||
.seed = Random()}));
|
||||
creep->sprite.scale = vector_make(CAGE_GREEN_CREEP_SIZE, CAGE_GREEN_CREEP_SIZE);
|
||||
creep->scale = CAGE_GREEN_CREEP_SCALE;
|
||||
creep->Update();
|
||||
}
|
||||
if (npc.isDead) npc_sound_play(SOUND_CAGE_DEATH, 1, 2, 1);
|
||||
npc.friction *= CAGE_FRICTION;
|
||||
}
|
||||
+17
-9
@@ -590,8 +590,12 @@ static void chimera_spit_fly_update(Entity_NPC& npc)
|
||||
if (npc.sprite.IsEventTriggered("Shoot"))
|
||||
{
|
||||
npc.PlaySound(SOUND_LITTLE_SPIT, 1, 2, false, 1);
|
||||
auto* fly = static_cast<Entity_NPC*>(
|
||||
g_game->Spawn({.position = npc.pos, .spawner = &npc, .type = ENTITY_BOOMFLY, .variant = DRAGON_FLY, .seed = Random()}));
|
||||
auto* fly = static_cast<Entity_NPC*>(g_game->Spawn({.position = npc.pos,
|
||||
.velocity = holdOffset,
|
||||
.spawner = &npc,
|
||||
.type = ENTITY_BOOMFLY,
|
||||
.variant = DRAGON_FLY,
|
||||
.seed = Random()}));
|
||||
fly->ClearEntityFlags(FLAG_APPEAR);
|
||||
fly->sprite.scale = vector_make(FLY_SCALE, FLY_SCALE);
|
||||
fly->entityCollisionClass = ENTCOLL_NONE;
|
||||
@@ -600,7 +604,7 @@ static void chimera_spit_fly_update(Entity_NPC& npc)
|
||||
fly->posOffset = vector_make(0, FLY_RAISE);
|
||||
fly->targetPosition = vector_add(npc.pos, holdOffset);
|
||||
npc.child = fly;
|
||||
Entity* splat = blood_explosion_spawn(SPLAT_SUBTYPE, npc.pos, {}, CHIMERA_GREEN_COLOR, {});
|
||||
Entity* splat = blood_explosion_spawn(SPLAT_SUBTYPE, npc.pos, vector_make(0, HEAD_SPLAT_RAISE), CHIMERA_GREEN_COLOR, {});
|
||||
static_cast<Entity_Effect*>(splat)->FollowParent(&npc);
|
||||
}
|
||||
if (Entity* fly = npc.child.get()) fly->targetPosition = vector_add(npc.pos, holdOffset);
|
||||
@@ -629,14 +633,15 @@ static void chimera_spray_fire(Entity_NPC& npc, float progress)
|
||||
float lead = vector_distance(npc.pos, target->pos) * (progress * CHIMERA_SPRAY_LEAD + 0);
|
||||
Vector aim = vector_sub(vector_add(target->pos, vector_scale(target->velocity, lead)), npc.pos);
|
||||
Vector landing = vector_add(vector_rotated(aim, progress * SPRAY_SWEEP - SPRAY_SWEEP_HALF), npc.pos);
|
||||
Vector velocity = vector_scale(vector_sub(landing, npc.pos), 1 / (progress * CHIMERA_SPRAY_FRAMES + SPRAY_MIN_FRAMES));
|
||||
float frames = progress * CHIMERA_SPRAY_FRAMES + SPRAY_MIN_FRAMES;
|
||||
Vector velocity = vector_div(vector_sub(landing, npc.pos), vector_make(frames, frames));
|
||||
float speed = vector_length(velocity);
|
||||
if (speed > SPRAY_MAX_SPEED && speed > 0) velocity = vector_scale(velocity, SPRAY_MAX_SPEED / speed);
|
||||
|
||||
auto* shot = static_cast<Entity_Projectile*>(g_game->Spawn(
|
||||
{.position = npc.pos, .velocity = velocity, .spawner = &npc, .type = ENTITY_PROJECTILE, .seed = Random()}));
|
||||
float flight = vector_distance(npc.pos, landing) / vector_length(velocity);
|
||||
float decay = (float)std::pow((double)SPRAY_DRAG, (double)flight);
|
||||
float decay = pow_float(SPRAY_DRAG, flight);
|
||||
float drag = std::max((decay - 1) * SPRAY_DRAG_SUM, SPRAY_DRAG_MIN);
|
||||
shot->fallingAccel = SPRAY_ACCEL;
|
||||
shot->scale = CHIMERA_SPRAY_SCALE;
|
||||
@@ -797,7 +802,7 @@ static void chimera_head_catch(Entity_NPC& npc)
|
||||
|
||||
auto* headNpc = static_cast<Entity_NPC*>(head);
|
||||
bool isCaught = npc.variant == CHIMERA_BODY && collider->type == ENTITY_CHIMERA && collider->variant == CHIMERA_HEAD &&
|
||||
head && chimera_body_is_waiting(npc) && headNpc->state == CHIMERA_HEAD_CHARGE && head_flag(*headNpc, HEAD_TO_BODY);
|
||||
collider == head && head && chimera_body_is_waiting(npc) && headNpc->state == CHIMERA_HEAD_CHARGE && head_flag(*headNpc, HEAD_TO_BODY);
|
||||
if (isCaught)
|
||||
{
|
||||
npc.state = CHIMERA_THROW;
|
||||
@@ -922,8 +927,9 @@ static void chimera_head_rest_update(Entity_NPC& npc)
|
||||
return;
|
||||
}
|
||||
|
||||
Vector landing = npc.CalcTargetPosition(0);
|
||||
if (!npc.HasEntityFlags(HEAD_PATH_BLOCK_FLAGS) && !room_check_line(npc.pos, target, LINE_MODE_GROUND, 0))
|
||||
Vector landing;
|
||||
if (npc.HasEntityFlags(HEAD_PATH_BLOCK_FLAGS) || room_check_line(npc.pos, target, LINE_MODE_GROUND, 0)) landing = npc.CalcTargetPosition(0);
|
||||
else
|
||||
{
|
||||
Vector position = npc.pos;
|
||||
Vector velocity = npc.velocity;
|
||||
@@ -1065,8 +1071,10 @@ static void chimera_head_motion_update(Entity_NPC& npc)
|
||||
if (vector_length(npc.targetPosition) < HEAD_STOPPED) npc.targetPosition = {};
|
||||
if (head_flag(npc, HEAD_THROWN) && (Random() & HEAD_TRAIL_MASK) == 0)
|
||||
{
|
||||
ProjectileParams params;
|
||||
Vector behind = vector_sub(npc.pos, vector_scale(npc.velocity, HEAD_TRAIL_BACK));
|
||||
npc.FireBossProjectiles((int)(Random() & 1) + 1, behind, 0, ProjectileParams());
|
||||
int count = (int)(Random() & 1) + 1;
|
||||
npc.FireBossProjectiles(count, behind, 0, params);
|
||||
}
|
||||
if (Random() % HEAD_CREEP_ODDS != 0) return;
|
||||
Entity* creep = g_game->Spawn(
|
||||
|
||||
+4
-2
@@ -99,7 +99,9 @@ static void clog_spit(Entity_NPC& npc)
|
||||
uint32_t seed = Random();
|
||||
auto* drip = static_cast<Entity_NPC*>(g_game->Spawn(
|
||||
{.position = vector_add(npc.pos, vector_scale(heading, CLOG_SPIT_REACH)), .spawner = &npc, .type = ENTITY_DRIP, .seed = seed}));
|
||||
npc_push(*drip, vector_scale(heading, random_unit() * CLOG_SPIT_SPEED_RANGE + CLOG_SPIT_SPEED));
|
||||
float speed = random_unit() * CLOG_SPIT_SPEED_RANGE + CLOG_SPIT_SPEED;
|
||||
if (drip->friction != 0)
|
||||
drip->velocity = vector_add(vector_div(vector_scale(heading, drip->speedMultiplier * speed), vector_make(drip->friction, drip->friction)), drip->velocity);
|
||||
drip->ClearEntityFlags(FLAG_APPEAR);
|
||||
drip->state = DRIP_FLUNG;
|
||||
drip->Update();
|
||||
@@ -153,7 +155,7 @@ static void clog_spin_update(Entity_NPC& npc)
|
||||
npc.sprite.Play(npc.i1 == 0 ? "SpinLoop" : "SpinLoop2");
|
||||
npc.stateFrame++;
|
||||
if (npc.stateFrame == SPIN_WATER_SOUND_FRAME)
|
||||
g_manager->sfxManager.Play(SOUND_BOSS2_WATERTHRASHING, {.frameDelay = SPIN_WATER_DELAY});
|
||||
npc_sound_play(SOUND_BOSS2_WATERTHRASHING, 1, SPIN_WATER_DELAY, 1);
|
||||
|
||||
Vector fromCenter = vector_sub(npc.pos, Room::GetCenterPos());
|
||||
if (vector_length(fromCenter) > SPIN_CENTER_SLACK)
|
||||
|
||||
+11
-6
@@ -387,9 +387,12 @@ static void clutch_stunned_update(Entity_NPC& npc)
|
||||
if (npc.stateFrame == 0)
|
||||
{
|
||||
npc.stateFrame = 1;
|
||||
for (Entity_NPC* clack : clutch_clacks_get(npc))
|
||||
for (Entity* other : Entity_NPC::QueryNPCsType(ENTITY_CLICKETY_CLACK, -1))
|
||||
{
|
||||
if (clack->state != CLACK_PILE || clack->i2 != CLACK_FLAME) continue;
|
||||
auto* clack = static_cast<Entity_NPC*>(other);
|
||||
if (!Entity::is_enemy_type(clack->type) || clack->parent.get() != &npc || clack->state != CLACK_PILE ||
|
||||
clack->i2 != CLACK_FLAME)
|
||||
continue;
|
||||
clack->i2 = 0;
|
||||
clack->sprite.Play("Collapse");
|
||||
if (clack->sprite.animState.animData) clack->sprite.animState.AdvancePosition(clack->sprite.animState.animData->length - 1);
|
||||
@@ -592,7 +595,7 @@ static void clutch_trail_update(Entity_NPC& npc)
|
||||
Vector side = vector_rotated(npc.velocity, RIGHT_ANGLE_DEGREES);
|
||||
float swing = std::sin(npc.updateTime * PI_F * TRAIL_SWING_RATE);
|
||||
anchor = vector_add(anchor, vector_scale(side, swing));
|
||||
drift = vector_scale(side, TRAIL_SWING_SHARE * swing);
|
||||
drift = vector_scale(vector_scale(side, TRAIL_SWING_SHARE), swing);
|
||||
}
|
||||
const NullFrame* null = npc.sprite.animState.animData ? npc.sprite.animState.GetNullFrame("Trail") : nullptr;
|
||||
|
||||
@@ -606,15 +609,17 @@ static void clutch_trail_update(Entity_NPC& npc)
|
||||
position = vector_add(position, vector_scale(velocity, step));
|
||||
velocity = vector_scale(velocity, timescale_factor(size.x * TRAIL_SIZE_DRAG + TRAIL_DRAG, step));
|
||||
Vector shake = random_direction();
|
||||
float strength = size.x * random_unit() * TRAIL_SHAKE * step;
|
||||
velocity = vector_add(velocity, vector_scale(shake, strength));
|
||||
float strength = random_unit();
|
||||
velocity.x += size.x * shake.x * strength * TRAIL_SHAKE * step;
|
||||
velocity.y += size.x * shake.y * strength * TRAIL_SHAKE * step;
|
||||
size.x = std::max(size.x - step * CLUTCH_TRAIL_SHRINK, 0.0f);
|
||||
|
||||
float distance = vector_distance(anchor, position);
|
||||
if (distance > TRAIL_REACH)
|
||||
{
|
||||
float kept = timescale_factor(TRAIL_PULL, step) * (distance - TRAIL_REACH) + TRAIL_REACH;
|
||||
position = vector_add(anchor, vector_scale(vector_sub(position, anchor), kept / distance));
|
||||
position = vector_add(anchor, vector_div(vector_scale(vector_sub(position, anchor), kept),
|
||||
vector_make(distance, distance)));
|
||||
}
|
||||
if (size.x > 0 || isInterpolated) i += TRAIL_POINT;
|
||||
else trail.erase(trail.begin() + (long)i, trail.begin() + (long)(i + TRAIL_POINT));
|
||||
|
||||
@@ -180,7 +180,7 @@ static Vector colostomia_pick_target(Entity_NPC& npc, bool& isPlayer)
|
||||
{
|
||||
Room& room = *g_game->room;
|
||||
std::array<int, ROOM_GRID_CELLS> clouds{};
|
||||
for (Entity* cloud : entity_query(ENTITY_EFFECT, EFFECT_SMOKE_CLOUD))
|
||||
for (Entity* cloud : entity_query(ENTITY_EFFECT, EFFECT_SMOKE_CLOUD, COLO_CLOUD_SUBTYPE))
|
||||
for (Vector cover : COLO_CLOUD_COVER)
|
||||
{
|
||||
int index = room.GetGridIndex(vector_add(cloud->pos, cover));
|
||||
@@ -397,7 +397,7 @@ static void colostomia_dive_update(Entity_NPC& npc)
|
||||
{
|
||||
npc.friction *= COLO_LEAP_FRICTION;
|
||||
npc.v2.x = std::clamp(npc.speedMultiplier * COLO_LEAP_PULL + npc.v2.x, 0.0f, 1.0f);
|
||||
npc.velocity = vector_scale(vector_sub(npc.v1, npc.pos), npc.v2.x / npc.friction);
|
||||
npc.velocity = vector_div(vector_scale(vector_sub(npc.v1, npc.pos), npc.v2.x), vector_make(npc.friction, npc.friction));
|
||||
}
|
||||
if (npc.sprite.IsEventTriggered("Land"))
|
||||
{
|
||||
@@ -433,7 +433,7 @@ static void colostomia_charge_splash(Entity_NPC& npc)
|
||||
angle += angle;
|
||||
Vector reach = vector_make(std::cos(angle) * COLO_DROP_REACH_X, std::sin(angle) * COLO_DROP_REACH_Y);
|
||||
float speed = random_unit() * COLO_DROP_SPEED_RANGE + COLO_DROP_SPEED;
|
||||
Vector velocity = vector_scale(reach, speed / COLO_DROP_REACH_X);
|
||||
Vector velocity = vector_div(vector_scale(reach, speed), vector_make(COLO_DROP_REACH_X, COLO_DROP_REACH_X));
|
||||
auto* drop = static_cast<Entity_Effect*>(g_game->Spawn({.position = vector_add(reach, npc.pos),
|
||||
.velocity = velocity,
|
||||
.subType = COLO_DROP_SUBTYPE,
|
||||
@@ -515,7 +515,7 @@ static void colostomia_charge_update(Entity_NPC& npc, float& frictionScale)
|
||||
if (npc.sprite.IsPlaying()) return;
|
||||
npc.state = COLO_IDLE;
|
||||
uint32_t odds = Random();
|
||||
size_t clouds = entity_query(ENTITY_EFFECT, EFFECT_SMOKE_CLOUD).size();
|
||||
size_t clouds = entity_query(ENTITY_EFFECT, EFFECT_SMOKE_CLOUD, COLO_CLOUD_SUBTYPE).size();
|
||||
npc.projectileCooldown = 1;
|
||||
if (odds % COLO_SPIT_ODDS + COLO_SPIT_CLOUDS <= clouds) npc.i2 = 1;
|
||||
return;
|
||||
|
||||
+2
-3
@@ -49,7 +49,6 @@ constexpr int EFFECT_POOF04 = 17;
|
||||
constexpr int EFFECT_BLOOD_GUSH = 42;
|
||||
|
||||
constexpr int COLLECTIBLE_FOREVER_ALONE = 128;
|
||||
constexpr int NULL_ITEM_SOL = 56;
|
||||
constexpr int GIANTBOOK_SOL = 5;
|
||||
constexpr int BOMB_TROLL_SUBTYPE = 3;
|
||||
constexpr std::array<int, 5> HORNFEL_ITEMS = {256, 220, 19, 137, 646};
|
||||
@@ -367,7 +366,7 @@ static void sol_trigger(Room& room, uint32_t seed)
|
||||
Entity_Player* player = game.GetPlayer((int)i);
|
||||
player->SetFullHearts();
|
||||
player->FullCharge(-1, false, false);
|
||||
ItemConfig_Item* sol = g_manager->itemConfig.GetNullItem(NULL_ITEM_SOL);
|
||||
ItemConfig_Item* sol = g_manager->itemConfig.GetNullItem(NULLITEM_SOL);
|
||||
if (player->HasCollectible(COLLECTIBLE_SOL) && sol)
|
||||
player->temporaryEffects.AddEffect(TemporaryEffect(sol), true, 1);
|
||||
}
|
||||
@@ -697,7 +696,7 @@ void Entity_NPC::update_blood_guide_gibs(const NullFrame& guide)
|
||||
if (GetIntervalTicks(GUIDE_SHAKE_INTERVAL, 0)) game_shake_screen(GUIDE_SHAKE_FRAMES);
|
||||
if (GetIntervalTicks(GUIDE_GIB_INTERVAL, 0))
|
||||
{
|
||||
Vector offset = vector_scale(guideSpot(GUIDE_REACH), 1 / GUIDE_PERSPECTIVE);
|
||||
Vector offset = vector_div(guideSpot(GUIDE_REACH), vector_make(GUIDE_PERSPECTIVE, GUIDE_PERSPECTIVE));
|
||||
gibs_spawn({.color = splatColor,
|
||||
.position = vector_add(pos, offset),
|
||||
.spawner = this,
|
||||
|
||||
+5
-7
@@ -47,7 +47,8 @@ constexpr float SLIDE_CREEP_SCALE = 0.75f;
|
||||
constexpr float SLIDE_CREEP_SCALE_SPREAD = 0.25f;
|
||||
|
||||
constexpr float WALL_SPLAT_REACH = 200;
|
||||
constexpr float WALL_SPLAT_MARGIN = -24;
|
||||
constexpr float WALL_SPLAT_SPREAD = 40;
|
||||
constexpr float WALL_SPLAT_INWARD = -0.6f;
|
||||
constexpr float WALL_SPLAT_SIZE = 1;
|
||||
constexpr float WALL_SPLAT_SIZE_SPREAD = 2;
|
||||
constexpr float WALL_SPLAT_TURN = 90;
|
||||
@@ -151,7 +152,7 @@ static void slide_wall_hit(Entity_NPC& npc)
|
||||
npc.targetPosition = room.GetRandomPosition(0);
|
||||
npc.PlaySound(SOUND_MEAT_JUMPS, 1, 2, false, 1);
|
||||
|
||||
float margin = random_unit() * WALL_SPLAT_MARGIN;
|
||||
float margin = random_unit() * WALL_SPLAT_SPREAD * WALL_SPLAT_INWARD;
|
||||
Vector behind = vector_add(npc.pos, vector_scale(npc.gridCollisionNormal, WALL_SPLAT_REACH));
|
||||
Vector spot = room.GetClampedPositionImpl(behind, margin, margin, margin, margin);
|
||||
GridEntity* wall = room_grid_entity_at(spot);
|
||||
@@ -182,9 +183,7 @@ static void dingle_slide(Entity_NPC& npc)
|
||||
npc.friction *= DINGLE_SLIDE_FRICTION;
|
||||
if (npc.sprite.WasEventTriggered("Slide"))
|
||||
{
|
||||
Vector push = vector_resized(npc.velocity, npc.subtype == DINGLE_SPIDERS ? SPIDERS_SLIDE_PUSH : SLIDE_PUSH);
|
||||
if (npc.friction != 0)
|
||||
npc.velocity = vector_add(npc.velocity, vector_scale(push, npc.speedMultiplier / npc.friction));
|
||||
npc_push(npc, vector_resized(npc.velocity, npc.subtype == DINGLE_SPIDERS ? SPIDERS_SLIDE_PUSH : SLIDE_PUSH));
|
||||
if (npc.variant == DANGLE) dangle_trail(npc);
|
||||
}
|
||||
npc.sprite.isFlipX = npc.velocity.x > 0;
|
||||
@@ -257,8 +256,7 @@ static void dangle_dip_spawn(Entity_NPC& npc)
|
||||
Vector spot = vector_add(vector_add(vector_scale(scatter, spread), vector_scale(aim, DANGLE_DIP_AHEAD)), npc.pos);
|
||||
auto* dip = static_cast<Entity_NPC*>(g_game->Spawn(
|
||||
{.position = spot, .spawner = &npc, .type = ENTITY_DIP, .variant = CORNY_DIP, .seed = seed}));
|
||||
if (dip->friction != 0)
|
||||
dip->velocity = vector_add(dip->velocity, vector_scale(aim, DANGLE_DIP_KICK * dip->speedMultiplier / dip->friction));
|
||||
npc_push(*dip, vector_scale(aim, DANGLE_DIP_KICK));
|
||||
dip->ClearEntityFlags(FLAG_APPEAR);
|
||||
dip->Update();
|
||||
dip->state = NPC_STATE_MOVE;
|
||||
|
||||
+4
-7
@@ -202,12 +202,11 @@ static void duke_burst(Entity_NPC& npc, const std::vector<Entity_NPC*>& group)
|
||||
}
|
||||
for (Entity* tinyFly : entity_query(ENTITY_EFFECT, EFFECT_TINY_FLY)) push_away(npc, *tinyFly, TINY_FLY_PUSH);
|
||||
|
||||
ProjectileParams params;
|
||||
if (npc.variant == HUSK)
|
||||
npc.FireProjectiles(vector_make(npc.pos.x, npc.pos.y - HUSK_RING_HEIGHT),
|
||||
vector_make(HUSK_RING_SPEED, DUKE_RING_SHOTS), PROJECTILES_RING, params);
|
||||
vector_make(HUSK_RING_SPEED, DUKE_RING_SHOTS), PROJECTILES_RING, ProjectileParams());
|
||||
else if (npc.subtype == DUKE_MOTERS)
|
||||
npc.FireProjectiles(npc.pos, vector_make(MOTER_RING_SPEED, DUKE_RING_SHOTS), PROJECTILES_RING, params);
|
||||
npc.FireProjectiles(npc.pos, vector_make(MOTER_RING_SPEED, DUKE_RING_SHOTS), PROJECTILES_RING, ProjectileParams());
|
||||
}
|
||||
|
||||
// An attack fly coughed up into its group, at a spot below its mouth.
|
||||
@@ -324,14 +323,12 @@ static void death_fly_spawn(Entity_NPC& npc, RNG& rng, int kind, int variant)
|
||||
// flies for the boom Husks, red for the red one).
|
||||
static void duke_death(Entity_NPC& npc)
|
||||
{
|
||||
uint32_t tinyFlies = 0;
|
||||
do
|
||||
for (uint32_t tinyFlies = 0; tinyFlies < Random() % DEATH_TINY_FLIES + DEATH_TINY_FLIES_MIN; tinyFlies++)
|
||||
{
|
||||
uint32_t seed = Random();
|
||||
Vector spot = scatter_spot(npc.pos, DEATH_TINY_FLY_SCATTER);
|
||||
g_game->Spawn({.position = spot, .spawner = &npc, .type = ENTITY_EFFECT, .variant = EFFECT_TINY_FLY, .seed = seed});
|
||||
tinyFlies++;
|
||||
} while (tinyFlies < Random() % DEATH_TINY_FLIES + DEATH_TINY_FLIES_MIN);
|
||||
}
|
||||
|
||||
RNG rng = {npc.initSeed, 5, 9, 7};
|
||||
if (npc.variant != HUSK)
|
||||
|
||||
+9
-5
@@ -119,7 +119,6 @@ static void beams_start(Entity_NPC& npc)
|
||||
npc.i1 = is_cross_diagonal(npc);
|
||||
tracers_spawn(npc);
|
||||
npc.stateFrame = 0;
|
||||
npc.v1.x = 0;
|
||||
}
|
||||
|
||||
// Walking about at random, and now and then the charge, Krampus's beams or the shots.
|
||||
@@ -176,6 +175,7 @@ static void shots_update(Entity_NPC& npc)
|
||||
return;
|
||||
}
|
||||
beams_start(npc);
|
||||
npc.v1.x = 0;
|
||||
}
|
||||
|
||||
// The charge: it chases its target, growling after a while, until hurt enough, then fires its cross.
|
||||
@@ -193,7 +193,11 @@ static void charge_update(Entity_NPC& npc)
|
||||
npc.PlaySound(SOUND_FALLEN_GROWL, 1, CHARGE_GROWL_DELAY, false, 1);
|
||||
Vector aim = vector_add(npc.CalcTargetPosition(0), vector_scale(npc.GetPlayerTarget()->velocity, CHARGE_LEAD_FRAMES));
|
||||
Vector toAim = vector_sub(aim, npc.pos);
|
||||
npc_push(npc, vector_scale(vector_normalized(toAim), CHARGE_ACCEL));
|
||||
Vector heading = vector_normalized(toAim);
|
||||
if (npc.friction != 0)
|
||||
npc.velocity = vector_add(vector_div(vector_scale(vector_scale(heading, npc.speedMultiplier), CHARGE_ACCEL),
|
||||
vector_make(npc.friction, npc.friction)),
|
||||
npc.velocity);
|
||||
npc.v1.x += npc.pendingDamage;
|
||||
npc.sprite.isFlipX = toAim.x < 0;
|
||||
if (npc.v1.x <= npc.maxHitPoints * CHARGE_HURT_SHARE) return;
|
||||
@@ -225,7 +229,7 @@ static void beams_update(Entity_NPC& npc)
|
||||
}
|
||||
else if (npc.sprite.WasEventTriggered("Shoot2") && npc.v1.y > 0)
|
||||
{
|
||||
npc.velocity = vector_add(npc.velocity, vector_scale(npc.targetPosition, npc.v1.y * npc.speedMultiplier));
|
||||
npc.velocity = vector_add(vector_scale(vector_scale(npc.targetPosition, npc.v1.y), npc.speedMultiplier), npc.velocity);
|
||||
npc.v1.y = std::max(npc.v1.y - npc.speedMultiplier * DRIFT_DECAY, 0.0f);
|
||||
}
|
||||
npc.stateFrame++;
|
||||
@@ -239,8 +243,8 @@ static void beams_update(Entity_NPC& npc)
|
||||
for (int i = 0; i < BEAMS; i++)
|
||||
{
|
||||
float angle = (float)i * BEAM_TURN + turn;
|
||||
Vector from = isSpin ? npc.pos : vector_add(npc.pos, vector_make(std::cos(angle * DEGREES_TO_RADIANS) * BEAM_OUT,
|
||||
std::sin(angle * DEGREES_TO_RADIANS) * BEAM_OUT - FALLEN_BEAM_RISE));
|
||||
Vector from = isSpin ? npc.pos : vector_make(std::cos(angle * DEGREES_TO_RADIANS) * BEAM_OUT + npc.pos.x,
|
||||
std::sin(angle * DEGREES_TO_RADIANS) * BEAM_OUT + (npc.pos.y - FALLEN_BEAM_RISE));
|
||||
Entity_Laser* laser = Entity_Laser::ShootAngle({.position = from,
|
||||
.posOffset = vector_make(0, -FALLEN_BEAM_RISE),
|
||||
.source = &npc,
|
||||
|
||||
+1
-2
@@ -12,7 +12,6 @@ constexpr int FAMINE_DASH = NPC_STATE_ATTACK;
|
||||
constexpr int FAMINE_HEAD = NPC_STATE_ATTACK2;
|
||||
constexpr int FAMINE_SUMMON = NPC_STATE_SUMMON;
|
||||
|
||||
constexpr uint64_t FAMINE_DISTRACTED = FLAG_CONFUSION | FLAG_FEAR | FLAG_SHRINK;
|
||||
constexpr float FAMINE_CEILING = 170;
|
||||
constexpr float FAMINE_FRICTION = 0.8f;
|
||||
constexpr float FAMINE_HEAD_HEALTH = 0.33f;
|
||||
@@ -113,7 +112,7 @@ static void famine_float(Entity_NPC& npc, Vector toTarget)
|
||||
|
||||
bool isInLine = std::abs(toTarget.y) < FAMINE_DASH_LINE ||
|
||||
(npc.subtype == FAMINE_BLUE && Random() % FAMINE_BLUE_DASH_ODDS == 0);
|
||||
if (!isInLine || Random() % FAMINE_DASH_ODDS != 0 || npc.HasEntityFlags(FAMINE_DISTRACTED)) return;
|
||||
if (!isInLine || Random() % FAMINE_DASH_ODDS != 0 || npc.HasEntityFlags(FLAG_DISTRACTED)) return;
|
||||
|
||||
npc.PlaySound(SOUND_MONSTER_YELL_A, 1, 2, false, 1);
|
||||
npc.sprite.isFlipX = toTarget.x < 0;
|
||||
|
||||
@@ -190,7 +190,7 @@ static void fistula_split(Entity_NPC& npc)
|
||||
fistula_piece_spawn(npc, ENTITY_FISTULA_MEDIUM, vector_make(c + npc.pos.x, s + npc.pos.y), spread);
|
||||
fistula_piece_spawn(npc, ENTITY_FISTULA_MEDIUM, vector_make(npc.pos.x - c, npc.pos.y - s), back);
|
||||
if (npc.subtype == FISTULA_GREY || npc.variant == TERATOMA)
|
||||
fistula_piece_spawn(npc, ENTITY_FISTULA_MEDIUM, vector_make(c + npc.pos.x, npc.pos.y - s), {});
|
||||
fistula_piece_spawn(npc, ENTITY_FISTULA_MEDIUM, vector_make(c + npc.pos.x, npc.pos.y - s), vector_make(0, 0));
|
||||
else
|
||||
{
|
||||
fistula_piece_spawn(npc, ENTITY_FISTULA_MEDIUM, vector_make(c + npc.pos.x, npc.pos.y - s),
|
||||
|
||||
+31
-4
@@ -46,11 +46,15 @@ constexpr int DEATHS_HEADS = 2;
|
||||
constexpr int DEATHS_HEAD_RED = 1;
|
||||
constexpr int MINIONS_FOR_BLAST = 3;
|
||||
|
||||
// The fade: it waits faded until its minions are gone or a player touches it, drifts to the room's center for at
|
||||
// most 120 frames, and fades back in.
|
||||
// The fade: it waits faded until its minions are gone or a player touches it, drifts to the room's center (an L
|
||||
// room's inner corner cell) for at most 120 frames, and fades back in.
|
||||
constexpr float DRIFT_PUSH = 1.2f;
|
||||
constexpr float DRIFT_MAX_SPEED = 3.2f;
|
||||
constexpr int DRIFT_FRAMES = 120;
|
||||
constexpr int L_ROOM_LBL_CENTER = 132;
|
||||
constexpr int L_ROOM_LBR_CENTER = 119;
|
||||
constexpr int L_ROOM_LTL_CENTER = 328;
|
||||
constexpr int L_ROOM_LTR_CENTER = 315;
|
||||
constexpr float DRIFT_ARRIVE = 45;
|
||||
|
||||
// The lasers: three (and the first again) from its hands 120 apart, turned a random 30 either way from its target's
|
||||
@@ -103,6 +107,24 @@ static int minion_type_get(const Entity_NPC& npc)
|
||||
return npc.subtype == FORSAKEN_BLACK ? ENTITY_BLACK_BONY : ENTITY_BONY;
|
||||
}
|
||||
|
||||
// Where it drifts while faded: the room's center, or the cell by an L room's inner corner.
|
||||
static Vector forsaken_drift_center()
|
||||
{
|
||||
Room& room = *g_game->room;
|
||||
switch (room.GetRoomShape())
|
||||
{
|
||||
case ROOMSHAPE_LBL:
|
||||
return room.GetGridPosition(L_ROOM_LBL_CENTER);
|
||||
case ROOMSHAPE_LBR:
|
||||
return room.GetGridPosition(L_ROOM_LBR_CENTER);
|
||||
case ROOMSHAPE_LTL:
|
||||
return room.GetGridPosition(L_ROOM_LTL_CENTER);
|
||||
case ROOMSHAPE_LTR:
|
||||
return room.GetGridPosition(L_ROOM_LTR_CENTER);
|
||||
}
|
||||
return Room::GetCenterPos();
|
||||
}
|
||||
|
||||
static void fade_start(Entity_NPC& npc)
|
||||
{
|
||||
npc.stateFrame = 0;
|
||||
@@ -218,8 +240,13 @@ static void forsaken_fade(Entity_NPC& npc, const ForsakenCount& count)
|
||||
case FADE_DRIFT:
|
||||
{
|
||||
anim_keep(npc, "Faded");
|
||||
Vector center = Room::GetCenterPos();
|
||||
npc_push(npc, vector_scale(vector_normalized(vector_sub(center, npc.pos)), DRIFT_PUSH));
|
||||
Vector center = forsaken_drift_center();
|
||||
Vector toward = vector_normalized(vector_sub(center, npc.pos));
|
||||
if (npc.friction != 0)
|
||||
{
|
||||
npc.velocity.y = (npc.speedMultiplier * toward.y * DRIFT_PUSH) / npc.friction + npc.velocity.y;
|
||||
npc.velocity.x = (npc.speedMultiplier * toward.x * DRIFT_PUSH) / npc.friction + npc.velocity.x;
|
||||
}
|
||||
if (vector_length(npc.velocity) > DRIFT_MAX_SPEED)
|
||||
npc.velocity = vector_resized(npc.velocity, DRIFT_MAX_SPEED);
|
||||
if (npc.stateFrame <= DRIFT_FRAMES && vector_length(vector_sub(npc.pos, center)) >= DRIFT_ARRIVE) return;
|
||||
|
||||
+1
-2
@@ -30,7 +30,6 @@ enum GatePattern
|
||||
GATE_PATTERN_HOMING
|
||||
};
|
||||
|
||||
constexpr uint64_t GATE_DISTRACTED = FLAG_CONFUSION | FLAG_FEAR | FLAG_SHRINK;
|
||||
constexpr float GATE_LIFT = 40;
|
||||
constexpr float GATE_FRICTION = 0.8f;
|
||||
constexpr float GATE_HURT_HEALTH = 0.3f;
|
||||
@@ -129,7 +128,7 @@ static void gate_idle(Entity_NPC& npc)
|
||||
npc.i1 = GATE_CHARGING;
|
||||
}
|
||||
else if (npc.subtype != GATE_BLACK && enemies > GATE_LASER_CROWD && npc.IsFrame(period, 0) &&
|
||||
random_below(GATE_LASER_ODDS / enemies) == 0 && !npc.HasEntityFlags(GATE_DISTRACTED))
|
||||
random_below(GATE_LASER_ODDS / enemies) == 0 && !npc.HasEntityFlags(FLAG_DISTRACTED))
|
||||
{
|
||||
npc.state = GATE_LASER;
|
||||
npc.i1 = GATE_CHARGING;
|
||||
|
||||
+1
-5
@@ -96,11 +96,7 @@ static void gurdy_players_place(Entity_NPC& npc)
|
||||
// What it spawned: a Delirium form's dying boils die with it, and the rest are shoved away from it.
|
||||
static void gurdy_spawn_shove(Entity_NPC& npc)
|
||||
{
|
||||
std::vector<Entity*> spawned;
|
||||
for (Entity* entity : g_game->room->entityList.updateEL)
|
||||
if (entity->spawnerType == npc.type) spawned.push_back(entity);
|
||||
|
||||
for (Entity* entity : spawned)
|
||||
for (Entity* entity : npc_query_spawner_type(npc.type, 0, SPAWNER_QUERY_ALL))
|
||||
{
|
||||
auto* other = dynamic_cast<Entity_NPC*>(entity);
|
||||
if (!other || other == &npc) continue;
|
||||
|
||||
@@ -30,7 +30,6 @@ enum GurdyJrOrder
|
||||
GURDY_JR_ORDER_SUMMON
|
||||
};
|
||||
|
||||
constexpr uint64_t GURDY_JR_DISTRACTED = FLAG_CONFUSION | FLAG_FEAR | FLAG_SHRINK;
|
||||
constexpr float GURDY_JR_FRICTION = 0.8f;
|
||||
constexpr float GURDY_JR_SLIDE_FRICTION = 0.97f;
|
||||
constexpr float GURDY_JR_SLIDE_START_FRICTION = 0.7f;
|
||||
@@ -89,7 +88,7 @@ static void gurdy_jr_idle(Entity_NPC& npc)
|
||||
int order = GURDY_JR_ORDER_NONE;
|
||||
if (npc.controllerID != -1)
|
||||
{
|
||||
if (!npc.HasEntityFlags(GURDY_JR_DISTRACTED)) npc.SpawnControlTarget(0, -1);
|
||||
if (!npc.HasEntityFlags(FLAG_DISTRACTED)) npc.SpawnControlTarget(0, -1);
|
||||
if (npc.is_controller_input_idle() &&
|
||||
vector_length_squared(vector_sub(npc.pos, npc.GetAimTargetPosition())) > GURDY_JR_AIM_REACH_SQUARED)
|
||||
order = GURDY_JR_ORDER_SLIDE;
|
||||
@@ -129,7 +128,7 @@ static void gurdy_jr_idle(Entity_NPC& npc)
|
||||
npc.stateFrame = 0;
|
||||
return npc.ClearChild();
|
||||
}
|
||||
if (npc.HasEntityFlags(GURDY_JR_DISTRACTED)) return;
|
||||
if (npc.HasEntityFlags(FLAG_DISTRACTED)) return;
|
||||
|
||||
npc.state = GURDY_JR_SLIDE;
|
||||
npc.i2 = GURDY_JR_SLIDE_PUSH;
|
||||
@@ -150,10 +149,10 @@ static void gurdy_jr_idle(Entity_NPC& npc)
|
||||
// every five frames.
|
||||
static void gurdy_jr_slide(Entity_NPC& npc)
|
||||
{
|
||||
if (npc_anim_is_done(npc) || npc.HasEntityFlags(GURDY_JR_DISTRACTED))
|
||||
if (npc_anim_is_done(npc) || npc.HasEntityFlags(FLAG_DISTRACTED))
|
||||
{
|
||||
if (npc.i2 == GURDY_JR_SLIDE_PUSH) npc.i2 = GURDY_JR_SLIDE_GLIDE;
|
||||
else if (npc.i2 == GURDY_JR_SLIDE_END) npc.state = NPC_STATE_IDLE;
|
||||
else if (npc.i2 != GURDY_JR_SLIDE_GLIDE) npc.state = NPC_STATE_IDLE;
|
||||
else if (vector_length_squared(npc.velocity) <= GURDY_JR_SLIDE_STOP_SQUARED || npc.i1++ > GURDY_JR_SLIDE_FRAMES)
|
||||
{
|
||||
npc.i2 = GURDY_JR_SLIDE_END;
|
||||
@@ -290,5 +289,5 @@ void boss_gurdy_jr_update(Entity_NPC& npc)
|
||||
break;
|
||||
}
|
||||
if (npc.controllerID == -1 || steer <= 0) return;
|
||||
npc.velocity = vector_add(npc.velocity, vector_scale(npc.GetControllerInput(0), steer * npc.speedMultiplier));
|
||||
npc.velocity = vector_add(vector_scale(vector_scale(npc.GetControllerInput(0), steer), npc.speedMultiplier), npc.velocity);
|
||||
}
|
||||
@@ -9,7 +9,6 @@ constexpr int HORSEMAN_ATTACK = NPC_STATE_ATTACK;
|
||||
constexpr int HEAD_CHARGE = NPC_STATE_ATTACK;
|
||||
constexpr int HEAD_SHOOT = NPC_STATE_ATTACK2;
|
||||
|
||||
constexpr uint64_t HORSEMAN_DISTRACTED = FLAG_CONFUSION | FLAG_FEAR | FLAG_SHRINK;
|
||||
constexpr float HORSEMAN_FRICTION = 0.8f;
|
||||
constexpr int HORSEMAN_ATTACK_FRAMES = 31;
|
||||
|
||||
@@ -95,7 +94,7 @@ static void head_float(Entity_NPC& npc)
|
||||
}
|
||||
bool isCharge = Random() % HEAD_CHARGE_ODDS == 0 ||
|
||||
(std::abs(toTarget.y) < HEAD_LINE_BAND && Random() % HEAD_LINE_CHARGE_ODDS == 0);
|
||||
if (!isCharge || npc.HasEntityFlags(HORSEMAN_DISTRACTED)) return;
|
||||
if (!isCharge || npc.HasEntityFlags(FLAG_DISTRACTED)) return;
|
||||
|
||||
npc.PlaySound(SOUND_MONSTER_YELL_A, 1, 2, false, 1);
|
||||
npc.sprite.isFlipX = toTarget.x < 0;
|
||||
|
||||
@@ -704,7 +704,7 @@ static LobArc lob_arc_solve(Entity_Projectile& shot, float distance)
|
||||
for (int i = 0; i < LOB_TRIES; i++)
|
||||
{
|
||||
float time = distance / arc.speed;
|
||||
float decay = (float)std::pow((double)LOB_DRAG, (double)time);
|
||||
float decay = pow_float(LOB_DRAG, time);
|
||||
float drag = std::max((decay - 1) * LOB_DRAG_SCALE, LOB_TIME_MIN);
|
||||
arc.fallingSpeed = (lift - (time - drag) * accel) / drag;
|
||||
bool isPast =
|
||||
|
||||
@@ -412,6 +412,7 @@ void boss_lil_blub_update(Entity_NPC& npc)
|
||||
npc.targetPosition = {};
|
||||
npc.splatColor = blub_is_sewage() ? SEWAGE_SPLASH_COLOR : WATER_SPLASH_COLOR;
|
||||
npc.projectileDelay = 0;
|
||||
npc.stateFrame = 0;
|
||||
break;
|
||||
case BLUB_REST:
|
||||
blub_rest_update(npc, leeches, isHurt);
|
||||
|
||||
+1
-11
@@ -34,16 +34,6 @@ constexpr float LOKI_SHOT_SPEED = 12;
|
||||
constexpr int BLOOD_EXPLOSION_SMALL = 3;
|
||||
constexpr float LOKI_FRICTION = 0.8f;
|
||||
|
||||
// The cell a spot lies in, or -1 off the grid.
|
||||
static int cell_get(const Vector& spot)
|
||||
{
|
||||
Room& room = *g_game->room;
|
||||
int column = (int)((spot.x - GRID_ORIGIN_X) / GRID_CELL_SIZE + 0.5f);
|
||||
int row = (int)((spot.y - GRID_ORIGIN_Y) / GRID_CELL_SIZE + 0.5f);
|
||||
if (column < 0 || column >= room.gridWidth || row < 0 || row >= room.gridHeight) return -1;
|
||||
return row * room.gridWidth + column;
|
||||
}
|
||||
|
||||
// The first frame: Loki waits, and the first Lokii of a pair hides its twin.
|
||||
static void loki_init(Entity_NPC& npc)
|
||||
{
|
||||
@@ -116,7 +106,7 @@ static void loki_teleport(Entity_NPC& npc)
|
||||
Room& room = *g_game->room;
|
||||
for (int i = TELEPORT_TRIES - 1; i >= 0; i--)
|
||||
{
|
||||
int cell = cell_get(room.GetRandomPosition(TELEPORT_MARGIN));
|
||||
int cell = room.GetGridIndex(room.GetRandomPosition(TELEPORT_MARGIN));
|
||||
Vector spot = vector_make((float)(cell % room.gridWidth) * GRID_CELL_SIZE + GRID_ORIGIN_X,
|
||||
(float)(cell / room.gridWidth) * GRID_CELL_SIZE + GRID_ORIGIN_Y);
|
||||
Vector away = vector_sub(spot, game_nearest_player(spot)->pos);
|
||||
|
||||
@@ -153,14 +153,14 @@ static void mask_heart_check(Entity_NPC& npc)
|
||||
npc.state = MASK_ANGRY;
|
||||
}
|
||||
|
||||
// Each time its heart is hurt it may lunge away from the target, one time in 2.
|
||||
static void mask_lunge_check(Entity_NPC& npc)
|
||||
// Each time its heart is hurt it may lunge away from the target, one time in 2, unless a player steers it.
|
||||
static void mask_lunge_check(Entity_NPC& npc, bool isControlled)
|
||||
{
|
||||
if (npc.type != ENTITY_MASK_OF_INFAMY || npc.state == MASK_ANGRY || !npc.parent) return;
|
||||
if (npc.v2.x == npc.parent->health) return;
|
||||
|
||||
npc.v2.x = npc.parent->health;
|
||||
if ((Random() & 1) != 0) return;
|
||||
if ((Random() & 1) != 0 || isControlled) return;
|
||||
Vector delta = mask_target_delta(npc, mask_cell_center(npc.pos));
|
||||
npc.targetPosition = vector_scale(mask_axis_away(delta), MASK_LUNGE_PUSH);
|
||||
npc.i1 = MASK_DASH_LUNGE;
|
||||
@@ -283,7 +283,7 @@ void boss_mask_of_infamy_update(Entity_NPC& npc)
|
||||
Entity_NPC* controller = mask_controller_get(npc);
|
||||
if (npc.state == NPC_STATE_INIT) return mask_init(npc);
|
||||
mask_heart_check(npc);
|
||||
mask_lunge_check(npc);
|
||||
mask_lunge_check(npc, controller != nullptr);
|
||||
mask_face(npc);
|
||||
|
||||
Vector cell = mask_cell_center(npc.pos);
|
||||
|
||||
@@ -333,6 +333,7 @@ static BossPool_Entry* boss_after_find(BossPool& bossPool, BossPool_Pool& pool,
|
||||
// win (weighted, allowed, not met this run or floor). Else roll moves through that entry's share, up to nine times,
|
||||
// then the next boss around the pool that can be picked does. The pick joins the floor's blacklist. Null for an empty
|
||||
// or weightless pool, or when nothing can be picked.
|
||||
// The original crashes on a roll past every entry's share. Here that finds nothing.
|
||||
BossPool_Entry* BossPool::PickBoss(BossPool_Pool& pool, float roll)
|
||||
{
|
||||
BossPool_Entry* picked = nullptr;
|
||||
|
||||
+12
-9
@@ -398,8 +398,9 @@ static void rag_man_rebirth(Entity_NPC& npc, const std::vector<Entity*>& ragling
|
||||
npc_sound_play(SOUND_RAGMAN_2, 1, 2, 1);
|
||||
if (npc.subtype == RAG_MAN_SPIDERS)
|
||||
{
|
||||
ProjectileParams params;
|
||||
Vector aim = game_random_player(*g_game, npc.pos, RAG_MAN_FAR)->pos;
|
||||
npc.FireBossProjectiles(RAG_MAN_REVIVE_SHOTS, aim, RAG_MAN_REVIVE_SHOT_CURVE, ProjectileParams());
|
||||
npc.FireBossProjectiles(RAG_MAN_REVIVE_SHOTS, aim, RAG_MAN_REVIVE_SHOT_CURVE, params);
|
||||
}
|
||||
else
|
||||
for (Entity* ragling : raglings)
|
||||
@@ -545,8 +546,8 @@ static void rag_man_head_update(Entity_NPC& npc)
|
||||
float speed = HEAD_FAST_SPEED - slowdown * HEAD_SLOWDOWN;
|
||||
Vector toTarget = vector_normalized(vector_sub(npc.CalcTargetPosition(0), npc.pos));
|
||||
Vector heading = vector_normalized(npc.velocity);
|
||||
Vector steer = vector_add(vector_add(vector_scale(toTarget, speed * HEAD_STEER), npc.velocity),
|
||||
vector_scale(heading, speed * HEAD_STEER));
|
||||
Vector steer = vector_make(speed * toTarget.x * HEAD_STEER + npc.velocity.x + speed * heading.x * HEAD_STEER,
|
||||
speed * toTarget.y * HEAD_STEER + npc.velocity.y + speed * heading.y * HEAD_STEER);
|
||||
steer = vector_resized(steer, speed);
|
||||
float keep = timescale_factor(RAG_MAN_FRICTION, npc.speedMultiplier);
|
||||
npc.velocity = vector_add(vector_scale(vector_sub(steer, npc.velocity), 1 - keep), npc.velocity);
|
||||
@@ -655,8 +656,10 @@ static void mega_ball_trail(Entity_NPC& npc)
|
||||
smoke->velocity = vector_scale(npc.velocity, BALL_TRAIL_BACK);
|
||||
float angle = random_unit() * PI_ROUGH;
|
||||
angle += angle;
|
||||
float scatter = random_unit() * vector_length(npc.velocity) * BALL_TRAIL_SCATTER;
|
||||
npc_push(*smoke, vector_make(std::cos(angle) * scatter, std::sin(angle) * scatter));
|
||||
float scatter = random_unit();
|
||||
float speed = vector_length(npc.velocity);
|
||||
npc_push(*smoke, vector_make(std::cos(angle) * scatter * speed * BALL_TRAIL_SCATTER,
|
||||
std::sin(angle) * scatter * speed * BALL_TRAIL_SCATTER));
|
||||
smoke->posOffset = vector_make(0, BALL_HEIGHT);
|
||||
}
|
||||
|
||||
@@ -700,10 +703,10 @@ static void mega_pillar_update(Entity_NPC& npc)
|
||||
static void mega_drift(Entity_NPC& npc)
|
||||
{
|
||||
Room& room = *g_game->room;
|
||||
Vector clamped = room.GetClampedPositionImpl(npc.pos, MEGA_WALL_MARGIN, 0, 0, 0);
|
||||
npc.pos.y = clamped.y;
|
||||
if (clamped.x == room.bottomRightPos.x) npc.velocity.x = -1;
|
||||
if (clamped.x == room.topLeftPos.x) npc.velocity.x = 1;
|
||||
npc.entityGridCollisionClass = GRIDCOLL_WALLS;
|
||||
npc.pos = room.GetClampedPositionImpl(npc.pos, MEGA_WALL_MARGIN, 0, 0, 0);
|
||||
if (npc.pos.x == room.bottomRightPos.x) npc.velocity.x = -1;
|
||||
if (npc.pos.x == room.topLeftPos.x) npc.velocity.x = 1;
|
||||
if (npc.pos.y == room.bottomRightPos.y) npc.velocity.y = -1;
|
||||
if (npc.pos.y == room.topLeftPos.y + MEGA_WALL_MARGIN) npc.velocity.y = 1;
|
||||
|
||||
|
||||
+16
-7
@@ -167,8 +167,8 @@ static void raglich_pick_target_pos(Entity_NPC& npc, float speed)
|
||||
Vector side = vector_from_direction(direction_turn(raglich_direction_get(npc), turn));
|
||||
Vector facing = vector_from_direction(raglich_direction_get(npc));
|
||||
Vector offEdge = vector_scale(facing, vector_dot(vector_sub(npc.pos, npc.targetPosition), facing));
|
||||
npc.velocity = vector_add(npc.velocity, vector_scale(vector_sub(vector_scale(side, speed), vector_scale(offEdge, WALK_EDGE_PULL)),
|
||||
npc.v1.y * npc.speedMultiplier));
|
||||
npc.velocity.x = (side.x * speed - offEdge.x * WALK_EDGE_PULL) * npc.v1.y * npc.speedMultiplier + npc.velocity.x;
|
||||
npc.velocity.y = (side.y * speed - offEdge.y * WALK_EDGE_PULL) * npc.v1.y * npc.speedMultiplier + npc.velocity.y;
|
||||
Vector clamped = room.GetClampedPositionImpl(vector_sub(npc.pos, offEdge), WALK_MARGIN, WALK_MARGIN, WALK_MARGIN, WALK_MARGIN);
|
||||
Vector ahead = vector_add(clamped, vector_scale(side, GRID_CELL_SIZE));
|
||||
if (!room.IsPositionInRoom(ahead, 0))
|
||||
@@ -215,9 +215,11 @@ static void raglich_slam_spawn_grid(Entity_NPC& arm)
|
||||
arm.PlaySound(SOUND_HELLBOSS_GROUNDPOUND, 1, 2, false, 1);
|
||||
game_shake_screen(ARM_SHAKE);
|
||||
}
|
||||
// The original adds the left blast's offset to his position before the hit's.
|
||||
Vector slam = vector_add(arm.pos, hit);
|
||||
for (float offset : {0.0f, -GRID_CELL_SIZE, GRID_CELL_SIZE})
|
||||
explosion_damage({.position = vector_add(slam, vector_make(offset, 0)),
|
||||
Vector left = vector_make(hit.x + (arm.pos.x - GRID_CELL_SIZE), slam.y);
|
||||
for (Vector blast : {slam, left, vector_make(slam.x + GRID_CELL_SIZE, slam.y)})
|
||||
explosion_damage({.position = blast,
|
||||
.source = &arm,
|
||||
.damageFlags = DAMAGE_CRUSH,
|
||||
.damage = ARM_BLAST_DAMAGE,
|
||||
@@ -369,6 +371,13 @@ static void raglich_dash_end(Entity_NPC& npc)
|
||||
npc.projectileCooldown = RAGLICH_DASH_COOLDOWN;
|
||||
}
|
||||
|
||||
// The dash's push along its axis at its speed.
|
||||
static void raglich_dash_push(Entity_NPC& npc, Vector axis)
|
||||
{
|
||||
npc.velocity.x = axis.x * npc.v1.y * npc.speedMultiplier + npc.velocity.x;
|
||||
npc.velocity.y = axis.y * npc.v1.y * npc.speedMultiplier + npc.velocity.y;
|
||||
}
|
||||
|
||||
// The dash across the room: building from 18 down to 8, heading for the far wall, then turning to walk back along it.
|
||||
// The alternate dash turns down into a slide that fires blue crosses, then dashes on.
|
||||
static bool raglich_dash_update(Entity_NPC& npc)
|
||||
@@ -423,7 +432,7 @@ static bool raglich_dash_update(Entity_NPC& npc)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
npc.velocity = vector_add(npc.velocity, vector_scale(axis, npc.v1.y * npc.speedMultiplier));
|
||||
raglich_dash_push(npc, axis);
|
||||
npc.v1.y = std::max(npc.v1.y - npc.speedMultiplier * DASH_SLOW, DASH_MIN);
|
||||
bool isPastMiddle = npc.state == RAGLICH_DASH && npc.sprite.GetFrame() <= DASH_LATE_FRAME &&
|
||||
vector_dot(vector_sub(npc.pos, Room::GetCenterPos()), axis) > 0;
|
||||
@@ -448,7 +457,7 @@ static bool raglich_dash_update(Entity_NPC& npc)
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
npc.velocity = vector_add(npc.velocity, vector_scale(axis, npc.v1.y * npc.speedMultiplier));
|
||||
raglich_dash_push(npc, axis);
|
||||
npc.v1.y = std::max(npc.v1.y - 2 * npc.speedMultiplier, DASH_TURN_MIN);
|
||||
if (npc.sprite.IsFinished())
|
||||
{
|
||||
@@ -457,7 +466,7 @@ static bool raglich_dash_update(Entity_NPC& npc)
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
npc.velocity = vector_add(npc.velocity, vector_scale(axis, npc.v1.y * npc.speedMultiplier));
|
||||
raglich_dash_push(npc, axis);
|
||||
npc.v1.y = std::max(npc.v1.y - npc.speedMultiplier, DASH_SHOOT_MIN);
|
||||
if (npc.sprite.IsEventTriggered("Shoot")) raglich_fire_shots(npc, SOUND_MONSTER_GRUNT_0, PROJECTILES_CROSS);
|
||||
else if (npc.sprite.IsEventTriggered("Shoot2")) raglich_fire_shots(npc, SOUND_MONSTER_GRUNT_1, PROJECTILES_PLUS);
|
||||
|
||||
+25
-14
@@ -308,7 +308,7 @@ static void reap_dash(Entity_NPC& npc, ReapFrame& frame)
|
||||
frame.friction = REAP_DASH_FRICTION;
|
||||
}
|
||||
|
||||
// The fountain: a minute of shots tossed up every other frame, falling around it, then a rest.
|
||||
// The fountain: a minute of shots tossed up every other frame, falling around it, then the spray's longer rest.
|
||||
static void reap_fountain(Entity_NPC& npc, ReapFrame& frame)
|
||||
{
|
||||
if (npc.projectileCooldown == 0)
|
||||
@@ -324,7 +324,8 @@ static void reap_fountain(Entity_NPC& npc, ReapFrame& frame)
|
||||
if (npc.projectileCooldown < 1)
|
||||
{
|
||||
frame.strafe = 0;
|
||||
return reap_rest_when_done(npc);
|
||||
if (npc_anim_is_done(npc)) reap_rest(npc, REAP_SPRAY_REST_MIN, REAP_SPRAY_REST_RANGE);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((npc.projectileCooldown & 1) == 0)
|
||||
@@ -337,8 +338,9 @@ static void reap_fountain(Entity_NPC& npc, ReapFrame& frame)
|
||||
params.scale = REAP_FOUNTAIN_SCALE - size * REAP_FOUNTAIN_SCALE_RANGE;
|
||||
params.fallingSpeedModifier = REAP_FOUNTAIN_FALL;
|
||||
Vector direction = random_direction();
|
||||
float reach = random_unit() * REAP_FOUNTAIN_SPREAD;
|
||||
Vector from = vector_make(reach * direction.x + npc.pos.x, direction.y * reach + npc.pos.y + REAP_FOUNTAIN_DROP);
|
||||
float reach = random_unit();
|
||||
Vector from = vector_make(reach * direction.x * REAP_FOUNTAIN_SPREAD + npc.pos.x,
|
||||
direction.y * reach * REAP_FOUNTAIN_SPREAD + npc.pos.y + REAP_FOUNTAIN_DROP);
|
||||
npc.FireProjectiles(from, up, PROJECTILES_SINGLE, params);
|
||||
npc.PlaySound(SOUND_TEARS_FIRE, 1, 2, false, 1);
|
||||
}
|
||||
@@ -498,11 +500,11 @@ static Vector reap_wall_spot(Room& room, uint32_t& seed)
|
||||
float along = random_unit();
|
||||
Vector topLeft = room.topLeftPos;
|
||||
Vector bottomRight = room.bottomRightPos;
|
||||
if (wall >= REAP_WALL_SIDE_ODDS)
|
||||
return vector_make((bottomRight.x - REAP_WALL_MARGIN - (topLeft.x + REAP_WALL_MARGIN)) * along + topLeft.x + REAP_WALL_MARGIN,
|
||||
bottomRight.y);
|
||||
float first = topLeft.x + REAP_WALL_MARGIN;
|
||||
if (wall >= REAP_WALL_SIDE_ODDS) return vector_make((bottomRight.x - REAP_WALL_MARGIN - first) * along + first, bottomRight.y);
|
||||
|
||||
float y = (bottomRight.y - REAP_WALL_MARGIN - (topLeft.y + REAP_WALL_MARGIN)) * along + topLeft.y + REAP_WALL_MARGIN;
|
||||
float top = topLeft.y + REAP_WALL_MARGIN;
|
||||
float y = (bottomRight.y - REAP_WALL_MARGIN - top) * along + top;
|
||||
return vector_make(wall < REAP_WALL_LEFT_ODDS ? topLeft.x : bottomRight.x, y);
|
||||
}
|
||||
|
||||
@@ -520,12 +522,21 @@ static void reap_wall_creep_summon(Entity_NPC& npc, ReapFrame& frame)
|
||||
npc.PlaySound(SOUND_SUMMONSOUND, 1, 2, false, 1);
|
||||
}
|
||||
|
||||
// A free tile at a random angle below it, within reach (beyond a minimum).
|
||||
static Vector reap_summon_spot(Entity_NPC& npc, float reachMin, float reachRange)
|
||||
// A free tile at a random angle below it, within reach: up to 200 for a spider, 100 to 300 for a Trite.
|
||||
// The original scales a spider's reach after the angle and a Trite's before it.
|
||||
static Vector reap_summon_spot(Entity_NPC& npc, bool isTrite)
|
||||
{
|
||||
float angle = (random_unit() * REAP_SUMMON_ARC + REAP_SUMMON_ARC_START) * DEGREES_TO_RADIANS;
|
||||
float reach = random_unit() * reachRange + reachMin;
|
||||
Vector spot = vector_make(std::cos(angle) * reach + npc.pos.x, std::sin(angle) * reach + npc.pos.y);
|
||||
float reach = random_unit();
|
||||
Vector spot{};
|
||||
if (isTrite)
|
||||
{
|
||||
reach = reach * REAP_SPIDER_REACH + REAP_TRITE_REACH_MIN;
|
||||
spot = vector_make(std::cos(angle) * reach + npc.pos.x, std::sin(angle) * reach + npc.pos.y);
|
||||
}
|
||||
else
|
||||
spot = vector_make(std::cos(angle) * reach * REAP_SPIDER_REACH + npc.pos.x,
|
||||
std::sin(angle) * reach * REAP_SPIDER_REACH + npc.pos.y);
|
||||
return room_free_tile_position_find(spot, REAP_FREE_TILE_REACH);
|
||||
}
|
||||
|
||||
@@ -538,7 +549,7 @@ static void reap_spider_summon(Entity_NPC& npc, ReapFrame& frame)
|
||||
npc.PlaySound(SOUND_BOSS_SPIT_BLOB_BARF, 1, 2, false, 1);
|
||||
if ((Random() & 1) == 0)
|
||||
for (int i = 0; i < REAP_SUMMON_SPIDERS; i++)
|
||||
Entity_NPC::ThrowSpider(npc.pos, &npc, reap_summon_spot(npc, 0, REAP_SPIDER_REACH), false,
|
||||
Entity_NPC::ThrowSpider(npc.pos, &npc, reap_summon_spot(npc, false), false,
|
||||
REAP_SPIDER_HEIGHT);
|
||||
else
|
||||
{
|
||||
@@ -546,7 +557,7 @@ static void reap_spider_summon(Entity_NPC& npc, ReapFrame& frame)
|
||||
.type = ENTITY_HOPPER,
|
||||
.variant = HOPPER_TRITE,
|
||||
.seed = Random()}));
|
||||
trite->targetPosition = reap_summon_spot(npc, REAP_TRITE_REACH_MIN, REAP_SPIDER_REACH);
|
||||
trite->targetPosition = reap_summon_spot(npc, true);
|
||||
trite->state = NPC_STATE_MOVE;
|
||||
trite->stateFrame = REAP_TRITE_HOP_FRAME;
|
||||
trite->sprite.Play("Hop", PLAY_FORCED);
|
||||
|
||||
+2
-1
@@ -347,7 +347,8 @@ static void spread_update(Entity_NPC& npc, Entity& target)
|
||||
params.fallingSpeedModifier = SPREAD_FALL_SPEED;
|
||||
}
|
||||
float speed = (vector_length(lead) <= SPREAD_FAR ? SPREAD_SPEED : SPREAD_SPEED_FAR) * SPREAD_SPEED_SCALE;
|
||||
npc.FireProjectiles(npc.pos, vector_resized(lead, speed), isShoot2 ? PROJECTILES_FOUR : PROJECTILES_FIVE, params);
|
||||
npc.FireProjectiles(npc.pos, vector_scale(vector_normalized(lead), speed), isShoot2 ? PROJECTILES_FOUR : PROJECTILES_FIVE,
|
||||
params);
|
||||
}
|
||||
|
||||
// Satan shakes from side to side between an attack's Shoot and Shoot2, on frames he updates.
|
||||
|
||||
@@ -1005,7 +1005,8 @@ static void chain_tip_fly(Entity_NPC& npc, Entity_NPC& head)
|
||||
npc.mass = SCOURGE_TIP_MASS;
|
||||
if (vector_is_zero(npc.targetPosition)) return;
|
||||
|
||||
npc.velocity = vector_add(npc.velocity, vector_scale(npc.targetPosition, SCOURGE_TIP_THRUST * npc.speedMultiplier));
|
||||
npc.velocity = vector_make(npc.targetPosition.x * SCOURGE_TIP_THRUST * npc.speedMultiplier + npc.velocity.x,
|
||||
npc.targetPosition.y * SCOURGE_TIP_THRUST * npc.speedMultiplier + npc.velocity.y);
|
||||
float speed = vector_length(npc.velocity);
|
||||
if (speed > SCOURGE_TIP_SPEED_MAX && speed > 0) npc.velocity = vector_scale(npc.velocity, SCOURGE_TIP_SPEED_MAX / speed);
|
||||
|
||||
@@ -1195,15 +1196,14 @@ static void chain_health_share(Entity_NPC& npc, Entity_NPC& head)
|
||||
weakest = std::min(link->health - link->pendingDamage, weakest);
|
||||
|
||||
float most = 0;
|
||||
EntityRef source(&npc);
|
||||
for (Entity* link = &head; is_scourge_link(link); link = link->child.get())
|
||||
{
|
||||
float left = link->health - link->pendingDamage;
|
||||
if (left <= weakest) continue;
|
||||
link->TakeDamage(left - weakest, 0, source, SCOURGE_LINK_DAMAGE_COUNTDOWN);
|
||||
link->TakeDamage(left - weakest, 0, EntityRef(&npc), SCOURGE_LINK_DAMAGE_COUNTDOWN);
|
||||
most = std::max(left - weakest, most);
|
||||
}
|
||||
if (head.parent && most > 0) head.parent->TakeDamage(most * SCOURGE_SHARED_DAMAGE, 0, source, SCOURGE_LINK_DAMAGE_COUNTDOWN);
|
||||
if (head.parent && most > 0) head.parent->TakeDamage(most * SCOURGE_SHARED_DAMAGE, 0, EntityRef(&npc), SCOURGE_LINK_DAMAGE_COUNTDOWN);
|
||||
}
|
||||
|
||||
// A dead link lets go of its neighbours, checks what is left of its chain and shows its wall impact.
|
||||
@@ -1284,7 +1284,7 @@ static void scourge_chain_strip_render(Entity_NPC& npc, const Vector& offset)
|
||||
const AnimationFrame* frame = npc.sprite.animState.GetLayerFrame(0);
|
||||
if (!frame) return;
|
||||
|
||||
float halfWidth = frame->width * HALF * npc.sprite.scale.x * frame->scale.x;
|
||||
float halfWidth = frame->width * HALF * npc.sprite.scale.x;
|
||||
float height = npc.subtype == SCOURGE_CHAIN_TRAP && tip.state == SCOURGE_LINK_LATCHED
|
||||
? (frame->height - SCOURGE_STRIP_LATCHED_INSET) * npc.sprite.scale.y
|
||||
: npc.sprite.scale.y * frame->height;
|
||||
@@ -1300,14 +1300,15 @@ static void scourge_chain_strip_render(Entity_NPC& npc, const Vector& offset)
|
||||
{
|
||||
Vector to = vector_add(link->pos, link->posOffset);
|
||||
Vector direction = vector_normalized(vector_sub(to, from));
|
||||
Vector edge = vector_make(-direction.y * halfWidth, direction.x * halfWidth);
|
||||
Vector edge = vector_make(halfWidth * frame->scale.x * -direction.y, direction.x * halfWidth * frame->scale.x);
|
||||
float edgeBack = direction.y * halfWidth * frame->scale.x;
|
||||
Vector start = render_position_get(from, RENDER_SNAPPED);
|
||||
Vector end = render_position_get(to, RENDER_SNAPPED);
|
||||
DestinationQuad quad;
|
||||
quad._topLeft = vector_add(vector_add(start, edge), offset);
|
||||
quad._topRight = vector_add(vector_sub(start, edge), offset);
|
||||
quad._topRight = vector_add(vector_make(start.x + edgeBack, start.y - edge.y), offset);
|
||||
quad._bottomLeft = vector_add(vector_add(end, edge), offset);
|
||||
quad._bottomRight = vector_add(vector_sub(end, edge), offset);
|
||||
quad._bottomRight = vector_add(vector_make(end.x + edgeBack, end.y - edge.y), offset);
|
||||
quads.emplace_back(quad, kcolor_rgba(1, 1, 1, 1));
|
||||
|
||||
SourceQuad source;
|
||||
|
||||
+7
-5
@@ -88,14 +88,14 @@ static void singe_ball_blasts_update(Entity_NPC& npc)
|
||||
}
|
||||
}
|
||||
|
||||
// Its height: falling (and bouncing, or dropping into a pit) while up or popped.
|
||||
static void singe_ball_fall_update(Entity_NPC& npc)
|
||||
// Its height: falling (and bouncing, or dropping into a pit) while up or popped. Whether it sank out of the room.
|
||||
static bool singe_ball_is_sunk(Entity_NPC& npc)
|
||||
{
|
||||
bool isAirborne = npc.v2.y < 0 || npc.v1.y < 0 || npc.entityGridCollisionClass == GRIDCOLL_PITSONLY;
|
||||
if (!isAirborne)
|
||||
{
|
||||
npc.posOffset.y = npc.v2.y;
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
float fall = npc.v1.y;
|
||||
@@ -107,6 +107,7 @@ static void singe_ball_fall_update(Entity_NPC& npc)
|
||||
{
|
||||
g_game->Spawn({.position = npc.pos, .type = ENTITY_EFFECT, .variant = EFFECT_POOF01, .seed = Random()});
|
||||
npc.Remove();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (npc.v2.y > 0)
|
||||
@@ -131,6 +132,7 @@ static void singe_ball_fall_update(Entity_NPC& npc)
|
||||
}
|
||||
}
|
||||
npc.posOffset.y = npc.v2.y;
|
||||
return false;
|
||||
}
|
||||
|
||||
// 0058d8b0 Singe's ball rolls about wherever it is knocked, bounced by blasts and turning with its roll, harmless
|
||||
@@ -172,7 +174,7 @@ void singe_ball_update(Entity_NPC& npc)
|
||||
npc.entityGridCollisionClass = npc.v2.y <= BALL_LIFTED || npc.v1.y < 0 ? GRIDCOLL_NOPITS : GRIDCOLL_GROUND;
|
||||
}
|
||||
singe_ball_blasts_update(npc);
|
||||
singe_ball_fall_update(npc);
|
||||
if (singe_ball_is_sunk(npc)) return;
|
||||
|
||||
float speedSquared = vector_length_squared(npc.velocity);
|
||||
int axis = std::abs(npc.velocity.y) < std::abs(npc.velocity.x) ? BALL_ROLL_SIDEWAYS : 0;
|
||||
@@ -764,7 +766,7 @@ static void singe_smoke_update(Entity_NPC& npc)
|
||||
Vector offset = vector_rotated(local, sprite.rotation);
|
||||
if (sprite.isFlipX) offset.x *= -1;
|
||||
if (sprite.isFlipY) offset.y *= -1;
|
||||
offset = vector_scale(offset, 1 / ROOM_SCREEN_SCALE);
|
||||
offset = vector_make(offset.x / ROOM_SCREEN_SCALE, offset.y / ROOM_SCREEN_SCALE);
|
||||
int count = 1 - (int)(guide->scale.y * guide->scale.x / SINGE_SMOKE_AREA);
|
||||
bool isLeft = offset.x < 0;
|
||||
|
||||
|
||||
+19
-12
@@ -106,12 +106,14 @@ constexpr float SIREN_LUNGE_NUDGE = 0.01f;
|
||||
constexpr float SIREN_SLASH_LEAD = 0.1f;
|
||||
constexpr float SIREN_CARRIER_SPEED = 10;
|
||||
|
||||
// The teleport: she sinks, trailing black creep, paths 10 above her target at 2.5 (for 30 to 90 frames) and rises.
|
||||
// The teleport: she sinks, trailing black creep, paths 10 above her target at 2.5 (for 30 to 90 frames) and rises,
|
||||
// owing a lunge for 30 frames.
|
||||
constexpr float SIREN_TELEPORT_SPEED = 2.5f;
|
||||
constexpr float SIREN_TELEPORT_RISE = 10;
|
||||
constexpr float SIREN_TELEPORT_MARGIN = 5;
|
||||
constexpr int SIREN_TELEPORT_MIN = 30;
|
||||
constexpr int SIREN_TELEPORT_MAX = 90;
|
||||
constexpr int SIREN_TELEPORT_LUNGE = 30;
|
||||
constexpr float SIREN_TELEPORT_NEAR = 20;
|
||||
constexpr int SIREN_CREEP_FRAMES = 300;
|
||||
constexpr uint32_t SIREN_SINK_CREEP_ODDS = 3;
|
||||
@@ -362,12 +364,14 @@ static void siren_pick(Entity_NPC& npc)
|
||||
Vector topLeft = room.topLeftPos;
|
||||
Vector bottomRight = room.bottomRightPos;
|
||||
float middle = (bottomRight.y - topLeft.y) * HALF + topLeft.y;
|
||||
float right = std::clamp((npc.pos.x - (bottomRight.x - SIREN_EDGE)) / SIREN_EDGE, 0.0f, 1.0f);
|
||||
float left = std::clamp((npc.pos.x - (topLeft.x + SIREN_EDGE)) / -SIREN_EDGE, 0.0f, 1.0f);
|
||||
float rightStart = bottomRight.x - SIREN_EDGE;
|
||||
float leftStart = topLeft.x + SIREN_EDGE;
|
||||
float right = std::clamp((npc.pos.x - rightStart) / (bottomRight.x - rightStart), 0.0f, 1.0f);
|
||||
float left = std::clamp((npc.pos.x - leftStart) / (topLeft.x - leftStart), 0.0f, 1.0f);
|
||||
float bottom = std::clamp((npc.pos.y - middle) / (bottomRight.y - middle), 0.0f, 1.0f);
|
||||
add(SIREN_TELEPORT, (int)((bottom + 0 + left + 0 + right + 0) * SIREN_PICK_BASE));
|
||||
}
|
||||
if (!isTeleportWeighed || picker.outcomes.empty()) add(SIREN_IDLE, SIREN_PICK_BASE);
|
||||
if (charmed > 0 || picker.outcomes.empty()) add(SIREN_IDLE, SIREN_PICK_BASE);
|
||||
|
||||
RNG rng = RNG_DEFAULT;
|
||||
rng._seed = Random() | 1;
|
||||
@@ -540,7 +544,8 @@ static void siren_teleport_end_update(Entity_NPC& npc)
|
||||
if (!siren_is_anim_done(npc)) return;
|
||||
npc.state = SIREN_IDLE;
|
||||
npc.projectileCooldown = 0;
|
||||
npc.stateFrame = SIREN_IDLE_FRAMES;
|
||||
npc.stateFrame = 0;
|
||||
npc.projectileDelay = SIREN_TELEPORT_LUNGE;
|
||||
siren_cooldown_set(npc, SIREN_COOLDOWN_TELEPORT, SIREN_TELEPORT_WAIT);
|
||||
}
|
||||
|
||||
@@ -936,7 +941,7 @@ static void siren_remains_update(Entity_NPC& npc)
|
||||
}
|
||||
|
||||
// The carrier: while it flies its charmed line pulses, and past 15 frames a familiar out of the room or a wall breaks
|
||||
// it into a ring of shots that hurts the line.
|
||||
// it into a ring of shots that hurts the line's helpers.
|
||||
static void siren_carrier_update(Entity_NPC& npc)
|
||||
{
|
||||
if (npc.state == NPC_STATE_INIT)
|
||||
@@ -949,23 +954,23 @@ static void siren_carrier_update(Entity_NPC& npc)
|
||||
auto* siren = static_cast<Entity_NPC*>(npc.parent.get());
|
||||
if (!siren || !siren->IsType(ENTITY_SIREN, 0, -1)) return npc.Remove();
|
||||
|
||||
std::vector<Entity_Familiar*> line;
|
||||
std::vector<Entity*> line;
|
||||
for (Entity* helper : Entity_NPC::QueryNPCsType(ENTITY_SIREN_HELPER, -1))
|
||||
{
|
||||
if (helper->parent.get() != siren) continue;
|
||||
auto* familiar = static_cast<Entity_Familiar*>(helper->target.get());
|
||||
if (familiar && familiar->HasEntityFlags(FLAG_CHARM) && familiar->is_following() && familiar->player == siren->sirenPlayerEntity)
|
||||
line.push_back(familiar);
|
||||
line.push_back(helper);
|
||||
}
|
||||
if (line.empty()) return npc.Remove();
|
||||
|
||||
if (npc.GetIntervalTicks(SIREN_CARRY_PULSE_EVERY, 0) != 0)
|
||||
for (Entity_Familiar* familiar : line) familiar->SetColor(SIREN_CARRY_PULSE, SIREN_CARRY_PULSE_EVERY, 0, true, true);
|
||||
for (Entity* helper : line) helper->target->SetColor(SIREN_CARRY_PULSE, SIREN_CARRY_PULSE_EVERY, 0, true, true);
|
||||
Room& room = *g_game->room;
|
||||
if (npc.updateTime > SIREN_CARRY_ARMED)
|
||||
for (Entity_Familiar* familiar : line)
|
||||
for (Entity* helper : line)
|
||||
{
|
||||
if (room.IsPositionInRoom(familiar->pos, SIREN_CARRY_MARGIN)) continue;
|
||||
if (room.IsPositionInRoom(helper->target->pos, SIREN_CARRY_MARGIN)) continue;
|
||||
npc.isDead = true;
|
||||
break;
|
||||
}
|
||||
@@ -978,7 +983,7 @@ static void siren_carrier_update(Entity_NPC& npc)
|
||||
npc.FireProjectiles(clamped, vector_make(SIREN_CARRY_SHOT_SPEED, (float)(int)shots), PROJECTILES_RING, params);
|
||||
npc.pos = clamped;
|
||||
game_shake_screen(SIREN_CARRY_SHAKE);
|
||||
for (Entity_Familiar* familiar : line) familiar->TakeDamage(SIREN_CARRY_DAMAGE, 0, EntityRef(), SIREN_CARRY_COUNTDOWN);
|
||||
for (Entity* helper : line) helper->TakeDamage(SIREN_CARRY_DAMAGE, 0, EntityRef(), SIREN_CARRY_COUNTDOWN);
|
||||
siren->sirenPlayerEntity->ClearEntityFlags(FLAG_SPAWN_STICKY_SPIDERS);
|
||||
npc.Remove();
|
||||
}
|
||||
@@ -1019,6 +1024,8 @@ void siren_helper_update(Entity_NPC& npc)
|
||||
npc.pos = familiar->pos;
|
||||
npc.velocity = familiar->velocity;
|
||||
npc.friction = familiar->friction;
|
||||
npc.entityCollisionClass = familiar->entityCollisionClass != ENTCOLL_NONE ? ENTCOLL_PLAYEROBJECTS : ENTCOLL_NONE;
|
||||
npc.entityGridCollisionClass = familiar->entityGridCollisionClass;
|
||||
if (familiar->charmedCountdown < SIREN_CHARM_FRAMES)
|
||||
{
|
||||
familiar->AddEntityFlags(FLAG_CHARM);
|
||||
|
||||
+11
-6
@@ -361,15 +361,20 @@ static void shell_move(Entity_NPC& npc)
|
||||
bool isTrailing = npc.i2 == 0 && (!parent || parent->i2 == 0);
|
||||
if (isTrailing && !parent) shell_head_roll(npc);
|
||||
else if (!isTrailing && !parent && npc.child)
|
||||
npc.pathfinder.FindGridPath(npc.CalcTargetPosition(0), random_unit() * SHELL_PATH_SPEED_RANGE + SHELL_PATH_SPEED_MIN,
|
||||
SHELL_PATH_MARKER, DIRECT_PATH_FAR);
|
||||
{
|
||||
float speed = random_unit() * SHELL_PATH_SPEED_RANGE + SHELL_PATH_SPEED_MIN;
|
||||
npc.pathfinder.FindGridPath(npc.CalcTargetPosition(0), speed, SHELL_PATH_MARKER, DIRECT_PATH_FAR);
|
||||
}
|
||||
else if (!isTrailing && parent)
|
||||
{
|
||||
Vector away = vector_sub(npc.pos, parent->pos);
|
||||
float distance = vector_length(away);
|
||||
Vector back = vector_normalized(away);
|
||||
if (distance > SHELL_SLACK)
|
||||
npc.velocity = vector_sub(npc.velocity, vector_scale(vector_normalized(away),
|
||||
(distance - SHELL_SLACK) * SHELL_SLACK_PULL * npc.speedMultiplier));
|
||||
{
|
||||
npc.velocity.x = -back.x * (distance - SHELL_SLACK) * SHELL_SLACK_PULL * npc.speedMultiplier + npc.velocity.x;
|
||||
npc.velocity.y = -back.y * (distance - SHELL_SLACK) * SHELL_SLACK_PULL * npc.speedMultiplier + npc.velocity.y;
|
||||
}
|
||||
}
|
||||
segment_follow(npc, isTrailing ? SEGMENT_FOLLOW : SEGMENT_RECORD, TUFF_SEGMENT_GAP, npc.v1.x * SEGMENT_SPEED_SCALE);
|
||||
}
|
||||
@@ -515,8 +520,8 @@ static void twins_body_attack(Entity_NPC& npc)
|
||||
npc.PlaySound(SOUND_BLOODSHOOT, 1, 2, false, 1);
|
||||
Vector target = npc.GetPlayerTarget()->pos;
|
||||
if (vector_length(vector_sub(npc.pos, target)) > BODY_SHOT_REACH) target = {};
|
||||
npc.FireBossProjectiles((int)(Random() % BODY_SHOTS_RANGE) + BODY_SHOTS_MIN, target, BODY_SHOT_CURVE,
|
||||
ProjectileParams());
|
||||
ProjectileParams params;
|
||||
npc.FireBossProjectiles((int)(Random() % BODY_SHOTS_RANGE) + BODY_SHOTS_MIN, target, BODY_SHOT_CURVE, params);
|
||||
Entity* poof =
|
||||
g_game->Spawn({.position = npc.pos, .type = ENTITY_EFFECT, .variant = EFFECT_BULLET_POOF, .seed = Random()});
|
||||
poof->sprite.offset = vector_make(0, BODY_SHOT_POOF_RISE);
|
||||
|
||||
+11
-9
@@ -160,7 +160,7 @@ static void turdlet_init(Entity_NPC& npc)
|
||||
npc.splatColor = POOP_SPLAT_COLOR;
|
||||
npc.aiCallFlags = AI_CALL_PRE_UPDATE;
|
||||
npc.v2.y = npc.maxHitPoints * TURDLET_START_HEALTH;
|
||||
if (npc.parent) static_cast<Entity_NPC*>(npc.parent.get())->vectorDeque1.push_back(npc.pos);
|
||||
if (npc.parent) static_cast<Entity_NPC*>(npc.parent.get())->vectorDeque1.push_front(npc.pos);
|
||||
if (!npc.parent)
|
||||
for (Entity_NPC* segment = &npc; segment; segment = segment->ChildNPC()) segment->groupIdx = npc.index;
|
||||
for (auto* segment = static_cast<Entity_NPC*>(npc.GetLastParent()); segment; segment = segment->ChildNPC())
|
||||
@@ -225,8 +225,8 @@ static void turdlet_wind_up(Entity_NPC& npc)
|
||||
int count = 0;
|
||||
for (Entity* segment = &npc; segment; segment = segment->child.get(), count++)
|
||||
middle = vector_add(middle, segment->pos);
|
||||
middle = vector_scale(middle, 1 / (float)count);
|
||||
Vector velocity = vector_resized(vector_sub(npc.CalcTargetPosition(0), middle), TURDLET_CHARGE_SPEED);
|
||||
Vector mean = vector_div(middle, vector_make((float)count, (float)count));
|
||||
Vector velocity = vector_resized(vector_sub(npc.CalcTargetPosition(0), mean), TURDLET_CHARGE_SPEED);
|
||||
for (Entity_NPC* segment = &npc; segment; segment = segment->ChildNPC())
|
||||
{
|
||||
segment->sprite.PlayOverlay("HeadChargeLoopOverlay");
|
||||
@@ -244,9 +244,10 @@ static void turdlet_charge_follow(Entity_NPC& npc)
|
||||
Entity* child = npc.child.get();
|
||||
if (parent && child)
|
||||
{
|
||||
Vector middle = vector_scale(vector_add(vector_add(parent->prevPosition, parent->prevVelocity),
|
||||
vector_add(child->prevPosition, child->prevVelocity)),
|
||||
HALF);
|
||||
Vector middle = vector_scale(
|
||||
vector_add(vector_add(vector_add(parent->prevPosition, parent->prevVelocity), child->prevPosition),
|
||||
child->prevVelocity),
|
||||
HALF);
|
||||
npc.velocity = vector_add(
|
||||
vector_scale(vector_sub(vector_sub(middle, npc.pos), npc.velocity), TURDLET_FOLLOW_PULL), npc.velocity);
|
||||
return;
|
||||
@@ -271,7 +272,7 @@ static float turdlet_charge_carry(Entity_NPC& npc)
|
||||
int count = 0;
|
||||
for (Entity* segment = head; segment; segment = segment->child.get(), count++)
|
||||
middle = vector_add(middle, segment->prevPosition);
|
||||
middle = vector_scale(middle, 1 / (float)count);
|
||||
middle = vector_div(middle, vector_make((float)count, (float)count));
|
||||
|
||||
Vector push{};
|
||||
float spin = 0;
|
||||
@@ -283,7 +284,7 @@ static float turdlet_charge_carry(Entity_NPC& npc)
|
||||
spin += vector_dot(vector_rotated(vector_normalized(arm), RIGHT_ANGLE_DEGREES), segment->prevVelocity);
|
||||
}
|
||||
spin /= (float)count;
|
||||
push = vector_scale(push, 1 / (float)count);
|
||||
push = vector_div(push, vector_make((float)count, (float)count));
|
||||
|
||||
float fade = 1 - std::clamp((npc.v2.x - TURDLET_CHARGE_FADE_START) / TURDLET_CHARGE_FADE_SPAN, 0.0f, 1.0f);
|
||||
float pushMax = fade * TURDLET_CHARGE_PUSH;
|
||||
@@ -300,7 +301,8 @@ static float turdlet_charge_carry(Entity_NPC& npc)
|
||||
{
|
||||
float turn = std::clamp((spin <= 0 ? -spinMax : spinMax) - spin, -TURDLET_SPIN_STEP, TURDLET_SPIN_STEP);
|
||||
Vector arm = vector_rotated(vector_sub(npc.prevPosition, middle), RIGHT_ANGLE_DEGREES);
|
||||
npc.velocity = vector_add(vector_scale(arm, turn * TURDLET_SPIN_SHARE * npc.speedMultiplier), npc.velocity);
|
||||
npc.velocity.x = arm.x * turn * TURDLET_SPIN_SHARE * npc.speedMultiplier + npc.velocity.x;
|
||||
npc.velocity.y = arm.y * turn * TURDLET_SPIN_SHARE * npc.speedMultiplier + npc.velocity.y;
|
||||
}
|
||||
return speed;
|
||||
}
|
||||
|
||||
+13
-4
@@ -60,7 +60,7 @@ constexpr size_t WORMWOOD_TRAIL_MAX = 60;
|
||||
constexpr float SWIM_TURN = 1.6f;
|
||||
constexpr float SWIM_PIT_TURN = 1.2f;
|
||||
constexpr float SWIM_SINK_TURN = 5;
|
||||
constexpr float SWIM_SPEED_UP = 0.22f;
|
||||
constexpr float SWIM_SPEED_UP = 0.22000001f;
|
||||
constexpr float CHASE_SPEED_UP = 0.4f;
|
||||
constexpr float ENRAGED_SPEED_UP = 3;
|
||||
constexpr float ENRAGED_TURN = 6;
|
||||
@@ -375,9 +375,16 @@ static void wormwood_animate(Entity_NPC& npc)
|
||||
if (!npc.sprite.animState.animData || !npc.sprite.animState.isPlaying) npc.i1 = HEAD_OPEN;
|
||||
}
|
||||
|
||||
// A segment's place along the trail its leader left, 20 behind it, sinking or rising with it.
|
||||
// A segment's place along the trail its leader left, 20 behind it, sinking or rising with it. Without a trail it only
|
||||
// keeps sinking or rising.
|
||||
static void segment_trail_follow(Entity_NPC& npc, Entity_NPC& leader)
|
||||
{
|
||||
if (leader.vectorDeque1.empty())
|
||||
{
|
||||
npc.v1.y = npc.v1.x * npc.speedMultiplier + npc.v1.y;
|
||||
return;
|
||||
}
|
||||
|
||||
Vector point = leader.pos;
|
||||
float pointDepth = leader.v1.y;
|
||||
float walked = 0;
|
||||
@@ -537,7 +544,9 @@ static void crossing_start(Entity_NPC& npc)
|
||||
float forward = random_unit() * DUST_SPEED;
|
||||
float across = random_unit() * DUST_SPEED - DUST_SPEED / 2;
|
||||
Vector velocity = vector_make(out * forward + across * 0.0f, -out * across + forward * 0.0f);
|
||||
Vector place = vector_add(npc.targetPosition, vector_scale(random_direction(), random_unit() * DUST_SPREAD));
|
||||
Vector direction = random_direction();
|
||||
float spread = random_unit() * DUST_SPREAD;
|
||||
Vector place = vector_add(npc.targetPosition, vector_scale(direction, spread));
|
||||
dust_spawn({.origin = npc.pos, .side = vector_make(0, -out), .velocity = velocity}, seed, place);
|
||||
}
|
||||
game_particles_spawn({.position = npc.targetPosition,
|
||||
@@ -811,7 +820,7 @@ void boss_wormwood_update(Entity_NPC& npc)
|
||||
int ticks = npc_ticks_get(npc);
|
||||
if (npc.subtype != 0)
|
||||
{
|
||||
if (!npc.parent) npc.Kill(EntityRef());
|
||||
if (!npc.parent) return npc.Kill(EntityRef());
|
||||
if (npc.state != NPC_STATE_INIT)
|
||||
{
|
||||
wormwood_animate(npc);
|
||||
|
||||
@@ -66,7 +66,6 @@ constexpr int TEMPORARY_PULSE_PERIOD = 60;
|
||||
constexpr int TEMPORARY_PULSE_PEAK = 31;
|
||||
constexpr float TEMPORARY_PULSE_SCALE = 300;
|
||||
constexpr float TEMPORARY_PULSE_BASE = 0.4f;
|
||||
constexpr char WORD_SEPARATOR = ' ';
|
||||
|
||||
// An ARGB color as KColor::SetFromARGB unpacks it.
|
||||
static KColor color_get(uint32_t argb)
|
||||
|
||||
@@ -456,7 +456,10 @@ static void tiny_fly_update(Entity_Effect& fly)
|
||||
fly.AddVelocity_divided(vector_scale(pull, random_unit() * FLY_PULL), false);
|
||||
}
|
||||
if (fly.IsFrame(FLY_JITTER_FRAMES, (int)fly.index))
|
||||
fly.AddVelocity_divided(vector_scale(random_direction(), random_unit() * FLY_JITTER), false);
|
||||
{
|
||||
Vector direction = random_direction();
|
||||
fly.AddVelocity_divided(vector_scale(direction, random_unit() * FLY_JITTER), false);
|
||||
}
|
||||
if (distance < FLY_FLEE_RANGE)
|
||||
{
|
||||
float push = (1 - distance * distance / (FLY_FLEE_RANGE * FLY_FLEE_RANGE)) * FLY_FLEE_PUSH;
|
||||
@@ -1374,7 +1377,8 @@ static void liquid_poop_puddle_update(Entity_Effect& puddle)
|
||||
{
|
||||
uint32_t seed = Random();
|
||||
int subtype = random_below(2);
|
||||
Vector drift = vector_scale(vector_scale(random_direction(), random_unit()), LIQUID_POOP_GAS_SPEED);
|
||||
Vector direction = random_direction();
|
||||
Vector drift = vector_scale(vector_scale(direction, random_unit()), LIQUID_POOP_GAS_SPEED);
|
||||
auto* gas = static_cast<Entity_Effect*>(g_game->Spawn({.position = puddle.pos,
|
||||
.velocity = vector_add(puddle.velocity, drift),
|
||||
.subType = subtype,
|
||||
|
||||
@@ -374,7 +374,7 @@ static void dogma_orb_render(Entity_Effect& spot, const Vector& offset)
|
||||
{
|
||||
float spent = std::clamp(((float)spot.timeout - SPOT_GUIDE_LAST_FRAMES) / ((float)spot.lifespan - SPOT_GUIDE_LAST_FRAMES),
|
||||
0.0f, 1.0f);
|
||||
float fade = std::sqrt(1 - spent);
|
||||
float fade = pow_float(1 - spent, HALF);
|
||||
float fadeIn = std::min((float)(spot.lifespan - spot.timeout) / SPOT_GUIDE_FADE_IN, 1.0f);
|
||||
reach = fadeIn * fade * fade;
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ static void tech_dot_render(Entity_Effect& dot, const Vector& offset)
|
||||
else
|
||||
{
|
||||
float spent = ((float)dot.timeout - DOT_GUIDE_FRAMES) / ((float)dot.lifespan - DOT_GUIDE_FRAMES);
|
||||
fade = std::sqrt(1 - std::clamp(spent, 0.0f, 1.0f));
|
||||
fade = pow_float(1 - std::clamp(spent, 0.0f, 1.0f), HALF);
|
||||
}
|
||||
|
||||
Vector start = vector_add(dot.pos, dot.posOffset);
|
||||
@@ -648,8 +648,8 @@ static void chain_lightning_update(Entity_Effect& chain)
|
||||
Entity* next = chain_next_find(chain);
|
||||
if (next || chain.state == 1)
|
||||
{
|
||||
Vector jump = next ? vector_sub(next->pos, chain.pos)
|
||||
: vector_scale(vector_scale(random_direction(), random_unit()), chain.minRadius);
|
||||
Vector jump = next ? vector_sub(next->pos, chain.pos) : random_direction();
|
||||
if (!next) jump = vector_scale(vector_scale(jump, random_unit()), chain.minRadius);
|
||||
chain_laser_fire(chain, next, jump);
|
||||
}
|
||||
if (next)
|
||||
|
||||
@@ -1213,7 +1213,7 @@ bool Entity_Knife::held_update(Entity_Player* player)
|
||||
else
|
||||
{
|
||||
sprite.rotation = normalize_angle_degrees(vector_angle(vector_sub(tip, owner->pos)) - KNIFE_TURN_QUARTER);
|
||||
if (const AnimationFrame* frame = sprite.animState.GetLayerFrame(0))
|
||||
if (const NullFrame* frame = sprite.GetNullFrameById(0))
|
||||
{
|
||||
Vector facing = vector_from_angle(sprite.rotation);
|
||||
knifeDepthOffset = facing.x * frame->pos.y + facing.y * frame->pos.x;
|
||||
@@ -1506,7 +1506,7 @@ void Entity_Knife::held_item_update()
|
||||
velocity = vector_sub(vector_add(place, linkedKnife->pos), pos);
|
||||
displayRotation = rotation;
|
||||
sprite.rotation = rotation - KNIFE_TURN_QUARTER;
|
||||
if (const AnimationFrame* frame = sprite.animState.GetLayerFrame(0))
|
||||
if (const NullFrame* frame = sprite.GetNullFrameById(0))
|
||||
{
|
||||
Vector facing = vector_from_angle(sprite.rotation);
|
||||
knifeDepthOffset = facing.x * frame->pos.y + facing.y * frame->pos.x;
|
||||
@@ -1614,7 +1614,7 @@ void Entity_Knife::Render(const Vector& offset)
|
||||
|
||||
if (GetBaseVariant() == KNIFE_BONE_CLUB && subtype != KNIFE_SUBTYPE_HELD_ITEM && player && player->deadEyeCharges > 0)
|
||||
{
|
||||
const AnimationFrame* frame = sprite.animState.GetLayerFrame(0);
|
||||
const NullFrame* frame = sprite.GetNullFrameById(0);
|
||||
ColorMod mark = COLOR_DEFAULT;
|
||||
mark._tint[3] = (float)std::min((int)player->deadEyeCharges, DEAD_EYE_LEVELS) / DEAD_EYE_LEVELS;
|
||||
deadEyeSprite.color = mark;
|
||||
|
||||
+26
-20
@@ -170,7 +170,7 @@ void Entity_Laser::DoDamage(Entity* entity, float damage)
|
||||
roll._seed = entity->initSeed;
|
||||
if (roll.RandomFloat() < blackHpDropChance) damageFlags |= DAMAGE_SPAWN_BLACK_HEART;
|
||||
}
|
||||
if (isVersus && tearFlags[TEAR_LASERSHOT]) damageFlags |= DAMAGE_LASER;
|
||||
if (isVersus && tearFlags[TEAR_LASERSHOT]) damageFlags |= DAMAGE_THROUGH_COOLDOWN;
|
||||
entity->TakeDamage(damage, damageFlags, EntityRef(source), HIT_COUNTDOWN);
|
||||
}
|
||||
|
||||
@@ -207,8 +207,9 @@ bool Entity_Laser::damage_grid_entity(int gridIndex, const Vector& direction)
|
||||
return grid->Hurt(1, EntityRef(this));
|
||||
}
|
||||
|
||||
// 00970cb0 What the beam's path meets on the grid: the cells across its width (20 apart) it covers, hurt once each,
|
||||
// and the room's edge, nearest along the path (beyond it the last point inside, for a beam that leaves the room).
|
||||
// 00970cb0 What the beam's path meets on the grid: the cells of standing grid entities across its width (20 apart)
|
||||
// it covers, hurt once each, the first stopping it, and the room's edge, nearest along the path (beyond it the last
|
||||
// point inside, for a beam that leaves the room).
|
||||
// Every beam of the players' also hurts each grid entity within its width along its angle.
|
||||
void Entity_Laser::find_nearest_grid_hit(const Vector& offset)
|
||||
{
|
||||
@@ -225,24 +226,27 @@ void Entity_Laser::find_nearest_grid_hit(const Vector& offset)
|
||||
float travelled = 0;
|
||||
Vector last{};
|
||||
|
||||
// Records a point across the beam: past the room's side it stops a Continuum beam, inside it marks its cell.
|
||||
auto probe = [&](const Vector& point, const Vector& direction) {
|
||||
// Records a point across the beam: past the room's side it stops a Continuum beam, inside it marks the cell of
|
||||
// a standing grid entity, which stops the beam too. The stop is at the last sample, or on the far side at the
|
||||
// point itself.
|
||||
auto probe = [&](const Vector& point, const Vector& direction, const Vector& stop) {
|
||||
if (!room.IsPositionInRoom(point, ROOM_SIDE_MARGIN))
|
||||
{
|
||||
if (tearFlags[TEAR_CONTINUUM] && travelled < impactDistance)
|
||||
{
|
||||
impactDistance = travelled;
|
||||
impactPosition = previous;
|
||||
impactDirection = direction;
|
||||
}
|
||||
return;
|
||||
if (!tearFlags[TEAR_CONTINUUM]) return;
|
||||
}
|
||||
int column = (int)((point.x - GRID_ORIGIN_X) / GRID_CELL_SIZE + 0.5f);
|
||||
int row = (int)((point.y - GRID_ORIGIN_Y) / GRID_CELL_SIZE + 0.5f);
|
||||
int index = room.GetGridIndexByTile(column, row);
|
||||
uint32_t collision = index >= 0 ? room.GetGridCollision(index) : COLLISION_NONE;
|
||||
if (index >= 0 && collision != COLLISION_NONE && collision != COLLISION_PIT)
|
||||
else
|
||||
{
|
||||
int column = (int)((point.x - GRID_ORIGIN_X) / GRID_CELL_SIZE + 0.5f);
|
||||
int row = (int)((point.y - GRID_ORIGIN_Y) / GRID_CELL_SIZE + 0.5f);
|
||||
int index = room.GetGridIndexByTile(column, row);
|
||||
uint32_t collision = index >= 0 ? room.GetGridCollision(index) : COLLISION_NONE;
|
||||
if (index < 0 || collision == COLLISION_NONE || collision == COLLISION_PIT) return;
|
||||
crossed.try_emplace(index, direction);
|
||||
}
|
||||
if (travelled >= impactDistance) return;
|
||||
impactDistance = travelled;
|
||||
impactPosition = stop;
|
||||
impactDirection = direction;
|
||||
};
|
||||
|
||||
for (size_t i = 0; i <= count; i++)
|
||||
@@ -271,8 +275,9 @@ void Entity_Laser::find_nearest_grid_hit(const Vector& offset)
|
||||
}
|
||||
for (float width = 0; width < size; width += GRID_SWEEP_STEP)
|
||||
{
|
||||
probe(vector_add(point, vector_scale(side, width)), direction);
|
||||
if (width != 0) probe(vector_sub(point, vector_scale(side, width)), direction);
|
||||
probe(vector_add(point, vector_scale(side, width)), direction, previous);
|
||||
Vector far = vector_sub(point, vector_scale(side, width));
|
||||
if (width != 0) probe(far, direction, far);
|
||||
}
|
||||
travelled += length;
|
||||
previous = point;
|
||||
@@ -303,7 +308,8 @@ void Entity_Laser::find_nearest_grid_hit(const Vector& offset)
|
||||
(float)(index / room.gridWidth) * GRID_CELL_SIZE + GRID_ORIGIN_Y);
|
||||
Vector relative = vector_add(vector_sub(cell, pos), offset);
|
||||
float along = vector_dot(relative, direction);
|
||||
float across = relative.y * direction.x - relative.x * direction.y;
|
||||
// The original adds the cross terms, so off the axes it measures the width against the beam mirrored: kept.
|
||||
float across = relative.y * direction.x + relative.x * direction.y;
|
||||
if (std::abs(across) < size + GRID_REACH_EXTRA && along > 0 && along <= reach)
|
||||
damage_grid_entity(index, direction);
|
||||
}
|
||||
|
||||
+7
-14
@@ -187,14 +187,9 @@ constexpr int TYPE_NO_TICK_B = 275;
|
||||
|
||||
// The items and seeds whose effects the NPC update reads, by Lua id.
|
||||
constexpr int COLLECTIBLE_CHAMPION_BELT_ID = 208;
|
||||
constexpr int COLLECTIBLE_SOUL_ID = 335;
|
||||
constexpr int COLLECTIBLE_BETRAYAL_ID = 391;
|
||||
constexpr int COLLECTIBLE_SPIDER_MOD_ID = 403;
|
||||
constexpr int COLLECTIBLE_GUPPYS_EYE_ID = 665;
|
||||
constexpr int TRINKET_SUPER_MAGNET_ID = 68;
|
||||
constexpr int TRINKET_ICE_CUBE_ID = 188;
|
||||
constexpr int ROOM_TRINKET_STATUS_FRAMES = -90;
|
||||
constexpr int NULLITEM_DAMOCLES_WEAKNESS = 64;
|
||||
|
||||
constexpr int ACHIEVEMENT_BOSS_COLORS = 3;
|
||||
constexpr int ACHIEVEMENT_MORE_BOSS_COLORS = 33;
|
||||
@@ -1638,7 +1633,8 @@ void Entity_NPC::midas_coins_spawn()
|
||||
for (int i = 0; i < coins; i++)
|
||||
{
|
||||
uint32_t seed = Random();
|
||||
Vector speed = vector_scale(random_direction(), random_unit() * MIDAS_COIN_SPEED);
|
||||
Vector direction = random_direction();
|
||||
Vector speed = vector_scale(direction, random_unit() * MIDAS_COIN_SPEED);
|
||||
g_game->Spawn({.position = pos,
|
||||
.velocity = speed,
|
||||
.subType = COIN_PENNY,
|
||||
@@ -1672,9 +1668,6 @@ void Entity_NPC::player_aura_update()
|
||||
constexpr float AURA_REACH_SQUARED = 1e9f;
|
||||
constexpr float SUPER_MAGNET_PULL = 0.5f;
|
||||
constexpr int AURA_ODDS = 3;
|
||||
constexpr float SALVATION_HALO_RADIUS = 70;
|
||||
constexpr int SALVATION_BEAM_SUBTYPE = 3;
|
||||
constexpr float SALVATION_BEAM_DAMAGE = 3.5f;
|
||||
if (state == NPC_STATE_DEATH || state == NPC_STATE_UNIQUE_DEATH || IsFriendly() || !IsVulnerableEnemy(nullptr))
|
||||
return;
|
||||
|
||||
@@ -1686,8 +1679,8 @@ void Entity_NPC::player_aura_update()
|
||||
float salvationDistance = AURA_REACH_SQUARED;
|
||||
for (Entity_Player* player : g_game->playerManager.playerList)
|
||||
{
|
||||
bool isSoul = player->HasCollectible(COLLECTIBLE_SOUL_ID);
|
||||
bool isMagnet = player->HasTrinket(TRINKET_SUPER_MAGNET_ID);
|
||||
bool isSoul = player->HasCollectible(COLLECTIBLE_SOUL);
|
||||
bool isMagnet = player->HasTrinket(TRINKET_SUPER_MAGNET);
|
||||
bool isSalvation = player->HasCollectible(COLLECTIBLE_SALVATION);
|
||||
if (!isSoul && !isMagnet && !isSalvation) continue;
|
||||
|
||||
@@ -1867,7 +1860,7 @@ void Entity_NPC::Update()
|
||||
}
|
||||
if (HasEntityFlags(FLAG_ICE_FROZEN)) return update_frozen();
|
||||
|
||||
bool isWeakened = g_game->room->temporaryEffects.HasNullEffect(NULLITEM_DAMOCLES_WEAKNESS);
|
||||
bool isWeakened = g_game->room->temporaryEffects.HasNullEffect(NULLITEM_REVERSE_STRENGTH);
|
||||
if (IsFrame(WEAKNESS_FRAMES, 0) && !IsFriendly() && IsActiveEnemy(DEAD_EXCLUDED) && isWeakened)
|
||||
AddWeakness(EntityRef(nullptr), -3);
|
||||
if (salvationTarget && salvationTarget->target.get() == this)
|
||||
@@ -2219,7 +2212,7 @@ bool Entity_NPC::TakeDamage(float damage, uint64_t damageFlags, const EntityRef&
|
||||
if (!IsFriendly() && isPlayerSource) g_game->room->isPacifist = false;
|
||||
|
||||
PlayerManager& players = g_game->playerManager;
|
||||
if (source.entity && players.FirstCollectibleOwner(COLLECTIBLE_BETRAYAL_ID, LAZARUS_SHARE_CHECK)) betrayal_turn(source.entity);
|
||||
if (source.entity && players.FirstCollectibleOwner(COLLECTIBLE_BETRAYAL, LAZARUS_SHARE_CHECK)) betrayal_turn(source.entity);
|
||||
if (players.FirstCollectibleOwner(COLLECTIBLE_JAR_OF_FLIES, LAZARUS_SHARE_CHECK))
|
||||
{
|
||||
bool isBlueFly = source.type == ENTITY_FAMILIAR && source.variant == Entity_Familiar::BLUE_FLY;
|
||||
@@ -3684,7 +3677,7 @@ bool Entity_NPC::split(float damage, const EntityRef& source, bool isPlaySound)
|
||||
void Entity_NPC::UpdatePickupGhosts()
|
||||
{
|
||||
bool isLootHolder = (type == ENTITY_FIREPLACE && health > 1) || (type == ENTITY_SHOPKEEPER && !isDead);
|
||||
if (isLootHolder && g_game->playerManager.FirstCollectibleOwner(COLLECTIBLE_GUPPYS_EYE_ID, LAZARUS_SHARE_CHECK))
|
||||
if (isLootHolder && g_game->playerManager.FirstCollectibleOwner(COLLECTIBLE_GUPPYS_EYE, LAZARUS_SHARE_CHECK))
|
||||
{
|
||||
LootList loot = type == ENTITY_FIREPLACE ? fireplace_get_loot(false) : LootList{shopkeeper_loot_get(*this, false)};
|
||||
if (!loot.entries.empty())
|
||||
|
||||
@@ -207,13 +207,15 @@ void segment_follow(Entity_NPC& npc, SegmentMode mode, float distance, float max
|
||||
if (trail.size() > SEGMENT_HISTORY) trail.resize(SEGMENT_HISTORY);
|
||||
}
|
||||
|
||||
// 006d0dd0 The NPCs of a group, in update order.
|
||||
// 006d0dd0 The NPCs of a group, in update order. A versus player passes the enemy check but is no NPC.
|
||||
std::vector<Entity_NPC*> Entity_NPC::QueryNPCsGroup(int groupIdx)
|
||||
{
|
||||
std::vector<Entity_NPC*> group;
|
||||
for (Entity* entity : g_game->room->entityList.updateEL)
|
||||
if (Entity::is_enemy_type(entity->type) && static_cast<Entity_NPC*>(entity)->groupIdx == groupIdx)
|
||||
group.push_back(static_cast<Entity_NPC*>(entity));
|
||||
{
|
||||
auto* npc = Entity::is_enemy_type(entity->type) ? dynamic_cast<Entity_NPC*>(entity) : nullptr;
|
||||
if (npc && npc->groupIdx == groupIdx) group.push_back(npc);
|
||||
}
|
||||
return group;
|
||||
}
|
||||
|
||||
|
||||
+15
-11
@@ -50,7 +50,6 @@ constexpr int WORMWOOD = 3;
|
||||
constexpr int BIG_BONY_BONE = 10;
|
||||
constexpr int SHELL = 3;
|
||||
constexpr int RIDDEN_MINECART = 10;
|
||||
constexpr int SINGE_BALL_VARIANT = 1;
|
||||
constexpr int HEART_PAIRED = 1;
|
||||
|
||||
// The ghost wraith's faintness without water to reflect it.
|
||||
@@ -104,7 +103,7 @@ static Vector npc_screen_position(const Vector& world, const Vector& offset)
|
||||
static const float* npc_height_speed(Entity_NPC& npc)
|
||||
{
|
||||
if (is_type(npc, ENTITY_PIN, WORMWOOD)) return &npc.v1.x;
|
||||
if (is_type(npc, ENTITY_SINGE, SINGE_BALL_VARIANT) || is_type(npc, ENTITY_BIG_BONY, BIG_BONY_BONE)) return &npc.v1.y;
|
||||
if (is_type(npc, ENTITY_SINGE, SINGE_BALL) || is_type(npc, ENTITY_BIG_BONY, BIG_BONY_BONE)) return &npc.v1.y;
|
||||
|
||||
bool isJumper = npc.type == ENTITY_NEEDLE || npc.type == ENTITY_FISSURE || is_type(npc, ENTITY_GUTTED_FATTY, FESTERING_GUTS);
|
||||
return isJumper && npc.state == NPC_STATE_JUMP ? &npc.v1.x : nullptr;
|
||||
@@ -178,7 +177,8 @@ static void needle_render(Entity_NPC& npc)
|
||||
for (int segment = 0; segment < NEEDLE_SEGMENTS; segment++)
|
||||
{
|
||||
LayerState* layer = npc.sprite.GetLayer(segment + 1);
|
||||
Vector shift = vector_make(points[segment].x - npc.pos.x, points[segment].y - npc.pos.y + heights[segment] - lift);
|
||||
Vector shift =
|
||||
vector_make(points[segment].x - npc.pos.x, points[segment].y - npc.pos.y + (heights[segment] - lift));
|
||||
layer->pos = vector_scale(shift, NPC_SCREEN_SCALE);
|
||||
layer->isVisible = heights[segment] <= NEEDLE_HIDE_DEPTH - (float)(segment + 1) * NEEDLE_HIDE_STEP;
|
||||
}
|
||||
@@ -204,7 +204,7 @@ static float wraith_alpha_get(RenderMode renderMode)
|
||||
// The Lamb's dash: afterimages trailing back along its velocity, fading out, then a faint copy over it.
|
||||
static void lamb_afterimages_render(Entity_NPC& npc, const Vector& offset)
|
||||
{
|
||||
Vector step = vector_scale(npc.velocity, -LAMB_AFTERIMAGE_REACH / LAMB_AFTERIMAGES);
|
||||
Vector step = vector_scale(vector_scale(npc.velocity, LAMB_AFTERIMAGE_REACH), -1.0f / LAMB_AFTERIMAGES);
|
||||
Vector at = npc.pos;
|
||||
ColorMod color = npc.sprite.color;
|
||||
|
||||
@@ -246,7 +246,7 @@ static void minecart_riders_render(Entity_NPC& cart, const Vector& offset)
|
||||
static void poop_rider_render(Entity_NPC& npc, const Vector& offset)
|
||||
{
|
||||
Entity* rider = npc.entityRef;
|
||||
Vector shift = vector_sub(vector_add(npc.pos, npc.posOffset), vector_add(rider->pos, rider->posOffset));
|
||||
Vector shift = vector_sub(vector_sub(vector_add(npc.pos, npc.posOffset), rider->pos), rider->posOffset);
|
||||
|
||||
rider->isVisible = true;
|
||||
rider->Render(vector_add(offset, vector_scale(shift, NPC_SCREEN_SCALE)));
|
||||
@@ -336,7 +336,7 @@ static void health_bar_render(Entity_NPC& npc, const Vector& position)
|
||||
|
||||
float stage = (float)game.stage_depth_get();
|
||||
float toughness = npc.maxHitPoints / (stage + stage + HEALTH_BAR_STAGE_BASE);
|
||||
float width = std::floor((std::log10(toughness) + 1) * HEALTH_BAR_WIDTH_PER_DECADE + 0.5f);
|
||||
float width = std::floor(((float)std::log10((double)toughness) + 1) * HEALTH_BAR_WIDTH_PER_DECADE + 0.5f);
|
||||
width = std::clamp(width, HEALTH_BAR_WIDTH_MIN, HEALTH_BAR_WIDTH_MAX);
|
||||
float left = position.x - width * 0.5f;
|
||||
float top = position.y - HEALTH_BAR_CAP;
|
||||
@@ -346,7 +346,8 @@ static void health_bar_render(Entity_NPC& npc, const Vector& position)
|
||||
image.Render(source, KAGE::Graphics::color_quad_rect(at, drawn, white), color);
|
||||
};
|
||||
Vector capSize = vector_make(HEALTH_BAR_CAP, HEALTH_BAR_HEIGHT);
|
||||
piece(vector_make(0, 0), capSize, vector_make(left - HEALTH_BAR_CAP, top), capSize, white);
|
||||
Vector leftCap = vector_make(-width * 0.5f - HEALTH_BAR_CAP + position.x, top);
|
||||
piece(vector_make(0, 0), capSize, leftCap, capSize, white);
|
||||
Vector rightCap = vector_make(HEALTH_BAR_CAP + HEALTH_BAR_MIDDLE, 0);
|
||||
piece(rightCap, capSize, vector_make(position.x + width * 0.5f, top), capSize, white);
|
||||
piece(vector_make(HEALTH_BAR_CAP, 0), vector_make(HEALTH_BAR_MIDDLE, HEALTH_BAR_HEIGHT), vector_make(left, top),
|
||||
@@ -566,8 +567,9 @@ static std::vector<CordPoint> cord_points_get(Entity_NPC& npc, const Vector& off
|
||||
std::vector<CordPoint> cord = {{screen.front(), 0}};
|
||||
for (size_t i = 1; i + 1 < screen.size(); i++)
|
||||
{
|
||||
Vector smoothed = vector_add(vector_scale(screen[i], CORD_SMOOTH_MIDDLE),
|
||||
vector_scale(vector_add(screen[i - 1], screen[i + 1]), CORD_SMOOTH_SIDE));
|
||||
Vector smoothed = vector_make(
|
||||
screen[i].x * CORD_SMOOTH_MIDDLE + screen[i - 1].x * CORD_SMOOTH_SIDE + screen[i + 1].x * CORD_SMOOTH_SIDE,
|
||||
screen[i - 1].y * CORD_SMOOTH_SIDE + screen[i].y * CORD_SMOOTH_MIDDLE + screen[i + 1].y * CORD_SMOOTH_SIDE);
|
||||
cord.push_back({smoothed, cord.back().length + vector_length(vector_sub(cord.back().pos, smoothed))});
|
||||
}
|
||||
cord.push_back({screen.back(), cord.back().length + vector_length(vector_sub(cord.back().pos, screen.back()))});
|
||||
@@ -647,8 +649,10 @@ void Entity_NPC::RenderSegmentLink(const Vector& offset, bool isShadow)
|
||||
|
||||
Vector start = vector_add(render_position_get(pos, RENDER_SNAPPED), offset);
|
||||
Vector end = vector_add(render_position_get(next->pos, RENDER_SNAPPED), offset);
|
||||
start.y -= i2 == 0 ? LINK_INSET + LINK_SHELL_RAISE : LINK_INSET;
|
||||
end.y -= next->i2 == 0 ? LINK_INSET + LINK_SHELL_RAISE : LINK_INSET;
|
||||
start.y -= LINK_INSET;
|
||||
end.y -= LINK_INSET;
|
||||
if (i2 == 0) start.y -= LINK_SHELL_RAISE;
|
||||
if (next->i2 == 0) end.y -= LINK_SHELL_RAISE;
|
||||
|
||||
Vector span = vector_sub(end, start);
|
||||
float distance = vector_length(span);
|
||||
|
||||
@@ -90,7 +90,6 @@ constexpr float CANTRIPPED_CARD_SPEED = 3;
|
||||
constexpr std::array<uint32_t, 3> MAGDALENE_HEART_SHIFTS = {7, 17, 21};
|
||||
constexpr std::array<uint32_t, 3> KEEPER_COIN_SHIFTS = {9, 11, 19};
|
||||
constexpr std::array<uint32_t, 3> KEEPER_REVISIT_SHIFTS = {13, 5, 19};
|
||||
constexpr int NULL_ITEM_TEMPORARY_HEARTS = 114;
|
||||
constexpr float DROP_SPEED_MIN = 2;
|
||||
constexpr float DROP_SPEED_RANGE = 3;
|
||||
constexpr int DROP_TIMEOUT = 60;
|
||||
@@ -499,7 +498,7 @@ static void kill_item_rewards(Entity_NPC& npc)
|
||||
static void magdalene_hearts_drop(Entity_NPC& npc)
|
||||
{
|
||||
PlayerManager& players = g_game->playerManager;
|
||||
bool isBlessed = players.HasTemporaryEffect(g_manager->itemConfig.GetNullItem(NULL_ITEM_TEMPORARY_HEARTS));
|
||||
bool isBlessed = players.HasTemporaryEffect(g_manager->itemConfig.GetNullItem(NULLITEM_SOUL_MAGDALENE));
|
||||
bool isMagdalene = std::ranges::any_of(players.playerList,
|
||||
[](Entity_Player* player)
|
||||
{
|
||||
|
||||
@@ -47,14 +47,11 @@ constexpr int COLLECTIBLE_MAGNETO = 53;
|
||||
constexpr int COLLECTIBLE_HUMBLEING_BUNDLE = 203;
|
||||
constexpr int COLLECTIBLE_BOGO_BOMBS = 250;
|
||||
constexpr int COLLECTIBLE_MAGGYS_BOW = 312;
|
||||
constexpr int COLLECTIBLE_SACK_HEAD = 424;
|
||||
constexpr int COLLECTIBLE_GUPPYS_EYE = 665;
|
||||
constexpr float OPTIONS_POOF_DROP = 10;
|
||||
constexpr int OPTIONS_ITEM_TIMEOUT = 4;
|
||||
constexpr int TRINKET_BROKEN_MAGNET = 6;
|
||||
constexpr int TRINKET_BIBLE_TRACT = 18;
|
||||
constexpr int TRINKET_MOMS_PEARL = 38;
|
||||
constexpr int TRINKET_SUPER_MAGNET = 68;
|
||||
constexpr float VERSUS_CHEST_VOLUME = 0.7f;
|
||||
constexpr int TRINKET_APPLE_OF_SODOM = 140;
|
||||
constexpr int TRINKET_NUH_UH = 165;
|
||||
@@ -2119,8 +2116,8 @@ bool Entity_Pickup::HandleCollision(Entity* collider, bool isLow)
|
||||
// A golden penny taken comes back somewhere in the room, less likely each time (0.98 to the times it came back).
|
||||
static void golden_penny_return(Entity_Pickup& penny)
|
||||
{
|
||||
constexpr double RETURN_DECAY = 0.98;
|
||||
float chance = (float)std::pow(RETURN_DECAY, (double)penny.varData);
|
||||
constexpr float RETURN_DECAY = 0.98f;
|
||||
float chance = pow_float(RETURN_DECAY, (float)penny.varData);
|
||||
if (penny.dropRNG.RandomFloat() > chance) return;
|
||||
|
||||
Room& room = *g_game->room;
|
||||
|
||||
+14
-9
@@ -334,6 +334,8 @@ void Entity_Player::stats_reset()
|
||||
markedTarget = nullptr;
|
||||
heldEntity = nullptr;
|
||||
tractorBeam = 0;
|
||||
yesMotherKnife = nullptr;
|
||||
circleOfProtection = nullptr;
|
||||
shootHeldFrames = 0;
|
||||
azazelsRageLaser = nullptr;
|
||||
shootDirectionHistory.clear();
|
||||
@@ -1614,8 +1616,9 @@ template <typename Link> static void link_release(Link& link, bool isRemoveEntit
|
||||
link = nullptr;
|
||||
}
|
||||
|
||||
// 00757ac0 Lets go of the weapons, then of the effects the player spawned (removed when asked), the held entity (thrown
|
||||
// on removal) and, unless it is being replaced, its stored helper players and its twin, removing its co-op players.
|
||||
// 00757ac0 Lets go of the weapons, then of the effects the player spawned (removed when asked, all but Salvation's tether),
|
||||
// the held entity (thrown on removal) and, unless it is being replaced, its stored helper players and its twin,
|
||||
// removing its co-op players. The original also clears two links nothing sets (0x1420, 0x144c).
|
||||
void Entity_Player::release_weapons_and_effects(bool isRemoveEntities)
|
||||
{
|
||||
for (size_t slot = 1; slot <= weapons.size(); slot++)
|
||||
@@ -1625,31 +1628,33 @@ void Entity_Player::release_weapons_and_effects(bool isRemoveEntities)
|
||||
weapon.reset();
|
||||
}
|
||||
link_release(ladder, isRemoveEntities);
|
||||
link_release(azazelsRageLaser, isRemoveEntities);
|
||||
link_release(trinityShield, isRemoveEntities);
|
||||
link_release(spearOfDestiny, isRemoveEntities);
|
||||
link_release(tractorBeam, isRemoveEntities);
|
||||
link_release(yesMotherKnife, isRemoveEntities);
|
||||
link_release(babyFamiliar, isRemoveEntities);
|
||||
link_release(deadToothRing, isRemoveEntities);
|
||||
link_release(dadsRingAura, isRemoveEntities);
|
||||
link_release(telekinesisHalo, isRemoveEntities);
|
||||
link_release(breathOfLifeEffect, isRemoveEntities);
|
||||
link_release(isaacsHeart, isRemoveEntities);
|
||||
link_release(trinityShield, isRemoveEntities);
|
||||
link_release(deadToothRing, isRemoveEntities);
|
||||
link_release(redemptionEffect, isRemoveEntities);
|
||||
link_release(bestFriend, isRemoveEntities);
|
||||
link_release(circleOfProtection, isRemoveEntities);
|
||||
link_release(megaBlastLaser, isRemoveEntities);
|
||||
link_release(markedTarget, isRemoveEntities);
|
||||
link_release(forgottenBody, isRemoveEntities);
|
||||
link_release(monstranceAura, isRemoveEntities);
|
||||
link_release(babyFamiliar, isRemoveEntities);
|
||||
link_release(saturnusRing, isRemoveEntities);
|
||||
link_release(salvationEffect, isRemoveEntities);
|
||||
link_release(darkArtsAura, isRemoveEntities);
|
||||
link_release(tetheredEffect, isRemoveEntities);
|
||||
link_release(astralProjectionBody, isRemoveEntities);
|
||||
link_release(azazelsRageLaser, isRemoveEntities);
|
||||
link_release(montezumaLaser, isRemoveEntities);
|
||||
link_release(spearOfDestiny, isRemoveEntities);
|
||||
link_release(redemptionEffect, isRemoveEntities);
|
||||
link_release(divineShield, isRemoveEntities);
|
||||
link_release(darkArtsLastSnare, isRemoveEntities);
|
||||
link_release(darkEsau, isRemoveEntities);
|
||||
tetheredEffect = nullptr;
|
||||
moveToTarget = {};
|
||||
if (isRemoveEntities) ThrowHeldEntity(vector_make(velocity.x * HELD_RELEASE_SPEED, velocity.y * HELD_RELEASE_SPEED));
|
||||
heldEntity = nullptr;
|
||||
|
||||
@@ -28,6 +28,8 @@ constexpr int COOP_BABY_BUFF_COUNT = 8;
|
||||
constexpr int DELAYED_SFX_FRAMES = 2;
|
||||
// The directions Ybab's aim axes are dealt from: right, left, down and up.
|
||||
constexpr int AIM_AXIS_COUNT = 4;
|
||||
// The creep spots Black Powder's trail remembers, oldest first, to find a closed circle in.
|
||||
constexpr int BLACK_POWDER_TRAIL_SIZE = 96;
|
||||
|
||||
// The buffs the co-op baby skins Rage to Brown give every player (coopBabyBuffTimers), in skin order.
|
||||
enum CoopBabyBuff
|
||||
@@ -65,6 +67,10 @@ constexpr int DAEMONS_TAIL_HEART_ODDS = 5;
|
||||
constexpr uint32_t LUCKY_TOE_ODDS = 3;
|
||||
constexpr uint32_t CARD_ITEM_FLAG = 0x8000;
|
||||
constexpr int DEAD_CAT_LIVES = 9;
|
||||
// Salvation's halo reach, and the Crack the Sky beam it holds over an enemy or a versus rival.
|
||||
constexpr float SALVATION_HALO_RADIUS = 70;
|
||||
constexpr int SALVATION_BEAM_SUBTYPE = 3;
|
||||
constexpr float SALVATION_BEAM_DAMAGE = 3.5f;
|
||||
|
||||
// Tainted Jacob's curse: its generator's shift, and the delays before Dark Esau charges, after a floor starts and
|
||||
// after becoming Tainted Jacob, in steps of a second after a least.
|
||||
@@ -797,6 +803,10 @@ enum PlayerItemId : int
|
||||
COLLECTIBLE_REMOTE_DETONATOR = 137,
|
||||
COLLECTIBLE_EVES_MASCARA = 310,
|
||||
COLLECTIBLE_SPIRIT_SWORD = 579,
|
||||
COLLECTIBLE_BETRAYAL = 391,
|
||||
COLLECTIBLE_SACK_HEAD = 424,
|
||||
COLLECTIBLE_GUPPYS_EYE = 665,
|
||||
COLLECTIBLE_GLASS_EYE = 730,
|
||||
TRINKET_POOL_SHIFT = 2,
|
||||
TRINKET_PETRIFIED_POOP = 2,
|
||||
TRINKET_PURPLE_HEART = 5,
|
||||
@@ -942,6 +952,11 @@ enum PlayerItemId : int
|
||||
TRINKET_TORN_CARD = 157,
|
||||
TRINKET_EXPANSION_PACK = 181,
|
||||
TRINKET_ENDLESS_NAMELESS = 79,
|
||||
TRINKET_PINKY_EYE = 30,
|
||||
TRINKET_PUSH_PIN = 31,
|
||||
TRINKET_SUPER_MAGNET = 68,
|
||||
TRINKET_DINGLE_BERRY = 163,
|
||||
TRINKET_ISAACS_HEAD = 54,
|
||||
|
||||
NULLITEM_EXPLOSIVE_DIARRHEA = 0,
|
||||
NULLITEM_STATUE = 4,
|
||||
@@ -1666,6 +1681,7 @@ public:
|
||||
EntityPtr babyFamiliar;
|
||||
EntityPtr bestFriend;
|
||||
EntityPtr breathOfLifeEffect;
|
||||
EntityPtr circleOfProtection;
|
||||
EntityPtr dadsRingAura;
|
||||
EntityPtr darkArtsAura;
|
||||
EntityPtr divineShield;
|
||||
@@ -1682,6 +1698,7 @@ public:
|
||||
EntityPtr tractorBeam;
|
||||
EntityPtr trinityShield;
|
||||
EntityPtr twinPlayer;
|
||||
EntityPtr yesMotherKnife;
|
||||
Entity_Player* backupPlayer = nullptr;
|
||||
Entity_Player* replacedPlayer = nullptr;
|
||||
Entity_Player* subPlayer = nullptr;
|
||||
@@ -1711,6 +1728,7 @@ public:
|
||||
bool isGlitchBaby = false;
|
||||
bool isHeldEntityVisible = false;
|
||||
|
||||
std::array<EntityPtr, BLACK_POWDER_TRAIL_SIZE> blackPowderTrail;
|
||||
std::array<int, COOP_BABY_BUFF_COUNT> coopBabyBuffTimers{};
|
||||
std::array<Vector, AIM_AXIS_COUNT> mirroredAimAxes{};
|
||||
float darkArtsDamage = 0;
|
||||
@@ -1729,6 +1747,9 @@ public:
|
||||
uint32_t montezumaChargeTimer = 0;
|
||||
uint32_t revelationChargeTimer = 0;
|
||||
uint32_t vampireCharmKills = 0;
|
||||
int blackPowderCooldown = 0;
|
||||
int blackPowderHead = 0;
|
||||
int blackPowderTail = 0;
|
||||
int bladderCharge = 0;
|
||||
int bleedOutHealth = 0;
|
||||
int cambionConceptionState = 0;
|
||||
|
||||
@@ -967,7 +967,8 @@ static void flush_npc(ItemUse& use, Entity_NPC& npc)
|
||||
for (int i = 0; i < dips; i++)
|
||||
{
|
||||
uint32_t seed = Random();
|
||||
Vector offset = vector_scale(vector_scale(random_direction(), random_unit()), npc.size);
|
||||
Vector direction = random_direction();
|
||||
Vector offset = vector_scale(vector_scale(direction, random_unit()), npc.size);
|
||||
g_game->Spawn({.position = vector_add(npc.pos, offset), .spawner = &player, .type = ENTITY_DIP,
|
||||
.variant = isCorny ? DIP_CORNY : 0, .seed = seed});
|
||||
}
|
||||
|
||||
@@ -1353,11 +1353,7 @@ static void r_key_restart(Entity_Effect*)
|
||||
game.playerManager.roomTransitionPlayer = nullptr;
|
||||
}
|
||||
}
|
||||
for (Entity_Player* player : game.playerManager.playerList)
|
||||
{
|
||||
if (player->IsHoldingItem()) player->heldSprite.Reset();
|
||||
player->queuedItem = {};
|
||||
}
|
||||
for (Entity_Player* player : game.playerManager.playerList) player->ClearQueueItem();
|
||||
game.fadeInColor = kcolor_rgba(0, 0, 0, game.isInstantFadeIn ? INSTANT_FADE_ALPHA : 1);
|
||||
game.fadeSpeed = R_KEY_FADE_SPEED;
|
||||
game.isFadeInIconShown = true;
|
||||
|
||||
@@ -31,8 +31,6 @@ constexpr int BLOOD_CHARGE_CONSUMABLE = 0x100;
|
||||
constexpr int WHORE_OF_BABYLON_RED_HEARTS = 1;
|
||||
constexpr int EVE_WHORE_OF_BABYLON_RED_HEARTS = 2;
|
||||
constexpr int DEATHMATCH_WHORE_RED_HEARTS = 16;
|
||||
constexpr int NULLITEM_SLOW_A = 62;
|
||||
constexpr int NULLITEM_SLOW_B = 65;
|
||||
constexpr float AZAZELS_STUMP_DAMAGE_SCALE = 1.5f;
|
||||
// The shift Esau's share of Jacob's hearts and items is rolled with, from Clicker's seed.
|
||||
constexpr uint32_t ESAU_SPLIT_RNG_SHIFT = 59;
|
||||
@@ -259,7 +257,7 @@ bool is_character_slowed(Entity_Player& player)
|
||||
{
|
||||
TemporaryEffects& effects = player.temporaryEffects;
|
||||
bool isFaster = player.playerType >= PLAYER_TYPE_COUNT || speed_table_get(player) >= 0;
|
||||
return isFaster && (effects.HasNullEffect(NULLITEM_SLOW_A) || effects.HasNullEffect(NULLITEM_SLOW_B));
|
||||
return isFaster && (effects.HasNullEffect(NULLITEM_REVERSE_EMPRESS) || effects.HasNullEffect(NULLITEM_REVERSE_HANGED_MAN));
|
||||
}
|
||||
|
||||
// The UpdateCostumes part (0075bf00) that redraws the player's head and body in the skin colors its costumes left it:
|
||||
@@ -1117,7 +1115,7 @@ static void maggy_health_drain(Entity_Player& player)
|
||||
|
||||
// The bleeding part of 00794e50: with Anemic's effect, bleeding out from her own wound, or while Tainted Magdalene's
|
||||
// health drains, one frame in five drops a small spot of red creep.
|
||||
static void blood_drip_update(Entity_Player& player)
|
||||
void blood_drip_update(Entity_Player& player)
|
||||
{
|
||||
bool isBleeding = player.temporaryEffects.HasCollectibleEffect(COLLECTIBLE_ANEMIC) ||
|
||||
(player.HasEntityFlags(FLAG_BLEED_OUT) && player.bleedSource.entity == &player) ||
|
||||
@@ -1172,7 +1170,7 @@ float damage_charge_scale()
|
||||
|
||||
// The Berserk! charge part of 00794e50: out of Berserk!, the damage dealt this frame charges Tainted Samson's
|
||||
// berserk bar and any Berserk! held in an active slot.
|
||||
static void berserk_charge_update(Entity_Player& player)
|
||||
void berserk_charge_update(Entity_Player& player)
|
||||
{
|
||||
bool isCharging = player.HasCollectible(COLLECTIBLE_BERSERK) || player.playerType == PLAYER_SAMSON_B;
|
||||
if (!isCharging || player.temporaryEffects.HasCollectibleEffect(COLLECTIBLE_BERSERK)) return;
|
||||
@@ -1186,14 +1184,11 @@ static void berserk_charge_update(Entity_Player& player)
|
||||
charge -= player.AddActiveCharge(charge, slot, false, false, true);
|
||||
}
|
||||
|
||||
// The characters' pieces of a whole frame the plain frame runs, with the items' frame (00794e50): Tainted Magdalene's
|
||||
// drain and its drip, and the Berserk! charge.
|
||||
// Tainted Magdalene's drain, the characters' piece of the whole frame the plain frame runs. Her drip, the Berserk!
|
||||
// charge and Tainted ???'s poop charge run in the items' frame (items_frame_update).
|
||||
void character_frame_update(Entity_Player& player)
|
||||
{
|
||||
maggy_health_drain(player);
|
||||
blood_drip_update(player);
|
||||
berserk_charge_update(player);
|
||||
blue_baby_poop_update(player);
|
||||
}
|
||||
|
||||
// Tainted Magdalene's hug, part of 0078e1f0: touching a vulnerable enemy that is not a friend, with the last swing
|
||||
|
||||
@@ -72,6 +72,8 @@ bool is_maggy_draining(Entity_Player& player);
|
||||
|
||||
// The characters' own parts of a whole frame (00782af0, 00794e50) and Tainted Magdalene's part of a touch (0078e1f0).
|
||||
void character_frame_update(Entity_Player& player);
|
||||
void blood_drip_update(Entity_Player& player);
|
||||
void berserk_charge_update(Entity_Player& player);
|
||||
void tainted_magdalene_hug(Entity_Player& player, Entity& collider);
|
||||
|
||||
// Eden's rolled stat offsets, and Tainted Eden's glitch on a penalised hit (part of 007729d0).
|
||||
|
||||
@@ -399,7 +399,7 @@ static void reverse_stars_end(Entity_Player& player)
|
||||
if (!player.bodySprite.IsPlaying("Pickup") && !player.bodySprite.IsPlaying("Pickup_Online")) return;
|
||||
|
||||
player.heldSprite.Reset();
|
||||
const AnimationFrame* frame = player.bodySprite.animState.GetLayerFrame(0);
|
||||
const NullFrame* frame = player.bodySprite.GetNullFrameById(0);
|
||||
if (!frame) return;
|
||||
Entity* poof = g_game->Spawn({.position = player.pos, .type = ENTITY_EFFECT, .variant = EFFECT_POOF01, .seed = Random()});
|
||||
poof->sprite.offset = vector_make(player.sprite.scale.x * frame->pos.x, player.sprite.scale.y * frame->pos.y);
|
||||
|
||||
@@ -111,7 +111,7 @@ static void adrenaline_look_read(Entity_Player& player, LayerLook& look)
|
||||
int frame = g_game->frameCount;
|
||||
auto beat = [rate](int at) {
|
||||
float wave = (std::sin((float)at * rate) * 0.5f + 0.5f) * ADRENALINE_BEAT_SCALE;
|
||||
return std::pow(wave, 2.0f) - ADRENALINE_BEAT_FLOOR;
|
||||
return pow_float(wave, 2) - ADRENALINE_BEAT_FLOOR;
|
||||
};
|
||||
|
||||
float pulse = beat(frame) * swing + 1;
|
||||
@@ -224,7 +224,8 @@ static void hot_potato_explode(Entity_Player& player)
|
||||
.radiusMultiplier = HOT_POTATO_RADIUS,
|
||||
.isDamageSource = true});
|
||||
player.velocity = {};
|
||||
Vector knock = vector_scale(random_direction(), random_unit() * HOT_POTATO_KNOCK_RANGE + HOT_POTATO_KNOCK_MIN);
|
||||
Vector direction = random_direction();
|
||||
Vector knock = vector_scale(direction, random_unit() * HOT_POTATO_KNOCK_RANGE + HOT_POTATO_KNOCK_MIN);
|
||||
player.TryThrow(EntityRef(), knock, HOT_POTATO_KNOCK_HEIGHT);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,6 @@ constexpr int TRINKET_CROW_HEART = 107;
|
||||
constexpr int TRINKET_FINGER_BONE = 128;
|
||||
constexpr int TRINKET_SWALLOWED_M80 = 178;
|
||||
constexpr int TRINKET_WALNUT = 108;
|
||||
constexpr int NULLITEM_DOUBLE_DAMAGE = 29;
|
||||
constexpr int SAMSON_B_HIT_CHARGE = 10000;
|
||||
|
||||
constexpr int SIREN_CHARM_SPARE_FRAMES = 29;
|
||||
@@ -113,8 +112,6 @@ constexpr float VOICE_PITCH_STEP = 0.2f;
|
||||
constexpr float VOICE_PITCH_MIN = 0.5f;
|
||||
constexpr float VOICE_PITCH_MAX = 2;
|
||||
constexpr float REMOTE_VOLUME_SCALE = 0.1f;
|
||||
constexpr int PILL_EFFECT_PUBERTY = 33;
|
||||
constexpr int PILL_EFFECT_HELIUM = 32;
|
||||
|
||||
// The extra lives the HUD counts: 1up!, Ankh, Guppy's Collar, Judas' Shadow, Lazarus' Rags and Inner Child.
|
||||
constexpr int EXTRA_LIFE_ITEMS[] = {11, 161, 212, 311, 332, 688};
|
||||
@@ -127,7 +124,6 @@ constexpr int EVIL_CHARM_GRID_VARIANT = 10000;
|
||||
// The temporary effects that make the player invincible to any hit: Gamekid, My Little Unicorn, Unicorn Stump and
|
||||
// Teleport.
|
||||
constexpr int INVINCIBLE_EFFECTS[] = {93, 77, 298, 44};
|
||||
constexpr int NULLITEM_INVINCIBLE_SHIELD = 59;
|
||||
constexpr int BLOOD_DONATION_VARIANT = 2;
|
||||
constexpr int BLOOD_BANK_VARIANT = 5;
|
||||
constexpr float GNAWED_LEAF_MASS = 1000;
|
||||
@@ -451,7 +447,7 @@ static int damage_amount_get(Entity_Player& player, float damage, uint64_t damag
|
||||
(player.HasCollectible(COLLECTIBLE_DOGMA) && !isHardMode);
|
||||
if (isHalved && amount > 1)
|
||||
amount = std::max((int)((float)amount * (isDeathmatch ? HALVED_DAMAGE_DEATHMATCH : HALVED_DAMAGE) + DAMAGE_ROUNDING), 1);
|
||||
if (player.temporaryEffects.HasNullEffect(NULLITEM_DOUBLE_DAMAGE))
|
||||
if (player.temporaryEffects.HasNullEffect(NULLITEM_OVERDOSE))
|
||||
amount = (int)((float)std::max(amount, 2) * (isDeathmatch ? DOUBLED_DAMAGE_DEATHMATCH : 1));
|
||||
if (player.GetHealthType() == HEALTH_COIN) amount = 2;
|
||||
if (game.seedEffects.HasSeedEffect(SEED_ISAAC_TAKES_HIGH_DAMAGE)) amount = std::max(amount, 2);
|
||||
@@ -1239,7 +1235,7 @@ bool Entity_Player::HasInvincibility(uint64_t damageFlags, const EntityRef& sour
|
||||
isInvincible = std::ranges::any_of(INVINCIBLE_EFFECTS, [&](int item) { return effects.HasCollectibleEffect(item); }) ||
|
||||
(HasCollectible(COLLECTIBLE_GNAWED_LEAF) && mass == GNAWED_LEAF_MASS && !isRedHit) ||
|
||||
effects.HasCollectibleEffect(COLLECTIBLE_BREATH_OF_LIFE) || (taurus && taurus->cooldown != 0) ||
|
||||
(effects.HasNullEffect(NULLITEM_INVINCIBLE_SHIELD) && !isRedHit) ||
|
||||
(effects.HasNullEffect(NULLITEM_TOOTH_AND_NAIL_STATUE) && !isRedHit) ||
|
||||
(effects.HasNullEffect(NULLITEM_REVERSE_CHARIOT) && !isRedHit) ||
|
||||
((effects.HasCollectibleEffect(COLLECTIBLE_DARK_ARTS) || isDarkArtsBlastPending) && !isRedHit) ||
|
||||
(suplexState != 0 && !isRedHit) || effects.HasCollectibleEffect(COLLECTIBLE_MEGA_MUSH);
|
||||
@@ -1278,7 +1274,7 @@ float Entity_Player::get_voice_pitch()
|
||||
{
|
||||
float pitch = variant == PLAYER_VARIANT_PLAYER ? VOICE_PITCH_PLAYER : VOICE_PITCH_BABY;
|
||||
|
||||
pitch += (float)(pillEffectUses[PILL_EFFECT_PUBERTY] - pillEffectUses[PILL_EFFECT_HELIUM]) * VOICE_PITCH_PER_PILL;
|
||||
pitch += (float)(pillEffectUses[PILLEFFECT_SMALLER] - pillEffectUses[PILLEFFECT_LARGER]) * VOICE_PITCH_PER_PILL;
|
||||
if (HasCollectible(COLLECTIBLE_PLUTO) || temporaryEffects.HasCollectibleEffect(COLLECTIBLE_INNER_CHILD))
|
||||
pitch += VOICE_PITCH_PLUTO;
|
||||
if (HasCollectible(COLLECTIBLE_BINKY)) pitch += VOICE_PITCH_STEP;
|
||||
|
||||
+482
-13
@@ -9,6 +9,13 @@
|
||||
#include "entity_player.h"
|
||||
#include "entity_laser.h"
|
||||
#include "entity_player_characters.h"
|
||||
#include "entity_player_passives.h"
|
||||
#include "entity_player_trinkets.h"
|
||||
#include "entity_knife.h"
|
||||
#include "active_items.h"
|
||||
#include "netplay_manager.h"
|
||||
#include "platform.h"
|
||||
#include "tainted_characters.h"
|
||||
#include "entity_projectile.h"
|
||||
#include "entity_tear.h"
|
||||
#include "entity_slot.h"
|
||||
@@ -49,6 +56,8 @@ constexpr int MEGA_BLAST_TAIL_FRAMES = 15;
|
||||
constexpr float MEGA_BLAST_DAMAGE_SCALE = 5;
|
||||
constexpr int RAGE_HEAD_SHOOT_FRAME = 15;
|
||||
constexpr int RAGE_HEAD_REWIND_FRAME = 8;
|
||||
// Azazel's Rage's rooms gathered while its beam fires.
|
||||
constexpr int RAGE_FIRING = 5;
|
||||
|
||||
// The pit at a cell, or null off the grid or on any other grid entity.
|
||||
static GridEntity_Pit* pit_at(Room& room, int gridIndex)
|
||||
@@ -158,6 +167,8 @@ constexpr float VOLT_REACH = 60;
|
||||
constexpr float VOLT_DAMAGE = 0.75f;
|
||||
constexpr float MONSTRANCE_RADIUS = 90;
|
||||
constexpr float MONSTRANCE_PERIOD = 4;
|
||||
constexpr float MONSTRANCE_VERSUS_PERIOD = 12;
|
||||
constexpr float MONSTRANCE_VERSUS_SCALE = 2;
|
||||
constexpr LerpRange MONSTRANCE_FALLOFF = {.inMin = 30, .inMax = 90, .outMin = 0, .outMax = 0.4f};
|
||||
constexpr float MONSTRANCE_STAGE_DAMAGE = 0.32f;
|
||||
constexpr float MONSTRANCE_BASE_DAMAGE = 3.6f;
|
||||
@@ -359,6 +370,27 @@ static void crack_the_sky_update(Entity_Player& player)
|
||||
beam->parent = &player;
|
||||
}
|
||||
|
||||
// Explosive Diarrhea drops a bomb (a butt bomb for Tainted ???) with the player's bomb effects every tenth frame it
|
||||
// has left. Stacked, the bombs home and grow by half.
|
||||
static void explosive_diarrhea_update(Entity_Player& player)
|
||||
{
|
||||
constexpr int DIARRHEA_BOMB_PERIOD = 10;
|
||||
constexpr float DIARRHEA_STACKED_SCALE = 1.5f;
|
||||
TemporaryEffect* diarrhea = player.temporaryEffects.GetNullEffect(NULLITEM_EXPLOSIVE_DIARRHEA);
|
||||
if (!diarrhea || diarrhea->cooldown % DIARRHEA_BOMB_PERIOD != 0) return;
|
||||
|
||||
int variant = player.playerType == PLAYER_BLUEBABY_B ? BOMB_BUTT : BOMB_NORMAL;
|
||||
Entity* spawned = g_game->Spawn({.position = player.pos, .spawner = &player, .type = ENTITY_BOMB,
|
||||
.variant = variant, .seed = Random()});
|
||||
if (spawned->type != ENTITY_BOMB) return;
|
||||
auto& bomb = *static_cast<Entity_Bomb*>(spawned);
|
||||
bomb.tearFlags = player.GetBombFlags(false);
|
||||
bomb.isLoadCostumes = true;
|
||||
if (diarrhea->count <= 1) return;
|
||||
bomb.tearFlags.set(TEAR_HOMING);
|
||||
bomb.scale = DIARRHEA_STACKED_SCALE;
|
||||
}
|
||||
|
||||
// Relax: every other frame it lasts, a poop drops where the player stands on an empty, decorated or webbed cell
|
||||
// (not in a crawl space), with a fart and the candle Bird's Eye or Ghost Pepper fires. Hallowed Ground makes it holy
|
||||
// one time in three, Meconium black (33, 66 or 100 in 100 by its copies) and Midas' Touch golden (luck helps).
|
||||
@@ -502,8 +534,10 @@ static void breath_of_life_update(Entity_Player& player)
|
||||
}
|
||||
|
||||
// Faded Polaroid every 300 frames, one time in five, fades the player for 3 to 7 seconds (times its multiplier).
|
||||
// In a versus match the rivals are confused for 3 seconds.
|
||||
static void faded_polaroid_update(Entity_Player& player)
|
||||
{
|
||||
constexpr int POLAROID_VERSUS_CONFUSION = 90;
|
||||
constexpr int POLAROID_PERIOD = 300;
|
||||
constexpr int POLAROID_ODDS = 5;
|
||||
constexpr int POLAROID_SECONDS_MIN = 3;
|
||||
@@ -516,6 +550,15 @@ static void faded_polaroid_update(Entity_Player& player)
|
||||
int multiplier = player.GetTrinketMultiplier(TRINKET_FADED_POLAROID);
|
||||
fade.cooldown = multiplier * (random_below(POLAROID_SECONDS_RANGE) + POLAROID_SECONDS_MIN) * FRAMES_PER_SECOND;
|
||||
effects.AddEffect(fade, true, 1);
|
||||
if (!g_game->deathmatchManager.is_active()) return;
|
||||
|
||||
PlayerManager& players = g_game->playerManager;
|
||||
for (size_t i = 0; i < players.playerList.size(); i++)
|
||||
{
|
||||
Entity_Player* rival = players.GetPlayer((int)i);
|
||||
if (rival != &player && rival != player.twinPlayer.get())
|
||||
rival->AddConfusion(EntityRef(&player), POLAROID_VERSUS_CONFUSION, false);
|
||||
}
|
||||
}
|
||||
|
||||
// Empty Vessel: without red hearts the player flies (with its costume), and while it flies a room still fighting
|
||||
@@ -763,13 +806,11 @@ static void azazels_rage_steer(Entity_Player& player)
|
||||
}
|
||||
|
||||
// Azazel's Rage: on a room's third frame (or once its beam is spent) the rage ends with the item gone. With four
|
||||
// rooms gathered, a room still fighting (an ambush not yet over) unleashes its beam. A spent beam's rage settles back
|
||||
// into the item's costume.
|
||||
// rooms gathered, a room still fighting (an ambush not yet over) unleashes its beam.
|
||||
static void azazels_rage_update(Entity_Player& player)
|
||||
{
|
||||
constexpr int RAGE_ROOM_FRAME = 3;
|
||||
constexpr int RAGE_READY = 4;
|
||||
constexpr int RAGE_FIRING = 5;
|
||||
constexpr int RAGE_FIRED = 6;
|
||||
TemporaryEffects& effects = player.temporaryEffects;
|
||||
ItemConfig& config = g_manager->itemConfig;
|
||||
@@ -795,6 +836,13 @@ static void azazels_rage_update(Entity_Player& player)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Azazel's Rage's spent beam settles the rage back into the item's costume, after the beam's steering.
|
||||
static void azazels_rage_end_update(Entity_Player& player)
|
||||
{
|
||||
TemporaryEffects& effects = player.temporaryEffects;
|
||||
ItemConfig& config = g_manager->itemConfig;
|
||||
if (effects.GetCollectibleEffectNum(COLLECTIBLE_AZAZELS_RAGE) <= RAGE_FIRING || player.azazelsRageLaser) return;
|
||||
effects.RemoveCollectibleEffect(COLLECTIBLE_AZAZELS_RAGE, -1);
|
||||
player.RemoveCostume(config.GetNullItem(NULLITEM_AZAZELS_RAGE_4));
|
||||
@@ -890,16 +938,19 @@ static void spooky_venus_update(Entity_Player& player)
|
||||
bool isVenus = player.HasCollectible(COLLECTIBLE_VENUS);
|
||||
if (!isSpooky && !isVenus) return;
|
||||
|
||||
for (Entity* enemy : entity_query_radius(player.pos, isVenus ? VENUS_RADIUS : SPOOKY_RADIUS, QUERY_ENEMIES))
|
||||
bool isVersus = g_game->deathmatchManager.is_active();
|
||||
float radius = isVenus && !isVersus ? VENUS_RADIUS : SPOOKY_RADIUS;
|
||||
for (Entity* enemy : entity_query_radius(player.pos, radius, QUERY_ENEMIES))
|
||||
{
|
||||
if (!enemy->IsVulnerableEnemy(nullptr) || enemy == &player) continue;
|
||||
bool isBoss = enemy->IsBoss();
|
||||
bool isRival = isVersus && enemy->is_player();
|
||||
int charm = isBoss ? VENUS_CHARM_FRAMES : VENUS_CHARM_FRAMES - enemy->charmedCountdown;
|
||||
if (isVenus && charm >= 1) enemy->AddCharmed(EntityRef(&player), charm, false, false);
|
||||
if (isVenus && charm >= 1) enemy->AddCharmed(EntityRef(&player), charm, isRival && !isBoss, false);
|
||||
if (!isSpooky) continue;
|
||||
float distanceSquared = vector_length_squared(vector_sub(enemy->pos, player.pos));
|
||||
if (isVenus && enemy->size + SPOOKY_FEAR_REACH < distanceSquared) continue;
|
||||
enemy->AddFear(EntityRef(&player), isBoss ? SPOOKY_BOSS_FEAR_FRAMES : SPOOKY_FEAR_FRAMES, false);
|
||||
enemy->AddFear(EntityRef(&player), isBoss ? SPOOKY_BOSS_FEAR_FRAMES : SPOOKY_FEAR_FRAMES, isRival && !isBoss);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -923,10 +974,12 @@ static void volt_120_update(Entity_Player& player)
|
||||
static void monstrance_update(Entity_Player& player)
|
||||
{
|
||||
bool isWorn = player.HasCollectible(COLLECTIBLE_MONSTRANCE) && !g_game->room->isPacifist;
|
||||
if (isWorn && player.GetIntervalTicks(MONSTRANCE_PERIOD, 0) != 0)
|
||||
bool isVersus = g_game->deathmatchManager.is_active();
|
||||
if (isWorn && player.GetIntervalTicks(isVersus ? MONSTRANCE_VERSUS_PERIOD : MONSTRANCE_PERIOD, 0) != 0)
|
||||
{
|
||||
LerpRange falloff = MONSTRANCE_FALLOFF;
|
||||
falloff.outMin = (float)g_game->stage * MONSTRANCE_STAGE_DAMAGE + MONSTRANCE_BASE_DAMAGE;
|
||||
float baseScale = isVersus ? MONSTRANCE_VERSUS_SCALE : 1;
|
||||
falloff.outMin = (float)g_game->stage * MONSTRANCE_STAGE_DAMAGE + baseScale * MONSTRANCE_BASE_DAMAGE;
|
||||
for (Entity* enemy : entity_query_radius(player.pos, MONSTRANCE_RADIUS, QUERY_ENEMIES))
|
||||
{
|
||||
if (!enemy->IsVulnerableEnemy(nullptr) || enemy == &player) continue;
|
||||
@@ -950,7 +1003,7 @@ static void mars_recharge_update(Entity_Player& player)
|
||||
if (!player.isMarsDashReady)
|
||||
{
|
||||
player.isMarsDashReady = true;
|
||||
player.ClearEntityFlags(FLAG_NO_PHYSICS_KNOCKBACK);
|
||||
player.ClearEntityFlags(FLAG_NO_DAMAGE_BLINK);
|
||||
player.SetMinDamageCooldown(MARS_READY_DAMAGE_COOLDOWN);
|
||||
}
|
||||
player.marsDashDirection = -1;
|
||||
@@ -1564,27 +1617,435 @@ static void volt_45_charge_update(Entity_Player& player)
|
||||
}
|
||||
}
|
||||
|
||||
// The written pieces of the items' frame (update_effects 00794e50) the plain path runs after its others, in their
|
||||
// order there.
|
||||
// In the Beast's crawlspace at Home, a Glowing Hour Glass with uses spent is filled back to three, fully charged.
|
||||
static void beast_room_hourglass_update(Entity_Player& player)
|
||||
{
|
||||
constexpr int BEAST_ROOM_HOURGLASS_USES = 3;
|
||||
RoomConfig_Room* config = g_game->room->descriptor->data;
|
||||
if (!config || config->type != ROOM_DUNGEON || config->stageId != STAGE_ID_HOME) return;
|
||||
|
||||
for (int slot = 0; slot < ACTIVE_SLOT_COUNT; slot++)
|
||||
{
|
||||
ActiveItemDesc& active = player.activeItems[slot];
|
||||
if (active.item != COLLECTIBLE_GLOWING_HOUR_GLASS || active.varData >= BEAST_ROOM_HOURGLASS_USES) continue;
|
||||
active.varData = BEAST_ROOM_HOURGLASS_USES;
|
||||
player.FullCharge(slot, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
// Lazarus risen, once he holds Anemia, always bleeds.
|
||||
static void lazarus_anemic_update(Entity_Player& player)
|
||||
{
|
||||
TemporaryEffects& effects = player.temporaryEffects;
|
||||
if (player.playerType != PLAYER_LAZARUS2 ||
|
||||
!g_manager->persistentGameData.Unlocked(ACHIEVEMENT_LAZARUS_HOLDS_ANEMIA) ||
|
||||
effects.HasCollectibleEffect(COLLECTIBLE_ANEMIC))
|
||||
return;
|
||||
effects.AddCollectibleEffect(COLLECTIBLE_ANEMIC, true, 1);
|
||||
}
|
||||
|
||||
// The opacity of a player's shots: a remote online player's fade with the options, the rest are whole.
|
||||
static float shot_alpha_get(Entity_Player& player)
|
||||
{
|
||||
NetplayManager& netplay = g_manager->netplayManager;
|
||||
if (!netplay.is_online() || netplay.IsIdxLocalPlayer(player.controllerIndex) || g_game->deathmatchManager.is_active())
|
||||
return 1;
|
||||
return tear_remote_opacity_get();
|
||||
}
|
||||
|
||||
// The transformations' pieces: Oh Crap! poops by itself now and then in a room still fighting, and Yes Mother?
|
||||
// chains Mom's Knife to the player, with its tear look, effects and damage.
|
||||
static void forms_frame_update(Entity_Player& player)
|
||||
{
|
||||
constexpr int OH_CRAP_PERIOD = 1800;
|
||||
constexpr int OH_CRAP_ODDS = 15;
|
||||
constexpr float KNIFE_RISE = -10;
|
||||
if (player.HasPlayerForm(PLAYER_FORM_OH_CRAP) && player.IsFrame(OH_CRAP_PERIOD, 0) &&
|
||||
random_below(OH_CRAP_ODDS) == 0 && !g_game->room->IsClear())
|
||||
player.UseActiveItem({.item = COLLECTIBLE_POOP, .flags = USE_NOANIM});
|
||||
if (!player.HasPlayerForm(PLAYER_FORM_YES_MOTHER) || player.yesMotherKnife) return;
|
||||
|
||||
Entity* knife = g_game->Spawn({.position = player.pos, .spawner = &player, .subType = KNIFE_SUBTYPE_CHAINED,
|
||||
.type = ENTITY_KNIFE, .variant = KNIFE_MOMS_KNIFE, .seed = Random()});
|
||||
knife->parent = &player;
|
||||
knife->posOffset = vector_make(0, KNIFE_RISE);
|
||||
ColorMod color = player.tearColor;
|
||||
color._tint[3] *= shot_alpha_get(player);
|
||||
knife->SetColor(color, -1, COLOR_PRIORITY_DEFAULT, false, true);
|
||||
static_cast<Entity_Knife*>(knife)->tearFlags = player.tearFlags;
|
||||
knife->SetCollisionDamage(player.damage);
|
||||
knife->AddEntityFlags(FLAG_DONT_OVERWRITE);
|
||||
player.yesMotherKnife = knife;
|
||||
knife->Update();
|
||||
}
|
||||
|
||||
// Bob's transformation leaves a spot of green creep every fifth frame.
|
||||
static void bob_creep_update(Entity_Player& player)
|
||||
{
|
||||
constexpr int BOB_CREEP_PERIOD = 5;
|
||||
constexpr ColorMod BOB_GREEN = {{0, 1, 1, 1}, {0, 0, 0, 0}, {0, 100 * BYTE_TO_UNIT, 0}};
|
||||
if (!player.HasPlayerForm(PLAYER_FORM_BOB) || !player.IsFrame(BOB_CREEP_PERIOD, 0)) return;
|
||||
|
||||
Entity* creep = creep_drop(player, EFFECT_PLAYER_CREEP_RED);
|
||||
creep->SetColor(BOB_GREEN, -1, COLOR_PRIORITY_DEFAULT, false, true);
|
||||
creep->Update();
|
||||
}
|
||||
|
||||
// Night Light: enemies in its cone are slowed (a versus rival a frame less while already slowed), and the enemy
|
||||
// shots and the others' tears crossing it are slowed to half speed once.
|
||||
static void night_light_update(Entity_Player& player)
|
||||
{
|
||||
constexpr float NIGHT_LIGHT_REACH = 200;
|
||||
constexpr int NIGHT_LIGHT_SLOW_FRAMES = 2;
|
||||
constexpr float NIGHT_LIGHT_SLOW = 0.9f;
|
||||
constexpr float NIGHT_LIGHT_SHOT_SLOW = 0.5f;
|
||||
constexpr float NIGHT_LIGHT_GLOW = 40 * BYTE_TO_UNIT;
|
||||
constexpr ColorMod NIGHT_LIGHT_TINT = {{1, 1, 1.3f, 1}, {0, 0, 0, 0}, {NIGHT_LIGHT_GLOW, NIGHT_LIGHT_GLOW, NIGHT_LIGHT_GLOW}};
|
||||
if (!player.HasCollectible(COLLECTIBLE_NIGHT_LIGHT)) return;
|
||||
|
||||
bool isVersus = g_game->deathmatchManager.is_active();
|
||||
uint32_t partitions = QUERY_ENEMIES | QUERY_PROJECTILES | (isVersus ? QUERY_TEARS : 0);
|
||||
for (Entity* entity : entity_query_radius(player.pos, NIGHT_LIGHT_REACH, partitions))
|
||||
{
|
||||
if (entity->IsVulnerableEnemy(nullptr) && player.IsPosInSpotLight(entity->pos))
|
||||
{
|
||||
int frames = isVersus && entity->slowingCountdown != 0 ? NIGHT_LIGHT_SLOW_FRAMES - 1 : NIGHT_LIGHT_SLOW_FRAMES;
|
||||
entity->AddSlowing(EntityRef(&player), frames, NIGHT_LIGHT_SLOW, NIGHT_LIGHT_TINT, isVersus);
|
||||
}
|
||||
else if (entity->type == ENTITY_PROJECTILE)
|
||||
{
|
||||
auto* shot = static_cast<Entity_Projectile*>(entity);
|
||||
if (!player.IsPosInSpotLight(shot->pos) || (shot->projectileFlags & PROJECTILE_SLOWED)) continue;
|
||||
shot->velocity = vector_scale(shot->velocity, NIGHT_LIGHT_SHOT_SLOW);
|
||||
shot->projectileFlags |= PROJECTILE_SLOWED;
|
||||
}
|
||||
else if (entity->type == ENTITY_TEAR && !entity->IsDescendantOf(&player) && player.IsPosInSpotLight(entity->pos))
|
||||
{
|
||||
auto* tear = static_cast<Entity_Tear*>(entity);
|
||||
if (tear->tearFlags[TEAR_GROW]) continue;
|
||||
tear->velocity = vector_scale(tear->velocity, NIGHT_LIGHT_SHOT_SLOW);
|
||||
TearFlags flags = tear->tearFlags;
|
||||
flags.set(TEAR_GROW);
|
||||
tear->SetTearFlags(flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Circle of Protection keeps a ring of light around the player, hurting with its laser damage each frame. Without the
|
||||
// item the ring goes.
|
||||
static void circle_of_protection_update(Entity_Player& player)
|
||||
{
|
||||
constexpr float PROTECTION_RING_RISE = -20;
|
||||
constexpr float PROTECTION_RING_DEPTH = 3000;
|
||||
if (!player.HasCollectible(COLLECTIBLE_CIRCLE_OF_PROTECTION))
|
||||
{
|
||||
if (Entity* ring = player.circleOfProtection.get()) ring->Remove();
|
||||
return;
|
||||
}
|
||||
Entity* ring = player.circleOfProtection.get();
|
||||
bool isSpawned = !ring;
|
||||
if (isSpawned)
|
||||
{
|
||||
ring = g_game->Spawn({.position = player.pos, .spawner = &player, .subType = LASER_SUBTYPE_RING_FOLLOW_PARENT,
|
||||
.type = ENTITY_LASER, .variant = LASER_LIGHT_RING, .seed = Random()});
|
||||
ring->posOffset = vector_make(0, PROTECTION_RING_RISE);
|
||||
ring->parent = &player;
|
||||
ring->spawnerEntity = &player;
|
||||
ring->renderDepthOffset = PROTECTION_RING_DEPTH;
|
||||
}
|
||||
int displacement = random_below(2) * 2 - 1;
|
||||
ring->SetCollisionDamage(player.GetTearHitParams(WEAPON_LASER, 1, displacement, nullptr).tearDamage);
|
||||
if (!isSpawned) return;
|
||||
ring->Update();
|
||||
player.circleOfProtection = ring;
|
||||
}
|
||||
|
||||
// Black Powder's sum over its trail from one spot to the newest: the farthest squared distance from the player (halved,
|
||||
// the circle's squared radius) and the trail's middle.
|
||||
struct PowderCircle
|
||||
{
|
||||
Vector center{};
|
||||
float radiusSquared = 0;
|
||||
int start = 0;
|
||||
};
|
||||
|
||||
// Whether the trail from a spot closes a circle around the player: wide enough, and with at most a quarter of its
|
||||
// spots near its middle.
|
||||
static bool is_powder_circle(Entity_Player& player, PowderCircle& circle)
|
||||
{
|
||||
constexpr float CIRCLE_MIN_SQUARED = 2500;
|
||||
constexpr float CIRCLE_INNER_SHARE = 0.25f;
|
||||
std::array<EntityPtr, BLACK_POWDER_TRAIL_SIZE>& trail = player.blackPowderTrail;
|
||||
int tail = player.blackPowderTail;
|
||||
|
||||
circle.radiusSquared = 0;
|
||||
for (int i = circle.start; i != tail; i = (i + 1) % BLACK_POWDER_TRAIL_SIZE)
|
||||
if (Entity* spot = trail[i].get())
|
||||
circle.radiusSquared = std::max(circle.radiusSquared, vector_length_squared(vector_sub(spot->pos, player.pos)));
|
||||
circle.radiusSquared *= HALF;
|
||||
if (circle.radiusSquared < CIRCLE_MIN_SQUARED) return false;
|
||||
|
||||
int count = tail - circle.start;
|
||||
if (count < 0) count += BLACK_POWDER_TRAIL_SIZE;
|
||||
circle.center = {};
|
||||
for (int i = circle.start; i != tail; i = (i + 1) % BLACK_POWDER_TRAIL_SIZE)
|
||||
if (Entity* spot = trail[i].get()) circle.center = vector_add(circle.center, spot->pos);
|
||||
circle.center = vector_scale(circle.center, 1.0f / (float)count);
|
||||
|
||||
int inner = 0;
|
||||
bool isClosed = true;
|
||||
for (int i = circle.start; i != tail; i = (i + 1) % BLACK_POWDER_TRAIL_SIZE)
|
||||
{
|
||||
Entity* spot = trail[i].get();
|
||||
if (!spot || vector_length_squared(vector_sub(spot->pos, circle.center)) / circle.radiusSquared >= CIRCLE_INNER_SHARE)
|
||||
continue;
|
||||
if ((float)++inner > (float)count * CIRCLE_INNER_SHARE) isClosed = false;
|
||||
}
|
||||
return isClosed;
|
||||
}
|
||||
|
||||
// Black Powder: the player trails black powder (a spot when it moved 10 away from the last, 95 at most). Once the
|
||||
// trail holds 12, a spot of its older half lit and near the player that starts a closed circle lights a pentagram
|
||||
// over its middle, 45 frames before the trail goes on.
|
||||
static void black_powder_update(Entity_Player& player)
|
||||
{
|
||||
constexpr float POWDER_STEP_SQUARED = 100;
|
||||
constexpr int POWDER_TRAIL_MAX = 95;
|
||||
constexpr int POWDER_SPOT_FRAMES = 60;
|
||||
constexpr int POWDER_CIRCLE_MIN = 12;
|
||||
constexpr float POWDER_LIT_ALPHA = 0.5f;
|
||||
constexpr float POWDER_START_SQUARED = 400;
|
||||
constexpr int PENTAGRAM_COOLDOWN = 45;
|
||||
if (!player.HasCollectible(COLLECTIBLE_BLACK_POWDER)) return;
|
||||
if (player.blackPowderCooldown > 0)
|
||||
{
|
||||
player.blackPowderCooldown--;
|
||||
return;
|
||||
}
|
||||
|
||||
std::array<EntityPtr, BLACK_POWDER_TRAIL_SIZE>& trail = player.blackPowderTrail;
|
||||
int& head = player.blackPowderHead;
|
||||
int& tail = player.blackPowderTail;
|
||||
while (!trail[head] && head != tail) head = (head + 1) % BLACK_POWDER_TRAIL_SIZE;
|
||||
int count = tail - head;
|
||||
if (count < 0) count += BLACK_POWDER_TRAIL_SIZE;
|
||||
if (count >= POWDER_TRAIL_MAX) return;
|
||||
Entity* last = count > 0 ? trail[(tail + POWDER_TRAIL_MAX) % BLACK_POWDER_TRAIL_SIZE].get() : nullptr;
|
||||
if (last && !last->isDead && vector_length_squared(vector_sub(player.pos, last->pos)) < POWDER_STEP_SQUARED) return;
|
||||
|
||||
auto* spot = static_cast<Entity_Effect*>(g_game->Spawn({.position = player.pos, .spawner = &player,
|
||||
.type = ENTITY_EFFECT,
|
||||
.variant = EFFECT_PLAYER_CREEP_BLACKPOWDER, .seed = Random()}));
|
||||
spot->SetTimeout(POWDER_SPOT_FRAMES);
|
||||
spot->Update();
|
||||
trail[tail] = spot;
|
||||
tail = (tail + 1) % BLACK_POWDER_TRAIL_SIZE;
|
||||
if (count < POWDER_CIRCLE_MIN) return;
|
||||
|
||||
PowderCircle circle;
|
||||
bool isFound = false;
|
||||
for (int step = count / 2; step >= 0 && !isFound; step--)
|
||||
{
|
||||
circle.start = (head + step) % BLACK_POWDER_TRAIL_SIZE;
|
||||
Entity* start = trail[circle.start].get();
|
||||
if (!start || start->sprite.color._tint[3] < POWDER_LIT_ALPHA ||
|
||||
vector_length_squared(vector_sub(start->pos, player.pos)) >= POWDER_START_SQUARED)
|
||||
continue;
|
||||
isFound = is_powder_circle(player, circle);
|
||||
}
|
||||
if (!isFound) return;
|
||||
|
||||
float radius = std::sqrt(circle.radiusSquared);
|
||||
auto* pentagram = static_cast<Entity_Effect*>(g_game->Spawn({.position = circle.center, .spawner = &player,
|
||||
.type = ENTITY_EFFECT,
|
||||
.variant = EFFECT_PENTAGRAM_BLACKPOWDER, .seed = Random()}));
|
||||
pentagram->scale = radius;
|
||||
pentagram->Update();
|
||||
player.blackPowderCooldown = PENTAGRAM_COOLDOWN;
|
||||
log_printf(LOG_INFO, "closed black powder circle at %.2f, %.2f with radius %.2f\n", circle.center.x, circle.center.y,
|
||||
radius);
|
||||
}
|
||||
|
||||
// Kidney Stone blocks the urethra again, for one to three seconds of bladder, once its burst is over and its time has
|
||||
// come, while the weapon can pass the stone. Otherwise it stays open.
|
||||
static void kidney_stone_update(Entity_Player& player)
|
||||
{
|
||||
constexpr int BLADDER_SECONDS = 3;
|
||||
Weapon* weapon = player.weapons[0] ? player.weapons[0].get() : player.weapons[1].get();
|
||||
if (!weapon || !player.HasCollectible(COLLECTIBLE_KIDNEY_STONE) || !weapon->CanTriggerKidneyStone())
|
||||
{
|
||||
player.isUrethraBlocked = false;
|
||||
return;
|
||||
}
|
||||
if (player.peeBurstCooldown >= 1 || player.isUrethraBlocked || player.nextUrethraBlockFrame > g_game->frameCount) return;
|
||||
player.isUrethraBlocked = true;
|
||||
player.maxBladderCharge = (random_below(BLADDER_SECONDS) + 1) * FRAMES_PER_SECOND;
|
||||
player.bladderCharge = 0;
|
||||
}
|
||||
|
||||
// Dark Prince's Crown glows while its condition holds, and sits a little lower under a Crown of Light.
|
||||
static void dark_princes_crown_update(Entity_Player& player)
|
||||
{
|
||||
constexpr float UNDER_CROWN_OFFSET = -7;
|
||||
if (!player.HasCollectible(COLLECTIBLE_DARK_PRINCES_CROWN)) return;
|
||||
crown_glow_set(player, COLLECTIBLE_DARK_PRINCES_CROWN, player.darkPrincesCrownSprite, is_dark_prince_lit(player));
|
||||
player.darkPrincesCrownSprite.offset =
|
||||
player.HasCollectible(COLLECTIBLE_CROWN_OF_LIGHT) ? vector_make(0, UNDER_CROWN_OFFSET) : Vector{};
|
||||
}
|
||||
|
||||
// Bozo every fifth frame gives each enemy not the player's own one chance in 700 to be charmed or frightened for 220
|
||||
// frames.
|
||||
static void bozo_update(Entity_Player& player)
|
||||
{
|
||||
constexpr int BOZO_SPELL_PERIOD = 5;
|
||||
constexpr int BOZO_SPELL_ODDS = 700;
|
||||
constexpr int BOZO_SPELL_FRAMES = 220;
|
||||
if (!player.HasCollectible(COLLECTIBLE_BOZO) || !player.IsFrame(BOZO_SPELL_PERIOD, 0)) return;
|
||||
|
||||
EntityList_EL entities = g_game->room->entityList.updateEL;
|
||||
for (Entity* entity : entities)
|
||||
{
|
||||
if (!entity->IsVulnerableEnemy(nullptr) || entity->IsDescendantOf(&player) || random_below(BOZO_SPELL_ODDS) != 0)
|
||||
continue;
|
||||
if (random_below(2) == 0) entity->AddCharmed(EntityRef(&player), BOZO_SPELL_FRAMES, false, false);
|
||||
else entity->AddFear(EntityRef(&player), BOZO_SPELL_FRAMES, false);
|
||||
}
|
||||
}
|
||||
|
||||
// Red Stew's damage runs down with the ticks passed, the stats evaluated each time it drops a step of 10.
|
||||
static void red_stew_update(Entity_Player& player)
|
||||
{
|
||||
constexpr int RED_STEW_STEP = 10;
|
||||
int left = player.redStewBonusDuration;
|
||||
if (left <= 0) return;
|
||||
player.redStewBonusDuration = std::max(left - player.update_ticks_get(), 0);
|
||||
if (player.redStewBonusDuration / RED_STEW_STEP >= left / RED_STEW_STEP) return;
|
||||
player.temporaryEffects.isEvaluateCachePending = true;
|
||||
player.temporaryEffects.cacheFlags |= CACHE_DAMAGE;
|
||||
}
|
||||
|
||||
// Stompy's transformation kicks up a cloud of dust every fifth frame it walks.
|
||||
static void stompy_dust_update(Entity_Player& player)
|
||||
{
|
||||
constexpr int STOMPY_DUST_PERIOD = 5;
|
||||
constexpr float STOMPY_DUST_DRAG = 0.7f;
|
||||
constexpr float STOMPY_DUST_SPREAD = 20;
|
||||
constexpr float STOMPY_DUST_SPIN = 5;
|
||||
constexpr int STOMPY_DUST_FRAMES = 15;
|
||||
if (!player.HasPlayerForm(PLAYER_FORM_STOMPY) || vector_length_squared(player.velocity) <= 1 ||
|
||||
!player.IsFrame(STOMPY_DUST_PERIOD, 0))
|
||||
return;
|
||||
|
||||
uint32_t seed = Random();
|
||||
Vector velocity = vector_scale(player.velocity, STOMPY_DUST_DRAG);
|
||||
Vector spread = random_direction();
|
||||
Vector at = vector_add(player.pos, vector_scale(spread, random_unit() * STOMPY_DUST_SPREAD));
|
||||
auto* dust = static_cast<Entity_Effect*>(g_game->Spawn({.position = at, .velocity = velocity,
|
||||
.type = ENTITY_EFFECT, .variant = EFFECT_DUST_CLOUD,
|
||||
.seed = seed}));
|
||||
float turn = random_below(2) == 0 ? 1.0f : -1.0f;
|
||||
dust->rotation = random_unit() * STOMPY_DUST_SPIN * turn;
|
||||
dust->SetTimeout(random_below(STOMPY_DUST_FRAMES) + STOMPY_DUST_FRAMES);
|
||||
dust->Update();
|
||||
}
|
||||
|
||||
// The versus pieces: Swarm adds a fly every 300 frames, the nearest rival Salvation's ring holds the player under its
|
||||
// beam (lit while it lasts), and Dirty Mind calls a dip every 210 ticks.
|
||||
static void versus_items_update(Entity_Player& player)
|
||||
{
|
||||
constexpr int SWARM_PERIOD = 300;
|
||||
constexpr float RIVAL_SALVATION_FAR = 1e9f;
|
||||
constexpr float DIP_INTERVAL = 210;
|
||||
constexpr std::array<std::pair<int, int>, 5> DIP_ROLLS = {{{30, 0}, {44, 1}, {58, 13}, {72, 3}, {86, 4}}};
|
||||
constexpr int DIP_LAST = 6;
|
||||
Game& game = *g_game;
|
||||
if (!game.deathmatchManager.is_active()) return;
|
||||
|
||||
if (player.HasCollectible(COLLECTIBLE_SWARM) && player.IsFrame(SWARM_PERIOD, 0)) player.AddSwarmFlyOrbital(player.pos);
|
||||
if (!player.isDead && player.variant == PLAYER_VARIANT_PLAYER && !player.isCoopGhost)
|
||||
{
|
||||
float nearest = RIVAL_SALVATION_FAR;
|
||||
Entity_Player* saviour = nullptr;
|
||||
for (int i = 0; i < (int)game.playerManager.playerList.size(); i++)
|
||||
{
|
||||
Entity_Player* other = game.GetPlayer(i);
|
||||
if (other == &player || !other->HasCollectible(COLLECTIBLE_SALVATION)) continue;
|
||||
float distance = vector_length_squared(vector_sub(other->pos, player.pos));
|
||||
if (distance >= nearest) continue;
|
||||
double reach = other->get_salvation_scale() * SALVATION_HALO_RADIUS + player.size;
|
||||
if ((double)distance >= reach * reach) continue;
|
||||
nearest = distance;
|
||||
saviour = other;
|
||||
}
|
||||
if (saviour && !player.tetheredEffect)
|
||||
{
|
||||
Entity* beam = game.Spawn({.position = player.pos, .spawner = saviour, .subType = SALVATION_BEAM_SUBTYPE,
|
||||
.type = ENTITY_EFFECT, .variant = EFFECT_CRACK_THE_SKY, .seed = Random()});
|
||||
beam->target = &player;
|
||||
beam->parent = saviour;
|
||||
beam->SetCollisionDamage(SALVATION_BEAM_DAMAGE);
|
||||
beam->Update();
|
||||
player.tetheredEffect = beam;
|
||||
}
|
||||
if (saviour && player.tetheredEffect) static_cast<Entity_Effect*>(player.tetheredEffect.get())->state = 1;
|
||||
}
|
||||
if (!player.HasCollectible(COLLECTIBLE_DIRTY_MIND) || !player.GetIntervalTicks(DIP_INTERVAL, 0)) return;
|
||||
int roll = (int)player.GetCollectibleRNG(COLLECTIBLE_DIRTY_MIND).RandomInt(100);
|
||||
int dip = DIP_LAST;
|
||||
for (auto [below, subType] : DIP_ROLLS)
|
||||
if (roll < below)
|
||||
{
|
||||
dip = subType;
|
||||
break;
|
||||
}
|
||||
game.Spawn({.position = player.pos, .spawner = &player, .subType = dip, .type = ENTITY_FAMILIAR,
|
||||
.variant = Entity_Familiar::DIP, .seed = Random()});
|
||||
}
|
||||
|
||||
// The items' frame (00794e50, update_effects), after the effects count down: nothing runs during a stage transition
|
||||
// or while the player falls through a trapdoor. Each item's piece in the original's order.
|
||||
void items_frame_update(Entity_Player& player)
|
||||
{
|
||||
TemporaryEffects& effects = player.temporaryEffects;
|
||||
if (g_game->stageTransition.state != 0) return;
|
||||
if (player.isPlayingExtraAnimation && player.sprite.IsPlaying("Trapdoor")) return;
|
||||
|
||||
player.UpdateBookOfVirtues(false);
|
||||
beast_room_hourglass_update(player);
|
||||
hairpin_frame_update(player);
|
||||
moms_foot_update(player);
|
||||
challenge_frame_update(player);
|
||||
lazarus_anemic_update(player);
|
||||
anarchist_cookbook_update(player);
|
||||
crack_the_sky_update(player);
|
||||
black_bean_update(player);
|
||||
explosive_diarrhea_update(player);
|
||||
relax_poop_update(player);
|
||||
invincible_effects_update(player);
|
||||
blood_drip_update(player);
|
||||
breath_of_life_update(player);
|
||||
mirror_death_update(player);
|
||||
breath_of_life_fade_update(player);
|
||||
passive_drops_update(player);
|
||||
faded_polaroid_update(player);
|
||||
zodiac_frame_update(player);
|
||||
empty_vessel_update(player);
|
||||
redemption_update(player);
|
||||
forms_frame_update(player);
|
||||
trinkets_frame_update(player);
|
||||
bob_creep_update(player);
|
||||
night_light_update(player);
|
||||
circle_of_protection_update(player);
|
||||
player.ClampGoldenHearts(false);
|
||||
black_powder_update(player);
|
||||
kidney_stone_update(player);
|
||||
dark_princes_crown_update(player);
|
||||
bozo_update(player);
|
||||
dads_ring_update(player);
|
||||
if (effects.HasCollectibleEffect(COLLECTIBLE_NOTCHED_AXE) && !player.HasCollectible(COLLECTIBLE_NOTCHED_AXE))
|
||||
effects.RemoveCollectibleEffect(COLLECTIBLE_NOTCHED_AXE, -1);
|
||||
if (effects.GetNullEffect(NULLITEM_CAMO_BOOST)) effects.RemoveNullEffect(NULLITEM_CAMO_BOOST, 1);
|
||||
tainted_frame_update(player);
|
||||
red_stew_update(player);
|
||||
berserk_tick_update(player);
|
||||
if (effects.HasCollectibleEffect(COLLECTIBLE_URN_OF_SOULS) && !player.HasCollectible(COLLECTIBLE_URN_OF_SOULS))
|
||||
effects.RemoveCollectibleEffect(COLLECTIBLE_URN_OF_SOULS, -1);
|
||||
@@ -1592,6 +2053,7 @@ void items_frame_update(Entity_Player& player)
|
||||
spooky_venus_update(player);
|
||||
volt_120_update(player);
|
||||
monstrance_update(player);
|
||||
redemption_update(player);
|
||||
saturnus_update(player);
|
||||
dashes_frame_update(player);
|
||||
mars_recharge_update(player);
|
||||
@@ -1605,19 +2067,26 @@ void items_frame_update(Entity_Player& player)
|
||||
if (effects.HasNullEffect(NULLITEM_REVERSE_STARS) && player.IsExtraAnimationFinished())
|
||||
effects.RemoveNullEffect(NULLITEM_REVERSE_STARS, 1);
|
||||
volt_45_charge_update(player);
|
||||
berserk_charge_update(player);
|
||||
blue_baby_poop_update(player);
|
||||
ibs_charge_update(player);
|
||||
birthright_dead_bird_update(player);
|
||||
azazels_rage_update(player);
|
||||
birthright_dead_bird_update(player);
|
||||
sumptorium_recall_update(player);
|
||||
purgatory_update(player);
|
||||
isaacs_heart_update(player);
|
||||
extension_cord_update(player);
|
||||
mega_blast_update(player);
|
||||
azazels_rage_steer(player);
|
||||
azazels_rage_end_update(player);
|
||||
montezuma_aim_update(player);
|
||||
plan_c_update(player);
|
||||
stompy_dust_update(player);
|
||||
linger_bean_update(player);
|
||||
versus_items_update(player);
|
||||
im_excited_update(player);
|
||||
if (player.rUaWizardTimer > 0 && --player.rUaWizardTimer == 0)
|
||||
player.RemoveCostume(g_manager->itemConfig.GetNullItem(NULLITEM_WIZARD));
|
||||
telekinesis_update(player);
|
||||
if (player.hallowedGroundCountdown > 0 && --player.hallowedGroundCountdown < 1)
|
||||
{
|
||||
|
||||
@@ -40,20 +40,10 @@ constexpr float FALL_SPEED_MIN_SLOPE = 0.01f;
|
||||
constexpr float G_FUEL_SPEED = 0.2f;
|
||||
constexpr float DEBUG_DAMAGE_BONUS = 40;
|
||||
constexpr float DEBUG_LUCK_BONUS = 50;
|
||||
constexpr int PILL_RANGE_DOWN = 11;
|
||||
constexpr int PILL_RANGE_UP = 12;
|
||||
constexpr int PILL_SPEED_DOWN = 13;
|
||||
constexpr int PILL_SPEED_UP = 14;
|
||||
constexpr int PILL_LUCK_DOWN = 17;
|
||||
constexpr int PILL_LUCK_UP = 18;
|
||||
constexpr int PILL_SHOT_SPEED_DOWN = 47;
|
||||
constexpr int PILL_SHOT_SPEED_UP = 48;
|
||||
constexpr int TRINKET_CRACKED_CROWN = 92;
|
||||
constexpr int FAMILIAR_ITEM_WISP = 206;
|
||||
|
||||
// The constants of the other sections: the collectibles, trinkets, null items and characters they ask about.
|
||||
constexpr int PILL_LARGER = 32;
|
||||
constexpr int PILL_SMALLER = 33;
|
||||
constexpr int SPRITE_SCALE_UNLOCK = 3;
|
||||
constexpr int ACHIEVEMENT_HUGE = 361;
|
||||
constexpr float SIZE_STEP = 0.322f;
|
||||
@@ -290,8 +280,10 @@ static void fire_delay_evaluate(Entity_Player& p, const StatBonuses& bonus)
|
||||
flat = e(COLLECTIBLE_WAVY_CAP) * 0.75f + flat;
|
||||
rate = (float)effects.GetNullEffectNum(NULLITEM_WAVY_CAP_1) * 0.3f + flat + rate;
|
||||
if (has(120) || effects.HasCollectibleEffect(120)) rate = (n(120) + e(120)) * 0.7f + 1 + rate;
|
||||
// The original also counts Equality when a trinket slot only the constructor writes holds it, always empty.
|
||||
if (effects.HasTrinketEffect(TRINKET_EQUALITY)) rate = trinket_num(p, TRINKET_EQUALITY) * 2 + rate;
|
||||
bool isEqualityPreviewed = p.previewTrinket == TRINKET_EQUALITY && p.isPreviewAdded && p.numKeys == p.numBombs &&
|
||||
p.numBombs == p.numCoins;
|
||||
if (effects.HasTrinketEffect(TRINKET_EQUALITY) || isEqualityPreviewed)
|
||||
rate = trinket_num(p, TRINKET_EQUALITY) * 2 + rate;
|
||||
rate = n(554) * 0.5f + rate;
|
||||
if (!p.HasWeaponType(WEAPON_BRIMSTONE)) rate = n(222) + rate;
|
||||
rate = (float)p.g_fuel_count() * 0.5f + rate;
|
||||
@@ -523,7 +515,7 @@ static void damage_evaluate(Entity_Player& p, const StatBonuses& bonus)
|
||||
uint32_t empty = (uint32_t)((p.boneHearts * 2 - p.redHearts + p.maxHearts) / 2);
|
||||
if (g_game->deathmatchManager.is_active()) empty >>= 3;
|
||||
float hearts = (float)(int)empty;
|
||||
damage = std::pow(hearts + hearts, ADRENALINE_POWER) * 0.1f + damage;
|
||||
damage = pow_float(hearts + hearts, ADRENALINE_POWER) * 0.1f + damage;
|
||||
}
|
||||
if (has(157) && !effects.isDisabled)
|
||||
{
|
||||
@@ -584,7 +576,7 @@ static void damage_evaluate(Entity_Player& p, const StatBonuses& bonus)
|
||||
}
|
||||
if (p.damageMultiplierStacks > 0)
|
||||
{
|
||||
float scale = std::pow(1.5f, (float)p.damageMultiplierStacks);
|
||||
float scale = pow_float(1.5f, (float)p.damageMultiplierStacks);
|
||||
damage = scale * damage;
|
||||
melee = scale * melee;
|
||||
}
|
||||
@@ -624,7 +616,7 @@ static void shot_speed_evaluate(Entity_Player& p, const StatBonuses& bonus)
|
||||
TemporaryEffects& effects = p.temporaryEffects;
|
||||
float crownScale = bonus.crownScale;
|
||||
|
||||
float pills = bonus.isMistOrGhost ? 0 : (float)(int)(pill_uses(p, PILL_SHOT_SPEED_UP) - pill_uses(p, PILL_SHOT_SPEED_DOWN));
|
||||
float pills = bonus.isMistOrGhost ? 0 : (float)(int)(pill_uses(p, PILLEFFECT_SHOT_SPEED_UP) - pill_uses(p, PILLEFFECT_SHOT_SPEED_DOWN));
|
||||
int occult = std::min(n(572), 1);
|
||||
int mascara = std::min(n(310), 1);
|
||||
float ups = (float)(n(176) + n(669) + (((n(183) - occult) - n(342)) - e(342)) + n(397) + n(341) + n(339) + n(194)) *
|
||||
@@ -674,7 +666,7 @@ static void range_evaluate(Entity_Player& p, const StatBonuses& bonus)
|
||||
p.tearFallingSpeed = 0;
|
||||
p.tearFallingAcceleration = 0;
|
||||
|
||||
float pills = pills_weigh(p, bonus, PILL_RANGE_UP, 0.5f, PILL_RANGE_DOWN, 0.4f);
|
||||
float pills = pills_weigh(p, bonus, PILLEFFECT_RANGE_UP, 0.5f, PILLEFFECT_RANGE_DOWN, 0.4f);
|
||||
int modifier = modifier_get(bonus, p.tearRangeModifier);
|
||||
float ups = (float)(effects.GetCollectibleEffectNum(12) + modifier + p.GetCollectibleNum(71) + p.GetCollectibleNum(12) +
|
||||
effects.GetCollectibleEffectNum(71)) + bonus.range;
|
||||
@@ -779,7 +771,7 @@ static void speed_evaluate(Entity_Player& p, const StatBonuses& bonus)
|
||||
TemporaryEffects& effects = p.temporaryEffects;
|
||||
float crownScale = bonus.crownScale;
|
||||
|
||||
float pills = pills_weigh(p, bonus, PILL_SPEED_UP, 0.5f, PILL_SPEED_DOWN, 0.4f);
|
||||
float pills = pills_weigh(p, bonus, PILLEFFECT_SPEED_UP, 0.5f, PILLEFFECT_SPEED_DOWN, 0.4f);
|
||||
int rollers = p.g_fuel_count() < 1 ? n(143) + e(143) : 0;
|
||||
int sharp = std::min(n(14) + e(14), 1);
|
||||
int slow = std::min(n(13) + e(13), 1);
|
||||
@@ -850,7 +842,7 @@ static void luck_evaluate(Entity_Player& p, const StatBonuses& bonus)
|
||||
{
|
||||
auto n = [&](int id) { return (float)p.GetCollectibleNum(id); };
|
||||
|
||||
float pills = bonus.isMistOrGhost ? 0 : pill_uses(p, PILL_LUCK_UP) - pill_uses(p, PILL_LUCK_DOWN);
|
||||
float pills = bonus.isMistOrGhost ? 0 : pill_uses(p, PILLEFFECT_LUCK_UP) - pill_uses(p, PILLEFFECT_LUCK_DOWN);
|
||||
float luck = (float)modifier_get(bonus, p.luckModifier) + bonus.luck + pills + (float)p.donateLuck + p.edenLuck + n(253);
|
||||
for (int id : {46, 343, 355, 439}) luck = n(id) + luck;
|
||||
luck = luck - n(5);
|
||||
@@ -883,7 +875,7 @@ static void luck_evaluate(Entity_Player& p, const StatBonuses& bonus)
|
||||
static float tear_fall_speed(float height, float range, float shotSpeed, float acceleration)
|
||||
{
|
||||
float flight = range / shotSpeed;
|
||||
float slope = std::max((std::pow(FALL_SPEED_DECAY, flight) - 1) * FALL_SPEED_SLOPE, FALL_SPEED_MIN_SLOPE);
|
||||
float slope = std::max((pow_float(FALL_SPEED_DECAY, flight) - 1) * FALL_SPEED_SLOPE, FALL_SPEED_MIN_SLOPE);
|
||||
return ((TEAR_HEIGHT_MAX - height) - (acceleration * FALL_SPEED_RANGE_SCALE + 1) * (flight - slope)) / slope;
|
||||
}
|
||||
|
||||
@@ -1162,7 +1154,7 @@ static void flying_evaluate(Entity_Player& p)
|
||||
// The scale a size step gives: doubling each step up to two, then growing in a line.
|
||||
static float size_scale(float steps)
|
||||
{
|
||||
return steps < SIZE_SCALE_KNEE ? std::pow(SIZE_SCALE_KNEE, steps)
|
||||
return steps < SIZE_SCALE_KNEE ? pow_float(SIZE_SCALE_KNEE, steps)
|
||||
: (steps - SIZE_SCALE_KNEE) * SIZE_SCALE_SLOPE + SIZE_SCALE_AT_KNEE;
|
||||
}
|
||||
|
||||
@@ -1174,7 +1166,7 @@ static void size_evaluate(Entity_Player& p)
|
||||
Game& game = *g_game;
|
||||
bool isMistOrGhost = p.hasCurseMistEffect || p.isCoopGhost;
|
||||
|
||||
int pills = isMistOrGhost ? 0 : (int)pill_uses(p, PILL_LARGER) - (int)pill_uses(p, PILL_SMALLER);
|
||||
int pills = isMistOrGhost ? 0 : (int)pill_uses(p, PILLEFFECT_LARGER) - (int)pill_uses(p, PILLEFFECT_SMALLER);
|
||||
int steps = (int)(p.coopBabyBuffTimers[COOP_BUFF_LARGER] > 0) - (int)(p.coopBabyBuffTimers[COOP_BUFF_SMALLER] > 0) +
|
||||
pills - n(71) - effect(71);
|
||||
float body = (float)(n(12) + (steps - n(438)) + effect(12)) * SIZE_STEP + 0;
|
||||
@@ -1329,35 +1321,30 @@ static bool is_libra(Entity_Player& p)
|
||||
return p.HasCollectible(COLLECTIBLE_LIBRA) || p.GetZodiacEffect() == COLLECTIBLE_LIBRA;
|
||||
}
|
||||
|
||||
// A float power taken in double precision, as the original's wrapper does.
|
||||
static float power_double(float base, float exponent)
|
||||
{
|
||||
return (float)std::pow((double)base, (double)exponent);
|
||||
}
|
||||
|
||||
// The Libra part of 00763570: the four stats meet at their average.
|
||||
static void libra_balance(Entity_Player& p)
|
||||
{
|
||||
float dps = p.damage * FIRE_RATE_FRAMES / (p.maxFireDelay + 1);
|
||||
float dpsStat = power_double((float)std::sqrt((double)dps), LIBRA_DPS_POWER) * LIBRA_DPS_SCALE - LIBRA_OFFSET;
|
||||
float dpsStat = pow_float((float)std::sqrt((double)dps), LIBRA_DPS_POWER) * LIBRA_DPS_SCALE - LIBRA_OFFSET;
|
||||
float speedStat = p.moveSpeed * LIBRA_SPEED_SCALE - LIBRA_OFFSET;
|
||||
float rangeStat = (p.tearRange - LIBRA_RANGE_BASE) / LIBRA_RANGE_SCALE + LIBRA_OFFSET;
|
||||
float average = (rangeStat + speedStat + (dpsStat + dpsStat)) * 0.25f;
|
||||
bool isPositive = average > -LIBRA_OFFSET;
|
||||
|
||||
p.moveSpeed = (average + LIBRA_OFFSET) / LIBRA_SPEED_SCALE;
|
||||
p.maxFireDelay = isPositive ? FIRE_RATE_FRAMES / power_double((average + LIBRA_OFFSET) * LIBRA_TEARS_SCALE, LIBRA_TEARS_POWER) - 1
|
||||
p.maxFireDelay = isPositive ? FIRE_RATE_FRAMES / pow_float((average + LIBRA_OFFSET) * LIBRA_TEARS_SCALE, LIBRA_TEARS_POWER) - 1
|
||||
: LIBRA_SLOWEST_FIRE_DELAY;
|
||||
p.damage = isPositive ? power_double((average + LIBRA_OFFSET) * LIBRA_DAMAGE_SCALE, LIBRA_DAMAGE_POWER) : 0;
|
||||
p.damage = isPositive ? pow_float((average + LIBRA_OFFSET) * LIBRA_DAMAGE_SCALE, LIBRA_DAMAGE_POWER) : 0;
|
||||
p.tearRange = (average - LIBRA_OFFSET) * LIBRA_RANGE_SCALE + LIBRA_RANGE_BASE;
|
||||
p.cacheFlags |= LIBRA_CACHE;
|
||||
}
|
||||
|
||||
// Rock Bottom's part of 00763570: each stat the cache asks for never drops below its best, which it keeps. The
|
||||
// original also skips it while a trinket slot only the constructor writes holds something, always empty.
|
||||
// Rock Bottom's part of 00763570: each stat the cache asks for never drops below its best, which it keeps. An info
|
||||
// panel's preview of an item or trinket skips it.
|
||||
static void rock_bottom_hold(Entity_Player& p)
|
||||
{
|
||||
if (!p.HasCollectible(COLLECTIBLE_ROCK_BOTTOM) || p.temporaryEffects.isDisabled) return;
|
||||
if (p.previewCollectible != 0 || p.previewTrinket != 0) return;
|
||||
|
||||
auto hold = [&](uint32_t flag, float& stat, float& best)
|
||||
{
|
||||
|
||||
@@ -700,11 +700,11 @@ void Entity_Player::PlayDelayedSFX(int sound, int soundDelay, int frameDelay, fl
|
||||
delayedSfxFrameDelay = frameDelay;
|
||||
}
|
||||
|
||||
// 0075e190 Forgets the queued item, and the held sprite while one is held up.
|
||||
// 0075e190 Forgets the queued item, and the held sprite while one is held up. Its item pool type stays.
|
||||
void Entity_Player::ClearQueueItem()
|
||||
{
|
||||
if (IsHoldingItem()) heldSprite.Reset();
|
||||
queuedItem = {};
|
||||
queuedItem = {.itemPoolType = queuedItem.itemPoolType};
|
||||
}
|
||||
|
||||
// 0056ff90 Whether no item waits to be added.
|
||||
@@ -1203,12 +1203,6 @@ constexpr std::array<ConsolationDrop, 5> CONSOLATION_DROPS = {{{PICKUP_COIN, 0,
|
||||
{PICKUP_HEART, HEART_SOUL, 1},
|
||||
{PICKUP_HEART, HEART_FULL, 2}}};
|
||||
|
||||
// Pow as the original's wrapper takes it, through doubles.
|
||||
static float pow_float(float base, float exponent)
|
||||
{
|
||||
return (float)std::pow((double)base, (double)exponent);
|
||||
}
|
||||
|
||||
static void consolation_prize_gain(Entity_Player& p, RNG& rng)
|
||||
{
|
||||
std::array<float, 4> stats = {p.moveSpeed * 4.5f - 2, pow_float(30 / (p.maxFireDelay + 1), 0.75f),
|
||||
@@ -1681,15 +1675,12 @@ void Entity_Player::AddCollectible(int type, int charge, bool isFirstTime, int a
|
||||
|
||||
// The costumes AddCostume swaps for a second copy of their item (Brimstone and two others): the null items worn
|
||||
// instead. Then the Intruder's pairing with Transcendence, Eden's hairs, Sack Head's daily and Holy Grail's challenge.
|
||||
constexpr int COLLECTIBLE_DOUBLED_COSTUME_A = 665;
|
||||
constexpr int COLLECTIBLE_DOUBLED_COSTUME_B = 730;
|
||||
constexpr int NULLITEM_BRIMSTONE_DOUBLE = 45;
|
||||
constexpr int NULLITEM_DOUBLED_COSTUME_A = 125;
|
||||
constexpr int NULLITEM_DOUBLED_COSTUME_B = 126;
|
||||
constexpr int NULLITEM_EDEN_HAIR = 12;
|
||||
constexpr int NULLITEM_EDEN_HAIR_B = 88;
|
||||
constexpr int NULLITEM_INTRUDER_TRANSCENDENCE = 132;
|
||||
constexpr int COLLECTIBLE_SACK_HEAD_COSTUME = 424;
|
||||
constexpr int COLLECTIBLE_HOLY_GRAIL = 184;
|
||||
constexpr int DAILY_COSTUME_PRIORITY_BONUS = 3;
|
||||
|
||||
@@ -1721,11 +1712,11 @@ static ItemConfig_Item* costume_item_get(Entity_Player& player, ItemConfig_Item*
|
||||
|
||||
if (item->id == COLLECTIBLE_BRIMSTONE && player.GetCollectibleNum(COLLECTIBLE_BRIMSTONE) > 1)
|
||||
item = items.GetNullItem(NULLITEM_BRIMSTONE_DOUBLE);
|
||||
if (item && item->type == ITEM_PASSIVE && item->id == COLLECTIBLE_DOUBLED_COSTUME_A &&
|
||||
player.GetCollectibleNum(COLLECTIBLE_DOUBLED_COSTUME_A) > 1)
|
||||
if (item && item->type == ITEM_PASSIVE && item->id == COLLECTIBLE_GUPPYS_EYE &&
|
||||
player.GetCollectibleNum(COLLECTIBLE_GUPPYS_EYE) > 1)
|
||||
item = items.GetNullItem(NULLITEM_DOUBLED_COSTUME_A);
|
||||
if (item && item->type == ITEM_PASSIVE && item->id == COLLECTIBLE_DOUBLED_COSTUME_B &&
|
||||
player.GetCollectibleNum(COLLECTIBLE_DOUBLED_COSTUME_B) > 1)
|
||||
if (item && item->type == ITEM_PASSIVE && item->id == COLLECTIBLE_GLASS_EYE &&
|
||||
player.GetCollectibleNum(COLLECTIBLE_GLASS_EYE) > 1)
|
||||
item = items.GetNullItem(NULLITEM_DOUBLED_COSTUME_B);
|
||||
return item;
|
||||
}
|
||||
@@ -1763,7 +1754,7 @@ void Entity_Player::AddCostume(ItemConfig_Item* item, bool isItemStateOnly)
|
||||
costume.isItemStateOnly = isItemStateOnly;
|
||||
costume.playerType = -1;
|
||||
if (g_game->dailyChallenge.specialDailyId == SPECIAL_DAILY_HALLOWEEN && item->IsCollectible() &&
|
||||
item->id == COLLECTIBLE_SACK_HEAD_COSTUME)
|
||||
item->id == COLLECTIBLE_SACK_HEAD)
|
||||
costume.priority += DAILY_COSTUME_PRIORITY_BONUS;
|
||||
costume.sprite.Load(item->costume.anm2Path, GRAPHICS_DEFER);
|
||||
if (is_eden_hair(item)) eden_hair_apply(costume.sprite);
|
||||
@@ -2015,8 +2006,6 @@ void Entity_Player::UpdateCostumes()
|
||||
// overlay animation. Costumes playing an item's own animation keep it.
|
||||
void Entity_Player::costume_heads_update(int blinkFrame)
|
||||
{
|
||||
constexpr int HEAD_IDLE_BLINK_LIMIT = 9;
|
||||
|
||||
for (PlayerCostumeMap& map : playerCostumeMap)
|
||||
{
|
||||
if (map.index < 0 || map.isBodyLayer) continue;
|
||||
@@ -2027,7 +2016,7 @@ void Entity_Player::costume_heads_update(int blinkFrame)
|
||||
if (!head->isLooping)
|
||||
{
|
||||
std::string idle = headAnim + "_Idle";
|
||||
if (blinkTime < HEAD_IDLE_BLINK_LIMIT && costume.sprite.GetAnimationData(idle)) costume.sprite.Play(idle);
|
||||
if (blinkFrame == 0 && costume.sprite.GetAnimationData(idle)) costume.sprite.Play(idle);
|
||||
else costume.sprite.SetFrame(headAnim, blinkFrame);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -106,7 +106,7 @@ void Entity_Player::AddDollarBillEffect()
|
||||
}
|
||||
|
||||
// The Black Bean's effect farts every fifth frame it has left, pushing enemies away under a smoke cloud.
|
||||
static void black_bean_update(Entity_Player& player)
|
||||
void black_bean_update(Entity_Player& player)
|
||||
{
|
||||
TemporaryEffect* bean = player.temporaryEffects.GetCollectibleEffect(COLLECTIBLE_BLACK_BEAN);
|
||||
if (!bean || bean->cooldown % BLACK_BEAN_FART_PERIOD != 0) return;
|
||||
@@ -150,7 +150,7 @@ static ColorMod invincible_flash_color()
|
||||
// The invincible effects (My Little Unicorn, a charging Taurus, the Gamekid, Unicorn Stump): the first one on races
|
||||
// the music (Unicorn Stump warbles it now and then), and the player flashes colours every fourth frame, then
|
||||
// flickers out over its last 30.
|
||||
static void invincible_effects_update(Entity_Player& player)
|
||||
void invincible_effects_update(Entity_Player& player)
|
||||
{
|
||||
TemporaryEffects& effects = player.temporaryEffects;
|
||||
MusicManager& music = g_manager->musicManager;
|
||||
@@ -205,7 +205,7 @@ static void placenta_update(Entity_Player& player)
|
||||
}
|
||||
|
||||
// A spot of creep under the player, randomly sized, before its first update.
|
||||
static Entity* creep_drop(Entity_Player& player, int variant)
|
||||
Entity* creep_drop(Entity_Player& player, int variant)
|
||||
{
|
||||
uint32_t seed = Random();
|
||||
Entity* creep = g_game->Spawn({.position = player.pos, .spawner = &player, .type = ENTITY_EFFECT,
|
||||
@@ -268,17 +268,20 @@ static void aquarius_update(Entity_Player& player)
|
||||
creep->Update();
|
||||
}
|
||||
|
||||
// The pieces of the items' frame (update_effects 00794e50) for collectibles 1 to 366, in their order there: the Black
|
||||
// Bean, the invincible effects, 3 Dollar Bill, Placenta, Ball of Tar, Taurus and Aquarius.
|
||||
void passives_frame_update(Entity_Player& player)
|
||||
// The pieces of the items' frame (update_effects 00794e50) for 3 Dollar Bill, Placenta and Ball of Tar, in their
|
||||
// order there.
|
||||
void passive_drops_update(Entity_Player& player)
|
||||
{
|
||||
black_bean_update(player);
|
||||
invincible_effects_update(player);
|
||||
if (player.HasCollectible(COLLECTIBLE_3_DOLLAR_BILL) && g_game->room->GetFrameCount() % DOLLAR_BILL_PERIOD == 0)
|
||||
player.AddDollarBillEffect();
|
||||
placenta_update(player);
|
||||
if (player.HasCollectible(COLLECTIBLE_BALL_OF_TAR) && player.IsFrame(CREEP_PERIOD, 0) && random_below(TAR_ODDS) > 1)
|
||||
creep_drop(player, EFFECT_PLAYER_CREEP_BLACK)->Update();
|
||||
}
|
||||
|
||||
// Taurus' and Aquarius' pieces of the items' frame, in their order there.
|
||||
void zodiac_frame_update(Entity_Player& player)
|
||||
{
|
||||
taurus_update(player);
|
||||
aquarius_update(player);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,11 @@ constexpr int ANEMIC_VERSUS_FRAMES = 300;
|
||||
|
||||
// The passive collectibles' (1 to 366) pieces other files call: the effects the frame and stats are written for, the
|
||||
// items' frame, the walking items' costumes and the hit, Cursed Eye's teleport and the last heart's saves.
|
||||
void passives_frame_update(Entity_Player& player);
|
||||
void black_bean_update(Entity_Player& player);
|
||||
void invincible_effects_update(Entity_Player& player);
|
||||
void passive_drops_update(Entity_Player& player);
|
||||
void zodiac_frame_update(Entity_Player& player);
|
||||
Entity* creep_drop(Entity_Player& player, int variant);
|
||||
void walking_items_animate(Entity_Player& player);
|
||||
void book_of_belial_passive_update(Entity_Player& player);
|
||||
void gnawed_leaf_update(Entity_Player& player);
|
||||
|
||||
@@ -26,10 +26,6 @@ constexpr int CARD_ID_VANILLA_LAST = 97;
|
||||
constexpr float ENDLESS_NAMELESS_CHANCE = 0.25f;
|
||||
constexpr float ENDLESS_NAMELESS_CHANCE_DOUBLE = 0.33f;
|
||||
constexpr float ENDLESS_NAMELESS_CHANCE_TRIPLE = 0.5f;
|
||||
|
||||
constexpr int PILL_ID_TEARS_UP = 16;
|
||||
constexpr int PILL_ID_GULP = 43;
|
||||
constexpr int PILL_ID_EXPERIMENTAL = 49;
|
||||
constexpr int PILL_ID_COUNT = 50;
|
||||
constexpr int ACHIEVEMENT_GULP = 386;
|
||||
constexpr int ANNOUNCER_FRAMES_RANDOM = 900;
|
||||
@@ -367,7 +363,7 @@ void Entity_Player::UseCard(int cardType, uint32_t useFlag)
|
||||
// 00763290 Unlocks the tears ups achievement once ten Tears Up pills and tears up items are taken.
|
||||
void tears_up_unlock_check(Entity_Player& player)
|
||||
{
|
||||
int tearsUps = PILL_ID_TEARS_UP < (int)player.pillEffectUses.size() ? player.pillEffectUses[PILL_ID_TEARS_UP] : 0;
|
||||
int tearsUps = PILLEFFECT_TEARS_UP < (int)player.pillEffectUses.size() ? player.pillEffectUses[PILLEFFECT_TEARS_UP] : 0;
|
||||
for (ItemConfig_Item* item : g_manager->itemConfig.GetTaggedItems(TAG_TEARS_UP))
|
||||
if (item->IsCollectible()) tearsUps += player.collectibleCounts[item->id];
|
||||
if (tearsUps >= TEARS_UP_UNLOCK_COUNT) g_manager->persistentGameData.TryUnlock(ACHIEVEMENT_TEARS_UP_ITEMS);
|
||||
@@ -417,11 +413,11 @@ void Entity_Player::UsePill(int pillEffect, int pillColor, uint32_t useFlags)
|
||||
name = string_scramble_seeded(name);
|
||||
description = string_scramble_seeded(description);
|
||||
}
|
||||
if (!(useFlags & USE_NOHUD) && pillEffect != PILL_ID_EXPERIMENTAL)
|
||||
if (!(useFlags & USE_NOHUD) && pillEffect != PILLEFFECT_EXPERIMENTAL)
|
||||
game.hud.show_pill_name(this, name.c_str(), description.c_str());
|
||||
if (pillEffect >= 0 && pillEffect < (int)pillEffectUses.size()) pillEffectUses[pillEffect] += isHorse ? 2 : 1;
|
||||
tears_up_unlock_check(*this);
|
||||
if (pillEffectUses.size() > PILL_ID_GULP && pillEffectUses[PILL_ID_GULP] > GULP_UNLOCK_USES)
|
||||
if (pillEffectUses.size() > PILLEFFECT_GULP && pillEffectUses[PILLEFFECT_GULP] > GULP_UNLOCK_USES)
|
||||
g_manager->persistentGameData.TryUnlock(ACHIEVEMENT_GULP);
|
||||
|
||||
int frames = announcer_frames();
|
||||
|
||||
@@ -19,8 +19,6 @@ constexpr int COLLECTIBLE_BELIAL_PARTNER = 474;
|
||||
constexpr int COLLECTIBLE_BELIAL_EFFECT = 214;
|
||||
constexpr int COLLECTIBLE_POKE_GO = 505;
|
||||
constexpr int COLLECTIBLE_MERCURIUS = 590;
|
||||
constexpr int NULL_ITEM_BELIAL = 123;
|
||||
constexpr int NULL_ITEM_FORGOTTEN_CHALLENGE = 106;
|
||||
constexpr int BELIAL_NULL_COUNT = 4;
|
||||
constexpr int VERSUS_EFFECT_COOLDOWN = 300;
|
||||
constexpr int CHALLENGE_FORGOTTEN_COSTUME = 42;
|
||||
@@ -327,7 +325,7 @@ void Entity_Player::room_enter()
|
||||
AddCollectible(COLLECTIBLE_DOGMA, 0, true, 0, 0);
|
||||
if (playerType == PLAYER_THEFORGOTTEN_B && game.challenge == CHALLENGE_FORGOTTEN_COSTUME)
|
||||
{
|
||||
ItemConfig_Item* costume = g_manager->itemConfig.GetNullItem(NULL_ITEM_FORGOTTEN_CHALLENGE);
|
||||
ItemConfig_Item* costume = g_manager->itemConfig.GetNullItem(NULLITEM_FORGOTTEN_BOMB);
|
||||
for (PlayerCostumeMap& layer : playerCostumeMap)
|
||||
{
|
||||
if (layer.index < 0 || layer.isBodyLayer || costumeSpriteDescs[layer.index].item != costume) continue;
|
||||
@@ -348,7 +346,7 @@ void Entity_Player::room_enter()
|
||||
if (game.deathmatchManager.state >= DEATHMATCH_INTRO) effect.cooldown = VERSUS_EFFECT_COOLDOWN;
|
||||
temporaryEffects.AddEffect(effect, true, 1);
|
||||
}
|
||||
temporaryEffects.AddNullEffect(NULL_ITEM_BELIAL, true, BELIAL_NULL_COUNT);
|
||||
temporaryEffects.AddNullEffect(NULLITEM_JUDAS_BIRTHRIGHT, true, BELIAL_NULL_COUNT);
|
||||
}
|
||||
|
||||
moveToTarget = vector_make(0, 0);
|
||||
|
||||
@@ -145,8 +145,6 @@ constexpr int COLLECTIBLE_TERRA = 592;
|
||||
constexpr int COLLECTIBLE_OCULAR_RIFT = 606;
|
||||
constexpr int COLLECTIBLE_LODESTONE = 617;
|
||||
constexpr int COLLECTIBLE_TROPICAMIDE = 659;
|
||||
constexpr int TRINKET_PINKY_EYE = 30;
|
||||
constexpr int TRINKET_PUSH_PIN = 31;
|
||||
constexpr int TRINKET_BLISTER = 77;
|
||||
constexpr int TRINKET_BLACK_TOOTH = 95;
|
||||
constexpr int TRINKET_NOSE_GOBLIN = 98;
|
||||
@@ -527,8 +525,8 @@ static void look_items_apply(Entity_Player& player, TearParams& params, const Te
|
||||
{
|
||||
float roll = random_unit() * 2 - 1;
|
||||
params.tearVariant = TEAR_ROCK;
|
||||
params.tearScale *= std::pow(2.0f, roll * TERRA_SCALE_EXPONENT);
|
||||
params.tearDamage *= std::pow(2.0f, roll);
|
||||
params.tearScale *= pow_float(2, roll * TERRA_SCALE_EXPONENT);
|
||||
params.tearDamage *= pow_float(2, roll);
|
||||
}
|
||||
if (player.temporaryEffects.HasNullEffect(NULLITEM_REVERSE_HANGED_MAN)) flags.set(TEAR_COIN_DROP_DEATH);
|
||||
if (player.temporaryEffects.HasCollectibleEffect(COLLECTIBLE_CROWN_OF_LIGHT)) params.tearVariant = TEAR_DIAMOND;
|
||||
@@ -900,7 +898,7 @@ TearParams Entity_Player::GetTearHitParams(WeaponType weaponType, float damageSc
|
||||
blood_baby_apply(*this, params, *state.familiar);
|
||||
mass_knockback_apply(*this, params);
|
||||
|
||||
float size = params.tearScale > 1 ? std::log(params.tearScale) + 1 : params.tearScale;
|
||||
float size = params.tearScale > 1 ? log_float(params.tearScale) + 1 : params.tearScale;
|
||||
float baseDamage = state.baseDamage;
|
||||
params.tearScale =
|
||||
(std::sqrt(baseDamage) * TEAR_SCALE_ROOT + size * TEAR_SCALE_SIZE + baseDamage * TEAR_SCALE_DAMAGE) *
|
||||
|
||||
@@ -956,7 +956,7 @@ void purity_gain(Entity_Player& player)
|
||||
}
|
||||
|
||||
// A crown's glow following its condition: the effect and the glowing float come on together, or go together.
|
||||
static void crown_glow_set(Entity_Player& player, int crown, ANM2& sprite, bool isLit)
|
||||
void crown_glow_set(Entity_Player& player, int crown, ANM2& sprite, bool isLit)
|
||||
{
|
||||
TemporaryEffects& effects = player.temporaryEffects;
|
||||
if (isLit == effects.HasCollectibleEffect(crown)) return;
|
||||
@@ -1108,11 +1108,16 @@ static void louse_update(Entity_Player& player)
|
||||
for (int i = player.GetTrinketMultiplier(TRINKET_LOUSE); i > 0; i--) player.ThrowBlueSpider(player.pos, {});
|
||||
}
|
||||
|
||||
// The trinkets' part of the items' frame (00794e50), in their order there: Hairpin, Mysterious Candy, Louse and
|
||||
// Rainbow Worm, whose tear effect changes every 90 frames.
|
||||
void trinkets_frame_update(Entity_Player& player)
|
||||
// Hairpin's piece of the items' frame (00794e50), at its start.
|
||||
void hairpin_frame_update(Entity_Player& player)
|
||||
{
|
||||
if (player.HasTrinket(TRINKET_HAIRPIN)) hairpin_update(player);
|
||||
}
|
||||
|
||||
// The trinkets' block of the items' frame (00794e50), in its order there: Mysterious Candy, Louse and Rainbow Worm,
|
||||
// whose tear effect changes every 90 frames.
|
||||
void trinkets_frame_update(Entity_Player& player)
|
||||
{
|
||||
if (player.HasTrinket(TRINKET_MYSTERIOUS_CANDY) && player.variant == PLAYER_VARIANT_PLAYER) mysterious_candy_update(player);
|
||||
if (player.HasTrinket(TRINKET_LOUSE)) louse_update(player);
|
||||
if (player.HasTrinket(TRINKET_RAINBOW_WORM) && g_game->frameCount % RAINBOW_WORM_FRAMES == 0)
|
||||
@@ -1154,8 +1159,8 @@ void coin_trinkets_collect(Entity_Pickup& pickup, Entity_Player& player, int val
|
||||
constexpr float BUTT_FART_RADIUS = 85;
|
||||
constexpr float BUTT_BEAN_RADIUS = 120;
|
||||
constexpr int BURNT_PENNY_BOMB = 1;
|
||||
float threshold = std::pow(0.75f, (float)value);
|
||||
float doubling = std::pow(0.5f, (float)value);
|
||||
float threshold = pow_float(0.75f, (float)value);
|
||||
float doubling = pow_float(0.5f, (float)value);
|
||||
|
||||
if (player.HasTrinket(TRINKET_BURNT_PENNY) && is_penny_rolled(player, TRINKET_BURNT_PENNY, threshold))
|
||||
penny_drop(player, PICKUP_BOMB, BURNT_PENNY_BOMB);
|
||||
|
||||
@@ -52,6 +52,7 @@ void trinkets_smelt(Entity_Player& player);
|
||||
// The player's frame and the items' frame.
|
||||
void equality_update(Entity_Player& player);
|
||||
void trinket_teleports_update(Entity_Player& player);
|
||||
void hairpin_frame_update(Entity_Player& player);
|
||||
void trinkets_frame_update(Entity_Player& player);
|
||||
|
||||
// A new room, the hearts changing, a hit.
|
||||
@@ -61,6 +62,7 @@ void crowns_room_enter(Entity_Player& player);
|
||||
void dice_bag_room_enter(Entity_Player& player);
|
||||
void crowns_update(Entity_Player& player);
|
||||
bool is_dark_prince_lit(Entity_Player& player);
|
||||
void crown_glow_set(Entity_Player& player, int crown, ANM2& sprite, bool isLit);
|
||||
bool late_items_hit_trigger(Entity_Player& player, const ItemsHit& hit, HitStep step);
|
||||
void cursed_skull_teleport(Entity_Player& player);
|
||||
|
||||
|
||||
@@ -44,8 +44,6 @@ constexpr float LEADER_PUSH_MAX = 2;
|
||||
constexpr float SALVATION_HALO_SCALE = 1.2f;
|
||||
constexpr float SALVATION_HALO_RISE = -15;
|
||||
constexpr int SALVATION_TURN_FRAMES = 360;
|
||||
constexpr float SALVATION_GROWTH = 0.1f;
|
||||
constexpr float SALVATION_SCALE_MAX = 2;
|
||||
constexpr float LAZARUS_TWIN_SPREAD = 15;
|
||||
constexpr float BREATH_OF_LIFE_RISE = -15;
|
||||
constexpr float FX_POOF_DEPTH = -10;
|
||||
@@ -208,12 +206,10 @@ static void hud_update(Entity_Player& player)
|
||||
if (player.playerHUD) player.playerHUD->Update();
|
||||
}
|
||||
|
||||
// 007d4340 Salvation's halo grows a tenth for each room its effect counts, up to twice, over its own 1.2.
|
||||
// Salvation's halo is its size (get_salvation_scale) over its own 1.2.
|
||||
float salvation_halo_scale_get(Entity_Player& player)
|
||||
{
|
||||
TemporaryEffect* effect = player.temporaryEffects.GetCollectibleEffect(COLLECTIBLE_SALVATION);
|
||||
float count = effect ? (float)effect->count : 0;
|
||||
return std::clamp(count * SALVATION_GROWTH + 1, 1.0f, SALVATION_SCALE_MAX) * SALVATION_HALO_SCALE;
|
||||
return player.get_salvation_scale() * SALVATION_HALO_SCALE;
|
||||
}
|
||||
|
||||
// Salvation's halo floats above the player at its size, turning a degree a frame.
|
||||
@@ -1064,8 +1060,8 @@ static void players_push_apart(Entity_Player& player)
|
||||
}
|
||||
|
||||
// The temporary effects' part of 00782af0: Mars' dash, a pony's charge and Recall ignore knockback, the stats are
|
||||
// evaluated when the effects changed, and the timed ones count down. The items' frame (update_effects) runs only
|
||||
// its written pieces, closed by the PostPEffectUpdate callback.
|
||||
// evaluated when the effects changed, and the timed ones count down before the items' frame (update_effects), closed
|
||||
// by the PostPEffectUpdate callback.
|
||||
static void temporary_effects_update(Entity_Player& player)
|
||||
{
|
||||
TemporaryEffects& effects = player.temporaryEffects;
|
||||
@@ -1081,11 +1077,8 @@ static void temporary_effects_update(Entity_Player& player)
|
||||
effects.isEvaluateCachePending = false;
|
||||
if (player.HasEntityFlags(FLAG_INTERPOLATION_UPDATE)) return;
|
||||
|
||||
tainted_frame_update(player);
|
||||
effects.Update();
|
||||
character_frame_update(player);
|
||||
passives_frame_update(player);
|
||||
trinkets_frame_update(player);
|
||||
items_frame_update(player);
|
||||
lua_engine_get().PostPEffectUpdate(&player);
|
||||
}
|
||||
|
||||
@@ -364,8 +364,6 @@ constexpr int BONE_PARTICLE_SUBTYPE = 1;
|
||||
|
||||
constexpr int SOUND_INFAMY_BLOCK = 863;
|
||||
constexpr int SOUND_PIN_GOO = 934;
|
||||
|
||||
constexpr int COLLECTIBLE_BETRAYAL = 391;
|
||||
constexpr uint32_t CHALLENGE_BROKEN_WATCH = 22;
|
||||
|
||||
// The familiars shots hurt (the two Infamy guards as the player does), and the subtype of the one that is spared.
|
||||
|
||||
@@ -867,7 +867,8 @@ void Entity_Tear::trail_spawn()
|
||||
if ((!isBomb && variant != TEAR_BALLOON && variant != TEAR_BALLOON_BRIMSTONE) || !IsFrame(2, 0)) return;
|
||||
|
||||
uint32_t seed = Random();
|
||||
Vector spread = vector_scale(random_direction(), random_unit() * TRAIL_SPREAD * fScale);
|
||||
Vector direction = random_direction();
|
||||
Vector spread = vector_scale(vector_scale(vector_scale(direction, random_unit()), TRAIL_SPREAD), fScale);
|
||||
Vector trailVelocity = vector_add(vector_scale(velocity, TRAIL_SPEED_SHARE), spread);
|
||||
Entity* trail = g_game->Spawn({.position = pos, .velocity = trailVelocity, .type = ENTITY_EFFECT,
|
||||
.variant = isBomb ? EFFECT_DARK_BALL_SMOKE_PARTICLE : EFFECT_HAEMO_TRAIL, .seed = seed});
|
||||
|
||||
@@ -223,7 +223,10 @@ static void dip_scoot(Entity_Familiar& dip, float speedScale)
|
||||
dip.friction = savedFriction;
|
||||
}
|
||||
else if (goal == dip.player)
|
||||
destination = vector_add(destination, vector_scale(random_direction(), random_unit() * DIP_WANDER));
|
||||
{
|
||||
Vector direction = random_direction();
|
||||
destination = vector_add(destination, vector_scale(direction, random_unit() * DIP_WANDER));
|
||||
}
|
||||
else if (dip.subtype == DIP_SUBTYPE_RED) speedScale = DIP_RED_CHARGE;
|
||||
|
||||
Vector heading = vector_is_zero(vector_sub(destination, dip.pos))
|
||||
|
||||
@@ -64,9 +64,7 @@ constexpr FamiliarSource FAMILIAR_SOURCES[] = {
|
||||
constexpr FamiliarSource LATE_FAMILIAR_SOURCES[] = {{565, 241}, {697, 242}};
|
||||
|
||||
// The familiars granted another way: items whose effect alone counts, the trinkets, and the counters.
|
||||
constexpr int NULLITEM_SPIN_TO_WIN_FAMILIAR = 131;
|
||||
constexpr int FAMILIAR_SPIN_TO_WIN = 244;
|
||||
constexpr int NULLITEM_HALO_FLY_LOSS = 107;
|
||||
constexpr int HALO_FLY_CAP = 10;
|
||||
constexpr int ACHIEVEMENT_CUBE_OF_MEAT_FULL = 144;
|
||||
constexpr int ACHIEVEMENT_BALL_OF_BANDAGES_FULL = 19;
|
||||
@@ -91,7 +89,6 @@ constexpr int GIANTBOOK_SUPER_BUM = 38;
|
||||
constexpr std::pair<int, int> SUPER_BUM_PARTS[] = {{COLLECTIBLE_KEY_BUM, Entity_Familiar::KEY_BUM},
|
||||
{COLLECTIBLE_DARK_BUM, Entity_Familiar::DARK_BUM},
|
||||
{COLLECTIBLE_BUM_FRIEND, Entity_Familiar::BUM_FRIEND}};
|
||||
constexpr int TRINKET_ISAACS_HEAD = 54;
|
||||
constexpr int TRINKET_SOUL = 57;
|
||||
constexpr int SOUL_TRINKET_CAP = 3;
|
||||
constexpr int FORM_RNG_SHIFT = 35;
|
||||
@@ -478,7 +475,7 @@ void familiars_evaluate(Entity_Player& p)
|
||||
for (const FamiliarSource& source : LATE_FAMILIAR_SOURCES) source_check(p, source);
|
||||
familiar_check(p, {.item = g_manager->itemConfig.GetCollectible(COLLECTIBLE_ESAU_JR),
|
||||
.rng = &p.GetCollectibleRNG(COLLECTIBLE_ESAU_JR),
|
||||
.count = p.temporaryEffects.GetNullEffectNum(NULLITEM_SPIN_TO_WIN_FAMILIAR),
|
||||
.count = p.temporaryEffects.GetNullEffectNum(NULLITEM_ESAU_JR_FAMILIAR),
|
||||
.variant = FAMILIAR_SPIN_TO_WIN});
|
||||
familiar_check(p, {.item = g_manager->itemConfig.GetCollectible(COLLECTIBLE_LEPROSY),
|
||||
.rng = &p.GetCollectibleRNG(COLLECTIBLE_LEPROSY),
|
||||
@@ -492,7 +489,7 @@ void familiars_evaluate(Entity_Player& p)
|
||||
int haloFlies = std::min(prettyFlies + p.GetCollectibleNum(COLLECTIBLE_HALO_OF_FLIES) * 2, HALO_FLY_CAP);
|
||||
familiar_check(p, {.item = g_manager->itemConfig.GetCollectible(COLLECTIBLE_HALO_OF_FLIES),
|
||||
.rng = &p.GetCollectibleRNG(COLLECTIBLE_HALO_OF_FLIES),
|
||||
.count = haloFlies - p.temporaryEffects.GetNullEffectNum(NULLITEM_HALO_FLY_LOSS) * 2,
|
||||
.count = haloFlies - p.temporaryEffects.GetNullEffectNum(NULLITEM_EXTRA_BIG_FAN) * 2,
|
||||
.variant = Entity_Familiar::FLY_ORBITAL});
|
||||
source_check(p, {COLLECTIBLE_DEAD_CAT, Entity_Familiar::DEAD_CAT, COUNT_OWNED});
|
||||
|
||||
@@ -648,8 +645,8 @@ void Entity_Familiar::RemoveFromPlayer(uint8_t)
|
||||
isEvaluated = true;
|
||||
break;
|
||||
case BIG_FAN:
|
||||
if (!owner.temporaryEffects.HasNullEffect(NULLITEM_HALO_FLY_LOSS)) break;
|
||||
owner.temporaryEffects.RemoveNullEffect(NULLITEM_HALO_FLY_LOSS, 1);
|
||||
if (!owner.temporaryEffects.HasNullEffect(NULLITEM_EXTRA_BIG_FAN)) break;
|
||||
owner.temporaryEffects.RemoveNullEffect(NULLITEM_EXTRA_BIG_FAN, 1);
|
||||
return owner.AddCacheFlags(CACHE_FAMILIARS), owner.EvaluateItems();
|
||||
case SUPER_BUM:
|
||||
{
|
||||
@@ -667,7 +664,7 @@ void Entity_Familiar::RemoveFromPlayer(uint8_t)
|
||||
owner.IncrementPlayerFormCounter(PLAYER_FORM_SPIDER_BABY, -owner.playerForms[PLAYER_FORM_SPIDER_BABY]);
|
||||
return;
|
||||
case ESAU_JR:
|
||||
owner.temporaryEffects.RemoveNullEffect(NULLITEM_HALO_FLY_LOSS, 1);
|
||||
owner.temporaryEffects.RemoveNullEffect(NULLITEM_EXTRA_BIG_FAN, 1);
|
||||
return owner.AddCacheFlags(CACHE_FAMILIARS), owner.EvaluateItems();
|
||||
}
|
||||
|
||||
|
||||
@@ -294,8 +294,8 @@ void intruder_player_hurt(Entity_Familiar& intruder, const DamageEvent& hit)
|
||||
// One of Boiled Baby's burst: a blood tear (an enemy shot for a charmed one) arcing up, small or big.
|
||||
static void boiled_shot_fire(Entity_Familiar& baby, float damage)
|
||||
{
|
||||
Vector velocity =
|
||||
vector_scale(random_direction(), BOILED_SPEED * (random_unit() * BOILED_SPEED_RANGE + BOILED_SPEED_MIN));
|
||||
Vector velocity = vector_scale(random_direction(), BOILED_SPEED);
|
||||
velocity = vector_scale(velocity, random_unit() * BOILED_SPEED_RANGE + BOILED_SPEED_MIN);
|
||||
bool isCharmed = baby.HasEntityFlags(FLAG_CHARM);
|
||||
ColorMod color = COLOR_DEFAULT;
|
||||
if (!isCharmed && baby.isLilDelirium) std::ranges::copy(BOILED_DELIRIUM_COLORIZE, color._colorize);
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include <algorithm>
|
||||
|
||||
// The items and trinkets the familiars' shots read.
|
||||
constexpr int TRINKET_ISAACS_HEAD_ID = 54;
|
||||
|
||||
// Fruity Plum's fruit tears: their damage, their two sizes (the tear scales of sizes 2 and 3), how much bigger, and
|
||||
// their slow fall.
|
||||
@@ -376,7 +375,7 @@ static void shot_variant_apply(Entity_Familiar& familiar, FamiliarShot& shot, in
|
||||
if (variant == Entity_Familiar::ISAACS_HEAD)
|
||||
{
|
||||
shot.flags.set(TEAR_PIERCING);
|
||||
int heads = player.GetTrinketMultiplier(TRINKET_ISAACS_HEAD_ID);
|
||||
int heads = player.GetTrinketMultiplier(TRINKET_ISAACS_HEAD);
|
||||
if (heads > 1) shot.damage = heads > 2 ? (float)((double)player.damage * 1.5) : player.damage;
|
||||
}
|
||||
else if (variant == Entity_Familiar::GHOST_BABY || rainbow == 1 || mimic == 6)
|
||||
|
||||
@@ -1237,12 +1237,14 @@ void my_shadow_touch(Entity_Familiar& shadow, Entity& collider)
|
||||
if (!collider.IsVulnerableEnemy(shadow.player)) return;
|
||||
if (entity_query(ENTITY_CHARGER, 0).size() > MY_SHADOW_CHARGER_LIMIT) return;
|
||||
|
||||
Vector spot = vector_add(shadow.pos, vector_scale(random_direction(), MY_SHADOW_REACH * random_unit()));
|
||||
Vector direction = random_direction();
|
||||
Vector spot = vector_add(shadow.pos, vector_scale(vector_scale(direction, MY_SHADOW_REACH), random_unit()));
|
||||
for (int i = 0; i < MY_SHADOW_TRIES && room_grid_collision_at(spot) != 0; i++)
|
||||
{
|
||||
float turn = random_unit() * PI_ROUGH * 2;
|
||||
float reach = random_unit() * MY_SHADOW_REACH;
|
||||
spot = vector_add(shadow.pos, vector_make(std::cos(turn) * reach, std::sin(turn) * reach));
|
||||
float share = random_unit();
|
||||
spot = vector_add(shadow.pos, vector_make(std::cos(turn) * MY_SHADOW_REACH * share,
|
||||
std::sin(turn) * MY_SHADOW_REACH * share));
|
||||
}
|
||||
if (room_grid_collision_at(spot) != 0) return;
|
||||
|
||||
|
||||
@@ -1179,7 +1179,7 @@ static void remote_wisp_lob(Entity_Familiar& wisp, WispTear& tear)
|
||||
tear.scale *= REMOTE_TEAR_SCALE;
|
||||
|
||||
float frames = vector_length(vector_sub(wisp.pos, landing)) / vector_length(tear.velocity);
|
||||
float fall = std::max((std::pow(REMOTE_FALL_DRAG, frames) - 1) * REMOTE_FALL_SPAN, REMOTE_FALL_MIN);
|
||||
float fall = std::max((pow_float(REMOTE_FALL_DRAG, frames) - 1) * REMOTE_FALL_SPAN, REMOTE_FALL_MIN);
|
||||
tear.fallingSpeed = (REMOTE_LAUNCH_HEIGHT - (frames - fall) * REMOTE_LAUNCH_SLOPE) / fall;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -88,7 +88,7 @@ enum DebugFlag : uint32_t
|
||||
// The run's state flags (Lua's GameStateFlag) the curated code reads, by bit.
|
||||
enum GameStateFlag : int
|
||||
{
|
||||
GAME_STATE_FAMINE_SPAWNED = 0,
|
||||
GAME_STATE_FAMINE_SPAWNED = 0, // Lua's name, though the game sets it when an angel room's door first spawns
|
||||
GAME_STATE_DEVILROOM_SPAWNED = 5,
|
||||
GAME_STATE_DEVILROOM_VISITED = 6,
|
||||
GAME_STATE_BOOK_PICKED_UP = 8,
|
||||
|
||||
+1
-1
@@ -693,7 +693,7 @@ float Entity_Player::GetGreedDonationJamChance(PersistentGameData& data)
|
||||
if ((uint32_t)playerType >= (uint32_t)COMPLETION_PLAYER_TYPE_COUNT) return DONATION_JAM_UNKNOWN;
|
||||
|
||||
uint32_t donated = data.eventCounters[COMPLETION_MARKS[playerType][COMPLETION_GREED_DONATION].counter];
|
||||
float chance = std::min(std::exp((float)donated * DONATION_JAM_GROWTH) - 1, DONATION_JAM_MAX);
|
||||
float chance = std::min(exp_float((float)donated * DONATION_JAM_GROWTH) - 1, DONATION_JAM_MAX);
|
||||
chance = std::floor(chance * DONATION_JAM_SHARE + HALF);
|
||||
return g_game->difficulty == DIFFICULTY_GREEDIER ? std::min(DONATION_JAM_GREEDIER_MAX, chance) : chance;
|
||||
}
|
||||
|
||||
@@ -35,8 +35,8 @@ constexpr int GREED_EXIT_WAVE = 10;
|
||||
// The run state bits doors set and read: Mega Satan's door unlocked, and Mom's Heart's exit opened.
|
||||
constexpr uint64_t GAME_STATE_HEART_EXIT_OPENED = 1ull << 52;
|
||||
|
||||
// The items, trinkets and challenge doors answer to.
|
||||
constexpr int FAMILIAR_KEY_FULL = 28;
|
||||
// The state Mega Satan's opening door gives the familiars it signals. The original signals Star of Bethlehem
|
||||
// (variant 236), not the full key (28).
|
||||
constexpr int FAMILIAR_STATE_KEY_DOOR = 1;
|
||||
|
||||
// How far a door's sprite stands out from the wall.
|
||||
@@ -795,7 +795,7 @@ void GridEntity_Door::UpdateAnimation()
|
||||
sprite.Play(openAnimation);
|
||||
if (targetRoomIdx == ROOM_MEGA_SATAN_IDX)
|
||||
for (Entity* entity : g_game->room->entityList.updateEL)
|
||||
if (entity->type == ENTITY_FAMILIAR && entity->variant == FAMILIAR_KEY_FULL)
|
||||
if (entity->type == ENTITY_FAMILIAR && entity->variant == Entity_Familiar::STAR_OF_BETHLEHEM)
|
||||
static_cast<Entity_Familiar*>(entity)->state = FAMILIAR_STATE_KEY_DOOR;
|
||||
}
|
||||
|
||||
@@ -916,7 +916,7 @@ void GridEntity_Door::Update()
|
||||
continue;
|
||||
|
||||
g_game->save_rewind_state(slot);
|
||||
player->TakeDamage(1, DAMAGE_CURSED_DOOR | DAMAGE_NO_PENALTIES, EntityRef(), 0);
|
||||
player->TakeDamage(1, DAMAGE_CURSED_DOOR | DAMAGE_NO_PENALTIES, EntityRef(), HIT_COUNTDOWN);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+88
-55
@@ -3,10 +3,12 @@
|
||||
#include "entity_config.h"
|
||||
#include "entity_effect_combat.h"
|
||||
#include "entity_familiar.h"
|
||||
#include "entity_knife.h"
|
||||
#include "entity_npc.h"
|
||||
#include "entity_pickup.h"
|
||||
#include "entity_player.h"
|
||||
#include "game.h"
|
||||
#include "grid_entity_rock.h"
|
||||
#include "log.h"
|
||||
#include "manager.h"
|
||||
#include "npc_ai.h"
|
||||
@@ -66,6 +68,8 @@ constexpr int HALLOWED_AURA_Z = 10000;
|
||||
// it drops: one in twenty its Petrified Poop, else a heart a quarter of the time (Daemon's Tail and Butt Penny take
|
||||
// some back) or a penny.
|
||||
constexpr float POOP_DROP_CHANCE = 0.1f;
|
||||
constexpr float AXE_DROP_CHANCE = 0.2f;
|
||||
constexpr float POOP_DROP_SPEED = 2;
|
||||
constexpr float GIGA_DROP_CHANCE = 0.25f;
|
||||
constexpr float LOW_DROP_CHANCE = 0.01f;
|
||||
constexpr float BUTT_PENNY_BASE = 0.2f;
|
||||
@@ -79,6 +83,7 @@ constexpr uint32_t BUTT_PENNY_HEART_ODDS = 3;
|
||||
// Meconium's black heart, per hundred by multiplier.
|
||||
constexpr uint32_t COUNTERFEIT_ODDS = 3;
|
||||
constexpr int GOLDEN_COINS_MIN = 5;
|
||||
constexpr int AXE_GOLDEN_COINS_MIN = 2;
|
||||
constexpr uint32_t GOLDEN_COINS_RANGE = 3;
|
||||
constexpr int COIN_THROW_ATTEMPTS = 10;
|
||||
constexpr float COIN_THROW_SPEED = 5;
|
||||
@@ -141,6 +146,15 @@ struct PoopDrop
|
||||
uint32_t seed = 0;
|
||||
};
|
||||
|
||||
// The generators of the trinkets and item a poop's drop roll asks: Daemon's Tail, Butt Penny and E. Coli, each of a
|
||||
// random owner, or none.
|
||||
struct PoopOwners
|
||||
{
|
||||
RNG* buttPenny = nullptr;
|
||||
RNG* eColi = nullptr;
|
||||
RNG* tail = nullptr;
|
||||
};
|
||||
|
||||
// Whether a poop variant is a part of the giant poop.
|
||||
static bool is_giga(int variant)
|
||||
{
|
||||
@@ -682,31 +696,35 @@ static float drop_chance_get(float chance, bool isLowDropChance)
|
||||
return isLowDropChance ? LOW_DROP_CHANCE : chance;
|
||||
}
|
||||
|
||||
// The drop roll of a poop: the owners of Daemon's Tail, Butt Penny and E. Coli drawn from ownerRng, then from rng
|
||||
// one in twenty the Petrified Poop (while in the pool), else a heart or a penny. E. Coli may still give a heart when
|
||||
// nothing drops.
|
||||
static PoopDrop poop_drop_roll(RNG& ownerRng, RNG& rng, float baseChance, bool isLowDropChance)
|
||||
// The owners of Daemon's Tail, Butt Penny and E. Coli a poop's drop roll asks, drawn from a generator in that order.
|
||||
static PoopOwners poop_owners_draw(RNG& ownerRng)
|
||||
{
|
||||
PlayerManager& players = g_game->playerManager;
|
||||
RNG* tail = nullptr;
|
||||
RNG* buttPenny = nullptr;
|
||||
RNG* eColi = nullptr;
|
||||
players.RandomTrinketOwner(TRINKET_DAEMONS_TAIL, ownerRng.Next(), &tail);
|
||||
players.RandomTrinketOwner(TRINKET_BUTT_PENNY, ownerRng.Next(), &buttPenny);
|
||||
players.RandomCollectibleOwner(COLLECTIBLE_E_COLI, ownerRng.Next(), &eColi);
|
||||
float chance = drop_chance_get(baseChance, isLowDropChance);
|
||||
PoopOwners owners;
|
||||
players.RandomTrinketOwner(TRINKET_DAEMONS_TAIL, ownerRng.Next(), &owners.tail);
|
||||
players.RandomTrinketOwner(TRINKET_BUTT_PENNY, ownerRng.Next(), &owners.buttPenny);
|
||||
players.RandomCollectibleOwner(COLLECTIBLE_E_COLI, ownerRng.Next(), &owners.eColi);
|
||||
return owners;
|
||||
}
|
||||
|
||||
// The drop roll of a poop from rng: one in twenty the Petrified Poop (while in the pool), else a heart or a penny.
|
||||
// E. Coli may still give a heart when nothing drops.
|
||||
static PoopDrop poop_drop_roll(const PoopOwners& owners, RNG& rng, float baseChance, bool isLowDropChance)
|
||||
{
|
||||
float chance = drop_chance_get(baseChance, isLowDropChance);
|
||||
if (chance <= rng.RandomFloat())
|
||||
{
|
||||
bool isHeart = eColi && eColi->RandomFloat() < chance && (rng.RandomFloat() < LOW_DROP_CHANCE || !isLowDropChance) &&
|
||||
rng.RandomFloat() < HEART_CHANCE && (!tail || tail->Next() % DAEMONS_TAIL_ODDS == 0);
|
||||
bool isHeart = owners.eColi && owners.eColi->RandomFloat() < chance &&
|
||||
(rng.RandomFloat() < LOW_DROP_CHANCE || !isLowDropChance) && rng.RandomFloat() < HEART_CHANCE &&
|
||||
(!owners.tail || owners.tail->Next() % DAEMONS_TAIL_ODDS == 0);
|
||||
return isHeart ? PoopDrop{.variant = PICKUP_HEART, .seed = rng.Next()} : PoopDrop{};
|
||||
}
|
||||
if (rng.Next() % PETRIFIED_ODDS == 0 && g_game->itemPool.RemoveTrinket(TRINKET_PETRIFIED_POOP))
|
||||
return {.subType = TRINKET_PETRIFIED_POOP, .variant = PICKUP_TRINKET, .seed = Random()};
|
||||
|
||||
bool isHeart = rng.RandomFloat() < HEART_CHANCE && (!tail || tail->Next() % DAEMONS_TAIL_ODDS == 0) &&
|
||||
(!buttPenny || buttPenny->Next() % BUTT_PENNY_HEART_ODDS == 0);
|
||||
bool isHeart = rng.RandomFloat() < HEART_CHANCE &&
|
||||
(!owners.tail || owners.tail->Next() % DAEMONS_TAIL_ODDS == 0) &&
|
||||
(!owners.buttPenny || owners.buttPenny->Next() % BUTT_PENNY_HEART_ODDS == 0);
|
||||
return {.variant = isHeart ? PICKUP_HEART : PICKUP_COIN, .seed = rng.Next()};
|
||||
}
|
||||
|
||||
@@ -759,7 +777,7 @@ void GridEntity_Poop::spawn_rewards(const PoopHit& hit)
|
||||
|
||||
RNG roll = {rng._seed, 7, 17, 21};
|
||||
if ((roll.Next() & 1) != 0) continue;
|
||||
PoopDrop drop = poop_drop_roll(roll, roll, GIGA_DROP_CHANCE, hit.isLowDropChance);
|
||||
PoopDrop drop = poop_drop_roll(poop_owners_draw(roll), roll, GIGA_DROP_CHANCE, hit.isLowDropChance);
|
||||
Entity* pickup = drop.variant == PICKUP_NULL ? nullptr
|
||||
: g_game->Spawn({.position = position, .subType = drop.subType,
|
||||
.type = ENTITY_PICKUP, .variant = drop.variant,
|
||||
@@ -771,18 +789,20 @@ void GridEntity_Poop::spawn_rewards(const PoopHit& hit)
|
||||
}
|
||||
}
|
||||
|
||||
// The golden poop's drop: one time in three its Counterfeit Penny while in the pool, else five to seven pennies
|
||||
// thrown where the way is clear.
|
||||
static void golden_drops_spawn(const Vector& position, RNG& rng)
|
||||
// The golden poop's drop: one time in three its Counterfeit Penny while in the pool, which ends the drops, else five
|
||||
// to seven pennies (two or three on an axe's extra rolls) thrown where the way is clear.
|
||||
static bool is_golden_drop_final(const Vector& position, RNG& rng, int rolls)
|
||||
{
|
||||
if (rng.Next() % COUNTERFEIT_ODDS == 0 && g_game->itemPool.RemoveTrinket(TRINKET_COUNTERFEIT_PENNY))
|
||||
{
|
||||
g_game->Spawn({.position = position, .subType = TRINKET_COUNTERFEIT_PENNY, .type = ENTITY_PICKUP,
|
||||
.variant = PICKUP_TRINKET, .seed = rng.Next()});
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
for (int coins = (int)(rng.Next() % GOLDEN_COINS_RANGE) + GOLDEN_COINS_MIN; coins > 0; coins--)
|
||||
int coins = (int)(rng.Next() % GOLDEN_COINS_RANGE) + GOLDEN_COINS_MIN;
|
||||
if (rolls > 1) coins = (int)(rng.Next() & 1) + AXE_GOLDEN_COINS_MIN;
|
||||
for (; coins > 0; coins--)
|
||||
{
|
||||
Vector velocity{};
|
||||
for (int attempt = 0; attempt < COIN_THROW_ATTEMPTS; attempt++)
|
||||
@@ -797,6 +817,7 @@ static void golden_drops_spawn(const Vector& position, RNG& rng)
|
||||
g_game->Spawn({.position = position, .velocity = velocity, .type = ENTITY_PICKUP, .variant = PICKUP_COIN,
|
||||
.seed = rng.Next()});
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// The rainbow poop's reward: its giant book and fanfare, and full health for every living player (in versus, only the
|
||||
@@ -831,22 +852,20 @@ static void black_poop_blast(const EntityRef& source)
|
||||
}
|
||||
|
||||
// Meconium's chance at a black heart from a black poop (by the breaker's in versus).
|
||||
static void meconium_drop_try(const Vector& position, const EntityRef& source, RNG& rng)
|
||||
static PoopDrop meconium_drop_roll(const EntityRef& source, RNG& rng)
|
||||
{
|
||||
Entity_Player* owner = g_game->playerManager.FirstTrinketOwner(TRINKET_MECONIUM);
|
||||
if (g_game->deathmatchManager.is_active())
|
||||
{
|
||||
if (!source.entity) return;
|
||||
if (!source.entity) return {};
|
||||
owner = source_player_get(source);
|
||||
}
|
||||
if (!owner) return;
|
||||
if (!owner) return {};
|
||||
|
||||
int multiplier = owner->GetTrinketMultiplier(TRINKET_MECONIUM);
|
||||
uint32_t odds = multiplier == 2 ? MECONIUM_ODDS_DOUBLE : multiplier == 3 ? MECONIUM_ODDS_TRIPLE : MECONIUM_ODDS;
|
||||
if (rng.Next() % MECONIUM_ROLL >= odds) return;
|
||||
g_game->Spawn({.position = position, .subType = HEART_BLACK, .type = ENTITY_PICKUP, .variant = PICKUP_HEART,
|
||||
.seed = rng.Next()});
|
||||
Random();
|
||||
if (rng.Next() % MECONIUM_ROLL >= odds) return {};
|
||||
return {.subType = HEART_BLACK, .variant = PICKUP_HEART, .seed = rng.Next()};
|
||||
}
|
||||
|
||||
// Whether a player has the Oh Crap form and so heals on broken poop.
|
||||
@@ -881,40 +900,49 @@ static void trinket_effects_spawn(const Vector& position, const EntityRef& sourc
|
||||
.radius = BROWN_CAP_RADIUS, .isLineCheck = false});
|
||||
}
|
||||
|
||||
// 007178c0 Spawns what a broken poop drops by kind: plain, corny and white poop roll a pickup, golden poop pays out,
|
||||
// rainbow poop heals everyone, black poop blasts the room (with Meconium's black heart), then the Oh Crap form heals
|
||||
// and Lil Larva and Brown Cap go off for all but red poop.
|
||||
// The swinging player (set only by Entity_Knife::UpdateSwingHits, not curated) never rolls again or makes Book of
|
||||
// Virtues wisps here.
|
||||
// 007178c0 Spawns what a broken poop drops by kind, roll by roll (three for a Notched Axe swinger with Book of
|
||||
// Belial): plain, corny and white poop roll a pickup, golden poop pays out (its Counterfeit Penny ends the rolls),
|
||||
// black poop may give Meconium's black heart, and on the last roll rainbow poop heals everyone and black poop blasts
|
||||
// the room. The pickups after the first fly off at a random angle. Then the Oh Crap form heals, Lil Larva and Brown
|
||||
// Cap go off for all but red poop, and the swinger's Book of Virtues may make a wisp.
|
||||
void GridEntity_Poop::spawn_drops(const PoopHit& hit)
|
||||
{
|
||||
RNG ownerRng = {hit.seed, 2, 7, 7};
|
||||
RNG rng = {hit.seed, 1, 5, 16};
|
||||
switch (hit.variant)
|
||||
PoopOwners owners = poop_owners_draw(ownerRng);
|
||||
Entity_Player* axe = g_notchedAxePlayer;
|
||||
int rolls = axe && axe->HasCollectible(COLLECTIBLE_BOOK_OF_BELIAL_PASSIVE) ? AXE_ROLLS : 1;
|
||||
Vector velocity{};
|
||||
|
||||
for (; rolls > 0; rolls--)
|
||||
{
|
||||
case POOP_NORMAL:
|
||||
case POOP_CORNY:
|
||||
case POOP_WHITE:
|
||||
PoopDrop drop;
|
||||
switch (hit.variant)
|
||||
{
|
||||
PoopDrop drop = poop_drop_roll(ownerRng, rng, POOP_DROP_CHANCE, hit.isLowDropChance);
|
||||
if (drop.variant == PICKUP_NULL) break;
|
||||
g_game->Spawn({.position = hit.position, .subType = drop.subType, .type = ENTITY_PICKUP,
|
||||
.variant = drop.variant, .seed = drop.seed});
|
||||
if (drop.variant != PICKUP_TRINKET) Random();
|
||||
break;
|
||||
case POOP_NORMAL:
|
||||
case POOP_CORNY:
|
||||
case POOP_WHITE:
|
||||
drop = poop_drop_roll(owners, rng, rolls > 1 ? AXE_DROP_CHANCE : POOP_DROP_CHANCE, hit.isLowDropChance);
|
||||
break;
|
||||
case POOP_GOLDEN:
|
||||
if (is_golden_drop_final(hit.position, rng, rolls)) rolls = 0;
|
||||
break;
|
||||
case POOP_RAINBOW:
|
||||
if (rolls == 1) rainbow_heal(hit.source);
|
||||
break;
|
||||
case POOP_BLACK:
|
||||
if (rolls == 1) black_poop_blast(hit.source);
|
||||
drop = meconium_drop_roll(hit.source, rng);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
case POOP_GOLDEN:
|
||||
golden_drops_spawn(hit.position, rng);
|
||||
break;
|
||||
case POOP_RAINBOW:
|
||||
rainbow_heal(hit.source);
|
||||
break;
|
||||
case POOP_BLACK:
|
||||
black_poop_blast(hit.source);
|
||||
meconium_drop_try(hit.position, hit.source, rng);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
if (drop.variant == PICKUP_NULL) continue;
|
||||
|
||||
bool isTrinket = drop.variant == PICKUP_TRINKET;
|
||||
g_game->Spawn({.position = hit.position, .velocity = isTrinket ? Vector{} : velocity, .subType = drop.subType,
|
||||
.type = ENTITY_PICKUP, .variant = drop.variant, .seed = drop.seed});
|
||||
if (!isTrinket) velocity = vector_scale(random_direction(), POOP_DROP_SPEED);
|
||||
}
|
||||
|
||||
bool isHealing = hit.variant == POOP_NORMAL || hit.variant == POOP_CORNY || hit.variant == POOP_GOLDEN ||
|
||||
@@ -927,4 +955,9 @@ void GridEntity_Poop::spawn_drops(const PoopHit& hit)
|
||||
if (is_oh_crap(*player)) player->AddHearts(1, false, false);
|
||||
|
||||
if (hit.variant != POOP_RED) trinket_effects_spawn(hit.position, hit.source);
|
||||
if (hit.isNoWisp) return;
|
||||
|
||||
RNG wispRng = {hit.seed, 7, 17, 21};
|
||||
if ((wispRng.Next() & 1) != 0 || !axe || !axe->HasCollectible(COLLECTIBLE_BOOK_OF_VIRTUES)) return;
|
||||
axe->AddWisp(hit.variant == POOP_GOLDEN ? ROCK_WISP_GOLD : COLLECTIBLE_POOP, hit.position, false, false);
|
||||
}
|
||||
@@ -448,8 +448,9 @@ static void plate_ambush_spawn(GridEntity& plate, RNG& rng)
|
||||
Vector position = room_free_pickup_position_find({.position = positions[(size_t)i % positions.size()]});
|
||||
float angle = random_unit() * PI_ROUGH;
|
||||
angle += angle;
|
||||
float distance = random_unit() * AMBUSH_SCATTER;
|
||||
position = vector_add(position, vector_make(std::cos(angle) * distance, std::sin(angle) * distance));
|
||||
float distance = random_unit();
|
||||
position = vector_add(position, vector_make(std::cos(angle) * distance * AMBUSH_SCATTER,
|
||||
std::sin(angle) * distance * AMBUSH_SCATTER));
|
||||
entity_spawn(enemy.type, enemy.variant, position, seed);
|
||||
}
|
||||
|
||||
@@ -471,7 +472,7 @@ static void plate_ambush_spawn(GridEntity& plate, RNG& rng)
|
||||
}
|
||||
|
||||
// 00983f30 pressure_plate_kill_enemies_timer_callback: each frame the kill button's timer strikes the room's
|
||||
// door-shutting enemies, ten at most (none friendly, no Blood Puppy or Dark Esau), with 1000 damage from its presser
|
||||
// door-shutting enemies (and the players in a versus match), ten at most (none friendly, no Blood Puppy or Dark Esau), with 1000 damage from its presser
|
||||
// (their health dropped to none first) or a plain kill at none, in red poofs on its first frame. Projectiles die while
|
||||
// the timer lives and moveable fires burn out. Five frames with nothing left end it.
|
||||
static void kill_button_tick(Entity_Effect* timer)
|
||||
@@ -485,7 +486,8 @@ static void kill_button_tick(Entity_Effect* timer)
|
||||
for (size_t i = 0; i < entities.size(); i++)
|
||||
{
|
||||
Entity& entity = *entities[i];
|
||||
bool isEnemy = is_npc_type(entity.type) && entity.CanShutDoors() && !entity.HasEntityFlags(FLAG_FRIENDLY) &&
|
||||
bool isVersusPlayer = game.deathmatchManager.is_active() && entity.type == ENTITY_PLAYER;
|
||||
bool isEnemy = (isVersusPlayer || is_npc_type(entity.type)) && entity.CanShutDoors() && !entity.HasEntityFlags(FLAG_FRIENDLY) &&
|
||||
entity.type != ENTITY_BLOOD_PUPPY && entity.type != ENTITY_DARK_ESAU;
|
||||
if (!isEnemy)
|
||||
{
|
||||
|
||||
@@ -165,14 +165,8 @@ constexpr float BUCKET_SLUDGE_SPEED_RANGE = 5;
|
||||
constexpr int BUCKET_SLUDGE_MIN = 4;
|
||||
constexpr uint32_t BUCKET_SLUDGE_RANGE = 5;
|
||||
|
||||
// Notched Axe's rolls with Book of Belial, and its Book of Virtues rock wisps: one roll in five, by chance below each.
|
||||
constexpr int AXE_ROLLS = 3;
|
||||
// Notched Axe's Book of Virtues rock wisps: one roll in five, by chance below each.
|
||||
constexpr uint32_t AXE_WISP_ODDS = 5;
|
||||
constexpr int ROCK_WISP_COMMON = 0x10000;
|
||||
constexpr int ROCK_WISP_UNCOMMON = 0x10001;
|
||||
constexpr int ROCK_WISP_GOLD = 0x10002;
|
||||
constexpr int ROCK_WISP_RAREST = 0x10003;
|
||||
constexpr int ROCK_WISP_RARE = 0x10004;
|
||||
constexpr float ROCK_WISP_RAREST_CHANCE = 0.01f;
|
||||
constexpr float ROCK_WISP_GOLD_CHANCE = 0.04f;
|
||||
constexpr float ROCK_WISP_RARE_CHANCE = 0.08f;
|
||||
@@ -483,13 +477,13 @@ static void spikes_hurt(GridEntity_Rock& rock)
|
||||
// Keeper's Kin lets a blue spider out of a rock, on the free side of it nearest its owner.
|
||||
static void rock_spider_release(GridEntity_Rock& rock, Entity_Player& owner)
|
||||
{
|
||||
constexpr std::array<std::array<float, 2>, 4> SIDES = {
|
||||
constexpr std::array<std::array<float, 2>, 4> SPIDER_SIDES = {
|
||||
{{-SPIDER_SIDE, 0}, {SPIDER_SIDE, 0}, {0, -SPIDER_SIDE}, {0, SPIDER_SIDE}}};
|
||||
Room& room = *g_game->room;
|
||||
Vector position = rock.Position();
|
||||
Vector spot{};
|
||||
float best = SPIDER_FAR;
|
||||
for (const std::array<float, 2>& side : SIDES)
|
||||
for (const std::array<float, 2>& side : SPIDER_SIDES)
|
||||
{
|
||||
Vector at = vector_make(position.x + side[0], position.y + side[1]);
|
||||
float dx = owner.pos.x - at.x;
|
||||
|
||||
@@ -7,6 +7,15 @@
|
||||
// The variant a big rock's frame is stored above.
|
||||
constexpr int BIG_ROCK_VARIANT = 1000;
|
||||
|
||||
// The rolls a Notched Axe swing gives a broken rock's or poop's drops with Book of Belial, and the Book of Virtues wisps
|
||||
// it breaks out of them: common, uncommon, gold, rarest and rare.
|
||||
constexpr int AXE_ROLLS = 3;
|
||||
constexpr int ROCK_WISP_COMMON = 0x10000;
|
||||
constexpr int ROCK_WISP_UNCOMMON = 0x10001;
|
||||
constexpr int ROCK_WISP_GOLD = 0x10002;
|
||||
constexpr int ROCK_WISP_RAREST = 0x10003;
|
||||
constexpr int ROCK_WISP_RARE = 0x10004;
|
||||
|
||||
// A rock standing, broken, primed to blow (a bomb rock hit by an explosion) and cracked (a super secret rock).
|
||||
enum RockState : int
|
||||
{
|
||||
|
||||
+1
-3
@@ -1156,8 +1156,6 @@ void HUD::render_counters(Vector& cursor, Vector shake)
|
||||
constexpr float ROW_HEIGHT = 12;
|
||||
constexpr float ROW_HEIGHT_TIGHT = 11;
|
||||
constexpr float JACOB_SHIFT = 14;
|
||||
constexpr float TEXT_OFFSET_X = 16;
|
||||
constexpr float TEXT_OFFSET_Y = 1;
|
||||
|
||||
PlayerManager& players = g_game->playerManager;
|
||||
Entity_Player* player = players.playerList.empty() ? nullptr : players.playerList[0];
|
||||
@@ -1181,7 +1179,7 @@ void HUD::render_counters(Vector& cursor, Vector shake)
|
||||
|
||||
Vector at = at_make(shake.x + cursor.x, shake.y + cursor.y);
|
||||
std::snprintf(count, sizeof(count), format, value);
|
||||
text_draw(font6, count, at_make(at.x + TEXT_OFFSET_X, at.y + TEXT_OFFSET_Y));
|
||||
text_draw(font6, count, at_make(at.x + HUD_TEXT_OFFSET_X, at.y + HUD_TEXT_OFFSET_Y));
|
||||
cursor = at_make(at.x - shake.x, at.y - shake.y);
|
||||
};
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
|
||||
constexpr int LOG_LINE_SIZE = 1024;
|
||||
constexpr std::string_view ITEMS_VERSION = "1";
|
||||
constexpr char WORD_SEPARATOR = ' ';
|
||||
constexpr std::string_view ITEMS_CATEGORY = "Items";
|
||||
constexpr std::string_view POCKET_ITEMS_CATEGORY = "PocketItems";
|
||||
constexpr const char* COLLECTIBLE_OUT_OF_BOUNDS = "Collectible ID out of bounds.\n";
|
||||
|
||||
+2
-3
@@ -104,7 +104,6 @@ constexpr int ONANS_STREAK_BANNED[] = {68, 118, 329, 52, 168, 114, 395, 394, 55,
|
||||
constexpr int PILL_COLORS = 13;
|
||||
constexpr int PILL_GOLD_ODDS = 140;
|
||||
constexpr int PILL_HORSE_ODDS = 70;
|
||||
constexpr int PILL_EFFECT_NONE = -1;
|
||||
// The effect class each shuffled color slot must have, or -1 for any.
|
||||
constexpr int PILL_SLOT_CLASSES[PILL_COLOR_SLOTS - 1] = {3, 3, 3, 3, 2, 1, 0, -1, -1, 3, 2, 1, -1, -1};
|
||||
// PHD's good side of a bad pill (0x00b6a240), and False PHD's bad side of a good one (its jump table at 0x00734c40).
|
||||
@@ -272,7 +271,7 @@ void ItemPool::Init(uint32_t startSeed, std::string_view path)
|
||||
effects.erase(effect);
|
||||
}
|
||||
|
||||
pillEffects[0] = PILL_EFFECT_NONE;
|
||||
pillEffects[0] = PILLEFFECT_NULL;
|
||||
for (auto& card : config.cards)
|
||||
if (card) g_manager->sfxManager.Preload(card->announcerVoice);
|
||||
identifiedPillEffects = {};
|
||||
@@ -894,7 +893,7 @@ static int effect_swap(std::span<const std::pair<int, int>> pairs, int effect)
|
||||
int ItemPool::GetPillEffect(uint32_t pillColor, Entity_Player* player)
|
||||
{
|
||||
int color = (int)(pillColor & PILL_COLOR_MASK);
|
||||
int effect = color < PILL_COLOR_SLOTS ? pillEffects[color] : PILL_EFFECT_NONE;
|
||||
int effect = color < PILL_COLOR_SLOTS ? pillEffects[color] : PILLEFFECT_NULL;
|
||||
bool isFalsePhd = false;
|
||||
|
||||
if (g_game->dailyChallenge.specialDailyId == SPECIAL_DAILY_AUGUST_16) return PILLEFFECT_EXPLOSIVE_DIARRHEA;
|
||||
|
||||
+6
-6
@@ -250,7 +250,7 @@ constexpr uint32_t KRAMPUS_ODDS_VISITED = 1;
|
||||
constexpr uint32_t KRAMPUS_ODDS_DEAL = 3;
|
||||
constexpr uint32_t KRAMPUS_ODDS_DEALS_DAILY = 10;
|
||||
|
||||
// The angel chance starts at 1 (half after Famine or a visited devil room) and each item adds a quarter of what is
|
||||
// The angel chance starts at 1 (half once an angel door spawned or a devil room was visited) and each item adds a quarter of what is
|
||||
// left, ten donations half, a beggar left a tenth. Eucharist sets it past 1.
|
||||
constexpr float ANGEL_CHANCE_HALVED = 0.5f;
|
||||
constexpr float ANGEL_ITEM_SHARE = 0.25f;
|
||||
@@ -4177,9 +4177,9 @@ bool Level::CanSpawnDevilRoom()
|
||||
return std::popcount(roomList[lastBossRoomListIdx].data->doors & 0xff) > 1;
|
||||
}
|
||||
|
||||
// 007f96f0 The chance the floor's deal room is an angel room: halved after Famine or a visited devil room, raised
|
||||
// by the Key Pieces, Book of Virtues, donations and a killed evil beggar, moved a tenth by a beggar left or an evil
|
||||
// one left, and scaled by the floor's own chance (none without it, unless no deal was taken since a devil room
|
||||
// 007f96f0 The chance the floor's deal room is an angel room: halved after an angel door or a visited devil room,
|
||||
// raised by the Key Pieces, Book of Virtues, donations and a killed evil beggar, moved a tenth by a beggar left or an
|
||||
// evil one left, and scaled by the floor's own chance (none without it, unless no deal was taken since a devil room
|
||||
// spawned). Eucharist makes it sure.
|
||||
float get_angel_room_chance()
|
||||
{
|
||||
@@ -4187,10 +4187,10 @@ float get_angel_room_chance()
|
||||
PlayerManager& players = game.playerManager;
|
||||
auto isHeld = [&](int item) { return players.FirstCollectibleOwner(item, LAZARUS_SHARE_CHECK) != nullptr; };
|
||||
auto raise = [](float chance, float share) { return chance + (1 - chance) * share; };
|
||||
bool isFamineOrVisited = game.gameStateFlags & (1ull << GAME_STATE_FAMINE_SPAWNED | 1ull << GAME_STATE_DEVILROOM_VISITED);
|
||||
bool isHalved = game.gameStateFlags & (1ull << GAME_STATE_FAMINE_SPAWNED | 1ull << GAME_STATE_DEVILROOM_VISITED);
|
||||
bool isDevilSpawned = game.gameStateFlags & (1ull << GAME_STATE_DEVILROOM_SPAWNED);
|
||||
|
||||
float chance = isFamineOrVisited ? ANGEL_CHANCE_HALVED : 1;
|
||||
float chance = isHalved ? ANGEL_CHANCE_HALVED : 1;
|
||||
if (isHeld(COLLECTIBLE_KEY_PIECE_1)) chance = raise(chance, ANGEL_ITEM_SHARE);
|
||||
if (isHeld(COLLECTIBLE_KEY_PIECE_2)) chance = raise(chance, ANGEL_ITEM_SHARE);
|
||||
if (isHeld(COLLECTIBLE_BOOK_OF_VIRTUES)) chance = raise(chance, ANGEL_ITEM_SHARE);
|
||||
|
||||
@@ -201,6 +201,7 @@ int Level::roll_red_room_type(RNG& rng)
|
||||
// 0074d010 Opens a red room through a door slot (the Red Key, Cracked Key, Soul of Cain): picks a room for the empty
|
||||
// cell beyond from the cell's seed, places it with doors to every room around that takes one, or opens the way to the
|
||||
// next floor off the map's edge, and puts the new doors in if the slot's room is the current one.
|
||||
// A negative slot is taken as the last one, where the original passes -1 on into undefined shifts.
|
||||
bool Level::MakeRedRoomDoor(int roomIdx, int doorSlot)
|
||||
{
|
||||
roomIdx = std::clamp(roomIdx, ROOM_IDX_MIN, ROOM_IDX_MAX);
|
||||
|
||||
@@ -327,13 +327,13 @@ void MusicManager::LoadConfig(std::string_view path, ModEntry* mod)
|
||||
}
|
||||
}
|
||||
|
||||
// A pitch bent up and down around itself by three slow sines at a time, by depth octaves at most.
|
||||
static float pitch_wobble(float pitch, double time, float depth)
|
||||
// A pitch bent up and down around itself by three slow sines at a time, by scale times depth octaves at most.
|
||||
static float pitch_wobble(float pitch, double time, float scale, float depth)
|
||||
{
|
||||
float wave = 0;
|
||||
for (size_t i = 0; i < WOBBLE_FREQUENCIES.size(); i++)
|
||||
wave += (float)std::sin(time * WOBBLE_FREQUENCIES[i]) * WOBBLE_AMPLITUDES[i];
|
||||
return std::pow(2.0f, wave * depth + std::log(pitch) / std::log(2.0f));
|
||||
return pow_float(2, wave * scale * depth + log_float(pitch) / log_float(2));
|
||||
}
|
||||
|
||||
// Sets the pitch the run's music seeds give, then in a game the wobble of dizziness and of a red room. Whether any
|
||||
@@ -354,12 +354,12 @@ bool MusicManager::pitch_effects_apply()
|
||||
double frame = (int)g_manager->framecount;
|
||||
if (g_game->dizzyIntensity > 0)
|
||||
{
|
||||
pitch = pitch_wobble(pitch, frame * DIZZY_WOBBLE_SPEED, g_game->dizzyIntensity * DIZZY_WOBBLE_DEPTH);
|
||||
pitch = pitch_wobble(pitch, frame * DIZZY_WOBBLE_SPEED, g_game->dizzyIntensity, DIZZY_WOBBLE_DEPTH);
|
||||
isChanged = true;
|
||||
}
|
||||
if (g_game->room->descriptor->flags & ROOM_DESCRIPTOR_FLAG_RED_ROOM)
|
||||
{
|
||||
pitch = pitch_wobble(pitch, frame * RED_ROOM_WOBBLE_SPEED, RED_ROOM_WOBBLE_DEPTH);
|
||||
pitch = pitch_wobble(pitch, frame * RED_ROOM_WOBBLE_SPEED, 1, RED_ROOM_WOBBLE_DEPTH);
|
||||
isChanged = true;
|
||||
}
|
||||
return isChanged;
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
// The splat of the stone and lava enemies: black, lifted a little.
|
||||
constexpr ColorMod ROCK_SPLAT_COLOR = {{0, 0, 0, 1}, {0, 0, 0, 0}, {30 / 255.0f, 30 / 255.0f, 30 / 255.0f}};
|
||||
|
||||
// The splat of the burning enemies (Coal Boy, the Fire Worm): glowing orange.
|
||||
constexpr ColorMod EMBER_SPLAT_COLOR = {{0, 0, 0, 1.1f}, {0, 0, 0, 0}, {1, 0.514f, 0.004f}};
|
||||
|
||||
// A cord's points sit in vectorDeque1 as triples: the point, its velocity, and its height with the height's speed.
|
||||
constexpr size_t CORD_STRIDE = 3;
|
||||
|
||||
|
||||
@@ -187,7 +187,7 @@ void npc_army_fly_update(Entity_NPC& npc)
|
||||
if (npc.controllerID != -1) army_fly_control_pass(npc);
|
||||
|
||||
if (npc.state == NPC_STATE_INIT) army_fly_enlist(npc);
|
||||
if (npc.state == NPC_STATE_MOVE)
|
||||
else if (npc.state == NPC_STATE_MOVE)
|
||||
{
|
||||
npc.sprite.Play("Fly");
|
||||
segment_follow(npc, SEGMENT_FOLLOW, ARMY_FLY_GAP, ARMY_FLY_FOLLOW_SPEED);
|
||||
|
||||
@@ -92,7 +92,7 @@ static void ball_facing_show(Entity_NPC& npc, float degrees, float turn)
|
||||
npc.sprite.rotation = turn - (float)facing * BALL_FACING_STEP;
|
||||
}
|
||||
|
||||
// Its first frame: it hangs from the first rock beside it (above, below, left, right) at its chain's length, or drops
|
||||
// Its first frame: it hangs from the last rock beside it (above, below, left, right) at its chain's length, or drops
|
||||
// free. It is untouchable and out of the players' control.
|
||||
static void ball_start(Entity_NPC& npc, float radius)
|
||||
{
|
||||
@@ -106,7 +106,6 @@ static void ball_start(Entity_NPC& npc, float radius)
|
||||
if (!chain_anchor_is_valid(grid)) continue;
|
||||
npc.targetPosition = room.GetGridPosition(grid->gridIndex);
|
||||
npc.i1 = grid->gridIndex;
|
||||
break;
|
||||
}
|
||||
|
||||
if (npc.sprite.SetOverlayAnimation("Chain") && npc.sprite.overlayAnimState.animData)
|
||||
|
||||
@@ -130,8 +130,9 @@ void npc_bomb_gagger_update(Entity_NPC& npc)
|
||||
{
|
||||
npc.state = GAGGER_WANDER;
|
||||
npc.i2 = 0;
|
||||
return;
|
||||
}
|
||||
else if (npc.state == GAGGER_WANDER) gagger_wander_update(npc);
|
||||
if (npc.state == GAGGER_WANDER) gagger_wander_update(npc);
|
||||
else if (npc.state == GAGGER_THROW) gagger_throw_update(npc);
|
||||
|
||||
if (!npc.isDead || !npc.sprite.animState.animData) return;
|
||||
|
||||
@@ -103,7 +103,7 @@ void npc_bomb_grimace_update(Entity_NPC& npc)
|
||||
|
||||
bool isInMineshaft = game.HasAbandonedMineshaft() && game.currentDimensionIdx == DIMENSION_MIRROR &&
|
||||
!game.Level::GetStateFlag(LEVEL_STATE_MINESHAFT_ESCAPE);
|
||||
if (npc.state == NPC_STATE_INIT) grimace_init(npc, isInMineshaft);
|
||||
if (npc.state == NPC_STATE_INIT) return grimace_init(npc, isInMineshaft);
|
||||
|
||||
if (npc.state == NPC_STATE_IDLE)
|
||||
{
|
||||
|
||||
@@ -120,7 +120,8 @@ static void cod_worm_control_update(Entity_NPC& npc, bool isShielded)
|
||||
}
|
||||
|
||||
float rate = npc.speedMultiplier / COD_WORM_CHARGE_FRAMES;
|
||||
if (!isShielded) npc.v1.x = std::max(npc.v1.x - rate * COD_WORM_CHARGE_DRAIN, 0.0f);
|
||||
if (!isShielded)
|
||||
npc.v1.x = std::max(npc.v1.x - npc.speedMultiplier * COD_WORM_CHARGE_DRAIN / COD_WORM_CHARGE_FRAMES, 0.0f);
|
||||
else if (npc.IsPlayerInRadius(npc.pos, COD_WORM_CHARGE_REACH)) npc.v1.x = std::max(npc.v1.x - rate, 0.0f);
|
||||
else npc.v1.x = std::min(npc.v1.x + rate, 1.0f);
|
||||
}
|
||||
|
||||
@@ -902,7 +902,7 @@ static void contact_enemy(Entity_NPC& npc, Entity& other)
|
||||
return;
|
||||
|
||||
hit_list_insert(npc.hitList, other);
|
||||
damage = std::log((npc.maxHitPoints + CHARMED_DAMAGE_BASE) / CHARMED_DAMAGE_SCALE) * CHARMED_DAMAGE_LOG;
|
||||
damage = log_float((npc.maxHitPoints + CHARMED_DAMAGE_BASE) / CHARMED_DAMAGE_SCALE) * CHARMED_DAMAGE_LOG;
|
||||
if (npc.HasEntityFlags(FLAG_DELIRIUM_FORM) && g_game->deathmatchManager.is_active())
|
||||
damage = npc.collisionDamage;
|
||||
if (npc.type == ENTITY_VIS && npc.variant == VIS_CHUBBER_VARIANT) damage = CHUBBER_DAMAGE;
|
||||
|
||||
+4
-4
@@ -9,7 +9,6 @@
|
||||
// pale grey and glowing orange.
|
||||
constexpr int DANNY_COAL_BOY = 1;
|
||||
constexpr ColorMod DANNY_SPLAT_COLOR = {{1, 1, 1, 1}, {1, 1, 1, 0.1f}, {0, 0, 0}};
|
||||
constexpr ColorMod COAL_BOY_SPLAT_COLOR = {{0, 0, 0, 1.1f}, {0, 0, 0, 0}, {1, 0.514f, 0.004f}};
|
||||
|
||||
// They walk at 0.6 and recharge over 150 frames (10 to 19 at first, twice as fast while hurt hard), then throw one
|
||||
// time in 60 a frame (one in 20 more while hurt hard): always within 200 of the target, one time in ten within 400.
|
||||
@@ -101,7 +100,7 @@ static void danny_throw(Entity_NPC& npc)
|
||||
|
||||
if (npc.variant == DANNY_COAL_BOY)
|
||||
{
|
||||
int lost = std::max(COAL_BOY_SPIDERS - kept, 0);
|
||||
int lost = COAL_BOY_SPIDERS - kept;
|
||||
for (int thrown = 0; thrown < COAL_BOY_THROWS; thrown++)
|
||||
{
|
||||
Vector direction = throw_direction(aim);
|
||||
@@ -114,7 +113,8 @@ static void danny_throw(Entity_NPC& npc)
|
||||
return throw_grit_spray(npc, aim);
|
||||
}
|
||||
|
||||
int lost = std::max(DANNY_SPIDERS - kept, 0);
|
||||
// The original clamps the lost count as unsigned, a no-op, so more spiders in its group than two add rocks.
|
||||
int lost = DANNY_SPIDERS - kept;
|
||||
ProjectileParams params;
|
||||
params.variant = PROJECTILE_ROCK;
|
||||
npc.FireBossProjectiles(DANNY_ROCKS - lost, target, 1, params);
|
||||
@@ -197,7 +197,7 @@ void npc_danny_update(Entity_NPC& npc)
|
||||
case NPC_STATE_INIT:
|
||||
npc.state = DANNY_WALK;
|
||||
npc.sprite.Play("WalkVert");
|
||||
npc.splatColor = npc.variant == DANNY_COAL_BOY ? COAL_BOY_SPLAT_COLOR : DANNY_SPLAT_COLOR;
|
||||
npc.splatColor = npc.variant == DANNY_COAL_BOY ? EMBER_SPLAT_COLOR : DANNY_SPLAT_COLOR;
|
||||
npc.stateFrame = npc.controllerID == -1 ? (int)(Random() % DANNY_FIRST_WAIT_RANGE) + DANNY_FIRST_WAIT
|
||||
: DANNY_FIRST_WAIT;
|
||||
break;
|
||||
|
||||
+3
-4
@@ -10,7 +10,6 @@
|
||||
constexpr int DIP_BIG_CORN = 3;
|
||||
constexpr int FAMILIAR_DIP_CORN = 2;
|
||||
constexpr int FAMILIAR_DIP_BROWNIE = 20;
|
||||
constexpr int TRINKET_DIPPING_TRINKET_ID = 163;
|
||||
|
||||
// How a Dip hops: one chance in ten a frame from rest, at a random speed (doubled for the corn dip), and how it
|
||||
// slows, splats and squeaks.
|
||||
@@ -80,11 +79,11 @@ void npc_dip_update(Entity_NPC& npc)
|
||||
bool isDrip = npc.type == ENTITY_DRIP;
|
||||
PlayerManager& players = g_game->playerManager;
|
||||
bool isTamed = players.FirstCollectibleOwner(COLLECTIBLE_DIRTY_MIND, LAZARUS_SHARE_CHECK) ||
|
||||
players.AnyoneHasTrinket(TRINKET_DIPPING_TRINKET_ID);
|
||||
players.AnyoneHasTrinket(TRINKET_DINGLE_BERRY);
|
||||
if (!npc.isDead && isTamed)
|
||||
{
|
||||
Entity* owner = players.RandomCollectibleOwner(COLLECTIBLE_DIRTY_MIND, npc.initSeed, nullptr);
|
||||
if (!owner) owner = players.RandomTrinketOwner(TRINKET_DIPPING_TRINKET_ID, npc.initSeed, nullptr);
|
||||
if (!owner) owner = players.RandomTrinketOwner(TRINKET_DINGLE_BERRY, npc.initSeed, nullptr);
|
||||
if (owner)
|
||||
{
|
||||
npc.entityCollisionClass = ENTCOLL_NONE;
|
||||
@@ -132,7 +131,7 @@ void npc_dip_update(Entity_NPC& npc)
|
||||
->SetColor(npc.splatColor, -1, COLOR_PRIORITY_DEFAULT, false, true);
|
||||
if (npc.pendingDamage > 0 && (Random() & 1) == 0)
|
||||
npc.PlaySound(SOUND_DIP_HURT, HURT_VOLUME, HURT_SOUND_DELAY, false, 1);
|
||||
if (isBigCorn && npc.controllerID != -1 && input_is_action_pressed(ACTION_BOMB, npc.controllerID, &npc))
|
||||
if (isBigCorn && npc.controllerID != -1 && input_is_action_pressed(ACTION_ITEM, npc.controllerID, &npc))
|
||||
npc.Kill(EntityRef());
|
||||
if (npc.isDead && isBigCorn && !npc.HasEntityFlags(FLAG_SHRINK)) dip_corn_shoot(npc);
|
||||
}
|
||||
+6
-4
@@ -143,7 +143,8 @@ static void evis_cord_init(Entity_NPC& cord, Entity& evis)
|
||||
cord.renderDepthOffset += EVIS_CORD_DEPTH;
|
||||
}
|
||||
|
||||
// Before its update the cord holds its catch, or catches the first player a stretch of it touches.
|
||||
// Before its update the cord holds its catch, or catches the first player a stretch of it touches (past its first
|
||||
// point, at Evis).
|
||||
static void evis_cord_catch(Entity_NPC& cord)
|
||||
{
|
||||
if (Entity* caught = cord.target.get())
|
||||
@@ -151,7 +152,8 @@ static void evis_cord_catch(Entity_NPC& cord)
|
||||
cord.velocity = vector_sub(caught->pos, cord.pos);
|
||||
cord.posOffset.y = caught->IsFlying() ? HOLD_HEIGHT_FLYING : HOLD_HEIGHT;
|
||||
}
|
||||
for (size_t i = 0; i < cord.vectorDeque1.size() && !cord.target; i += CORD_STRIDE)
|
||||
for (size_t i = CORD_STRIDE; i < EVIS_CORD_POINTS * CORD_STRIDE && i < cord.vectorDeque1.size() && !cord.target;
|
||||
i += CORD_STRIDE)
|
||||
{
|
||||
Capsule capsule = cord.GetCollisionCapsule(vector_sub(cord.vectorDeque1[i], cord.pos));
|
||||
for (Entity* entity : entity_query_capsule(capsule, QUERY_PLAYERS))
|
||||
@@ -207,7 +209,7 @@ static void evis_cord_flight(Entity_NPC& cord, bool isInterpolation)
|
||||
}
|
||||
|
||||
// Evis' cord (variant 10): laid out on its first frame, it flies out and back until it catches a player. Without
|
||||
// Evis it dies, and on dying it bursts into blood along its points.
|
||||
// Evis it dies, and on dying it bursts into blood along its points past the first.
|
||||
static void evis_cord_update(Entity_NPC& cord)
|
||||
{
|
||||
bool isInterpolation = cord.aiCallPhase == AI_PHASE_INTERPOLATE;
|
||||
@@ -225,7 +227,7 @@ static void evis_cord_update(Entity_NPC& cord)
|
||||
}
|
||||
if (!cord.isDead) return;
|
||||
|
||||
for (size_t i = 0; i < EVIS_CORD_POINTS * CORD_STRIDE; i += CORD_STRIDE)
|
||||
for (size_t i = CORD_STRIDE; i < EVIS_CORD_POINTS * CORD_STRIDE; i += CORD_STRIDE)
|
||||
if (i + 2 < cord.vectorDeque1.size())
|
||||
blood_explosion_spawn(1, cord.vectorDeque1[i], vector_make(0, cord.vectorDeque1[i + 2].x), cord.splatColor, {});
|
||||
}
|
||||
|
||||
Loaded 100 of 157 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user