Curation round 25 (code only): the ultra horsemen and the Beast's background, the Scourge and Polty, the player's last gaps with the frame gate removed, game core, debug and daily, local co-op and player-controlled enemies, TMTRAINER, local versus, the vanilla Lua API, the special-daily fix, shared constants folded (60 duplicates, 10 offline gaps)
This commit is contained in:
1 parent
534339a496
commit
5c89798773
280 files changed
+14904
-5309
No files matched your search
@@ -131,7 +131,6 @@ bool is_active_slot_kept(Entity_Player& player, int slot);
|
||||
void active_collectible_add(Entity_Player& player, ItemConfig_Item& item, const ActiveGain& gain);
|
||||
bool active_pedestal_swap(Entity_Pickup& pickup, Entity_Player& player);
|
||||
bool battery_collect(Entity_Pickup& battery, Entity_Player& player);
|
||||
bool is_temporary_effect_plain(const TemporaryEffect& effect);
|
||||
bool history_item_remove(History& history, const HistoryItem& item);
|
||||
bool pocket_item_collect(Entity_Pickup& pocket, Entity_Player& player);
|
||||
void tears_up_unlock_check(Entity_Player& player);
|
||||
+2
-3
@@ -41,7 +41,6 @@ constexpr int DOOR_STOP_CHALLENGE = 3;
|
||||
|
||||
// The Boss Rush's bosses rise round an ellipse 200 by 180 about the room's centre, Gurdy 80 and Mega Maw 160 below the
|
||||
// top, at least 40 from a player (stepping 60 away), the segments of a boss 20 apart. Gurdy clears three cells round.
|
||||
constexpr float BOSS_RUSH_FULL_TURN = 6.2831855f;
|
||||
constexpr float BOSS_RUSH_RING_X = 200;
|
||||
constexpr float BOSS_RUSH_RING_Y = 180;
|
||||
constexpr float BOSS_RUSH_GURDY_DROP = 80;
|
||||
@@ -216,7 +215,7 @@ static Vector boss_rush_spot_find(int type, float angle)
|
||||
Entity_Player* player = game_nearest_player(spot);
|
||||
if (player && vector_length_squared(vector_sub(spot, player->pos)) < BOSS_RUSH_PLAYER_CLEAR * BOSS_RUSH_PLAYER_CLEAR)
|
||||
{
|
||||
float away = random_unit() * RANDOM_HALF_TURN * 2;
|
||||
float away = random_unit() * PI_ROUGH * 2;
|
||||
spot = vector_add(spot, vector_scale(vector_make(std::cos(away), std::sin(away)), BOSS_RUSH_PLAYER_STEP));
|
||||
}
|
||||
return room_free_pickup_position_find({.position = spot});
|
||||
@@ -258,7 +257,7 @@ void Ambush::SpawnBossrushWave()
|
||||
if (bosses.empty()) KAGE_LogMessage(LOG_ASSERT, (uint8_t*)"Wave has no entries!");
|
||||
|
||||
float angle = 0;
|
||||
float angleStep = BOSS_RUSH_FULL_TURN / (float)bosses.size();
|
||||
float angleStep = TAU / (float)bosses.size();
|
||||
for (const BossRushEntry& boss : bosses)
|
||||
{
|
||||
Vector spot = boss_rush_spot_find(boss.type, angle);
|
||||
|
||||
+10
-15
@@ -35,12 +35,7 @@ constexpr int LOG_MESSAGE_SIZE = 1024;
|
||||
constexpr int FRAME_INDEX_UNSET = -1;
|
||||
constexpr uint32_t EVENT_BIT_MASK = 31;
|
||||
constexpr float CHANNEL = 255;
|
||||
constexpr float PERCENT = 100;
|
||||
constexpr float DEGREES_HALF_TURN = 180;
|
||||
constexpr float DEGREES_TURN = 360;
|
||||
constexpr float RADIANS_PER_DEGREE = 0.017453292f;
|
||||
constexpr float GLITCH_TURN = 90;
|
||||
constexpr int SHIMMER_STEPS = 256;
|
||||
constexpr std::string_view SHADOW_LAYER_NAME = "shadow";
|
||||
constexpr std::string_view APPEAR_ANIMATION = "Appear";
|
||||
constexpr std::string_view IDLE_ANIMATION = "Idle";
|
||||
@@ -148,9 +143,9 @@ void color_multiply(ColorMod& color, const ColorMod& other)
|
||||
// An angle brought into [-180, 180] degrees.
|
||||
static float angle_wrap(float angle)
|
||||
{
|
||||
if (std::fabs(angle) > DEGREES_TURN) angle = (float)std::fmod((double)angle, (double)DEGREES_TURN);
|
||||
if (angle > DEGREES_HALF_TURN) return angle - DEGREES_TURN;
|
||||
if (angle < -DEGREES_HALF_TURN) return angle + DEGREES_TURN;
|
||||
if (std::fabs(angle) > FULL_TURN_DEGREES) angle = (float)std::fmod((double)angle, (double)FULL_TURN_DEGREES);
|
||||
if (angle > HALF_TURN_DEGREES) return angle - FULL_TURN_DEGREES;
|
||||
if (angle < -HALF_TURN_DEGREES) return angle + FULL_TURN_DEGREES;
|
||||
return angle;
|
||||
}
|
||||
|
||||
@@ -159,10 +154,10 @@ float angle_lerp(float from, float to, float t)
|
||||
{
|
||||
from = angle_wrap(from);
|
||||
to = angle_wrap(to);
|
||||
if (std::fabs(to - from) > DEGREES_HALF_TURN)
|
||||
if (std::fabs(to - from) > HALF_TURN_DEGREES)
|
||||
{
|
||||
if (to > from) from += DEGREES_TURN;
|
||||
else to += DEGREES_TURN;
|
||||
if (to > from) from += FULL_TURN_DEGREES;
|
||||
else to += FULL_TURN_DEGREES;
|
||||
}
|
||||
return angle_wrap((to - from) * t + from);
|
||||
}
|
||||
@@ -1164,8 +1159,8 @@ DestinationQuad AnimationLayer::GetDestQuad(const AnimationFrame& frame, const L
|
||||
(top + frame.height) - draw.bottomRightClamp.y / layerScale.y);
|
||||
quad_scale(quad, layerOrigin, layerScale);
|
||||
quad_scale(quad, spriteOrigin, spriteScale);
|
||||
quad_rotate(quad, layerOrigin, layerRotation * RADIANS_PER_DEGREE);
|
||||
quad_rotate(quad, spriteOrigin, spriteRotation * RADIANS_PER_DEGREE);
|
||||
quad_rotate(quad, layerOrigin, layerRotation * DEGREES_TO_RADIANS);
|
||||
quad_rotate(quad, spriteOrigin, spriteRotation * DEGREES_TO_RADIANS);
|
||||
return quad;
|
||||
}
|
||||
|
||||
@@ -1207,7 +1202,7 @@ static void procedural_item_turn(SourceQuad& source, const AnimationFrame& frame
|
||||
if (layer.spriteSheet == g_game->proceduralItemManager.renderTarget)
|
||||
center = vector_make(center.x + layer.cropOffset.x, center.y + layer.cropOffset.y);
|
||||
|
||||
quad_rotate(source, center, (rng.RandomInt(2) == 0 ? GLITCH_TURN : -GLITCH_TURN) * RADIANS_PER_DEGREE);
|
||||
quad_rotate(source, center, (rng.RandomInt(2) == 0 ? GLITCH_TURN : -GLITCH_TURN) * DEGREES_TO_RADIANS);
|
||||
if (rng.RandomInt(2) != 0) quad_columns_swap(source);
|
||||
}
|
||||
|
||||
@@ -1263,7 +1258,7 @@ void AnimationLayer::RenderFrame(const SpriteDraw& draw, int frameIndex, const A
|
||||
{
|
||||
bool isGameTime = !(flags & ANIM_RENDER_IGNORE_GAME_TIME);
|
||||
int frameCount = isGameTime ? g_game->frameCount : (int)(g_manager->framecount / 2);
|
||||
color._colorize[3] = (float)(frameCount % SHIMMER_STEPS) / SHIMMER_STEPS;
|
||||
color._colorize[3] = (float)(frameCount % GOLD_SHIMMER_STEPS) / GOLD_SHIMMER_STEPS;
|
||||
}
|
||||
|
||||
KColor tint;
|
||||
|
||||
+13
@@ -120,6 +120,13 @@ constexpr float HALF_TURN_DEGREES = 180;
|
||||
constexpr float RIGHT_ANGLE_DEGREES = 90;
|
||||
constexpr float DIAGONAL = 0.70710677f;
|
||||
constexpr float HALF = 0.5f;
|
||||
// A quarter turn in radians, the original's rough half turn (3.14), a hundred percent, and a color byte as a unit.
|
||||
constexpr float QUARTER_TURN = PI_F / 2;
|
||||
constexpr float PI_ROUGH = 3.14f;
|
||||
constexpr int PERCENT = 100;
|
||||
constexpr float BYTE_TO_UNIT = 1 / 255.0f;
|
||||
// The steps of a golden or static sprite's shimmer.
|
||||
constexpr int GOLD_SHIMMER_STEPS = 256;
|
||||
|
||||
inline Vector vector_add(Vector a, Vector b)
|
||||
{
|
||||
@@ -168,6 +175,12 @@ inline float vector_distance(Vector a, Vector b)
|
||||
return vector_length(vector_sub(a, b));
|
||||
}
|
||||
|
||||
// Vector::operator==: whether two vectors match, never for one holding a NaN.
|
||||
inline bool vector_equal(Vector a, Vector b)
|
||||
{
|
||||
return a.x == b.x && a.y == b.y;
|
||||
}
|
||||
|
||||
inline bool vector_is_zero(Vector v)
|
||||
{
|
||||
return v.x == 0 && v.y == 0;
|
||||
|
||||
+2
-3
@@ -190,7 +190,6 @@ constexpr float TAR_OUT_MIN = 20;
|
||||
constexpr float TAR_OUT_RANGE = 40;
|
||||
constexpr float TAR_SHIFT_RANGE = 10;
|
||||
constexpr float TAR_SCALE_RANGE = 4;
|
||||
constexpr float HALF_TURN = 1.5707964f;
|
||||
constexpr int DROSS_LIGHT_FIRST = 3;
|
||||
constexpr int DROSS_LIGHT_ODDS = 40;
|
||||
constexpr float DROSS_LIGHT_SCALE = 0.5f;
|
||||
@@ -1599,8 +1598,8 @@ static void dank_details_spawn(Backdrop& backdrop, const WallSlot& slot)
|
||||
Vector center = wall_center(slot.quad);
|
||||
float out = backdrop.rng.RandomFloat() * TAR_OUT_RANGE + TAR_OUT_MIN;
|
||||
Vector position = vector_make(normal.x * out + center.x, normal.y * out + center.y);
|
||||
float cosine = std::cos(HALF_TURN);
|
||||
float sine = std::sin(HALF_TURN);
|
||||
float cosine = std::cos(QUARTER_TURN);
|
||||
float sine = std::sin(QUARTER_TURN);
|
||||
Vector along = vector_make(normal.x * cosine - normal.y * sine, normal.y * cosine + normal.x * sine);
|
||||
float shift = backdrop.rng.RandomFloat() * TAR_SHIFT_RANGE - TAR_SHIFT_RANGE;
|
||||
position.x += shift * along.x;
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include <cmath>
|
||||
|
||||
// A point's edges spread along its direction turned a quarter, and a joint's normal is never shortened past this.
|
||||
constexpr float BEAM_NORMAL_TURN = 1.5707964f;
|
||||
constexpr float JOINT_DOT_MIN = 0.4f;
|
||||
constexpr float HALF_WIDTH = 0.5f;
|
||||
|
||||
@@ -17,8 +16,8 @@ BeamRenderer g_beamRenderer;
|
||||
static Vector normal_get(Vector from, Vector to)
|
||||
{
|
||||
Vector direction = vector_normalized(vector_sub(to, from));
|
||||
float cosine = std::cos(BEAM_NORMAL_TURN);
|
||||
float sine = std::sin(BEAM_NORMAL_TURN);
|
||||
float cosine = std::cos(QUARTER_TURN);
|
||||
float sine = std::sin(QUARTER_TURN);
|
||||
return vector_make(direction.x * cosine - direction.y * sine, sine * direction.x + cosine * direction.y);
|
||||
}
|
||||
|
||||
|
||||
+5
-35
@@ -86,7 +86,6 @@ constexpr float POISON_CLOUD_FLATTEN = 0.4f;
|
||||
constexpr int POISON_CLOUD_SUBTYPE = 4;
|
||||
constexpr std::array<int, 6> EFFECTS_BLOWN_AWAY = {21, 33, 63, 64, 158, 159};
|
||||
constexpr int BOMB_EXPLOSION_EFFECT = 1;
|
||||
constexpr int SPECIAL_DAILY_FIREWORKS = 12;
|
||||
constexpr size_t SAVED_EFFECTS_MAX = 128;
|
||||
|
||||
// Butt Bombs heal poop enemies by a quarter, and hurt and confuse the rest for two seconds.
|
||||
@@ -153,8 +152,6 @@ constexpr int GIGA_DUSTS = 15;
|
||||
constexpr float GIGA_DUST_SPEED_MIN = 15;
|
||||
constexpr float GIGA_DUST_SPEED_RANGE = 5;
|
||||
constexpr float GIGA_DUST_FLATTEN = 0.85f;
|
||||
constexpr float GIGA_DUST_SPIN_MIN = 2;
|
||||
constexpr float GIGA_DUST_SPIN_RANGE = 10;
|
||||
constexpr float GIGA_DUST_SCALE_RANGE = 0.6f;
|
||||
constexpr int GIGA_DUST_FRAMES = 40;
|
||||
constexpr ColorMod GIGA_DUST_COLOR = {{0.45f, 0.45f, 0.46f, 0.75f}, {0, 0, 0, 0}, {0, 0, 0}};
|
||||
@@ -188,33 +185,6 @@ static bool is_scissored(Entity* source)
|
||||
return !source || (source->type != ENTITY_PLAYER && !source->GetPlayerAncestor());
|
||||
}
|
||||
|
||||
// Room::CheckLine's explosion mode (2): the line walked in steps, cell by cell. A metal block stops it, and so does a
|
||||
// wall, unless it is a door, a wall the check ignores, or a lock Broken Padlock lets the blast through.
|
||||
bool explosion_line_clear(const Vector& start, const Vector& end, bool isIgnoreWalls)
|
||||
{
|
||||
Room& room = *g_game->room;
|
||||
Vector step = vector_sub(start, end);
|
||||
float length = vector_length(step);
|
||||
if (length <= 0) return true;
|
||||
|
||||
step = vector_scale(step, LINE_STEP / length);
|
||||
Vector at = start;
|
||||
for (float walked = 0; walked < length; walked += LINE_STEP)
|
||||
{
|
||||
at = vector_sub(at, step);
|
||||
int gridIndex = room.GetGridIndex(at);
|
||||
uint32_t collision = room.GetGridCollision(gridIndex);
|
||||
GridEntity* grid = gridIndex >= 0 ? room.GetGridEntity((uint32_t)gridIndex) : nullptr;
|
||||
if (grid && collision != COLLISION_NONE && grid->type == GRID_ROCKB) return false;
|
||||
if (collision != COLLISION_WALL) continue;
|
||||
|
||||
bool isPadlock = grid && grid->type == GRID_LOCK && g_game->playerManager.AnyoneHasTrinket(TRINKET_BROKEN_PADLOCK);
|
||||
bool isOpening = grid && (grid->type == GRID_DOOR || (grid->type == GRID_WALL && isIgnoreWalls));
|
||||
if (!isPadlock && !isOpening) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Pushes an entity away from an explosion, harder the deeper inside it is, a heavy one half as far and with Knockback
|
||||
// twice as far. A player keeps its push and half its speed, at most so fast.
|
||||
// Past a mass of 20 the original's further tiers (30, 50, 150) are never reached. They are left out.
|
||||
@@ -338,7 +308,7 @@ static void explosion_grid_break(const Explosion& explosion)
|
||||
for (int gridIndex : explosion_cells_get(explosion))
|
||||
{
|
||||
Vector cell = room.GetGridPosition(gridIndex);
|
||||
if (!explosion_line_clear(explosion.position, cell, false)) continue;
|
||||
if (!room_check_line(explosion.position, cell, LINE_MODE_EXPLOSION, 0)) continue;
|
||||
|
||||
uint32_t collision = room.GetGridCollision(gridIndex);
|
||||
GridEntity* grid = room.GetGridEntity((uint32_t)gridIndex);
|
||||
@@ -382,7 +352,7 @@ void explosion_damage(Explosion explosion)
|
||||
|
||||
Vector away = vector_sub(entity->pos, explosion.position);
|
||||
float distance = vector_length(away);
|
||||
if (explosion.isLineCheck && !explosion_line_clear(explosion.position, entity->pos, true)) continue;
|
||||
if (explosion.isLineCheck && !room_check_line({.start = explosion.position, .end = entity->pos, .mode = LINE_MODE_EXPLOSION, .isIgnoreWalls = true})) continue;
|
||||
if (source && source->type == ENTITY_BOMB) flags |= static_cast<Entity_Bomb*>(source)->tearFlags;
|
||||
|
||||
bool isPlayerSpared = type == ENTITY_PLAYER && (entity->mass == IMMOVABLE_MASS || (source && source->IsFriendly()) ||
|
||||
@@ -753,7 +723,7 @@ static void giga_bomb_crater(const Explosion& explosion)
|
||||
auto* dust = static_cast<Entity_Effect*>(game.Spawn({.position = explosion.position, .velocity = velocity, .type = ENTITY_EFFECT,
|
||||
.variant = EFFECT_DUST_CLOUD, .seed = Random()}));
|
||||
float spin = Random() & 1 ? 1 : -1;
|
||||
dust->rotation = (random_unit() * GIGA_DUST_SPIN_RANGE + GIGA_DUST_SPIN_MIN) * spin;
|
||||
dust->rotation = (random_between(DUST_SPIN_MIN, DUST_SPIN_RANGE)) * spin;
|
||||
float scale = random_unit() * GIGA_DUST_SCALE_RANGE + 1;
|
||||
dust->sprite.scale = vector_make(scale, scale);
|
||||
dust->SetTimeout((int)(Random() % GIGA_DUST_FRAMES) + GIGA_DUST_FRAMES);
|
||||
@@ -865,7 +835,7 @@ static void cross_bomb_spread(const Explosion& explosion)
|
||||
arm.isDamageSource = false;
|
||||
arm.isLineCheck = true;
|
||||
DeathmatchManager& versus = g_game->deathmatchManager;
|
||||
bool isBomberman = versus.is_active() && dynamic_cast<DeathmatchTypeBomberman*>(versus.type.get());
|
||||
bool isBomberman = versus.is_active() && versus.type->rules() == DEATHMATCH_BOMBERMAN;
|
||||
float scale = isBomberman ? CROSS_SCALE_VERSUS : CROSS_SCALE;
|
||||
arm.radiusMultiplier = scale * explosion.radiusMultiplier;
|
||||
|
||||
@@ -926,7 +896,7 @@ void explosion_effects(const Explosion& explosion)
|
||||
else if (flags[TEAR_GIGA_BOMB]) blast->sprite.scale = vector_make(explosion.radiusMultiplier * 2, explosion.radiusMultiplier * 2);
|
||||
|
||||
bool isFetusBomb = source && source->type == ENTITY_BOMB && static_cast<Entity_Bomb*>(source)->isFetus;
|
||||
if (g_game->dailyChallenge.specialDailyId == SPECIAL_DAILY_FIREWORKS && isFetusBomb)
|
||||
if (g_game->dailyChallenge.specialDailyId == SPECIAL_DAILY_JULY_4 && isFetusBomb)
|
||||
{
|
||||
Entity* fireworks = g_game->Spawn({.position = explosion.position, .subType = 1, .type = ENTITY_EFFECT,
|
||||
.variant = EFFECT_FIREWORKS, .seed = Random()});
|
||||
|
||||
+9
-21
@@ -148,7 +148,6 @@ constexpr float BEAST_STALACTITE_HURT = 14;
|
||||
constexpr float BEAST_STALACTITE_HURT_NEAR = 500;
|
||||
constexpr float BEAST_STALACTITE_HURT_FALLOFF = 1500;
|
||||
constexpr float BEAST_STALACTITE_HURT_FAR = 0.8f;
|
||||
constexpr int BEAST_STALACTITE_HIT_COUNTDOWN = 30;
|
||||
constexpr int BEAST_RING_AFTER = 20;
|
||||
constexpr int BEAST_RING_EVERY = 30;
|
||||
constexpr uint32_t BEAST_RING_GAPS = 20;
|
||||
@@ -256,7 +255,7 @@ static void beast_stalactites_hurt(Entity_NPC& npc, float left, float right)
|
||||
BEAST_STALACTITE_HURT_FALLOFF,
|
||||
0.0f, 1.0f);
|
||||
stalactite->TakeDamage((1 - falloff * BEAST_STALACTITE_HURT_FAR) * (roll * BEAST_STALACTITE_HURT + BEAST_STALACTITE_HURT),
|
||||
0, EntityRef(), BEAST_STALACTITE_HIT_COUNTDOWN);
|
||||
0, EntityRef(), HIT_COUNTDOWN);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -921,8 +920,8 @@ static void beast_switch(Entity_NPC& npc, Room& room)
|
||||
npc.stateFrame = 0;
|
||||
}
|
||||
|
||||
// Red rays burst from the Beast: a wide one and three thin ones at random turns.
|
||||
static void beast_rays_spawn(Entity_NPC& npc)
|
||||
// Red rays burst from a beast at an offset: a wide one and three thin ones at random turns.
|
||||
void beast_rays_spawn(Entity_NPC& npc, const Vector& offset)
|
||||
{
|
||||
int frames = (int)std::ceil(BEAST_RAY_FRAMES);
|
||||
auto* ray = static_cast<Entity_Effect*>(g_game->Spawn({.position = npc.pos,
|
||||
@@ -931,7 +930,7 @@ static void beast_rays_spawn(Entity_NPC& npc)
|
||||
.type = ENTITY_EFFECT,
|
||||
.variant = EFFECT_BIG_ATTRACT,
|
||||
.seed = Random()}));
|
||||
ray->posOffset = BEAST_RAY_OFFSET;
|
||||
ray->posOffset = offset;
|
||||
ray->SetColor(BEAST_RAY_COLOR, -1, COLOR_PRIORITY_DEFAULT, false, true);
|
||||
ray->minRadius = BEAST_RAY_INNER;
|
||||
ray->maxRadius = BEAST_RAY_OUTER;
|
||||
@@ -948,7 +947,7 @@ static void beast_rays_spawn(Entity_NPC& npc)
|
||||
.type = ENTITY_EFFECT,
|
||||
.variant = EFFECT_BIG_ATTRACT,
|
||||
.seed = Random()}));
|
||||
line->posOffset = BEAST_RAY_OFFSET;
|
||||
line->posOffset = offset;
|
||||
line->sprite.rotation = random_unit() * BEAST_THIN_RAY_SPREAD - BEAST_THIN_RAY_SPREAD * HALF +
|
||||
(float)thin * BEAST_THIN_RAY_TURN + turn;
|
||||
line->SetColor(BEAST_RAY_COLOR, -1, COLOR_PRIORITY_DEFAULT, false, true);
|
||||
@@ -982,7 +981,7 @@ static void beast_soul_call(Entity_NPC& npc, Room& room)
|
||||
g_game->Spawn({.position = at, .spawner = &npc, .type = ENTITY_BEAST, .variant = BEAST_SOUL, .seed = seed})
|
||||
->Update();
|
||||
}
|
||||
if ((npc.stateFrame & 1) == 0) beast_rays_spawn(npc);
|
||||
if ((npc.stateFrame & 1) == 0) beast_rays_spawn(npc, BEAST_RAY_OFFSET);
|
||||
npc.stateFrame++;
|
||||
}
|
||||
}
|
||||
@@ -1274,7 +1273,7 @@ static void stalactite_burst(Entity_NPC& npc)
|
||||
{
|
||||
for (int draw = 0; draw < STALACTITE_DISCARDED_DRAWS; draw++) Random();
|
||||
uint32_t seed = Random();
|
||||
float scatterAngle = random_unit() * RANDOM_HALF_TURN;
|
||||
float scatterAngle = random_unit() * PI_ROUGH;
|
||||
scatterAngle += scatterAngle;
|
||||
float scatter = random_unit();
|
||||
float turn = random_unit() * STALACTITE_THROW_SPREAD - STALACTITE_THROW_SPREAD * HALF;
|
||||
@@ -1295,7 +1294,7 @@ static void stalactite_burst(Entity_NPC& npc)
|
||||
piece->Update();
|
||||
|
||||
uint32_t dustSeed = Random();
|
||||
float dustAngle = random_unit() * RANDOM_HALF_TURN;
|
||||
float dustAngle = random_unit() * PI_ROUGH;
|
||||
dustAngle += dustAngle;
|
||||
float dustSpeed = random_unit() * STALACTITE_SCATTER;
|
||||
auto* dust = static_cast<Entity_Effect*>(g_game->Spawn({.position = capsule.center,
|
||||
@@ -1676,33 +1675,22 @@ void boss_beast_update(Entity_NPC& npc)
|
||||
case BEAST_SOUL:
|
||||
return beast_soul_update(npc);
|
||||
case BEAST_ULTRA_FAMINE:
|
||||
return NpcAI::ENTITY_BEAST_ultra_famine(&npc);
|
||||
case BEAST_ULTRA_FAMINE_FLY:
|
||||
return NpcAI::ENTITY_BEAST_ultra_famine_fly(&npc);
|
||||
case BEAST_ULTRA_PESTILENCE:
|
||||
return NpcAI::ENTITY_BEAST_ultra_pestilence(&npc);
|
||||
case BEAST_ULTRA_PESTILENCE_FLY:
|
||||
return NpcAI::ENTITY_BEAST_pestilence_fly(&npc);
|
||||
case BEAST_ULTRA_PESTILENCE_MAGGOT:
|
||||
return NpcAI::ENTITY_BEAST_ultra_pestilence_maggot(&npc);
|
||||
case BEAST_ULTRA_PESTILENCE_FLY_BALL:
|
||||
return NpcAI::ENTITY_BEAST_ultra_pestilence_fly_ball(&npc);
|
||||
case BEAST_ULTRA_WAR:
|
||||
return NpcAI::ENTITY_BEAST_ultra_war(&npc);
|
||||
case BEAST_ULTRA_WAR_BOMB:
|
||||
return NpcAI::ENTITY_BEAST_ultra_war_bomb(&npc);
|
||||
case BEAST_ULTRA_DEATH:
|
||||
return NpcAI::ENTITY_BEAST_ultra_death(&npc);
|
||||
case BEAST_ULTRA_DEATH_SCYTHE:
|
||||
return NpcAI::ENTITY_BEAST_ultra_death_scythe(&npc);
|
||||
case BEAST_ULTRA_DEATH_HEAD:
|
||||
return NpcAI::ENTITY_BEAST_ultra_death_head(&npc);
|
||||
case BEAST_BACKGROUND_BEAST:
|
||||
case BEAST_BACKGROUND_FAMINE:
|
||||
case BEAST_BACKGROUND_PESTILENCE:
|
||||
case BEAST_BACKGROUND_WAR:
|
||||
case BEAST_BACKGROUND_DEATH:
|
||||
return NpcAI::ENTITY_BEAST_background(&npc);
|
||||
return beast_horseman_update(npc);
|
||||
default:
|
||||
return beast_update(npc);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -209,7 +209,7 @@ void water_drops_spawn(const Vector& position, Vector radii, float speed)
|
||||
float scale = narrow > DROPS_BIG_RADIUS ? DROPS_BIG_SCALE : 1;
|
||||
for (int drops = (int)(Random() % DROPS_RANGE) + DROPS_MIN; drops > 0; drops--)
|
||||
{
|
||||
float angle = random_unit() * RANDOM_HALF_TURN;
|
||||
float angle = random_unit() * PI_ROUGH;
|
||||
angle += angle;
|
||||
Vector offset = vector_make(std::cos(angle) * radii.x, std::sin(angle) * radii.y);
|
||||
float pace = (random_unit() * DROPS_SPEED_RANGE + DROPS_SPEED_MIN) * speed;
|
||||
|
||||
+9
-13
@@ -87,7 +87,6 @@ constexpr float SWIPE_WALL_FACING = 0.3f;
|
||||
constexpr float SWIPE_KNOCK = 10;
|
||||
constexpr float SWIPE_PLAYER_DAMAGE = 2;
|
||||
constexpr float SWIPE_DAMAGE = 35;
|
||||
constexpr int SWIPE_HIT_COUNTDOWN = 30;
|
||||
constexpr uint32_t COIN_LOSS_RANGE = 3;
|
||||
constexpr float COIN_KNOCK = 3;
|
||||
constexpr float BUMBINO_COIN_SPEED_RANGE = 5;
|
||||
@@ -98,8 +97,6 @@ constexpr int SWIPE_AGAIN_FRAME = 7;
|
||||
// Its trail of dust while lunging, every 2 frames, at a fifth of its speed plus 2 at random.
|
||||
constexpr float DUST_EVERY = 2;
|
||||
constexpr float DUST_TRAIL_SHARE = 0.2f;
|
||||
constexpr float BUMBINO_DUST_SPIN = 10;
|
||||
constexpr float BUMBINO_DUST_SPIN_MIN = 2;
|
||||
constexpr uint32_t DUST_TRAIL_RANGE = 15;
|
||||
constexpr int DUST_TRAIL_FRAMES = 15;
|
||||
constexpr ColorMod BUMBINO_DUST_COLOR = {{0.8f, 0.7f, 0.65f, 0.75f}, {0, 0, 0, 0}, {0, 0, 0}};
|
||||
@@ -186,7 +183,7 @@ static void bumbino_trail_spawn(Entity_NPC& npc)
|
||||
Vector velocity = vector_add(vector_scale(npc.velocity, DUST_TRAIL_SHARE), vector_add(drift, drift));
|
||||
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_unit() * BUMBINO_DUST_SPIN + BUMBINO_DUST_SPIN_MIN;
|
||||
cloud->rotation = random_between(DUST_SPIN_MIN, DUST_SPIN_RANGE);
|
||||
cloud->SetTimeout((int)(Random() % DUST_TRAIL_RANGE) + DUST_TRAIL_FRAMES);
|
||||
cloud->SetColor(BUMBINO_DUST_COLOR, -1, COLOR_PRIORITY_DEFAULT, false, true);
|
||||
cloud->renderDepthOffset = BUMBINO_DUST_DEPTH;
|
||||
@@ -202,7 +199,7 @@ static void bumbino_burst_dust(Entity_NPC& npc, const Vector& position, const Ve
|
||||
.variant = EFFECT_DUST_CLOUD,
|
||||
.seed = Random()}));
|
||||
float side = Random() & 1 ? 1.0f : -1.0f;
|
||||
cloud->rotation = (random_unit() * BUMBINO_DUST_SPIN + BUMBINO_DUST_SPIN_MIN) * side;
|
||||
cloud->rotation = (random_between(DUST_SPIN_MIN, DUST_SPIN_RANGE)) * side;
|
||||
float scale = random_unit() * BUMBINO_DUST_SCALE_RANGE + BUMBINO_DUST_SCALE;
|
||||
cloud->sprite.scale = vector_make(scale, scale);
|
||||
cloud->SetTimeout((int)(Random() % SLAM_DUST_RANGE) + SLAM_DUST_FRAMES);
|
||||
@@ -347,7 +344,7 @@ static void bumbino_dizzy_update(Entity_NPC& npc, int ticks)
|
||||
params.scale = RAIN_SCALE - random_unit() * RAIN_SCALE_RANGE;
|
||||
params.variant = PROJECTILE_ROCK;
|
||||
params.fallingSpeedModifier = random_unit() * RAIN_FALL_RANGE + 0;
|
||||
float angle = random_unit() * RANDOM_HALF_TURN * 2;
|
||||
float angle = random_unit() * PI_ROUGH * 2;
|
||||
float speed = random_unit();
|
||||
npc.FireProjectiles(spot, vector_make(std::cos(angle) * speed, std::sin(angle) * speed), PROJECTILES_SINGLE, params);
|
||||
}
|
||||
@@ -363,7 +360,7 @@ static void bumbino_hitbox_update(Entity_NPC& npc)
|
||||
Capsule hitbox;
|
||||
npc.GetNullCapsule(hitbox, "Hitbox");
|
||||
if (hitbox.radius <= 0) return;
|
||||
// The hitspheres debug view (debug flag 6) is left out until Entity::GetDebugShape is written.
|
||||
// The hitspheres debug view (debug flag 6) is left out until DebugRenderer is taken over.
|
||||
|
||||
for (Entity* other : entity_query_radius(hitbox.center, hitbox.halfLength + hitbox.radius, QUERY_ALL))
|
||||
{
|
||||
@@ -374,7 +371,7 @@ static void bumbino_hitbox_update(Entity_NPC& npc)
|
||||
Vector away = vector_normalized(vector_sub(other->pos, npc.pos));
|
||||
other->velocity = vector_add(other->velocity, vector_scale(away, SWIPE_KNOCK));
|
||||
bool isFriend = other->type == ENTITY_PLAYER || other->type == ENTITY_FAMILIAR;
|
||||
other->TakeDamage(isFriend ? SWIPE_PLAYER_DAMAGE : SWIPE_DAMAGE, 0, EntityRef(&npc), SWIPE_HIT_COUNTDOWN);
|
||||
other->TakeDamage(isFriend ? SWIPE_PLAYER_DAMAGE : SWIPE_DAMAGE, 0, EntityRef(&npc), HIT_COUNTDOWN);
|
||||
|
||||
auto* player = other->ToPlayer();
|
||||
bool isRobbed = player && player->variant == 0 && !player->isCoopGhost &&
|
||||
@@ -386,7 +383,7 @@ static void bumbino_hitbox_update(Entity_NPC& npc)
|
||||
{
|
||||
uint32_t seed = Random();
|
||||
Vector knock = vector_scale(away, COIN_KNOCK);
|
||||
float angle = random_unit() * RANDOM_HALF_TURN * 2;
|
||||
float angle = random_unit() * PI_ROUGH * 2;
|
||||
float speed = random_unit() * BUMBINO_COIN_SPEED_RANGE + COIN_SPEED;
|
||||
Vector velocity = vector_add(knock, vector_make(std::cos(angle) * speed, std::sin(angle) * speed));
|
||||
g_game->Spawn({.position = player->pos,
|
||||
@@ -467,7 +464,7 @@ static void bumbino_slam_update(Entity_NPC& npc)
|
||||
game_shake_screen(BUMBINO_SLAM_SHAKE);
|
||||
for (int i = 0; i < SLAM_DUST; i++)
|
||||
{
|
||||
float angle = random_unit() * RANDOM_HALF_TURN * 2;
|
||||
float angle = random_unit() * PI_ROUGH * 2;
|
||||
float speed = random_unit() * BUMBINO_SLAM_DUST_SPEED_RANGE + SLAM_DUST_SPEED;
|
||||
bumbino_burst_dust(npc, hit, vector_make(std::cos(angle) * speed, std::sin(angle) * speed));
|
||||
}
|
||||
@@ -487,7 +484,7 @@ static void bumbino_slam_update(Entity_NPC& npc)
|
||||
npc.FireProjectiles(hit, vector_make(BUMBINO_SLAM_ROCK_SPEED, 0), PROJECTILES_EIGHT, params);
|
||||
for (int i = 0; i < BUMBINO_SLAM_PARTICLES; i++)
|
||||
{
|
||||
float angle = random_unit() * RANDOM_HALF_TURN * 2;
|
||||
float angle = random_unit() * PI_ROUGH * 2;
|
||||
float speed = random_unit() + PARTICLE_SPEED_MIN;
|
||||
Vector direction = vector_make(std::cos(angle) * speed, std::sin(angle) * speed * PARTICLE_FLATTEN);
|
||||
uint32_t seed = Random();
|
||||
@@ -572,8 +569,7 @@ static bool bumbino_rocks_break(Entity_NPC& npc)
|
||||
if (!isSolid || !rock || rock->collisionClass != COLLISION_SOLID) continue;
|
||||
if (!rock->Destroy(false, EntityRef(&npc))) continue;
|
||||
|
||||
Vector cell = vector_make((float)(rock->gridIndex % room.gridWidth) * GRID_CELL_SIZE + GRID_ORIGIN_X,
|
||||
(float)(rock->gridIndex / room.gridWidth) * GRID_CELL_SIZE + GRID_ORIGIN_Y);
|
||||
Vector cell = room.GetGridPosition(rock->gridIndex);
|
||||
Vector beyond = vector_add(cell, vector_scale(vector_cardinal(vector_sub(cell, npc.pos)), GRID_CELL_SIZE));
|
||||
int beyondIndex = room.GetGridIndex(beyond);
|
||||
if (beyondIndex >= 0) room_bridge_make(room.GetGridEntity((uint32_t)beyondIndex), rock);
|
||||
|
||||
+3
-4
@@ -52,7 +52,6 @@ constexpr int CAGE_REST = 30;
|
||||
constexpr uint32_t CAGE_ATTACK_ODDS = 20;
|
||||
constexpr uint32_t CAGE_PUKE_ODDS = 3;
|
||||
constexpr int CAGE_VOMIT_ENEMY_LIMIT = 3;
|
||||
constexpr float CAGE_HALF_TURN = 180;
|
||||
constexpr float CAGE_FULL_TURN = 360;
|
||||
constexpr float CAGE_JUMP_LEAD = 10;
|
||||
|
||||
@@ -168,7 +167,7 @@ static void cage_idle(Entity_NPC& npc)
|
||||
return;
|
||||
}
|
||||
npc.state = CAGE_PUKE;
|
||||
npc.v1.x = random_unit() * CAGE_FULL_TURN - CAGE_HALF_TURN;
|
||||
npc.v1.x = random_unit() * CAGE_FULL_TURN - HALF_TURN_DEGREES;
|
||||
float turn = (float)(Random() & 1) + 0;
|
||||
npc.v1.y = (turn + turn) - 1;
|
||||
return;
|
||||
@@ -226,7 +225,7 @@ static void cage_land_burst(Entity_NPC& npc)
|
||||
for (int i = 0; i < CAGE_CREEPS; i++)
|
||||
{
|
||||
uint32_t seed = Random();
|
||||
float angle = random_unit() * RANDOM_HALF_TURN;
|
||||
float angle = random_unit() * PI_ROUGH;
|
||||
angle += angle;
|
||||
float reach = random_unit() * CAGE_CREEP_REACH;
|
||||
Vector spot = vector_make(std::cos(angle) * reach + npc.pos.x, std::sin(angle) * reach + npc.pos.y);
|
||||
@@ -389,7 +388,7 @@ static bool cage_laser(Entity_NPC& npc)
|
||||
{.position = npc.pos,
|
||||
.posOffset = offset,
|
||||
.source = &npc,
|
||||
.angleDegrees = angle_wrap((float)direction * CAGE_LASER_QUARTER + CAGE_HALF_TURN),
|
||||
.angleDegrees = angle_wrap((float)direction * CAGE_LASER_QUARTER + HALF_TURN_DEGREES),
|
||||
.timeout = CAGE_LASER_TIMEOUT,
|
||||
.variant = CAGE_LASER_VARIANT});
|
||||
laser->renderDepthOffset = direction == DIRECTION_UP ? CAGE_LASER_DEPTH_UP : CAGE_LASER_DEPTH;
|
||||
|
||||
@@ -429,7 +429,7 @@ static void colostomia_charge_splash(Entity_NPC& npc)
|
||||
|
||||
for (uint32_t drops = Random() % COLO_DROPS_RANGE + COLO_DROPS; drops != 0; drops--)
|
||||
{
|
||||
float angle = random_unit() * RANDOM_HALF_TURN;
|
||||
float angle = random_unit() * PI_ROUGH;
|
||||
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;
|
||||
@@ -680,7 +680,7 @@ static void colostomia_drip(Entity_NPC& npc)
|
||||
Vector guide = npc.GetNullOffset("EffectGuide");
|
||||
if (vector_is_zero(guide)) return;
|
||||
|
||||
float angle = random_unit() * RANDOM_HALF_TURN;
|
||||
float angle = random_unit() * PI_ROUGH;
|
||||
angle += angle;
|
||||
float reach = random_unit();
|
||||
Vector drift = vector_make(std::cos(angle) * reach, std::sin(angle) * reach);
|
||||
|
||||
@@ -206,7 +206,7 @@ static void dll_drop(Entity_NPC& npc, int ticks)
|
||||
npc.stateFrame++;
|
||||
if (npc.variant != TRIACHNID || npc.stateFrame >= TRIACHNID_CREEP_FRAMES) continue;
|
||||
|
||||
float angle = random_unit() * RANDOM_HALF_TURN;
|
||||
float angle = random_unit() * PI_ROUGH;
|
||||
angle += angle;
|
||||
float reach = (float)npc.stateFrame + (float)npc.stateFrame + TRIACHNID_CREEP_REACH;
|
||||
Vector at = vector_make(std::cos(angle) * reach + npc.pos.x, std::sin(angle) * reach + npc.pos.y);
|
||||
|
||||
+64
-3
@@ -13,6 +13,8 @@
|
||||
#include "npc_ai.h"
|
||||
#include "options_config.h"
|
||||
#include "persistent_game_data.h"
|
||||
#include "player_manager.h"
|
||||
#include "item_pool.h"
|
||||
#include "room.h"
|
||||
#include "room_descriptor.h"
|
||||
#include "room_grid.h"
|
||||
@@ -78,6 +80,8 @@ constexpr RNG COLOR_HEART_SHIFTS = {0, 3, 5, 22};
|
||||
constexpr RNG CONSOLATION_SHIFTS = {0, 3, 3, 29};
|
||||
constexpr RNG SOL_SHIFTS = {0, 5, 27, 25};
|
||||
constexpr int DEATH_SEED_SHIFT_INDEX = 4;
|
||||
// An angel's key piece drop draws from its seed at this shift index.
|
||||
constexpr int ANGEL_DROP_SHIFT_INDEX = 30;
|
||||
constexpr int HORNFEL_SHIFT_INDEX = 23;
|
||||
constexpr int PERFECTION_SHIFT_INDEX = 24;
|
||||
constexpr int HORNFEL_CHEST_ODDS = 7;
|
||||
@@ -577,10 +581,67 @@ static void miniboss_death_rewards(Room& room, Entity_NPC& boss, RNG& rng, bool
|
||||
else if (isKrampus) save.TryUnlock(ACHIEVEMENT_HEAD_OF_KRAMPUS);
|
||||
}
|
||||
|
||||
// Part of 007fec00: an angel's key piece. The first Uriel (or Gabriel) of its kind killed in the room drops the
|
||||
// first (or second) key piece unless someone has it or it lies in the room. Filigree Feather stands in for the piece
|
||||
// another one would block: an angel item, with a half soul heart (doubled) or a soul heart (tripled) beside it.
|
||||
// The original also counts the angels killed in a Game field nothing reads, left out here.
|
||||
static void angel_key_piece_drop(Room& room, Entity_NPC& boss)
|
||||
{
|
||||
for (const KilledNpc& fallen : room.killedNpcs)
|
||||
if (fallen.type == (int)boss.type) return;
|
||||
|
||||
Game& game = *g_game;
|
||||
RNG rng;
|
||||
rng.game_constructor(boss.initSeed, ANGEL_DROP_SHIFT_INDEX);
|
||||
GameStateFlag killed = boss.type == ENTITY_URIEL ? GAME_STATE_URIEL_KILLED : GAME_STATE_GABRIEL_KILLED;
|
||||
if (!game.GetStateFlag(killed)) game.gameStateFlags |= 1ull << killed;
|
||||
|
||||
Vector spot = room_free_pickup_position_find({.position = boss.pos});
|
||||
PlayerManager& players = game.playerManager;
|
||||
bool hasFirst = players.AnyoneHasCollectible(COLLECTIBLE_KEY_PIECE_1);
|
||||
bool hasSecond = players.AnyoneHasCollectible(COLLECTIBLE_KEY_PIECE_2);
|
||||
bool isFirstHere = false;
|
||||
bool isSecondHere = false;
|
||||
for (Entity* entity : room.entityList.updateEL)
|
||||
{
|
||||
if (entity->type != ENTITY_PICKUP || entity->variant != PICKUP_COLLECTIBLE) continue;
|
||||
if (entity->subtype == COLLECTIBLE_KEY_PIECE_1) isFirstHere = true;
|
||||
else if (entity->subtype == COLLECTIBLE_KEY_PIECE_2) isSecondHere = true;
|
||||
}
|
||||
bool isFirstDropped = !hasFirst && !isFirstHere && (!players.AnyoneHasTrinket(TRINKET_FILIGREE_FEATHERS) || hasSecond);
|
||||
bool isSecondDropped =
|
||||
!hasSecond && !isSecondHere && (!players.AnyoneHasTrinket(TRINKET_FILIGREE_FEATHERS) || hasFirst);
|
||||
|
||||
int item = 0;
|
||||
if (boss.type == ENTITY_URIEL && isFirstDropped) item = COLLECTIBLE_KEY_PIECE_1;
|
||||
else if (boss.type == ENTITY_GABRIEL && isSecondDropped) item = COLLECTIBLE_KEY_PIECE_2;
|
||||
else
|
||||
{
|
||||
if (players.AnyoneHasTrinket(TRINKET_FILIGREE_FEATHERS))
|
||||
{
|
||||
item = game.itemPool.GetCollectible(POOL_ANGEL, rng.Next(), 0, 0, 0);
|
||||
Entity_Player* owner = players.FirstTrinketOwner(TRINKET_FILIGREE_FEATHERS);
|
||||
int multiplier = owner ? owner->GetTrinketMultiplier(TRINKET_FILIGREE_FEATHERS) : 0;
|
||||
if (multiplier == 2 || multiplier == 3)
|
||||
{
|
||||
int heart = multiplier == 2 ? (int)HEART_HALF_SOUL : (int)HEART_SOUL;
|
||||
game.Spawn({.position = spot, .spawner = &boss, .subType = heart, .type = ENTITY_PICKUP, .variant = PICKUP_HEART,
|
||||
.seed = rng.Next()});
|
||||
spot = room_free_pickup_position_find({.position = boss.pos});
|
||||
}
|
||||
}
|
||||
if (isFirstDropped) item = COLLECTIBLE_KEY_PIECE_1;
|
||||
else if (isSecondDropped) item = COLLECTIBLE_KEY_PIECE_2;
|
||||
if (item == 0) return;
|
||||
}
|
||||
game.Spawn({.position = spot, .spawner = &boss, .subType = item, .type = ENTITY_PICKUP, .variant = PICKUP_COLLECTIBLE,
|
||||
.seed = rng.Next()});
|
||||
}
|
||||
|
||||
// 007fec00 A boss leaving for good: counts it off the room's bosses (once, never a friendly one or one that does not
|
||||
// count), and the last one gives the room's rewards, a miniboss's or a boss's, then moves the room's death seed on.
|
||||
// In a challenge or the Boss Rush the rewards are drawn from the fight's seed instead, and the room's stays.
|
||||
// Big Horn's holes never count. Uriel's and Gabriel's key pieces are not reconstructed yet.
|
||||
// Big Horn's holes never count. Uriel and Gabriel may leave a key piece.
|
||||
void Room::TriggerBossDeath(Entity_NPC& boss)
|
||||
{
|
||||
Game& game = *g_game;
|
||||
@@ -616,7 +677,7 @@ void Room::TriggerBossDeath(Entity_NPC& boss)
|
||||
bool isAngel = boss.type == ENTITY_URIEL || boss.type == ENTITY_GABRIEL;
|
||||
RoomType currentType = game.room->roomType;
|
||||
bool isAngelRoom = currentType == ROOM_ANGEL || currentType == ROOM_SACRIFICE || currentType == ROOM_SUPERSECRET;
|
||||
if (isAngel && isAngelRoom) reconstruction_missing("Room::TriggerBossDeath 007fec00: the angels' key pieces");
|
||||
if (isAngel && isAngelRoom) angel_key_piece_drop(*this, boss);
|
||||
}
|
||||
|
||||
// 006d7520 A death animation's blood guide between its BloodStart and BloodStop (or Explosion) events: a huge boss
|
||||
@@ -684,7 +745,7 @@ void Entity_NPC::update_blood_guide_gibs(const NullFrame& guide)
|
||||
.variant = EFFECT_BLOOD_GUSH,
|
||||
.seed = Random()}));
|
||||
gush->FollowParent(this);
|
||||
float angle = random_unit() * RANDOM_HALF_TURN;
|
||||
float angle = random_unit() * PI_ROUGH;
|
||||
angle += angle;
|
||||
float distance = random_unit();
|
||||
gush->sprite.offset =
|
||||
|
||||
+2
-3
@@ -662,7 +662,7 @@ static void dogma_jacob(Entity_NPC& npc, float tvHealth)
|
||||
npc.sprite.GetLayer(DOGMA_DISTORTION_LAYER)->color._colorize[2] = DOGMA_GLOW_SHOT;
|
||||
for (int shot = (int)(Random() & 1) + 3; shot != 0; shot--)
|
||||
{
|
||||
float angle = random_unit() * RANDOM_HALF_TURN;
|
||||
float angle = random_unit() * PI_ROUGH;
|
||||
angle += angle;
|
||||
Vector velocity = vector_make(std::cos(angle) * DOGMA_JACOB_SPEED, std::sin(angle) * DOGMA_JACOB_SPEED);
|
||||
ProjectileParams params;
|
||||
@@ -1164,7 +1164,6 @@ constexpr float DOGMA_ANGEL_TRAIL_DRAG = 0.5f;
|
||||
constexpr float DOGMA_ANGEL_RING_REACH = 1.6f;
|
||||
constexpr float DOGMA_ANGEL_RING_PLAYER_DAMAGE = 1;
|
||||
constexpr float DOGMA_ANGEL_RING_DAMAGE = 100;
|
||||
constexpr int DOGMA_ANGEL_RING_HIT_COUNTDOWN = 30;
|
||||
constexpr float DOGMA_ANGEL_RING_PUSH = 10;
|
||||
constexpr uint64_t DOGMA_ANGEL_RING_FLAGS = FLAG_NO_KNOCKBACK | FLAG_NO_PHYSICS_KNOCKBACK;
|
||||
|
||||
@@ -1458,7 +1457,7 @@ static void angel_ring_touch(Entity_NPC& npc)
|
||||
{
|
||||
if (entity == &npc) continue;
|
||||
bool isAlly = entity->type == ENTITY_PLAYER || entity->type == ENTITY_FAMILIAR;
|
||||
entity->TakeDamage(isAlly ? DOGMA_ANGEL_RING_PLAYER_DAMAGE : DOGMA_ANGEL_RING_DAMAGE, 0, EntityRef(&npc), DOGMA_ANGEL_RING_HIT_COUNTDOWN);
|
||||
entity->TakeDamage(isAlly ? DOGMA_ANGEL_RING_PLAYER_DAMAGE : DOGMA_ANGEL_RING_DAMAGE, 0, EntityRef(&npc), HIT_COUNTDOWN);
|
||||
Vector away = vector_resized(vector_sub(entity->pos, npc.pos), DOGMA_ANGEL_RING_PUSH);
|
||||
entity->velocity = vector_add(entity->velocity, vector_scale(vector_rotated(away, RIGHT_ANGLE_DEGREES), entity->speedMultiplier));
|
||||
}
|
||||
|
||||
@@ -76,5 +76,7 @@ void boss_mother_update(Entity_NPC& npc);
|
||||
void boss_dogma_update(Entity_NPC& npc);
|
||||
void boss_beast_update(Entity_NPC& npc);
|
||||
void beast_background_spawn(Entity_NPC& npc);
|
||||
void beast_horseman_update(Entity_NPC& npc);
|
||||
void beast_rays_spawn(Entity_NPC& npc, const Vector& offset);
|
||||
void beast_render(Entity_NPC& npc, const Vector& offset);
|
||||
void mother_render(Entity_NPC& npc, const Vector& offset);
|
||||
@@ -38,9 +38,6 @@ constexpr float TERATOMA_SPIDER_FAR_REACH = 100;
|
||||
constexpr float TERATOMA_SPIDER_LIFT = 10;
|
||||
constexpr float TERATOMA_SPIDER_JUMP = -8;
|
||||
constexpr float TERATOMA_SPIDER_SPEED = 0.04f;
|
||||
constexpr float ROOM_GRID_ORIGIN_X = 40;
|
||||
constexpr float ROOM_GRID_ORIGIN_Y = 120;
|
||||
constexpr float ROOM_GRID_CELL = 40;
|
||||
|
||||
// The growl one of the room's Fistulas lets out now and then, picked among their sizes.
|
||||
static void fistula_growl(Entity_NPC& npc)
|
||||
@@ -131,11 +128,8 @@ static void teratoma_spiders(Entity_NPC& npc)
|
||||
auto* spider = static_cast<Entity_NPC*>(
|
||||
g_game->Spawn({.position = spot, .spawner = &npc, .type = ENTITY_SPIDER, .seed = Random()}));
|
||||
|
||||
int column = (int)((spot.x - ROOM_GRID_ORIGIN_X) / ROOM_GRID_CELL + 0.5f);
|
||||
int row = (int)((spot.y - ROOM_GRID_ORIGIN_Y) / ROOM_GRID_CELL + 0.5f);
|
||||
int cell = room.gridWidth * row + column;
|
||||
if (column >= 0 && column < room.gridWidth && row >= 0 && row < room.gridHeight && cell < ROOM_GRID_CELLS &&
|
||||
room.gridPaths[cell] < TERATOMA_SPIDER_PATH_LIMIT)
|
||||
int cell = room.GetGridIndex(spot);
|
||||
if (cell >= 0 && cell < ROOM_GRID_CELLS && room.gridPaths[cell] < TERATOMA_SPIDER_PATH_LIMIT)
|
||||
room.gridPaths[cell] = GRID_PATH_FREED;
|
||||
|
||||
spider->targetPosition = spider->pos;
|
||||
@@ -170,7 +164,7 @@ static void fistula_maggot(Entity_NPC& npc)
|
||||
// small ones, and a small one into its maggot or Teratoma's spiders.
|
||||
static void fistula_split(Entity_NPC& npc)
|
||||
{
|
||||
float angle = random_unit() * RANDOM_HALF_TURN;
|
||||
float angle = random_unit() * PI_ROUGH;
|
||||
angle += angle;
|
||||
float c = std::cos(angle) * FISTULA_SPLIT_REACH;
|
||||
float s = std::sin(angle) * FISTULA_SPLIT_REACH;
|
||||
|
||||
@@ -92,7 +92,7 @@ static void anim_keep(Entity_NPC& npc, std::string_view anim)
|
||||
// A random spot 70 out from the Forsaken.
|
||||
static Vector summon_spot_roll(const Entity_NPC& npc)
|
||||
{
|
||||
float angle = random_unit() * RANDOM_HALF_TURN;
|
||||
float angle = random_unit() * PI_ROUGH;
|
||||
angle += angle;
|
||||
return vector_make(std::cos(angle) * FORSAKEN_SUMMON_REACH + npc.pos.x,
|
||||
std::sin(angle) * FORSAKEN_SUMMON_REACH + npc.pos.y);
|
||||
|
||||
+2
-4
@@ -117,7 +117,6 @@ constexpr int CRUMBLE_PARTICLES_MIN = 12;
|
||||
constexpr int CRUMBLE_PARTICLES_RANGE = 3;
|
||||
constexpr float CRUMBLE_SPEED = 9;
|
||||
constexpr int DEATH_DUST_PARTICLES = 4;
|
||||
constexpr float DEATH_DUST_SPEED = 5;
|
||||
constexpr float DEATH_EXPLOSION_SCALE = 2;
|
||||
constexpr int GIDEON_DEATH_SHAKE = 14;
|
||||
constexpr int GIDEON_ROCK_PARTICLE_SUBTYPE = 7;
|
||||
@@ -130,7 +129,6 @@ constexpr std::array<int, 7> WAVE_DIFFICULTY = {1, 1, 5, 5, 10, 10, 15};
|
||||
constexpr int WAVE_PITS_FOR_FIRE_WORMS = 6;
|
||||
constexpr int WAVE_TRIES = 10;
|
||||
constexpr int STAGE_ID_HOME_DIMENSION = 35;
|
||||
constexpr int GIDEON_DIMENSION_DEATH_CERTIFICATE = 2;
|
||||
constexpr float WAVE_ENTRY_SCALE = 2.3283062e-10f;
|
||||
constexpr float CELL_SIZE = 40;
|
||||
constexpr float CELL_ORIGIN_X = 40;
|
||||
@@ -290,7 +288,7 @@ static void gideon_wave_spawn(Entity_NPC& npc)
|
||||
int stageId = STAGE_ID_HOME_DIMENSION;
|
||||
if (game.challenge == CHALLENGE_RED_REDEMPTION)
|
||||
stageId = RoomConfig::GetStageID(game.stage, game.GetRoomStageType(game.currentRoomIdx), ROOM_MODE_CURRENT);
|
||||
else if (game.currentDimensionIdx != GIDEON_DIMENSION_DEATH_CERTIFICATE)
|
||||
else if (game.currentDimensionIdx != DIMENSION_DEATH_CERTIFICATE)
|
||||
stageId = RoomConfig::GetStageID(game.stage, game.stageType, ROOM_MODE_CURRENT);
|
||||
RoomQuery query = {.shape = (RoomShape)room.GetRoomShape(),
|
||||
.maxDifficulty = difficulty,
|
||||
@@ -713,7 +711,7 @@ void gideon_death_update(Entity_NPC& npc)
|
||||
npc_sound_play(SOUND_ROCK_CRUMBLE, 1, 2, champion_pitch_get(npc));
|
||||
Random();
|
||||
game_particles_spawn({.position = npc.pos,
|
||||
.speed = DEATH_DUST_SPEED,
|
||||
.speed = DUST_SPEED,
|
||||
.count = DEATH_DUST_PARTICLES,
|
||||
.subType = GIDEON_ROCK_PARTICLE_SUBTYPE,
|
||||
.variant = EFFECT_ROCK_PARTICLE});
|
||||
|
||||
+1
-1
@@ -85,7 +85,7 @@ static void gurdy_players_place(Entity_NPC& npc)
|
||||
player.Teleport(vector_make(npc.pos.x, GURDY_PLAYER_ROW), false, false);
|
||||
continue;
|
||||
}
|
||||
float angle = random_unit() * RANDOM_HALF_TURN;
|
||||
float angle = random_unit() * PI_ROUGH;
|
||||
angle += angle;
|
||||
player.Teleport(vector_make(std::cos(angle) * GURDY_PLAYER_SCATTER + npc.pos.x,
|
||||
std::sin(angle) * GURDY_PLAYER_SCATTER + GURDY_PLAYER_ROW),
|
||||
|
||||
@@ -603,7 +603,7 @@ void boss_horny_boys_update(Entity_NPC& npc)
|
||||
|
||||
for (size_t slot = 0; slot < HORNY_BOMBS; slot++)
|
||||
{
|
||||
float angle = random_unit() * RANDOM_HALF_TURN;
|
||||
float angle = random_unit() * PI_ROUGH;
|
||||
angle += angle;
|
||||
Vector spot = vector_make(std::cos(angle) * HORNY_DEATH_SPREAD + npc.pos.x,
|
||||
std::sin(angle) * HORNY_DEATH_SPREAD + npc.pos.y);
|
||||
|
||||
@@ -53,7 +53,6 @@ constexpr int BOSS_ROOM_DELIRIUM = 90;
|
||||
constexpr int DELIRIUM_STAGE = 8;
|
||||
constexpr int DOUBLE_TROUBLE_FIRST = 3700;
|
||||
constexpr int DOUBLE_TROUBLE_SPAN = 150;
|
||||
constexpr float BYTE_TO_UNIT = 0.003921569f;
|
||||
constexpr float UNKNOWN_SHADOW_GREEN = 0.5568628f;
|
||||
constexpr float UNKNOWN_SHADOW_BLUE = 0.4666667f;
|
||||
|
||||
|
||||
+1
-1
@@ -989,7 +989,7 @@ static void blink_spot_pick(Entity_NPC& npc)
|
||||
{
|
||||
for (int tries = 0; vector_is_zero(npc.targetPosition) && tries < BLINK_TRIES; tries++)
|
||||
{
|
||||
float angle = random_unit() * RANDOM_HALF_TURN * 2;
|
||||
float angle = random_unit() * PI_ROUGH * 2;
|
||||
float reach = random_unit() * BLINK_REACH_RANGE + BLINK_REACH_MIN;
|
||||
Vector spot = vector_make(std::cos(angle) * reach + npc.pos.x, std::sin(angle) * reach + npc.pos.y);
|
||||
Vector fromTarget = vector_sub(npc.GetPlayerTarget()->pos, spot);
|
||||
|
||||
+55
-24
@@ -4,6 +4,7 @@
|
||||
#include "entity_config.h"
|
||||
#include "entity_pickup.h"
|
||||
#include "grid_entity.h"
|
||||
#include "menu_manager.h"
|
||||
#include "room_descriptor.h"
|
||||
#include "sfx_manager.h"
|
||||
#include <algorithm>
|
||||
@@ -42,6 +43,7 @@ constexpr float GRUB_AIM_LEAD = 16;
|
||||
constexpr float GRUB_AIM_BAND = 20;
|
||||
constexpr float GRUB_CHARGE_FRICTION = 0.9f;
|
||||
constexpr float GRUB_CHARGE_SPEED = 3.7f;
|
||||
constexpr float GRUB_CONTROLLED_CHARGE_SPEED = 5.55f;
|
||||
constexpr int GRUB_SPAWNS_MIN = 2;
|
||||
constexpr std::array<int, 3> GRUB_SPAWN_KINDS = {ENTITY_CHARGER, ENTITY_SPITTY, ENTITY_MAGGOT};
|
||||
constexpr int DAMAGE_COUNTDOWN_SHARED = 30;
|
||||
@@ -108,7 +110,8 @@ static void direction_play(Entity_NPC& npc, const DirectionAnims& anims, int dir
|
||||
npc.sprite.isFlipX = direction == DIRECTION_LEFT;
|
||||
}
|
||||
|
||||
// A dead Grub's segments all die and up to 2 to 5 of their free spots, shuffled, grow a Charger, Spitty or Maggot.
|
||||
// A dead Grub's segments all die and up to 2 to 5 of their free spots, shuffled, grow a Charger, Spitty or Maggot,
|
||||
// the first of which takes over its controller.
|
||||
static void grub_death(Entity_NPC& npc)
|
||||
{
|
||||
std::vector<Vector> spots = {npc.pos};
|
||||
@@ -133,14 +136,15 @@ static void grub_death(Entity_NPC& npc)
|
||||
{
|
||||
if (room_grid_collision_at(spots[i]) != 0) continue;
|
||||
int kind = GRUB_SPAWN_KINDS[Random() % GRUB_SPAWN_KINDS.size()];
|
||||
g_game->Spawn({.position = spots[i], .spawner = &npc, .type = kind, .seed = Random()});
|
||||
Entity* spawned = g_game->Spawn({.position = spots[i], .spawner = &npc, .type = kind, .seed = Random()});
|
||||
if (npc.controllerID != -1 && spawned) npc.TransferControl(static_cast<Entity_NPC*>(spawned));
|
||||
}
|
||||
npc.ClearEntityFlags(FLAG_NO_DEATH_TRIGGER);
|
||||
}
|
||||
|
||||
// A dead segment: a Larry Jr. head heals the segment behind it, a Grub breaks apart, the last segments cry out and a
|
||||
// Hollow segment may leave a Charger, Boom Fly or coin by its subtype.
|
||||
static void larry_death(Entity_NPC& npc)
|
||||
static void larry_death_effects(Entity_NPC& npc)
|
||||
{
|
||||
if (npc.type == ENTITY_LARRYJR)
|
||||
{
|
||||
@@ -169,6 +173,16 @@ static void larry_death(Entity_NPC& npc)
|
||||
npc.PlaySound(++g_hollowDeathCount & 1 ? SOUND_HOLLOW_DEATH_2 : SOUND_HOLLOW_DEATH_1, 1, 2, false, 1);
|
||||
}
|
||||
|
||||
// A dead segment's effects, then its controller passes to the segment behind it (a Grub's went to its spawns). The
|
||||
// original reads a missing segment's type, so none takes it here.
|
||||
static void larry_death(Entity_NPC& npc)
|
||||
{
|
||||
larry_death_effects(npc);
|
||||
Entity* next = npc.child;
|
||||
if (npc.controllerID != -1 && npc.type != ENTITY_GRUB && next && next->IsEnemy())
|
||||
npc.TransferControl(static_cast<Entity_NPC*>(next));
|
||||
}
|
||||
|
||||
// The first frame: a segment without a parent joins the nearest free tail of its kind within reach, a head names its
|
||||
// group, and a Grub segment pools its neighbours' health into its own.
|
||||
static void larry_init(Entity_NPC& npc)
|
||||
@@ -221,14 +235,23 @@ static void larry_init(Entity_NPC& npc)
|
||||
}
|
||||
|
||||
// A Larry Jr. tail now and then (more often when hurt) drops a poop where it crawls, outside challenge rooms and
|
||||
// calm Delirium forms, and pauses its next one.
|
||||
// calm Delirium forms, and pauses its next one. A controlled chain's tail drops one on its bomb button once paused
|
||||
// long enough.
|
||||
static void tail_poop(Entity_NPC& npc)
|
||||
{
|
||||
Room& room = *g_game->room;
|
||||
if (room.roomType == ROOM_CHALLENGE) return;
|
||||
bool isDropped = Random() % POOP_ODDS == 0;
|
||||
if (!isDropped && npc.pendingDamage > 0) isDropped = Random() % HURT_POOP_ODDS == 0;
|
||||
if (!isDropped) return;
|
||||
Entity_NPC* head = chain_head(npc);
|
||||
if (head && head->controllerID != -1)
|
||||
{
|
||||
if (!head->IsControllerActionPressed(ACTION_BOMB) || npc.v1.x > 0) return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (room.roomType == ROOM_CHALLENGE) return;
|
||||
bool isDropped = Random() % POOP_ODDS == 0;
|
||||
if (!isDropped && npc.pendingDamage > 0) isDropped = Random() % HURT_POOP_ODDS == 0;
|
||||
if (!isDropped) return;
|
||||
}
|
||||
if (npc.HasEntityFlags(FLAG_DELIRIUM_FORM) && room_is_clear()) return;
|
||||
|
||||
int cell = room.GetGridIndex(npc.pos);
|
||||
@@ -275,7 +298,8 @@ static void body_update(Entity_NPC& npc)
|
||||
if (npc.type == ENTITY_LARRYJR && !npc.child && npc.subtype != LARRY_SHARED_HEALTH) tail_poop(npc);
|
||||
}
|
||||
|
||||
// A Grub head waits, then charges along a row or column when its target (led a little) lines up in plain sight.
|
||||
// A Grub head waits, then charges along a row or column when its target (led a little) lines up in plain sight, or
|
||||
// a controlled one along its controller's walking input on the item button.
|
||||
static void grub_aim(Entity_NPC& npc)
|
||||
{
|
||||
if (npc.HasEntityFlags(GRUB_STUNNED)) return;
|
||||
@@ -289,10 +313,16 @@ static void grub_aim(Entity_NPC& npc)
|
||||
Vector preyVelocity = npc.GetPlayerTarget()->velocity;
|
||||
Vector lead = vector_scale(vector_scale(preyVelocity, random_unit()), GRUB_AIM_LEAD);
|
||||
Vector aim = vector_sub(vector_add(lead, preyPos), npc.pos);
|
||||
if (std::abs(aim.y) >= GRUB_AIM_BAND && std::abs(aim.x) >= GRUB_AIM_BAND) return;
|
||||
if (!room_check_line(npc.pos, vector_add(npc.pos, aim), LINE_MODE_GROUND, 0)) return;
|
||||
if (npc.controllerID == -1)
|
||||
{
|
||||
if (std::abs(aim.y) >= GRUB_AIM_BAND && std::abs(aim.x) >= GRUB_AIM_BAND) return;
|
||||
if (!room_check_line(npc.pos, vector_add(npc.pos, aim), LINE_MODE_GROUND, 0)) return;
|
||||
}
|
||||
else if (!npc.IsControllerActionPressed(ACTION_ITEM) || vector_is_zero(npc.GetControllerInput(MOVEMENT_DEADZONE)))
|
||||
return;
|
||||
|
||||
npc.PlaySound(SOUND_MONSTER_ROAR_0, 1, 2, false, 1);
|
||||
if (npc.controllerID != -1) aim = npc.GetControllerInput(0);
|
||||
npc.targetPosition = vector_cardinal(aim);
|
||||
npc.stateFrame = 0;
|
||||
npc.i1 = 1;
|
||||
@@ -300,7 +330,7 @@ static void grub_aim(Entity_NPC& npc)
|
||||
npc.pathfinder.moveDirection = {};
|
||||
}
|
||||
|
||||
// A charging Grub runs straight on until it hits a wall or is stunned.
|
||||
// A charging Grub runs straight on until it hits a wall or is stunned, faster under a player's control.
|
||||
static void grub_charge(Entity_NPC& npc)
|
||||
{
|
||||
if (npc.isCollidesWithGrid || npc.HasEntityFlags(GRUB_STUNNED))
|
||||
@@ -310,13 +340,13 @@ static void grub_charge(Entity_NPC& npc)
|
||||
return;
|
||||
}
|
||||
npc.friction *= GRUB_CHARGE_FRICTION;
|
||||
float speed = npc.controllerID == -1 ? GRUB_CHARGE_SPEED : GRUB_CONTROLLED_CHARGE_SPEED;
|
||||
if (npc.friction != 0)
|
||||
npc.velocity = vector_add(npc.velocity, vector_scale(npc.targetPosition,
|
||||
GRUB_CHARGE_SPEED * npc.speedMultiplier / npc.friction));
|
||||
npc.velocity = vector_add(npc.velocity, vector_scale(npc.targetPosition, speed * npc.speedMultiplier / npc.friction));
|
||||
}
|
||||
|
||||
// A Hollow head bounces about the room in a long or tall gait, turning off the walls, and keeps away from its
|
||||
// target while feared or shrunk. Confused, it wanders.
|
||||
// target while feared or shrunk. Confused, it wanders, unless a player controls it.
|
||||
static void hollow_move(Entity_NPC& npc)
|
||||
{
|
||||
if (vector_length_squared(npc.velocity) < HOLLOW_STILL_SPEED_SQUARED && npc.friction != 0)
|
||||
@@ -349,7 +379,7 @@ static void hollow_move(Entity_NPC& npc)
|
||||
npc.v1 = Random() & 1 ? vector_make(HOLLOW_GAIT_TALL_SHORT, HOLLOW_GAIT_LONG)
|
||||
: vector_make(HOLLOW_GAIT_LONG, HOLLOW_GAIT_WIDE_SHORT);
|
||||
|
||||
if (npc.HasEntityFlags(FLAG_CONFUSION))
|
||||
if (npc.HasEntityFlags(FLAG_CONFUSION) && npc.controllerID == -1)
|
||||
{
|
||||
npc.friction = HOLLOW_CONFUSED_FRICTION;
|
||||
for (int i = 0; i < 3; i++) npc.pathfinder.MoveRandomlyBoss(STATUS_OBEYED);
|
||||
@@ -358,7 +388,7 @@ static void hollow_move(Entity_NPC& npc)
|
||||
if (npc.friction != 0)
|
||||
npc.velocity = vector_add(npc.velocity, vector_scale(vector_make(sign.x * npc.v1.x, sign.y * npc.v1.y),
|
||||
npc.speedMultiplier / npc.friction));
|
||||
if (!npc.HasEntityFlags(FLAG_FEAR | FLAG_SHRINK)) return;
|
||||
if (!npc.HasEntityFlags(FLAG_FEAR | FLAG_SHRINK) || npc.controllerID != -1) return;
|
||||
|
||||
Vector away = vector_sub(npc.pos, npc.GetPlayerTarget()->pos);
|
||||
float strength = std::clamp((LARRY_FLEE_RANGE - vector_length(away)) * LARRY_FLEE_STRENGTH, 0.0f, LARRY_FLEE_MAX);
|
||||
@@ -367,10 +397,12 @@ static void hollow_move(Entity_NPC& npc)
|
||||
vector_scale(vector_resized(away, strength), npc.speedMultiplier / npc.friction));
|
||||
}
|
||||
|
||||
// A spitting Larry Jr. (subtype 1) now and then shoots along its way: one shot, three for the Hollow.
|
||||
// A spitting Larry Jr. (subtype 1) now and then shoots along its way: one shot, three for the Hollow. A controlled
|
||||
// one spits on its controller's shooting input, on the shortest cooldown.
|
||||
static void larry_spit(Entity_NPC& npc)
|
||||
{
|
||||
if (Random() % SPIT_ODDS != 0) return;
|
||||
bool isControlled = npc.controllerID != -1;
|
||||
if (!(isControlled ? npc.IsTargetInAttackRange(CONTROLLED_ATTACK_RANGE, 0, true) : Random() % SPIT_ODDS == 0)) return;
|
||||
if (npc.projectileCooldown > 0)
|
||||
{
|
||||
npc.projectileCooldown -= npc_ticks_get(npc);
|
||||
@@ -378,7 +410,7 @@ static void larry_spit(Entity_NPC& npc)
|
||||
}
|
||||
|
||||
npc.PlaySound(SOUND_BLOODSHOOT, 1, 2, false, 1);
|
||||
npc.projectileCooldown = (int)(Random() % SPIT_COOLDOWN_SPREAD) + SPIT_COOLDOWN;
|
||||
npc.projectileCooldown = (isControlled ? 0 : (int)(Random() % SPIT_COOLDOWN_SPREAD)) + SPIT_COOLDOWN;
|
||||
ProjectileParams params;
|
||||
params.fallingAccelModifier = SPIT_FALLING_ACCEL;
|
||||
if (npc.variant == 0) params.fallingSpeedModifier = SPIT_FALLING_SPEED;
|
||||
@@ -439,15 +471,14 @@ static void head_update(Entity_NPC& npc)
|
||||
}
|
||||
|
||||
// 0046a0f0 NpcAI::ENTITY_LARRYJR: Larry Jr. and the Hollow (type 19), Buttlicker (89) and Grub (239), heads that
|
||||
// crawl about trailed by body segments, which die one by one. A head without a body dies too. Tuff Twins and a
|
||||
// segment a player controls are not reconstructed yet.
|
||||
// crawl about trailed by body segments, which die one by one. A head without a body dies too. A player controlling a
|
||||
// segment steers the head instead.
|
||||
void boss_larry_jr_update(Entity_NPC& npc)
|
||||
{
|
||||
if (npc.type == ENTITY_LARRYJR && (npc.variant == LARRY_TUFF_TWINS || npc.variant == LARRY_TUFF_TWINS_ALT))
|
||||
return boss_tuff_twins_update(npc);
|
||||
Entity_NPC* head = chain_head(npc);
|
||||
if (npc.controllerID != -1 || (head && head->controllerID != -1))
|
||||
reconstruction_missing("NpcAI::ENTITY_LARRYJR 0046a0f0: a segment a player controls");
|
||||
if (npc.controllerID != -1 && npc.parent && head) npc.TransferControl(head);
|
||||
|
||||
if (npc.isDead) return larry_death(npc);
|
||||
if (npc.state == NPC_STATE_INIT) return larry_init(npc);
|
||||
|
||||
@@ -386,7 +386,7 @@ static void blub_burst(Entity_NPC& npc)
|
||||
timer->Update();
|
||||
for (uint32_t i = Random() % DEATH_LEECHES_RANGE + DEATH_LEECHES; i != 0; i--)
|
||||
{
|
||||
float angle = random_unit() * RANDOM_HALF_TURN * 2;
|
||||
float angle = random_unit() * PI_ROUGH * 2;
|
||||
float reach = random_unit() * DEATH_LEECH_REACH;
|
||||
blub_leech_throw(npc, vector_add(npc.pos, vector_make(std::cos(angle) * reach, std::sin(angle) * reach)), false);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "boss_ai.h"
|
||||
#include "entity_player.h"
|
||||
#include "menu_manager.h"
|
||||
#include "npc_caves.h"
|
||||
#include "room_grid.h"
|
||||
#include "sfx_manager.h"
|
||||
@@ -228,6 +229,31 @@ static void mask_charge_try(Entity_NPC& npc, Vector cell)
|
||||
npc_sound_play(SOUND_MASKINFAMY_DASH, 1, 2, 1);
|
||||
}
|
||||
|
||||
// A controlled Mask charges on its controller's item button along the controller's input (the heart's walking input,
|
||||
// its own shooting one), or along its own motion without input.
|
||||
static void mask_controlled_charge_try(Entity_NPC& npc, Entity_NPC& controller)
|
||||
{
|
||||
npc.targetPosition = {};
|
||||
if (!controller.IsControllerActionPressed(ACTION_ITEM)) return;
|
||||
|
||||
Vector input = &controller == &npc ? controller.GetControllerInput(0) : controller.GetControllerMovementInput(0);
|
||||
if (vector_is_zero(input)) input = npc.velocity;
|
||||
if (vector_is_zero(input)) return;
|
||||
npc.targetPosition = vector_scale(vector_cardinal(input), MASK_CHARGE_PUSH);
|
||||
npc.i1 = MASK_DASH_CHARGE;
|
||||
}
|
||||
|
||||
// The NPC steering a Mask: the Mask itself, else its heart (parent, then its linked entity) when a player controls it.
|
||||
// In versus the original also takes a player there.
|
||||
static Entity_NPC* mask_controller_get(Entity_NPC& npc)
|
||||
{
|
||||
if (npc.controllerID != -1) return &npc;
|
||||
for (Entity* link : {npc.parent.get(), npc.entityRef.get()})
|
||||
if (link && link->IsEnemy() && static_cast<Entity_NPC*>(link)->controllerID != -1)
|
||||
return static_cast<Entity_NPC*>(link);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// The dash along its axis, drawn into its lane, until it hits a wall or is distracted.
|
||||
static void mask_dash(Entity_NPC& npc, Vector cell)
|
||||
{
|
||||
@@ -250,14 +276,11 @@ static void mask_dash(Entity_NPC& npc, Vector cell)
|
||||
// 00461fc0 NpcAI::ENTITY_MASK_OF_INFAMY: the Mask of Infamy (and the plain Mask) drifts along the axes untouchable
|
||||
// while its heart lives, charging targets lined up with it and lunging when the heart is hurt. Without the heart it
|
||||
// turns angry and can be hurt. The original compares the lane cell's coordinates, not the dash's axis, to pick
|
||||
// which way it is drawn into its lane.
|
||||
// which way it is drawn into its lane. A player steering the Mask or its heart charges it on the item button and walks
|
||||
// it while it wanders.
|
||||
void boss_mask_of_infamy_update(Entity_NPC& npc)
|
||||
{
|
||||
bool isControlled = npc.controllerID != -1;
|
||||
for (Entity* link : {npc.parent.get(), npc.entityRef.get()})
|
||||
isControlled |= link && link->IsEnemy() && static_cast<Entity_NPC*>(link)->controllerID != -1;
|
||||
if (isControlled) reconstruction_missing("NpcAI::ENTITY_MASK_OF_INFAMY 00461fc0: a Mask under a player's control");
|
||||
|
||||
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);
|
||||
@@ -265,12 +288,26 @@ void boss_mask_of_infamy_update(Entity_NPC& npc)
|
||||
|
||||
Vector cell = mask_cell_center(npc.pos);
|
||||
bool isActive = !npc.HasEntityFlags(FLAG_DELIRIUM_FORM) || !room_is_clear();
|
||||
if ((npc.i1 == MASK_DASH_NONE || npc.i1 == MASK_DASH_LUNGE) && !npc.HasEntityFlags(FLAG_DISTRACTED) && isActive)
|
||||
mask_charge_try(npc, cell);
|
||||
if ((npc.i1 == MASK_DASH_NONE || npc.i1 == MASK_DASH_LUNGE) && !npc.HasEntityFlags(FLAG_DISTRACTED))
|
||||
{
|
||||
if (controller) mask_controlled_charge_try(npc, *controller);
|
||||
else if (isActive) mask_charge_try(npc, cell);
|
||||
}
|
||||
if (npc.i1 != MASK_DASH_NONE) return mask_dash(npc, cell);
|
||||
|
||||
int ownController = npc.controllerID;
|
||||
if (controller)
|
||||
{
|
||||
npc.controllerID = controller->controllerID;
|
||||
npc.isControlSwapped = controller != &npc;
|
||||
}
|
||||
npc.pathfinder.MoveRandomlyAxisAligned(npc.state == MASK_ANGRY ? MASK_ANGRY_WANDER_SPEED : MASK_WANDER_SPEED,
|
||||
STATUS_OBEYED);
|
||||
if (controller)
|
||||
{
|
||||
npc.controllerID = ownController;
|
||||
npc.isControlSwapped = false;
|
||||
}
|
||||
npc.velocity.x *= timescale_factor(MASK_DRAG_X, npc.speedMultiplier);
|
||||
npc.velocity.y *= timescale_factor(MASK_DRAG_Y, npc.speedMultiplier);
|
||||
}
|
||||
@@ -78,7 +78,6 @@ constexpr float SUMMON_OUT = 20;
|
||||
constexpr float SUMMON_RAISE = 4;
|
||||
constexpr float MATRIARCH_SUMMON_SPEED = 10;
|
||||
constexpr float SUMMON_BLOOD_SHARE = 0.3f;
|
||||
constexpr int SUMMON_HIT_COUNTDOWN = 30;
|
||||
|
||||
// Worms: eight Chubber worms on an ellipse of 16 (22.4 across), their blood thrown at 0.3, 0.5 and 0.6 of their speed.
|
||||
constexpr int WORMS = 8;
|
||||
@@ -297,7 +296,7 @@ static void matriarch_summon_spit(Entity_NPC& npc)
|
||||
matriarch_blood_spawn(BLOOD_SUBTYPE_SPLASH, position, vector_scale(fistuloid->velocity, SUMMON_BLOOD_SHARE), BLOOD_RAISE);
|
||||
|
||||
float left = std::max(npc.health - fistuloid_health_get(), matriarch_chunk_health(npc) + 1);
|
||||
if (left < npc.health) npc.TakeDamage(npc.health - left, 0, EntityRef(), SUMMON_HIT_COUNTDOWN);
|
||||
if (left < npc.health) npc.TakeDamage(npc.health - left, 0, EntityRef(), HIT_COUNTDOWN);
|
||||
}
|
||||
|
||||
// Sprays a ring of eight Chubber worms, each in its blood.
|
||||
|
||||
@@ -288,7 +288,7 @@ static void mega_fatty_land_burst(Entity_NPC& npc)
|
||||
for (int i = 0; i < MEGA_FATTY_CREEPS; i++)
|
||||
{
|
||||
uint32_t seed = Random();
|
||||
float angle = random_unit() * RANDOM_HALF_TURN;
|
||||
float angle = random_unit() * PI_ROUGH;
|
||||
angle += angle;
|
||||
float reach = random_unit() * MEGA_FATTY_CREEP_REACH;
|
||||
Vector spot = vector_make(std::cos(angle) * reach + npc.pos.x, std::sin(angle) * reach + npc.pos.y);
|
||||
@@ -327,7 +327,7 @@ static void mega_fatty_dips_spawn(Entity_NPC& npc)
|
||||
{
|
||||
uint32_t seed = Random();
|
||||
Vector spot = room_free_pickup_position_find({.position = npc.pos, .step = MEGA_FATTY_DIP_SEARCH});
|
||||
float angle = random_unit() * RANDOM_HALF_TURN;
|
||||
float angle = random_unit() * PI_ROUGH;
|
||||
angle += angle;
|
||||
float reach = random_unit();
|
||||
Vector position = vector_make(std::cos(angle) * reach * MEGA_FATTY_DIP_SPREAD + spot.x,
|
||||
|
||||
@@ -124,9 +124,6 @@ constexpr float DIVE_GROUP_FLATTEN = 0.6f;
|
||||
constexpr int DIVE_RETURN_FRAMES = 29;
|
||||
constexpr float DIVE_RISE_RADIUS = 0.1f;
|
||||
|
||||
// collect_npcs_with_same_parent's turn: a full turn in radians, wrapped as if it were degrees.
|
||||
constexpr float SIBLING_TURN = 6.2831855f;
|
||||
|
||||
// 00557ce0 collect_npcs_with_same_parent: the live Willos sharing the Willo's parent spread evenly around their ring.
|
||||
static void willo_siblings_spread(Entity_NPC& npc)
|
||||
{
|
||||
@@ -142,7 +139,7 @@ static void willo_siblings_spread(Entity_NPC& npc)
|
||||
}
|
||||
if (siblings.size() < 2) return;
|
||||
|
||||
float step = SIBLING_TURN / (float)siblings.size();
|
||||
float step = TAU / (float)siblings.size();
|
||||
for (size_t i = 0; i < siblings.size(); i++) siblings[i]->v2.x = angle_wrap((float)i * step + lowest);
|
||||
}
|
||||
|
||||
@@ -497,7 +494,7 @@ static Vector dive_spot_find(Entity_NPC& npc, const std::vector<Entity*>& spawne
|
||||
if (tries < DIVE_NEAR_TRIES && Random() % DIVE_NEAR_ODDS == 0)
|
||||
{
|
||||
Vector targetPos = npc.GetPlayerTarget()->pos;
|
||||
float angle = random_unit() * RANDOM_HALF_TURN * 2;
|
||||
float angle = random_unit() * PI_ROUGH * 2;
|
||||
float distance = random_unit() * DIVE_NEAR_RANGE + DIVE_NEAR_MIN;
|
||||
Vector near = vector_add(targetPos, vector_make(std::cos(angle) * distance, std::sin(angle) * distance));
|
||||
spot = room.GetClampedPositionImpl(near, DIVE_SPOT_MARGIN, DIVE_SPOT_MARGIN, DIVE_SPOT_MARGIN,
|
||||
|
||||
@@ -411,7 +411,7 @@ static void suckers_free(Entity_NPC& npc)
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
uint32_t seed = Random();
|
||||
float angle = random_unit() * RANDOM_HALF_TURN;
|
||||
float angle = random_unit() * PI_ROUGH;
|
||||
angle += angle;
|
||||
Vector spot = vector_make(std::cos(angle) * npc.size + npc.pos.x, std::sin(angle) * npc.size + npc.pos.y);
|
||||
Entity* sucker = g_game->Spawn({.position = spot,
|
||||
|
||||
+10
-11
@@ -122,7 +122,6 @@ constexpr int SCRAPE_SHAKE = 8;
|
||||
constexpr float SCRAPE_PUSH = 10;
|
||||
constexpr float SCRAPE_PLAYER_DAMAGE = 2;
|
||||
constexpr float SCRAPE_DAMAGE = 100;
|
||||
constexpr int MOTHER_HIT_COUNTDOWN = 30;
|
||||
constexpr float SCRAPE_ISAAC_REACH = 140;
|
||||
|
||||
// The crush: her hands sweep down 20 a frame from the Shoot, killing the Dead Isaacs above the sweep every other frame,
|
||||
@@ -962,7 +961,7 @@ static void mother_scrape_update(Entity_NPC& npc)
|
||||
other->velocity = vector_add(
|
||||
other->velocity, vector_scale(vector_normalized(vector_sub(other->pos, npc.pos)), SCRAPE_PUSH));
|
||||
float damage = other->is_player() || other->IsFamiliar() ? SCRAPE_PLAYER_DAMAGE : SCRAPE_DAMAGE;
|
||||
other->TakeDamage(damage, 0, EntityRef(&npc), MOTHER_HIT_COUNTDOWN);
|
||||
other->TakeDamage(damage, 0, EntityRef(&npc), HIT_COUNTDOWN);
|
||||
}
|
||||
if (other->IsType(ENTITY_MOTHER, MOTHER_DEAD_ISAAC, -1)) npc_sound_play(SOUND_MOTHER_ISAAC_HIT, 1, 2, 1);
|
||||
}
|
||||
@@ -1124,7 +1123,7 @@ static void mother_wall_row_fall(Entity_NPC& npc)
|
||||
dust_spawn(spot, 1, 0);
|
||||
if (Random() % SUMMON_SPLAT_ODDS == 0)
|
||||
{
|
||||
float angle = random_unit() * RANDOM_HALF_TURN;
|
||||
float angle = random_unit() * PI_ROUGH;
|
||||
angle += angle;
|
||||
float reach = random_unit() * MOTHER_WALL_SPLAT_REACH;
|
||||
Vector splat = vector_make(std::cos(angle) * reach + spot.x, spot.y + std::sin(angle) * reach);
|
||||
@@ -1481,7 +1480,7 @@ static void mother_charge_update(Entity_NPC& npc, const MotherBounds& bounds)
|
||||
for (size_t i = 0; i < CHARGE_SPOTS.size(); i++)
|
||||
{
|
||||
Vector spot = CHARGE_SPOTS[i];
|
||||
float angle = random_unit() * RANDOM_HALF_TURN;
|
||||
float angle = random_unit() * PI_ROUGH;
|
||||
angle += angle;
|
||||
float reach = random_unit() * CHARGE_SPLAT_REACH;
|
||||
Vector position = vector_make(std::cos(angle) * reach + npc.pos.x + spot.x,
|
||||
@@ -1646,7 +1645,7 @@ static void mother_spin_update(Entity_NPC& npc, int ticks)
|
||||
.spread = GIB_SPREAD,
|
||||
.amount = 1,
|
||||
.gibFlags = (Random() & 1) ? 4u : GIB_BLOOD});
|
||||
float angle = random_unit() * RANDOM_HALF_TURN;
|
||||
float angle = random_unit() * PI_ROUGH;
|
||||
angle += angle;
|
||||
Vector direction = vector_make(std::cos(angle), std::sin(angle));
|
||||
Vector velocity = vector_scale(direction, random_between(SPIN_SPLAT_SPEED, SPIN_SPLAT_SPEED_RANGE));
|
||||
@@ -2119,7 +2118,7 @@ static void mother_worm_steer(Entity_NPC& npc)
|
||||
if (delay > 0)
|
||||
{
|
||||
float ramp = std::clamp((float)delay / WORM_WEAVE_RAMP, 0.0f, 1.0f);
|
||||
float angle = random_unit() * RANDOM_HALF_TURN;
|
||||
float angle = random_unit() * PI_ROUGH;
|
||||
angle += angle;
|
||||
float jitter = random_unit();
|
||||
Vector heading = vector_normalized(npc.velocity);
|
||||
@@ -2206,14 +2205,14 @@ static void mother_orb_collide(Entity_NPC& npc)
|
||||
Vector away = vector_sub(other->pos, npc.pos);
|
||||
if (vector_length(away) > 0) away = vector_resized(away, ORB_PUSH);
|
||||
other->velocity = vector_add(other->velocity, vector_scale(away, other->speedMultiplier));
|
||||
other->TakeDamage(npc.collisionDamage, 0, EntityRef(&npc), MOTHER_HIT_COUNTDOWN);
|
||||
other->TakeDamage(npc.collisionDamage, 0, EntityRef(&npc), HIT_COUNTDOWN);
|
||||
npc.collisionResult = 0;
|
||||
return;
|
||||
}
|
||||
if (other->IsFamiliar() || !Entity::is_enemy_type(other->type) || npc.subtype != MOTHER_ORB_BIG) return;
|
||||
|
||||
if (other->IsVulnerableEnemy(nullptr) && !other->IsBoss())
|
||||
other->TakeDamage(ORB_ENEMY_DAMAGE, 0, EntityRef(&npc), MOTHER_HIT_COUNTDOWN);
|
||||
other->TakeDamage(ORB_ENEMY_DAMAGE, 0, EntityRef(&npc), HIT_COUNTDOWN);
|
||||
npc.collisionResult = 0;
|
||||
}
|
||||
|
||||
@@ -2416,7 +2415,7 @@ static void mother_orb_burst(Entity_NPC& npc)
|
||||
Entity* mother = npc.entityRef;
|
||||
if (npc.subtype == MOTHER_ORB_SMALL)
|
||||
{
|
||||
if (mother) mother->TakeDamage(ORB_SMALL_MOTHER_DAMAGE, 0, EntityRef(), MOTHER_HIT_COUNTDOWN);
|
||||
if (mother) mother->TakeDamage(ORB_SMALL_MOTHER_DAMAGE, 0, EntityRef(), HIT_COUNTDOWN);
|
||||
else
|
||||
small_maggot_spawn(npc.pos, ORB_MAGGOT_HEIGHT, {}, ORB_MAGGOT_RISE - random_unit() * ORB_MAGGOT_RISE_RANGE);
|
||||
return;
|
||||
@@ -2427,7 +2426,7 @@ static void mother_orb_burst(Entity_NPC& npc)
|
||||
if (mother)
|
||||
{
|
||||
if (mother->entityCollisionClass != ENTCOLL_NONE)
|
||||
mother->TakeDamage(ORB_MEDIUM_MOTHER_DAMAGE, 0, EntityRef(), MOTHER_HIT_COUNTDOWN);
|
||||
mother->TakeDamage(ORB_MEDIUM_MOTHER_DAMAGE, 0, EntityRef(), HIT_COUNTDOWN);
|
||||
npc_sound_play(SOUND_DEATH_BURST_LARGE, 1, 2, 1);
|
||||
blood_explosion_spawn(4, npc.pos, npc.posOffset, npc.splatColor, vector_scale(npc.velocity, HALF));
|
||||
game_shake_screen(ORB_MEDIUM_SHAKE);
|
||||
@@ -2446,7 +2445,7 @@ static void mother_orb_burst(Entity_NPC& npc)
|
||||
if (mother)
|
||||
{
|
||||
if (mother->entityCollisionClass != ENTCOLL_NONE)
|
||||
mother->TakeDamage(ORB_BIG_MOTHER_DAMAGE, 0, EntityRef(), MOTHER_HIT_COUNTDOWN);
|
||||
mother->TakeDamage(ORB_BIG_MOTHER_DAMAGE, 0, EntityRef(), HIT_COUNTDOWN);
|
||||
spread = ORB_MOTHER_SPREAD;
|
||||
}
|
||||
for (int i = 0; i < ORB_BIG_PIECES; i++)
|
||||
|
||||
@@ -67,8 +67,6 @@ constexpr ColorMod DUST_COLOR = {{0, 0, 0, 1}, {0, 0, 0, 0}, {0, 0, 0}};
|
||||
constexpr float DUST_DRAG = 0.1f;
|
||||
constexpr float DUST_RISE = -2;
|
||||
constexpr float DUST_RISE_RANGE = 6;
|
||||
constexpr float SHADOW_DUST_SPIN = 10;
|
||||
constexpr float SHADOW_DUST_SPIN_MIN = 2;
|
||||
constexpr uint32_t SHADOW_DUST_TIMEOUT_RANGE = 10;
|
||||
constexpr int SHADOW_DUST_TIMEOUT = 10;
|
||||
constexpr float SHADOW_DUST_SCALE = 1.5f;
|
||||
@@ -250,7 +248,7 @@ static void shadow_dust_spawn(Entity_NPC& npc)
|
||||
auto* dust = static_cast<Entity_Effect*>(g_game->Spawn(
|
||||
{.position = at, .velocity = velocity, .spawner = &npc, .type = ENTITY_EFFECT, .variant = EFFECT_DUST_CLOUD, .seed = seed}));
|
||||
dust->sprite.GetLayer(0)->color = DUST_COLOR;
|
||||
dust->rotation = random_unit() * SHADOW_DUST_SPIN + SHADOW_DUST_SPIN_MIN;
|
||||
dust->rotation = random_between(DUST_SPIN_MIN, DUST_SPIN_RANGE);
|
||||
int timeout = (int)(Random() % SHADOW_DUST_TIMEOUT_RANGE) + SHADOW_DUST_TIMEOUT;
|
||||
dust->timeout = timeout;
|
||||
dust->lifespan = timeout;
|
||||
|
||||
+4
-4
@@ -278,7 +278,7 @@ static void peep_jump_down(Entity_NPC& npc, const ColorMod& bloodColor)
|
||||
for (int i = 0; i < BLOAT_LAND_CREEPS; i++)
|
||||
{
|
||||
uint32_t seed = Random();
|
||||
float angle = random_unit() * RANDOM_HALF_TURN;
|
||||
float angle = random_unit() * PI_ROUGH;
|
||||
angle += angle;
|
||||
float reach = random_unit() * BLOAT_LAND_CREEP_REACH;
|
||||
Vector spot = vector_make(std::cos(angle) * reach + npc.pos.x, std::sin(angle) * reach + npc.pos.y);
|
||||
@@ -368,7 +368,7 @@ static void peep_spray(Entity_NPC& npc, const ColorMod& bloodColor)
|
||||
const NullFrame* guide = npc.sprite.animState.GetNullFrame("BloodGuide");
|
||||
if (!guide || !guide->isVisible) continue;
|
||||
|
||||
float angle = random_unit() * RANDOM_HALF_TURN;
|
||||
float angle = random_unit() * PI_ROUGH;
|
||||
angle += angle;
|
||||
Vector fling = vector_make(std::cos(angle) * guide->scale.x * PEEP_GUIDE_REACH,
|
||||
std::sin(angle) * guide->scale.y * PEEP_GUIDE_REACH);
|
||||
@@ -424,7 +424,7 @@ static void peep_sheet_swap(Entity_NPC& npc, std::string_view suffix)
|
||||
static void peep_bleed(Entity_NPC& npc)
|
||||
{
|
||||
Entity_Effect* splat = npc.MakeSplat(random_unit() * PEEP_SPLAT_SIZE + PEEP_SPLAT_MIN);
|
||||
float angle = random_unit() * RANDOM_HALF_TURN;
|
||||
float angle = random_unit() * PI_ROUGH;
|
||||
angle += angle;
|
||||
float sine = std::sin(angle);
|
||||
float cosine = std::cos(angle);
|
||||
@@ -447,7 +447,7 @@ static void peep_bleed(Entity_NPC& npc)
|
||||
npc_sound_play(SOUND_PLOP, 1, 2, champion_pitch_get(npc));
|
||||
npc.i1++;
|
||||
uint32_t seed = Random();
|
||||
float turn = random_unit() * RANDOM_HALF_TURN;
|
||||
float turn = random_unit() * PI_ROUGH;
|
||||
turn += turn;
|
||||
Vector spot = vector_make(std::cos(turn) * PEEP_EYE_REACH + npc.pos.x,
|
||||
std::sin(turn) * PEEP_EYE_REACH + npc.pos.y);
|
||||
|
||||
@@ -71,7 +71,7 @@ static void pestilence_splat(Entity_NPC& npc)
|
||||
{
|
||||
float scale = random_unit() * PESTILENCE_SPLAT_SIZE + PESTILENCE_SPLAT_MIN;
|
||||
uint32_t seed = Random();
|
||||
float angle = random_unit() * RANDOM_HALF_TURN;
|
||||
float angle = random_unit() * PI_ROUGH;
|
||||
angle += angle;
|
||||
Vector spot = vector_make(std::cos(angle) * PESTILENCE_SPLAT_REACH + npc.pos.x,
|
||||
std::sin(angle) * PESTILENCE_SPLAT_REACH + npc.pos.y);
|
||||
|
||||
+2
-5
@@ -144,10 +144,7 @@ constexpr float PHASE_GIB_SPEED_RANGE = 4;
|
||||
constexpr float PHASE_GIB_LIFT = 0.5f;
|
||||
constexpr float PHASE_GIB_SPREAD = 0.5f;
|
||||
constexpr int DEATH_DUST_MIN = 3;
|
||||
constexpr float PIN_DEATH_DUST_SPEED = 5;
|
||||
constexpr float DEATH_DUST_SPREAD = 20;
|
||||
constexpr float DEATH_DUST_SPIN_MIN = 2;
|
||||
constexpr float DEATH_DUST_SPIN_RANGE = 10;
|
||||
constexpr int DEATH_DUST_LIFE_MIN = 15;
|
||||
constexpr int DEATH_DUST_LIFE_RANGE = 15;
|
||||
constexpr float DEATH_DUST_ALPHA_MIN = 0.2f;
|
||||
@@ -850,7 +847,7 @@ static void frail_death_dust(Entity_NPC& npc, const PinChain& chain)
|
||||
for (int i = 0; i < clouds; i++)
|
||||
{
|
||||
Vector heading = random_direction();
|
||||
Vector velocity = vector_scale(heading, random_unit() * PIN_DEATH_DUST_SPEED);
|
||||
Vector velocity = vector_scale(heading, random_unit() * DUST_SPEED);
|
||||
uint32_t seed = Random();
|
||||
Vector place = random_direction();
|
||||
Vector position = vector_add(npc.pos, vector_scale(place, random_unit() * DEATH_DUST_SPREAD));
|
||||
@@ -862,7 +859,7 @@ static void frail_death_dust(Entity_NPC& npc, const PinChain& chain)
|
||||
.seed = seed}));
|
||||
float side =
|
||||
(dust->pos.y - npc.pos.y) * -velocity.x + (dust->pos.x - npc.pos.x) * velocity.y < 0 ? -1.0f : 1.0f;
|
||||
dust->rotation = (random_unit() * DEATH_DUST_SPIN_RANGE + DEATH_DUST_SPIN_MIN) * side;
|
||||
dust->rotation = (random_between(DUST_SPIN_MIN, DUST_SPIN_RANGE)) * side;
|
||||
int life = (int)(Random() % DEATH_DUST_LIFE_RANGE) + DEATH_DUST_LIFE_MIN;
|
||||
dust->timeout = life;
|
||||
dust->lifespan = life;
|
||||
|
||||
@@ -451,7 +451,7 @@ static void pile_move_pick(Entity_NPC& npc)
|
||||
// A random spot about a center, a fraction of the Pile's reach away.
|
||||
static Vector pile_spot_roll(Vector center)
|
||||
{
|
||||
float angle = random_unit() * RANDOM_HALF_TURN;
|
||||
float angle = random_unit() * PI_ROUGH;
|
||||
angle += angle;
|
||||
float reach = (random_unit() * PILE_SPOT_REACH_SPREAD + PILE_SPOT_REACH_MIN) * PILE_SPOT_REACH;
|
||||
return vector_make(std::cos(angle) * reach + center.x, std::sin(angle) * reach + center.y);
|
||||
|
||||
+1
-2
@@ -38,7 +38,6 @@ constexpr int BOSS_REAP_CREEP = 74;
|
||||
constexpr std::array<int, 4> HORSEMEN = {BOSS_FAMINE, BOSS_PESTILENCE, BOSS_WAR, BOSS_DEATH};
|
||||
|
||||
// The bosses the dark bosses special daily fixes on stages 1 to 7 (none on stage 6).
|
||||
constexpr int SPECIAL_DAILY_DARK_BOSSES = 13;
|
||||
constexpr std::array<int, 8> SPECIAL_DAILY_BOSSES = {0, 60, 43, 50, 23, 51, 0, 15};
|
||||
|
||||
constexpr int ACHIEVEMENT_HARBINGERS = 5;
|
||||
@@ -249,7 +248,7 @@ int BossPool::GetBossId(int levelStage, int stageType)
|
||||
|
||||
if (game.challenge == CHALLENGE_APRILS_FOOL) return BOSS_THE_BLOAT;
|
||||
bool isDailyStage = levelStage >= 0 && levelStage < (int)SPECIAL_DAILY_BOSSES.size();
|
||||
if (game.dailyChallenge.specialDailyId == SPECIAL_DAILY_DARK_BOSSES && isDailyStage &&
|
||||
if (game.dailyChallenge.specialDailyId == SPECIAL_DAILY_HALLOWEEN && isDailyStage &&
|
||||
SPECIAL_DAILY_BOSSES[levelStage] != 0)
|
||||
return SPECIAL_DAILY_BOSSES[levelStage];
|
||||
if (int boss = chapter_end_boss(levelStage, stageType)) return boss;
|
||||
|
||||
@@ -653,7 +653,7 @@ static void mega_ball_trail(Entity_NPC& npc)
|
||||
.seed = Random()});
|
||||
smoke->SetColor(npc.sprite.GetLayer(0)->color, -1, COLOR_PRIORITY_DEFAULT, false, true);
|
||||
smoke->velocity = vector_scale(npc.velocity, BALL_TRAIL_BACK);
|
||||
float angle = random_unit() * RANDOM_HALF_TURN;
|
||||
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));
|
||||
|
||||
@@ -77,4 +77,27 @@ void chimera_head_update(Entity_NPC& npc);
|
||||
void boss_lil_blub_update(Entity_NPC& npc);
|
||||
void boss_bumbino_update(Entity_NPC& npc);
|
||||
void singe_ball_update(Entity_NPC& npc);
|
||||
|
||||
// A Scourge chain link's states (its tip's: flying, latched onto a wall, drawn back), and the chains' kinds (their
|
||||
// links' subtype): the trap's pair, the slice's pair and a single slicing chain.
|
||||
enum ScourgeLinkState
|
||||
{
|
||||
SCOURGE_LINK_FLYING = NPC_STATE_IDLE,
|
||||
SCOURGE_LINK_LATCHED = NPC_STATE_JUMP,
|
||||
SCOURGE_LINK_RETRACTING = NPC_STATE_STOMP
|
||||
};
|
||||
|
||||
enum ScourgeChainKind
|
||||
{
|
||||
SCOURGE_CHAIN_TRAP,
|
||||
SCOURGE_CHAIN_SLICE,
|
||||
SCOURGE_CHAIN_SLICE_ONE
|
||||
};
|
||||
|
||||
// The Scourge and its chain (boss_scourge.cpp).
|
||||
void boss_scourge_update(Entity_NPC& npc);
|
||||
void scourge_chain_update(Entity_NPC& npc);
|
||||
|
||||
// The Polty and the Kineti (npc_polty.cpp).
|
||||
void npc_polty_update(Entity_NPC& npc);
|
||||
void clutch_render(Entity_NPC& npc, const Vector& offset);
|
||||
+4
-4
@@ -440,7 +440,7 @@ static void face_shots_update(Entity_NPC& npc, int ticks)
|
||||
// A blood gib thrown from about the face, plain one in five, else rotten.
|
||||
static void face_gib_throw(Entity_NPC& npc)
|
||||
{
|
||||
float angle = random_unit() * RANDOM_HALF_TURN;
|
||||
float angle = random_unit() * PI_ROUGH;
|
||||
angle += angle;
|
||||
Vector direction = vector_make(std::cos(angle), std::sin(angle));
|
||||
float reach = random_unit();
|
||||
@@ -512,7 +512,7 @@ static void face_rubble_throw(Entity_NPC& npc)
|
||||
Vector velocity = vector_scale(spray, random_between(RUBBLE_SPLASH_SPEED, RUBBLE_SPLASH_SPEED_RANGE));
|
||||
float rise = std::clamp((float)npc.projectileDelay / FACE_RUBBLE_FRAMES, 0.0f, 1.0f);
|
||||
float lift = random_unit();
|
||||
float wobble = random_unit() * RANDOM_HALF_TURN;
|
||||
float wobble = random_unit() * PI_ROUGH;
|
||||
wobble += wobble;
|
||||
Vector offset = vector_make(std::cos(wobble) * RUBBLE_SPLASH_WOBBLE,
|
||||
RUBBLE_SPLASH_HEIGHT - rise * RUBBLE_SPLASH_RISE - lift * RUBBLE_SPLASH_RISE_RANGE +
|
||||
@@ -557,7 +557,7 @@ static void face_munch_spray(Entity_NPC& npc)
|
||||
{
|
||||
for (int i = 0; i < MUNCH_SPRAY_SHOTS; i++)
|
||||
{
|
||||
float angle = random_unit() * RANDOM_HALF_TURN;
|
||||
float angle = random_unit() * PI_ROUGH;
|
||||
angle += angle;
|
||||
Vector direction = vector_make(std::cos(angle), std::sin(angle));
|
||||
float speed = random_unit() * MUNCH_SPRAY_SPEED;
|
||||
@@ -1190,7 +1190,7 @@ static void rotgut_wall_break(Entity_Effect* timer)
|
||||
|
||||
for (int i = 0; i < ROTGUT_WALL_ROCKS; i++)
|
||||
{
|
||||
float angle = random_unit() * RANDOM_HALF_TURN;
|
||||
float angle = random_unit() * PI_ROUGH;
|
||||
angle += angle;
|
||||
float speed = random_unit();
|
||||
Vector velocity = vector_make(std::cos(angle) * speed * ROTGUT_WALL_ROCK_SPEED,
|
||||
|
||||
+1
-1
@@ -461,7 +461,7 @@ static void dying_update(Entity_NPC& npc)
|
||||
if (sprite.IsEventTriggered("Shoot2"))
|
||||
for (const Vector& spot : DEATH_BURSTS)
|
||||
{
|
||||
float angle = random_unit() * RANDOM_HALF_TURN * 2;
|
||||
float angle = random_unit() * PI_ROUGH * 2;
|
||||
uint32_t seed = Random();
|
||||
Vector position = vector_make(std::cos(angle) * DEATH_BURST_REACH + spot.x + npc.pos.x,
|
||||
std::sin(angle) * DEATH_BURST_REACH + spot.y + npc.pos.y);
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -188,7 +188,7 @@ static void sisters_init(Entity_NPC& npc)
|
||||
if (npc.spawnerType == npc.type) return;
|
||||
|
||||
uint32_t seed = Random();
|
||||
float angle = random_unit() * RANDOM_HALF_TURN;
|
||||
float angle = random_unit() * PI_ROUGH;
|
||||
angle += angle;
|
||||
Entity* sister = g_game->Spawn({.position = vector_make(std::cos(angle) * SISTERS_SPAWN_REACH + npc.pos.x,
|
||||
std::sin(angle) * SISTERS_SPAWN_REACH + npc.pos.y),
|
||||
|
||||
+2
-5
@@ -225,9 +225,6 @@ constexpr float VISAGE_FRONT_DEPTH = 1000;
|
||||
constexpr uint32_t DUST_EXTRA_MASK = 3;
|
||||
constexpr int VISAGE_DUST_MIN = 5;
|
||||
constexpr float VISAGE_DUST_SPREAD = 20;
|
||||
constexpr float VISAGE_DUST_SPEED = 5;
|
||||
constexpr float VISAGE_DUST_SPIN = 10;
|
||||
constexpr float VISAGE_DUST_SPIN_MIN = 2;
|
||||
constexpr float DUST_HEIGHT = -16;
|
||||
constexpr uint32_t VISAGE_DUST_TIMEOUT_RANGE = 10;
|
||||
constexpr int VISAGE_DUST_TIMEOUT = 30;
|
||||
@@ -396,14 +393,14 @@ static void visage_spawn_particles(const Vector& position, const Vector& directi
|
||||
uint32_t seed = Random();
|
||||
float back = random_unit();
|
||||
float sideways = random_unit() * 2 - 1;
|
||||
Vector velocity = vector_add(vector_scale(direction, back * VISAGE_DUST_SPEED), vector_scale(side, sideways));
|
||||
Vector velocity = vector_add(vector_scale(direction, back * DUST_SPEED), vector_scale(side, sideways));
|
||||
Vector at = random_direction();
|
||||
Vector spot = vector_add(position, vector_scale(at, random_unit() * VISAGE_DUST_SPREAD));
|
||||
auto* dust = static_cast<Entity_Effect*>(g_game->Spawn(
|
||||
{.position = spot, .velocity = velocity, .type = ENTITY_EFFECT, .variant = EFFECT_DUST_CLOUD, .seed = seed}));
|
||||
|
||||
bool isBehind = vector_dot(vector_sub(dust->pos, position), direction) < 0;
|
||||
dust->rotation = (random_unit() * VISAGE_DUST_SPIN + VISAGE_DUST_SPIN_MIN) * (float)isBehind == 0 ? 1.0f : -1.0f;
|
||||
dust->rotation = (random_between(DUST_SPIN_MIN, DUST_SPIN_RANGE) * (float)isBehind == 0) ? 1.0f : -1.0f;
|
||||
int timeout = (int)(Random() % VISAGE_DUST_TIMEOUT_RANGE) + VISAGE_DUST_TIMEOUT;
|
||||
dust->posOffset = vector_make(0, DUST_HEIGHT);
|
||||
dust->timeout = timeout;
|
||||
|
||||
+1
-1
@@ -166,7 +166,7 @@ static void widow_creep_spread(Entity_NPC& npc)
|
||||
const ColorMod& color = isBlack ? WIDOW_BLACK_CREEP_COLOR : WIDOW_CREEP_COLOR;
|
||||
for (int ticks = npc_ticks_get(npc); ticks > 0; ticks--)
|
||||
{
|
||||
float angle = random_unit() * RANDOM_HALF_TURN;
|
||||
float angle = random_unit() * PI_ROUGH;
|
||||
angle += angle;
|
||||
float reach = (float)npc.stateFrame * WIDOW_CREEP_SPREAD;
|
||||
Vector spot = vector_make(std::cos(angle) * reach + npc.pos.x, std::sin(angle) * reach + npc.pos.y);
|
||||
|
||||
@@ -121,10 +121,7 @@ constexpr int CROSS_PARTICLES_MIN = 6;
|
||||
constexpr int CROSS_PARTICLES_RANGE = 5;
|
||||
constexpr float CROSS_PARTICLE_SPEED = 8;
|
||||
constexpr int WORMWOOD_DUST_MIN = 3;
|
||||
constexpr float WORMWOOD_DUST_SPEED = 5;
|
||||
constexpr float DUST_SPREAD = 20;
|
||||
constexpr float WORMWOOD_DUST_SPIN_MIN = 2;
|
||||
constexpr float WORMWOOD_DUST_SPIN_RANGE = 10;
|
||||
constexpr int WORMWOOD_DUST_LIFE_MIN = 15;
|
||||
constexpr int DUST_LIFE_RANGE = 15;
|
||||
|
||||
@@ -501,7 +498,7 @@ static void dust_spawn(const DustBurst& burst, uint32_t seed, Vector place)
|
||||
.variant = EFFECT_DUST_CLOUD,
|
||||
.seed = seed}));
|
||||
float spin = vector_dot(vector_sub(dust->pos, burst.origin), burst.side) < 0 ? -1.0f : 1.0f;
|
||||
dust->rotation = (random_unit() * WORMWOOD_DUST_SPIN_RANGE + WORMWOOD_DUST_SPIN_MIN) * spin;
|
||||
dust->rotation = (random_between(DUST_SPIN_MIN, DUST_SPIN_RANGE)) * spin;
|
||||
int life = (int)(Random() % DUST_LIFE_RANGE) + WORMWOOD_DUST_LIFE_MIN;
|
||||
dust->timeout = life;
|
||||
dust->lifespan = life;
|
||||
@@ -537,8 +534,8 @@ static void crossing_start(Entity_NPC& npc)
|
||||
for (int i = 0; i < clouds; i++)
|
||||
{
|
||||
uint32_t seed = Random();
|
||||
float forward = random_unit() * WORMWOOD_DUST_SPEED;
|
||||
float across = random_unit() * WORMWOOD_DUST_SPEED - WORMWOOD_DUST_SPEED / 2;
|
||||
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));
|
||||
dust_spawn({.origin = npc.pos, .side = vector_make(0, -out), .velocity = velocity}, seed, place);
|
||||
@@ -582,8 +579,8 @@ static void crossing_burst(Entity_NPC& npc)
|
||||
int clouds = (int)(Random() % 3) + WORMWOOD_DUST_MIN;
|
||||
for (int i = 0; i < clouds; i++)
|
||||
{
|
||||
float across = random_unit() * WORMWOOD_DUST_SPEED - WORMWOOD_DUST_SPEED / 2;
|
||||
float forward = random_unit() * WORMWOOD_DUST_SPEED;
|
||||
float across = random_unit() * DUST_SPEED - DUST_SPEED / 2;
|
||||
float forward = random_unit() * DUST_SPEED;
|
||||
Vector velocity = vector_make(i != 0 ? -forward : forward, across);
|
||||
uint32_t seed = Random();
|
||||
Vector heading = random_direction();
|
||||
|
||||
+1
-3
@@ -47,7 +47,6 @@ constexpr float SHAKE_PEAK = 0.9f;
|
||||
constexpr int SHAKE_KICK_FRAMES = 3;
|
||||
constexpr float SHAKE_KICK = 10;
|
||||
constexpr float SHAKE_FADE_FRAMES = 11;
|
||||
constexpr float SHAKE_PI = 3.14f;
|
||||
|
||||
// A door pulls the camera toward it from this close, fully from DOOR_PULL_FULL.
|
||||
constexpr float DOOR_PULL_RANGE = 30;
|
||||
@@ -66,7 +65,6 @@ constexpr float NET_VIEW_HALF_WIDTH = 369.23077f;
|
||||
constexpr float NET_VIEW_HALF_HEIGHT = 207.6923f;
|
||||
|
||||
constexpr int ITEM_STATE_LUDOVICO_CHARGE = 49;
|
||||
constexpr int COLLECTIBLE_LUDOVICO_TECHNIQUE = 329;
|
||||
|
||||
// 00945130 Adds a vector, dropping the oldest when full.
|
||||
void VectorRing::push(Vector vector)
|
||||
@@ -396,7 +394,7 @@ void Camera::shake_update()
|
||||
if (g_game->screenShakeTimer < 1) shakeOffsets.push(vector_make(0, 0));
|
||||
else
|
||||
{
|
||||
float angle = random_unit() * SHAKE_PI;
|
||||
float angle = random_unit() * PI_ROUGH;
|
||||
angle += angle;
|
||||
|
||||
if (g_game->frameCount % SHAKE_KICK_FRAMES == 0)
|
||||
|
||||
+16
-3
@@ -2,6 +2,7 @@
|
||||
#include "data.h"
|
||||
#include "game.h"
|
||||
#include "log.h"
|
||||
#include "lua_engine.h"
|
||||
#include "music_manager.h"
|
||||
#include "nightmare_scene.h"
|
||||
#include "persistent_game_data.h"
|
||||
@@ -621,6 +622,15 @@ static void part_start(CutscenePart& part)
|
||||
part.isLetterbox ? SCREEN_FIT_FILL : SCREEN_FIT_INSIDE);
|
||||
}
|
||||
|
||||
// Whether a skip action was pressed this frame: a mod's answer through MC_INPUT_ACTION during a run, else any device's.
|
||||
static bool skip_action_get(ButtonAction action)
|
||||
{
|
||||
std::optional<bool> isModTriggered;
|
||||
if (g_manager->state == MANAGER_STATE_GAME && g_luaEngine)
|
||||
isModTriggered = lua_engine_get().InputAction(nullptr, INPUT_HOOK_TRIGGERED, action);
|
||||
return isModTriggered ? *isModTriggered : is_action(action, ACTION_TRIGGERED);
|
||||
}
|
||||
|
||||
// 0095df20 Plays the cutscene on: once the skip delay passed, menu confirm or back skips it. Runs the current part
|
||||
// and starts the next when it finishes. When the parts ran out or a skip faded out, unloads it and gives the screen
|
||||
// back to the window. (Labelled Manager::update_state_loading, it works on the cutscene player.)
|
||||
@@ -634,9 +644,12 @@ void Cutscene::Update()
|
||||
|
||||
if (entry.currentPart >= 0 && entry.currentPart < partCount)
|
||||
isSkipAllowed = time_ms() - entry.parts[entry.currentPart]->startTime >= (uint64_t)(uint32_t)skipDelay;
|
||||
if (isSkipAllowed &&
|
||||
(is_action(ACTION_MENU_CONFIRM, ACTION_TRIGGERED) || is_action(ACTION_MENU_BACK, ACTION_TRIGGERED)))
|
||||
entry.isSkipped = true;
|
||||
if (isSkipAllowed)
|
||||
{
|
||||
bool isConfirm = skip_action_get(ACTION_MENU_CONFIRM);
|
||||
bool isBack = skip_action_get(ACTION_MENU_BACK);
|
||||
if (isConfirm || isBack) entry.isSkipped = true;
|
||||
}
|
||||
|
||||
if (entry.isSkipped || (entry.isFadeOut && entry.currentPart >= partCount) || entry.isSkipVoted)
|
||||
entry.fadeProgress += CUTSCENE_FADE_STEP;
|
||||
|
||||
+88
-4
@@ -3,6 +3,7 @@
|
||||
#include "game.h"
|
||||
#include "level.h"
|
||||
#include "log.h"
|
||||
#include "manager.h"
|
||||
#include "platform.h"
|
||||
#include "room.h"
|
||||
#include "seeds.h"
|
||||
@@ -11,10 +12,6 @@
|
||||
#include <chrono>
|
||||
|
||||
constexpr uint32_t DAILY_SHIFT_INDEX = 64;
|
||||
constexpr uint32_t SPECIAL_DAILY_GROUNDHOG = 2;
|
||||
constexpr uint32_t SPECIAL_DAILY_EASTER = 6;
|
||||
constexpr uint32_t SPECIAL_DAILY_THANKSGIVING = 16;
|
||||
constexpr uint32_t SPECIAL_DAILY_G_FUEL = 52;
|
||||
constexpr const char* G_FUEL_SEED = "XRA8 J6GH";
|
||||
constexpr int NOVEMBER = 11;
|
||||
constexpr int EASTER_LAST_YEAR = 3100;
|
||||
@@ -93,6 +90,34 @@ constexpr std::array<SpecialDailyRules, 51> SPECIAL_DAILY_RULES = {{
|
||||
{SPECIAL_DAILY_G_FUEL, 0, 11, 1, 0, 0},
|
||||
}};
|
||||
|
||||
// The collectibles a special daily starts its player with, after or instead of the character's own.
|
||||
struct SpecialDailyItems
|
||||
{
|
||||
uint32_t id = 0;
|
||||
std::array<int, 6> collectibles{};
|
||||
bool isReplacing = false;
|
||||
};
|
||||
constexpr std::array<SpecialDailyItems, 43> SPECIAL_DAILY_ITEMS = {{
|
||||
{3, {382, 200, 63}}, {6, {138, 7, 83}}, {8, {31, 41, 55}}, {9, {163, 67, 8, 268, 265, 247}},
|
||||
{10, {175, 170, 116}}, {11, {191, 418, 174}}, {12, {52, 366, 330, 583}}, {13, {424}}, {14, {81}, true},
|
||||
{16, {48}}, {17, {132, 173}}, {18, {93}}, {19, {132, 74}}, {20, {145, 134, 212}},
|
||||
{22, {378, 6, 209, 291}}, {23, {150, 446, 86}}, {24, {330, 436}}, {25, {372, 116, 63, 356, 139}},
|
||||
{26, {413, 390, 499}}, {27, {104, 397, 457}}, {29, {67, 8, 163, 99, 100, 322}}, {30, {273, 316, 371, 81, 129}},
|
||||
{31, {180, 447, 484, 116}}, {32, {68, 579}}, {33, {282, 314}}, {34, {424, 166}}, {35, {210, 36, 376}},
|
||||
{36, {18}}, {37, {127}}, {38, {480, 151, 268}}, {39, {245, 123, 95}},
|
||||
{40, {118, 38, 221, 313, 3}}, {42, {182, 179, 374}}, {43, {232, 337}}, {45, {314, 129}}, {46, {52, 366}},
|
||||
{47, {402}}, {48, {156, 286, 74, 75}}, {49, {316, 371, 366, 273}}, {50, {286, 75, 156}},
|
||||
{51, {249, 414}}, {SPECIAL_DAILY_G_FUEL, {}, true},
|
||||
}};
|
||||
|
||||
// The bombs, luck and keys some special dailies start with, and St Patrick's green tint.
|
||||
constexpr int NEW_YEAR_BOMBS = 99;
|
||||
constexpr int VALENTINES_LUCK = 7;
|
||||
constexpr int ST_PATRICKS_LUCK_PILLS = 18;
|
||||
constexpr ColorMod ST_PATRICKS_TINT = {{1, 1, 1, 1}, {0, 1, 0, 0.6f}, {0, 0, 0}};
|
||||
constexpr int ST_PATRICKS_TINT_PRIORITY = 255;
|
||||
constexpr int CHRISTMAS_KEYS = 1;
|
||||
|
||||
// A YYYYMMDD date as a calendar date, normalized as mktime would.
|
||||
static std::chrono::sys_days date_days_get(uint32_t date)
|
||||
{
|
||||
@@ -291,3 +316,62 @@ void DailyChallenge::Init(uint32_t dailyDate)
|
||||
seed = rng.Next();
|
||||
special_daily_apply(*this);
|
||||
}
|
||||
|
||||
// Part of Entity_Player::InitPostLevelInitStats: what a special daily starts a player with besides its trinket and
|
||||
// card. New Year's bombs, Valentine's luck, St Patrick's lucky pills tinting the player green, December 6th's costume,
|
||||
// Christmas's key, and every listed special daily's collectibles, replacing the character's own for some.
|
||||
void special_daily_start_apply(Entity_Player& player, std::vector<int>& items)
|
||||
{
|
||||
uint32_t specialDailyId = g_game->dailyChallenge.specialDailyId;
|
||||
|
||||
switch (specialDailyId)
|
||||
{
|
||||
case SPECIAL_DAILY_NEW_YEAR: player.AddBombs(NEW_YEAR_BOMBS); break;
|
||||
case SPECIAL_DAILY_VALENTINES: player.luckModifier += VALENTINES_LUCK; break;
|
||||
case SPECIAL_DAILY_ST_PATRICKS:
|
||||
player.pillEffectUses[PILLEFFECT_LUCK_UP] += ST_PATRICKS_LUCK_PILLS;
|
||||
player.cacheFlags |= CACHE_LUCK;
|
||||
player.colorOverride = ST_PATRICKS_TINT;
|
||||
player.SetColor(ST_PATRICKS_TINT, 1, ST_PATRICKS_TINT_PRIORITY, false, true);
|
||||
break;
|
||||
case SPECIAL_DAILY_DECEMBER_6:
|
||||
player.AddCostume(g_manager->itemConfig.GetNullItem(NULLITEM_IWATA), false);
|
||||
break;
|
||||
case SPECIAL_DAILY_CHRISTMAS: player.AddKeys(CHRISTMAS_KEYS); break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
auto start = std::ranges::find(SPECIAL_DAILY_ITEMS, specialDailyId, &SpecialDailyItems::id);
|
||||
if (start == SPECIAL_DAILY_ITEMS.end()) return;
|
||||
if (start->isReplacing) items.clear();
|
||||
for (int id : start->collectibles)
|
||||
if (id != 0) items.push_back(id);
|
||||
}
|
||||
|
||||
// Part of Entity_Player::InitPostLevelInitStats: the trinket a special daily starts with in place of the one picked,
|
||||
// for a character without its own.
|
||||
int special_daily_trinket_get(int trinket)
|
||||
{
|
||||
switch (g_game->dailyChallenge.specialDailyId)
|
||||
{
|
||||
case SPECIAL_DAILY_MARCH_2: return TRINKET_LEFT_HAND;
|
||||
case SPECIAL_DAILY_DECEMBER_6: return TRINKET_CARTRIDGE;
|
||||
case SPECIAL_DAILY_FEBRUARY_18: return TRINKET_AAA_BATTERY;
|
||||
case SPECIAL_DAILY_APRIL_15:
|
||||
case SPECIAL_DAILY_NOVEMBER_19: return TRINKET_TICK;
|
||||
default: return trinket;
|
||||
}
|
||||
}
|
||||
|
||||
// Part of Entity_Player::InitPostLevelInitStats: the card a special daily starts with, for a character without its
|
||||
// own, or 0.
|
||||
int special_daily_card_get()
|
||||
{
|
||||
switch (g_game->dailyChallenge.specialDailyId)
|
||||
{
|
||||
case SPECIAL_DAILY_JULY_13: return CARD_DICE_SHARD;
|
||||
case SPECIAL_DAILY_NOVEMBER_13: return CARD_JUDGEMENT;
|
||||
case SPECIAL_DAILY_DECEMBER_23: return CARD_STRENGTH;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
@@ -2,11 +2,49 @@
|
||||
|
||||
#include "challenge_params.h"
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
struct Entity_Player;
|
||||
|
||||
// A YYYYMMDD date's factors: the year's, then the month's and the day's part.
|
||||
constexpr uint32_t DATE_YEAR = 10000;
|
||||
constexpr uint32_t DATE_PART = 100;
|
||||
|
||||
// The special dailies the code tells apart, by the holiday or date they fall on.
|
||||
enum SpecialDaily : uint32_t
|
||||
{
|
||||
SPECIAL_DAILY_NONE,
|
||||
SPECIAL_DAILY_NEW_YEAR = 1,
|
||||
SPECIAL_DAILY_GROUNDHOG = 2,
|
||||
SPECIAL_DAILY_VALENTINES = 3,
|
||||
SPECIAL_DAILY_MARCH_2 = 4,
|
||||
SPECIAL_DAILY_ST_PATRICKS = 5,
|
||||
SPECIAL_DAILY_EASTER = 6,
|
||||
SPECIAL_DAILY_APRIL_FOOLS = 7,
|
||||
SPECIAL_DAILY_JULY_4 = 12,
|
||||
SPECIAL_DAILY_HALLOWEEN = 13,
|
||||
SPECIAL_DAILY_THANKSGIVING = 16,
|
||||
SPECIAL_DAILY_DECEMBER_5 = 17,
|
||||
SPECIAL_DAILY_DECEMBER_6 = 18,
|
||||
SPECIAL_DAILY_CHRISTMAS = 19,
|
||||
SPECIAL_DAILY_FEBRUARY_9 = 23,
|
||||
SPECIAL_DAILY_FEBRUARY_18 = 25,
|
||||
SPECIAL_DAILY_MARCH_22 = 28,
|
||||
SPECIAL_DAILY_APRIL_15 = 30,
|
||||
SPECIAL_DAILY_MAY_13 = 33,
|
||||
SPECIAL_DAILY_JULY_2 = 37,
|
||||
SPECIAL_DAILY_JULY_13 = 39,
|
||||
SPECIAL_DAILY_AUGUST_16 = 41,
|
||||
SPECIAL_DAILY_SEPTEMBER_5 = 43,
|
||||
SPECIAL_DAILY_SEPTEMBER_17 = 44,
|
||||
SPECIAL_DAILY_SEPTEMBER_22 = 45,
|
||||
SPECIAL_DAILY_OCTOBER_6 = 46,
|
||||
SPECIAL_DAILY_NOVEMBER_13 = 48,
|
||||
SPECIAL_DAILY_NOVEMBER_19 = 49,
|
||||
SPECIAL_DAILY_DECEMBER_23 = 50,
|
||||
SPECIAL_DAILY_G_FUEL = 52
|
||||
};
|
||||
|
||||
// A day's daily run (DailyChallenge): its date (0 when no daily is played), seed, the special daily the date falls on
|
||||
// and the rules drawn for it, and whether it is only practiced.
|
||||
struct DailyChallenge
|
||||
@@ -21,3 +59,6 @@ struct DailyChallenge
|
||||
};
|
||||
|
||||
uint32_t holiday_get_current(uint32_t date);
|
||||
void special_daily_start_apply(Entity_Player& player, std::vector<int>& items);
|
||||
int special_daily_trinket_get(int trinket);
|
||||
int special_daily_card_get();
|
||||
+1006
-16
File diff suppressed because it is too large.
Load diff
+197
-3
@@ -1,12 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#include "classes.h"
|
||||
#include <cstdint>
|
||||
#include <initializer_list>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
|
||||
namespace KAGE::Graphics
|
||||
{
|
||||
class ImageBase;
|
||||
}
|
||||
struct GameState;
|
||||
|
||||
// Where a versus match stands. From the intro on, the players fight each other.
|
||||
enum DeathmatchState : int
|
||||
{
|
||||
DEATHMATCH_OFF = 0,
|
||||
DEATHMATCH_FADE_OUT = 1,
|
||||
DEATHMATCH_INTRO = 2,
|
||||
DEATHMATCH_COUNTDOWN = 3,
|
||||
DEATHMATCH_FIGHT = 4,
|
||||
@@ -30,13 +41,194 @@ enum DeathmatchRules : int
|
||||
DEATHMATCH_VENOM
|
||||
};
|
||||
|
||||
// The versus mode of online co-op (g_game->deathmatchManager): the match's state and timer, and the rules it is played
|
||||
// with. Offline no match ever starts, but a run still draws its rules.
|
||||
// The rules are classes.h's DeathmatchType classes until those are taken over.
|
||||
// A versus match's clock: a minute and a half, then sudden death.
|
||||
constexpr int DEATHMATCH_MATCH_FRAMES = 2700;
|
||||
// The heart containers a versus player starts with, in the match's eighths of a heart.
|
||||
constexpr int DEATHMATCH_MAX_HEARTS = 80;
|
||||
// Normal drops a collectible every six seconds.
|
||||
constexpr int DEATHMATCH_NORMAL_SPAWN_FRAMES = 180;
|
||||
|
||||
// The hearts a collectible gives when taken.
|
||||
struct HeartGain
|
||||
{
|
||||
int hearts = 0;
|
||||
int maxHearts = 0;
|
||||
int soulHearts = 0;
|
||||
};
|
||||
|
||||
// The rules of a versus match (Rebirth's DeathmatchTypeBase): the clock and its sudden death of fly bombs and spikes,
|
||||
// the pickups and collectibles it drops, what it bans, and the hooks the player code asks. Each kind of match
|
||||
// (DeathmatchType*) overrides a few.
|
||||
// Destruction (0042a430, 0042d0f0, 0042d780) is the default.
|
||||
// The original has two more slots that do nothing in every type.
|
||||
// The arena's spawn points come twice: for the joining players and for Pandora's Box's collectibles.
|
||||
class DeathmatchTypeBase
|
||||
{
|
||||
public:
|
||||
std::list<Vector> itemSpawnPoints;
|
||||
std::list<Vector> spawnPoints;
|
||||
std::map<int, bool> collectiblePool;
|
||||
float timerAlpha = 0;
|
||||
int pickupTimer = 0;
|
||||
int timer = 0;
|
||||
bool isPickupSpawning = false;
|
||||
|
||||
virtual ~DeathmatchTypeBase() = default;
|
||||
virtual DeathmatchRules rules() = 0;
|
||||
virtual bool Init();
|
||||
virtual void Update();
|
||||
void timer_render();
|
||||
bool is_over();
|
||||
uint64_t winner_get();
|
||||
bool is_card_banned(int card);
|
||||
bool is_pill_banned(int pillEffect);
|
||||
bool is_trinket_banned(int trinket);
|
||||
bool is_collectible_banned(int collectible);
|
||||
virtual int arena_shape_get();
|
||||
Entity* collectible_spawn(Vector position, float radius);
|
||||
void collectible_spawn_random();
|
||||
void item_hearts_adjust(int collectible, HeartGain& gain);
|
||||
void entity_damage_adjust(Entity& entity);
|
||||
virtual bool can_shoot(Entity_Player& player);
|
||||
virtual float base_damage_scale();
|
||||
virtual bool is_trinket_swap_allowed();
|
||||
bool is_bouncy(Entity_Player& player);
|
||||
virtual void player_update(Entity_Player& player);
|
||||
virtual void player_render(Entity_Player& player);
|
||||
virtual void player_ghost_morph(Entity_Player& player);
|
||||
virtual void speed_evaluate(Entity_Player& player, float& speed);
|
||||
virtual void damage_evaluate(Entity_Player& player, float& damage);
|
||||
virtual void fire_delay_evaluate(Entity_Player& player, float& fireDelay);
|
||||
void StoreGameState(GameState& state);
|
||||
void RestoreGameState(const GameState& state);
|
||||
virtual void player_init(Entity_Player& player, uint64_t userId);
|
||||
int player_type_get(uint64_t userId);
|
||||
Entity* pickup_spawn_random();
|
||||
int collectible_take(bool isNoneAllowed);
|
||||
void pickup_replace_banned(int type, int variant, int& subType);
|
||||
static int weighted_pick(std::initializer_list<uint32_t> weights);
|
||||
};
|
||||
|
||||
// Normal: a collectible per player at the start and one every six seconds, and pickups now and then.
|
||||
class DeathmatchTypeNormal : public DeathmatchTypeBase
|
||||
{
|
||||
public:
|
||||
int spawnTimer = DEATHMATCH_NORMAL_SPAWN_FRAMES;
|
||||
|
||||
DeathmatchRules rules() override;
|
||||
bool Init() override;
|
||||
void Update() override;
|
||||
};
|
||||
|
||||
// Ipecac: everyone shoots Ipecac, and the dead float off the walls with stronger, faster shots.
|
||||
class DeathmatchTypeIpecac : public DeathmatchTypeBase
|
||||
{
|
||||
public:
|
||||
DeathmatchRules rules() override;
|
||||
void player_update(Entity_Player& player) override;
|
||||
void player_ghost_morph(Entity_Player& player) override;
|
||||
void speed_evaluate(Entity_Player& player, float& speed) override;
|
||||
void damage_evaluate(Entity_Player& player, float& damage) override;
|
||||
void fire_delay_evaluate(Entity_Player& player, float& fireDelay) override;
|
||||
void player_init(Entity_Player& player, uint64_t userId) override;
|
||||
};
|
||||
|
||||
// Bomberman: Bomber Boy with 99 golden bombs (Tainted ???'s flies instead) in its own arenas, and only the dead shoot.
|
||||
class DeathmatchTypeBomberman : public DeathmatchTypeBase
|
||||
{
|
||||
public:
|
||||
DeathmatchRules rules() override;
|
||||
int arena_shape_get() override;
|
||||
bool can_shoot(Entity_Player& player) override;
|
||||
void player_init(Entity_Player& player, uint64_t userId) override;
|
||||
};
|
||||
|
||||
// Ludovico: the Ludovico Technique with an arrow to the local player's tear when it leaves the screen.
|
||||
class DeathmatchTypeLudovico : public DeathmatchTypeBase
|
||||
{
|
||||
public:
|
||||
std::shared_ptr<KAGE::Graphics::ImageBase> arrowImage;
|
||||
|
||||
DeathmatchTypeLudovico();
|
||||
DeathmatchRules rules() override;
|
||||
bool is_trinket_swap_allowed() override;
|
||||
void player_render(Entity_Player& player) override;
|
||||
void player_init(Entity_Player& player, uint64_t userId) override;
|
||||
};
|
||||
|
||||
// Sumo: Jelly Belly bounces, and only the dead shoot.
|
||||
class DeathmatchTypeSumo : public DeathmatchTypeBase
|
||||
{
|
||||
public:
|
||||
DeathmatchRules rules() override;
|
||||
bool can_shoot(Entity_Player& player) override;
|
||||
void player_init(Entity_Player& player, uint64_t userId) override;
|
||||
};
|
||||
|
||||
// Knockout: Knockout Drops and luck, at half the base damage.
|
||||
class DeathmatchTypeKnockout : public DeathmatchTypeBase
|
||||
{
|
||||
public:
|
||||
DeathmatchRules rules() override;
|
||||
float base_damage_scale() override;
|
||||
void player_init(Entity_Player& player, uint64_t userId) override;
|
||||
};
|
||||
|
||||
// Sword fight: Spirit Sword and Mom's Knife's swing.
|
||||
class DeathmatchTypeSwordFight : public DeathmatchTypeBase
|
||||
{
|
||||
public:
|
||||
DeathmatchRules rules() override;
|
||||
void player_init(Entity_Player& player, uint64_t userId) override;
|
||||
};
|
||||
|
||||
// Machine gun: a stack of tears ups at nearly seven times the base damage.
|
||||
class DeathmatchTypeMachineGun : public DeathmatchTypeBase
|
||||
{
|
||||
public:
|
||||
DeathmatchRules rules() override;
|
||||
float base_damage_scale() override;
|
||||
void player_init(Entity_Player& player, uint64_t userId) override;
|
||||
};
|
||||
|
||||
// Indigestion: bomb items that keep their trinkets.
|
||||
class DeathmatchTypeIndigestion : public DeathmatchTypeBase
|
||||
{
|
||||
public:
|
||||
DeathmatchRules rules() override;
|
||||
bool is_trinket_swap_allowed() override;
|
||||
void player_init(Entity_Player& player, uint64_t userId) override;
|
||||
};
|
||||
|
||||
// Knife fight: Mom's Knife.
|
||||
class DeathmatchTypeKnifeFight : public DeathmatchTypeBase
|
||||
{
|
||||
public:
|
||||
DeathmatchRules rules() override;
|
||||
void player_init(Entity_Player& player, uint64_t userId) override;
|
||||
};
|
||||
|
||||
// Venom: poison items, and the dead leave green creep.
|
||||
class DeathmatchTypeVenom : public DeathmatchTypeBase
|
||||
{
|
||||
public:
|
||||
DeathmatchRules rules() override;
|
||||
bool is_trinket_swap_allowed() override;
|
||||
void player_update(Entity_Player& player) override;
|
||||
void player_init(Entity_Player& player, uint64_t userId) override;
|
||||
};
|
||||
|
||||
void camo_undies_confuse(Entity_Player& player);
|
||||
uint64_t versus_time_get();
|
||||
bool versus_cooldown_is_over(uint64_t stampMs, uint64_t cooldownMs);
|
||||
|
||||
// The versus mode of online co-op (g_game->deathmatchManager): the match's state and timer, where its winner stands,
|
||||
// and the rules it is played with. Offline no match ever starts, but a run still draws its rules.
|
||||
class DeathmatchManager
|
||||
{
|
||||
public:
|
||||
std::unique_ptr<DeathmatchTypeBase> type;
|
||||
Vector winnerPosition{};
|
||||
DeathmatchState state = DEATHMATCH_OFF;
|
||||
int timer = 0;
|
||||
bool isSilentEntry = false;
|
||||
@@ -44,6 +236,8 @@ public:
|
||||
bool is_active();
|
||||
bool is_fighting();
|
||||
void enter_arena();
|
||||
void state_set(DeathmatchState newState);
|
||||
void Update();
|
||||
void set_type(DeathmatchRules rules);
|
||||
void Reset();
|
||||
};
|
||||
+104
-13
@@ -6,6 +6,8 @@
|
||||
#include "entity_npc.h"
|
||||
#include "entity_player.h"
|
||||
#include "entity_tear.h"
|
||||
#include "render_passes.h"
|
||||
#include "entity_text.h"
|
||||
#include "fx_layers.h"
|
||||
#include "game.h"
|
||||
#include "log.h"
|
||||
@@ -17,6 +19,7 @@
|
||||
#include <cmath>
|
||||
#include <cstdarg>
|
||||
#include <cstdio>
|
||||
#include <format>
|
||||
|
||||
// classes.h declares the original's Lua imports, and its luaL_newstate differs from Lua's only in its return type.
|
||||
#define luaL_newstate lua_newstate_auxiliary
|
||||
@@ -29,6 +32,19 @@ extern "C"
|
||||
|
||||
// GetRenderZ's bands: the background layer, the door layer and the normal layer sorted by depth.
|
||||
constexpr int RENDER_INDEX_MASK = 0x3ff;
|
||||
constexpr int DEBUG_TEXT_PRIORITY = 255;
|
||||
// The debug overlays' colors: a position (orange for an effect), and by grid collision class and collision class.
|
||||
constexpr uint32_t DEBUG_POSITION_ARGB = 0xffff0000;
|
||||
constexpr uint32_t DEBUG_EFFECT_POSITION_ARGB = 0xffffa500;
|
||||
constexpr std::array<uint32_t, 8> DEBUG_GRID_COLLISION_ARGB = {0xff000000, 0xff8b0000, 0xff006400, 0xffffff00,
|
||||
0xffffa500, 0xffff0000, 0xff00ffff, 0xffff00ff};
|
||||
constexpr std::array<uint32_t, 5> DEBUG_HITSPHERE_ARGB = {0xff000000, 0xffffa500, 0xffffc0cb, 0xff00ff00, 0xffff0000};
|
||||
// A position's cross half a side, and a hitsphere drawn in segments about 10 long, from 4 to 24 to its half circle.
|
||||
constexpr float DEBUG_CROSS_HALF = 2;
|
||||
constexpr float DEBUG_SEGMENT_LENGTH = 10;
|
||||
constexpr float DEBUG_SEGMENTS_MIN = 2;
|
||||
constexpr float DEBUG_SEGMENTS_MAX = 12;
|
||||
constexpr size_t DEBUG_TEXT_LENGTH = 255;
|
||||
constexpr int RENDER_Z_BACKGROUND_BASE = 100;
|
||||
constexpr int RENDER_Z_BACKGROUND_MAX = 4999;
|
||||
constexpr int RENDER_Z_DOOR_BASE = 5100;
|
||||
@@ -990,7 +1006,7 @@ void Entity::damage_events_update()
|
||||
{
|
||||
if (event.damage <= 0) continue;
|
||||
if (g_game->debugFlags & DEBUG_DAMAGE_VALUES)
|
||||
reconstruction_missing("Entity::Update 006ae820: the debug damage numbers (spawn_debug_damage_text)");
|
||||
debug_damage_text_spawn(pos, DEBUG_DAMAGE_DEALT_ARGB, std::format("dmg {:.2f}", event.damage));
|
||||
|
||||
bool isHiss = (event.damageFlags & (DAMAGE_FIRE | DAMAGE_POOP)) && !(event.damageFlags & DAMAGE_EXPLOSION);
|
||||
if (isHiss)
|
||||
@@ -1102,15 +1118,77 @@ void Entity::Render(const Vector& offset)
|
||||
sprite.Render(SpriteDraw{renderPosition, {}, {}});
|
||||
}
|
||||
|
||||
// 006b1260 Draws the debug overlays the console turns on.
|
||||
// 006b1260 Draws the debug overlays the console turns on: its position as a small cross (debug 1), the points it
|
||||
// checks against the grid colored by its grid collision class (debug 13), and its hitsphere colored by its collision
|
||||
// class (debug 6), a circle or, stretched by its size multiplier, a capsule along its longer axis.
|
||||
void Entity::PostRender()
|
||||
{
|
||||
uint32_t debugFlags = g_game->debugFlags;
|
||||
bool isPositionShown = (debugFlags & DEBUG_ENTITY_POSITIONS) && type != ENTITY_LASER;
|
||||
bool isGridShown = (debugFlags & DEBUG_GRID_COLLISION) && entityGridCollisionClass != GRIDCOLL_NONE;
|
||||
bool isHitsphereShown = (debugFlags & DEBUG_HITSPHERES) && size > 0 && entityCollisionClass != ENTCOLL_NONE;
|
||||
if (isPositionShown || isGridShown || isHitsphereShown)
|
||||
reconstruction_missing("Entity::PostRender 006b1260: the debug overlays");
|
||||
Game& game = *g_game;
|
||||
Vector screen = vector_add(render_position_get(pos, RENDER_SNAPPED), game.room->renderScrollOffset);
|
||||
auto point = [&](Vector offset) { return vector_add(screen, vector_scale(offset, ROOM_SCREEN_SCALE)); };
|
||||
auto line = [](Vector from, Vector to, KColor color) { render_color_quad(from, to, color, color, 1); };
|
||||
|
||||
if ((game.debugFlags & DEBUG_ENTITY_POSITIONS) && type != ENTITY_LASER)
|
||||
{
|
||||
KColor color = kcolor_argb(type == ENTITY_EFFECT ? DEBUG_EFFECT_POSITION_ARGB : DEBUG_POSITION_ARGB);
|
||||
Vector across = vector_make(DEBUG_CROSS_HALF, 0);
|
||||
Vector down = vector_make(0, DEBUG_CROSS_HALF);
|
||||
line(vector_sub(screen, across), vector_add(screen, across), color);
|
||||
line(vector_sub(screen, down), vector_add(screen, down), color);
|
||||
}
|
||||
if ((game.debugFlags & DEBUG_GRID_COLLISION) && entityGridCollisionClass != GRIDCOLL_NONE)
|
||||
{
|
||||
uint32_t gridClass = entityGridCollisionClass;
|
||||
if (gridClass >= DEBUG_GRID_COLLISION_ARGB.size()) gridClass = 0;
|
||||
KColor color = kcolor_argb(DEBUG_GRID_COLLISION_ARGB[gridClass]);
|
||||
for (Vector offset : collisionPoints)
|
||||
render_color_shader_pass(KAGE::Graphics::color_quad_rect(point(offset), vector_make(1, 1), color));
|
||||
}
|
||||
if (!(game.debugFlags & DEBUG_HITSPHERES) || size <= 0 || entityCollisionClass == ENTCOLL_NONE) return;
|
||||
|
||||
uint32_t collisionClass = entityCollisionClass;
|
||||
if (collisionClass >= DEBUG_HITSPHERE_ARGB.size()) collisionClass = 0;
|
||||
KColor color = kcolor_argb(DEBUG_HITSPHERE_ARGB[collisionClass]);
|
||||
int halfSegments = (int)std::clamp(size * TAU / DEBUG_SEGMENT_LENGTH, DEBUG_SEGMENTS_MIN, DEBUG_SEGMENTS_MAX) * 2;
|
||||
auto angleGet = [&](int segment) { return (float)segment * HALF_TURN_DEGREES / (float)halfSegments; };
|
||||
|
||||
if (sizeMulti.x == 1 && sizeMulti.y == 1)
|
||||
{
|
||||
Vector from = point(vector_make(size, 0));
|
||||
for (int segment = 1; segment <= halfSegments * 2; segment++)
|
||||
{
|
||||
Vector to = point(vector_scale(vector_from_angle(angleGet(segment)), size));
|
||||
line(from, to, color);
|
||||
from = to;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
float rotation = sprite.rotation;
|
||||
float major = sizeMulti.x * size;
|
||||
float minor = size * sizeMulti.y;
|
||||
if (major < minor)
|
||||
{
|
||||
rotation += RIGHT_ANGLE_DEGREES;
|
||||
std::swap(major, minor);
|
||||
}
|
||||
Vector axis = vector_scale(vector_from_angle(rotation), major - minor);
|
||||
Vector side = vector_scale(vector_from_angle(rotation + RIGHT_ANGLE_DEGREES), minor);
|
||||
Vector backSide = vector_scale(side, -1);
|
||||
|
||||
line(point(vector_sub(backSide, axis)), point(vector_add(backSide, axis)), color);
|
||||
line(point(vector_sub(side, axis)), point(vector_add(side, axis)), color);
|
||||
Vector front = point(vector_add(side, axis));
|
||||
Vector back = point(vector_sub(side, axis));
|
||||
for (int segment = 1; segment <= halfSegments; segment++)
|
||||
{
|
||||
Vector frontTo = point(vector_add(vector_rotated(side, -angleGet(segment)), axis));
|
||||
Vector backTo = point(vector_sub(vector_rotated(side, angleGet(segment)), axis));
|
||||
line(front, frontTo, color);
|
||||
line(back, backTo, color);
|
||||
front = frontTo;
|
||||
back = backTo;
|
||||
}
|
||||
}
|
||||
|
||||
// 006b2000 Draws only its sprite's shadow layer, uncolored, under it.
|
||||
@@ -1255,12 +1333,25 @@ void Entity::SetSpriteOverlayFrame(std::string_view animation, int frame)
|
||||
sprite.overlayAnimState.SetFrameFloat((float)frame);
|
||||
}
|
||||
|
||||
// The rest of Entity is not reconstructed yet.
|
||||
|
||||
// 006b5f10
|
||||
void* Entity::GetDebugShape(bool)
|
||||
// 00703580 (spawn_debug_damage_text) Shows a debug damage number (debug 7) as a text entity at a position, tinted,
|
||||
// and prints it to the error output as the original does.
|
||||
void debug_damage_text_spawn(const Vector& position, uint32_t argb, const std::string& text)
|
||||
{
|
||||
reconstruction_missing("Entity::GetDebugShape 006b5f10");
|
||||
std::perror(text.c_str());
|
||||
|
||||
Entity* entity = g_game->Spawn({.position = position, .type = ENTITY_TEXT, .seed = Random()});
|
||||
auto& label = static_cast<Entity_Text&>(*entity);
|
||||
KColor color = kcolor_argb(argb);
|
||||
ColorMod tint = {{color._red, color._green, color._blue, color._alpha}, {}, {}};
|
||||
label.SetColor(tint, -1, DEBUG_TEXT_PRIORITY, false, true);
|
||||
label.text = text.substr(0, DEBUG_TEXT_LENGTH);
|
||||
label.Update();
|
||||
}
|
||||
|
||||
// 006b5f10 The debug renderer's shape for this entity, by its index.
|
||||
void* Entity::GetDebugShape(bool isUnknown)
|
||||
{
|
||||
return g_game->debugRenderer.Get((int)index, isUnknown);
|
||||
}
|
||||
|
||||
// 006b6c20 The capsule its sprite's null layer covers: placed and turned like GetNullOffset, four times the null's
|
||||
|
||||
+7
-3
@@ -545,8 +545,6 @@ enum GridCollisionMode
|
||||
// A tear, bomb, knife or laser's 128 TearFlags bits (BitSet128).
|
||||
using TearFlags = std::bitset<128>;
|
||||
|
||||
// The drop RNG an entity holds before Init seeds it.
|
||||
constexpr RNG DROP_RNG_DEFAULT = {RNG_SEED_DEFAULT, 5, 9, 7};
|
||||
// The shifts of a drop RNG restored from a save, its seed taken from the save.
|
||||
constexpr RNG DROP_RNG_SAVED = {0, 4, 3, 17};
|
||||
|
||||
@@ -659,7 +657,7 @@ struct Entity
|
||||
EntityPtr parent;
|
||||
EntityPtr spawnerEntity;
|
||||
EntityPtr target;
|
||||
RNG dropRNG = DROP_RNG_DEFAULT;
|
||||
RNG dropRNG = RNG_DEFAULT;
|
||||
EntityConfig_Entity* config = nullptr;
|
||||
uint64_t flags = 0;
|
||||
uint64_t pendingDamageFlags = 0;
|
||||
@@ -776,6 +774,7 @@ struct Entity
|
||||
virtual void SetColor(const ColorMod& newColor, int duration, int priority, bool isFadeout, bool isShared);
|
||||
virtual void SetCollisionDamage(float damage);
|
||||
virtual void ClearReferences();
|
||||
// 005ccc00 An entity does not keep the doors shut.
|
||||
virtual bool CanShutDoors() { return false; }
|
||||
virtual bool IsBoss() { return false; }
|
||||
virtual bool IsValidTarget(Entity* other);
|
||||
@@ -927,4 +926,9 @@ constexpr int CULTIST_BLOOD_SPAWN = 10;
|
||||
void hit_list_insert(std::vector<uint32_t>& hitList, Entity& entity);
|
||||
float stage_health_get(float baseHealth, float stageHealth);
|
||||
Vector render_position_get(const Vector& world, RenderSnap snap);
|
||||
void debug_damage_text_spawn(const Vector& position, uint32_t argb, const std::string& text);
|
||||
|
||||
// The debug damage view's numbers (debug 7): damage an entity takes in light green, a player's hurt in orange red.
|
||||
constexpr uint32_t DEBUG_DAMAGE_DEALT_ARGB = 0xff90ee90;
|
||||
constexpr uint32_t DEBUG_DAMAGE_TAKEN_ARGB = 0xffff4500;
|
||||
int render_z_get(float depth);
|
||||
+3
-5
@@ -85,7 +85,6 @@ constexpr int BOMB_PICKUP_GIGA = 7;
|
||||
constexpr int BLASTING_CAP_CHANCE = 10;
|
||||
|
||||
// The sounds a bomb makes, and the size its costume sprites are picked by.
|
||||
constexpr int SOUND_SAFETY_SCISSORS = 900;
|
||||
constexpr float GOLDEN_VOLUME = 0.8f;
|
||||
constexpr float GIGA_DROP_PITCH = 0.8f;
|
||||
constexpr float BEEP_PITCH = 1.5f;
|
||||
@@ -113,7 +112,6 @@ constexpr float BOUNCE_VOLUME = 0.5f;
|
||||
|
||||
// Dr. Fetus' bombs in flight: Wiggle Worm's sway, Tractor Beam's pull toward its line, the boomerang's pull back, and
|
||||
// a rocket's wiggle, thrust and steering, and the smoke it trails.
|
||||
constexpr float HALF_TURN = 180;
|
||||
constexpr float FETUS_WIGGLE_RATE = 0.7f;
|
||||
constexpr float TRACTOR_PULL = 0.01f;
|
||||
constexpr float TRACTOR_PULL_MAX = 2;
|
||||
@@ -633,7 +631,7 @@ void Entity_Bomb::explode(Entity_Player* spawner)
|
||||
sprite.Play("Appear", PLAY_FORCED);
|
||||
if (sprite.animState.animData) sprite.animState.SetFrameFloat(GOLDEN_APPEAR_FRAME);
|
||||
RNG directionRng = {dropRNG.Next(), 3, 1, 14};
|
||||
float angle = directionRng.RandomFloat() * RANDOM_HALF_TURN;
|
||||
float angle = directionRng.RandomFloat() * PI_ROUGH;
|
||||
angle += angle;
|
||||
float speed = dropRNG.RandomFloat() * GOLDEN_SPEED_EXTRA + GOLDEN_SPEED;
|
||||
velocity = vector_make(speed * std::cos(angle), speed * std::sin(angle));
|
||||
@@ -723,7 +721,7 @@ void Entity_Bomb::fetus_children_throw()
|
||||
}
|
||||
|
||||
if (!tearFlags[TEAR_QUADSPLIT]) return;
|
||||
float angle = random_unit() * RANDOM_HALF_TURN;
|
||||
float angle = random_unit() * PI_ROUGH;
|
||||
angle += angle;
|
||||
Vector around = vector_make(std::cos(angle), std::sin(angle));
|
||||
float turnCosine = std::cos(PI_F / 2);
|
||||
@@ -890,7 +888,7 @@ void Entity_Bomb::rocket_sprite_update(float shownAngle)
|
||||
if (HasEntityFlags(FLAG_HELD)) angle = 0;
|
||||
else if (angle > RIGHT_ANGLE_DEGREES || angle < -RIGHT_ANGLE_DEGREES)
|
||||
{
|
||||
angle = HALF_TURN - angle;
|
||||
angle = HALF_TURN_DEGREES - angle;
|
||||
sprite.isFlipX = true;
|
||||
}
|
||||
sprite.rotation = angle;
|
||||
|
||||
@@ -122,7 +122,6 @@ struct PoisonSplash
|
||||
void explosion_damage(Explosion explosion);
|
||||
void poison_splash_spawn(const PoisonSplash& splash);
|
||||
void shovel_quest_dig();
|
||||
bool explosion_line_clear(const Vector& start, const Vector& end, bool isIgnoreWalls);
|
||||
void explosion_effects(const Explosion& explosion);
|
||||
void explosion_tear_flag_effects(const Explosion& explosion);
|
||||
Entity* bomb_crater_spawn(const Vector& position, Entity* spawner, float scale);
|
||||
@@ -17,7 +17,6 @@
|
||||
#include <cmath>
|
||||
|
||||
// What crushes rocks on contact: The Nail, Leo (worn or rolled by Zodiac), Thunder Thighs, Stompy and Mega Mush.
|
||||
constexpr int COLLECTIBLE_THUNDER_THIGHS = 314;
|
||||
// A transformation counts once the player holds this many of its items.
|
||||
constexpr int PLAYER_FORM_ITEMS = 3;
|
||||
|
||||
|
||||
+117
-18
@@ -100,10 +100,8 @@ constexpr float BISHOP_SHIELD_HEIGHT = -24;
|
||||
constexpr float BISHOP_SHIELD_NULL_Y = 4;
|
||||
constexpr float NULL_OFFSET_SCALE = 0.5f / 0.65f;
|
||||
|
||||
// Entity_Tear::HandleCollision: the hit countdown, the tears' push, the bounce of a just fired tear off a bomb, and
|
||||
// Entity_Tear::HandleCollision: the bounce of a just fired tear off a bomb, and
|
||||
// the burning tear's explosion chance from luck.
|
||||
constexpr int TEAR_HIT_COUNTDOWN = 30;
|
||||
constexpr float TEAR_PUSH_MIN_DISTANCE = 0.0001f;
|
||||
constexpr float TEAR_DEFLECTOR_MASS_SCALE = 0.1f;
|
||||
constexpr int BOMB_GRACE_FRAMES = 3;
|
||||
constexpr float FLY_PUSH = 0.5f;
|
||||
@@ -140,6 +138,18 @@ constexpr float BABY_CONTACT_DAMAGE = 10;
|
||||
constexpr float HORN_DAMAGE = 3.5f;
|
||||
constexpr float RAM_DAMAGE = 20;
|
||||
constexpr float RAM_FINISH_HEALTH = 40;
|
||||
// A versus ram deals 15 and waits a second, and Gamekid's touch scares a player (for the original's -60 frames).
|
||||
constexpr float RAM_VERSUS_DAMAGE = 15;
|
||||
constexpr int RAM_VERSUS_COOLDOWN = 30;
|
||||
constexpr int GAMEKID_VERSUS_FEAR = -60;
|
||||
// The kill trinkets a versus tear hit rolls.
|
||||
constexpr uint32_t LOCUST_ODDS_MASK = 0xf;
|
||||
constexpr uint32_t FISH_TAIL_EXTRA_ODDS = 5;
|
||||
constexpr uint32_t VERSUS_BAT_WING_ODDS = 50;
|
||||
constexpr uint32_t VERSUS_CRICKET_LEG_ODDS = 33;
|
||||
constexpr uint32_t VERSUS_SIGIL_ODDS = 10;
|
||||
constexpr int VERSUS_SIGIL_FRAMES = 30;
|
||||
constexpr int VERSUS_SIGIL_MAX_FRAMES = 150;
|
||||
constexpr int MIDAS_CONTACT_FREEZE = 90;
|
||||
constexpr int MIDAS_CONTACT_FREEZE_VERSUS = 45;
|
||||
constexpr float MIDAS_CONTACT_DAMAGE = 3.5f;
|
||||
@@ -221,7 +231,7 @@ static Entity_Effect* effect_spawn(int variant, int subType, Vector position, Ve
|
||||
// A random angle of a full turn, as the bursts draw it.
|
||||
static float random_angle()
|
||||
{
|
||||
float angle = random_unit() * RANDOM_HALF_TURN;
|
||||
float angle = random_unit() * PI_ROUGH;
|
||||
return angle + angle;
|
||||
}
|
||||
|
||||
@@ -317,7 +327,8 @@ static int coop_player_count()
|
||||
|
||||
// 006ace60 Queues a hit for the next update: nothing from a friendly source, nothing from a fire or countdown hit
|
||||
// while its cooldown runs, and nothing a Bishop shields. A boss takes less in co-op, a weakened entity double, and a
|
||||
// mod's MC_ENTITY_TAKE_DMG may cancel it. Whether the hit was queued.
|
||||
// mod's MC_ENTITY_TAKE_DMG may cancel it. A hit on an enemy (or a versus player) counts toward the damage its
|
||||
// attacking player dealt this frame. Whether the hit was queued.
|
||||
bool Entity::TakeDamage(float damage, uint64_t damageFlags, const EntityRef& source, int countdown)
|
||||
{
|
||||
if (type == ENTITY_PLAYER) log_printf(LOG_ASSERT, "Entity TakeDamage should not be called for Entity Player!");
|
||||
@@ -355,7 +366,10 @@ bool Entity::TakeDamage(float damage, uint64_t damageFlags, const EntityRef& sou
|
||||
damageEvents.push_back({.source = source, .damage = damage, .damageFlags = damageFlags});
|
||||
pendingDamageFlags |= damageFlags;
|
||||
pendingDamage += damage;
|
||||
// The damage the attacking player dealt is tallied only for the online stats screen, which is not written yet.
|
||||
|
||||
// The online stats screen also tallies the damage, which netplay being offline leaves out.
|
||||
Entity* attacker = source.entity ? source.entity->GetPlayerAncestor() : nullptr;
|
||||
if (attacker && is_enemy_type(type)) static_cast<Entity_Player*>(attacker)->versus.damageDealt += (uint32_t)damage;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -441,6 +455,28 @@ static void burst_drops_spawn(Entity& entity, int gibsAmount)
|
||||
}
|
||||
}
|
||||
|
||||
constexpr ColorMod BULB_FLASH_COLOR = {{1, 1, 0, 1}, {0, 0, 0, 0}, {0, 0, 0}};
|
||||
constexpr int BULB_FLASH_FRAMES = 3;
|
||||
constexpr float BULB_FLASH_SCALE = 0.75f;
|
||||
constexpr float BULB_FLASH_RAISE = -10;
|
||||
|
||||
// Part of 006b45c0: the Bulb's death flash, a yellow additive light 10 up for 3 frames.
|
||||
static void bulb_flash_spawn(const Vector& position)
|
||||
{
|
||||
npc_sound_play(SOUND_BULB_FLASH, 1, 2, 1);
|
||||
uint32_t seed = Random();
|
||||
auto* flash = static_cast<Entity_Effect*>(
|
||||
g_game->Spawn({.position = position, .type = ENTITY_EFFECT, .variant = EFFECT_LIGHT, .seed = seed}));
|
||||
flash->SetColor(BULB_FLASH_COLOR, -1, COLOR_PRIORITY_DEFAULT, false, true);
|
||||
flash->timeout = BULB_FLASH_FRAMES;
|
||||
flash->lifespan = BULB_FLASH_FRAMES;
|
||||
flash->sprite.scale = vector_make(BULB_FLASH_SCALE, BULB_FLASH_SCALE);
|
||||
flash->state = BULB_FLASH_FRAMES;
|
||||
flash->posOffset = vector_make(0, BULB_FLASH_RAISE);
|
||||
if (flash->sprite.animState.animData) flash->sprite.animState.SetFrameFloat(1);
|
||||
layer_additive_set(*flash->sprite.GetLayer(0));
|
||||
}
|
||||
|
||||
// 006b45c0 Bursts it: an iced or frozen enemy only shatters into shards, anything else plays its burst sound and
|
||||
// throws its config's gibs, a big burst (extra gore, or a huge config) shaking the screen, pushed away from the first
|
||||
// hit and with blood drops. It leaves a blood splat unless it is a bomb, a pickup or splashes no blood.
|
||||
@@ -467,8 +503,7 @@ void Entity::BloodExplode()
|
||||
}
|
||||
|
||||
burst_sound_play(*this);
|
||||
if (type == ENTITY_SUCKER && variant == SUCKER_BULB)
|
||||
reconstruction_missing("Entity::BloodExplode 006b45c0: the bulb's death flash");
|
||||
if (type == ENTITY_SUCKER && variant == SUCKER_BULB) bulb_flash_spawn(pos);
|
||||
|
||||
int gibsAmount = config->gibsAmount;
|
||||
if (gibsAmount >= 1 && HasEntityFlags(FLAG_REDUCE_GIBS)) gibsAmount = std::max(gibsAmount / REDUCED_GIBS_DIVISOR, 1);
|
||||
@@ -558,7 +593,7 @@ static Entity_Effect* gib_fling(const GibSpawn& gibs, int variant, int subType,
|
||||
// Part of 006b31b0: a tooth or chain gib, scattered within half the spread and flung at its own speed.
|
||||
static Entity_Effect* gib_scatter(const GibSpawn& gibs, int variant, uint32_t angleDraw)
|
||||
{
|
||||
float angle = (float)angleDraw * RANDOM_UNIT_SCALE * RANDOM_HALF_TURN;
|
||||
float angle = (float)angleDraw * RANDOM_UNIT_SCALE * PI_ROUGH;
|
||||
angle += angle;
|
||||
float reach = random_unit();
|
||||
Vector position = vector_add(gibs.position, vector_make(std::cos(angle) * reach * HALF_F * gibs.spread,
|
||||
@@ -707,7 +742,7 @@ static void tear_push(Entity_Tear& tear, Entity& collider, float massScale)
|
||||
{
|
||||
Vector offset = vector_sub(collider.pos, tear.pos);
|
||||
float distance = vector_length(offset);
|
||||
if (distance < TEAR_PUSH_MIN_DISTANCE) return;
|
||||
if (distance < PUSH_MIN_DISTANCE) return;
|
||||
|
||||
Vector relative = vector_sub(tear.velocity, collider.velocity);
|
||||
float speed = vector_length(relative);
|
||||
@@ -850,6 +885,54 @@ static TearContact tear_contact_get(Entity_Tear& tear, Entity& collider, Entity*
|
||||
return TEAR_CONTACT_HIT;
|
||||
}
|
||||
|
||||
// How many locusts a locust trinket sends: one, or with Fish Tail two (sometimes three doubled, four tripled).
|
||||
static int locust_count_get(Entity_Player& player)
|
||||
{
|
||||
if (!player.HasTrinket(TRINKET_FISH_TAIL)) return 1;
|
||||
int multiplier = player.GetTrinketMultiplier(TRINKET_FISH_TAIL);
|
||||
if (multiplier == 2) return Random() % FISH_TAIL_EXTRA_ODDS == 0 ? 3 : 2;
|
||||
if (multiplier == 3 && Random() % FISH_TAIL_EXTRA_ODDS == 0) return 4;
|
||||
return 2;
|
||||
}
|
||||
|
||||
// Part of 00673660: a versus player's tear landing on another player rolls its kill trinkets: each locust one in 16
|
||||
// (Conquest's twice as many), Bat Wing's flight one in 50, Cricket Leg's pickup one in 33 and Sigil of Baphomet's
|
||||
// shield one in 10 for a second, up to five.
|
||||
static void versus_hit_trinkets(Entity_Player& player)
|
||||
{
|
||||
TemporaryEffects& effects = player.temporaryEffects;
|
||||
for (int trinket = TRINKET_LOCUST_OF_WRATH; trinket <= TRINKET_LOCUST_OF_CONQUEST; trinket++)
|
||||
{
|
||||
if (!player.HasTrinket(trinket) || (Random() & LOCUST_ODDS_MASK) != 0) continue;
|
||||
int locusts = locust_count_get(player) * (trinket == TRINKET_LOCUST_OF_CONQUEST ? 2 : 1);
|
||||
for (int i = 0; i < locusts; i++)
|
||||
{
|
||||
uint32_t seed = Random();
|
||||
Entity* locust = g_game->Spawn({.position = player.pos, .spawner = &player,
|
||||
.subType = trinket - TRINKET_LOCUST_OF_WRATH + 1, .type = ENTITY_FAMILIAR,
|
||||
.variant = Entity_Familiar::BLUE_FLY, .seed = seed});
|
||||
locust->ClearEntityFlags(FLAG_APPEAR);
|
||||
}
|
||||
}
|
||||
if (player.HasTrinket(TRINKET_BAT_WING) && !effects.HasTrinketEffect(TRINKET_BAT_WING) &&
|
||||
player.GetTrinketRNG(TRINKET_BAT_WING).RandomInt(VERSUS_BAT_WING_ODDS) == 0)
|
||||
{
|
||||
effects.AddTrinketEffect(TRINKET_BAT_WING, true, 1);
|
||||
player.AddCostume(g_manager->itemConfig.GetNullItem(NULLITEM_BATWING_WINGS), false);
|
||||
}
|
||||
if (player.HasTrinket(TRINKET_CRICKET_LEG) && Random() % VERSUS_CRICKET_LEG_ODDS == 0) player.SpawnTrinketRandomPickup();
|
||||
if (!player.HasTrinket(TRINKET_SIGIL_OF_BAPHOMET) || Random() % VERSUS_SIGIL_ODDS != 0) return;
|
||||
|
||||
TemporaryEffect* shadows = effects.GetCollectibleEffect(COLLECTIBLE_BOOK_OF_SHADOWS);
|
||||
if (shadows && shadows->cooldown >= VERSUS_SIGIL_MAX_FRAMES) return;
|
||||
TemporaryEffect added;
|
||||
added.item = g_manager->itemConfig.GetCollectible(COLLECTIBLE_BOOK_OF_SHADOWS);
|
||||
added.cooldown = VERSUS_SIGIL_FRAMES;
|
||||
added.unknown = shadows ? 0 : 1;
|
||||
if (!shadows) sound_play(SOUND_BOOK_SHADOWS_SIGIL);
|
||||
effects.AddEffect(added, true, 1);
|
||||
}
|
||||
|
||||
// Part of 00673660: a tear hitting what it may hurt: whether its owner's side may hurt it, and whether it faces the
|
||||
// tear's way (a shielded front blocks). Piercing passes the fronts, and a spectral tear an obstacle with no grid
|
||||
// damage. Whether the tear flies through.
|
||||
@@ -872,10 +955,15 @@ static bool tear_damage_deal(Entity_Tear& tear, Entity& collider, bool& isHit)
|
||||
bool isSpectral = tear.tearFlags[TEAR_SPECTRAL];
|
||||
if (collider.IsEnemy() && (!isPiercing || isObstacle) && (!isSpectral || !isObstacle) && !isFacing) return false;
|
||||
if (isSpectral && isObstacle && tear.tearFlags[TEAR_NO_GRID_DAMAGE]) return true;
|
||||
if (g_game->deathmatchManager.is_active()) reconstruction_missing("Entity_Tear::HandleCollision 00673660: the versus trinkets");
|
||||
Entity_Player* shooterPlayer = shooter ? shooter->ToPlayer() : nullptr;
|
||||
if (g_game->deathmatchManager.is_active() && shooterPlayer)
|
||||
{
|
||||
shooterPlayer->trigger_vampire_charm_kill();
|
||||
if (collider.type == ENTITY_PLAYER) versus_hit_trinkets(*shooterPlayer);
|
||||
}
|
||||
|
||||
isHit = true;
|
||||
collider.TakeDamage(damage, damageFlags, EntityRef(&tear), TEAR_HIT_COUNTDOWN);
|
||||
collider.TakeDamage(damage, damageFlags, EntityRef(&tear), HIT_COUNTDOWN);
|
||||
if (tear.tearFlags[TEAR_FETUS_FLAG] && !isObstacle) tear.fetus_hit(collider);
|
||||
if (collider.IsEnemy()) tear.isCanTriggerStreakEnd = false;
|
||||
return collider.IsEnemy() && (tear.tearFlags[TEAR_BOOGER_FLAG] || tear.tearFlags[TEAR_STICKY] || tear.tearFlags[TEAR_SPORE_FLAG]);
|
||||
@@ -1017,8 +1105,8 @@ bool Entity_Tear::HandleCollision(Entity* collider, bool isLow)
|
||||
{
|
||||
apply_death_flag_effects(collider);
|
||||
if (tearFlags[TEAR_BELIAL_FLAG]) belial_turn();
|
||||
if (g_game->deathmatchManager.is_active() && collider->type == ENTITY_FAMILIAR)
|
||||
reconstruction_missing("Entity_Tear::HandleCollision 00673660: a versus familiar's block");
|
||||
bool isPassed = collider->type == ENTITY_FAMILIAR && !static_cast<Entity_Familiar*>(collider)->CanBlockProjectiles();
|
||||
if (g_game->deathmatchManager.is_active() && isPassed) return true;
|
||||
if (tear_flies_on(*this, *collider)) return true;
|
||||
deathFlags |= TEAR_DEATH_ENTITY;
|
||||
isDead = true;
|
||||
@@ -1084,7 +1172,8 @@ void Entity_NPC::on_player_damaged()
|
||||
}
|
||||
}
|
||||
|
||||
// Part of 0078e1f0: the damage a player's touch deals: the ramming items (more against the weak), Mom's Heels, The
|
||||
// Part of 0078e1f0: the damage a player's touch deals: in a versus fight 1 to a Sumo player (and Gamekid's fear), the
|
||||
// ramming items (more against the weak, 15 against a versus player once a second), Mom's Heels, The
|
||||
// Virus and Serpent's Kiss, Isaac's Heart's melee, Midas' Touch's gold freeze, the crow baby, Little Horn, Breath of Life, Aries at speed (which makes the player heavy and briefly unhurt),
|
||||
// Tooth and Nail, all tripled when thrown. Whether Breath of Life adds to it goes back through isBreath.
|
||||
static float player_contact_damage(Entity_Player& player, Entity& collider, bool& isBreath)
|
||||
@@ -1093,14 +1182,24 @@ static float player_contact_damage(Entity_Player& player, Entity& collider, bool
|
||||
TemporaryEffects& effects = player.temporaryEffects;
|
||||
float damage = 0;
|
||||
if (collider.type == ENTITY_PLAYER && g_game->deathmatchManager.is_fighting())
|
||||
reconstruction_missing("Entity_Player::HandleCollision 0078e1f0: the versus rules' contact damage");
|
||||
{
|
||||
damage = g_game->deathmatchManager.type->is_bouncy(static_cast<Entity_Player&>(collider)) ? 1 : 0;
|
||||
if (effects.HasCollectibleEffect(COLLECTIBLE_GAMEKID)) collider.AddFear(EntityRef(&player), GAMEKID_VERSUS_FEAR, false);
|
||||
}
|
||||
|
||||
TemporaryEffect* taurus = effects.GetCollectibleEffect(COLLECTIBLE_TAURUS);
|
||||
bool isRamming = effects.HasCollectibleEffect(COLLECTIBLE_MY_LITTLE_UNICORN) ||
|
||||
effects.HasCollectibleEffect(COLLECTIBLE_GAMEKID) || effects.HasCollectibleEffect(COLLECTIBLE_THE_NAIL) ||
|
||||
(taurus && taurus->cooldown != 0);
|
||||
if (isRamming && isVersus) reconstruction_missing("Entity_Player::HandleCollision 0078e1f0: the versus ramming cooldown");
|
||||
if (isRamming) damage += collider.health <= RAM_FINISH_HEALTH ? RAM_DAMAGE + RAM_DAMAGE : RAM_DAMAGE;
|
||||
if (isRamming && player.versus.ramCooldown == 0)
|
||||
{
|
||||
damage += collider.health <= RAM_FINISH_HEALTH ? RAM_DAMAGE + RAM_DAMAGE : RAM_DAMAGE;
|
||||
if (isVersus && collider.type == ENTITY_PLAYER)
|
||||
{
|
||||
damage = RAM_VERSUS_DAMAGE;
|
||||
player.versus.ramCooldown = RAM_VERSUS_COOLDOWN;
|
||||
}
|
||||
}
|
||||
if (player.HasCollectible(COLLECTIBLE_MOMS_HEELS)) damage += isVersus ? HEELS_DAMAGE_VERSUS : HEELS_DAMAGE;
|
||||
if (player.HasCollectible(COLLECTIBLE_VIRUS)) damage += isVersus ? VIRUS_DAMAGE_VERSUS : VIRUS_DAMAGE;
|
||||
if (player.HasCollectible(COLLECTIBLE_SERPENTS_KISS)) damage += isVersus ? VIRUS_DAMAGE_VERSUS : VIRUS_DAMAGE;
|
||||
|
||||
+15
-5
@@ -1,5 +1,8 @@
|
||||
#include "entity_dummy.h"
|
||||
#include "log.h"
|
||||
#include "font.h"
|
||||
#include "fx_layers.h"
|
||||
#include "manager.h"
|
||||
#include <string>
|
||||
|
||||
constexpr float DUMMY_FRICTION = 0.965f;
|
||||
|
||||
@@ -23,10 +26,17 @@ void Entity_Dummy::Update()
|
||||
if (isDead) Remove();
|
||||
}
|
||||
|
||||
// The rest of Entity_Dummy is not reconstructed yet.
|
||||
// Its type and variant label sits 8 above where it draws.
|
||||
constexpr float DUMMY_LABEL_RAISE = 8;
|
||||
|
||||
// 006a7f80
|
||||
void Entity_Dummy::Render(const Vector&)
|
||||
// 006a7f80 Draws as any entity, then its type and variant above it.
|
||||
void Entity_Dummy::Render(const Vector& offset)
|
||||
{
|
||||
reconstruction_missing("Entity_Dummy::Render 006a7f80");
|
||||
Entity::Render(offset);
|
||||
std::string label = "e" + std::to_string(type) + "." + std::to_string(variant);
|
||||
Font& font = g_manager->font2_TeamMeatEx12;
|
||||
float width = (float)font.GetStringWidth(label);
|
||||
Vector at = vector_make(renderPosition.x - width * HALF, renderPosition.y - DUMMY_LABEL_RAISE);
|
||||
FontSettings settings;
|
||||
font.DrawString(label, at, vector_make(1, 1), WHITE, settings);
|
||||
}
|
||||
@@ -300,8 +300,7 @@ void Entity_Effect::Init(int entityType, int entityVariant, int entitySubType, u
|
||||
if (!isExists) return;
|
||||
|
||||
sprite.LoadGraphics();
|
||||
if (g_game->deathmatchManager.is_active())
|
||||
reconstruction_missing("Entity_Effect::Init 005cdb20: the versus mode's entity registration");
|
||||
if (g_game->deathmatchManager.is_active()) g_game->deathmatchManager.type->entity_damage_adjust(*this);
|
||||
lua_engine_get().PostEffectInit(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -60,6 +60,7 @@ constexpr int BLOOD_EXPLOSION_FLAME = 5;
|
||||
constexpr float DUST_SPEED = 5;
|
||||
constexpr float DUST_RADIUS = 20;
|
||||
constexpr float DUST_SPIN_MIN = 2;
|
||||
constexpr float DUST_SPIN_RANGE = 10;
|
||||
|
||||
// Dogma's blackhole (171): its sparks (subtype 1) and swirls (2), and its states while open and closing.
|
||||
constexpr int BLACKHOLE_SPARK = 1;
|
||||
@@ -87,6 +88,9 @@ enum HaloSubtype
|
||||
HALO_BREATH_OF_LIFE = 9
|
||||
};
|
||||
|
||||
// The black of the trail drawn between Dark Arts' snares and what they hold.
|
||||
constexpr ColorMod SNARE_TRAIL_TINT = {{0, 0, 0, 1}, {0, 0, 0, 0}, {0, 0, 0}};
|
||||
|
||||
// The effect variants several files name (Lua's EffectVariant).
|
||||
enum EffectVariant : int
|
||||
{
|
||||
|
||||
@@ -33,7 +33,6 @@ constexpr int SOUND_SPAWNER_SUMMON = 265;
|
||||
constexpr int DOOR_STATE_KEEPS_DECORATIONS = 7;
|
||||
constexpr int RENDER_Z_DECORATION_LIMIT = 0x40000000;
|
||||
constexpr float NEAR_PLAYER_RANGE_SQUARED = 10000;
|
||||
constexpr float HALF_TURN = 180;
|
||||
|
||||
// The tiny fly: white in the Cathedral, how it wanders, flees the nearest player within range, dies to tears,
|
||||
// knives and fires, and drops down in circles when dead.
|
||||
@@ -162,8 +161,8 @@ static bool is_listed(const std::array<int, N>& list, int value)
|
||||
static float angle_normalized(float angle)
|
||||
{
|
||||
if (std::abs(angle) > FULL_TURN_DEGREES) angle = std::fmod(angle, FULL_TURN_DEGREES);
|
||||
if (angle > HALF_TURN) return angle - FULL_TURN_DEGREES;
|
||||
if (angle < -HALF_TURN) angle += FULL_TURN_DEGREES;
|
||||
if (angle > HALF_TURN_DEGREES) return angle - FULL_TURN_DEGREES;
|
||||
if (angle < -HALF_TURN_DEGREES) angle += FULL_TURN_DEGREES;
|
||||
return angle;
|
||||
}
|
||||
|
||||
@@ -469,7 +468,7 @@ static void tiny_fly_update(Entity_Effect& fly)
|
||||
}
|
||||
if (fly.IsFrame(FLY_JITTER_FRAMES, (int)fly.index))
|
||||
{
|
||||
float angle = random_unit() * RANDOM_HALF_TURN * 2;
|
||||
float angle = random_unit() * PI_ROUGH * 2;
|
||||
Vector jitter = vector_make(std::cos(angle), std::sin(angle));
|
||||
fly.AddVelocity_divided(vector_scale(jitter, random_unit() * FLY_JITTER), false);
|
||||
}
|
||||
@@ -1587,7 +1586,7 @@ static void tadpole_init(Entity_Effect& tadpole)
|
||||
{
|
||||
tadpole.sprite.Play("Idle");
|
||||
tadpole.rotation = angle_normalized(random_unit() * FULL_TURN_DEGREES);
|
||||
tadpole.sprite.GetLayer(0)->rotation = tadpole.rotation + HALF_TURN;
|
||||
tadpole.sprite.GetLayer(0)->rotation = tadpole.rotation + HALF_TURN_DEGREES;
|
||||
tadpole.height = 0;
|
||||
tadpole.isUnknown176 = true;
|
||||
}
|
||||
@@ -1653,7 +1652,7 @@ static void tadpole_update(Entity_Effect& tadpole)
|
||||
break;
|
||||
}
|
||||
if (tadpole.isDead) bug_splat(tadpole, 0);
|
||||
tadpole.sprite.GetLayer(0)->rotation = tadpole.rotation + HALF_TURN;
|
||||
tadpole.sprite.GetLayer(0)->rotation = tadpole.rotation + HALF_TURN_DEGREES;
|
||||
}
|
||||
|
||||
// A lil ghost starts where it was spawned with a random heading, size, speed and faintness, pale violet in the dark
|
||||
|
||||
@@ -65,7 +65,6 @@ constexpr float BLAST_PUSH = 3;
|
||||
constexpr float BLAST_TICK_SHARE = 50;
|
||||
constexpr float SMALL_BLAST_TICK_SHARE = 8;
|
||||
constexpr uint64_t BLAST_DAMAGE_FLAGS = DAMAGE_EXPLOSION | DAMAGE_CRUSH;
|
||||
constexpr int BLAST_HIT_COUNTDOWN = 30;
|
||||
constexpr int BEAN_FREEZE = -50;
|
||||
constexpr int BEAN_POISON = 90;
|
||||
constexpr float BEAN_POISON_DAMAGE = 5;
|
||||
@@ -81,8 +80,6 @@ constexpr float DEBRIS_TRAIL = 50;
|
||||
constexpr float DEBRIS_SCATTER = 50;
|
||||
constexpr float DEBRIS_SPEED_MIN = 4;
|
||||
constexpr float DEBRIS_SPEED_SPAN = 4;
|
||||
constexpr float BLAST_DUST_SPIN_MIN = 2;
|
||||
constexpr float BLAST_DUST_SPIN_SPAN = 10;
|
||||
constexpr int BLAST_DUST_LIFE_MIN = 10;
|
||||
constexpr int BLAST_DUST_LIFE_SPAN = 10;
|
||||
constexpr float BLAST_DUST_ALPHA_MIN = 0.2f;
|
||||
@@ -230,7 +227,7 @@ static bool blast_first_hit(Entity_Effect& blast, Entity& entity, float damage)
|
||||
{
|
||||
if (EntityList::HitListContains(blast.hitList, entity)) return false;
|
||||
hit_list_insert(blast.hitList, entity);
|
||||
entity.TakeDamage(damage, BLAST_DAMAGE_FLAGS, EntityRef(blast.spawnerEntity.get()), BLAST_HIT_COUNTDOWN);
|
||||
entity.TakeDamage(damage, BLAST_DAMAGE_FLAGS, EntityRef(blast.spawnerEntity.get()), HIT_COUNTDOWN);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -250,7 +247,7 @@ static void blast_entity_hit(Entity_Effect& blast, Entity& entity, float tickDam
|
||||
entity.AddPoison(source, BEAN_POISON, BEAN_POISON_DAMAGE, false);
|
||||
}
|
||||
else if (blast.variant != EFFECT_MEGA_BEAN_EXPLOSION)
|
||||
entity.TakeDamage(tickDamage, BLAST_DAMAGE_FLAGS, source, BLAST_HIT_COUNTDOWN);
|
||||
entity.TakeDamage(tickDamage, BLAST_DAMAGE_FLAGS, source, HIT_COUNTDOWN);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -264,7 +261,7 @@ static void blast_entity_hit(Entity_Effect& blast, Entity& entity, float tickDam
|
||||
else if (entity.is_slot())
|
||||
{
|
||||
entity.AddVelocity(blast_push(blast, entity), false);
|
||||
if (!entity.isDead) entity.TakeDamage(damage, BLAST_DAMAGE_FLAGS, source, BLAST_HIT_COUNTDOWN);
|
||||
if (!entity.isDead) entity.TakeDamage(damage, BLAST_DAMAGE_FLAGS, source, HIT_COUNTDOWN);
|
||||
}
|
||||
else if (entity.is_pickup())
|
||||
{
|
||||
@@ -286,7 +283,7 @@ static void blast_dust_throw(Entity_Effect& blast, Vector cell, Vector spot, Vec
|
||||
auto* dust = static_cast<Entity_Effect*>(g_game->Spawn(
|
||||
{.position = spot, .velocity = velocity, .type = ENTITY_EFFECT, .variant = EFFECT_DUST_CLOUD, .seed = seed}));
|
||||
float side = vector_dot(vector_sub(dust->pos, cell), vector_make(direction.y, -direction.x)) < 0 ? -1.0f : 1.0f;
|
||||
dust->rotation = (random_unit() * BLAST_DUST_SPIN_SPAN + BLAST_DUST_SPIN_MIN) * side;
|
||||
dust->rotation = (random_between(DUST_SPIN_MIN, DUST_SPIN_RANGE)) * side;
|
||||
dust->SetTimeout(random_below(BLAST_DUST_LIFE_SPAN) + BLAST_DUST_LIFE_MIN);
|
||||
if (blast.subtype == 2)
|
||||
{
|
||||
|
||||
@@ -28,7 +28,6 @@ constexpr float CRACK_STRIKE_DAMAGE = 20;
|
||||
constexpr float CRACK_HOSTILE_DAMAGE = 2;
|
||||
constexpr float CRACK_VERSUS_HIT_DAMAGE = 7;
|
||||
constexpr int CRACK_HIT_SPACING = 3;
|
||||
constexpr int CRACK_HIT_COUNTDOWN = 30;
|
||||
constexpr int CRACK_SHAKE = 5;
|
||||
// The crater it leaves.
|
||||
constexpr int CRACK_CRATER_SUBTYPE = 1;
|
||||
@@ -82,12 +81,12 @@ static void crack_hit(Entity_Effect& crack)
|
||||
effect_tear_flags_set(crack, flags);
|
||||
}
|
||||
float damage = isVersus ? CRACK_VERSUS_HIT_DAMAGE : CRACK_HOSTILE_DAMAGE;
|
||||
entity->TakeDamage(damage, damageFlags, EntityRef(source), CRACK_HIT_COUNTDOWN);
|
||||
entity->TakeDamage(damage, damageFlags, EntityRef(source), HIT_COUNTDOWN);
|
||||
}
|
||||
else if (entity->type >= CRACK_NPC_TYPE_FIRST)
|
||||
{
|
||||
float damage = isHostile ? CRACK_HOSTILE_DAMAGE : crack.collisionDamage;
|
||||
entity->TakeDamage(damage, 0, EntityRef(source), CRACK_HIT_COUNTDOWN);
|
||||
entity->TakeDamage(damage, 0, EntityRef(source), HIT_COUNTDOWN);
|
||||
}
|
||||
}
|
||||
if (crack.subtype == CRACK_PLAYER) crack.subtype = CRACK_PLAYER_STRUCK;
|
||||
@@ -202,7 +201,6 @@ constexpr float HUSH_LASER_PLAYER_PULL = 1.1f;
|
||||
constexpr float HUSH_LASER_FRICTION = 0.8f;
|
||||
constexpr int HUSH_LASER_HIT_SPACING = 2;
|
||||
constexpr float HUSH_LASER_DAMAGE = 2;
|
||||
constexpr int HUSH_LASER_HIT_COUNTDOWN = 30;
|
||||
constexpr int HUSH_LASER_TRAIL_SPACING = 5;
|
||||
constexpr int HUSH_LASER_TRAIL_PRIORITY = 255;
|
||||
constexpr ColorMod HUSH_LASER_TRAIL_COLOR = {{0, 0, 0, 0.8f}, {0, 0, 0, 0}, {17 / 255.0f, 159 / 255.0f, 225 / 255.0f}};
|
||||
@@ -227,7 +225,7 @@ static void hush_laser_hit(Entity_Effect& laser)
|
||||
|
||||
if (vector_length_squared(vector_sub(victim.pos, laser.pos)) >= reach * reach) return;
|
||||
if (victim.isDead || victim.entityCollisionClass == ENTCOLL_NONE) return;
|
||||
victim.TakeDamage(HUSH_LASER_DAMAGE, 0, EntityRef(source), HUSH_LASER_HIT_COUNTDOWN);
|
||||
victim.TakeDamage(HUSH_LASER_DAMAGE, 0, EntityRef(source), HIT_COUNTDOWN);
|
||||
};
|
||||
|
||||
if (isFriendly)
|
||||
|
||||
@@ -305,7 +305,6 @@ constexpr float WORM_STEP_SPEED_SQUARED = 1;
|
||||
constexpr float WORM_TEAR_RANGE = 5;
|
||||
constexpr float WORM_STILL_SPEED_SQUARED = 1;
|
||||
|
||||
constexpr float HALF_TURN = 180;
|
||||
constexpr float SPRITE_UP = 90;
|
||||
|
||||
static CombatEffect variant_get(const Entity_Effect& effect)
|
||||
@@ -328,8 +327,8 @@ bool is_combat_effect(int variant)
|
||||
static float angle_wrap(float angle)
|
||||
{
|
||||
if (std::fabs(angle) > FULL_TURN_DEGREES) angle = std::fmod(angle, FULL_TURN_DEGREES);
|
||||
if (angle > HALF_TURN) return angle - FULL_TURN_DEGREES;
|
||||
if (angle < -HALF_TURN) return angle + FULL_TURN_DEGREES;
|
||||
if (angle > HALF_TURN_DEGREES) return angle - FULL_TURN_DEGREES;
|
||||
if (angle < -HALF_TURN_DEGREES) return angle + FULL_TURN_DEGREES;
|
||||
return angle;
|
||||
}
|
||||
|
||||
@@ -369,7 +368,7 @@ void game_particles_spawn(const ParticleSpawn& spawn)
|
||||
for (int i = 0; i < spawn.count; i++)
|
||||
{
|
||||
uint32_t seed = Random();
|
||||
float angle = random_unit() * RANDOM_HALF_TURN;
|
||||
float angle = random_unit() * PI_ROUGH;
|
||||
angle += angle;
|
||||
Vector velocity = vector_make(std::cos(angle) * spawn.speed, std::sin(angle) * HALF * spawn.speed);
|
||||
auto* particle = static_cast<Entity_Effect*>(
|
||||
@@ -479,7 +478,7 @@ static void dust_cloud_init(Entity_Effect& effect)
|
||||
int frame = clouds->length == 0 ? 0 : (int)(Random() % (uint32_t)clouds->length);
|
||||
effect.sprite.SetFrame(clouds->name, frame);
|
||||
effect.sprite.isFlipX = !(Random() & 1);
|
||||
effect.sprite.rotation = random_unit() * FULL_TURN_DEGREES - HALF_TURN;
|
||||
effect.sprite.rotation = random_unit() * FULL_TURN_DEGREES - HALF_TURN_DEGREES;
|
||||
effect.sprite.scale = vector_make(DUST_SCALE, DUST_SCALE);
|
||||
effect.renderZOffset = POOF_RENDER_Z;
|
||||
if (effect.subtype == DUST_DARK) effect.sprite.color = {{1, 1, 1, 1}, {}, {DUST_DARKEN, DUST_DARKEN, DUST_DARKEN}};
|
||||
|
||||
@@ -83,7 +83,6 @@ constexpr float ORB_FAN_TURN = 45;
|
||||
constexpr int ORB_FAN_EXTRA_FRAMES = 12;
|
||||
constexpr float ORB_FAN_SCALE = 2;
|
||||
constexpr int ORB_HIT_PERIOD = 5;
|
||||
constexpr int ORB_HIT_COUNTDOWN = 30;
|
||||
|
||||
// The beam guide a spot draws: a line out from it, fading in over its first 15 frames and out over its life, and in
|
||||
// its last 5 frames thickening as it fades. It turns half a frame ahead on even frames.
|
||||
@@ -315,7 +314,7 @@ static void dogma_orb_hits_update(Entity_Effect& orb)
|
||||
if (EntityList::HitListContains(orb.hitList, *entity)) continue;
|
||||
hit_list_insert(orb.hitList, *entity);
|
||||
float damage = entity->IsEnemy() ? orb.collisionDamage : 1;
|
||||
entity->TakeDamage(damage, 0, EntityRef(&orb), ORB_HIT_COUNTDOWN);
|
||||
entity->TakeDamage(damage, 0, EntityRef(&orb), HIT_COUNTDOWN);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -552,7 +552,6 @@ constexpr float PUDDLE_BUBBLE_SPREAD = 4;
|
||||
constexpr float PUDDLE_SCREEN_SCALE = 0.65f;
|
||||
constexpr float PUDDLE_TEXEL_ALPHA = 0.5f;
|
||||
constexpr float PUDDLE_DAMAGE = 1;
|
||||
constexpr int PUDDLE_HIT_COUNTDOWN = 30;
|
||||
constexpr int PUDDLE_FADE_FRAMES = 15;
|
||||
constexpr int PUDDLE_SORTING_Z = 2000;
|
||||
constexpr std::string_view POOP_BUBBLE_SHEET = "gfx/effects/poop_bubble.png";
|
||||
@@ -596,7 +595,7 @@ static void colostomia_player_burn(Entity_Effect& puddle, Entity_Player& player)
|
||||
.alphaThreshold = PUDDLE_TEXEL_ALPHA,
|
||||
.layerId = 0});
|
||||
if (texel._alpha <= PUDDLE_TEXEL_ALPHA) return;
|
||||
player.TakeDamage(PUDDLE_DAMAGE, DAMAGE_ACID, EntityRef(&puddle), PUDDLE_HIT_COUNTDOWN);
|
||||
player.TakeDamage(PUDDLE_DAMAGE, DAMAGE_ACID, EntityRef(&puddle), HIT_COUNTDOWN);
|
||||
player.AddEntityFlags(FLAG_SLIPPERY_PHYSICS);
|
||||
player.SetFootprintColor(texel, false);
|
||||
}
|
||||
|
||||
@@ -181,7 +181,6 @@ constexpr float MR_ME_HIT_DAMAGE = 3;
|
||||
constexpr int MR_ME_HIT_PERIOD = 10;
|
||||
constexpr int MR_ME_VERSUS_HIT_PERIOD = 16;
|
||||
constexpr int MR_ME_VERSUS_FRAMES = 600;
|
||||
constexpr int MR_ME_HIT_COUNTDOWN = 30;
|
||||
constexpr int MR_ME_FLASH_FRAMES = 5;
|
||||
constexpr int MR_ME_FLASH_PRIORITY = 200;
|
||||
constexpr int MR_ME_TARGET_PRIORITY = 255;
|
||||
@@ -511,7 +510,7 @@ static Vector mr_me_work(Entity_Effect& helper, MrMeData& data)
|
||||
if (helper.IsFrame(period, 0) &&
|
||||
vector_length_squared(vector_sub(helper.pos, child->pos)) < helper.size * helper.size)
|
||||
{
|
||||
child->TakeDamage(MR_ME_HIT_DAMAGE, 0, EntityRef(helper.parent), MR_ME_HIT_COUNTDOWN);
|
||||
child->TakeDamage(MR_ME_HIT_DAMAGE, 0, EntityRef(helper.parent), HIT_COUNTDOWN);
|
||||
helper.SetColor(MR_ME_FLASH_COLOR, MR_ME_FLASH_FRAMES, MR_ME_FLASH_PRIORITY, true, true);
|
||||
}
|
||||
return move;
|
||||
|
||||
@@ -47,7 +47,6 @@ constexpr ColorMod FOOT_POOF_COLOR = {{0.62f, 0.62f, 0.62f, 0.8f}, {0, 0, 0, 0},
|
||||
constexpr float FIRE_FRICTION = 0.95f;
|
||||
constexpr int FIRE_HIT_RESET_FRAMES = 5;
|
||||
constexpr int FIRE_LIFESPAN = 300;
|
||||
constexpr int FIRE_HIT_COUNTDOWN = 30;
|
||||
constexpr float FIRE_SHRINK = 0.25f;
|
||||
constexpr float FIRE_MIN_DAMAGE_SCALE = 0.5f;
|
||||
constexpr float FIRE_ENEMY_REACH = 5;
|
||||
@@ -73,9 +72,6 @@ constexpr float FIRE_JET_PLAYER_THRESHOLD = 30;
|
||||
constexpr float DEATH_SKULL_HEIGHT = -30;
|
||||
constexpr int DEATH_SKULL_LINGER = 2;
|
||||
|
||||
// Mom's hand from Emergency Contact lands on its target for its damage.
|
||||
constexpr int MOMS_HAND_HIT_COUNTDOWN = 30;
|
||||
|
||||
// The Ultra Death scythe falls 0.7 faster each frame and goes 120 below the room.
|
||||
constexpr float SCYTHE_FALL = 0.7f;
|
||||
constexpr float SCYTHE_FALL_MARGIN = 120;
|
||||
@@ -256,7 +252,7 @@ static bool fire_hit(Entity_Effect& fire, Entity& entity, float damage, uint64_t
|
||||
if (EntityList::HitListContains(fire.hitList, entity)) return false;
|
||||
|
||||
hit_list_insert(fire.hitList, entity);
|
||||
return entity.TakeDamage(damage, damageFlags, EntityRef(&fire), FIRE_HIT_COUNTDOWN);
|
||||
return entity.TakeDamage(damage, damageFlags, EntityRef(&fire), HIT_COUNTDOWN);
|
||||
}
|
||||
|
||||
// Whether a burnable entity is one a fire may hurt now: alive, collidable, not friendly and, for an item fire, no
|
||||
@@ -647,7 +643,7 @@ static void moms_hand_update(Entity_Effect& hand)
|
||||
{
|
||||
if (hand.sprite.IsEventTriggered("Land") && hand.target && hand.target->isExists)
|
||||
{
|
||||
hand.target->TakeDamage(hand.collisionDamage, 0, EntityRef(&hand), MOMS_HAND_HIT_COUNTDOWN);
|
||||
hand.target->TakeDamage(hand.collisionDamage, 0, EntityRef(&hand), HIT_COUNTDOWN);
|
||||
effect_sound_play(SOUND_FORESTBOSS_STOMPS);
|
||||
}
|
||||
if (hand.sprite.IsFinished("JumpDown")) hand.sprite.Play("Grab");
|
||||
@@ -1082,7 +1078,7 @@ static void spear_update(Entity_Effect& spear)
|
||||
if (!isHittable || EntityList::HitListContains(spear.hitList, *entity)) continue;
|
||||
|
||||
float damage = params.tearDamage * (isGuardian ? 1 : SPEAR_DAMAGE_SCALE);
|
||||
entity->TakeDamage(damage, 0, EntityRef(&spear), FIRE_HIT_COUNTDOWN);
|
||||
entity->TakeDamage(damage, 0, EntityRef(&spear), HIT_COUNTDOWN);
|
||||
if (entity->IsBoss()) entity->AddFear(EntityRef(spear.parent.get()), SPEAR_FEAR_FRAMES, false);
|
||||
hit_list_insert(spear.hitList, *entity);
|
||||
}
|
||||
@@ -1121,7 +1117,7 @@ static void brown_cloud_sting(Entity_Effect& cloud)
|
||||
{
|
||||
if (!entity->IsVulnerableEnemy(nullptr) || cloud.IsDescendantOf(entity)) continue;
|
||||
if (EntityList::HitListContains(cloud.hitList, *entity)) continue;
|
||||
entity->TakeDamage(damage, 0, EntityRef(&cloud), FIRE_HIT_COUNTDOWN);
|
||||
entity->TakeDamage(damage, 0, EntityRef(&cloud), HIT_COUNTDOWN);
|
||||
hit_list_insert(cloud.hitList, *entity);
|
||||
}
|
||||
for (Entity* tear : entity_query_radius(cloud.pos, reach, QUERY_TEARS))
|
||||
@@ -1200,7 +1196,7 @@ static void boomerang_update(Entity_Effect& boomerang)
|
||||
if (entity->isDead || entity->entityCollisionClass == ENTCOLL_NONE) continue;
|
||||
if (EntityList::HitListContains(boomerang.hitList, *entity)) continue;
|
||||
|
||||
entity->TakeDamage(boomerang.collisionDamage, 0, EntityRef(&boomerang), FIRE_HIT_COUNTDOWN);
|
||||
entity->TakeDamage(boomerang.collisionDamage, 0, EntityRef(&boomerang), HIT_COUNTDOWN);
|
||||
entity->AddFreeze(EntityRef(&boomerang), BOOMERANG_FREEZE, false);
|
||||
entity->AddVelocity(boomerang.velocity, false);
|
||||
hit_list_insert(boomerang.hitList, *entity);
|
||||
|
||||
@@ -40,11 +40,10 @@ constexpr std::array<ColorMod, 4> PORTAL_COLORS = {{
|
||||
{{0.6f, 1, 0.6f, 1}, {0, 1.8f, 0, 1}, {0, 0, 0}},
|
||||
}};
|
||||
constexpr std::string_view WOMB_HOLE_ORANGE_SHEET = "gfx/Effects/wombhole_orange.png";
|
||||
constexpr float BYTE_SCALE = 1.0f / 255;
|
||||
constexpr ColorMod ORANGE_WISP_BODY = {
|
||||
{400 * BYTE_SCALE, 250 * BYTE_SCALE, 60 * BYTE_SCALE, 1}, {0, 0, 0, 0}, {0, 0, 0}};
|
||||
{400 * BYTE_TO_UNIT, 250 * BYTE_TO_UNIT, 60 * BYTE_TO_UNIT, 1}, {0, 0, 0, 0}, {0, 0, 0}};
|
||||
constexpr ColorMod ORANGE_WISP_FLAME = {
|
||||
{300 * BYTE_SCALE, 200 * BYTE_SCALE, 10 * BYTE_SCALE, 1}, {0, 0, 0, 0}, {0, 0, 0}};
|
||||
{300 * BYTE_TO_UNIT, 200 * BYTE_TO_UNIT, 10 * BYTE_TO_UNIT, 1}, {0, 0, 0, 0}, {0, 0, 0}};
|
||||
constexpr int WISP_ORBIT_LAYER = 9;
|
||||
|
||||
// The portal states: closed, opening, open, taking a player in, and letting one out.
|
||||
|
||||
@@ -127,7 +127,6 @@ constexpr float SWIRL_PULL = 14;
|
||||
constexpr float TECH_DOT_PULL = 8;
|
||||
constexpr float SWIRL_PULL_RANGE = 250;
|
||||
constexpr int SWIRL_HIT_FRAMES = 3;
|
||||
constexpr int SWIRL_HIT_COUNTDOWN = 30;
|
||||
constexpr int TECH_DOT_LASER_TIMEOUT = 10;
|
||||
constexpr int TECH_DOT_LIFE = 90;
|
||||
constexpr int DOGMA_DOT_LIFE = 60;
|
||||
@@ -200,7 +199,7 @@ static void swirl_enemy_hurt(Entity_Effect& swirl, Entity& enemy, Entity_Player*
|
||||
params = player->GetTearHitParams(WEAPON_LASER, 1, 0, swirl.spawnerEntity.get());
|
||||
damageFlags = tear_damage_flags_get(params.tearFlags, &swirl);
|
||||
}
|
||||
enemy.TakeDamage(swirl.collisionDamage, damageFlags, EntityRef(&swirl), SWIRL_HIT_COUNTDOWN);
|
||||
enemy.TakeDamage(swirl.collisionDamage, damageFlags, EntityRef(&swirl), HIT_COUNTDOWN);
|
||||
if (isDot) hit_list_insert(swirl.hitList, enemy);
|
||||
if (player) Entity_Tear::ApplyTearFlagEffects(&enemy, swirl.pos, params.tearFlags, &swirl, swirl.collisionDamage);
|
||||
}
|
||||
@@ -287,7 +286,6 @@ static void swirl_update(Entity_Effect& swirl)
|
||||
// then runs from it to its child (or its player), and a strike lengthens Judas' Dark Arts effect.
|
||||
constexpr int SNARE_HOLD_FRAMES = 4;
|
||||
constexpr int SNARE_TINT_PRIORITY = 1;
|
||||
constexpr int SNARE_HIT_COUNTDOWN = 30;
|
||||
constexpr int SNARE_SOUND_DELAY = 1;
|
||||
constexpr float SNARE_PITCH_MIN = 1.5f;
|
||||
constexpr float SNARE_PITCH_SPAN = 0.2f;
|
||||
@@ -301,7 +299,6 @@ constexpr int SNARE_JUDAS_FRAMES = 4;
|
||||
constexpr int SNARE_FRAMES_PER_COUNT = 30;
|
||||
constexpr ColorMod SNARE_HOLD_TINT = {{0.5f, 0.5f, 0.5f, 1}, {0, 0, 0, 0}, {0, 0, 0}};
|
||||
constexpr ColorMod SNARE_POOF_TINT = {{0.2f, 0.2f, 0.2f, 0.8f}, {0, 0, 0, 0}, {0, 0, 0}};
|
||||
constexpr ColorMod SNARE_TRAIL_TINT = {{0, 0, 0, 1}, {0, 0, 0, 0}, {0, 0, 0}};
|
||||
|
||||
// Part of 005cdb20 (Init's case 194) The snare lies on the floor, its shadow showing.
|
||||
static void dark_snare_init(Entity_Effect& snare)
|
||||
@@ -322,7 +319,7 @@ static bool dark_snare_strike(Entity_Effect& snare)
|
||||
}
|
||||
if (!target->IsEnemy() || target->isDead) return false;
|
||||
|
||||
target->TakeDamage(snare.collisionDamage, 0, EntityRef(&snare), SNARE_HIT_COUNTDOWN);
|
||||
target->TakeDamage(snare.collisionDamage, 0, EntityRef(&snare), HIT_COUNTDOWN);
|
||||
Entity_Tear::ApplyTearFlagEffects(target, snare.pos, effect_tear_flags(snare), &snare, snare.collisionDamage);
|
||||
Entity* spawner = snare.spawnerEntity;
|
||||
if (!target->HasMortalDamage() || !spawner || !spawner->is_player()) return true;
|
||||
|
||||
@@ -64,7 +64,6 @@ constexpr float HUNGRY_SOUL_FRICTION = 0.95f;
|
||||
constexpr float HUNGRY_SOUL_STOP_FRICTION = 0.8f;
|
||||
constexpr int HUNGRY_SOUL_HIT_RESET_FRAMES = 8;
|
||||
constexpr float HUNGRY_SOUL_BITE_SHARE = 0.5f;
|
||||
constexpr int SOUL_HIT_COUNTDOWN = 30;
|
||||
constexpr float HUNGRY_SOUL_PITCH_MIN = 0.9f;
|
||||
constexpr float HUNGRY_SOUL_PITCH_SPAN = 0.2f;
|
||||
constexpr int HUNGRY_SOUL_SHAKE = 6;
|
||||
@@ -253,7 +252,7 @@ static void hungry_soul_bite(Entity_Effect& soul, Entity_Player& player)
|
||||
for (Entity* enemy : entity_query_radius(soul.pos, soul.size, QUERY_ENEMIES))
|
||||
{
|
||||
if (!enemy->IsVulnerableEnemy(&player) || EntityList::HitListContains(soul.hitList, *enemy)) continue;
|
||||
enemy->TakeDamage(player.meleeDamage * HUNGRY_SOUL_BITE_SHARE, 0, EntityRef(&soul), SOUL_HIT_COUNTDOWN);
|
||||
enemy->TakeDamage(player.meleeDamage * HUNGRY_SOUL_BITE_SHARE, 0, EntityRef(&soul), HIT_COUNTDOWN);
|
||||
hit_list_insert(soul.hitList, *enemy);
|
||||
}
|
||||
}
|
||||
@@ -374,7 +373,7 @@ static void dead_bird_update(Entity_Effect& bird)
|
||||
{
|
||||
for (Entity* entity : entity_query_capsule(bird.GetCollisionCapsule({}), QUERY_ENEMIES))
|
||||
if (entity->IsVulnerableEnemy(&bird))
|
||||
entity->TakeDamage(bird.collisionDamage, 0, EntityRef(nullptr), SOUL_HIT_COUNTDOWN);
|
||||
entity->TakeDamage(bird.collisionDamage, 0, EntityRef(nullptr), HIT_COUNTDOWN);
|
||||
}
|
||||
|
||||
float lastSpeed = vector_length(bird.velocity);
|
||||
|
||||
@@ -294,7 +294,6 @@ constexpr float RIFT_SHOT_HOVER = 0.3f;
|
||||
constexpr int RIFT_SHOT_SAFE_FRAMES = 15;
|
||||
constexpr float RIFT_SHOT_LOWEST = -50;
|
||||
constexpr int RIFT_HIT_PERIOD = 10;
|
||||
constexpr int RIFT_HIT_COUNTDOWN = 30;
|
||||
constexpr float RIFT_ATTRACT_STRENGTH = 20;
|
||||
constexpr float RIFT_ATTRACT_RADIUS = 250;
|
||||
|
||||
@@ -324,7 +323,7 @@ static void rift_pull(Entity_Effect& rift, Entity& entity, float strength)
|
||||
pull *= strength;
|
||||
|
||||
if (rift.IsFrame(RIFT_HIT_PERIOD, 0) && entity.IsEnemy() && distance < entity.size + rift.size && is_laser_target(entity))
|
||||
entity.TakeDamage(rift.collisionDamage, DAMAGE_LASER, EntityRef(rift.parent), RIFT_HIT_COUNTDOWN);
|
||||
entity.TakeDamage(rift.collisionDamage, DAMAGE_LASER, EntityRef(rift.parent), HIT_COUNTDOWN);
|
||||
|
||||
float nearness = distance < RIFT_NEAR ? distance / RIFT_NEAR_SHARE : 1 / distance;
|
||||
pull = pull * nearness / entity.friction;
|
||||
@@ -347,7 +346,7 @@ static void rift_hits_update(Entity_Effect& rift, Entity_Player* player)
|
||||
{
|
||||
if (entity == player || is_critter_eaten(*entity) || !is_laser_target(*entity)) continue;
|
||||
uint64_t damageFlags = laser_effects_apply(rift, *entity, player);
|
||||
entity->TakeDamage(rift.collisionDamage, damageFlags, EntityRef(rift.parent), RIFT_HIT_COUNTDOWN);
|
||||
entity->TakeDamage(rift.collisionDamage, damageFlags, EntityRef(rift.parent), HIT_COUNTDOWN);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -403,7 +402,6 @@ static void rift_update(Entity_Effect& rift)
|
||||
constexpr float BALL_SHRINK_SCALE = 1.5f;
|
||||
constexpr float BALL_FADE = 0.8f;
|
||||
constexpr float BALL_OCCULT_SPEED = 3;
|
||||
constexpr float BALL_OCCULT_FRICTION = 0.8f;
|
||||
constexpr float BALL_HOMING_LOOKAHEAD = 5;
|
||||
constexpr float BALL_HOMING_RANGE = 100;
|
||||
constexpr int BALL_HOMING_PERIOD = 5;
|
||||
@@ -425,7 +423,6 @@ constexpr int BALL_SPLAT_SUBTYPE = 2;
|
||||
constexpr int BALL_SPLAT_PRIORITY = 255;
|
||||
constexpr float BALL_SPLAT_VOLUME = 0.7f;
|
||||
constexpr int BALL_SPLAT_DELAY = 8;
|
||||
constexpr int BALL_HIT_COUNTDOWN = 30;
|
||||
constexpr ColorMod BALL_SPLAT_TINT = color_make({2, 1, 1, 1});
|
||||
|
||||
// The brimstone ball part of 005cdb20 (Init): it appears.
|
||||
@@ -511,7 +508,7 @@ static void brimstone_ball_hits_update(Entity_Effect& ball, Entity_Player* playe
|
||||
brimstone_ball_splatter(ball, *entity);
|
||||
damage = damage * BALL_MARK_DAMAGE_SCALE + BALL_MARK_DAMAGE_BONUS;
|
||||
}
|
||||
entity->TakeDamage(damage, damageFlags, EntityRef(ball.parent), BALL_HIT_COUNTDOWN);
|
||||
entity->TakeDamage(damage, damageFlags, EntityRef(ball.parent), HIT_COUNTDOWN);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -545,7 +542,7 @@ static void brimstone_ball_update(Entity_Effect& ball)
|
||||
player->GetMouseAimTarget(aim, false);
|
||||
if (!vector_is_zero(aim))
|
||||
ball.velocity = vector_add(ball.velocity, vector_scale(vector_normalized(aim), player->shotSpeed * BALL_OCCULT_SPEED));
|
||||
ball.friction = BALL_OCCULT_FRICTION;
|
||||
ball.friction = OCCULT_FRICTION;
|
||||
}
|
||||
if (flags[TEAR_HOMING]) brimstone_ball_home(ball);
|
||||
if (flags[TEAR_GROW])
|
||||
|
||||
@@ -179,7 +179,6 @@ constexpr uint32_t ROOM_CONFIG_FLAG_AFTERBIRTH_HAZARDS = 1 << 3;
|
||||
constexpr int STAGE_BACKWARDS_LAST = 6;
|
||||
constexpr int STAGE_LABYRINTH_SHIFT = 1;
|
||||
constexpr uint32_t CURSE_LABYRINTH = 1 << 1;
|
||||
constexpr int SPECIAL_DAILY_GOLDEN_FATTY = 7;
|
||||
constexpr int CHALLENGE_GOLDEN_FATTY = 32;
|
||||
|
||||
template <typename T> static std::unique_ptr<Entity> entity_make()
|
||||
@@ -339,8 +338,7 @@ Entity* game_spawn(const EntitySpawn& request, PoolMode mode)
|
||||
EntitySpawn spawn = request;
|
||||
lua_engine_get().Callback_PreEntitySpawn(spawn);
|
||||
if (game.deathmatchManager.state >= DEATHMATCH_INTRO)
|
||||
reconstruction_missing("Game::SpawnEx 006fe410: a versus match's "
|
||||
"blacklisted pickups (0042b560)");
|
||||
game.deathmatchManager.type->pickup_replace_banned(spawn.type, spawn.variant, spawn.subType);
|
||||
|
||||
Entity* spawner = spawn.spawner;
|
||||
int variant = spawn.variant;
|
||||
@@ -364,9 +362,10 @@ Entity* game_spawn(const EntitySpawn& request, PoolMode mode)
|
||||
|
||||
std::set<std::pair<uint32_t, int>>& triggers = game.proceduralItemManager.spawnTriggerTargets;
|
||||
bool isTriggered = triggers.contains({entity->type, entity->variant}) || triggers.contains({entity->type, -1});
|
||||
if (entity->isExists && !game.proceduralItemManager.proceduralItems.empty() && isTriggered &&
|
||||
!game.playerManager.playerList.empty())
|
||||
reconstruction_missing("trigger_set_dispatch 009e0680: a TMTRAINER item's spawn trigger");
|
||||
if (entity->isExists && !game.proceduralItemManager.proceduralItems.empty() && isTriggered)
|
||||
for (size_t i = 0; i < game.playerManager.playerList.size(); i++)
|
||||
glitched_items_trigger(*game.playerManager.playerList[i],
|
||||
{spawn.position, spawn.velocity, entity, CONDITION_ENTITY_SPAWN});
|
||||
|
||||
g_entitySpawnTimeMs += GetTimeNs() / NS_PER_MS - startMs;
|
||||
return entity;
|
||||
@@ -601,7 +600,7 @@ static bool enemy_variant_transform(Room& room, RoomEntry& entry, int stage, int
|
||||
switch (entry.type)
|
||||
{
|
||||
case ENTITY_STONEY:
|
||||
if (game.dailyChallenge.specialDailyId == SPECIAL_DAILY_GOLDEN_FATTY ||
|
||||
if (game.dailyChallenge.specialDailyId == SPECIAL_DAILY_APRIL_FOOLS ||
|
||||
game.challenge == CHALLENGE_GOLDEN_FATTY)
|
||||
return roll(true, 5, 1, 10);
|
||||
return false;
|
||||
|
||||
@@ -410,7 +410,7 @@ void Entity_Familiar::Init(int initType, int initVariant, int initSubtype, uint3
|
||||
|
||||
variant_init(kept);
|
||||
if (overwrite_limit() < 0) flags |= FLAG_DONT_OVERWRITE;
|
||||
if (familiar_versus()) reconstruction_missing("Entity_Familiar::Init 0060de70 (a versus match's familiar)");
|
||||
if (familiar_versus()) g_game->deathmatchManager.type->entity_damage_adjust(*this);
|
||||
if (variant == BUM_FRIEND || variant == DARK_BUM || variant == KEY_BUM || variant == SUPER_BUM)
|
||||
sprite.Play("FloatDown");
|
||||
if (variant == ISAACS_HEART) player->isaacsHeart = this;
|
||||
|
||||
@@ -140,7 +140,6 @@ constexpr int KNIFE_HIT_REFRESH = 3;
|
||||
constexpr int SCYTHE_HIT_REFRESH = 5;
|
||||
constexpr int SCYTHE_WAIT_HIT_REFRESH = 10;
|
||||
constexpr float GRID_STEP = 40;
|
||||
constexpr int KNIFE_HIT_COUNTDOWN = 30;
|
||||
// Local until entity_player_weapons.cpp drops its copy for the shared PlayerItemId enum.
|
||||
constexpr float KNIFE_BRIDGE_TURN = 90;
|
||||
constexpr float KNIFE_TURN_QUARTER = 90;
|
||||
@@ -265,7 +264,7 @@ void tear_flags_area_apply(const Vector& position, Entity* source, float radius,
|
||||
for (Entity* enemy : entity_query_radius(position, radius, QUERY_ENEMIES))
|
||||
{
|
||||
if (!enemy->IsVulnerableEnemy(nullptr)) continue;
|
||||
enemy->TakeDamage(damage, 0, EntityRef(source), KNIFE_HIT_COUNTDOWN);
|
||||
enemy->TakeDamage(damage, 0, EntityRef(source), HIT_COUNTDOWN);
|
||||
Entity_Tear::ApplyTearFlagEffects(enemy, position, flags, source, damage);
|
||||
}
|
||||
}
|
||||
@@ -1721,7 +1720,7 @@ bool Entity_Knife::HandleCollision(Entity* collider, bool isLow)
|
||||
}
|
||||
|
||||
uint64_t damageFlags = tear_damage_flags_get(flags, this);
|
||||
collider->TakeDamage(damage, damageFlags, EntityRef(this), KNIFE_HIT_COUNTDOWN);
|
||||
collider->TakeDamage(damage, damageFlags, EntityRef(this), HIT_COUNTDOWN);
|
||||
if (collider->type == ENTITY_FIREPLACE) return true;
|
||||
|
||||
Entity_Tear::ApplyTearFlagEffects(collider, pos, flags, this, damage);
|
||||
|
||||
@@ -148,7 +148,6 @@ constexpr int BURST_TRAIL_DEPTH = -400;
|
||||
constexpr float KNIFE_SPLIT_SCALE = 0.8f;
|
||||
constexpr float SPLIT_ANGLE = 90;
|
||||
constexpr float SHARD_CRAWLSPACE_OFFSET_Y = -18;
|
||||
constexpr float RANDOM_HALF_TURN_KNIFE = 3.14f;
|
||||
|
||||
// The tear effects a shard or stuck tear does not inherit.
|
||||
constexpr std::array<int, 9> QUAD_SHARD_DROPPED = {TEAR_EXPLOSIVE, TEAR_QUADSPLIT, TEAR_SPLIT, TEAR_LUDOVICO, TEAR_BONE_FLAG,
|
||||
@@ -889,7 +888,7 @@ void Entity_Knife::apply_hit_effects(const KnifeHit& hit)
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
uint32_t seed = Random();
|
||||
float angle = random_unit() * RANDOM_HALF_TURN_KNIFE;
|
||||
float angle = random_unit() * PI_ROUGH;
|
||||
angle += angle;
|
||||
Vector velocity = vector_make(std::cos(angle) * shardSpeed, std::sin(angle) * shardSpeed);
|
||||
Entity_Tear& tear = *static_cast<Entity_Tear*>(g_game->Spawn({.position = shardPosition,
|
||||
@@ -1026,7 +1025,7 @@ void Entity_Knife::apply_hit_effects(const KnifeHit& hit)
|
||||
if (tearFlags[TEAR_BONE_FLAG])
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
float angle = random_unit() * RANDOM_HALF_TURN_KNIFE;
|
||||
float angle = random_unit() * PI_ROUGH;
|
||||
angle += angle;
|
||||
Vector velocity = vector_make(std::cos(angle) * shardSpeed, std::sin(angle) * shardSpeed);
|
||||
Entity_Tear& shard = bone_shard_spawn(*this, shardPosition, velocity, player);
|
||||
|
||||
@@ -31,7 +31,6 @@ constexpr float ATTRACTOR_SOFT_RANGE = 100;
|
||||
constexpr float HIT_SHOT_INTERVAL = 4;
|
||||
constexpr float HIT_CREEP_MARGIN = 15;
|
||||
constexpr float HIT_CREEP_SCALE = 0.4f;
|
||||
constexpr float STICKING_TEAR_SCALE_MIN = 0.01f;
|
||||
constexpr int CULTIST_STUCK_VARIANT = 10;
|
||||
constexpr float IMPACT_EXPLOSION_INTERVAL = 4;
|
||||
constexpr float RING_CONTINUUM_WRAP_MARGIN = -200;
|
||||
@@ -44,7 +43,6 @@ constexpr float IMPACT_EXPLOSION_REACH = 30;
|
||||
constexpr float IMPACT_EXPLOSION_GROWTH = 10;
|
||||
constexpr float IMPACT_EXPLOSION_PUSH = 10;
|
||||
constexpr float IMPACT_EXPLOSION_DAMAGE = 10;
|
||||
constexpr float IMPACT_SPLIT_HALF_TURN = 3.14f;
|
||||
constexpr float IMPACT_SPLIT_SPEED = 10;
|
||||
constexpr float IMPACT_SPLIT_BACKSTEP = 4;
|
||||
constexpr float IMPACT_SPLIT_HEIGHT = -11.875f;
|
||||
@@ -69,7 +67,6 @@ constexpr float SPLASH_SPEED_MIN = 4;
|
||||
constexpr float SPLASH_SPEED_RANGE = 6;
|
||||
constexpr float SPLASH_SPREAD = 3;
|
||||
constexpr float SPLASH_SCALE = 2;
|
||||
constexpr float SPLASH_HALF_TURN = 3.14f;
|
||||
constexpr float MARKED_SPLASH_SPEED_MIN = 2;
|
||||
constexpr float MARKED_SPLASH_SPEED_RANGE = 2;
|
||||
constexpr float MARKED_TINT_RED = 2;
|
||||
@@ -78,7 +75,6 @@ constexpr float MARKED_SOUND_VOLUME = 0.7f;
|
||||
constexpr int MARKED_SOUND_DELAY = 8;
|
||||
constexpr float MARKED_DAMAGE_EXTRA = 3;
|
||||
constexpr float PLAYER_HIT_DAMAGE = 1;
|
||||
constexpr int LASER_HIT_COUNTDOWN = 30;
|
||||
constexpr int GRID_HURT_CHANCE_MASK = 3;
|
||||
constexpr int SHIELD_RING_CHANCE = 50;
|
||||
constexpr int SHIELD_CHANCE = 5;
|
||||
@@ -144,7 +140,7 @@ void Entity_Laser::DoDamage(Entity* entity, float damage)
|
||||
{
|
||||
if (!isVersus)
|
||||
{
|
||||
entity->TakeDamage(PLAYER_HIT_DAMAGE, DAMAGE_LASER, EntityRef(source), LASER_HIT_COUNTDOWN);
|
||||
entity->TakeDamage(PLAYER_HIT_DAMAGE, DAMAGE_LASER, EntityRef(source), HIT_COUNTDOWN);
|
||||
return;
|
||||
}
|
||||
if (IsDescendantOf(entity)) return;
|
||||
@@ -154,7 +150,7 @@ void Entity_Laser::DoDamage(Entity* entity, float damage)
|
||||
(g_game->challenge == CHALLENGE_GUARDIAN && entity->variant == Entity_Familiar::PUNCHING_BAG)))
|
||||
{
|
||||
Entity_Player* player = static_cast<Entity_Familiar*>(entity)->player;
|
||||
player->TakeDamage(PLAYER_HIT_DAMAGE, DAMAGE_LASER | DAMAGE_ISAAC_HURT, EntityRef(source), LASER_HIT_COUNTDOWN);
|
||||
player->TakeDamage(PLAYER_HIT_DAMAGE, DAMAGE_LASER | DAMAGE_ISAAC_HURT, EntityRef(source), HIT_COUNTDOWN);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -175,7 +171,7 @@ void Entity_Laser::DoDamage(Entity* entity, float damage)
|
||||
if (roll.RandomFloat() < blackHpDropChance) damageFlags |= DAMAGE_SPAWN_BLACK_HEART;
|
||||
}
|
||||
if (isVersus && tearFlags[TEAR_LASERSHOT]) damageFlags |= DAMAGE_LASER;
|
||||
entity->TakeDamage(damage, damageFlags, EntityRef(source), LASER_HIT_COUNTDOWN);
|
||||
entity->TakeDamage(damage, damageFlags, EntityRef(source), HIT_COUNTDOWN);
|
||||
}
|
||||
|
||||
// 00971590 Hurts the grid entity in a cell the beam crosses. One time in four a standing one is broken by an Acid or
|
||||
@@ -330,7 +326,7 @@ void Entity_Laser::splash_spawn(const Vector& center, const Vector& along, float
|
||||
{
|
||||
uint32_t seed = Random();
|
||||
float speed = random_unit() * SPLASH_SPEED_RANGE + SPLASH_SPEED_MIN;
|
||||
float angle = random_unit() * SPLASH_HALF_TURN * 2;
|
||||
float angle = random_unit() * PI_ROUGH * 2;
|
||||
Vector velocity = vector_add(vector_make(std::cos(angle), std::sin(angle)), vector_scale(along, speed));
|
||||
float across = (to - from) * random_unit() + from;
|
||||
Vector position = vector_add(vector_add(center, vector_scale(side, across)),
|
||||
@@ -352,7 +348,7 @@ void Entity_Laser::splash_spawn(const Vector& center, const Vector& along, float
|
||||
color_multiply(marked, sprite.color);
|
||||
uint32_t seed = Random();
|
||||
float speed = random_unit() * MARKED_SPLASH_SPEED_RANGE + MARKED_SPLASH_SPEED_MIN;
|
||||
float angle = random_unit() * SPLASH_HALF_TURN * 2;
|
||||
float angle = random_unit() * PI_ROUGH * 2;
|
||||
Vector velocity = vector_add(vector_make(std::cos(angle), std::sin(angle)), vector_scale(along, speed));
|
||||
float across = (to - from) * random_unit() + from;
|
||||
Entity* spray = g_game->Spawn({.position = vector_add(center, vector_scale(side, across)),
|
||||
@@ -470,7 +466,7 @@ static void sticking_tear_fire(Entity_Laser& laser, Entity& entity, const Vector
|
||||
tear->Update();
|
||||
tear->SetTearFlags(flags);
|
||||
tear->SetCollisionDamage(laser.collisionDamage);
|
||||
float tearScale = std::max(laser.scale, STICKING_TEAR_SCALE_MIN);
|
||||
float tearScale = std::max(laser.scale, TEAR_SCALE_MIN);
|
||||
tear->baseScale = tearScale;
|
||||
tear->fScale = tearScale;
|
||||
tear->ResetSpriteScale();
|
||||
@@ -662,7 +658,7 @@ void Entity_Laser::impact_split(const Vector& position, const Vector& direction,
|
||||
if (!isFirstUpdate && GetIntervalTicks(IMPACT_EXPLOSION_INTERVAL, 0) == 0) return;
|
||||
|
||||
Vector at = g_game->room->GetClampedPositionImpl(position, 1, 1, 1, 1);
|
||||
float angle = random_unit() * IMPACT_SPLIT_HALF_TURN;
|
||||
float angle = random_unit() * PI_ROUGH;
|
||||
angle += angle;
|
||||
Vector velocity = vector_make(std::cos(angle) * IMPACT_SPLIT_SPEED, std::sin(angle) * IMPACT_SPLIT_SPEED);
|
||||
TearFlags flags = tearFlags;
|
||||
@@ -701,7 +697,7 @@ void Entity_Laser::impact_split(const Vector& position, const Vector& direction,
|
||||
if (g_game->room->roomType == ROOM_DUNGEON) tear->posOffset.y = IMPACT_SPLIT_CRAWLSPACE_Y;
|
||||
tear->SetTearFlags(flags);
|
||||
tear->SetCollisionDamage(collisionDamage * 0.5f);
|
||||
float tearScale = std::max(scale * IMPACT_SPLIT_SCALE, STICKING_TEAR_SCALE_MIN);
|
||||
float tearScale = std::max(scale * IMPACT_SPLIT_SCALE, TEAR_SCALE_MIN);
|
||||
tear->baseScale = tearScale;
|
||||
tear->fScale = tearScale;
|
||||
tear->ResetSpriteScale();
|
||||
@@ -903,7 +899,7 @@ void Entity_Laser::UpdateHits()
|
||||
else if (!isDead && !isInterpolating && variant == LASER_LIGHT_RING && GetIntervalTicks(LIGHT_RING_INTERVAL, 0))
|
||||
for (Entity* entity : entity_query_radius(pos, radius, QUERY_ENEMIES))
|
||||
if (entity->IsVulnerableEnemy(nullptr) && !IsDescendantOf(entity))
|
||||
entity->TakeDamage(collisionDamage, 0, EntityRef(this), LASER_HIT_COUNTDOWN);
|
||||
entity->TakeDamage(collisionDamage, 0, EntityRef(this), HIT_COUNTDOWN);
|
||||
|
||||
if (isHitFrame && (std::isfinite(impactDistance) || isGridHit))
|
||||
impact_tear_flag_effects(impactPosition, impactDirection);
|
||||
|
||||
+3
-2
@@ -404,11 +404,12 @@ static bool is_update_skipped(Entity& entity, UpdateMode mode)
|
||||
return isDrawnAway || (mode == UPDATE_TRANSITION && !entity.HasEntityFlags(FLAG_TRANSITION_UPDATE));
|
||||
}
|
||||
|
||||
// The damage an enemy has taken so far, which the frame's total compares before and after its update.
|
||||
// The damage an enemy (or a versus player, in this room) has taken so far, which the frame's total compares before and
|
||||
// after its update.
|
||||
static float damage_taken_get(Entity& entity)
|
||||
{
|
||||
if (!Entity::is_enemy_type(entity.type)) return 0;
|
||||
if (entity.type == ENTITY_PLAYER) reconstruction_missing("EntityList::Update 004186c0: a versus player's damage");
|
||||
if (entity.type == ENTITY_PLAYER) return (float)(uint32_t)static_cast<Entity_Player&>(entity).roomDamageTaken;
|
||||
return static_cast<Entity_NPC&>(entity).totalDamageTaken;
|
||||
}
|
||||
|
||||
|
||||
+110
-43
@@ -595,63 +595,78 @@ static int line_cell_collision(Room& room, int column, int row)
|
||||
return path >= GRID_PATH_SOLID ? COLLISION_SOLID : COLLISION_NONE;
|
||||
}
|
||||
|
||||
// Whether a blast stops at a cell: walls (but an unlocked lock or a door) and solid blocks.
|
||||
static bool line_cell_is_blast_wall(Room& room, int cellIndex)
|
||||
// Whether a blast stops at a cell: walls (but an unlocked lock, a door, or a wall when walls are ignored) and solid
|
||||
// blocks. With crushables ignored, a grid entity that can be crushed or walked stops it too.
|
||||
static bool line_cell_is_blast_wall(Room& room, int cellIndex, const LineQuery& check)
|
||||
{
|
||||
uint32_t collision = room.GetGridCollision(cellIndex);
|
||||
bool isKnown = cellIndex >= 0 && cellIndex < ROOM_GRID_CELLS;
|
||||
GridEntity* grid = isKnown ? room.gridEntities[cellIndex] : nullptr;
|
||||
if (collision == COLLISION_NONE) return false;
|
||||
if (!grid) return collision == COLLISION_WALL;
|
||||
if (grid->type == GRID_ROCKB) return true;
|
||||
if (collision != COLLISION_NONE && grid->type == GRID_ROCKB) return true;
|
||||
if (grid->type == GRID_LOCK && g_game->playerManager.AnyoneHasTrinket(TRINKET_BROKEN_PADLOCK)) return false;
|
||||
return grid->type != GRID_DOOR && collision == COLLISION_WALL;
|
||||
|
||||
bool isPassable = grid->type == GRID_DOOR || (grid->type == GRID_WALL && check.isIgnoreWalls);
|
||||
if (!isPassable && collision == COLLISION_WALL) return true;
|
||||
return check.isIgnoreCrushable && (grid->IsEasyCrushableOrWalkable() || grid->IsDangerousCrushableOrWalkable());
|
||||
}
|
||||
|
||||
// Whether a band corner's collision lets a line through: with crushables ignored, a grid entity in the grid that can
|
||||
// be crushed or walked does.
|
||||
static bool line_corner_is_crushable(Room& room, int column, int row, const LineQuery& check)
|
||||
{
|
||||
bool isInside = column >= 0 && column < room.gridWidth && row >= 0 && row < room.gridHeight;
|
||||
int gridIndex = isInside ? row * room.gridWidth + column : -1;
|
||||
if (!check.isIgnoreCrushable || gridIndex < 0 || gridIndex >= ROOM_GRID_CELLS) return false;
|
||||
|
||||
GridEntity* grid = room.gridEntities[gridIndex];
|
||||
return grid && (grid->IsEasyCrushableOrWalkable() || grid->IsDangerousCrushableOrWalkable());
|
||||
}
|
||||
|
||||
// 007f0df0 Whether a line from start to end is clear, walked in steps of 10: mode 0 checks a 10 wide band for grid
|
||||
// collision and for more than 8 cells walked past their grid path threshold, mode 1 the same on the line's own cells,
|
||||
// mode 2 the line's own cells for what stops a blast, mode 3 the band for shots (which fly over pits). Crushable
|
||||
// rocks and the stop position are left to come.
|
||||
bool room_check_line(const Vector& start, const Vector& end, int mode, int gridPathThreshold)
|
||||
// mode 2 the line's own cells for what stops a blast, mode 3 the band for shots (which fly over pits), and any other
|
||||
// mode nothing. The stop position, when asked, gets the step before the line was blocked, or the end.
|
||||
bool room_check_line(const LineQuery& check)
|
||||
{
|
||||
|
||||
Room& room = *g_game->room;
|
||||
Vector step = vector_sub(start, end);
|
||||
auto stop = [&](const Vector& position, bool isClear) {
|
||||
if (check.stopPosition) *check.stopPosition = position;
|
||||
return isClear;
|
||||
};
|
||||
Vector step = vector_sub(check.start, check.end);
|
||||
float length = vector_length(step);
|
||||
if (length <= 0) return true;
|
||||
if (length <= 0) return stop(check.end, true);
|
||||
|
||||
step = vector_scale(step, LINE_STEP / length);
|
||||
auto cellOf = [](float value, float origin) {
|
||||
return (int)((value - origin) / GRID_CELL_SIZE + HALF);
|
||||
};
|
||||
int startColumn = cellOf(start.x, GRID_ORIGIN_X);
|
||||
int startRow = cellOf(start.y, GRID_ORIGIN_Y);
|
||||
int startColumn = cellOf(check.start.x, GRID_ORIGIN_X);
|
||||
int startRow = cellOf(check.start.y, GRID_ORIGIN_Y);
|
||||
bool isStartInside =
|
||||
startColumn >= 0 && startColumn < room.gridWidth && startRow >= 0 && startRow < room.gridHeight;
|
||||
int startIndex = isStartInside ? room.gridWidth * startRow + startColumn : -1;
|
||||
|
||||
int blocked = 0;
|
||||
Vector at = start;
|
||||
Vector at = check.start;
|
||||
for (float walked = 0; walked < length; walked += LINE_STEP)
|
||||
{
|
||||
at = vector_sub(at, step);
|
||||
if (mode == LINE_MODE_EXPLOSION)
|
||||
Vector before = vector_add(at, step);
|
||||
if (check.mode != LINE_MODE_GROUND && check.mode != LINE_MODE_PROJECTILE)
|
||||
{
|
||||
int column = cellOf(at.x, GRID_ORIGIN_X);
|
||||
int row = cellOf(at.y, GRID_ORIGIN_Y);
|
||||
bool isInside = column >= 0 && column < room.gridWidth && row >= 0 && row < room.gridHeight;
|
||||
int cellIndex = isInside ? row * room.gridWidth + column : -1;
|
||||
if (line_cell_is_blast_wall(room, cellIndex)) return false;
|
||||
continue;
|
||||
}
|
||||
if (mode == LINE_MODE_CELL)
|
||||
{
|
||||
int column = cellOf(at.x, GRID_ORIGIN_X);
|
||||
int row = cellOf(at.y, GRID_ORIGIN_Y);
|
||||
bool isInside = column >= 0 && column < room.gridWidth && row >= 0 && row < room.gridHeight;
|
||||
int cellIndex = isInside ? row * room.gridWidth + column : -1;
|
||||
if (room.GetGridCollision(cellIndex) != COLLISION_NONE) return false;
|
||||
if (cellIndex != startIndex && cellIndex >= 0 && room.GetGridPath(cellIndex) > gridPathThreshold) blocked++;
|
||||
if (check.mode == LINE_MODE_EXPLOSION && line_cell_is_blast_wall(room, cellIndex, check))
|
||||
return stop(before, false);
|
||||
if (check.mode != LINE_MODE_CELL) continue;
|
||||
|
||||
if (room.GetGridCollision(cellIndex) != COLLISION_NONE) return stop(before, false);
|
||||
if (cellIndex != startIndex && cellIndex >= 0 && room.GetGridPath(cellIndex) > check.gridPathThreshold)
|
||||
blocked++;
|
||||
continue;
|
||||
}
|
||||
for (const LineCorner& corner : LINE_CORNERS)
|
||||
@@ -659,17 +674,22 @@ bool room_check_line(const Vector& start, const Vector& end, int mode, int gridP
|
||||
int column = cellOf(at.x + corner.x, GRID_ORIGIN_X);
|
||||
int row = cellOf(at.y + corner.y, GRID_ORIGIN_Y);
|
||||
int collision = line_cell_collision(room, column, row);
|
||||
if (mode == LINE_MODE_PROJECTILE && collision == COLLISION_PIT) continue;
|
||||
if (collision != COLLISION_NONE) return false;
|
||||
if (check.mode == LINE_MODE_PROJECTILE && collision == COLLISION_PIT) continue;
|
||||
if (collision != COLLISION_NONE)
|
||||
{
|
||||
if (line_corner_is_crushable(room, column, row, check)) continue;
|
||||
return stop(before, false);
|
||||
}
|
||||
|
||||
bool isInside = column >= 0 && column < room.gridWidth && row >= 0 && row < room.gridHeight;
|
||||
int cornerIndex = isInside ? row * room.gridWidth + column : -1;
|
||||
if (cornerIndex == startIndex) continue;
|
||||
int path = cornerIndex >= 0 ? room.GetGridPath(cornerIndex) : 0;
|
||||
if (mode == LINE_MODE_GROUND && path > gridPathThreshold) blocked++;
|
||||
if (check.mode == LINE_MODE_GROUND && path > check.gridPathThreshold) blocked++;
|
||||
}
|
||||
}
|
||||
return blocked <= LINE_BLOCKED_MAX;
|
||||
if (blocked > LINE_BLOCKED_MAX) return stop(vector_add(at, step), false);
|
||||
return stop(check.end, true);
|
||||
}
|
||||
|
||||
// The suppression the console sets so its next spawned NPC is not rolled a champion (the original's 00c71670).
|
||||
@@ -2222,8 +2242,7 @@ bool Entity_NPC::TakeDamage(float damage, uint64_t damageFlags, const EntityRef&
|
||||
Entity_Player* player =
|
||||
attacker && attacker->type == ENTITY_PLAYER ? static_cast<Entity_Player*>(attacker) : game_nearest_player(pos);
|
||||
if (damageFlags & DAMAGE_SPAWN_FLY) player->AddBlueFlies(1, player->pos, this);
|
||||
if (!player->proceduralItems.empty())
|
||||
reconstruction_missing("Entity_NPC::TakeDamage 006d60a0: the attacker's on-hit procedural items");
|
||||
glitched_items_hit_trigger(*player, *this, CONDITION_ENEMY_HIT);
|
||||
return isHurt;
|
||||
}
|
||||
|
||||
@@ -2461,7 +2480,7 @@ Vector Entity_NPC::CalcTargetPosition(float distanceLimit)
|
||||
g_game->frameCount % CONFUSION_RETARGET_FRAMES != 0);
|
||||
if (!isKept)
|
||||
{
|
||||
float angle = random_unit() * RANDOM_HALF_TURN;
|
||||
float angle = random_unit() * PI_ROUGH;
|
||||
angle += angle;
|
||||
float scaleFirst = random_unit();
|
||||
float distance = random_unit() * scaleFirst * CONFUSION_WANDER;
|
||||
@@ -3119,18 +3138,32 @@ Vector Entity_NPC::GetControllerMovementInput(float deadzone)
|
||||
return controller_input_finish(input, deadzone);
|
||||
}
|
||||
|
||||
// 006d9050 Keeps the controlling player's last movement, or none without one.
|
||||
void Entity_NPC::UpdateControllerMovement(bool)
|
||||
// 006d9050 Keeps the controlling player's shooting input as its movement, the last one held unless forced to take
|
||||
// any (none included), or none without a player.
|
||||
void Entity_NPC::UpdateControllerMovement(bool isForceUpdate)
|
||||
{
|
||||
if (controllerID == -1)
|
||||
{
|
||||
controllerMovement = {};
|
||||
return;
|
||||
}
|
||||
reconstruction_missing("Entity_NPC::UpdateControllerMovement 006d9050");
|
||||
|
||||
Vector input = GetControllerMovementInput(MOVEMENT_DEADZONE);
|
||||
if (isForceUpdate || !vector_is_zero(input)) controllerMovement = input;
|
||||
}
|
||||
|
||||
// The rest of Entity_NPC is not reconstructed yet.
|
||||
// 006d9320 Steers it by the controlling player's walking input: the input times the acceleration and its speed
|
||||
// multiplier added to its velocity under a friction its multiplier eases, capped at a top speed.
|
||||
void Entity_NPC::apply_controller_movement(float acceleration, float drag, float maxSpeed)
|
||||
{
|
||||
float scaledDrag = drag;
|
||||
if (speedMultiplier != 1) scaledDrag = drag / (speedMultiplier + drag - speedMultiplier * drag);
|
||||
|
||||
Vector input = GetControllerInput(0);
|
||||
velocity = vector_add(vector_scale(input, acceleration * speedMultiplier), vector_scale(velocity, scaledDrag));
|
||||
float speed = vector_length(velocity);
|
||||
if (speed > maxSpeed && speed > 0) velocity = vector_scale(velocity, maxSpeed / speed);
|
||||
}
|
||||
|
||||
// 006d9440 Thrown: a poop pile flies at the throw's velocity from 20 pixels up at the throw's height, stops being kept
|
||||
// across rooms, gets the thrown flag (colliding with everything when a player threw it) and splats when fast. Other
|
||||
@@ -3330,11 +3363,38 @@ void Entity_NPC::TransferControl(Entity_NPC* target)
|
||||
controllerID = -1;
|
||||
}
|
||||
|
||||
// 006d8b20 The aim target a controlled NPC steers. Without a controller and none shown yet, there is nothing to do.
|
||||
void Entity_NPC::SpawnControlTarget(int inputMode, float)
|
||||
// 006d8b20 Shows the aim target a controlled NPC steers, turned by rotation, for two frames more: an aim target that
|
||||
// is no effect goes first. A new one (1000.30, never timing out, tinted red) appears only on the input its mode
|
||||
// watches (shooting, walking or none).
|
||||
void Entity_NPC::SpawnControlTarget(int inputMode, float rotation)
|
||||
{
|
||||
if (!aimTargetEffect && controllerID == -1 && inputMode <= 1) return;
|
||||
reconstruction_missing("Entity_NPC::SpawnControlTarget 006d8b20");
|
||||
Entity* target = aimTargetEffect;
|
||||
if (target && target->type != ENTITY_EFFECT)
|
||||
{
|
||||
target->Remove();
|
||||
aimTargetEffect = nullptr;
|
||||
target = nullptr;
|
||||
}
|
||||
|
||||
if (!target)
|
||||
{
|
||||
if (inputMode == CONTROL_INPUT_SHOOT && vector_is_zero(GetControllerMovementInput(0))) return;
|
||||
if (inputMode == CONTROL_INPUT_WALK && vector_is_zero(GetControllerInput(0))) return;
|
||||
|
||||
auto* spawned = static_cast<Entity_Effect*>(g_game->Spawn(
|
||||
{.position = pos, .spawner = this, .type = ENTITY_EFFECT, .variant = EFFECT_TARGET, .seed = Random()}));
|
||||
spawned->timeout = 0;
|
||||
spawned->lifespan = 0;
|
||||
spawned->Update();
|
||||
spawned->sprite.color = CONTROL_TARGET_COLOR;
|
||||
aimTargetEffect = spawned;
|
||||
target = spawned;
|
||||
}
|
||||
|
||||
auto& effect = static_cast<Entity_Effect&>(*target);
|
||||
effect.rotation = rotation;
|
||||
effect.varData[1] = CONTROL_TARGET_FRAMES;
|
||||
effect.varData[2] = (uint32_t)inputMode;
|
||||
}
|
||||
|
||||
// 006d8d30 Where its aim target stands, or its own position without one.
|
||||
@@ -3343,10 +3403,17 @@ Vector Entity_NPC::GetAimTargetPosition()
|
||||
return aimTargetEffect ? aimTargetEffect->pos : pos;
|
||||
}
|
||||
|
||||
// 006d8d80
|
||||
// 006d8d80 Whether the controlling player lets its aim target be: no input on the one its mode watches (always for
|
||||
// the mode watching none, the shooting input for an aim target that is no effect). Never without an aim target.
|
||||
bool Entity_NPC::is_controller_input_idle()
|
||||
{
|
||||
reconstruction_missing("Entity_NPC::is_controller_input_idle 006d8d80");
|
||||
Entity* target = aimTargetEffect;
|
||||
if (!target) return false;
|
||||
|
||||
int mode = target->type == ENTITY_EFFECT ? (int)static_cast<Entity_Effect*>(target)->varData[2] : CONTROL_INPUT_SHOOT;
|
||||
if (mode == CONTROL_INPUT_SHOOT) return vector_is_zero(GetControllerMovementInput(MOVEMENT_DEADZONE));
|
||||
if (mode == CONTROL_INPUT_WALK) return vector_is_zero(GetControllerInput(MOVEMENT_DEADZONE));
|
||||
return mode == CONTROL_INPUT_NONE;
|
||||
}
|
||||
|
||||
// 006d8e40 A controlled NPC's charge bar at value between start and end, hidden when full if asked.
|
||||
|
||||
+41
-1
@@ -71,6 +71,26 @@ constexpr int MULLIGAN_VARIANT_FLEEING = 2;
|
||||
// Movement or controller input below this length counts as standing still.
|
||||
constexpr float MOVEMENT_DEADZONE = 0.1f;
|
||||
|
||||
// The input a controlled NPC's aim target appears on (SpawnControlTarget's mode): its controller's shooting input,
|
||||
// its walking input, or none, shown at once.
|
||||
enum ControlTargetInput : int
|
||||
{
|
||||
CONTROL_INPUT_SHOOT,
|
||||
CONTROL_INPUT_WALK,
|
||||
CONTROL_INPUT_NONE
|
||||
};
|
||||
|
||||
// A controlled NPC's aim target: the frames it outlasts its last refresh, and its red tint.
|
||||
constexpr uint32_t CONTROL_TARGET_FRAMES = 2;
|
||||
// A controlled NPC gliding through a leap: its acceleration, a drag that eases as it glides, and its top speed. The
|
||||
// range it attacks within, which a controller's input decides alone.
|
||||
constexpr float CONTROL_STEER_ACCEL = 3;
|
||||
constexpr float CONTROL_STEER_DRAG = 1.25f;
|
||||
constexpr float CONTROL_STEER_DRAG_FALL = 0.20000005f;
|
||||
constexpr float CONTROL_STEER_SPEED = 30;
|
||||
constexpr float CONTROLLED_ATTACK_RANGE = 1000;
|
||||
constexpr ColorMod CONTROL_TARGET_COLOR = {{155 / 255.0f, 0, 0, 1}, {0, 0, 0, 0}, {0, 0, 0}};
|
||||
|
||||
// Lua's ChampionColor values the NPC code tests.
|
||||
enum ChampionColor : int
|
||||
{
|
||||
@@ -369,6 +389,7 @@ struct Entity_NPC : Entity
|
||||
Vector GetControllerMovementInput(float deadzone);
|
||||
bool is_controller_input_idle();
|
||||
void UpdateControllerMovement(bool isForceUpdate);
|
||||
void apply_controller_movement(float acceleration, float drag, float maxSpeed);
|
||||
void UpdateChildEffectPosition(bool isPredictMovement);
|
||||
void TransferControl(Entity_NPC* target);
|
||||
void SpawnControlTarget(int inputMode, float rotation);
|
||||
@@ -406,6 +427,19 @@ enum LineCheckMode : int
|
||||
};
|
||||
constexpr int LINE_CHECK_THRESHOLD = 999;
|
||||
|
||||
// A line to check (Room::CheckLine's arguments): from start to end in a mode, the grid path threshold walkers pass,
|
||||
// whether walls and crushable grid entities are ignored, and where to put the position the line stops at.
|
||||
struct LineQuery
|
||||
{
|
||||
Vector start{};
|
||||
Vector end{};
|
||||
Vector* stopPosition = nullptr;
|
||||
int mode = LINE_MODE_GROUND;
|
||||
int gridPathThreshold = 0;
|
||||
bool isIgnoreCrushable = false;
|
||||
bool isIgnoreWalls = false;
|
||||
};
|
||||
|
||||
// The pitch of G FUEL!'s explosions and bursts, 0.9 to 1.1.
|
||||
constexpr float GFUEL_BLAST_PITCH = 0.9f;
|
||||
constexpr float GFUEL_BLAST_PITCH_RANGE = 0.2f;
|
||||
@@ -447,6 +481,12 @@ constexpr size_t SHEET_EXTENSION_SIZE = 4;
|
||||
constexpr std::string_view CHAMPION_SUFFIX = "_champion";
|
||||
std::string sheet_path_resolve(const std::string& path, std::string_view floorSuffix, std::string_view championSuffix,
|
||||
bool& isChampionSheet);
|
||||
bool room_check_line(const Vector& start, const Vector& end, int mode, int gridPathThreshold);
|
||||
bool room_check_line(const LineQuery& check);
|
||||
|
||||
// Room::CheckLine without the walls, crushables or stop position.
|
||||
inline bool room_check_line(const Vector& start, const Vector& end, int mode, int gridPathThreshold)
|
||||
{
|
||||
return room_check_line({.start = start, .end = end, .mode = mode, .gridPathThreshold = gridPathThreshold});
|
||||
}
|
||||
std::vector<LootEntry> shopkeeper_loot_get(Entity_NPC& npc, bool isAdvance);
|
||||
bool entity_is_prey(Entity& prey);
|
||||
@@ -22,7 +22,6 @@ constexpr uint32_t DROP_CHANCE_HARD = 33;
|
||||
constexpr uint32_t DROP_CHANCE_PURPLE_HEART = 50;
|
||||
constexpr uint32_t DROP_CHANCE_PURPLE_HEART_DOUBLE = 66;
|
||||
constexpr uint32_t DROP_CHANCE_PURPLE_HEART_TRIPLE = 75;
|
||||
constexpr uint32_t PERCENT = 100;
|
||||
constexpr uint32_t VOID_DROP_ODDS = 20;
|
||||
constexpr uint32_t VOID_DROP_ODDS_SURE = 7;
|
||||
constexpr int PURPLE_HEART_TRIPLE = 3;
|
||||
|
||||
@@ -23,6 +23,8 @@ constexpr float HEALTH_BAR_DROP = 10;
|
||||
|
||||
// Part of 006d2e50 The dummy shows the damage it took (its v1.x) to two places, centred 28 above it.
|
||||
constexpr float DUMMY_TEXT_RISE = 28;
|
||||
// The health a persistent boss shows in the debug damage view (debug 7).
|
||||
constexpr KColor DEBUG_HEALTH_COLOR = kcolor_rgba(1, 0, 1, 0.5f);
|
||||
|
||||
// The health bar's sheet: left cap, stretched middle and right cap 8 high in the top row, the fill below the middle.
|
||||
// Its width grows with the log of the NPC's toughness, from 8 to 48. The fill's hue runs from red (none left) to green,
|
||||
@@ -469,7 +471,12 @@ void Entity_NPC::Render(const Vector& offset)
|
||||
chargeBarSprite.Render(SpriteDraw{at, {}, {}});
|
||||
}
|
||||
if (HasEntityFlags(FLAG_PERSISTENT | FLAG_DELIRIUM_FORM) && (g_game->debugFlags & DEBUG_DAMAGE_VALUES))
|
||||
reconstruction_missing("Entity_NPC::Render 006d2e50: the debug health text");
|
||||
{
|
||||
FontSettings settings(ALIGN_CENTER);
|
||||
g_manager->font2_TeamMeatEx12.DrawString(std::format("{:.2f}", health),
|
||||
vector_add(render_position_get(pos, RENDER_SNAPPED), offset),
|
||||
vector_make(1, 1), DEBUG_HEALTH_COLOR, settings);
|
||||
}
|
||||
}
|
||||
|
||||
// The fade of a Fissure layer at a depth: gone above the floor, or below it in the reflection.
|
||||
|
||||
@@ -103,7 +103,7 @@ constexpr float KEEPER_BOSS_HEALTH_STEP = 10;
|
||||
// A pickup thrown out of the dead enemy in a random direction at two to five, gone after a while.
|
||||
static void reward_pickup_throw(Entity_NPC& npc, const EntitySpawn& spawn, int timeout)
|
||||
{
|
||||
float angle = random_unit() * RANDOM_HALF_TURN;
|
||||
float angle = random_unit() * PI_ROUGH;
|
||||
angle += angle;
|
||||
float sine = std::sin(angle);
|
||||
float speed = random_unit() * DROP_SPEED_RANGE + DROP_SPEED_MIN;
|
||||
@@ -418,7 +418,7 @@ static void bone_spurs_spawn(Entity_NPC& npc, Entity_Player& owner)
|
||||
}
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
float angle = random_unit() * RANDOM_HALF_TURN;
|
||||
float angle = random_unit() * PI_ROUGH;
|
||||
angle += angle;
|
||||
float sine = std::sin(angle);
|
||||
float push = random_unit() + 1;
|
||||
@@ -481,7 +481,7 @@ static void kill_item_rewards(Entity_NPC& npc)
|
||||
if (g_game->challenge == CHALLENGE_CANTRIPPED && npc.dropRNG.Next() % CANTRIPPED_ODDS == 0)
|
||||
{
|
||||
uint32_t seed = Random();
|
||||
float angle = random_unit() * RANDOM_HALF_TURN;
|
||||
float angle = random_unit() * PI_ROUGH;
|
||||
angle += angle;
|
||||
Vector direction =
|
||||
vector_make(std::cos(angle) * CANTRIPPED_CARD_SPEED, std::sin(angle) * CANTRIPPED_CARD_SPEED);
|
||||
|
||||
+39
-23
@@ -60,7 +60,6 @@ constexpr float VERSUS_CHEST_VOLUME = 0.7f;
|
||||
constexpr int TRINKET_APPLE_OF_SODOM = 140;
|
||||
constexpr int TRINKET_NUH_UH = 165;
|
||||
constexpr int COLLECTIBLE_MITRE = 173;
|
||||
constexpr int SPECIAL_DAILY_NICKELS = 7;
|
||||
|
||||
// A bed of subtype 10 is held like the ending pickups, a while untouchable. The barren room's bed is torn, and Pay To
|
||||
// Play's chests show a coin slot.
|
||||
@@ -202,7 +201,6 @@ constexpr int CARD_SUIT_CHANCE = 10;
|
||||
|
||||
// Pickup motion and timing.
|
||||
constexpr int COLLISION_COOLDOWN = 10;
|
||||
constexpr int THROWN_PICKUP_HIT_COUNTDOWN = 30;
|
||||
constexpr int SETTLE_FRAMES = 6;
|
||||
constexpr float PICKUP_REPOSITION_STEP = 40;
|
||||
constexpr int APPEAR_KICK = 15;
|
||||
@@ -463,7 +461,7 @@ static void coin_subtype_pick(PickupChoice& choice, RNG& rng)
|
||||
return;
|
||||
}
|
||||
}
|
||||
bool isNickelDaily = g_game->dailyChallenge.specialDailyId == SPECIAL_DAILY_NICKELS;
|
||||
bool isNickelDaily = g_game->dailyChallenge.specialDailyId == SPECIAL_DAILY_APRIL_FOOLS;
|
||||
if (kind == COIN_NICKEL && isNickelDaily) kind = COIN_STICKYNICKEL;
|
||||
}
|
||||
|
||||
@@ -1153,7 +1151,7 @@ static void rotten_heart_drip(Entity_Pickup& heart)
|
||||
constexpr float DRIP_SPEED = 3;
|
||||
constexpr uint32_t DRIP_ODDS = 3;
|
||||
constexpr uint32_t WORMS_MAX = 3;
|
||||
constexpr float WORM_TURN = 2 * 3.14f;
|
||||
constexpr float WORM_TURN = 2 * PI_ROUGH;
|
||||
|
||||
bool isLanding = heart.sprite.animState.animData && heart.sprite.IsEventTriggered("DropSound");
|
||||
if (!isLanding && !(vector_length(heart.velocity) > DRIP_SPEED && Random() % DRIP_ODDS == 0)) return;
|
||||
@@ -1863,6 +1861,30 @@ static void bed_touch(Entity_Pickup& bed, Entity_Player& player)
|
||||
g_game->itemOverlay.Show(isMomsBed && isHome ? GIANTBOOK_SLEEP_NIGHTMARE : GIANTBOOK_SLEEP, 0, nullptr);
|
||||
}
|
||||
|
||||
// A co-op copy of an item taken while more players live than copies made leaves the next copy, a boss pool item, where
|
||||
// the item was (beside it when the pedestal keeps an item), unless Tainted Isaac took the item into his inventory.
|
||||
// The copy's index setter (006e2ff0) is inlined.
|
||||
static void coop_copy_spawn(Entity_Pickup& pickup, Entity& collider)
|
||||
{
|
||||
bool isInventoried = pickup.subtype != 0 && collider.type == ENTITY_PLAYER &&
|
||||
static_cast<Entity_Player&>(collider).playerType == PLAYER_ISAAC_B;
|
||||
if (pickup.coopDuplicateIndex + 1 >= g_game->playerManager.GetNumAlivePlayers() || isInventoried) return;
|
||||
|
||||
Vector position = pickup.pos;
|
||||
if (pickup.subtype == 0) pickup.Remove();
|
||||
else position = room_free_pickup_position_find({.position = pickup.pos, .step = PICKUP_SPOT_STEP, .isAvoidActiveEntities = true});
|
||||
int id = g_game->itemPool.GetCollectible(POOL_BOSS, pickup.dropRNG.Next(), 0, 0, 0);
|
||||
auto* copy = static_cast<Entity_Pickup*>(g_game->Spawn({.position = position,
|
||||
.subType = id,
|
||||
.type = ENTITY_PICKUP,
|
||||
.variant = PICKUP_COLLECTIBLE,
|
||||
.seed = pickup.dropRNG.Next()}));
|
||||
copy->coopDuplicateIndex = pickup.coopDuplicateIndex + 1;
|
||||
if (copy->coopDuplicateIndex != 0 && copy->coopDuplicateIndex != -1) copy->cycleCollectibleCount = 0;
|
||||
copy->Update();
|
||||
if (pickup.subtype != 0) pickup.coopDuplicateIndex = -1;
|
||||
}
|
||||
|
||||
// 006e8ae0 A player touching the pickup collects it (hearts, coins, keys and bombs into their counters), plays its
|
||||
// pickup sound and animation and marks it dead. Coop ghosts, babies and players who cannot pick up take only a few
|
||||
// kinds. Whether the collision is solid: a priced or collected pickup and players' bombs pass through.
|
||||
@@ -1897,7 +1919,7 @@ bool Entity_Pickup::HandleCollision(Entity* collider, bool isLow)
|
||||
return false;
|
||||
if (g_game->seedEffects.HasSeedEffect(SEED_PICKUPS_TIMEOUT)) ResetColor();
|
||||
if (HasEntityFlags(FLAG_THROWN) && spawnerType == ENTITY_POLTY && g_forceCollideDepth == 0)
|
||||
collider->TakeDamage(1, 0, EntityRef(this), THROWN_PICKUP_HIT_COUNTDOWN);
|
||||
collider->TakeDamage(1, 0, EntityRef(this), HIT_COUNTDOWN);
|
||||
}
|
||||
if (variant == PICKUP_COIN && subtype == COIN_STICKYNICKEL)
|
||||
{
|
||||
@@ -1932,7 +1954,7 @@ bool Entity_Pickup::HandleCollision(Entity* collider, bool isLow)
|
||||
RemoveOtherOptions();
|
||||
g_game->scoreSheet.add_pickup_points(variant, subtype, pos);
|
||||
PlayPickupSound();
|
||||
collect_finish(nullptr);
|
||||
collect_finish();
|
||||
return true;
|
||||
}
|
||||
return g_game->room->roomType == ROOM_DUNGEON || collider->type == ENTITY_BOMB || price != 0;
|
||||
@@ -1956,9 +1978,9 @@ bool Entity_Pickup::HandleCollision(Entity* collider, bool isLow)
|
||||
bool isHelperRefused = is_listed({PICKUP_TAROTCARD, PICKUP_PILL, PICKUP_TRINKET, PICKUP_BED, PICKUP_BIGCHEST,
|
||||
PICKUP_TROPHY},
|
||||
variant);
|
||||
if (player->variant == 1 && player->babySkin == BABY_MAGNET && CanReroll())
|
||||
reconstruction_missing("Entity_Pickup::HandleCollision 006e8ae0: a co-op baby rerolling it");
|
||||
if (player->variant != 0) isRefused = true;
|
||||
bool isMagnetBaby = player->variant == PLAYER_VARIANT_COOP_BABY && player->babySkin == BABY_MAGNET &&
|
||||
variant != PICKUP_COLLECTIBLE && CanReroll();
|
||||
if (player->variant != 0 && !isMagnetBaby) isRefused = true;
|
||||
else if (player->isCoopGhost) isRefused |= !isGhostPickup;
|
||||
else isRefused |= (player->parent && isHelperRefused) ||
|
||||
(variant == PICKUP_COLLECTIBLE && is_collectible_refused(*player));
|
||||
@@ -2061,14 +2083,12 @@ bool Entity_Pickup::HandleCollision(Entity* collider, bool isLow)
|
||||
|
||||
g_game->scoreSheet.add_pickup_points(variant, collectedSubtype, pos);
|
||||
if (variant != PICKUP_COLLECTIBLE) PlayPickupSound();
|
||||
glitched_items_trigger(*player, {pos, {}, this, CONDITION_PICKUP_COLLECTED});
|
||||
if (paidPrice != 0) purchase_finish(*player, paidPrice);
|
||||
else if (variant == PICKUP_TRINKET) trinket_lift(*this, *player);
|
||||
else if (variant != PICKUP_COLLECTIBLE) collect_finish(player);
|
||||
if ((variant == PICKUP_COLLECTIBLE || paidPrice != 0) && !player->proceduralItems.empty())
|
||||
reconstruction_missing("Entity_Pickup::HandleCollision 006e8ae0: the procedural items' pickup trigger");
|
||||
else if (variant != PICKUP_COLLECTIBLE) collect_finish();
|
||||
|
||||
if (g_game->playerManager.IsCoopPlay() && coopDuplicateIndex != -1)
|
||||
reconstruction_missing("Entity_Pickup::HandleCollision 006e8ae0: a co-op item copy");
|
||||
if (g_game->playerManager.IsCoopPlay() && coopDuplicateIndex != -1) coop_copy_spawn(*this, *collider);
|
||||
return variant != PICKUP_COLLECTIBLE || g_game->room->roomType == ROOM_DUNGEON || price != 0;
|
||||
}
|
||||
|
||||
@@ -2093,13 +2113,10 @@ static void golden_penny_return(Entity_Pickup& penny)
|
||||
g_pickupIgnoreModifiers--;
|
||||
}
|
||||
|
||||
// The end of a collection: the procedural items' triggers, the pickup flying into its "Collect" animation and dying,
|
||||
// and the run's note that a heart, bomb or coin was picked up.
|
||||
void Entity_Pickup::collect_finish(Entity_Player* player)
|
||||
// The end of a collection: the pickup flying into its "Collect" animation and dying, and the run's note that a heart,
|
||||
// bomb or coin was picked up.
|
||||
void Entity_Pickup::collect_finish()
|
||||
{
|
||||
if (player && !player->proceduralItems.empty())
|
||||
reconstruction_missing("Entity_Pickup::HandleCollision 006e8ae0: the procedural items' pickup trigger");
|
||||
|
||||
velocity = {};
|
||||
entityCollisionClass = ENTCOLL_NONE;
|
||||
entityGridCollisionClass = GRIDCOLL_WALLS;
|
||||
@@ -2230,10 +2247,10 @@ static void apple_of_sodom_burst(Entity_Pickup& heart, Entity_Player& player, in
|
||||
effect.variant = EFFECT_BLOOD_PARTICLE;
|
||||
for (int gibs = (int)(Random() % SODOM_EXTRA_ODDS) + spiders; gibs > 0; gibs--)
|
||||
{
|
||||
float angle = random_unit() * RANDOM_HALF_TURN * 2;
|
||||
float angle = random_unit() * PI_ROUGH * 2;
|
||||
float reach = HALF * heart.size;
|
||||
effect.position = vector_make(std::cos(angle) * reach + heart.pos.x, std::sin(angle) * reach + heart.pos.y);
|
||||
float heading = random_unit() * RANDOM_HALF_TURN * 2;
|
||||
float heading = random_unit() * PI_ROUGH * 2;
|
||||
float speed = random_between(SODOM_GIB_SPEED_MIN, SODOM_GIB_SPEED_RANGE);
|
||||
effect.velocity = vector_make(std::cos(heading) * speed, std::sin(heading) * speed);
|
||||
effect.seed = Random();
|
||||
@@ -2579,7 +2596,6 @@ void Entity_Pickup::PlayDropSound()
|
||||
}
|
||||
|
||||
// 006e7dc0 Plays the sound of the pickup being collected, by its kind.
|
||||
// An item's fanfare is not reconstructed yet.
|
||||
void Entity_Pickup::PlayPickupSound()
|
||||
{
|
||||
int sound = 0;
|
||||
|
||||
+1
-1
@@ -256,7 +256,7 @@ private:
|
||||
void coin_collect(Entity_Player& player);
|
||||
bool key_collect(Entity_Player& player);
|
||||
bool bomb_collect(Entity_Player& player);
|
||||
void collect_finish(Entity_Player* player);
|
||||
void collect_finish();
|
||||
|
||||
// The chests' parts of HandleCollision and TryOpenChest (entity_pickup_chest.cpp).
|
||||
bool chest_touch(Entity_Player& player);
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
constexpr int OUTCOME_SHIFT_INDEX = 35;
|
||||
constexpr int LOOT_ANGLE_SHIFT_INDEX = 18;
|
||||
constexpr int LOOT_DROP_SHIFT_INDEX = 12;
|
||||
constexpr float LOOT_ANGLE_SCALE = 3.14f;
|
||||
|
||||
// The chests a player opens by touch, a key for the locked ones, and their pedestals for the items they give.
|
||||
constexpr std::array<int, 3> LOCKED_CHESTS = {PICKUP_LOCKEDCHEST, PICKUP_ETERNALCHEST, PICKUP_OLDCHEST};
|
||||
@@ -760,7 +759,7 @@ void Entity_Pickup::chest_loot_spawn(const LootList& loot, Entity_Player& player
|
||||
Vector velocity = GetRandomPickupVelocity(pos, &dropRng, 0);
|
||||
RNG angleRng;
|
||||
angleRng.SetSeed(dropRng.Next(), LOOT_ANGLE_SHIFT_INDEX);
|
||||
float angle = angleRng.RandomFloat() * LOOT_ANGLE_SCALE * 2;
|
||||
float angle = angleRng.RandomFloat() * PI_ROUGH * 2;
|
||||
Entity* out = g_game->Spawn({.position = vector_make(std::cos(angle) + pos.x, std::sin(angle) + pos.y),
|
||||
.velocity = vector_make(velocity.x * speed, velocity.y * speed),
|
||||
.subType = entry.subType,
|
||||
|
||||
@@ -64,7 +64,7 @@ void Entity_Pickup::Morph(int entityType, int entityVariant, int entitySubType,
|
||||
initSeed = rng.Next();
|
||||
}
|
||||
if (g_game->deathmatchManager.is_active())
|
||||
reconstruction_missing("Entity_Pickup::Morph 006e30a0 (the deathmatch's blacklist)");
|
||||
g_game->deathmatchManager.type->pickup_replace_banned(entityType, entityVariant, entitySubType);
|
||||
std::array<EntityPtr, 2> megaPair = megaChestCollectible;
|
||||
std::shared_ptr<EntitySaveState> flipOther = flipSaveState;
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@ constexpr float PICKUP_VELOCITY_CHALLENGE = 0.4f;
|
||||
constexpr float PICKUP_VELOCITY_LOB = 0.2f;
|
||||
constexpr float PICKUP_VELOCITY_LOB_BASE = 3;
|
||||
constexpr float PICKUP_VELOCITY_REACH = 7;
|
||||
constexpr float PICKUP_VELOCITY_ROUND = 3.14f;
|
||||
constexpr float PICKUP_VELOCITY_SCALE = 2.3283062e-10f;
|
||||
constexpr int PICKUP_VELOCITY_TRIES = 10;
|
||||
constexpr int PRICE_DIGITS = 10;
|
||||
@@ -425,7 +424,7 @@ Vector Entity_Pickup::GetRandomPickupVelocity(const Vector& position, RNG* rng,
|
||||
value ^= value >> 14;
|
||||
unit = (float)value * PICKUP_VELOCITY_SCALE;
|
||||
}
|
||||
float angle = unit * PICKUP_VELOCITY_ROUND + unit * PICKUP_VELOCITY_ROUND;
|
||||
float angle = unit * PI_ROUGH + unit * PI_ROUGH;
|
||||
velocity = vector_make(std::cos(angle) * PICKUP_VELOCITY_SPEED, std::sin(angle) * PICKUP_VELOCITY_SPEED);
|
||||
if (ePickupVelType != 0) velocity.y = velocity.y * PICKUP_VELOCITY_LOB + PICKUP_VELOCITY_LOB_BASE;
|
||||
else if (g_game->room->roomType == ROOM_CHALLENGE) velocity = vector_scale(velocity, PICKUP_VELOCITY_CHALLENGE);
|
||||
|
||||
+26
-61
@@ -61,7 +61,6 @@ constexpr int ASCENT_HOME_STAGE = 6;
|
||||
constexpr int CAINS_EYE_CHANCE = 25;
|
||||
constexpr int CANTRIPPED_CARDS = 3;
|
||||
constexpr int CARD_START_RUNE_CHANCE = 10;
|
||||
constexpr int DAILY_CHRISTMAS = 19;
|
||||
constexpr int EMPTY_HEART_RED_HEARTS = 3;
|
||||
constexpr int EVENT_BONUS_ITEMS = 114;
|
||||
constexpr int START_ITEM_ROLLS = 100;
|
||||
@@ -95,10 +94,9 @@ static bool is_file_found(const std::string& path)
|
||||
static ColorMod color_from_bytes(int tintRed, int tintGreen, int tintBlue, int tintAlpha, int offsetRed,
|
||||
int offsetGreen, int offsetBlue)
|
||||
{
|
||||
constexpr float BYTE = 1.0f / 255;
|
||||
return {{tintRed * BYTE, tintGreen * BYTE, tintBlue * BYTE, tintAlpha * BYTE},
|
||||
return {{tintRed * BYTE_TO_UNIT, tintGreen * BYTE_TO_UNIT, tintBlue * BYTE_TO_UNIT, tintAlpha * BYTE_TO_UNIT},
|
||||
{0, 0, 0, 0},
|
||||
{offsetRed * BYTE, offsetGreen * BYTE, offsetBlue * BYTE}};
|
||||
{offsetRed * BYTE_TO_UNIT, offsetGreen * BYTE_TO_UNIT, offsetBlue * BYTE_TO_UNIT}};
|
||||
}
|
||||
|
||||
// A random card as the run hands one out: drawn from a seed, then offered to the mods' card callback.
|
||||
@@ -210,6 +208,7 @@ void Entity_Player::Init(int entityType, int entityVariant, int subType, uint32_
|
||||
log_printf(LOG_INFO, "[Frame: %d] Initialized player with Variant %d and Subtype %d\n", manager.framecount,
|
||||
entityVariant, entitySubType);
|
||||
temporaryEffects.ClearEffects(true);
|
||||
isCoPlayerItemsInvalid = false;
|
||||
stats_reset();
|
||||
|
||||
tonsilCounter = (short)(trinketRNGs[TRINKET_TONSIL].Next() % TONSIL_COUNTER_RANGE + TONSIL_COUNTER_MIN);
|
||||
@@ -269,8 +268,7 @@ void Entity_Player::Init(int entityType, int entityVariant, int subType, uint32_
|
||||
babyFamiliar = nullptr;
|
||||
if (variant == PLAYER_VARIANT_COOP_BABY)
|
||||
{
|
||||
if (babySkin == BABY_BLOAT || babySkin == BABY_YBAB || babySkin == BABY_APOLLYON)
|
||||
reconstruction_missing("Entity_Player::Init 00755470 (the co-op babies that come with a familiar)");
|
||||
baby_companions_spawn(initRng);
|
||||
hasBabyRoomShield = true;
|
||||
}
|
||||
links_reset();
|
||||
@@ -495,6 +493,7 @@ void Entity_Player::links_reset()
|
||||
heightVelocity = 0;
|
||||
redStewBonusDuration = 0;
|
||||
salvationEffect = nullptr;
|
||||
darkArtsAura = nullptr;
|
||||
astralProjectionBody = nullptr;
|
||||
brokenHearts = 0;
|
||||
rottenHearts = 0;
|
||||
@@ -511,6 +510,7 @@ void Entity_Player::links_reset()
|
||||
reverseEmpressMaxHearts = 0;
|
||||
reverseChariotMoveCooldown = 0;
|
||||
reverseSunBoneHearts = 0;
|
||||
pendingPill = -1;
|
||||
revelationChargeTimer = 0;
|
||||
montezumaChargeTimer = 0;
|
||||
jupiterCharge = 0;
|
||||
@@ -556,6 +556,8 @@ void Entity_Player::links_reset()
|
||||
wildCardVarData = 0;
|
||||
samsonBerserkCharge = 0;
|
||||
ibsCharge = 0;
|
||||
versus = {};
|
||||
versusPauseTimer = 0;
|
||||
}
|
||||
|
||||
// 007bbbd0 Gives a character the name, health and pickups its players.xml entry starts with, then what its type, Eden's
|
||||
@@ -799,7 +801,6 @@ void Entity_Player::starting_trinket_add(int id)
|
||||
// unlocked ones (D6, Wooden Nickel, Razor Blade), the daily's, its innate items and pocket active, its trinket, Eden's
|
||||
// rolled items, the Mega Satan key pieces and the challenge's lists. Then it evaluates the stats, shares the pickups
|
||||
// and starts the twins and companions. Straw Man's player only evaluates. Netplay's per-player save data is offline.
|
||||
// The original's daily specials stop here until reached.
|
||||
void Entity_Player::InitPostLevelInitStats()
|
||||
{
|
||||
Game& game = *g_game;
|
||||
@@ -816,8 +817,6 @@ void Entity_Player::InitPostLevelInitStats()
|
||||
isPostLevelInitFinished = true;
|
||||
return;
|
||||
}
|
||||
if (game.dailyChallenge.specialDailyId != 0)
|
||||
reconstruction_missing("Entity_Player::InitPostLevelInitStats 007bc740 (a daily's special start)");
|
||||
|
||||
if (playerConfig->card > 0) AddPocketItem(playerConfig->card, POCKET_CARD);
|
||||
else if (playerConfig->card < 0) AddPocketItem(card_roll(initSeed, CARD_START_RUNE_CHANCE, true), POCKET_CARD);
|
||||
@@ -836,6 +835,7 @@ void Entity_Player::InitPostLevelInitStats()
|
||||
if (playerType == PLAYER_EVE && is_run_unlocked(ACHIEVEMENT_EVE_HOLDS_RAZOR_BLADE))
|
||||
items.push_back(COLLECTIBLE_RAZOR_BLADE);
|
||||
}
|
||||
special_daily_start_apply(*this, items);
|
||||
if (!game.deathmatchManager.is_active())
|
||||
for (int id : items) starting_collectible_add(id);
|
||||
apply_innate_collectibles();
|
||||
@@ -858,7 +858,12 @@ void Entity_Player::InitPostLevelInitStats()
|
||||
else if (playerType == PLAYER_SAMSON && is_run_unlocked(ACHIEVEMENT_SAMSON_HOLDS_CHILDS_HEART))
|
||||
trinket = TRINKET_CHILDS_HEART;
|
||||
}
|
||||
if (playerConfig->trinket == 0 && game.dailyChallenge.specialDailyId == SPECIAL_DAILY_FEBRUARY_18)
|
||||
starting_trinket_add(TRINKET_WATCH_BATTERY);
|
||||
if (playerConfig->trinket == 0) trinket = special_daily_trinket_get(trinket);
|
||||
if (trinket != 0 && !game.deathmatchManager.is_active()) starting_trinket_add(trinket);
|
||||
int dailyCard = special_daily_card_get();
|
||||
if (playerConfig->card == 0 && dailyCard != 0) AddPocketItem(dailyCard, POCKET_CARD);
|
||||
|
||||
if ((playerConfig->id == PLAYER_EDEN || playerConfig->id == TAINTED_EDEN_PLAYER_ID) &&
|
||||
!game.deathmatchManager.is_active())
|
||||
@@ -962,7 +967,15 @@ void Entity_Player::level_start(bool isForced)
|
||||
ventricleRazorPortal = 0;
|
||||
if (variant == PLAYER_VARIANT_COOP_BABY)
|
||||
{
|
||||
if (isGlitchBaby) reconstruction_missing("Entity_Player::level_start 007a4ba0 (the glitched co-op baby)");
|
||||
if (isGlitchBaby)
|
||||
{
|
||||
babySkin = BABY_GLITCH;
|
||||
InitBabySkin();
|
||||
g_game->playerManager.glitchBabyRng.Next();
|
||||
subtype = (int)GetGlitchBabySubType();
|
||||
babySkin = std::min(subtype, (int)BABY_BASIC);
|
||||
PlayExtraAnimation("Glitch");
|
||||
}
|
||||
if (parent) pos = parent->pos;
|
||||
}
|
||||
isLevelStartPending = false;
|
||||
@@ -1415,8 +1428,7 @@ void Entity_Player::UpdateCanShoot()
|
||||
if (!playerConfig) log_printf(LOG_ASSERT, "Could not load config for player type %d\n", playerType);
|
||||
canShoot = isChallengeShooting && playerConfig && playerConfig->isCanShoot;
|
||||
}
|
||||
if (game.deathmatchManager.is_active())
|
||||
reconstruction_missing("Entity_Player::UpdateCanShoot 007cba30 (deathmatch rules)");
|
||||
if (game.deathmatchManager.is_active()) canShoot = canShoot && game.deathmatchManager.type->can_shoot(*this);
|
||||
}
|
||||
|
||||
// 0075dfe0 Takes off every costume, leaving each layer to the player's own sprite.
|
||||
@@ -1489,7 +1501,7 @@ void Entity_Player::update_player_skin()
|
||||
bool isBombForm = playerType == PLAYER_THEFORGOTTEN_B || playerType == PLAYER_THESOUL_B;
|
||||
if (variant == PLAYER_VARIANT_PLAYER && !game.GetChallengeParams().isCanShoot && !isBombForm)
|
||||
AddCostume(items.GetNullItem(NULLITEM_BLINDFOLD), false);
|
||||
if (game.seedEffects.HasSeedEffect(SEED_CHRISTMAS) || game.dailyChallenge.specialDailyId == DAILY_CHRISTMAS)
|
||||
if (game.seedEffects.HasSeedEffect(SEED_CHRISTMAS) || game.dailyChallenge.specialDailyId == SPECIAL_DAILY_CHRISTMAS)
|
||||
AddCostume(items.GetNullItem(NULLITEM_CHRISTMAS), false);
|
||||
if (game.challenge == CHALLENGE_HOT_POTATO && playerType == PLAYER_THEFORGOTTEN_B)
|
||||
AddCostume(items.GetNullItem(NULLITEM_FORGOTTEN_BOMB), false);
|
||||
@@ -1620,6 +1632,7 @@ void Entity_Player::release_weapons_and_effects(bool isRemoveEntities)
|
||||
link_release(monstranceAura, isRemoveEntities);
|
||||
link_release(babyFamiliar, isRemoveEntities);
|
||||
link_release(salvationEffect, isRemoveEntities);
|
||||
link_release(darkArtsAura, isRemoveEntities);
|
||||
link_release(tetheredEffect, isRemoveEntities);
|
||||
link_release(astralProjectionBody, isRemoveEntities);
|
||||
link_release(montezumaLaser, isRemoveEntities);
|
||||
@@ -1808,51 +1821,3 @@ void Entity_Player::apply_victory_lap_penalty(uint32_t seed)
|
||||
size_t lost = std::min((size_t)std::floor((float)(collectibles.size() + 1) * loss), collectibles.size());
|
||||
for (size_t i = 0; i < lost; i++) RemoveCollectible(collectibles[i], false, 0, true);
|
||||
}
|
||||
|
||||
// 007585b0 Moves a dead co-op player's view to the next player alive.
|
||||
void Entity_Player::cycle_spectate_target()
|
||||
{
|
||||
reconstruction_missing("Entity_Player::cycle_spectate_target 007585b0 (co-op)");
|
||||
}
|
||||
|
||||
// 007ba2b0 The effects of a co-op baby's skin each frame.
|
||||
void Entity_Player::update_baby_skin_effects()
|
||||
{
|
||||
reconstruction_missing("Entity_Player::update_baby_skin_effects 007ba2b0 (co-op)");
|
||||
}
|
||||
|
||||
// 007bb5e0 A co-op baby's skin's effect as it dies.
|
||||
void Entity_Player::coop_baby_death_effect()
|
||||
{
|
||||
reconstruction_missing("Entity_Player::coop_baby_death_effect 007bb5e0 (co-op)");
|
||||
}
|
||||
|
||||
// 007bf040 Dresses a co-op baby in its skin.
|
||||
void Entity_Player::InitBabySkin()
|
||||
{
|
||||
reconstruction_missing("Entity_Player::InitBabySkin 007bf040 (co-op)");
|
||||
}
|
||||
|
||||
// 007c2e90 The skin a glitched co-op baby takes next.
|
||||
uint32_t Entity_Player::GetGlitchBabySubType()
|
||||
{
|
||||
reconstruction_missing("Entity_Player::GetGlitchBabySubType 007c2e90 (co-op)");
|
||||
}
|
||||
|
||||
// 007cb090 What a co-op baby's skin brings as it joins.
|
||||
void Entity_Player::apply_coop_baby_spawn_bonus()
|
||||
{
|
||||
reconstruction_missing("Entity_Player::apply_coop_baby_spawn_bonus 007cb090 (co-op)");
|
||||
}
|
||||
|
||||
// 007d93b0 Brings a co-op ghost back to life.
|
||||
void Entity_Player::RevivePlayerGhost()
|
||||
{
|
||||
reconstruction_missing("Entity_Player::RevivePlayerGhost 007d93b0 (co-op)");
|
||||
}
|
||||
|
||||
// 007d96f0 Turns a dead co-op player into a ghost.
|
||||
void Entity_Player::MorphToCoopGhost()
|
||||
{
|
||||
reconstruction_missing("Entity_Player::MorphToCoopGhost 007d96f0 (co-op)");
|
||||
}
|
||||
+117
-5
@@ -24,6 +24,27 @@ constexpr int BAG_OF_CRAFTING_SIZE = 8;
|
||||
constexpr int CHARGE_BAR_COUNT = 7;
|
||||
constexpr int COLLECTIBLE_VANILLA_COUNT = 733;
|
||||
constexpr int COOP_BABY_BUFF_COUNT = 8;
|
||||
// The frames a delayed sound played at once keeps for its next one.
|
||||
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 buffs the co-op baby skins Rage to Brown give every player (coopBabyBuffTimers), in skin order.
|
||||
enum CoopBabyBuff
|
||||
{
|
||||
COOP_BUFF_DAMAGE,
|
||||
COOP_BUFF_TEARS,
|
||||
COOP_BUFF_SPEED,
|
||||
COOP_BUFF_RANGE,
|
||||
COOP_BUFF_LUCK,
|
||||
COOP_BUFF_SMALLER,
|
||||
COOP_BUFF_LARGER,
|
||||
COOP_BUFF_BUTT_PENNY
|
||||
};
|
||||
|
||||
// The stats each co-op baby buff asks for again as it starts and ends (Butt Penny's none).
|
||||
constexpr uint32_t COOP_BUFF_CACHES[] = {CACHE_DAMAGE, CACHE_FIREDELAY, CACHE_SPEED, CACHE_SHOTSPEED | CACHE_RANGE,
|
||||
CACHE_LUCK, CACHE_SIZE, CACHE_SIZE};
|
||||
constexpr int COSTUME_LAYER_COUNT = 15;
|
||||
constexpr int FORGOTTEN_BODY_ROOM_NONE = -99999;
|
||||
constexpr int HEART_STAT_COUNT = 6;
|
||||
@@ -61,6 +82,9 @@ constexpr uint8_t WILD_CARD_PILL = 0;
|
||||
constexpr uint8_t WILD_CARD_CARD = 1;
|
||||
constexpr uint8_t WILD_CARD_ACTIVE = 2;
|
||||
|
||||
// The most bombs a player holds.
|
||||
constexpr int BOMBS_MAX = 99;
|
||||
|
||||
// Which consumables ConsumableCountChanged and SyncConsumables copy between players.
|
||||
enum ConsumableMask : uint32_t
|
||||
{
|
||||
@@ -154,21 +178,50 @@ enum PlayerVariant : int
|
||||
// The co-op baby skins Init and the frame tell apart (Lua's BabySubType).
|
||||
enum BabySubType : int
|
||||
{
|
||||
BABY_SPIDER = 0,
|
||||
BABY_LOVE = 1,
|
||||
BABY_BLOAT = 2,
|
||||
BABY_WATER = 3,
|
||||
BABY_PSY = 4,
|
||||
BABY_CURSED = 5,
|
||||
BABY_TROLL = 6,
|
||||
BABY_YBAB = 7,
|
||||
BABY_HOST = 9,
|
||||
BABY_LOST = 10,
|
||||
BABY_SHADOW = 13,
|
||||
BABY_GLASS = 14,
|
||||
BABY_GOLD = 15,
|
||||
BABY_CY = 16,
|
||||
BABY_MAG = 18,
|
||||
BABY_WRATH = 19,
|
||||
BABY_BEGOTTEN = 21,
|
||||
BABY_DEAD = 22,
|
||||
BABY_FIGHTING = 23,
|
||||
BABY_0 = 24,
|
||||
BABY_GLITCH = 25,
|
||||
BABY_MAGNET = 26,
|
||||
BABY_BLACK = 27,
|
||||
BABY_RED = 28,
|
||||
BABY_WHITE = 29,
|
||||
BABY_BLUE = 30,
|
||||
BABY_RAGE = 31,
|
||||
BABY_BROWN = 38,
|
||||
BABY_NOOSE = 39,
|
||||
BABY_HIVE = 40,
|
||||
BABY_BUDDY = 41,
|
||||
BABY_COLORFUL = 42,
|
||||
BABY_WHORE = 43,
|
||||
BABY_DRIPPING = 45,
|
||||
BABY_BLINDING = 46,
|
||||
BABY_SUCKY = 47,
|
||||
BABY_DARK = 48,
|
||||
BABY_PICKY = 49,
|
||||
BABY_REVENGE = 50,
|
||||
BABY_BELIAL = 51,
|
||||
BABY_SALE = 52,
|
||||
BABY_GOAT = 53,
|
||||
BABY_SUPER_GREED = 54,
|
||||
BABY_MORT = 55,
|
||||
BABY_APOLLYON = 56,
|
||||
BABY_BONE = 57,
|
||||
BABY_BOUND = 58,
|
||||
@@ -411,6 +464,7 @@ enum PlayerItemId : int
|
||||
COLLECTIBLE_MOMS_PURSE = 139,
|
||||
COLLECTIBLE_BOBS_CURSE = 140,
|
||||
COLLECTIBLE_SCAPULAR = 142,
|
||||
COLLECTIBLE_SPEED_BALL = 143,
|
||||
COLLECTIBLE_BUM_FRIEND = 144,
|
||||
COLLECTIBLE_NOTCHED_AXE = 147,
|
||||
COLLECTIBLE_INFESTATION = 148,
|
||||
@@ -437,6 +491,7 @@ enum PlayerItemId : int
|
||||
COLLECTIBLE_FANNY_PACK = 204,
|
||||
COLLECTIBLE_SPIDERBABY = 211,
|
||||
COLLECTIBLE_ANEMIC = 214,
|
||||
COLLECTIBLE_GOAT_HEAD = 215,
|
||||
COLLECTIBLE_MOMS_WIG = 217,
|
||||
COLLECTIBLE_PLACENTA = 218,
|
||||
COLLECTIBLE_OLD_BANDAGE = 219,
|
||||
@@ -806,6 +861,7 @@ enum PlayerItemId : int
|
||||
TRINKET_STEM_CELL = 119,
|
||||
TRINKET_WOODEN_CROSS = 121,
|
||||
TRINKET_BUTTER = 122,
|
||||
TRINKET_FILIGREE_FEATHERS = 123,
|
||||
TRINKET_DOOR_STOP = 124,
|
||||
TRINKET_BABY_BENDER = 127,
|
||||
TRINKET_GIGANTE_BEAN = 134,
|
||||
@@ -862,6 +918,7 @@ enum PlayerItemId : int
|
||||
TRINKET_WISH_BONE = 104,
|
||||
TRINKET_BAG_LUNCH = 105,
|
||||
TRINKET_BAT_WING = 118,
|
||||
TRINKET_SIGIL_OF_BAPHOMET = 189,
|
||||
TRINKET_HAIRPIN = 120,
|
||||
TRINKET_BLESSED_PENNY = 131,
|
||||
TRINKET_BROKEN_SYRINGE = 132,
|
||||
@@ -880,6 +937,7 @@ enum PlayerItemId : int
|
||||
TRINKET_PANIC_BUTTON = 149,
|
||||
TRINKET_TORN_CARD = 157,
|
||||
TRINKET_EXPANSION_PACK = 181,
|
||||
TRINKET_ENDLESS_NAMELESS = 79,
|
||||
|
||||
NULLITEM_EXPLOSIVE_DIARRHEA = 0,
|
||||
NULLITEM_STATUE = 4,
|
||||
@@ -919,6 +977,7 @@ enum PlayerItemId : int
|
||||
NULLITEM_AZAZELS_RAGE_1 = 96,
|
||||
NULLITEM_AZAZELS_RAGE_4 = 99,
|
||||
NULLITEM_ESAU_JR = 100,
|
||||
NULLITEM_SPIRIT_SHACKLES_SOUL = 101,
|
||||
NULLITEM_SPIRIT_SHACKLES_DISABLED = 102,
|
||||
NULLITEM_FORGOTTEN_BOMB = 106,
|
||||
NULLITEM_JACOBS_CURSE = 109,
|
||||
@@ -935,11 +994,13 @@ enum PlayerItemId : int
|
||||
NULLITEM_REVERSE_DEVIL = 67,
|
||||
NULLITEM_REVERSE_TEMPERANCE = 69,
|
||||
NULLITEM_MEGABLAST = 31,
|
||||
NULLITEM_IWATA = 35,
|
||||
NULLITEM_REVERSE_CHARIOT_ALT = 68,
|
||||
NULLITEM_REVERSE_STARS = 70,
|
||||
NULLITEM_LAZARUS_SOUL_REVIVE = 113,
|
||||
NULLITEM_SOUL_MAGDALENE = 114,
|
||||
NULLITEM_SOUL_BLUEBABY = 115,
|
||||
NULLITEM_MIRROR_DEATH = 116,
|
||||
NULLITEM_SOUL_JUDAS = 128,
|
||||
NULLITEM_HEMOPTYSIS_BOOST = 127,
|
||||
NULLITEM_ERA_WALK = 42,
|
||||
@@ -1065,7 +1126,17 @@ enum PlayerItemId : int
|
||||
COLLECTIBLE_GHOST_PEPPER = 495,
|
||||
COLLECTIBLE_IMMACULATE_HEART = 573,
|
||||
COLLECTIBLE_BIRDS_EYE = 616,
|
||||
COLLECTIBLE_ROTTEN_BABY = 268
|
||||
COLLECTIBLE_ROTTEN_BABY = 268,
|
||||
COLLECTIBLE_BOMBER_BOY = 353,
|
||||
COLLECTIBLE_KNOCKOUT_DROPS = 637,
|
||||
COLLECTIBLE_LUDOVICO_TECHNIQUE = 329,
|
||||
COLLECTIBLE_CAT_O_NINE_TAILS = 165,
|
||||
COLLECTIBLE_THUNDER_THIGHS = 314,
|
||||
COLLECTIBLE_BUCKET_OF_LARD = 129,
|
||||
COLLECTIBLE_JELLY_BELLY = 690,
|
||||
COLLECTIBLE_MYSTERIOUS_LIQUID = 317,
|
||||
COLLECTIBLE_BODY = 334,
|
||||
COLLECTIBLE_PJS = 428
|
||||
};
|
||||
|
||||
// The unlocks the player's code checks or grants (Lua's Achievement).
|
||||
@@ -1189,6 +1260,13 @@ struct CostumeSpriteDesc
|
||||
bool isOverwriteColor = false;
|
||||
};
|
||||
|
||||
// A dash's after-image: where the player stood, drawn fading over the frames it has left.
|
||||
struct AfterImageFrame
|
||||
{
|
||||
Vector position{};
|
||||
int frames = 0;
|
||||
};
|
||||
|
||||
// A frame of the player's walk as the Void's hallucination replays it: where it stood and how it moved, and its body
|
||||
// and head animations (their indices, -1 for none) at their frames.
|
||||
struct TrailFrame
|
||||
@@ -1323,6 +1401,30 @@ void sound_play(int sound);
|
||||
// 006dad10, 006dad20, 006dad30, 006dad60, 006dad70, 006dae00, 006dae10, 00753930, 007539f0, 00753c20, 00753c30,
|
||||
// 007e92a0, 0083ab80, 00841ca0, 0085e220, 0085e230, 0085e240, 0085e250, 0085e270, 0085e290, 0085e2c0, 0085e2d0,
|
||||
// 0085e2e0, 0085e2f0) are the public fields.
|
||||
// What a versus player keeps to pace its items: the real times (in milliseconds) Infestation, Spiderbaby, Varicose
|
||||
// Veins, Dead Bird and Black Bean last went off, the damage and hits counted toward Giant Cell, Habit,
|
||||
// Leprosy, It Hurts and Purity (negative while it recovers), the ramming cooldown, the damage the player dealt this
|
||||
// frame, whether Missing Page 2 went off, and the effects Broken Syringe, Mom's Lock and the Twins lent.
|
||||
struct VersusPacing
|
||||
{
|
||||
std::vector<int> twinsEffects;
|
||||
uint64_t blackBeanMs = 0;
|
||||
uint64_t deadBirdMs = 0;
|
||||
uint64_t infestationMs = 0;
|
||||
uint64_t spiderbabyMs = 0;
|
||||
uint64_t varicoseVeinsMs = 0;
|
||||
float giantCellDamage = 15;
|
||||
int drugEffect = 0;
|
||||
int momEffect = 0;
|
||||
int ramCooldown = 0;
|
||||
uint32_t damageDealt = 0;
|
||||
short purityHits = 0;
|
||||
uint8_t habitDamage = 0;
|
||||
uint8_t itHurtsHits = 0;
|
||||
uint8_t leprosyHits = 0;
|
||||
bool isMissingPage2Used = false;
|
||||
};
|
||||
|
||||
// A player (Lua's EntityPlayer): a character, a co-op baby or an extra player, with its health, consumables, items,
|
||||
// costumes, stats and the sprites it draws over its own.
|
||||
struct Entity_Player : Entity
|
||||
@@ -1437,6 +1539,7 @@ public:
|
||||
|
||||
TemporaryEffects temporaryEffects;
|
||||
History history;
|
||||
VersusPacing versus;
|
||||
std::array<int, INVENTORY_SIZE> inventory{};
|
||||
std::vector<int> collectibleCounts;
|
||||
std::vector<uint8_t> extraCollectibleCounts;
|
||||
@@ -1492,6 +1595,7 @@ public:
|
||||
|
||||
std::array<WeaponPtr, WEAPON_SLOT_COUNT> weapons;
|
||||
std::array<bool, WEAPON_TYPE_COUNT> weaponTypes{};
|
||||
std::deque<AfterImageFrame> afterImageFrames;
|
||||
std::deque<Vector> shootDirectionHistory;
|
||||
EntityPtr azazelsRageLaser;
|
||||
Vector aimDirection{};
|
||||
@@ -1545,7 +1649,7 @@ public:
|
||||
std::shared_ptr<GameStatePlayer> unlistedRestoreState;
|
||||
std::shared_ptr<PlayerHUD> playerHUD;
|
||||
std::vector<uint32_t> contactHitList;
|
||||
std::vector<Entity*> darkArtsHitList;
|
||||
std::vector<uint32_t> darkArtsHitList;
|
||||
std::vector<FamiliarData> curseMistFamiliars;
|
||||
std::vector<int> pendingWisps;
|
||||
std::deque<PocketItem> echoChamberItems;
|
||||
@@ -1557,6 +1661,7 @@ public:
|
||||
EntityPtr bestFriend;
|
||||
EntityPtr breathOfLifeEffect;
|
||||
EntityPtr dadsRingAura;
|
||||
EntityPtr darkArtsAura;
|
||||
EntityPtr divineShield;
|
||||
EntityPtr darkEsau;
|
||||
EntityPtr deadToothRing;
|
||||
@@ -1593,12 +1698,14 @@ public:
|
||||
int suplexState = 0;
|
||||
bool hasBabyRoomShield = false;
|
||||
bool hasCurseMistEffect = false;
|
||||
bool isCoPlayerItemsInvalid = false;
|
||||
bool isCoopGhost = false;
|
||||
bool isPreviewAdded = true;
|
||||
bool isGlitchBaby = false;
|
||||
bool isHeldEntityVisible = false;
|
||||
|
||||
std::array<int, COOP_BABY_BUFF_COUNT> coopBabyBuffTimers{};
|
||||
std::array<Vector, AIM_AXIS_COUNT> mirroredAimAxes{};
|
||||
float darkArtsDamage = 0;
|
||||
float delayedSfxVolume = 0;
|
||||
float forgottenBHeight = 0;
|
||||
@@ -1658,6 +1765,7 @@ public:
|
||||
int ponyCharge = 0;
|
||||
int potatoPeelerBandageCounter = 0;
|
||||
int potatoPeelerCounter = 0;
|
||||
int pendingPill = -1;
|
||||
int purityState = 0;
|
||||
int rUaWizardTimer = 0;
|
||||
int redStewBonusDuration = 0;
|
||||
@@ -1743,6 +1851,7 @@ public:
|
||||
void UpdateBlackHeartMask();
|
||||
void UpdateHeartDependentEffects();
|
||||
void ClampGoldenHearts(bool isSkipBreak);
|
||||
int golden_holders_count();
|
||||
void ClampHeartsToLimit(HeartKind kind, int amount);
|
||||
void update_bone_hearts();
|
||||
void update_greeds_gullet();
|
||||
@@ -1790,16 +1899,15 @@ public:
|
||||
bool IsValidTarget(Entity* other) override;
|
||||
void ResetColor() override;
|
||||
|
||||
// Not reconstructed yet: each stops the game with reconstruction_missing when reached.
|
||||
bool TakeDamage(float damage, uint64_t damageFlags, const EntityRef& source, int damageCountdown) override;
|
||||
bool TryThrow(const EntityRef& source, const Vector& velocity, float height) override;
|
||||
bool HandleCollision(Entity* collider, bool isLow) override;
|
||||
void AddCollectible(int type, int charge, bool isFirstTime, int activeSlot, int varData, int poolType = 0);
|
||||
void SetQueuedItem(const QueueItemData& queued);
|
||||
void PlayDelayedSFX(int sound, int soundDelay, int frameDelay, float volume);
|
||||
int tagged_item_count(uint64_t tag);
|
||||
void collectible_unlocks_check(int collectibleId, ItemConfig_Item& item);
|
||||
void collectible_pickups_add(ItemConfig_Item& item);
|
||||
std::string frame_gap();
|
||||
void costume_heads_update(int blinkFrame);
|
||||
void costume_layers_update();
|
||||
float body_costumes_walk(const CostumeWalk& walk);
|
||||
@@ -1842,7 +1950,6 @@ private:
|
||||
Entity_Player* health_owner();
|
||||
Entity_Player* heart_owner(PlayerType halfOwner);
|
||||
void eternal_heart_overlay_show();
|
||||
int golden_holders_count();
|
||||
void bone_hearts_add(int amount);
|
||||
void rotten_hearts_add(int amount);
|
||||
void red_hearts_add(int hearts, bool isUnknown2);
|
||||
@@ -2047,6 +2154,11 @@ public:
|
||||
void update_baby_skin_effects();
|
||||
void coop_baby_death_effect();
|
||||
void InitBabySkin();
|
||||
void baby_companions_spawn(RNG& initRng);
|
||||
void bound_chain_spawn();
|
||||
void coop_items_sync();
|
||||
void ghost_revive();
|
||||
Vector mirrored_aim_get(Vector aim);
|
||||
Entity_Laser* FireDelayedBrimstone(float angle, Entity* parent);
|
||||
bool CanPickupItem();
|
||||
bool IsHeldItemVisible();
|
||||
|
||||
+254
-65
@@ -23,6 +23,7 @@
|
||||
#include "kage_input.h"
|
||||
#include "key_configs.h"
|
||||
#include "log.h"
|
||||
#include "loot_list.h"
|
||||
#include "lua_callbacks.h"
|
||||
#include "lua_engine.h"
|
||||
#include "manager.h"
|
||||
@@ -58,7 +59,6 @@ constexpr float RED_CANDLE_DAMAGE = 4;
|
||||
constexpr int NINE_VOLT_RECHARGE_FRAMES = 450;
|
||||
constexpr int NECROMANCER_FORM_ITEMS = 3;
|
||||
constexpr int OVERLAY_DELAY = 3;
|
||||
constexpr int PERCENT = 100;
|
||||
constexpr int REVELATIONS_SOUL_HEARTS = 2;
|
||||
constexpr int REVELATIONS_STATE_FLAG = 7;
|
||||
constexpr int TAMMY_TEAR_COUNT = 10;
|
||||
@@ -104,7 +104,6 @@ constexpr float METRONOME_GENESIS_CHANCE = 0.25f;
|
||||
constexpr int DELIRIOUS_LOKII = 1;
|
||||
constexpr float DELIRIOUS_HORSEMAN_HEAD_HEALTH = 50;
|
||||
constexpr float DELIRIOUS_PAIR_SPACING = 40;
|
||||
constexpr float DELIRIOUS_HALF_TURN = 3.14f;
|
||||
constexpr int DELIRIOUS_HALLUCINATION_FRAMES = 25;
|
||||
constexpr std::array<int, 4> DELIRIOUS_WISPS = {65550, 65551, 65552, 65553};
|
||||
|
||||
@@ -145,6 +144,22 @@ constexpr int CASED_ACTIVES[] = {
|
||||
552, 555, 556, 557, 577, 578, 580, 582, 584, 585, 604, 605, 609, 611, 622, 623, 625, 628, 631, 635, 636, 638, 639,
|
||||
640, 642, 650, 653, 685, 687, 703, 704, 705, 706, 709, 710, 711, 712, 713, 714, 715, 719, 720, 722, 723, 728, 729};
|
||||
|
||||
// Judas' Birthright's bonuses: Necronomicon's shake and bleeding walls, Golden Razor's strike, the poof and flames.
|
||||
constexpr int BELIAL_NECRONOMICON_SHAKE = 8;
|
||||
constexpr int BELIAL_BLOOD_WALLS_DURATION = 10;
|
||||
constexpr int BELIAL_BLOOD_WALLS_COUNT = 5;
|
||||
constexpr int BELIAL_RAZOR_SHAKE = 15;
|
||||
constexpr int BELIAL_RAZOR_GOLD_FRAMES = 3;
|
||||
constexpr float BELIAL_RAZOR_DAMAGE = 15;
|
||||
constexpr int BELIAL_RAZOR_COUNTDOWN = 30;
|
||||
constexpr int BELIAL_FLAMES = 5;
|
||||
constexpr int BELIAL_BONUS_FLAME_DEPTH = -600;
|
||||
constexpr ColorMod BELIAL_POOF_COLOR = {{0.2f, 0.2f, 0.2f, 0.6f}, {1, 1, 1, 1}, {0, 0, 0}};
|
||||
constexpr ColorMod BELIAL_BONUS_FLAME_COLOR = {{5, 0.5f, 0.2f, 1}, {0, 0, 0, 0}, {0, 0, 0}};
|
||||
|
||||
// M!'s chance in 100 to charge the swapped active with two copies (twice that with three).
|
||||
constexpr int M_CHARGE_CHANCE = 10;
|
||||
|
||||
// The last collectible of each release, for the message where an unwritten active stops the game.
|
||||
struct ActiveRelease
|
||||
{
|
||||
@@ -202,16 +217,21 @@ void battery_effect_spawn(Entity_Player& player)
|
||||
}
|
||||
|
||||
// Whether an action meets a test on a controller, or on any connected device for -1, through the key configs.
|
||||
// A trigger of the raw action (33) is the grave accent key itself, which no config binds.
|
||||
static bool is_action_met(ButtonAction action, int controllerIndex, ActionTest test)
|
||||
{
|
||||
KAGE::Input::Manager& input = KAGE::Input::manager;
|
||||
bool isRaw = action == INPUT_RAW_ACTION && test == ACTION_TRIGGERED;
|
||||
ActionBinding rawBinding;
|
||||
rawBinding.fill(KAGE::Input::BUTTON_NONE);
|
||||
rawBinding[0] = KEY_GRAVE_ACCENT;
|
||||
|
||||
for (int i = 0; i < input.get_device_count(); i++)
|
||||
{
|
||||
std::shared_ptr<KAGE::Input::InputDevice> device = input.get_device(i);
|
||||
if (!device || !device->isConnected || (controllerIndex != -1 && device->id != controllerIndex)) continue;
|
||||
|
||||
for (int button : g_manager->keyConfigs.binding_get(*device, action))
|
||||
for (int button : isRaw ? rawBinding : g_manager->keyConfigs.binding_get(*device, action))
|
||||
{
|
||||
if (button == KAGE::Input::BUTTON_NONE) continue;
|
||||
if (test == ACTION_TRIGGERED ? device->is_button_triggered(button) : device->is_button_pressed(button))
|
||||
@@ -241,10 +261,7 @@ bool input_is_action_pressed(ButtonAction action, int controllerIndex, Entity* e
|
||||
bool input_is_action_triggered(ButtonAction action, int controllerIndex, Entity* entity)
|
||||
{
|
||||
std::optional<bool> isModTriggered = action_hook_run(entity, INPUT_HOOK_TRIGGERED, action);
|
||||
if (isModTriggered) return *isModTriggered;
|
||||
if (action == INPUT_RAW_ACTION)
|
||||
reconstruction_missing("input_is_action_triggered 009561e0 (the raw button action)");
|
||||
return is_action_met(action, controllerIndex, ACTION_TRIGGERED);
|
||||
return isModTriggered ? *isModTriggered : is_action_met(action, controllerIndex, ACTION_TRIGGERED);
|
||||
}
|
||||
|
||||
// 00827180 The first door slot whose Red Key outline lies within 120 of a position, or -1.
|
||||
@@ -661,8 +678,87 @@ void Entity_Player::DischargeActiveItem(uint32_t slot, bool isRemoved)
|
||||
if (slot == ACTIVE_SLOT_POCKET2) SetPocketActiveItem(0, ACTIVE_SLOT_POCKET2, false);
|
||||
}
|
||||
|
||||
// The actives a trinket may swap in or use: every other available active with art, not barred from Eden.
|
||||
static bool is_trinket_active(Entity_Player& player, ItemConfig_Item* item)
|
||||
{
|
||||
return item && item->id != player.activeItems[ACTIVE_SLOT_PRIMARY].item && item->type == ITEM_ACTIVE &&
|
||||
!item->HasTags(TAG_NO_EDEN) && !item->gfxFilename.empty() && item->IsAvailableEx(AVAILABLE_ALL);
|
||||
}
|
||||
|
||||
// Uses an active for a trinket without its animation, as owned, the player's item state kept unless the use set one.
|
||||
static void trinket_active_use(Entity_Player& player, int item)
|
||||
{
|
||||
if (item == 0) return;
|
||||
int itemState = player.itemState;
|
||||
player.itemState = 0;
|
||||
player.UseActiveItem({.item = item, .flags = USE_NOANIM | USE_OWNED, .slot = ACTIVE_SLOT_PRIMARY});
|
||||
if (player.itemState == 0) player.itemState = itemState;
|
||||
else player.itemStateCooldown = 0;
|
||||
}
|
||||
|
||||
// M!: the spent active turns into another, weighed toward the low qualities (a glitched one with TMTRAINER), with more
|
||||
// copies sometimes fully charged.
|
||||
static void m_trinket_swap(Entity_Player& player)
|
||||
{
|
||||
constexpr int QUALITY_WEIGHTS[] = {5, 4, 3, 2, 1};
|
||||
RNG& rng = player.GetTrinketRNG(TRINKET_M);
|
||||
int swapped = 0;
|
||||
if (player.HasCollectible(COLLECTIBLE_TMTRAINER))
|
||||
{
|
||||
swapped = g_game->proceduralItemManager.CreateProceduralItem(rng.Next(), PROCEDURAL_FORCE_ACTIVE);
|
||||
if (g_manager->itemConfig.GetCollectible(swapped)->type != ITEM_ACTIVE) return;
|
||||
}
|
||||
else
|
||||
{
|
||||
WeightedOutcomePicker picker;
|
||||
for (std::unique_ptr<ItemConfig_Item>& item : g_manager->itemConfig.collectibles)
|
||||
if (is_trinket_active(player, item.get())) picker.AddOutcomeWeight(item->id, QUALITY_WEIGHTS[item->quality]);
|
||||
swapped = picker.PickOutcome(rng_make(rng.Next(), DEFAULT_SHIFT_INDEX));
|
||||
}
|
||||
if (swapped == 0) return;
|
||||
|
||||
int copies = player.GetTrinketMultiplier(TRINKET_M);
|
||||
player.RemoveCollectible(player.activeItems[ACTIVE_SLOT_PRIMARY].item, false, ACTIVE_SLOT_PRIMARY, true);
|
||||
player.AddCollectible(swapped, 0, false, ACTIVE_SLOT_PRIMARY, 0);
|
||||
if (copies > 1 && (int)rng.RandomInt(PERCENT) < (copies == 2 ? M_CHARGE_CHANCE : M_CHARGE_CHANCE * 2))
|
||||
{
|
||||
ActiveItemDesc& active = player.activeItems[ACTIVE_SLOT_PRIMARY];
|
||||
player.AddActiveCharge(player.GetCollectibleMaxCharge(active.item, active.varData), ACTIVE_SLOT_PRIMARY, false,
|
||||
false, false);
|
||||
}
|
||||
}
|
||||
|
||||
// Expansion Pack: once a room (always in a versus match, and every use of an uncharged active), a spent active also
|
||||
// uses a random one- or two-charge active (twice with two copies, after a three-charge one with three).
|
||||
static void expansion_pack_use(Entity_Player& player)
|
||||
{
|
||||
constexpr int EXCLUDED[] = {COLLECTIBLE_D_INFINITY, COLLECTIBLE_GLOWING_HOUR_GLASS, COLLECTIBLE_METRONOME,
|
||||
COLLECTIBLE_ESAU_JR};
|
||||
TemporaryEffects& effects = player.temporaryEffects;
|
||||
ItemConfig_Item* spent = g_manager->itemConfig.GetCollectible(player.activeItems[ACTIVE_SLOT_PRIMARY].item);
|
||||
if (!spent) return;
|
||||
bool isCharged = player.GetActiveMaxCharge(ACTIVE_SLOT_PRIMARY) != 0 || spent->maxCharges < 1;
|
||||
if (isCharged && effects.HasTrinketEffect(TRINKET_EXPANSION_PACK) && !g_game->deathmatchManager.is_active()) return;
|
||||
|
||||
effects.AddTrinketEffect(TRINKET_EXPANSION_PACK, true, 1);
|
||||
WeightedOutcomePicker small;
|
||||
WeightedOutcomePicker large;
|
||||
for (std::unique_ptr<ItemConfig_Item>& item : g_manager->itemConfig.collectibles)
|
||||
{
|
||||
if (!is_trinket_active(player, item.get()) || std::ranges::find(EXCLUDED, item->id) != std::end(EXCLUDED))
|
||||
continue;
|
||||
if (item->maxCharges == 1 || item->maxCharges == 2) small.AddOutcomeWeight(item->id, 1);
|
||||
else if (item->maxCharges == 3) large.AddOutcomeWeight(item->id, 1);
|
||||
}
|
||||
RNG& rng = player.GetTrinketRNG(TRINKET_EXPANSION_PACK);
|
||||
int copies = player.GetTrinketMultiplier(TRINKET_EXPANSION_PACK);
|
||||
if (copies == 3) trinket_active_use(player, large.PickOutcome(rng_make(rng.Next(), DEFAULT_SHIFT_INDEX)));
|
||||
for (int use = copies >= 2 ? 2 : 1; use > 0; use--)
|
||||
trinket_active_use(player, small.PickOutcome(rng_make(rng.Next(), DEFAULT_SHIFT_INDEX)));
|
||||
}
|
||||
|
||||
// 007abf80 After a slot's item was spent: a Broken Glass Cannon mends, the first slot's use feeds Book of Virtues and
|
||||
// Judas' Birthright. M!, Butter! and Expansion Pack are not written yet.
|
||||
// Judas' Birthright, then M! swaps the active, Butter! drops it (unless it was removed) and Expansion Pack adds a use.
|
||||
void Entity_Player::active_used_post(int slot, bool isRemoved, int chargeBeforeUse)
|
||||
{
|
||||
if (activeItems[slot].item == COLLECTIBLE_BROKEN_GLASS_CANNON) glass_cannon_mend(*this, slot);
|
||||
@@ -670,15 +766,142 @@ void Entity_Player::active_used_post(int slot, bool isRemoved, int chargeBeforeU
|
||||
|
||||
TriggerBookOfVirtues(activeItems[0].item, chargeBeforeUse);
|
||||
trigger_book_of_belial_passive(activeItems[0].item, chargeBeforeUse);
|
||||
if (HasTrinket(TRINKET_M) || (HasTrinket(TRINKET_BUTTER) && !isRemoved) || HasTrinket(TRINKET_EXPANSION_PACK))
|
||||
reconstruction_missing("Entity_Player::active_used_post 007abf80 (M!, Butter! and Expansion Pack)");
|
||||
int active = activeItems[ACTIVE_SLOT_PRIMARY].item;
|
||||
if (HasTrinket(TRINKET_M) && ItemConfig::IsValidCollectible(active)) m_trinket_swap(*this);
|
||||
active = activeItems[ACTIVE_SLOT_PRIMARY].item;
|
||||
ItemConfig_Item* item = g_manager->itemConfig.GetCollectible(active);
|
||||
if (HasTrinket(TRINKET_BUTTER) && ItemConfig::IsValidCollectible(active) && !isRemoved && item &&
|
||||
item->type == ITEM_ACTIVE)
|
||||
{
|
||||
sound_play_local(*this, SOUND_BUTTER_DROP);
|
||||
DropCollectible(active, nullptr, false);
|
||||
}
|
||||
if (HasTrinket(TRINKET_EXPANSION_PACK) && ItemConfig::IsValidCollectible(activeItems[ACTIVE_SLOT_PRIMARY].item))
|
||||
expansion_pack_use(*this);
|
||||
}
|
||||
|
||||
// 005c9930 Judas' Birthright: the bonus an active gives when Book of Belial's passive is held.
|
||||
void Entity_Player::trigger_book_of_belial_passive(int, int)
|
||||
// Golden Razor with Judas' Birthright: every enemy (every player too in a versus match) that can be hit is struck for
|
||||
// twice the player's damage plus 15, one time in three turned to gold first.
|
||||
static void golden_razor_belial(Entity_Player& player)
|
||||
{
|
||||
sound_play(SOUND_ROCK_CRUMBLE);
|
||||
game_shake_screen(BELIAL_RAZOR_SHAKE);
|
||||
bool isVersus = g_game->deathmatchManager.is_active();
|
||||
for (Entity* entity : g_game->room->entityList.updateEL)
|
||||
{
|
||||
bool isTarget = (isVersus && entity->type == ENTITY_PLAYER) ||
|
||||
(entity->type >= ENTITY_GAPER && entity->type < ENTITY_EFFECT);
|
||||
if (!isTarget || entity->entityCollisionClass == ENTCOLL_NONE || entity->entityCollisionClass == ENTCOLL_PLAYERONLY ||
|
||||
entity->isInvincible || entity->isDead)
|
||||
continue;
|
||||
if (entity->HasEntityFlags(FLAG_NO_TARGET) && entity->type != ENTITY_BLOOD_PUPPY && entity->type != ENTITY_DARK_ESAU)
|
||||
continue;
|
||||
if (Random() % 3 == 0) entity->AddMidasFreeze(EntityRef(&player), BELIAL_RAZOR_GOLD_FRAMES, false);
|
||||
entity->TakeDamage(player.meleeDamage + player.meleeDamage + BELIAL_RAZOR_DAMAGE, 0, EntityRef(&player),
|
||||
BELIAL_RAZOR_COUNTDOWN);
|
||||
}
|
||||
}
|
||||
|
||||
// The flames Judas' Birthright's bonus sheds: five rising off the player, wider and faster one after another.
|
||||
static void belial_flames_spawn(Entity_Player& player)
|
||||
{
|
||||
for (int flame = 0; flame < BELIAL_FLAMES; flame++)
|
||||
{
|
||||
float reach = (float)flame * 0.7f * 0.25f + 0.3f;
|
||||
Vector rise = vector_make(reach * 0, (-10 - random_unit() * 6) * reach);
|
||||
float turn = (random_unit() * 10 - 5) * DEGREES_TO_RADIANS;
|
||||
float speed = std::clamp((float)flame / 12, 0.0f, 1.0f) * 1.4f + 0.6f;
|
||||
Vector velocity = vector_scale(vector_make(std::cos(turn) * rise.x - std::sin(turn) * rise.y,
|
||||
std::cos(turn) * rise.y + std::sin(turn) * rise.x),
|
||||
speed);
|
||||
Vector at = vector_add(player.pos, vector_scale(velocity, 2));
|
||||
auto* spark = static_cast<Entity_Effect*>(g_game->Spawn({.position = at, .velocity = velocity, .spawner = &player,
|
||||
.type = ENTITY_EFFECT, .variant = EFFECT_DUST_CLOUD,
|
||||
.seed = Random()}));
|
||||
LayerState& layer = *spark->sprite.GetLayer(0);
|
||||
layer_additive_set(layer);
|
||||
layer.color = BELIAL_BONUS_FLAME_COLOR;
|
||||
spark->rotation = random_unit() * 10 + 2;
|
||||
spark->SetTimeout((int)(Random() % 10) + 10);
|
||||
float size = random_unit() * 0.4f + 0.2f;
|
||||
spark->sprite.scale = vector_make(size * player.playerSpriteScale.x, size * player.playerSpriteScale.y);
|
||||
spark->renderZOffset = BELIAL_BONUS_FLAME_DEPTH;
|
||||
}
|
||||
}
|
||||
|
||||
// 005c9930 Judas' Birthright: with Book of Belial's passive held, a used active lends Belial's damage for its charges
|
||||
// (at least one, or its first charge), with a dark poof (a ground poof for four or more) and five flames. Some actives
|
||||
// do more or other: blood ones lend Razor Blade, Kamikaze and Razor Blade call a Necronomicon with bleeding walls,
|
||||
// Forget Me Now and IV Bag lend lasting damage, Golden Razor strikes the room, Magic Fingers may lend Golden Razor's
|
||||
// effect, Magic Skin lends it for good. Belial's own books and Guppy's Paw lend nothing, nor do uncharged or special
|
||||
// actives.
|
||||
void Entity_Player::trigger_book_of_belial_passive(int activeId, int charges)
|
||||
{
|
||||
if (!HasCollectible(COLLECTIBLE_BOOK_OF_BELIAL_PASSIVE)) return;
|
||||
reconstruction_missing("Entity_Player::trigger_book_of_belial_passive 005c9930 (the active's bonus)");
|
||||
|
||||
ItemConfig_Item* item = g_manager->itemConfig.GetCollectible(activeId);
|
||||
switch (activeId)
|
||||
{
|
||||
case COLLECTIBLE_BLOOD_RIGHTS:
|
||||
case COLLECTIBLE_SHARP_KEY:
|
||||
temporaryEffects.AddCollectibleEffect(COLLECTIBLE_RAZOR_BLADE, true, 1);
|
||||
return;
|
||||
case COLLECTIBLE_BOOK_OF_BELIAL:
|
||||
case COLLECTIBLE_BOOK_OF_BELIAL_PASSIVE:
|
||||
case COLLECTIBLE_GUPPYS_PAW:
|
||||
return;
|
||||
case COLLECTIBLE_KAMIKAZE:
|
||||
case COLLECTIBLE_RAZOR_BLADE:
|
||||
sound_play(SOUND_DEATH_CARD);
|
||||
UseActiveItem({.item = COLLECTIBLE_NECRONOMICON, .flags = USE_NOANIM});
|
||||
game_shake_screen(BELIAL_NECRONOMICON_SHAKE);
|
||||
g_game->room->bloodFromWallsDuration = BELIAL_BLOOD_WALLS_DURATION;
|
||||
g_game->room->bloodFromWallsCount = BELIAL_BLOOD_WALLS_COUNT;
|
||||
return;
|
||||
case COLLECTIBLE_FORGET_ME_NOW:
|
||||
temporaryEffects.AddNullEffect(NULLITEM_JUDAS_BIRTHRIGHT_STAGE, true, 2);
|
||||
return;
|
||||
case COLLECTIBLE_IV_BAG:
|
||||
temporaryEffects.AddNullEffect(NULLITEM_JUDAS_BIRTHRIGHT, true, 1);
|
||||
return;
|
||||
case COLLECTIBLE_GOLDEN_RAZOR:
|
||||
return golden_razor_belial(*this);
|
||||
case COLLECTIBLE_HOW_TO_JUMP:
|
||||
sound_play(SOUND_CANDLE_LIGHT);
|
||||
return;
|
||||
case COLLECTIBLE_THE_JAR:
|
||||
if (charges < 1) return;
|
||||
break;
|
||||
case COLLECTIBLE_MAGIC_FINGERS:
|
||||
if (GetCollectibleRNG(COLLECTIBLE_BOOK_OF_BELIAL_PASSIVE).RandomInt(4) != 0) return;
|
||||
sound_play(SOUND_CASH_REGISTER);
|
||||
temporaryEffects.AddCollectibleEffect(COLLECTIBLE_GOLDEN_RAZOR, true, 1);
|
||||
return;
|
||||
case COLLECTIBLE_MAGIC_SKIN:
|
||||
temporaryEffects.AddNullEffect(NULLITEM_JUDAS_BIRTHRIGHT_PERMANENT, true, 1);
|
||||
break;
|
||||
default:
|
||||
if (!item || item->maxCharges < 1 || item->chargeType != CHARGE_NORMAL) return;
|
||||
}
|
||||
|
||||
if (charges == 0) charges = std::max(1, item->initCharge);
|
||||
bool isBelial = temporaryEffects.HasCollectibleEffect(COLLECTIBLE_BOOK_OF_BELIAL) ||
|
||||
temporaryEffects.HasNullEffect(NULLITEM_JUDAS_BIRTHRIGHT);
|
||||
sound_play(isBelial ? SOUND_CANDLE_LIGHT : SOUND_DEVIL_CARD);
|
||||
if (ItemConfig_Item* boost = g_manager->itemConfig.GetNullItem(NULLITEM_JUDAS_BIRTHRIGHT))
|
||||
{
|
||||
TemporaryEffect effect(boost);
|
||||
effect.cooldown = boost->maxCooldown;
|
||||
temporaryEffects.AddEffect(effect, true, charges);
|
||||
}
|
||||
if (charges < 4)
|
||||
{
|
||||
Entity* poof = g_game->Spawn({.position = pos, .type = ENTITY_EFFECT, .variant = EFFECT_POOF01, .seed = Random()});
|
||||
poof->SetColor(BELIAL_POOF_COLOR, -1, COLOR_PRIORITY_DEFAULT, false, true);
|
||||
poof->Update();
|
||||
}
|
||||
else MakeGroundPoof(pos, BELIAL_POOF_COLOR, 1);
|
||||
belial_flames_spawn(*this);
|
||||
}
|
||||
|
||||
// 007ad330 Takes off an item's costume unless its effect still runs (Shoop da Whoop's always goes), or it came with
|
||||
@@ -1036,11 +1259,12 @@ static void book_of_revelations_use(ItemUse& use)
|
||||
}
|
||||
|
||||
// A pedestal the D6 rerolls: another item from the pools (with a wisp for Book of Virtues), or none a quarter of the
|
||||
// time for the Eternal D6, then a poof.
|
||||
// time for the Eternal D6 (the emptied pedestal vanishing in a versus match), then a poof.
|
||||
static void pedestal_reroll(ItemUse& use, Entity_Pickup& pickup)
|
||||
{
|
||||
constexpr int ETERNAL_D6_RNG_SHIFT = 44;
|
||||
constexpr float ETERNAL_D6_EMPTY_CHANCE = 0.25f;
|
||||
constexpr float ETERNAL_D6_VERSUS_VOLUME = 0.7f;
|
||||
|
||||
bool isEmptied = false;
|
||||
if (use.id == COLLECTIBLE_ETERNAL_D6)
|
||||
@@ -1052,7 +1276,11 @@ static void pedestal_reroll(ItemUse& use, Entity_Pickup& pickup)
|
||||
{
|
||||
pickup.empty_pedestal();
|
||||
if (g_game->deathmatchManager.is_active())
|
||||
reconstruction_missing("Entity_Player::UseActiveItem 005b39d0 (the Eternal D6 in a deathmatch)");
|
||||
{
|
||||
g_game->Spawn({.position = pickup.pos, .type = ENTITY_EFFECT, .variant = EFFECT_POOF01, .seed = Random()});
|
||||
npc_sound_play(SOUND_SUMMONSOUND, ETERNAL_D6_VERSUS_VOLUME, SOUND_FRAME_DELAY_DEFAULT, 1);
|
||||
pickup.Kill(EntityRef());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1157,8 +1385,8 @@ static int metronome_item_roll(Entity_Player& player)
|
||||
if (id == COLLECTIBLE_GENESIS && chances.RandomFloat() >= METRONOME_GENESIS_CHANCE) continue;
|
||||
if (g_game->dailyChallenge.id != 0 && id == COLLECTIBLE_FORGET_ME_NOW) continue;
|
||||
if (!ItemConfig::IsValidCollectible(id) || !config.GetCollectible(id)) continue;
|
||||
if (g_game->deathmatchManager.is_active())
|
||||
reconstruction_missing("Entity_Player::UseActiveItem 005b39d0 (Metronome's pick in a versus match)");
|
||||
DeathmatchManager& versus = g_game->deathmatchManager;
|
||||
if (versus.is_active() && versus.type->is_collectible_banned(id)) continue;
|
||||
return id;
|
||||
}
|
||||
return 0;
|
||||
@@ -1293,7 +1521,7 @@ void Entity_Player::console_spawn(const DeliriousBoss& boss, bool isAddWisp)
|
||||
{.position = pos, .health = boss.health, .count = boss.count, .type = boss.type, .variant = boss.variant}};
|
||||
if (is_delirious_pair(boss))
|
||||
{
|
||||
float angle = random_unit() * DELIRIOUS_HALF_TURN;
|
||||
float angle = random_unit() * PI_ROUGH;
|
||||
angle += angle;
|
||||
Vector offset = vector_make(std::cos(angle) * DELIRIOUS_PAIR_SPACING, std::sin(angle) * DELIRIOUS_PAIR_SPACING);
|
||||
DeliriousSpawn partner = spawns[0];
|
||||
@@ -1671,7 +1899,11 @@ UseResult Entity_Player::UseActiveItem(const ActiveUse& request)
|
||||
use.isShowAnimation = variant == PLAYER_VARIANT_PLAYER && !(request.flags & USE_NOANIM);
|
||||
use.isLuaAnimationAllowed = use.isShowAnimation;
|
||||
use.isWispAllowed = use.isShowAnimation || (request.flags & USE_ALLOWWISPSPAWN);
|
||||
if (use.id < 0) reconstruction_missing("Entity_Player::UseActiveItem 005b39d0: glitched_item_effects_run 009e01b0");
|
||||
if (use.id < 0)
|
||||
{
|
||||
if (use.isShowAnimation) AnimateCollectible(use.id, "UseItem", "PlayerPickupSparkle");
|
||||
glitched_item_effects_run(use.id, *this, {pos, aimDirection, this, CONDITION_ACTIVE});
|
||||
}
|
||||
|
||||
if (use.isShowAnimation) sound_play(SOUND_ITEM_RAISE);
|
||||
if (!use.item)
|
||||
@@ -2240,8 +2472,6 @@ static void suplex_super_landing(Entity_Player& player)
|
||||
constexpr float SLAM_DUST_SPEED_RANGE = 5;
|
||||
constexpr float SLAM_DUST_SPEED_MIN = 15;
|
||||
constexpr float SLAM_DUST_FLATTEN = 0.85f;
|
||||
constexpr float SLAM_DUST_SPIN_RANGE = 10;
|
||||
constexpr float SLAM_DUST_SPIN_MIN = 2;
|
||||
constexpr float SLAM_DUST_SCALE_RANGE = 0.6f;
|
||||
constexpr uint32_t SLAM_DUST_LIFE_RANGE = 40;
|
||||
constexpr ColorMod SLAM_DUST_COLOR = {{0.45f, 0.45f, 0.46f, 0.75f}, {0, 0, 0, 0}, {0, 0, 0}};
|
||||
@@ -2264,7 +2494,7 @@ static void suplex_super_landing(Entity_Player& player)
|
||||
.type = ENTITY_EFFECT, .variant = EFFECT_DUST_CLOUD,
|
||||
.seed = Random()}));
|
||||
float spin = (Random() & 1) ? 1 : -1;
|
||||
dust->rotation = (random_unit() * SLAM_DUST_SPIN_RANGE + SLAM_DUST_SPIN_MIN) * spin;
|
||||
dust->rotation = (random_between(DUST_SPIN_MIN, DUST_SPIN_RANGE)) * spin;
|
||||
float scale = random_unit() * SLAM_DUST_SCALE_RANGE + 1;
|
||||
dust->sprite.scale = vector_make(scale, scale);
|
||||
dust->SetTimeout((int)(Random() % SLAM_DUST_LIFE_RANGE + SLAM_DUST_LIFE_RANGE));
|
||||
@@ -2471,47 +2701,6 @@ void Entity_Player::ControlActiveItem(int slot)
|
||||
if (slot == ACTIVE_SLOT_PRIMARY) bulbs_update(*this, chargeBefore, slot);
|
||||
}
|
||||
|
||||
// The temporary effects the plain frame, stats and tears are written for: the first floor's actives that leave one,
|
||||
// Whore of Babylon and Tainted Eve's, Dead Bird, Bloody Lust and Bloody Gust, Lazarus' boost, Jacob's curse,
|
||||
// Metronome's and Delirious' marks (the item Metronome lends counts as owned, so its own checks still apply), and the
|
||||
// marks of the Bag of Crafting, Abyss, Flip, Lemegeton and Anima Sola. Book of Belial and Razor Blade change the
|
||||
// damage and tears, which are not written for effects yet.
|
||||
bool is_temporary_effect_plain(const TemporaryEffect& effect)
|
||||
{
|
||||
constexpr int PLAIN_EFFECT_ITEMS[] = {COLLECTIBLE_BIBLE,
|
||||
COLLECTIBLE_POOP,
|
||||
COLLECTIBLE_MR_BOOM,
|
||||
COLLECTIBLE_TAMMYS_HEAD,
|
||||
COLLECTIBLE_MOMS_BRA,
|
||||
COLLECTIBLE_KAMIKAZE,
|
||||
COLLECTIBLE_TELEPORT,
|
||||
COLLECTIBLE_YUM_HEART,
|
||||
COLLECTIBLE_LEMON_MISHAP,
|
||||
COLLECTIBLE_BOOK_OF_REVELATIONS,
|
||||
COLLECTIBLE_D6,
|
||||
COLLECTIBLE_SPIDER_BUTT,
|
||||
COLLECTIBLE_ETERNAL_D6,
|
||||
COLLECTIBLE_WHORE_OF_BABYLON,
|
||||
COLLECTIBLE_DEAD_BIRD,
|
||||
COLLECTIBLE_BLOODY_LUST,
|
||||
COLLECTIBLE_BLOODY_GUST,
|
||||
COLLECTIBLE_METRONOME,
|
||||
COLLECTIBLE_DELIRIOUS,
|
||||
COLLECTIBLE_BAG_OF_CRAFTING,
|
||||
COLLECTIBLE_ABYSS,
|
||||
COLLECTIBLE_FLIP,
|
||||
COLLECTIBLE_LEMEGETON,
|
||||
COLLECTIBLE_ANIMA_SOLA,
|
||||
COLLECTIBLE_HOLD,
|
||||
COLLECTIBLE_BOOK_OF_VIRTUES};
|
||||
|
||||
if (effect.item->type == ITEM_NULL)
|
||||
return effect.item->id == NULLITEM_LAZARUS_BOOST || effect.item->id == NULLITEM_BLOODY_BABYLON ||
|
||||
effect.item->id == NULLITEM_JACOBS_CURSE;
|
||||
return effect.item->IsCollectible() &&
|
||||
std::ranges::find(PLAIN_EFFECT_ITEMS, effect.item->id) != std::end(PLAIN_EFFECT_ITEMS);
|
||||
}
|
||||
|
||||
// 007da7a0 Whether an active slot's item stays when another active is taken from a pedestal: an empty or unknown
|
||||
// item, the unused ids, and the books Book of Virtues and Judas's Birthright put in the slot.
|
||||
bool is_active_slot_kept(Entity_Player& player, int slot)
|
||||
@@ -2540,8 +2729,8 @@ void active_collectible_add(Entity_Player& player, ItemConfig_Item& item, const
|
||||
bool isSchoolbagMove = gain.slot == ACTIVE_SLOT_PRIMARY && player.HasCollectible(COLLECTIBLE_SCHOOLBAG) &&
|
||||
player.activeItems[ACTIVE_SLOT_SECONDARY].item == 0;
|
||||
if (isSchoolbagMove) std::swap(player.activeItems[ACTIVE_SLOT_PRIMARY], player.activeItems[ACTIVE_SLOT_SECONDARY]);
|
||||
if (active.item < 0) reconstruction_missing("Entity_Player::AddCollectible 0075f0e0 (replacing a procedural active)");
|
||||
if (active.item > 0)
|
||||
if (active.item < 0) glitched_item_remove(player, active.item);
|
||||
else if (active.item > 0)
|
||||
player.collectibleCounts[active.item] = std::max(player.collectibleCounts[active.item] - 1, 0);
|
||||
|
||||
active.item = gain.item;
|
||||
|
||||
@@ -339,7 +339,7 @@ static void monster_manual_use(ItemUse& use)
|
||||
}
|
||||
|
||||
// Dead Sea Scrolls: one of 32 first floor actives used at once, named over the HUD, with its wisp for Book of
|
||||
// Virtues. Ten tries skip what Cantripped forbids, then Tammy's Head.
|
||||
// Virtues. Ten tries skip what Cantripped or the versus rules forbid, then Tammy's Head.
|
||||
static void dead_sea_scrolls_use(ItemUse& use)
|
||||
{
|
||||
Entity_Player& player = use.player;
|
||||
@@ -349,13 +349,13 @@ static void dead_sea_scrolls_use(ItemUse& use)
|
||||
if (player.itemState == 0)
|
||||
{
|
||||
int pick = COLLECTIBLE_TAMMYS_HEAD;
|
||||
if (g_game->deathmatchManager.is_active())
|
||||
reconstruction_missing("Entity_Player::UseActiveItem 005b39d0 (Dead Sea Scrolls in a versus match)");
|
||||
DeathmatchManager& versus = g_game->deathmatchManager;
|
||||
for (int i = 0; i < DEAD_SEA_SCROLLS_TRIES; i++)
|
||||
{
|
||||
int id = DEAD_SEA_SCROLLS_ITEMS[player.GetCollectibleRNG(use.id).RandomInt(DEAD_SEA_SCROLLS_ITEMS.size())];
|
||||
if (g_game->challenge == CHALLENGE_CANTRIPPED && ItemConfig::is_collectible_tagged(id, TAG_NO_CANTRIP))
|
||||
continue;
|
||||
if (versus.is_active() && versus.type->is_collectible_banned(id)) continue;
|
||||
pick = id;
|
||||
break;
|
||||
}
|
||||
@@ -383,13 +383,13 @@ static void forget_me_now_restart(Entity_Effect* timer)
|
||||
g_game->stageTransition.start({.player = player, .type = STAGE_TRANSITION_FORGET_ME_NOW, .isSameStage = true});
|
||||
}
|
||||
|
||||
// Forget Me Now: the floor restarts a frame later. It goes once owned, or used through the Void.
|
||||
// Forget Me Now: the floor restarts a frame later (during a versus fight it only buzzes). It goes once owned, or used
|
||||
// through the Void.
|
||||
static void forget_me_now_use(ItemUse& use)
|
||||
{
|
||||
if (use.player.variant != PLAYER_VARIANT_PLAYER) return;
|
||||
if (use.request.flags & (USE_OWNED | USE_VOID)) use.result.isRemove = true;
|
||||
if (g_game->deathmatchManager.is_active())
|
||||
reconstruction_missing("Entity_Player::UseActiveItem 005b39d0 (Forget Me Now in a versus match)");
|
||||
if (g_game->deathmatchManager.is_fighting()) return g_manager->sfxManager.Play(SOUND_ERROR_BUZZ);
|
||||
|
||||
Entity_Effect* timer = Entity_Effect::CreateTimer(reinterpret_cast<void*>(&forget_me_now_restart), 1, 0, false);
|
||||
timer->parent = &use.player;
|
||||
@@ -984,9 +984,12 @@ static void flush_npc(ItemUse& use, Entity_NPC& npc)
|
||||
if (npc.minecart) static_cast<Entity_NPC*>(npc.minecart.get())->MinecartUpdateChild(poop);
|
||||
}
|
||||
|
||||
// The Flush: the room flooded for its effect, and every enemy flushed but the friendly ones.
|
||||
// The Flush: the room flooded for its effect, and every enemy flushed but the friendly ones. The other versus players
|
||||
// take 30.
|
||||
static void flush_use(ItemUse& use)
|
||||
{
|
||||
constexpr float FLUSH_VERSUS_DAMAGE = 30;
|
||||
constexpr int FLUSH_VERSUS_COUNTDOWN = 30;
|
||||
Entity_Player& player = use.player;
|
||||
if (player.variant == PLAYER_VARIANT_PLAYER)
|
||||
{
|
||||
@@ -998,7 +1001,10 @@ static void flush_use(ItemUse& use)
|
||||
Entity_NPC* npc = dynamic_cast<Entity_NPC*>(entities[i]);
|
||||
if (npc && npc->HasEntityFlags(FLAG_FRIENDLY)) continue;
|
||||
if (entities[i]->is_player() && entities[i] != &player && g_game->deathmatchManager.is_active())
|
||||
reconstruction_missing("Entity_Player::UseActiveItem 005b39d0 (the Flush in a versus match)");
|
||||
{
|
||||
entities[i]->TakeDamage(FLUSH_VERSUS_DAMAGE, 0, EntityRef(), FLUSH_VERSUS_COUNTDOWN);
|
||||
continue;
|
||||
}
|
||||
if (npc) flush_npc(use, *npc);
|
||||
}
|
||||
}
|
||||
@@ -1559,7 +1565,24 @@ static void box_open(Entity_Player& player, int stage)
|
||||
}
|
||||
}
|
||||
|
||||
// Pandora's Box: opened by a main player, it gives what the floor holds (or the Strange Key's collectibles), one wisp
|
||||
// Pandora's Box in a versus match: a collectible for each player on one of the arena's spawn points (each used once).
|
||||
// The original reads an empty list's head when the points run out. Here no more collectibles come.
|
||||
static void versus_box_open()
|
||||
{
|
||||
constexpr float VERSUS_BOX_RADIUS = 40;
|
||||
DeathmatchTypeBase& versus = *g_game->deathmatchManager.type;
|
||||
std::list<Vector> points = versus.itemSpawnPoints;
|
||||
|
||||
for (int i = 0; i < g_game->playerManager.count_main_players() && !points.empty(); i++)
|
||||
{
|
||||
auto point = std::next(points.begin(), (long)(Random() % points.size()));
|
||||
versus.collectible_spawn(*point, VERSUS_BOX_RADIUS);
|
||||
points.erase(point);
|
||||
}
|
||||
}
|
||||
|
||||
// Pandora's Box: opened by a main player, it gives what the floor holds (or the Strange Key's collectibles, or in a
|
||||
// versus match a collectible per player), one wisp
|
||||
// per floor past the first with Book of Virtues and a devil familiar with Judas's kept Book of Belial. It goes once
|
||||
// owned, or used through the Void.
|
||||
static void pandoras_box_use(ItemUse& use)
|
||||
@@ -1572,8 +1595,7 @@ static void pandoras_box_use(ItemUse& use)
|
||||
if (use.request.flags & (USE_OWNED | USE_VOID)) use.result.isRemove = true;
|
||||
int stage = g_game->stage;
|
||||
if (player.HasTrinket(TRINKET_STRANGE_KEY)) strange_key_open(player);
|
||||
else if (g_game->deathmatchManager.is_active())
|
||||
reconstruction_missing("Entity_Player::UseActiveItem 005b39d0 (Pandora's Box in a versus match)");
|
||||
else if (g_game->deathmatchManager.is_active()) versus_box_open();
|
||||
else if (g_game->IsGreedMode()) greed_box_open(player, stage);
|
||||
else box_open(player, stage);
|
||||
|
||||
|
||||
@@ -67,7 +67,6 @@ constexpr std::array<std::pair<int, int>, 4> D_INFINITY_OVERLAYS = {
|
||||
constexpr int DATAMINER_STATS = 6;
|
||||
constexpr uint32_t DATAMINER_CACHE_FLAGS = 0x41f;
|
||||
constexpr int PLAN_C_BOSS_DELIRIUM = 70;
|
||||
constexpr int PLAN_C_BOSS_MOTHER = 88;
|
||||
constexpr int PLAN_C_DELIRIUM_FRAMES = 300;
|
||||
constexpr int PLAN_C_MOTHER_FRAMES = 345;
|
||||
constexpr int PLAN_C_FRAMES = 90;
|
||||
@@ -895,7 +894,7 @@ static void plan_c_use(ItemUse& use)
|
||||
single_use_remove(use);
|
||||
int boss = g_game->room->bossId;
|
||||
if (boss == PLAN_C_BOSS_DELIRIUM) player.planCKillCountdown = PLAN_C_DELIRIUM_FRAMES;
|
||||
else player.planCKillCountdown = boss == PLAN_C_BOSS_MOTHER ? PLAN_C_MOTHER_FRAMES : PLAN_C_FRAMES;
|
||||
else player.planCKillCountdown = boss == BOSS_MOTHER ? PLAN_C_MOTHER_FRAMES : PLAN_C_FRAMES;
|
||||
sound_play(SOUND_PLAN_C);
|
||||
EntityList_EL& entities = room_entities();
|
||||
for (size_t i = 0; i < entities.size(); i++)
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
// The items a player's bombs ask about (Lua's CollectibleType and TrinketType).
|
||||
constexpr int COLLECTIBLE_BOBBY_BOMB = 125;
|
||||
constexpr int COLLECTIBLE_SAD_BOMBS = 220;
|
||||
constexpr int COLLECTIBLE_BOMBER_BOY = 353;
|
||||
constexpr int COLLECTIBLE_SCATTER_BOMBS = 366;
|
||||
constexpr int COLLECTIBLE_STICKY_BOMBS = 367;
|
||||
constexpr int COLLECTIBLE_MR_MEGA = 106;
|
||||
@@ -35,6 +34,7 @@ constexpr int TRINKET_RING_CAP = 164;
|
||||
// damage, the spread of extra bombs, Short Fuse's fuse and extra damage, and the consumables the HUD redraws.
|
||||
constexpr int BOMB_DELAY = 30;
|
||||
constexpr int BOMB_DELAY_FAST = 1;
|
||||
constexpr int BOMB_DELAY_BOMBERMAN = 15;
|
||||
constexpr int BOMB_FUSE = 45;
|
||||
constexpr float BOMB_INHERIT = 0.1f;
|
||||
constexpr float BOMB_SCALE_BIG = 1.5f;
|
||||
@@ -45,7 +45,6 @@ constexpr float ROCKET_FAN_STEP = 3;
|
||||
constexpr float ROCKET_FAN_REACH = 80;
|
||||
constexpr int SHORT_FUSE = 22;
|
||||
constexpr std::array<float, 3> SHORT_FUSE_DAMAGE = {15.000001f, 30.000002f, 50};
|
||||
constexpr int BOMBS_MAX = 99;
|
||||
constexpr int SOUND_GLITTER_FUSE = 867;
|
||||
constexpr int PLACE_SOUND_DELAY = 4;
|
||||
|
||||
@@ -204,7 +203,8 @@ static void placed_bomb_setup(Entity_Player& player, Entity_Bomb& bomb, const Te
|
||||
if (flags[TEAR_FAST_BOMB]) bomb.AddEntityFlags(FLAG_NO_KNOCKBACK);
|
||||
}
|
||||
|
||||
// Blood Bombs' price for a bomb without bombs: Tainted Bethany's blood charge, or else a heart of the player's own.
|
||||
// Blood Bombs' price for a bomb without bombs: Tainted Bethany's blood charge, or else a heart of the player's own (eight
|
||||
// points in a versus match).
|
||||
// Whether it was paid.
|
||||
static bool blood_bomb_pay(Entity_Player& player)
|
||||
{
|
||||
@@ -215,8 +215,10 @@ static bool blood_bomb_pay(Entity_Player& player)
|
||||
player.AddBloodCharge(-1);
|
||||
return true;
|
||||
}
|
||||
constexpr float BLOOD_BOMB_VERSUS_COST = 8;
|
||||
player.damageCooldown = 0;
|
||||
return player.TakeDamage(1, BLOOD_BOMB_FLAGS, EntityRef(), BLOOD_BOMB_COUNTDOWN);
|
||||
float cost = g_game->deathmatchManager.is_active() ? BLOOD_BOMB_VERSUS_COST : 1;
|
||||
return player.TakeDamage(cost, BLOOD_BOMB_FLAGS, EntityRef(), BLOOD_BOMB_COUNTDOWN);
|
||||
}
|
||||
|
||||
// Rocket in a Jar's aim for a placed bomb: along the fire direction held, launched at 10 with the player's motion,
|
||||
@@ -294,8 +296,8 @@ void Entity_Player::update_bomb_input()
|
||||
if (numBombs < 1 && !isFree) return;
|
||||
|
||||
bombPlaceDelay = HasCollectible(COLLECTIBLE_FAST_BOMBS) ? BOMB_DELAY_FAST : BOMB_DELAY;
|
||||
if (g_game->deathmatchManager.is_active())
|
||||
reconstruction_missing("Entity_Player::update_bomb_input 00780f40: a versus match's bomb delay");
|
||||
DeathmatchManager& versus = g_game->deathmatchManager;
|
||||
if (versus.is_active() && versus.type->rules() == DEATHMATCH_BOMBERMAN) bombPlaceDelay = BOMB_DELAY_BOMBERMAN;
|
||||
int bombCount = 1 + (HasTrinket(TRINKET_RING_CAP) ? GetTrinketMultiplier(TRINKET_RING_CAP) : 0);
|
||||
for (int i = 0; i < bombCount; i++)
|
||||
{
|
||||
@@ -319,7 +321,7 @@ void Entity_Player::update_bomb_input()
|
||||
}
|
||||
else if (bombCount > 1)
|
||||
{
|
||||
float angle = random_unit() * RANDOM_HALF_TURN;
|
||||
float angle = random_unit() * PI_ROUGH;
|
||||
angle += angle;
|
||||
bomb.pos = vector_make(std::cos(angle) * EXTRA_BOMB_SPREAD + pos.x, std::sin(angle) * EXTRA_BOMB_SPREAD + pos.y);
|
||||
}
|
||||
|
||||
+27
-12
@@ -8,6 +8,7 @@
|
||||
#include "entity_tear.h"
|
||||
#include "entity_familiar.h"
|
||||
#include "game.h"
|
||||
#include "game_state_player.h"
|
||||
#include "hud.h"
|
||||
#include "level_generator.h"
|
||||
#include "loot_list.h"
|
||||
@@ -111,7 +112,6 @@ constexpr int SOUL_SAMSON_FRAMES = 300;
|
||||
constexpr float REVERSE_CHARIOT_DUST_ALPHA = 0.5f;
|
||||
constexpr float REVERSE_CHARIOT_DUST_MIN_ALPHA = 0.2f;
|
||||
constexpr float REVERSE_CHARIOT_DUST_MIN_TURN = 2;
|
||||
constexpr float REVERSE_CHARIOT_DUST_SPEED = 5;
|
||||
constexpr float REVERSE_CHARIOT_DUST_SPREAD = 20;
|
||||
constexpr float REVERSE_CHARIOT_DUST_TURN = 10;
|
||||
constexpr float REVERSE_HERMIT_COIN_SPEED = 5;
|
||||
@@ -628,6 +628,25 @@ static PocketUseEnd suicide_king_use(PocketUse& use)
|
||||
}
|
||||
|
||||
// ? Card: the first slot's active used for free (the Glowing Hour Glass's saved rewinds kept straight), with Book of
|
||||
// ? Card on the Glowing Hour Glass: the rewind the hourglass would make no longer gives the ? Card back, the player's
|
||||
// saved pockets losing their first one.
|
||||
static void hourglass_question_card_forget(Entity_Player& player)
|
||||
{
|
||||
Game& game = *g_game;
|
||||
int slot = game.currentGlowingHourglassSlot;
|
||||
if (player.glowingHourglassIndex < 0 || slot < 0) return;
|
||||
GlowingHourglassState* state = &game.glowingHourglassStates[1 - slot];
|
||||
if (!state->isUsable) state = &game.glowingHourglassStates[slot];
|
||||
if (!state->isUsable || player.glowingHourglassIndex >= (int)state->gameState.players.size()) return;
|
||||
|
||||
std::array<PocketItem, POCKET_SLOT_COUNT>& pockets = state->gameState.players[player.glowingHourglassIndex].pocketItems;
|
||||
auto card = std::ranges::find_if(pockets, [](const PocketItem& item)
|
||||
{ return item.type == POCKET_CARD && item.id == CARD_QUESTIONMARK; });
|
||||
if (card == pockets.end()) return;
|
||||
std::move(card + 1, pockets.end(), card);
|
||||
pockets.back() = {0, POCKET_CARD};
|
||||
}
|
||||
|
||||
// Virtues' wisp. With Blank Card it opens the I AM ERROR room instead, or drops a trapdoor, and the Blank Card goes.
|
||||
static PocketUseEnd questionmark_use(PocketUse& use)
|
||||
{
|
||||
@@ -650,8 +669,7 @@ static PocketUseEnd questionmark_use(PocketUse& use)
|
||||
player.RemoveCollectible(item, false, ACTIVE_SLOT_PRIMARY, true);
|
||||
return POCKET_END_ANIMATE;
|
||||
}
|
||||
if (item == COLLECTIBLE_GLOWING_HOUR_GLASS)
|
||||
reconstruction_missing("Entity_Player::UseCard 007b2230 (? Card's Glowing Hour Glass rewinds)");
|
||||
if (item == COLLECTIBLE_GLOWING_HOUR_GLASS) hourglass_question_card_forget(player);
|
||||
player.UseActiveItem({.item = item, .flags = USE_OWNED, .slot = ACTIVE_SLOT_PRIMARY});
|
||||
player.TriggerBookOfVirtues(item, 0);
|
||||
return POCKET_END_SKIP_ANIMATION;
|
||||
@@ -901,14 +919,14 @@ static PocketUseEnd reverse_devil_use(PocketUse& use)
|
||||
static bool is_versus_card_banned(int card)
|
||||
{
|
||||
DeathmatchManager& versus = g_game->deathmatchManager;
|
||||
return versus.is_active() && versus.type->FUN_0042b480(card);
|
||||
return versus.is_active() && versus.type->is_card_banned(card);
|
||||
}
|
||||
|
||||
// Whether a versus match's rules ban a collectible.
|
||||
static bool is_versus_collectible_banned(int item)
|
||||
{
|
||||
DeathmatchManager& versus = g_game->deathmatchManager;
|
||||
return versus.is_active() && versus.type->FUN_0042b020(item);
|
||||
return versus.is_active() && versus.type->is_collectible_banned(item);
|
||||
}
|
||||
|
||||
// Spawns a pickup near the player that no one spawned, with the card's next seed after its spot is found.
|
||||
@@ -945,10 +963,7 @@ constexpr std::array<uint32_t, 3> HAGALAZ_SHIFTS = {5, 27, 25};
|
||||
constexpr float HAGALAZ_SHELL_DAMAGE = 40;
|
||||
constexpr int HAGALAZ_DUST_MIN = 6;
|
||||
constexpr uint32_t HAGALAZ_DUST_RANGE = 6;
|
||||
constexpr float HAGALAZ_DUST_SPEED = 5;
|
||||
constexpr float HAGALAZ_DUST_SPREAD = 20;
|
||||
constexpr float HAGALAZ_DUST_SPIN_MIN = 2;
|
||||
constexpr float HAGALAZ_DUST_SPIN_RANGE = 10;
|
||||
constexpr int HAGALAZ_DUST_FRAMES = 15;
|
||||
constexpr float HAGALAZ_DUST_ALPHA_MIN = 0.2f;
|
||||
constexpr float HAGALAZ_DUST_ALPHA_RANGE = 0.5f;
|
||||
@@ -958,7 +973,7 @@ constexpr float HAGALAZ_QUIET_VOLUME = 0.8f;
|
||||
static void hagalaz_dust_spawn(Entity& npc)
|
||||
{
|
||||
Vector heading = random_direction();
|
||||
Vector velocity = vector_scale(heading, random_unit() * HAGALAZ_DUST_SPEED);
|
||||
Vector velocity = vector_scale(heading, random_unit() * DUST_SPEED);
|
||||
uint32_t seed = Random();
|
||||
Vector away = random_direction();
|
||||
Vector position = vector_add(npc.pos, vector_scale(away, random_unit() * HAGALAZ_DUST_SPREAD));
|
||||
@@ -969,7 +984,7 @@ static void hagalaz_dust_spawn(Entity& npc)
|
||||
.seed = seed}));
|
||||
Vector offset = vector_sub(dust->pos, npc.pos);
|
||||
float side = offset.x * velocity.y - offset.y * velocity.x < 0 ? -1.0f : 1.0f;
|
||||
dust->rotation = (random_unit() * HAGALAZ_DUST_SPIN_RANGE + HAGALAZ_DUST_SPIN_MIN) * side;
|
||||
dust->rotation = (random_between(DUST_SPIN_MIN, DUST_SPIN_RANGE)) * side;
|
||||
dust->timeout = (int)(Random() % HAGALAZ_DUST_FRAMES) + HAGALAZ_DUST_FRAMES;
|
||||
dust->lifespan = dust->timeout;
|
||||
dust->sprite.scale = vector_make(1, 1);
|
||||
@@ -1167,7 +1182,7 @@ static PocketUseEnd reverse_lovers_use(PocketUse& use)
|
||||
static void reverse_chariot_dust_spawn(Entity_Player& player)
|
||||
{
|
||||
Vector direction = random_direction();
|
||||
Vector velocity = vector_scale(direction, random_unit() * REVERSE_CHARIOT_DUST_SPEED);
|
||||
Vector velocity = vector_scale(direction, random_unit() * DUST_SPEED);
|
||||
uint32_t seed = Random();
|
||||
Vector offsetDirection = random_direction();
|
||||
Vector position = vector_add(player.pos, vector_scale(offsetDirection, random_unit() * REVERSE_CHARIOT_DUST_SPREAD));
|
||||
@@ -2051,6 +2066,6 @@ PocketUseEnd card_effect_run(PocketUse& use, int card)
|
||||
return soul_jacob_use(use);
|
||||
}
|
||||
if (card >= (int)g_manager->itemConfig.cards.size()) log_printf(LOG_WARN, "Warning: Card %d don't exist\n", card);
|
||||
else reconstruction_missing(("Entity_Player::UseCard 007b2230 (card " + std::to_string(card) + ")").c_str());
|
||||
else if (card == CARD_REVERSE_FOOL) reconstruction_missing("Entity_Player::UseCard 007b2230 (Reverse Fool, case 56)");
|
||||
return POCKET_END_ANIMATE;
|
||||
}
|
||||
@@ -22,6 +22,8 @@
|
||||
#include <cmath>
|
||||
#include <ranges>
|
||||
|
||||
constexpr uint64_t DEAD_BIRD_VERSUS_MS = 30001;
|
||||
constexpr int DEAD_BIRD_VERSUS_FRAMES = 450;
|
||||
constexpr int CHARGE_STORE_MAX = 99;
|
||||
constexpr int SOUL_CHARGE_CONSUMABLE = 0x20;
|
||||
constexpr int BLOOD_CHARGE_CONSUMABLE = 0x100;
|
||||
@@ -110,40 +112,6 @@ bool is_azazel(Entity_Player& player)
|
||||
player.temporaryEffects.HasTrinketEffect(TRINKET_AZAZELS_STUMP);
|
||||
}
|
||||
|
||||
// Whether the frame and the stat evaluation are reconstructed for the player's character: the normal ones and the
|
||||
// tainted ones the frame (00782af0, 00794e50) has no branch for. Tainted Judas's and Tainted Keeper's Birthright have
|
||||
// one, and so has Tainted Lazarus's, which keeps both forms in the room.
|
||||
bool is_character_reconstructed(Entity_Player& player)
|
||||
{
|
||||
switch (player.playerType)
|
||||
{
|
||||
case PLAYER_JUDAS_B:
|
||||
case PLAYER_KEEPER_B:
|
||||
case PLAYER_LAZARUS_B:
|
||||
case PLAYER_LAZARUS2_B:
|
||||
return !player.HasCollectible(COLLECTIBLE_BIRTHRIGHT);
|
||||
case PLAYER_JACOB_B:
|
||||
case PLAYER_JACOB2_B:
|
||||
case PLAYER_ISAAC_B:
|
||||
case PLAYER_MAGDALENE_B:
|
||||
case PLAYER_BLUEBABY_B:
|
||||
case PLAYER_THEFORGOTTEN_B:
|
||||
case PLAYER_THESOUL_B:
|
||||
case PLAYER_LILITH_B:
|
||||
case PLAYER_CAIN_B:
|
||||
case PLAYER_SAMSON_B:
|
||||
case PLAYER_EVE_B:
|
||||
case PLAYER_AZAZEL_B:
|
||||
case PLAYER_EDEN_B:
|
||||
case PLAYER_THELOST_B:
|
||||
case PLAYER_APOLLYON_B:
|
||||
case PLAYER_BETHANY_B:
|
||||
return true;
|
||||
default:
|
||||
return player.playerType >= PLAYER_ISAAC && player.playerType <= PLAYER_ESAU;
|
||||
}
|
||||
}
|
||||
|
||||
// The tears up or down a character adds to the items' before Binge Eater's: Samson's, the tainted ones', Azazel's (or
|
||||
// its stump's) and the twins'.
|
||||
float character_tears_get(Entity_Player& player)
|
||||
@@ -426,7 +394,7 @@ Vector PlayerManager::find_safe_spawn_position(Vector position)
|
||||
for (int radius = 0; radius < SAFE_SPAWN_TRIES && bestDistance <= SAFE_SPAWN_FAR_ENOUGH;
|
||||
radius += SAFE_SPAWN_RADIUS_STEP)
|
||||
{
|
||||
float angle = random_unit() * 3.14f;
|
||||
float angle = random_unit() * PI_ROUGH;
|
||||
angle = angle + angle;
|
||||
float distance = (float)radius + SAFE_SPAWN_RADIUS_MIN;
|
||||
Vector spot = vector_make(std::cos(angle) * distance + position.x, std::sin(angle) * distance + position.y);
|
||||
@@ -1085,17 +1053,23 @@ void Entity_Player::ChangePlayerType(int newType, bool isKeepState)
|
||||
|
||||
// The TakeDamage part (007729d0) for the items Eve and Samson start with: Dead Bird's effect wakes (and its costume
|
||||
// goes), and Bloody Lust, Bloody Gust and Blood Rights count the hit, Bloody Lust's and Bloody Gust's effects waking
|
||||
// (Samson's Bloody Lust without its costume). The deathmatch's timed Dead Bird is not reconstructed yet.
|
||||
// (Samson's Bloody Lust without its costume). A versus match wakes Dead Bird for 15 seconds at most every 30.
|
||||
void character_items_hit(Entity_Player& player)
|
||||
{
|
||||
TemporaryEffects& effects = player.temporaryEffects;
|
||||
bool isVersus = g_game->deathmatchManager.is_active();
|
||||
|
||||
if (player.HasCollectible(COLLECTIBLE_DEAD_BIRD))
|
||||
if (player.HasCollectible(COLLECTIBLE_DEAD_BIRD) &&
|
||||
(!isVersus || versus_cooldown_is_over(player.versus.deadBirdMs, DEAD_BIRD_VERSUS_MS)))
|
||||
{
|
||||
if (g_game->deathmatchManager.is_active())
|
||||
reconstruction_missing("Entity_Player::TakeDamage 007729d0 (Dead Bird's deathmatch cooldown)");
|
||||
ItemConfig_Item* deadBird = g_manager->itemConfig.GetCollectible(COLLECTIBLE_DEAD_BIRD);
|
||||
effects.AddEffect(TemporaryEffect(deadBird), true, 1);
|
||||
TemporaryEffect birds(deadBird);
|
||||
if (isVersus)
|
||||
{
|
||||
birds.cooldown = DEAD_BIRD_VERSUS_FRAMES;
|
||||
player.versus.deadBirdMs = versus_time_get();
|
||||
}
|
||||
effects.AddEffect(birds, true, 1);
|
||||
player.RemoveCostume(deadBird);
|
||||
}
|
||||
bool isLust = player.HasCollectible(COLLECTIBLE_BLOODY_LUST);
|
||||
@@ -1179,6 +1153,14 @@ void Entity_Player::add_samson_berserk_charge(int amount)
|
||||
temporaryEffects.isEvaluateCachePending = true;
|
||||
}
|
||||
|
||||
// The damage that charges a player's items this frame: what the room's enemies took, or in a versus match what the
|
||||
// player itself dealt.
|
||||
float damage_dealt_get(Entity_Player& player)
|
||||
{
|
||||
if (g_game->deathmatchManager.is_active()) return (float)player.versus.damageDealt;
|
||||
return g_game->room->entityList.enemyDamageInflicted;
|
||||
}
|
||||
|
||||
// 007d3560 How much charge a point of damage dealt is worth: a tenth in a versus match, else less the deeper the
|
||||
// floor (the alternate floors count one deeper).
|
||||
float damage_charge_scale()
|
||||
@@ -1188,15 +1170,13 @@ float damage_charge_scale()
|
||||
return 1 / ((float)game.stage_depth_get() * DAMAGE_CHARGE_PER_STAGE + DAMAGE_CHARGE_BASE);
|
||||
}
|
||||
|
||||
// The Berserk! charge part of 00794e50: out of Berserk!, the damage enemies took this frame charges Tainted Samson's
|
||||
// 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)
|
||||
{
|
||||
bool isCharging = player.HasCollectible(COLLECTIBLE_BERSERK) || player.playerType == PLAYER_SAMSON_B;
|
||||
if (!isCharging || player.temporaryEffects.HasCollectibleEffect(COLLECTIBLE_BERSERK)) return;
|
||||
if (g_game->deathmatchManager.is_active())
|
||||
reconstruction_missing("Entity_Player::update_effects 00794e50 (the versus damage dealt)");
|
||||
float dealt = g_game->room->entityList.enemyDamageInflicted;
|
||||
float dealt = damage_dealt_get(player);
|
||||
if (dealt <= 0) return;
|
||||
|
||||
int charge = (int)(damage_charge_scale() * dealt * BERSERK_CHARGE_PER_DAMAGE);
|
||||
|
||||
@@ -47,7 +47,6 @@ bool is_character_slowed(Entity_Player& player);
|
||||
|
||||
bool is_eden(const Entity_Player& player);
|
||||
bool is_azazel(Entity_Player& player);
|
||||
bool is_character_reconstructed(Entity_Player& player);
|
||||
|
||||
// Eve's Whore of Babylon and Tainted Eve's last heart (007c9ea0).
|
||||
bool is_whore_of_babylon_awake(Entity_Player& player);
|
||||
@@ -87,3 +86,4 @@ void npc_poop_update(Entity_NPC& npc);
|
||||
|
||||
// What a point of damage dealt adds to a damage charge (007d3560).
|
||||
float damage_charge_scale();
|
||||
float damage_dealt_get(Entity_Player& player);
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "entity_player_passives.h"
|
||||
#include "active_items.h"
|
||||
#include "boss_ai.h"
|
||||
#include "entity_combat.h"
|
||||
#include "entity_config.h"
|
||||
#include "entity_effect.h"
|
||||
#include "entity_familiar.h"
|
||||
@@ -11,6 +12,7 @@
|
||||
#include "log.h"
|
||||
#include "manager.h"
|
||||
#include "music_manager.h"
|
||||
#include "npc_ai.h"
|
||||
#include "room.h"
|
||||
#include "room_grid.h"
|
||||
#include <algorithm>
|
||||
@@ -41,8 +43,30 @@ enum RemovalItem : int
|
||||
NULLITEM_DOUBLED_B = 126
|
||||
};
|
||||
|
||||
// The collectible whose effect ends with more than its costume that is not written yet: Mega Mush.
|
||||
constexpr int EFFECT_END_ITEMS[] = {625};
|
||||
// The ends of the effects: Mega Mush's unhurtable frames, Reverse Chariot's crumbling statue, Reverse Stars' shake and
|
||||
// rng (shift index 34), and Spirit Shackles' trail of dust from the soul back to its body, with the exe's values.
|
||||
constexpr int MEGA_MUSH_END_COOLDOWN = 90;
|
||||
constexpr float STATUE_GIB_SPREAD = 40;
|
||||
constexpr int STATUE_GIBS = 4;
|
||||
constexpr uint32_t GIB_FLAGS_STATUE = 0x1000;
|
||||
constexpr uint32_t GIB_FLAGS_STATUE_BARE = 0x1080;
|
||||
constexpr int STATUE_CHIPS = 6;
|
||||
constexpr float STATUE_CHIP_SPEED_MIN = 2;
|
||||
constexpr float STATUE_CHIP_SPEED_RANGE = 4;
|
||||
constexpr int REVERSE_STARS_SHAKE = 6;
|
||||
constexpr uint32_t REVERSE_STARS_SHIFT = 34;
|
||||
constexpr float SHACKLES_DRIFT = 0.1f;
|
||||
constexpr float SHACKLES_DRIFT_MAX = 4;
|
||||
constexpr float SHACKLES_DUST_STEP = 20;
|
||||
constexpr int SHACKLES_DUST_MIN = 4;
|
||||
constexpr int SHACKLES_DUST_MAX = 12;
|
||||
constexpr float SHACKLES_DUST_SPREAD = 15;
|
||||
constexpr float SHACKLES_DUST_SIZE = 0.3f;
|
||||
constexpr float SHACKLES_DUST_RISE = 16;
|
||||
constexpr int SHACKLES_POOF_SUBTYPE = 10;
|
||||
constexpr int SHACKLES_FLASH_FRAMES = 8;
|
||||
constexpr ColorMod SHACKLES_DUST_COLOR = {{1, 1, 1, 1}, {0, 0, 0, 0}, {1, 1, 1}};
|
||||
constexpr ColorMod SHACKLES_POOF_COLOR = {{1, 1, 1, 1}, {1, 1, 1, 1}, {0, 0, 0}};
|
||||
|
||||
// The suplex aiming when Berserk ends leaps at once.
|
||||
constexpr int SUPLEX_STATE_AIMING = 2;
|
||||
@@ -279,11 +303,9 @@ static void collectible_effect_end(Entity_Player& player, int collectibleId)
|
||||
}
|
||||
}
|
||||
|
||||
// Spin to Win's spin over: its costume comes off, the player's familiars come back to their own orbits, and its
|
||||
// wisps go out.
|
||||
static void spin_to_win_end(Entity_Player& player, ItemConfig_Item* spin)
|
||||
// Spin to Win's spin over: the player's familiars come back to their own orbits, and its wisps go out.
|
||||
static void spin_to_win_end(Entity_Player& player)
|
||||
{
|
||||
player.RemoveCostume(spin);
|
||||
for (Entity* entity : g_game->room->entityList.updateEL)
|
||||
{
|
||||
if (entity->type != ENTITY_FAMILIAR || static_cast<Entity_Familiar*>(entity)->player != &player) continue;
|
||||
@@ -297,27 +319,199 @@ static void spin_to_win_end(Entity_Player& player, ItemConfig_Item* spin)
|
||||
player.EvaluateItems();
|
||||
}
|
||||
|
||||
// 00793970 An item's temporary effect ran out or was taken: a collectible's costume comes off unless the item keeps
|
||||
// it, the doubled ones with it, then the collectible's own end runs (see collectible_effect_end), and a null effect's
|
||||
// costume comes off (Spin to Win's spin ends). A trinket's effect takes its costume off (Faded Polaroid's fading
|
||||
// colour too). The other null effects and the items whose end does more are not written yet.
|
||||
// Mega Mush's end: a player wearing its giant costume shrinks back in a TransformBack shown over the screen, hidden
|
||||
// meanwhile, and is unhurtable for 3 seconds at least.
|
||||
static void mega_mush_end(Entity_Player& player)
|
||||
{
|
||||
int costume = player.playerCostumeMap[PLAYER_LAYER_HEAD].index;
|
||||
CostumeSpriteDesc* desc = costume >= 0 ? &player.costumeSpriteDescs[costume] : nullptr;
|
||||
if (desc && desc->item && desc->item->type == ITEM_ACTIVE && desc->item->id == COLLECTIBLE_MEGA_MUSH)
|
||||
{
|
||||
sound_play(SOUND_MEGA_MUSH_SHRINK);
|
||||
ANM2& overlay = g_game->itemOverlay.megaMushPlayerSprite;
|
||||
overlay = desc->sprite;
|
||||
for (LayerState& layer : overlay.layerStates) layer.pos = {};
|
||||
overlay.Play("TransformBack", PLAY_FORCED);
|
||||
g_game->itemOverlay.Show(GIANTBOOK_MEGA_MUSH, 0, &player);
|
||||
player.isVisible = false;
|
||||
log_printf(LOG_INFO, "[Frame %d] Mega Mush Ending, starting Shrink Animation \n", g_game->frameCount);
|
||||
}
|
||||
player.damageCooldown = std::max(player.damageCooldown, MEGA_MUSH_END_COOLDOWN);
|
||||
}
|
||||
|
||||
// Reverse Chariot's statue crumbles: rock gibs (with six rock chips when its statue costume was worn) and a crumble.
|
||||
static void reverse_chariot_end(Entity_Player& player, bool isStatueWorn)
|
||||
{
|
||||
gibs_spawn({.position = player.pos, .spawner = &player, .spread = STATUE_GIB_SPREAD, .amount = STATUE_GIBS,
|
||||
.gibFlags = isStatueWorn ? GIB_FLAGS_STATUE : GIB_FLAGS_STATUE_BARE});
|
||||
for (int chip = 0; isStatueWorn && chip < STATUE_CHIPS; chip++)
|
||||
{
|
||||
Vector side = random_direction();
|
||||
Vector at = vector_add(player.pos, vector_scale(side, random_unit() * 0.5f * player.size));
|
||||
Vector heading = random_direction();
|
||||
Vector velocity = vector_scale(heading, random_between(STATUE_CHIP_SPEED_MIN, STATUE_CHIP_SPEED_RANGE));
|
||||
g_game->Spawn({.position = at, .velocity = velocity, .spawner = &player, .type = ENTITY_EFFECT,
|
||||
.variant = EFFECT_TOOTH_PARTICLE, .seed = Random()});
|
||||
}
|
||||
sound_play(SOUND_ROCK_CRUMBLE);
|
||||
}
|
||||
|
||||
// Reverse Sun's end: the bone hearts it turned red heart containers into turn back, as far as the player still has
|
||||
// them, unless the player's health is not plain hearts.
|
||||
static void reverse_sun_end(Entity_Player& player)
|
||||
{
|
||||
int restored = std::min(player.reverseSunBoneHearts, player.boneHearts);
|
||||
for (int heart = 0; heart < player.reverseSunBoneHearts && player.boneHearts > 0; heart++)
|
||||
{
|
||||
player.boneHearts--;
|
||||
uint32_t mask = (uint32_t)player.boneHeartsMask;
|
||||
for (int bit = 0; bit < 32; bit++)
|
||||
{
|
||||
uint32_t below = (1u << bit) - 1;
|
||||
if (!(mask & (1u << bit))) continue;
|
||||
player.boneHeartsMask = (int)(((mask >> 1) & ~below) | (mask & below));
|
||||
break;
|
||||
}
|
||||
}
|
||||
player.AddMaxHearts(restored * 2, false);
|
||||
player.UpdateHeartDependentEffects();
|
||||
player.reverseSunBoneHearts = 0;
|
||||
}
|
||||
|
||||
// Reverse Stars' end: a black poof, a shake, and two items from the room's pool drop on either side, each with a
|
||||
// poof. A player still lifting its pickup drops the held sprite in another poof.
|
||||
static void reverse_stars_end(Entity_Player& player)
|
||||
{
|
||||
sound_play(SOUND_BLACK_POOF);
|
||||
player.MakeGroundPoof(player.pos, COLOR_DEFAULT, 1);
|
||||
game_shake_screen(REVERSE_STARS_SHAKE);
|
||||
RNG rng;
|
||||
rng.SetSeed(player.GetCardRNG(CARD_REVERSE_STARS).Next(), REVERSE_STARS_SHIFT);
|
||||
for (float side : {-PICKUP_SPOT_STEP, PICKUP_SPOT_STEP})
|
||||
{
|
||||
int item = g_game->itemPool.GetSeededCollectible(rng.Next(), 0, *g_game->room->descriptor);
|
||||
Vector spot = room_free_pickup_position_find({.position = vector_add(player.pos, vector_make(side, 0)),
|
||||
.step = PICKUP_SPOT_STEP});
|
||||
g_game->Spawn({.position = spot, .subType = item, .type = ENTITY_PICKUP, .variant = PICKUP_COLLECTIBLE,
|
||||
.seed = rng.Next()});
|
||||
g_game->Spawn({.position = spot, .type = ENTITY_EFFECT, .variant = EFFECT_POOF01, .seed = Random()})->Update();
|
||||
}
|
||||
if (!player.bodySprite.IsPlaying("Pickup") && !player.bodySprite.IsPlaying("Pickup_Online")) return;
|
||||
|
||||
player.heldSprite.Reset();
|
||||
const AnimationFrame* frame = player.bodySprite.animState.GetLayerFrame(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);
|
||||
poof->Update();
|
||||
}
|
||||
|
||||
// Spirit Shackles' soul is pulled back into its body: a trail of white dust from the soul to the body, a poof where it
|
||||
// stood, and the player is moved there unhurtable for 3 seconds, flashing white as the body goes.
|
||||
static void spirit_shackles_end(Entity_Player& player)
|
||||
{
|
||||
Entity* body = player.astralProjectionBody.get();
|
||||
if (!body) return;
|
||||
|
||||
Vector gap = vector_sub(body->pos, player.pos);
|
||||
Vector drift = vector_scale(gap, SHACKLES_DRIFT);
|
||||
float driftLength = vector_length(drift);
|
||||
if (driftLength > SHACKLES_DRIFT_MAX && driftLength > 0) drift = vector_scale(drift, SHACKLES_DRIFT_MAX / driftLength);
|
||||
int dust = std::clamp((int)std::floor(vector_length(gap) / SHACKLES_DUST_STEP), SHACKLES_DUST_MIN, SHACKLES_DUST_MAX);
|
||||
for (int puff = 1; puff <= dust; puff++)
|
||||
{
|
||||
float along = (float)puff / (float)(dust + 1);
|
||||
Vector side = random_direction();
|
||||
Vector at = vector_add(vector_add(player.pos, vector_scale(gap, along)),
|
||||
vector_scale(side, random_unit() * SHACKLES_DUST_SPREAD));
|
||||
uint32_t seed = Random();
|
||||
Vector velocity = vector_scale(drift, random_unit() * 0.5f + 0.5f);
|
||||
Entity* puffEntity = g_game->Spawn({.position = at, .velocity = velocity, .type = ENTITY_EFFECT,
|
||||
.variant = EFFECT_HAEMO_TRAIL, .seed = seed});
|
||||
puffEntity->SetColor(SHACKLES_DUST_COLOR, -1, COLOR_PRIORITY_DEFAULT, false, true);
|
||||
float size = random_unit() * SHACKLES_DUST_SIZE + SHACKLES_DUST_SIZE;
|
||||
puffEntity->sprite.scale = vector_make(along * size, along * size);
|
||||
puffEntity->posOffset = vector_make(player.posOffset.x, player.posOffset.y - player.sprite.scale.y * SHACKLES_DUST_RISE);
|
||||
}
|
||||
Entity* poof = g_game->Spawn({.position = player.pos, .velocity = drift, .subType = SHACKLES_POOF_SUBTYPE,
|
||||
.type = ENTITY_EFFECT, .variant = EFFECT_POOF02, .seed = Random()});
|
||||
poof->SetColor(SHACKLES_POOF_COLOR, -1, COLOR_PRIORITY_DEFAULT, false, true);
|
||||
poof->posOffset = player.posOffset;
|
||||
poof->sprite.scale = player.sprite.scale;
|
||||
|
||||
player.velocity = {};
|
||||
player.Teleport(body->pos, false, false);
|
||||
player.damageCooldown = std::max(player.damageCooldown, MEGA_MUSH_END_COOLDOWN);
|
||||
player.ResetColor();
|
||||
ColorMod flash = player.sprite.color;
|
||||
color_multiply(flash, SHACKLES_DUST_COLOR);
|
||||
player.SetColor(flash, SHACKLES_FLASH_FRAMES, COLOR_PRIORITY_DEFAULT, true, true);
|
||||
body->Remove();
|
||||
}
|
||||
|
||||
// A null effect's end: its costume comes off (Reverse Chariot's statue first), then Spin to Win's spin, Reverse
|
||||
// Empress's, Chariot's, Sun's, Devil's and Stars' cards, the Wavy Cap and Spirit Shackles' soul end their own way.
|
||||
static void null_effect_end(Entity_Player& player, int nullItem)
|
||||
{
|
||||
ItemConfig& items = g_manager->itemConfig;
|
||||
TemporaryEffects& effects = player.temporaryEffects;
|
||||
bool isStatueWorn = false;
|
||||
|
||||
if (nullItem == NULLITEM_REVERSE_CHARIOT)
|
||||
{
|
||||
ItemConfig_Item* statue = items.GetNullItem(NULLITEM_REVERSE_CHARIOT_ALT);
|
||||
isStatueWorn = std::ranges::any_of(player.playerCostumeMap, [&](const PlayerCostumeMap& map)
|
||||
{ return map.index >= 0 && player.costumeSpriteDescs[map.index].item == statue; });
|
||||
player.RemoveCostume(statue);
|
||||
}
|
||||
player.RemoveCostume(items.GetNullItem(nullItem));
|
||||
switch (nullItem)
|
||||
{
|
||||
case NULLITEM_SPIN_TO_WIN:
|
||||
return spin_to_win_end(player);
|
||||
case NULLITEM_REVERSE_EMPRESS:
|
||||
for (int heart = player.reverseEmpressMaxHearts; heart > 0; heart--)
|
||||
if (player.soulHearts + player.boneHearts * 2 + player.maxHearts > 2) player.AddMaxHearts(-2, false);
|
||||
player.reverseEmpressMaxHearts = 0;
|
||||
return;
|
||||
case NULLITEM_REVERSE_CHARIOT:
|
||||
if (!effects.HasNullEffect(nullItem)) reverse_chariot_end(player, isStatueWorn);
|
||||
return;
|
||||
case NULLITEM_REVERSE_SUN:
|
||||
if (!effects.HasNullEffect(nullItem) && player.reverseSunBoneHearts > 0 &&
|
||||
player.GetHealthType() == HEALTH_DEFAULT)
|
||||
reverse_sun_end(player);
|
||||
return;
|
||||
case NULLITEM_REVERSE_DEVIL:
|
||||
if (!effects.HasNullEffect(nullItem) && !effects.HasCollectibleEffect(COLLECTIBLE_BIBLE))
|
||||
effects.AddCollectibleEffect(COLLECTIBLE_BIBLE, true, 1);
|
||||
return;
|
||||
case NULLITEM_REVERSE_STARS:
|
||||
return reverse_stars_end(player);
|
||||
case NULLITEM_WAVY_CAP_1:
|
||||
return player.update_mini_mush_costume();
|
||||
case NULLITEM_SPIRIT_SHACKLES_SOUL:
|
||||
return spirit_shackles_end(player);
|
||||
}
|
||||
}
|
||||
|
||||
// 00793970 An item's temporary effect ran out or was taken. A null effect ends its own way (see null_effect_end). A
|
||||
// trinket's effect takes its costume off (Faded Polaroid's fading colour too). A collectible's doubled costumes come
|
||||
// off, Mega Mush shrinks back, its costume comes off unless the item keeps it, and its own end runs (see
|
||||
// collectible_effect_end).
|
||||
void Entity_Player::trigger_collectible_effect_removed(ItemConfig_Item* item, int)
|
||||
{
|
||||
constexpr int NULL_EFFECTS_WITH_ENDS[] = {62, 63, 66, 67, 70, 71, 101};
|
||||
if (item->type == ITEM_NULL && item->id == NULLITEM_SPIN_TO_WIN) return spin_to_win_end(*this, item);
|
||||
if (item->type == ITEM_NULL && std::ranges::find(NULL_EFFECTS_WITH_ENDS, item->id) == std::end(NULL_EFFECTS_WITH_ENDS))
|
||||
return RemoveCostume(g_manager->itemConfig.GetNullItem(item->id));
|
||||
if (item->type == ITEM_NULL) return null_effect_end(*this, item->id);
|
||||
if (item->type == ITEM_TRINKET)
|
||||
{
|
||||
TryRemoveTrinketCostume(item->id);
|
||||
if (item->id == TRINKET_FADED_POLAROID) ResetColor();
|
||||
return;
|
||||
}
|
||||
if (!item->IsCollectible())
|
||||
reconstruction_missing("Entity_Player::trigger_collectible_effect_removed 00793970 (a null effect)");
|
||||
if (!item->IsCollectible()) return;
|
||||
|
||||
doubled_costume_remove(*this, item->id);
|
||||
if (std::ranges::find(EFFECT_END_ITEMS, item->id) != std::end(EFFECT_END_ITEMS))
|
||||
reconstruction_missing("Entity_Player::trigger_collectible_effect_removed 00793970 (an item's own end)");
|
||||
if (item->id == COLLECTIBLE_MEGA_MUSH) mega_mush_end(*this);
|
||||
TryRemoveCollectibleCostume(item->id, true);
|
||||
collectible_effect_end(*this, item->id);
|
||||
}
|
||||
@@ -359,10 +553,9 @@ void Entity_Player::RemoveCollectible(int type, bool isIgnoreModifiers, int acti
|
||||
|
||||
log_printf(LOG_INFO, "Removing collectible %d (%s) from player %d (%s)\n", type, item->GetLocalizedName().c_str(),
|
||||
playerIndex, name.c_str());
|
||||
if (type < 0) reconstruction_missing("Entity_Player::RemoveCollectible 0078f840 (a procedural item)");
|
||||
if (collectibleCounts[type] >= 1) collectibleCounts[type]--;
|
||||
else if (!proceduralItems.empty())
|
||||
reconstruction_missing("Entity_Player::RemoveCollectible 0078f840 (the procedural item copying it)");
|
||||
if (type < 0) glitched_item_remove(*this, type);
|
||||
else if (collectibleCounts[type] >= 1) collectibleCounts[type]--;
|
||||
else if (int glitched = glitched_item_copying(*this, ITEM_PASSIVE, type)) RemoveCollectible(glitched, false, 0, true);
|
||||
|
||||
bool isSlotGiven = activeSlot >= 0 && activeSlot < ACTIVE_SLOT_COUNT && activeItems[activeSlot].item == type;
|
||||
int first = isSlotGiven ? activeSlot : 0;
|
||||
@@ -377,7 +570,7 @@ void Entity_Player::RemoveCollectible(int type, bool isIgnoreModifiers, int acti
|
||||
|
||||
TriggerCollectibleRemoved(type);
|
||||
doubled_costume_remove(*this, type);
|
||||
if (collectibleCounts[type] < 1)
|
||||
if (type >= 0 && collectibleCounts[type] < 1)
|
||||
{
|
||||
if (item->isAddCostumeOnPickup && !HasCollectible(type)) RemoveCostume(item);
|
||||
if (type == REMOVAL_MARS) RemoveCostume(items.GetNullItem(NULLITEM_MARS_DASH));
|
||||
@@ -400,15 +593,17 @@ void Entity_Player::RemoveCollectible(int type, bool isIgnoreModifiers, int acti
|
||||
UpdateBookOfVirtues(false);
|
||||
}
|
||||
|
||||
// Shows an item over the player's head: the pedestal's sprite with the item's graphics plays its animation (left alone
|
||||
// when it already shows it), lifted a little.
|
||||
static void held_sprite_show(Entity_Player& player, const std::string& gfx, std::string_view spriteAnimName)
|
||||
// Shows an item over the player's head: the pedestal's sprite with the item's graphics (a glitched item's cell of the
|
||||
// item surface) plays its animation (left alone when it already shows it), lifted a little.
|
||||
static void held_sprite_show(Entity_Player& player, const ItemConfig_Item& item, std::string_view spriteAnimName)
|
||||
{
|
||||
ANM2& held = player.heldSprite;
|
||||
|
||||
held.Reset();
|
||||
held.Load(g_manager->entityConfig.GetEntity(ENTITY_PICKUP, PICKUP_COLLECTIBLE, 0)->anm2Path, GRAPHICS_DEFER);
|
||||
held.ReplaceSpritesheet(1, gfx);
|
||||
LayerState* layer = item.type != ITEM_TRINKET && item.id < 0 ? held.GetLayer(1) : nullptr;
|
||||
if (layer) procedural_layer_set(*layer, item.id);
|
||||
else held.ReplaceSpritesheet(1, item.gfxFilename);
|
||||
held.LoadGraphics();
|
||||
held.Play(spriteAnimName);
|
||||
held.offset = vector_make(0, HELD_SPRITE_RISE);
|
||||
@@ -432,8 +627,7 @@ void Entity_Player::AnimateCollectible(int collectibleId, std::string_view animN
|
||||
ItemConfig_Item* item = g_manager->itemConfig.GetCollectible(collectibleId);
|
||||
if (!item) return;
|
||||
|
||||
if (collectibleId < 0) reconstruction_missing("Entity_Player::AnimateCollectible 007ab380 (a procedural item)");
|
||||
held_sprite_show(*this, item->gfxFilename, spriteAnimName);
|
||||
held_sprite_show(*this, *item, spriteAnimName);
|
||||
PlayExtraAnimation(animName);
|
||||
}
|
||||
|
||||
@@ -443,7 +637,7 @@ void Entity_Player::AnimateTrinket(int trinketId, std::string_view animName, std
|
||||
ItemConfig_Item* item = g_manager->itemConfig.GetTrinket((uint32_t)trinketId & TRINKET_ID_MASK);
|
||||
if (!item) return;
|
||||
|
||||
held_sprite_show(*this, item->gfxFilename, spriteAnimName);
|
||||
held_sprite_show(*this, *item, spriteAnimName);
|
||||
PlayExtraAnimation(animName);
|
||||
}
|
||||
|
||||
|
||||
Loaded 100 of 280 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user