Curation round 20: player update, costumes and render, Missing No., the last actives and cards, familiars, Pin, the Frail, Wormwood and the Heretic, Dross to Gehenna, effects and the devil room purchase, champion colours, the quit path, save fields, shared vector helpers
This commit is contained in:
1 parent
ee863e70e6
commit
8dbeb1bc4a
168 files changed
+15682
-2399
No files matched your search
+163
-31
@@ -12,6 +12,7 @@
|
||||
#include "entity_projectile.h"
|
||||
#include "game.h"
|
||||
#include "grid_entity_door.h"
|
||||
#include "kage_graphics.h"
|
||||
#include "level.h"
|
||||
#include "manager.h"
|
||||
#include "npc_ai.h"
|
||||
@@ -205,13 +206,6 @@ constexpr float BOOMERANG_FRICTION = 0.95f;
|
||||
constexpr float BOOMERANG_RETURN_SPEED = 15;
|
||||
constexpr int STICKY_NICKEL_COOLDOWN = 10;
|
||||
|
||||
// Plays a sound through the seeds' fart override.
|
||||
static void overridden_sound_play(int sound, SoundPlay play = {})
|
||||
{
|
||||
seed_fart_sound_override(&sound);
|
||||
g_manager->sfxManager.Play(sound, play);
|
||||
}
|
||||
|
||||
// Redemption's sign over its player: a damage up and a soul heart's worth (two halves) with a white flash on success,
|
||||
// a thumbs down and a poof 20 up on failure.
|
||||
constexpr float REDEMPTION_DEPTH = -10;
|
||||
@@ -220,13 +214,6 @@ constexpr int REDEMPTION_FLASH_FRAMES = 6;
|
||||
constexpr float REDEMPTION_POOF_HEIGHT = -20;
|
||||
constexpr ColorMod REDEMPTION_FLASH = {{1, 1, 1, 1}, {0, 0, 0, 0}, {1, 1, 1}};
|
||||
|
||||
// Redemption's states: waiting while its player holds an item up, succeeded, failed.
|
||||
enum RedemptionState
|
||||
{
|
||||
REDEMPTION_WAITING = 1,
|
||||
REDEMPTION_SUCCESS,
|
||||
REDEMPTION_FAIL
|
||||
};
|
||||
|
||||
// Part of 005cdb20 (Init's fire case) A fire keeps off pits, owned by whoever fired the tear or bomb that set it. The
|
||||
// item fires burn for 300 frames at full size.
|
||||
@@ -297,7 +284,7 @@ static void blue_flame_update(Entity_Effect& flame)
|
||||
if (!fire_hit(flame, *entity, flame.collisionDamage * damageScale, 0)) continue;
|
||||
|
||||
float volume = std::min(entity->health * FLAME_HISS_PER_HEALTH + FLAME_HISS_VOLUME, 1.0f);
|
||||
overridden_sound_play(SOUND_FIREDEATH_HISS, {.volume = volume, .frameDelay = FLAME_HISS_DELAY});
|
||||
effect_sound_play(SOUND_FIREDEATH_HISS, {.volume = volume, .frameDelay = FLAME_HISS_DELAY});
|
||||
}
|
||||
else if (is_shot_put_out(flame, *entity)) entity->Remove();
|
||||
}
|
||||
@@ -319,7 +306,7 @@ static void item_fire_update(Entity_Effect& fire)
|
||||
if (fire.parent && fire.parent->IsEnemy())
|
||||
{
|
||||
radius = fire.parent->size + FIRE_ENEMY_REACH;
|
||||
fire.scale = lerp_clamped(fire.parent->health, FIRE_ENEMY_HEALTH_LOW, FIRE_ENEMY_HEALTH_HIGH, 0, 1);
|
||||
fire.scale = lerp_range(fire.parent->health, {FIRE_ENEMY_HEALTH_LOW, FIRE_ENEMY_HEALTH_HIGH, 0, 1});
|
||||
}
|
||||
if (fire.IsFrame(FIRE_HIT_RESET_FRAMES, (int)fire.index)) fire.hitList.clear();
|
||||
layer_additive_set(*fire.sprite.GetLayer(0));
|
||||
@@ -344,7 +331,7 @@ static void item_fire_update(Entity_Effect& fire)
|
||||
{
|
||||
fire.isDead = true;
|
||||
if (fire.parent && fire.parent->IsEnemy())
|
||||
overridden_sound_play(SOUND_STEAM_HALFSEC, {.volume = FIRE_STEAM_VOLUME});
|
||||
effect_sound_play(SOUND_STEAM_HALFSEC, {.volume = FIRE_STEAM_VOLUME});
|
||||
}
|
||||
if (!fire.isDead) return;
|
||||
|
||||
@@ -382,7 +369,7 @@ static void foot_update(Entity_Effect& foot)
|
||||
}
|
||||
else if (frame == FOOT_STOMP_FRAME)
|
||||
{
|
||||
overridden_sound_play(SOUND_HELLBOSS_GROUNDPOUND);
|
||||
effect_sound_play(SOUND_HELLBOSS_GROUNDPOUND);
|
||||
|
||||
float damage = g_game->deathmatchManager.is_active() ? FOOT_VERSUS_DAMAGE : foot.collisionDamage;
|
||||
explosion_damage({.position = foot.pos, .source = &foot, .damageFlags = DAMAGE_CRUSH, .damage = damage,
|
||||
@@ -607,7 +594,7 @@ static void fire_jet_update(Entity_Effect& jet)
|
||||
int frame = jet.FrameCount();
|
||||
if (frame == 1 && jet.subtype == 0)
|
||||
{
|
||||
overridden_sound_play(SOUND_CANDLE_LIGHT);
|
||||
effect_sound_play(SOUND_CANDLE_LIGHT);
|
||||
}
|
||||
if ((frame == 2 || frame == 4) && jet.collisionDamage > 0)
|
||||
{
|
||||
@@ -649,7 +636,7 @@ static void xray_wall_update(Entity_Effect& hole)
|
||||
static void moms_hand_init(Entity_Effect& hand)
|
||||
{
|
||||
hand.sprite.Play("JumpDown");
|
||||
overridden_sound_play(SOUND_BIRD_FLAP);
|
||||
effect_sound_play(SOUND_BIRD_FLAP);
|
||||
}
|
||||
|
||||
// 005ffc5d (Update's case 91) Mom's hand lands on its target for its damage with a stomp, grabs it, and dies (going
|
||||
@@ -659,7 +646,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);
|
||||
overridden_sound_play(SOUND_FORESTBOSS_STOMPS);
|
||||
effect_sound_play(SOUND_FORESTBOSS_STOMPS);
|
||||
}
|
||||
if (hand.sprite.IsFinished("JumpDown")) hand.sprite.Play("Grab");
|
||||
if (!hand.target || !hand.target->isExists) hand.isDead = true;
|
||||
@@ -775,7 +762,7 @@ static void tooth_update(Entity_Effect& tooth)
|
||||
else if (tooth.sprite.IsFinished("JumpUp")) tooth.Remove();
|
||||
if (tooth.state == MONSTRO_TOOTH_LAND_FRAME)
|
||||
{
|
||||
overridden_sound_play(SOUND_FORESTBOSS_STOMPS, {.volume = MONSTRO_TOOTH_VOLUME});
|
||||
effect_sound_play(SOUND_FORESTBOSS_STOMPS, {.volume = MONSTRO_TOOTH_VOLUME});
|
||||
explosion_damage({.position = tooth.pos, .source = &tooth, .damageFlags = DAMAGE_CRUSH,
|
||||
.damage = MONSTRO_TOOTH_DAMAGE, .radius = MONSTRO_TOOTH_RADIUS, .isLineCheck = false});
|
||||
}
|
||||
@@ -916,7 +903,7 @@ static void ground_glow_update(Entity_Effect& glow)
|
||||
if (glow.parent->type == ENTITY_PROJECTILE)
|
||||
{
|
||||
float height = static_cast<Entity_Projectile&>(*glow.parent).height;
|
||||
alpha = lerp_clamped(height, GLOW_HEIGHT_HIGH, GLOW_HEIGHT_LOW, GLOW_DIMMEST, 1);
|
||||
alpha = lerp_range(height, {GLOW_HEIGHT_HIGH, GLOW_HEIGHT_LOW, GLOW_DIMMEST, 1});
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -1158,7 +1145,7 @@ static void boomerang_init(Entity_Effect& boomerang)
|
||||
boomerang.entityGridCollisionClass = GRIDCOLL_WALLS;
|
||||
boomerang.sprite.Play("Rotate");
|
||||
boomerang.posOffset = vector_make(0, BOOMERANG_HEIGHT);
|
||||
overridden_sound_play(SOUND_BOOMERANG_LOOP, {.loop = SOUND_LOOP});
|
||||
effect_sound_play(SOUND_BOOMERANG_LOOP, {.loop = SOUND_LOOP});
|
||||
}
|
||||
|
||||
// The first pickup the boomerang touches that can be taken becomes its catch. A sticky nickel only rattles.
|
||||
@@ -1176,7 +1163,7 @@ static void boomerang_grab(Entity_Effect& boomerang)
|
||||
continue;
|
||||
}
|
||||
boomerang.child = pickup;
|
||||
overridden_sound_play(SOUND_BOOMERANG_HIT);
|
||||
effect_sound_play(SOUND_BOOMERANG_HIT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1203,13 +1190,13 @@ static void boomerang_update(Entity_Effect& boomerang)
|
||||
entity->AddFreeze(EntityRef(&boomerang), BOOMERANG_FREEZE, false);
|
||||
entity->AddVelocity(boomerang.velocity, false);
|
||||
hit_list_insert(boomerang.hitList, *entity);
|
||||
overridden_sound_play(SOUND_BOOMERANG_HIT);
|
||||
effect_sound_play(SOUND_BOOMERANG_HIT);
|
||||
}
|
||||
|
||||
if (boomerang.isCollidesWithGrid)
|
||||
{
|
||||
boomerang.timeout = 1;
|
||||
overridden_sound_play(SOUND_BOOMERANG_HIT);
|
||||
effect_sound_play(SOUND_BOOMERANG_HIT);
|
||||
}
|
||||
if (boomerang.timeout < BOOMERANG_SLOWING_FRAMES) boomerang.friction *= BOOMERANG_FRICTION;
|
||||
if (boomerang.timeout < 2)
|
||||
@@ -1224,7 +1211,7 @@ static void boomerang_update(Entity_Effect& boomerang)
|
||||
if (distance <= thrower->size + boomerang.size)
|
||||
{
|
||||
boomerang.isDead = true;
|
||||
overridden_sound_play(SOUND_BOOMERANG_CATCH);
|
||||
effect_sound_play(SOUND_BOOMERANG_CATCH);
|
||||
if (boomerang.child) boomerang.child->entityGridCollisionClass = GRIDCOLL_WALLS;
|
||||
}
|
||||
}
|
||||
@@ -1232,7 +1219,7 @@ static void boomerang_update(Entity_Effect& boomerang)
|
||||
|
||||
if (boomerang.isDead) boomerang.Remove();
|
||||
else if (!g_manager->sfxManager.IsPlaying(SOUND_BOOMERANG_LOOP))
|
||||
overridden_sound_play(SOUND_BOOMERANG_LOOP, {.loop = SOUND_LOOP});
|
||||
effect_sound_play(SOUND_BOOMERANG_LOOP, {.loop = SOUND_LOOP});
|
||||
}
|
||||
|
||||
// Part of 005cdb20 (Init's case 185) Redemption's sign hangs behind its player, its glow additive.
|
||||
@@ -1261,7 +1248,7 @@ static void redemption_update(Entity_Effect& sign)
|
||||
{
|
||||
if (!player || player->IsHoldingItem()) return;
|
||||
sign.state = REDEMPTION_FAIL;
|
||||
overridden_sound_play(SOUND_THUMBS_DOWN);
|
||||
effect_sound_play(SOUND_THUMBS_DOWN);
|
||||
}
|
||||
else if (sign.state == REDEMPTION_SUCCESS)
|
||||
{
|
||||
@@ -1275,7 +1262,7 @@ static void redemption_update(Entity_Effect& sign)
|
||||
player->AddSoulHearts(REDEMPTION_SOUL_HEARTS, false);
|
||||
player->AnimateHappy();
|
||||
player->SetColor(REDEMPTION_FLASH, REDEMPTION_FLASH_FRAMES, 1, true, true);
|
||||
overridden_sound_play(SOUND_POWERUP_SPEWER);
|
||||
effect_sound_play(SOUND_POWERUP_SPEWER);
|
||||
}
|
||||
sign.Remove();
|
||||
}
|
||||
@@ -1297,6 +1284,150 @@ static void redemption_update(Entity_Effect& sign)
|
||||
|
||||
// The variants of this group by their Init, Update and Render. Those that only play their animation share Update's
|
||||
// poof case. The empty ones have no Init or Update case in the original.
|
||||
// The halos (subtypes: 0 halo, 1 Telekinesis, 2 Monstrance, 3 curse, 4 static, 5 Saturnus, 6 Salvation, 7 static
|
||||
// prerendered, 8 Dark Arts, 9 Breath of Life) follow what they belong to, under it. The static ones touch what is near
|
||||
// for nothing every frame, Telekinesis' pushes enemies within 80 away on its Push event, Salvation's grows with its
|
||||
// scale.
|
||||
enum HaloSubtype
|
||||
{
|
||||
HALO_CURSE = 3,
|
||||
HALO_STATIC = 4,
|
||||
HALO_TELEKINESIS = 1,
|
||||
HALO_SALVATION = 6,
|
||||
HALO_STATIC_PRERENDERED = 7,
|
||||
HALO_DARK_ARTS = 8,
|
||||
HALO_BREATH_OF_LIFE = 9
|
||||
};
|
||||
constexpr int HALO_RENDER_Z = -1000;
|
||||
constexpr unsigned int HALO_PRERENDERED_FLAG = 1u << 8;
|
||||
constexpr float HALO_PUSH_RANGE = 80;
|
||||
constexpr float HALO_PUSH_MAX = 7;
|
||||
constexpr float HALO_PUSH_SCALE = 2;
|
||||
constexpr float HALO_HEAVY_MASS = 20;
|
||||
constexpr float HALO_HEAVIER_MASS = 30;
|
||||
constexpr float HALO_HEAVIEST_MASS = 50;
|
||||
constexpr float HALO_HEAVY_SHARE = 0.5f;
|
||||
constexpr float HALO_HEAVIER_SHARE = 0.2f;
|
||||
constexpr float HALO_HEAVIEST_SHARE = 0.015f;
|
||||
constexpr float HALO_PUSH_CARRY = 0.5f;
|
||||
constexpr float HALO_STATIC_REACH = 40;
|
||||
constexpr uint64_t HALO_STATIC_DAMAGE_FLAGS = DAMAGE_POISON_BURN;
|
||||
constexpr int HALO_STATIC_COUNTDOWN = 30;
|
||||
constexpr float HALO_SALVATION_BIG = 1.5f;
|
||||
|
||||
// Part of 005cdb20 (Init's case 123) A halo draws under what it follows: the curse one multiplying the floor, the
|
||||
// static and Breath of Life ones glowing.
|
||||
static void halo_init(Entity_Effect& halo)
|
||||
{
|
||||
LayerState& layer = *halo.sprite.GetLayer(halo.subtype == HALO_BREATH_OF_LIFE ? 1 : 0);
|
||||
if (halo.subtype == HALO_CURSE)
|
||||
layer.blendMode = {KAGE::Graphics::EQUATION_ADD, KAGE::Graphics::FACTOR_ZERO, KAGE::Graphics::FACTOR_SRC_COLOR,
|
||||
KAGE::Graphics::FACTOR_ZERO, KAGE::Graphics::FACTOR_SRC_COLOR};
|
||||
else if (halo.subtype == HALO_STATIC || halo.subtype == HALO_STATIC_PRERENDERED ||
|
||||
halo.subtype == HALO_BREATH_OF_LIFE)
|
||||
{
|
||||
if (halo.subtype == HALO_STATIC) halo.sprite.bitflags |= ANIM_RENDER_STATIC;
|
||||
if (halo.subtype == HALO_STATIC_PRERENDERED) halo.sprite.bitflags |= HALO_PRERENDERED_FLAG;
|
||||
layer_additive_set(layer);
|
||||
}
|
||||
halo.renderZOffset = HALO_RENDER_Z;
|
||||
}
|
||||
|
||||
// Telekinesis' push on an enemy within reach: up to 7 (twice that) by how close, halved for one heavier than 20.
|
||||
static void halo_push(Entity_Effect& halo, Entity& enemy)
|
||||
{
|
||||
if (enemy.mass == 0 || enemy.HasEntityFlags(FLAG_NO_KNOCKBACK)) return;
|
||||
if (halo.spawnerEntity && halo.spawnerEntity->IsDescendantOf(&enemy)) return;
|
||||
|
||||
Vector away = vector_sub(enemy.pos, halo.pos);
|
||||
float distance = vector_length(away);
|
||||
if (distance <= 0) return;
|
||||
float push = std::min(HALO_PUSH_MAX, enemy.size + HALO_PUSH_RANGE - distance) * HALO_PUSH_SCALE;
|
||||
if (enemy.mass > HALO_HEAVY_MASS) push *= HALO_HEAVY_SHARE;
|
||||
else if (enemy.mass > HALO_HEAVIER_MASS) push *= HALO_HEAVIER_SHARE;
|
||||
else if (enemy.mass > HALO_HEAVIEST_MASS) push *= HALO_HEAVIEST_SHARE;
|
||||
enemy.velocity = vector_add(vector_scale(enemy.velocity, HALO_PUSH_CARRY), vector_scale(away, push / distance));
|
||||
}
|
||||
|
||||
// Telekinesis' halo blinks while it holds (its state), and pushes enemies away on its Push event.
|
||||
static void telekinesis_halo_update(Entity_Effect& halo)
|
||||
{
|
||||
std::string_view animation = halo.sprite.GetAnimation();
|
||||
if (halo.state >= 1 && animation != "Blink") halo.sprite.SetAnimation("Blink", SWITCH_KEEP_FRAME);
|
||||
else if (halo.state == 0 && halo.sprite.IsPlaying("Idle")) halo.sprite.SetAnimation("Idle", SWITCH_KEEP_FRAME);
|
||||
if (!halo.sprite.IsEventTriggered("Push")) return;
|
||||
|
||||
for (Entity* enemy : entity_query_radius(halo.pos, HALO_PUSH_RANGE, QUERY_ENEMIES))
|
||||
if (enemy->IsEnemy()) halo_push(halo, *enemy);
|
||||
}
|
||||
|
||||
// A static halo touches everything near it for nothing, unless friendly.
|
||||
static void static_halo_touch(Entity_Effect& halo)
|
||||
{
|
||||
if (halo.HasEntityFlags(FLAG_FRIENDLY)) return;
|
||||
float reach = halo.sprite.scale.x * HALO_STATIC_REACH;
|
||||
for (Entity* entity : entity_query_radius(halo.pos, reach, QUERY_FAMILIARS | QUERY_PLAYERS))
|
||||
if (entity->entityCollisionClass != ENTCOLL_NONE)
|
||||
entity->TakeDamage(0, HALO_STATIC_DAMAGE_FLAGS, EntityRef(&halo), HALO_STATIC_COUNTDOWN);
|
||||
}
|
||||
|
||||
// 006064cc (Update's case 123) A halo without its holder goes (the lasting ones disappear first), and goes (without
|
||||
// Update's shared end) with a dying enemy. Otherwise it shows while its holder lives, the static ones riding it, and
|
||||
// Telekinesis', Breath of Life's and Salvation's play their parts.
|
||||
static EffectUpdateEnd halo_update(Entity_Effect& halo)
|
||||
{
|
||||
bool isLasting = halo.subtype == HALO_STATIC || halo.subtype == HALO_STATIC_PRERENDERED ||
|
||||
halo.subtype == HALO_DARK_ARTS || halo.subtype == HALO_BREATH_OF_LIFE;
|
||||
Entity* holder = halo.parent;
|
||||
if (!holder)
|
||||
{
|
||||
if (!isLasting) halo.Remove();
|
||||
else
|
||||
{
|
||||
halo.velocity = {};
|
||||
halo.sprite.Play("Disappear");
|
||||
if (halo.sprite.IsFinished()) halo.Remove();
|
||||
}
|
||||
return EFFECT_UPDATE_RETURN;
|
||||
}
|
||||
|
||||
if (halo.subtype == HALO_TELEKINESIS) telekinesis_halo_update(halo);
|
||||
if (halo.subtype == HALO_BREATH_OF_LIFE && !halo.sprite.animState.IsLoopingAnimation() && halo.sprite.IsFinished())
|
||||
halo.sprite.Play("Idle");
|
||||
bool isStatic = halo.subtype == HALO_STATIC || halo.subtype == HALO_STATIC_PRERENDERED;
|
||||
if (!holder->IsEnemy())
|
||||
{
|
||||
if (!isStatic) halo.isVisible = !holder->isDead;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (static_cast<Entity_NPC*>(holder)->state == NPC_STATE_DEATH)
|
||||
{
|
||||
if (halo.sprite.GetAnimationData("Disappear")) halo.sprite.Play("Disappear");
|
||||
else halo.isVisible = false;
|
||||
}
|
||||
if (halo.sprite.IsFinished())
|
||||
{
|
||||
halo.Remove();
|
||||
return EFFECT_UPDATE_RETURN;
|
||||
}
|
||||
}
|
||||
|
||||
if (isStatic)
|
||||
{
|
||||
halo.pos = holder->pos;
|
||||
halo.velocity = holder->velocity;
|
||||
halo.posOffset = holder->posOffset;
|
||||
static_halo_touch(halo);
|
||||
}
|
||||
if (halo.subtype != HALO_SALVATION) return EFFECT_UPDATE_FINISH;
|
||||
bool isBig = halo.scale > HALO_SALVATION_BIG;
|
||||
halo.sprite.Play(isBig ? "Idle2" : "Idle1");
|
||||
float size = isBig ? halo.scale / 2 : halo.scale;
|
||||
halo.sprite.scale = vector_make(size, size);
|
||||
return EFFECT_UPDATE_FINISH;
|
||||
}
|
||||
|
||||
constexpr auto ITEM_EFFECT_BEHAVIOURS = std::to_array<EffectBehaviour>({
|
||||
{0, nullptr, nullptr, nullptr},
|
||||
{EFFECT_LADDER, ladder_init, nullptr, nullptr},
|
||||
@@ -1345,6 +1476,7 @@ constexpr auto ITEM_EFFECT_BEHAVIOURS = std::to_array<EffectBehaviour>({
|
||||
{EFFECT_ULTRA_DEATH_SCYTHE, scythe_init, effect_finishing<scythe_update>, nullptr},
|
||||
{EFFECT_BULLET_POOF_STATIC, static_poof_init, effect_poof_update, nullptr},
|
||||
{EFFECT_GUN, nullptr, nullptr, nullptr},
|
||||
{EFFECT_HALO, halo_init, halo_update, nullptr},
|
||||
});
|
||||
|
||||
std::span<const EffectBehaviour> item_effect_behaviours()
|
||||
|
||||
Reference in new issue
Block a user