Curation round 13: grid entities, more enemies, Caves, boss helpers and five bosses, chests and costumes, curses and alt stages, the Lua API
This commit is contained in:
1 parent
f8ce24fc6c
commit
8ae02a8422
160 files changed
+16231
-1689
No files matched your search
+42
-36
@@ -1,4 +1,5 @@
|
||||
#include "entity_npc.h"
|
||||
#include "boss_ai.h"
|
||||
#include "boss_death.h"
|
||||
#include "entity_config.h"
|
||||
#include "entity_effect.h"
|
||||
@@ -18,12 +19,15 @@
|
||||
#include "room.h"
|
||||
#include "room_config.h"
|
||||
#include "room_descriptor.h"
|
||||
#include "room_grid.h"
|
||||
#include "sfx_manager.h"
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <filesystem>
|
||||
|
||||
constexpr int ENTITY_ETERNAL_FLY = 96;
|
||||
// The frames of a controlled NPC's charge bar, empty to full.
|
||||
constexpr int CHARGE_BAR_FRAMES = 100;
|
||||
|
||||
constexpr int ENTITY_FEAR_IMMUNE = 205;
|
||||
constexpr int ENTITY_NO_DECOY_TYPE = 213;
|
||||
constexpr int ENTITY_MOMS_HEART_PLAYER_PICK = 53;
|
||||
@@ -88,7 +92,6 @@ struct LineCorner
|
||||
constexpr std::array<LineCorner, 4> LINE_CORNERS = {{{-5, -5}, {-5, 5}, {5, 5}, {5, -5}}};
|
||||
constexpr int GRID_PATH_PIT = 3000;
|
||||
constexpr uint32_t GRID_PATH_BAND = 1000;
|
||||
constexpr int STAGE_BEAST_DUNGEON = 35;
|
||||
constexpr float SHIELD_SECOND = 30;
|
||||
constexpr float SHIELD_BASE = 0.09f;
|
||||
constexpr float SHIELD_FALLOFF = 0.18f;
|
||||
@@ -102,7 +105,6 @@ constexpr uint64_t FLAG_FRIENDLY_BALL_DYING = 1ull << 60;
|
||||
// The burst effects a dead NPC leaves besides blood (Lua's EffectVariant).
|
||||
enum DeathBurst : int
|
||||
{
|
||||
EFFECT_POOP_EXPLOSION = 43,
|
||||
EFFECT_BURST_810 = 130,
|
||||
EFFECT_BURST_853 = 131,
|
||||
EFFECT_BURST_818 = 145
|
||||
@@ -150,7 +152,6 @@ constexpr int TRINKET_ICE_CUBE_ID = 188;
|
||||
constexpr int TRINKET_DEVILS_CROWN_ID = 185;
|
||||
constexpr int NULLITEM_DAMOCLES_WEAKNESS = 64;
|
||||
|
||||
constexpr int STAGE_VOID = 12;
|
||||
constexpr int CHALLENGE_ULTRA_HARD = 34;
|
||||
constexpr int CHALLENGE_BEANS = 30;
|
||||
constexpr int CHALLENGE_SLOW = 22;
|
||||
@@ -421,7 +422,7 @@ uint32_t room_grid_collision_at(const Vector& position)
|
||||
static int line_cell_collision(Room& room, int column, int row)
|
||||
{
|
||||
RoomConfig_Room* config = room.descriptor ? room.descriptor->data : nullptr;
|
||||
if (config && config->type == ROOM_DUNGEON && config->stageId == STAGE_BEAST_DUNGEON) return COLLISION_NONE;
|
||||
if (config && config->type == ROOM_DUNGEON && config->stageId == STAGE_ID_HOME) return COLLISION_NONE;
|
||||
if (column < 0 || column >= room.gridWidth || row < 0 || row >= room.gridHeight) return COLLISION_WALL;
|
||||
|
||||
int gridIndex = row * room.gridWidth + column;
|
||||
@@ -1398,7 +1399,7 @@ void Entity_NPC::appear_update()
|
||||
if (isChampion && championColorIdx < CHAMPION_COUNT)
|
||||
poof->SetColor(champion_sprite_color_get(championColorIdx), -1, COLOR_PRIORITY_DEFAULT, false, true);
|
||||
|
||||
int sound = isDeathSoundAlt ? SOUND_SUMMON_POOF : SOUND_SUMMONSOUND;
|
||||
int sound = isDeathSoundAlt ? SOUND_SUMMON_WAVE : SOUND_SUMMON_POOF;
|
||||
g_manager->sfxManager.Stop(sound);
|
||||
PlaySound(sound, 1, 2, false, 1);
|
||||
if (type == APPEAR_SOUND_TYPE_A || type == APPEAR_SOUND_TYPE_B || (type == ENTITY_BIG_HORN && variant == 0))
|
||||
@@ -1425,7 +1426,7 @@ void Entity_NPC::appear_update()
|
||||
}
|
||||
|
||||
if (std::ranges::find(APPEAR_EVENT_TYPES, type) != APPEAR_EVENT_TYPES.end())
|
||||
reconstruction_missing("Entity_NPC::Update 006c4b30: a Repentance boss's appear events");
|
||||
boss_appear_events(*this);
|
||||
if (state == NPC_STATE_APPEAR) friction *= APPEAR_FRICTION;
|
||||
appearFrames++;
|
||||
}
|
||||
@@ -1441,7 +1442,7 @@ void Entity_NPC::appear_init()
|
||||
}
|
||||
npc_ai_update(*this);
|
||||
if (championColorIdx == CHAMPION_FLY_PROTECTED || championColorIdx == CHAMPION_RAINBOW)
|
||||
spawn_at(ENTITY_ETERNAL_FLY, 0, 0, pos, this)->parent = this;
|
||||
spawn_at(ENTITY_ETERNALFLY, 0, 0, pos, this)->parent = this;
|
||||
if (HasEntityFlags(FLAG_APPEAR))
|
||||
{
|
||||
isVisible = false;
|
||||
@@ -1504,7 +1505,7 @@ void Entity_NPC::death_animation_start()
|
||||
return;
|
||||
}
|
||||
if (type == ENTITY_CHUB || type == ENTITY_LARRYJR || type == ENTITY_PIN || type == ENTITY_TURDLET)
|
||||
reconstruction_missing("Entity_NPC::Update 006c4b30: a segmented boss's death animations");
|
||||
return segment_death_animation_play(*this);
|
||||
if (type >= DEATH_NO_BURST_FIRST && type <= DEATH_NO_BURST_LAST) return;
|
||||
BloodExplode();
|
||||
trigger_kill_item_effects();
|
||||
@@ -2572,8 +2573,11 @@ void Entity_NPC::trigger_kill_item_effects()
|
||||
if (!HasEntityFlags(FLAG_NO_REWARD))
|
||||
{
|
||||
if (HasEntityFlags(FLAG_SPAWN_BLACK_HP) && dropRNG.Next() % BLACK_HEART_CHANCE == 0)
|
||||
reconstruction_missing(
|
||||
"Entity_NPC::trigger_kill_item_effects 006d5400: the black heart (Room::FindFreeTilePosition)");
|
||||
g_game->Spawn({.position = room_free_tile_position_find(pos, 0),
|
||||
.subType = HEART_BLACK,
|
||||
.type = ENTITY_PICKUP,
|
||||
.variant = PICKUP_HEART,
|
||||
.seed = Random()});
|
||||
Entity_Player* jarOwner =
|
||||
g_game->playerManager.RandomCollectibleOwner(COLLECTIBLE_JAR_OF_FLIES_ID, dropRNG.Next(), nullptr);
|
||||
if (jarOwner && (HasEntityFlags(FLAG_ADD_JAR_FLY | FLAG_FREEZE) || HasEntityFlags(FLAG_ICE_FROZEN)))
|
||||
@@ -2826,12 +2830,6 @@ void Entity_NPC::CreateGoldParticles(uint32_t)
|
||||
reconstruction_missing("Entity_NPC::CreateGoldParticles 0059e4c0");
|
||||
}
|
||||
|
||||
// 006b6830
|
||||
Entity_Effect* Entity_NPC::MakeBloodCloud(const Vector&, const ColorMod&)
|
||||
{
|
||||
reconstruction_missing("Entity_NPC::MakeBloodCloud 006b6830");
|
||||
}
|
||||
|
||||
// 006be760
|
||||
void Entity_NPC::KillUnique()
|
||||
{
|
||||
@@ -2850,24 +2848,12 @@ void Entity_NPC::update_frozen()
|
||||
reconstruction_missing("Entity_NPC::update_frozen 006ca930");
|
||||
}
|
||||
|
||||
// 006ccdd0
|
||||
void Entity_NPC::FireBossProjectiles(int, const Vector&, float, const ProjectileParams&)
|
||||
{
|
||||
reconstruction_missing("Entity_NPC::FireBossProjectiles 006ccdd0");
|
||||
}
|
||||
|
||||
// 006d0c60
|
||||
void* Entity_NPC::QueryNPCsType(void*, int, int)
|
||||
{
|
||||
reconstruction_missing("Entity_NPC::QueryNPCsType 006d0c60");
|
||||
}
|
||||
|
||||
// 006d0dd0
|
||||
EntityList* Entity_NPC::QueryNPCsGroup(EntityList*, int)
|
||||
{
|
||||
reconstruction_missing("Entity_NPC::QueryNPCsGroup 006d0dd0");
|
||||
}
|
||||
|
||||
// 006d1580
|
||||
void* Entity_NPC::fireplace_get_loot(void*, bool)
|
||||
{
|
||||
@@ -2886,16 +2872,17 @@ void Entity_NPC::TransferControl(Entity_NPC*)
|
||||
reconstruction_missing("Entity_NPC::TransferControl 006d88b0");
|
||||
}
|
||||
|
||||
// 006d8b20
|
||||
void Entity_NPC::SpawnControlTarget(int, float)
|
||||
// 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)
|
||||
{
|
||||
if (!aimTargetEffect && controllerID == -1 && inputMode <= 1) return;
|
||||
reconstruction_missing("Entity_NPC::SpawnControlTarget 006d8b20");
|
||||
}
|
||||
|
||||
// 006d8d30
|
||||
// 006d8d30 Where its aim target stands, or its own position without one.
|
||||
Vector Entity_NPC::GetAimTargetPosition()
|
||||
{
|
||||
reconstruction_missing("Entity_NPC::GetAimTargetPosition 006d8d30");
|
||||
return aimTargetEffect ? aimTargetEffect->pos : pos;
|
||||
}
|
||||
|
||||
// 006d8d80
|
||||
@@ -2904,10 +2891,29 @@ bool Entity_NPC::is_controller_input_idle()
|
||||
reconstruction_missing("Entity_NPC::is_controller_input_idle 006d8d80");
|
||||
}
|
||||
|
||||
// 006d8e40
|
||||
void Entity_NPC::UpdateChargeBar(float, float, float, bool)
|
||||
// 006d8e40 A controlled NPC's charge bar at value between start and end, hidden when full if asked.
|
||||
void Entity_NPC::UpdateChargeBar(float start, float end, float value, bool isHideWhenFull)
|
||||
{
|
||||
reconstruction_missing("Entity_NPC::UpdateChargeBar 006d8e40");
|
||||
if (controllerID == -1 && !chargeBarSprite.isLoaded) return;
|
||||
if (controllerID != -1)
|
||||
{
|
||||
if (!chargeBarSprite.isLoaded) chargeBarSprite.Load("gfx/chargebar.anm2", GRAPHICS_LOAD);
|
||||
chargeBarSprite.GetLayer(2)->isVisible = false;
|
||||
if (start == end) KAGE_LogMessage(LOG_ASSERT, (uint8_t*)"Start and End parameters cannot be the same!");
|
||||
|
||||
int frame = (int)(std::clamp((value - start) / (end - start), 0.0f, 1.0f) * CHARGE_BAR_FRAMES);
|
||||
if (!isHideWhenFull || frame < CHARGE_BAR_FRAMES)
|
||||
{
|
||||
if (chargeBarSprite.SetAnimation("Charging", SWITCH_KEEP_FRAME) && chargeBarSprite.animState.animData)
|
||||
{
|
||||
chargeBarSprite.animState.SetFrameFloat((float)frame);
|
||||
chargeBarSprite.animState.isPlaying = false;
|
||||
}
|
||||
chargeBarSprite.color._tint[3] = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
chargeBarSprite.color._tint[3] = 0;
|
||||
}
|
||||
|
||||
// 006d97e0
|
||||
|
||||
Reference in new issue
Block a user