diff --git a/db/names.tsv b/db/names.tsv index 0a21006..15c8fc8 100644 --- a/db/names.tsv +++ b/db/names.tsv @@ -1972,7 +1972,7 @@ 005cc510 std::vector<8byte>::_Emplace_reallocate ECX vector, args (where, const T*) for 8-byte elements: 1.5x growth (max 0x1fffffff), insert, move halves, _Change_array; used by Level::place_special_rooms, Entity_Player::RestoreGameState and the push_back wrapper FUN_005cbdd0 005ae140 NpcHelper::wormwood_spawn_splash ECX = Wormwood npc: spawns effect 1000.132 at its position and plays sound 474; returns the effect; called from NpcAI::ENTITY_WORMWOOD_main when it dives/emerges and ENTITY_WORMWOOD_segment_follow when a segment crosses the water line 005999b0 NpcHelper::tuff_twins_play_anim ECX = Tuff Twins npc: copies the anim name arg1 into a std::string, appends "B" when +0xbc4 is set (the alternate body), and ANM2::Play's it on the sprite (+0x48); callers are NpcAI::ENTITY_TUFF_TWINS, NpcHelper::tuff_twins_body_attack_anim and sibling state helpers -00589e40 std::vector::_Emplace_reallocate ECX vector of 0x70-byte elements (max 0x2492492): allocate 1.5x, render_quad_copy the new element and both halves, adopt (FUN_0041fe10), returns pointer to the inserted element; callers Entity_Pickup::GetLootList and render_quad_draw push ColorQuads +00589e40 std::vector::_Emplace_reallocate ECX vector of 0x70-byte elements (max 0x2492492): allocate 1.5x, render_quad_copy the new element and both halves, adopt (FUN_0041fe10), returns pointer to the inserted element; callers NpcHelper::scourge_chain_strip_render and render_quad_draw push ColorQuads 005711a0 std::vector<32byte>::_Clear_and_reserve_geometric ECX vector of 0x20-byte elements (max 0x7ffffff): frees old storage and allocates max(1.5x cap, n) leaving size 0, used before memmove in Game_StateSlot::operator_assign, GameState::copy_room_list, Level::generate_boss_room (MSVC vector::assign helper) 005688c0 NpcHelper::mother_set_collision_class ECX = Mother npc: sets _entityCollisionClass (0x188) to arg; for subtype 0 also on the two linked parts from the deque at +0xbf4 (indices +0xbfc+1/+2); NpcAI::ENTITY_MOTHER sets 4 / 0 on anim events, mother_spawn_parts sets 0 004d6f80 std::vector::erase ECX vector, args (out iterator, where): move-assigns every 0x78-byte EntitySaveState after where down by one (swapping the shared pointer/ANM2 ref members), destroys the last (invoke_pending_callbacks) and shrinks end by 0x78; used by NpcAI::ENTITY_MOMS_HEART_mausoleum_death and Game::spawn_bomb_crater on room save states @@ -3528,3 +3528,5 @@ 0086e6c0 LuaEngine::RunScript REPENTOGON LuaEngine::RunScript(const char* path), __thiscall: LoadModContent 008f464d loads ECX from g_luaEngine (00c71690); strings 'Running Lua Script: %s', 'There was an error running the lua file: %s' 008f6190 is_mod_name_less ListMods sort comparator: string_compare(a->_name, b->_name) >> 31 on two ModEntry* 0069d290 EntityConfig::link_tainted_players misnamed Menu_Mods::Update: LoadModContent 008f4681 calls it with ECX=g_manager+0x2a670 (_entityConfig); walks players from index 41 (0x29, 0x148-byte EntityConfig_Player), maps display names, then sets +0x124 of players whose _bSkinParentName matches +005832c0 NpcHelper::scourge_chain_strip_render Scourge chain (909.10) render: ZHL sig misnamed it Entity_Pickup::GetLootList; the first link draws the chain as one textured strip (boss_scourge.cpp) +0058a010 NpcHelper::singe_crater_ring misnamed Entity_NPC::Render by a ZHL prefix: the timer callback Singe's super blast (0058aed0) creates; rings the timer's cell with pits one cell further out per call (Entity_Effect state), poofs, rock chips, SOUND_ROCK_CRUMBLE (boss_singe.cpp) diff --git a/db/protos.zhl b/db/protos.zhl index b77650b..f6e5ecb 100644 --- a/db/protos.zhl +++ b/db/protos.zhl @@ -1173,7 +1173,7 @@ __thiscall void Entity_Player::update_ladder(); // plain RET at 007a002f; ECX __thiscall void Room::card_against_humanity_fill(); // plain RET at 007febf7; ECX = room (clears +0x11f4, reads grid width/height at +0xc/+0x10), no stack args __fastcall void NpcHelper::delirium_fire_pattern(Entity_NPC* npc); // plain RET at 004a9826; mov edi,ecx at entry, EDX written before read, no stack args; reads npc _deliriumAttackID/_deliriumAttackAngle __thiscall int Entity_Player::reroll_collectibles_on_damage(RNG* rng, bool isIncludeActives); // RET 0x8 at 005c92e3; REPENTOGON Entity_Player::RerollAllCollectibles(RNG*, bool includeActives) shape (here [ebp+8] is never read: it rolls the player D4 collectible RNG at _collectibleRNGs+0x11c0); byte [ebp+0xc] lets active slots 0/1 and Book of Virtues be rerolled; returns the rerolled count; callers UseActiveItem (D4) and TakeDamage (Tainted Eden) -__thiscall void Entity_Pickup::GetLootList(Vector* renderOffset); // RET 0x4 (at 00584130); misnamed by ZHL sig: renders the pickup sprite as textured quads along its Scourge-chain children (909.10); only caller 00589de0 passes its Vector* render offset +__stdcall void NpcHelper::scourge_chain_strip_render(Entity_NPC* npc, Vector* renderOffset); // RET 0x4 (at 00584130); was misnamed Entity_Pickup::GetLootList by ZHL sig: renders the pickup sprite as textured quads along its Scourge-chain children (909.10); only caller 00589de0 passes its Vector* render offset __thiscall void Level::generate_random_layout(); // plain RET (at 00751239); ECX = Level (mov edi,ecx; RNG at +0x182d4), no [ebp+8..] read __thiscall void Menu_KeyConfig::Render(); // plain RET (at 008da02c); aligned frame reads no [ebx+8..]; ECX = Manager+0xd284 menu (+0x14 ANM2, +0x11d/+0x84 flags) __thiscall void PauseScreen::Update(); // plain RET (at 009b5dc7/009b64c6/009b671c); aligned frame reads no [ebx+8..]; ECX = PauseScreen (Game+_pauseScreen) diff --git a/dump/all.c b/dump/all.c index 96ac02b..63b652a 100644 --- a/dump/all.c +++ b/dump/all.c @@ -225673,14 +225673,14 @@ void FUN_00583170(void) } -//@@ 005832c0 Entity_Pickup::GetLootList +//@@ 005832c0 NpcHelper::scourge_chain_strip_render /* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */ -/* ZHL [exact] __thiscall LootList Entity_Pickup::GetLootList(bool ShouldAdvance, Entity_Player* +/* ZHL [exact] __thiscall LootList NpcHelper::scourge_chain_strip_render(bool ShouldAdvance, Entity_Player* player); prototype: db/protos.zhl, confirmed by RET 4 */ -void __thiscall Entity_Pickup::GetLootList(Entity_Pickup *this,Vector *renderOffset) +void __thiscall NpcHelper::scourge_chain_strip_render(Entity_Pickup *this,Vector *renderOffset) { void *pvVar1; @@ -229236,7 +229236,7 @@ void FUN_00589de0(Vector *param_1) iVar2 = in_ECX->_parent; if (((iVar2 == 0) || (*(int *)(iVar2 + 0x28) != 0x38d)) || (*(int *)(iVar2 + 0x2c) != 10)) { - Entity_Pickup::GetLootList(in_ECX,param_1); + NpcHelper::scourge_chain_strip_render(in_ECX,param_1); } else if (*(int *)&in_ECX[1]._priceANM2._overlayAnimState._isPlaying == 6) { bVar1 = (in_ECX->_sprite)._flipX; @@ -229253,7 +229253,7 @@ void FUN_00589de0(Vector *param_1) /* DB: ECX vector of 0x70-byte elements (max 0x2492492): allocate 1.5x, render_quad_copy the new element and both halves, adopt (FUN_0041fe10), returns pointer to the inserted element; callers - Entity_Pickup::GetLootList and render_quad_draw push ColorQuads */ + NpcHelper::scourge_chain_strip_render and render_quad_draw push ColorQuads */ void * std::vector::_Emplace_reallocate(void *param_1,void *param_2) @@ -229351,7 +229351,7 @@ byte __thiscall Room::CanSpawnObstacleAtPos(Room *this,Vector *position,byte isF } -//@@ 0058a010 Entity_NPC::Render +//@@ 0058a010 NpcHelper::singe_crater_ring /* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */ /* ZHL [prefix33/34] __thiscall void Entity_NPC::Render(Vector *offset); diff --git a/dump/functions.tsv b/dump/functions.tsv index 4e8c8e0..490b20a 100644 --- a/dump/functions.tsv +++ b/dump/functions.tsv @@ -1523,7 +1523,7 @@ 005830e0 FUN_005830e0 40 00583110 FUN_00583110 86 00583170 FUN_00583170 309 -005832c0 Entity_Pickup::GetLootList 3699 +005832c0 NpcHelper::scourge_chain_strip_render 3699 00584140 NpcAI::ENTITY_SCOURGE_chain 9005 005864b0 NpcAI::ENTITY_SCOURGE_main 1665 00586b50 FUN_00586b50 240 @@ -1533,7 +1533,7 @@ 00589de0 FUN_00589de0 95 00589e40 std::vector::_Emplace_reallocate 327 00589f90 Room::CanSpawnObstacleAtPos 116 -0058a010 Entity_NPC::Render 2894 +0058a010 NpcHelper::singe_crater_ring 2894 0058ab60 FUN_0058ab60 161 0058ac10 NpcHelper::singe_explode_at 701 0058aed0 NpcAI::ENTITY_SINGE_body 10641 diff --git a/dump/strings.tsv b/dump/strings.tsv index f6708c0..a3b27f5 100644 --- a/dump/strings.tsv +++ b/dump/strings.tsv @@ -109,9 +109,9 @@ 00b1a488 SleepConditionVariableCS 00aef191:FUN_00aef191 00b1a4a4 WakeAllConditionVariable 00aef191:FUN_00aef191 00b1a4f0 id out of bounds\n 008e3830:Menu_Mods::Update 009db850:Menu_Save::update_sprites 009a3eb0:HUD::Render 00713ee0:GridEntity_Pit::update_sprite_edges 009b31c0:Menu_Options::Render 009b31c0:Menu_Options::Render 009b31c0:Menu_Options::Render 009b31c0:Menu_Options::Render 009b31c0:Menu_Options::Render 009b31c0:Menu_Options::Render 009b31c0:Menu_Options::Render 009b31c0:Menu_Options::Render 009b31c0:Menu_Options::Render 009b31c0:Menu_Options::Render 008da030:Menu_KeyConfig::update_gamepad_layout 00982100:Menu_Game::PreRenderContinueImg 00982100:Menu_Game::PreRenderContinueImg 00982100:Menu_Game::PreRenderContinueImg 00712180:GridEntity_Pit::Update 0099a300:GameOver::render_collectible_icon 0099a300:GameOver::render_collectible_icon 006e2570:Entity_Pickup::update_price_sprite 006e2570:Entity_Pickup::update_price_sprite 006e2570:Entity_Pickup::update_price_sprite 0040a7e0:ANM2::SetLayerFrame 00981140:Menu_Game::Update 00981140:Menu_Game::Update 00981140:Menu_Game::Update 00981140:Menu_Game::Update 00998880:GameOver::Render 008d0840:FUN_008d0840 008d0840:FUN_008d0840 008d8b00:Menu_KeyConfig::Update 00408b90:AnimationState::AdvanceLayerPosition 00408c10:AnimationState::AdvanceNullLayerPosition 00408e00:AnimationState::SetFrameFloat 00408e00:AnimationState::SetFrameFloat 00408ef0:AnimationState::SetLayerFrame 00408fc0:AnimationState::SetNullLayerFrame 00837ab0:GenericPrompt::Update 008e7f60:Menu_OnlineLobby::load_graphics 009b6840:netplay_lobby_menu_update 009b6840:netplay_lobby_menu_update 009b6840:netplay_lobby_menu_update 009b6840:netplay_lobby_menu_update 009b6840:netplay_lobby_menu_update 009b6840:netplay_lobby_menu_update 008ced40:Menu_Cutscenes::Update 0094ef10:Menu_Collection::Render 0094ef10:Menu_Collection::Render 009462c0:Menu_Challenge::Render 009462c0:Menu_Challenge::Render 009462c0:Menu_Challenge::Render 009462c0:Menu_Challenge::Render 008c66a0:Menu_Bestiary::Render 008c66a0:Menu_Bestiary::Render 008c66a0:Menu_Bestiary::Render 008c66a0:Menu_Bestiary::Render 008c66a0:Menu_Bestiary::Render 008c66a0:Menu_Bestiary::Render 008c66a0:Menu_Bestiary::Render 008ddae0:Menu_OnlineLobby::Render 008ed350:Menu_OnlineLobby::load_member_sprite 008ed350:Menu_OnlineLobby::load_member_sprite 009ed5a0:Menu_Stats::render_number 0094d500:Menu_Character::UpdateRotations 0094d500:Menu_Character::UpdateRotations 00665630:FUN_00665630 00665630:FUN_00665630 00565680:Entity_NPC::render_v1_layer_frames 00565680:Entity_NPC::render_v1_layer_frames 00565680:Entity_NPC::render_v1_layer_frames 009ecbc0:Menu_Stats::Update 009ecbc0:Menu_Stats::Update 009ecbc0:Menu_Stats::Update 009997c0:GameOver::Show 009997c0:GameOver::Show 009997c0:GameOver::Show 009997c0:GameOver::Show 009997c0:GameOver::Show 009997c0:GameOver::Show 008d4940:OnlinePlayerInfo::render_items 009b83a0:PauseScreen::render_my_stuff 008d4940:OnlinePlayerInfo::render_items -00b1a504 AnimationData is NULL\n 005832c0:Entity_Pickup::GetLootList 0040ac70:AnimationState::GetNullFrameById 0040ace0:AnimationState::GetNullFrame 0040ace0:AnimationState::GetNullFrame 0040add0:AnimationState::IsEventTriggered 0040ae70:AnimationState::WasEventTriggered 0040af10:AnimationState::NextEventTrigger 0040a220:AnimationState::GetLayerFrame 0094a500:Menu_Character::Render 0094a500:Menu_Character::Render 00998880:GameOver::Render 00998880:GameOver::Render 008e8af0:Menu_OnlineLobby::Render 00408c90:AnimationState::FireTriggersAtCurrentFrame 004b7c30:NpcHelper::hornfel_render_minecart 004b7c30:NpcHelper::hornfel_render_minecart 00935010:Backdrop::render_control_icon 008d3640:PauseScreen::render_items_page +00b1a504 AnimationData is NULL\n 005832c0:NpcHelper::scourge_chain_strip_render 0040ac70:AnimationState::GetNullFrameById 0040ace0:AnimationState::GetNullFrame 0040ace0:AnimationState::GetNullFrame 0040add0:AnimationState::IsEventTriggered 0040ae70:AnimationState::WasEventTriggered 0040af10:AnimationState::NextEventTrigger 0040a220:AnimationState::GetLayerFrame 0094a500:Menu_Character::Render 0094a500:Menu_Character::Render 00998880:GameOver::Render 00998880:GameOver::Render 008e8af0:Menu_OnlineLobby::Render 00408c90:AnimationState::FireTriggersAtCurrentFrame 004b7c30:NpcHelper::hornfel_render_minecart 004b7c30:NpcHelper::hornfel_render_minecart 00935010:Backdrop::render_control_icon 008d3640:PauseScreen::render_items_page 00b1a520 Animation::AdvancePosition cannot go backward (new: %d, cur: %d)\n 00408d00:AnimationState::AdvancePosition -00b1a564 LayerId out of bounds\n 008e3830:Menu_Mods::Update 009db850:Menu_Save::update_sprites 009a3eb0:HUD::Render 004bbe30:Entity_Pickup::Render 00713ee0:GridEntity_Pit::update_sprite_edges 009b31c0:Menu_Options::Render 009b31c0:Menu_Options::Render 009b31c0:Menu_Options::Render 009b31c0:Menu_Options::Render 009b31c0:Menu_Options::Render 009b31c0:Menu_Options::Render 009b31c0:Menu_Options::Render 009b31c0:Menu_Options::Render 009b31c0:Menu_Options::Render 009b31c0:Menu_Options::Render 009b31c0:Menu_Options::Render 005832c0:Entity_Pickup::GetLootList 00832850:Entity_Player::TriggerRoomExit 0040a8a0:FUN_0040a8a0 008da030:Menu_KeyConfig::update_gamepad_layout 00982100:Menu_Game::PreRenderContinueImg 00982100:Menu_Game::PreRenderContinueImg 00982100:Menu_Game::PreRenderContinueImg 00712180:GridEntity_Pit::Update 0040a220:AnimationState::GetLayerFrame 0099a300:GameOver::render_collectible_icon 0099a300:GameOver::render_collectible_icon 006e2570:Entity_Pickup::update_price_sprite 006e2570:Entity_Pickup::update_price_sprite 006e2570:Entity_Pickup::update_price_sprite 0094a500:Menu_Character::Render 0094a500:Menu_Character::Render 0040a7e0:ANM2::SetLayerFrame 00981140:Menu_Game::Update 00981140:Menu_Game::Update 00981140:Menu_Game::Update 00981140:Menu_Game::Update 00998880:GameOver::Render 00998880:GameOver::Render 00998880:GameOver::Render 008d0840:FUN_008d0840 008d0840:FUN_008d0840 00920940:NightmareScene::Render 008e8af0:Menu_OnlineLobby::Render 008d8b00:Menu_KeyConfig::Update 00408ef0:AnimationState::SetLayerFrame 00408f70:AnimationState::GetLayerFrameIdx 00837ab0:GenericPrompt::Update 004b7c30:NpcHelper::hornfel_render_minecart 004b7c30:NpcHelper::hornfel_render_minecart 008e7f60:Menu_OnlineLobby::load_graphics 009b6840:netplay_lobby_menu_update 009b6840:netplay_lobby_menu_update 009b6840:netplay_lobby_menu_update 009b6840:netplay_lobby_menu_update 009b6840:netplay_lobby_menu_update 009b6840:netplay_lobby_menu_update 008ced40:Menu_Cutscenes::Update 0094ef10:Menu_Collection::Render 0094ef10:Menu_Collection::Render 009462c0:Menu_Challenge::Render 009462c0:Menu_Challenge::Render 009462c0:Menu_Challenge::Render 009462c0:Menu_Challenge::Render 008c66a0:Menu_Bestiary::Render 008c66a0:Menu_Bestiary::Render 008c66a0:Menu_Bestiary::Render 008c66a0:Menu_Bestiary::Render 008c66a0:Menu_Bestiary::Render 008c66a0:Menu_Bestiary::Render 008c66a0:Menu_Bestiary::Render 008ddae0:Menu_OnlineLobby::Render 00935010:Backdrop::render_control_icon 008ed350:Menu_OnlineLobby::load_member_sprite 008ed350:Menu_OnlineLobby::load_member_sprite 009ed5a0:Menu_Stats::render_number 0094d500:Menu_Character::UpdateRotations 0094d500:Menu_Character::UpdateRotations 0093d510:Backdrop::render_wall_detail 00665630:FUN_00665630 00665630:FUN_00665630 00565680:Entity_NPC::render_v1_layer_frames 00565680:Entity_NPC::render_v1_layer_frames 00565680:Entity_NPC::render_v1_layer_frames 009ecbc0:Menu_Stats::Update 009ecbc0:Menu_Stats::Update 009ecbc0:Menu_Stats::Update 009997c0:GameOver::Show 009997c0:GameOver::Show 009997c0:GameOver::Show 009997c0:GameOver::Show 009997c0:GameOver::Show 009997c0:GameOver::Show 009997c0:GameOver::Show 008d3640:PauseScreen::render_items_page 008d4940:OnlinePlayerInfo::render_items 009b83a0:PauseScreen::render_my_stuff 008d4940:OnlinePlayerInfo::render_items +00b1a564 LayerId out of bounds\n 008e3830:Menu_Mods::Update 009db850:Menu_Save::update_sprites 009a3eb0:HUD::Render 004bbe30:Entity_Pickup::Render 00713ee0:GridEntity_Pit::update_sprite_edges 009b31c0:Menu_Options::Render 009b31c0:Menu_Options::Render 009b31c0:Menu_Options::Render 009b31c0:Menu_Options::Render 009b31c0:Menu_Options::Render 009b31c0:Menu_Options::Render 009b31c0:Menu_Options::Render 009b31c0:Menu_Options::Render 009b31c0:Menu_Options::Render 009b31c0:Menu_Options::Render 009b31c0:Menu_Options::Render 005832c0:NpcHelper::scourge_chain_strip_render 00832850:Entity_Player::TriggerRoomExit 0040a8a0:FUN_0040a8a0 008da030:Menu_KeyConfig::update_gamepad_layout 00982100:Menu_Game::PreRenderContinueImg 00982100:Menu_Game::PreRenderContinueImg 00982100:Menu_Game::PreRenderContinueImg 00712180:GridEntity_Pit::Update 0040a220:AnimationState::GetLayerFrame 0099a300:GameOver::render_collectible_icon 0099a300:GameOver::render_collectible_icon 006e2570:Entity_Pickup::update_price_sprite 006e2570:Entity_Pickup::update_price_sprite 006e2570:Entity_Pickup::update_price_sprite 0094a500:Menu_Character::Render 0094a500:Menu_Character::Render 0040a7e0:ANM2::SetLayerFrame 00981140:Menu_Game::Update 00981140:Menu_Game::Update 00981140:Menu_Game::Update 00981140:Menu_Game::Update 00998880:GameOver::Render 00998880:GameOver::Render 00998880:GameOver::Render 008d0840:FUN_008d0840 008d0840:FUN_008d0840 00920940:NightmareScene::Render 008e8af0:Menu_OnlineLobby::Render 008d8b00:Menu_KeyConfig::Update 00408ef0:AnimationState::SetLayerFrame 00408f70:AnimationState::GetLayerFrameIdx 00837ab0:GenericPrompt::Update 004b7c30:NpcHelper::hornfel_render_minecart 004b7c30:NpcHelper::hornfel_render_minecart 008e7f60:Menu_OnlineLobby::load_graphics 009b6840:netplay_lobby_menu_update 009b6840:netplay_lobby_menu_update 009b6840:netplay_lobby_menu_update 009b6840:netplay_lobby_menu_update 009b6840:netplay_lobby_menu_update 009b6840:netplay_lobby_menu_update 008ced40:Menu_Cutscenes::Update 0094ef10:Menu_Collection::Render 0094ef10:Menu_Collection::Render 009462c0:Menu_Challenge::Render 009462c0:Menu_Challenge::Render 009462c0:Menu_Challenge::Render 009462c0:Menu_Challenge::Render 008c66a0:Menu_Bestiary::Render 008c66a0:Menu_Bestiary::Render 008c66a0:Menu_Bestiary::Render 008c66a0:Menu_Bestiary::Render 008c66a0:Menu_Bestiary::Render 008c66a0:Menu_Bestiary::Render 008c66a0:Menu_Bestiary::Render 008ddae0:Menu_OnlineLobby::Render 00935010:Backdrop::render_control_icon 008ed350:Menu_OnlineLobby::load_member_sprite 008ed350:Menu_OnlineLobby::load_member_sprite 009ed5a0:Menu_Stats::render_number 0094d500:Menu_Character::UpdateRotations 0094d500:Menu_Character::UpdateRotations 0093d510:Backdrop::render_wall_detail 00665630:FUN_00665630 00665630:FUN_00665630 00565680:Entity_NPC::render_v1_layer_frames 00565680:Entity_NPC::render_v1_layer_frames 00565680:Entity_NPC::render_v1_layer_frames 009ecbc0:Menu_Stats::Update 009ecbc0:Menu_Stats::Update 009ecbc0:Menu_Stats::Update 009997c0:GameOver::Show 009997c0:GameOver::Show 009997c0:GameOver::Show 009997c0:GameOver::Show 009997c0:GameOver::Show 009997c0:GameOver::Show 009997c0:GameOver::Show 008d3640:PauseScreen::render_items_page 008d4940:OnlinePlayerInfo::render_items 009b83a0:PauseScreen::render_my_stuff 008d4940:OnlinePlayerInfo::render_items 00b1a57c layerId out of bounds\n 00408fc0:AnimationState::SetNullLayerFrame 00b1a594 ChampionColor 00409120:AnimationLayer::RenderFrame 00b1a5b0 KAGE_ColorTextureShader 00a1bd80:Font::render_glyph_quads 0083a3d0:render_beast_arena_background 00a18e90:KAGE::Graphics::Manager::Init 00a180b0:FUN_00a180b0 00817830:Room::render_water 00817830:Room::render_water 00a1c7d0:Font::draw_glyph_run 00a14050:shader_cache_find @@ -6256,7 +6256,7 @@ z 00b6becc music stopped playing\n 007e15a0:FUN_007e15a0 00b6bee8 Music::Crossfade: music already playing, only adjusting target volume.\n 007e1e70:MusicManager::Crossfade 00b6bf30 [warn] no music for ID %d (%s).\n 007e1d50:Music::Play 007e1e70:MusicManager::Crossfade -00b6bf54 RNG Seed is zero!\n 009eb880:Seeds::set_start_seed 009eb880:Seeds::set_start_seed 007db8d0:Entity_Player::get_seeded_variant 009eb980:Seeds::ForgetStageSeed 00793970:Entity_Player::trigger_collectible_effect_removed 00793970:Entity_Player::trigger_collectible_effect_removed 007c3980:Entity_Player::add_random_stat_up 00633990:familiar_wisp_pick_tear_color 00633990:familiar_wisp_pick_tear_color 00633990:familiar_wisp_pick_tear_color 00633990:familiar_wisp_pick_tear_color 00633990:familiar_wisp_pick_tear_color 0074399a:FUN_0074399a 00743a6c:FUN_00743a6c 00743a03:FUN_00743a03 00743af9:FUN_00743af9 0060bae0:Entity_Effect::setup_loot_preview 0062bb70:Entity_Familiar::room_enter 00743b49:FUN_00743b49 00743bf8:FUN_00743bf8 007bbbd0:Entity_Player::Init 007bbbd0:Entity_Player::Init 007bbbd0:Entity_Player::Init 007bbbd0:Entity_Player::Init 007bbbd0:Entity_Player::Init 007bbbd0:Entity_Player::Init 007bbbd0:Entity_Player::Init 007bbbd0:Entity_Player::Init 007bbbd0:Entity_Player::Init 007bbbd0:Entity_Player::Init 007bbbd0:Entity_Player::Init 007dbba0:Entity_Player::add_random_drug_item_effect 00743ba3:FUN_00743ba3 00743c43:FUN_00743c43 006fbc10:Game::Render 00743ced:FUN_00743ced 0074bce0:FUN_0074bce0 00733ca0:ItemPool::GetTrinket 00733ca0:ItemPool::GetTrinket 007dbc80:Entity_Player::AddRandomMomItemEffect 00743c93:FUN_00743c93 00813d90:Room::init_shop_item_slots 00813d90:Room::init_shop_item_slots 00813d90:Room::init_shop_item_slots 00813d90:Room::init_shop_item_slots 00813d90:Room::init_shop_item_slots 00813d90:Room::init_shop_item_slots 00813d90:Room::init_shop_item_slots 00813d90:Room::init_shop_item_slots 007dbd70:Entity_Player::ModelingClay_roll 008e3db0:AnimationLayer::RenderFrame 0080bd20:Room::render_player_light 006bbdc0:Entity_Pickup::Update 006bbdc0:Entity_Pickup::Update 006bbdc0:Entity_Pickup::Update 006bbdc0:Entity_Pickup::Update 0080bd20:Room::render_player_light 006bbdc0:Entity_Pickup::Update 006bbdc0:Entity_Pickup::Update 006bbdc0:Entity_Pickup::Update 006bbdc0:Entity_Pickup::Update 006bbdc0:Entity_Pickup::Update 006bbdc0:Entity_Pickup::Update 006bbdc0:Entity_Pickup::Update 006bbdc0:Entity_Pickup::Update 006bbdc0:Entity_Pickup::Update 006bbdc0:Entity_Pickup::Update 006bbdc0:Entity_Pickup::Update 006bbdc0:Entity_Pickup::Update 006bbdc0:Entity_Pickup::Update 006bbdc0:Entity_Pickup::Update 006bbdc0:Entity_Pickup::Update 006bbdc0:Entity_Pickup::Update 006bbdc0:Entity_Pickup::Update 00743d94:FUN_00743d94 00743e72:FUN_00743e72 0085bed0:EntitySpawner::Spawn 007dbeb0:Entity_Player::twins_duplicate_familiars 007dbeb0:Entity_Player::twins_duplicate_familiars 0074beb0:Level::init_rotgut_dungeon_room 0074beb0:Level::init_rotgut_dungeon_room 00743f73:FUN_00743f73 00743f23:FUN_00743f23 005cbfe0:FUN_005cbfe0 00743fc3:Level::generate_greed_chunk_place 007abf80:Entity_Player::active_used_post 006e30a0:Entity_Pickup::Morph 006e30a0:Entity_Pickup::Morph 005b30b0:alabaster_box_timer_callback 005b30b0:alabaster_box_timer_callback 005b30b0:alabaster_box_timer_callback 005b30b0:alabaster_box_timer_callback 005b30b0:alabaster_box_timer_callback 007eb1b0:Room::PlayMusic 007eb1b0:Room::PlayMusic 007fb250:Room::SpawnClearAward 008332e0:Ambush::shuffle_waves 00763370:Entity_Player::CheckFamiliar 007333f0:ItemPool::should_force_magic_skin 007333f0:ItemPool::should_force_magic_skin 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0042b560:ItemPool::ReplaceBlacklistedPickup 0042b560:ItemPool::ReplaceBlacklistedPickup 007435c8:FUN_007435c8 0099b520:GridEntity_Gravity::PostInit 00813520:Room::FindFreePickupSpawnPosition 0078b640:Entity_Player::Render 00733610:ItemPool::GetCollectible 00833600:Ambush::SpawnWave 00833600:Ambush::SpawnWave 00833600:Ambush::SpawnWave 00833600:Ambush::SpawnWave 00833600:Ambush::SpawnWave 00713760:GridEntity_Pit::BeginBatches 00713760:GridEntity_Pit::BeginBatches 00713760:GridEntity_Pit::BeginBatches 00543720:NpcAI::ENTITY_PORTAL 0074371e:FUN_0074371e 0074378b:Level::generate_greed_chunk_rooms 00422830:BossPool::GetBossId 00802980:Room::Update 00802980:Room::Update 00802980:Room::Update 00802980:Room::Update 00802980:Room::Update 00802980:Room::Update 007fa920:RoomClear_PickVariant 007fa920:RoomClear_PickVariant 007fa920:RoomClear_PickVariant 007fa920:RoomClear_PickVariant 007fa920:RoomClear_PickVariant 007fa920:RoomClear_PickVariant 007fa920:RoomClear_PickVariant 007fa920:RoomClear_PickVariant 007fa920:RoomClear_PickVariant 007fa920:RoomClear_PickVariant 007fa920:RoomClear_PickVariant 007fa920:RoomClear_PickVariant 007fa920:RoomClear_PickVariant 0062a930:Entity_Familiar::AddCoins 0062a930:Entity_Familiar::AddCoins 00802980:Room::Update 00802980:Room::Update 00802980:Room::Update 00802980:Room::Update 00802980:Room::Update 005caa70:Entity_Player::console_spawn 005caa70:Entity_Player::console_spawn 00612bb0:Entity_Familiar::FollowParent 00612bb0:Entity_Familiar::FollowParent 00682b90:string_scramble_seeded 00682b90:string_scramble_seeded 0099acc0:GridEntity_Decoration::BeginBatches 0065ad30:reroll_entity_to_free_tile 0065ad30:reroll_entity_to_free_tile 00732dc0:ItemPool::GetPoolForRoom 006dae40:Entity_Pickup::GetChestLoot 006dae40:Entity_Pickup::GetChestLoot 006dae40:Entity_Pickup::GetChestLoot 006dae40:Entity_Pickup::GetChestLoot 006dae40:Entity_Pickup::GetChestLoot 006dae40:Entity_Pickup::GetChestLoot 006dae40:Entity_Pickup::GetChestLoot 006dae40:Entity_Pickup::GetChestLoot 006dae40:Entity_Pickup::GetChestLoot 006dae40:Entity_Pickup::GetChestLoot 006dae40:Entity_Pickup::GetChestLoot 006dae40:Entity_Pickup::GetChestLoot 006dae40:Entity_Pickup::GetChestLoot 006dae40:Entity_Pickup::GetChestLoot 006dae40:Entity_Pickup::GetChestLoot 006dae40:Entity_Pickup::GetChestLoot 006dae40:Entity_Pickup::GetChestLoot 007c2e90:Entity_Player::GetGlitchBabySubType 0071af60:GridEntity_Rock::TrySpawnWorms 006a2050:Entity_Bomb::Init 008020d0:Room::update_deaths_list 008020d0:Room::update_deaths_list 008020d0:Room::update_deaths_list 0058a010:Entity_NPC::Render 0058a010:Entity_NPC::Render 00712180:GridEntity_Pit::Update 00712180:GridEntity_Pit::Update 00712180:GridEntity_Pit::Update 00712180:GridEntity_Pit::Update 0059a2d0:NpcAI::ENTITY_TUFF_TWINS 005b23f0:Entity_Player::use_card_hagalaz 005b23f0:Entity_Player::use_card_hagalaz 005ca470:Entity_Player::TriggerBookOfVirtues 0061a4e0:Entity_Familiar::ai_pickup_sack 0061a4e0:Entity_Familiar::ai_pickup_sack 0061a4e0:Entity_Familiar::ai_pickup_sack 0061a4e0:Entity_Familiar::ai_pickup_sack 0061a4e0:Entity_Familiar::ai_pickup_sack 0061a4e0:Entity_Familiar::ai_pickup_sack 0061a4e0:Entity_Familiar::ai_pickup_sack 0061a4e0:Entity_Familiar::ai_pickup_sack 0061a4e0:Entity_Familiar::ai_pickup_sack 0061a4e0:Entity_Familiar::ai_pickup_sack 0061a4e0:Entity_Familiar::ai_pickup_sack 0061a4e0:Entity_Familiar::ai_pickup_sack 0061a4e0:Entity_Familiar::ai_pickup_sack 0061a4e0:Entity_Familiar::ai_pickup_sack 0061a4e0:Entity_Familiar::ai_pickup_sack 0061a4e0:Entity_Familiar::ai_pickup_sack 0061a4e0:Entity_Familiar::ai_pickup_sack 0074a500:Level::generate_home 0074a500:Level::generate_home 0074a500:Level::generate_home 0074a500:Level::generate_home 0074a500:Level::generate_home 0074a500:Level::generate_home 0074a500:Level::generate_home 0074a500:Level::generate_home 0074a500:Level::generate_home 0074a500:Level::generate_home 0074a500:Level::generate_home 0074a500:Level::generate_home 0074a500:Level::generate_home 0074a500:Level::generate_home 0074a500:Level::generate_home 0074a500:Level::generate_home 0074a500:Level::generate_home 0074a500:Level::generate_home 0074a500:Level::generate_home 0074a500:Level::generate_home 0074a500:Level::generate_home 004da590:NpcAI::ENTITY_ROTTEN_GAPER 004218e0:BossPool::init 00579890:NpcAI::ENTITY_REAP_CREEP 00579890:NpcAI::ENTITY_REAP_CREEP 004098a0:AnimationLayer::GetSourceQuad 004098a0:AnimationLayer::GetSourceQuad 004b1910:NpcHelper::gideon_spawn_wave 004b1910:NpcHelper::gideon_spawn_wave 004b1910:NpcHelper::gideon_spawn_wave 004b1910:NpcHelper::gideon_spawn_wave 004b1910:NpcHelper::gideon_spawn_wave 006e1910:FUN_006e1910 007499a0:Level::InitializeDevilAngelRoom 007499a0:Level::InitializeDevilAngelRoom 007499a0:Level::InitializeDevilAngelRoom 006c1ac0:Entity_NPC::shopkeeper_get_loot 006c1ac0:Entity_NPC::shopkeeper_get_loot 006c1ac0:Entity_NPC::shopkeeper_get_loot 006c1ac0:Entity_NPC::shopkeeper_get_loot 006c1ac0:Entity_NPC::shopkeeper_get_loot 00631b20:Entity_Familiar::delirium_morph 00631b20:Entity_Familiar::delirium_morph 009b1b20:level_generator_rooms_shuffle 00759bf0:Entity_Player::AddSwarmFlyOrbital 00711bb0:GridEntity_Lock::break_open 00711bb0:GridEntity_Lock::break_open 00711bb0:GridEntity_Lock::break_open 00711bb0:GridEntity_Lock::break_open 00921ce0:NightmareScene::Show 00921ce0:NightmareScene::Show 00921ce0:NightmareScene::Show 00921ce0:NightmareScene::Show 00921ce0:NightmareScene::Show 00921ce0:NightmareScene::Show 00541ce0:NpcAI::ENTITY_MEATBALL 00541ce0:NpcAI::ENTITY_MEATBALL 007d9ca0:FUN_007d9ca0 007d9d00:Entity_Player::CalculateBagOfCraftingOutput 007d9d00:Entity_Player::CalculateBagOfCraftingOutput 00741e60:Level::place_rooms_backwards 00741e60:Level::place_rooms_backwards 00741e60:Level::place_rooms_backwards 00741e60:Level::place_rooms_backwards 00741e60:Level::place_rooms_backwards 00741e60:Level::place_rooms_backwards 00741e60:Level::place_rooms_backwards 00741e60:Level::place_rooms_backwards 00741e60:Level::place_rooms_backwards 00741e60:Level::place_rooms_backwards 00741e60:Level::place_rooms_backwards 00741e60:Level::place_rooms_backwards 00741e60:Level::place_rooms_backwards 00741e60:Level::place_rooms_backwards 00751650:Level::generate_dark_closet 00751650:Level::generate_dark_closet 00751650:Level::generate_dark_closet 006e1e90:Entity_Pickup::load_collectible_gfx 00751650:Level::generate_dark_closet 00751650:Level::generate_dark_closet 00751650:Level::generate_dark_closet 00709fb0:GridEntity::hurt_func 00709fb0:GridEntity::hurt_func 00709fb0:GridEntity::hurt_func 00709fb0:GridEntity::hurt_func 00709fb0:GridEntity::hurt_func 00719f80:GridEntity_Rock::BeginBatches 00719f80:GridEntity_Rock::BeginBatches 00719f80:GridEntity_Rock::BeginBatches 00719f80:GridEntity_Rock::BeginBatches 00719f80:GridEntity_Rock::BeginBatches 007e9020:RNG::RandomInt 007e90f0:RNG::Next 007e9080:RNG::RandomFloat 00739080:Level::pick_boss_room_config 00739080:Level::pick_boss_room_config 007a1090:Entity_Player::TriggerDeath 007a1090:Entity_Player::TriggerDeath 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 005c93b0:Entity_Player::AddWisp 00591460:NpcAI::ENTITY_SIREN 009e14b0:trigger_effect_execute 009e14b0:trigger_effect_execute 009e14b0:trigger_effect_execute 009e14b0:trigger_effect_execute 00751650:Level::generate_dark_closet 005c96f0:Entity_Player::AddItemWisp 006d97e0:Entity_NPC::split 006d97e0:Entity_NPC::split 006d97e0:Entity_NPC::split 007c97f0:Entity_Player::apply_victory_lap_penalty 00740860:Level::GetRandomRoomIndex 00740860:Level::GetRandomRoomIndex 007c8830:Entity_Player::spawn_locusts 007508c0:Level::generate_random_layout 007508c0:Level::generate_random_layout 007508c0:Level::generate_random_layout 007508c0:Level::generate_random_layout 007508c0:Level::generate_random_layout 007508c0:Level::generate_random_layout 007508c0:Level::generate_random_layout 007508c0:Level::generate_random_layout 007508c0:Level::generate_random_layout 007508c0:Level::generate_random_layout 007508c0:Level::generate_random_layout 007508c0:Level::generate_random_layout 007508c0:Level::generate_random_layout 007508c0:Level::generate_random_layout 007508c0:Level::generate_random_layout 005c88a0:Entity_Player::reroll_collectibles_on_damage 005c88a0:Entity_Player::reroll_collectibles_on_damage 00428940:Seeds::Init3 00428940:Seeds::Init3 00428940:Seeds::Init3 00428940:Seeds::Init3 004d8910:spawn_small_maggot_jump 007009a0:Game::BombTearflagEffects 009e0ad0:ProceduralEffect::roll_spawn_target 009e0ad0:ProceduralEffect::roll_spawn_target 009e0ad0:ProceduralEffect::roll_spawn_target 009e0ad0:ProceduralEffect::roll_spawn_target 006e8ae0:Entity_Pickup::HandleCollision 006e8ae0:Entity_Pickup::HandleCollision 006e8ae0:Entity_Pickup::HandleCollision 00990a40:FXLayers::LoadConfig 00990a40:FXLayers::LoadConfig 00990a40:FXLayers::LoadConfig 00990a40:FXLayers::LoadConfig 00990a40:FXLayers::LoadConfig 00990a40:FXLayers::LoadConfig 00990a40:FXLayers::LoadConfig 00990a40:FXLayers::LoadConfig 00990a40:FXLayers::LoadConfig 00738ab0:Level::place_room 004d8b50:spawn_small_maggot 00618b00:FamiliarAI::gb_bug 00618b00:FamiliarAI::gb_bug 00618b00:FamiliarAI::gb_bug 009b0b00:LevelGenerator::get_neighbor_candidates 004d8d10:NpcHelper::gaper_l2_spawn_maggot 004f8df0:NpcAI::ENTITY_BOMB_GRIMACE 004f8df0:NpcAI::ENTITY_BOMB_GRIMACE 00540df0:NpcAI::ENTITY_SWARM 00930ee0:FUN_00930ee0 00528ec0:NpcHelper::migraine_timer_spawn 00528ec0:NpcHelper::migraine_timer_spawn 00528ec0:NpcHelper::migraine_timer_spawn 00528ec0:NpcHelper::migraine_timer_spawn 004b0fe0:NpcHelper::gideon_spawn_stairs 007a8fd0:Entity_Player::TriggerRoomClear 007a8fd0:Entity_Player::TriggerRoomClear 007a8fd0:Entity_Player::TriggerRoomClear 007a8fd0:Entity_Player::TriggerRoomClear 007a8fd0:Entity_Player::TriggerRoomClear 007a8fd0:Entity_Player::TriggerRoomClear 007a8fd0:Entity_Player::TriggerRoomClear 007a8fd0:Entity_Player::TriggerRoomClear 007a8fd0:Entity_Player::TriggerRoomClear 007a8fd0:Entity_Player::TriggerRoomClear 009e0f60:ProceduralEffect::roll_params 009e0f60:ProceduralEffect::roll_params 007c8050:Entity_Player::AddImmaculateConceptionCounter 005c8020:everything_jar_crack_the_sky_timer 005c8020:everything_jar_crack_the_sky_timer 005c8020:everything_jar_crack_the_sky_timer 00678080:Entity_Tear::fire_split_projectiles 007481d0:Level::ForceHorsemanBoss 00820170:Room::TrySpawnBlueWombDoor 00468180:NpcAI::ENTITY_DADDYLONGLEGS 00468180:NpcAI::ENTITY_DADDYLONGLEGS 006e02f0:Entity_Pickup::Init 006e02f0:Entity_Pickup::Init 007a8350:Entity_Player::TriggerNewRoom_TemporaryEffects 007a8350:Entity_Player::TriggerNewRoom_TemporaryEffects 007a8350:Entity_Player::TriggerNewRoom_TemporaryEffects 006d03e0:Entity_NPC::MakeChampion 006d03e0:Entity_NPC::MakeChampion 005c83f0:everything_jar_shopkeeper_rain_timer 005c83f0:everything_jar_shopkeeper_rain_timer 007f83b0:Room::TrySpawnDevilRoomDoor 007f83b0:Room::TrySpawnDevilRoomDoor 007f83b0:Room::TrySpawnDevilRoomDoor 009b04d0:LevelGenerator::generate_rooms 009b04d0:LevelGenerator::generate_rooms 009b04d0:LevelGenerator::generate_rooms 009b04d0:LevelGenerator::generate_rooms 009b04d0:LevelGenerator::generate_rooms 009b04d0:LevelGenerator::generate_rooms 009b04d0:LevelGenerator::generate_rooms 00790530:Entity_Player::DropCollectible 005505c0:NpcAI::ENTITY_SWARM_SPIDER 00838560:GridEntity_Statue::Destroy 00838560:GridEntity_Statue::Destroy 00838560:GridEntity_Statue::Destroy 00650610:FamiliarAI::vanishing_twin 00650610:FamiliarAI::vanishing_twin 00650610:FamiliarAI::vanishing_twin 00650610:FamiliarAI::vanishing_twin 008f06e0:Menu_SpecialSeeds::Render 008f06e0:Menu_SpecialSeeds::Render 009e0700:ProceduralEffect::roll_trigger_target 009e0700:ProceduralEffect::roll_trigger_target 00548720:NpcHelper::leper_flesh_ai 00548720:NpcHelper::leper_flesh_ai 0074f820:Level::InitStageSeeds 007178c0:GridEntity_Poop::spawn_drops 007178c0:GridEntity_Poop::spawn_drops 007178c0:GridEntity_Poop::spawn_drops 007178c0:GridEntity_Poop::spawn_drops 007178c0:GridEntity_Poop::spawn_drops 007178c0:GridEntity_Poop::spawn_drops 007178c0:GridEntity_Poop::spawn_drops 007178c0:GridEntity_Poop::spawn_drops 007178c0:GridEntity_Poop::spawn_drops 007178c0:GridEntity_Poop::spawn_drops 007178c0:GridEntity_Poop::spawn_drops 007178c0:GridEntity_Poop::spawn_drops 007178c0:GridEntity_Poop::spawn_drops 007178c0:GridEntity_Poop::spawn_drops 007178c0:GridEntity_Poop::spawn_drops 007178c0:GridEntity_Poop::spawn_drops 007178c0:GridEntity_Poop::spawn_drops 007178c0:GridEntity_Poop::spawn_drops 007178c0:GridEntity_Poop::spawn_drops 007178c0:GridEntity_Poop::spawn_drops 007178c0:GridEntity_Poop::spawn_drops 007178c0:GridEntity_Poop::spawn_drops 007178c0:GridEntity_Poop::spawn_drops 006ef890:Seeds::GetNextSeed 004878a0:NpcAI::ENTITY_CAGE 004878a0:NpcAI::ENTITY_CAGE 007c7960:Entity_Player::GetZodiacEffect 007f7a40:Room::TrySpawnSecretExit 005c7ad0:FUN_005c7ad0 00707ad0:r_key_timer_callback 00967a70:Entity_Knife::apply_wiggle 00827bf0:Room::spawn_sanguine_bond_spikes 0074fbe0:Level::try_place_random_room 0074fbe0:Level::try_place_random_room 0074fbe0:Level::try_place_random_room 0074fbe0:Level::try_place_random_room 0074fbe0:Level::try_place_random_room 0074fbe0:Level::try_place_random_room 0074fbe0:Level::try_place_random_room 0074fbe0:Level::try_place_random_room 0074fbe0:Level::try_place_random_room 0074fbe0:Level::try_place_random_room 0074fbe0:Level::try_place_random_room 0081fb70:LRoomTileDesc::GetRandomTile 0081fb70:LRoomTileDesc::GetRandomTile 0081fb70:LRoomTileDesc::GetRandomTile 0081fb70:LRoomTileDesc::GetRandomTile 0081fb70:LRoomTileDesc::GetRandomTile 007d7c30:Entity_Player::trigger_cracked_orb 0097fc10:Entity_Laser::ResetSpriteScale 004bfd30:NpcAI::ENTITY_HUSH 004bfd30:NpcAI::ENTITY_HUSH 004bfd30:NpcAI::ENTITY_HUSH 004bfd30:NpcAI::ENTITY_HUSH 004bfd30:NpcAI::ENTITY_HUSH 004bfd30:NpcAI::ENTITY_HUSH 004bfd30:NpcAI::ENTITY_HUSH 004f7e60:NpcAI::ENTITY_MORNINGSTAR 005c7f20:FUN_005c7f20 00737010:ItemPool::get_chaos_pool 00737010:ItemPool::get_chaos_pool 0067f0d0:RandomVector 0074f0c0:Level::generate_mirror_world 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 006bf120:NpcHelper::ChampionDrop 006bf120:NpcHelper::ChampionDrop 006bf120:NpcHelper::ChampionDrop 006bf120:NpcHelper::ChampionDrop 006bf120:NpcHelper::ChampionDrop 006bf120:NpcHelper::ChampionDrop 006bf120:NpcHelper::ChampionDrop 006bf120:NpcHelper::ChampionDrop 006bf120:NpcHelper::ChampionDrop 006bf120:NpcHelper::ChampionDrop 006bf120:NpcHelper::ChampionDrop 009dcc70:ItemPool::CreateGlitchedCollectible 007d7290:Entity_Player::UsePoopSpell 0074f360:Level::generate_mineshaft 0074f360:Level::generate_mineshaft 0074f360:Level::generate_mineshaft 0044f2b0:NpcAI::ENTITY_BEAST_ultra_war_bomb 0044f2b0:NpcAI::ENTITY_BEAST_ultra_war_bomb 00816910:Room::SpawnGreedModeWave 00816910:Room::SpawnGreedModeWave 00816910:Room::SpawnGreedModeWave 00816910:Room::SpawnGreedModeWave 00816910:Room::SpawnGreedModeWave 00816910:Room::SpawnGreedModeWave 0079f3c0:Entity_Player::update_ladder 0079f3c0:Entity_Player::update_ladder 00737380:ItemPool::GetCollectibleFromList 00737380:ItemPool::GetCollectibleFromList 00937420:Backdrop::pre_render_walls 00937420:Backdrop::pre_render_walls 00937420:Backdrop::pre_render_walls 00937420:Backdrop::pre_render_walls 00937420:Backdrop::pre_render_walls 00937420:Backdrop::pre_render_walls 0071f4b0:FUN_0071f4b0 0071f4b0:FUN_0071f4b0 007475b0:Level::RestoreGameState 007cf610:Entity_Player::RemoveCollectible 008276e0:Room::spawn_options_alternative 008276e0:Room::spawn_options_alternative 008276e0:Room::spawn_options_alternative 007bf6c0:Entity_Player::GetTearHitParams 007bf6c0:Entity_Player::GetTearHitParams 007376c0:ItemPool::GetCardImpl 007376c0:ItemPool::GetCardImpl 007376c0:ItemPool::GetCardImpl 007bf6c0:Entity_Player::GetTearHitParams 0062f7f0:FamiliarAI::bumbo 004d77b0:NpcAI::ENTITY_SMALL_MAGGOT 004d77b0:NpcAI::ENTITY_SMALL_MAGGOT 004d77b0:NpcAI::ENTITY_SMALL_MAGGOT 006ae820:Entity::Update 006ae820:Entity::Update 00816910:Room::SpawnGreedModeWave 00426a50:DailyChallenge::Init 00426a50:DailyChallenge::Init 00426a50:DailyChallenge::Init 00426a50:DailyChallenge::Init 00426a50:DailyChallenge::Init 00426a50:DailyChallenge::Init 0075ea40:Entity_Player::render_charge_bars 0043eb10:Entity_Familiar::GetRandomWisp 00996b30:FXLayers::grow_vein_branches 00736ba0:ItemPool::ForceAddPillEffect 007a6c50:Entity_Player::room_enter 007a6c50:Entity_Player::room_enter 007a6c50:Entity_Player::room_enter 00736c30:ItemPool::on_pill_used 006f6dd0:Game::StartDailyChallenge 00716db0:spawn_poop_rewards 00716db0:spawn_poop_rewards 00716db0:spawn_poop_rewards 00716db0:spawn_poop_rewards 00716db0:spawn_poop_rewards 00716db0:spawn_poop_rewards 00716db0:spawn_poop_rewards 00716db0:spawn_poop_rewards 00716db0:spawn_poop_rewards 00716db0:spawn_poop_rewards 00716db0:spawn_poop_rewards 00716db0:spawn_poop_rewards 00716db0:spawn_poop_rewards 00716db0:spawn_poop_rewards 00716db0:spawn_poop_rewards 00716db0:spawn_poop_rewards 00716db0:spawn_poop_rewards 00716db0:spawn_poop_rewards 00716db0:spawn_poop_rewards 006d6d80:Entity_NPC::room_enter 00996e90:FXLayers::update_vein_branch 006e6e40:Entity_Pickup::TryOpenChest 006e6e40:Entity_Pickup::TryOpenChest 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 00755470:Entity_Player::Init 009960b0:Game::start_poop_cloud_screen_effect 009960b0:Game::start_poop_cloud_screen_effect 009960b0:Game::start_poop_cloud_screen_effect 009960b0:Game::start_poop_cloud_screen_effect 009960b0:Game::start_poop_cloud_screen_effect 009960b0:Game::start_poop_cloud_screen_effect 00816000:Room::ShopReshuffle 00816000:Room::ShopReshuffle 0073e0a0:Level::load_room 0073e0a0:Level::load_room 0073e0a0:Level::load_room 0073e0a0:Level::load_room 0073e0a0:Level::load_room 009be140:PlayerManager::RandomCollectibleOwner 009ae170:LevelGenerator::place_secret_room 009ae170:LevelGenerator::place_secret_room 007fe220:Room::card_against_humanity_fill 007fe220:Room::card_against_humanity_fill 007fe220:Room::card_against_humanity_fill 007fe220:Room::card_against_humanity_fill 007fe220:Room::card_against_humanity_fill 007fe220:Room::card_against_humanity_fill 007fe220:Room::card_against_humanity_fill 0046e290:NpcAI::ENTITY_DUKE 0046e290:NpcAI::ENTITY_DUKE 0046e290:NpcAI::ENTITY_DUKE 0046e290:NpcAI::ENTITY_DUKE 009be3e0:PlayerManager::RandomTrinketOwner 00436330:Entity_Familiar::WispInit 00436330:Entity_Familiar::WispInit 00436330:Entity_Familiar::WispInit 00436330:Entity_Familiar::WispInit 00436330:Entity_Familiar::WispInit 00436330:Entity_Familiar::WispInit 0080e320:Room::pick_special_clear_award 006ee440:Isaac::GetRandomPickupVelocity 006ee440:Isaac::GetRandomPickupVelocity 004d64f0:NpcAI::ENTITY_MOMS_HEART_mausoleum_death 004d64f0:NpcAI::ENTITY_MOMS_HEART_mausoleum_death 004d64f0:NpcAI::ENTITY_MOMS_HEART_mausoleum_death 004d64f0:NpcAI::ENTITY_MOMS_HEART_mausoleum_death 004d64f0:NpcAI::ENTITY_MOMS_HEART_mausoleum_death 004d64f0:NpcAI::ENTITY_MOMS_HEART_mausoleum_death 004d64f0:NpcAI::ENTITY_MOMS_HEART_mausoleum_death 004d64f0:NpcAI::ENTITY_MOMS_HEART_mausoleum_death 004d64f0:NpcAI::ENTITY_MOMS_HEART_mausoleum_death 004d64f0:NpcAI::ENTITY_MOMS_HEART_mausoleum_death 004d64f0:NpcAI::ENTITY_MOMS_HEART_mausoleum_death 004d64f0:NpcAI::ENTITY_MOMS_HEART_mausoleum_death 004d64f0:NpcAI::ENTITY_MOMS_HEART_mausoleum_death 008ce430:Menu_CustomChallenge::Render 009be530:PlayerManager::GetRandomPlayer 007d6670:Entity_Player::poop_spell_roll 007d6670:Entity_Player::poop_spell_roll 007d6670:Entity_Player::poop_spell_roll 007d6670:Entity_Player::poop_spell_roll 007d6670:Entity_Player::poop_spell_roll 007d6670:Entity_Player::poop_spell_roll 007d6670:Entity_Player::poop_spell_roll 006ee640:FUN_006ee640 006ee640:FUN_006ee640 007ce6e0:Entity_Player::ChangePlayerType 007ce6e0:Entity_Player::ChangePlayerType 009ae640:LevelGenerator::try_place_room 009ae640:LevelGenerator::try_place_room 006d6690:NpcAI::ENTITY_MOVABLE_TNT 00956780:seed_fart_sound_override 0082d880:RoomConfig::GetRandomSplitRoom 0082d880:RoomConfig::GetRandomSplitRoom 008158a0:Room::ShopRestockPartial 008158a0:Room::ShopRestockPartial 007d58f0:Entity_Player::tainted_cain_pedestal_burst 007d58f0:Entity_Player::tainted_cain_pedestal_burst 007d58f0:Entity_Player::tainted_cain_pedestal_burst 007d58f0:Entity_Player::tainted_cain_pedestal_burst 007d58f0:Entity_Player::tainted_cain_pedestal_burst 007d58f0:Entity_Player::tainted_cain_pedestal_burst 007d58f0:Entity_Player::tainted_cain_pedestal_burst 007d58f0:Entity_Player::tainted_cain_pedestal_burst 007d58f0:Entity_Player::tainted_cain_pedestal_burst 007d58f0:Entity_Player::tainted_cain_pedestal_burst 007d58f0:Entity_Player::tainted_cain_pedestal_burst 007d58f0:Entity_Player::tainted_cain_pedestal_burst 007d58f0:Entity_Player::tainted_cain_pedestal_burst 007d58f0:Entity_Player::tainted_cain_pedestal_burst 007d58f0:Entity_Player::tainted_cain_pedestal_burst 007d58f0:Entity_Player::tainted_cain_pedestal_burst 007d58f0:Entity_Player::tainted_cain_pedestal_burst 007d58f0:Entity_Player::tainted_cain_pedestal_burst 0058d8b0:NpcAI::ENTITY_SINGE_ball 00715940:GridEntity_Poop::BeginBatches 00735a30:ItemPool::load_pools 00735a30:ItemPool::load_pools 006ddcd0:Pickup_PickVariant 006ddcd0:Pickup_PickVariant 006ddcd0:Pickup_PickVariant 00815ae0:Room::ShopRestockFull 00815ae0:Room::ShopRestockFull 0092dc30:SoundEffects::Play 009bdc60:PlayerManager::init_random_unlocks 00825de0:Room::render_darkness_overlay 00825de0:Room::render_darkness_overlay 00825de0:Room::render_darkness_overlay 00825de0:Room::render_darkness_overlay 00825de0:Room::render_darkness_overlay 00825de0:Room::render_darkness_overlay 0074de30:Game::generate_home_level 0074de30:Game::generate_home_level 0074de30:Game::generate_home_level 0074de30:Game::generate_home_level 0074de30:Game::generate_home_level 0074de30:Game::generate_home_level 0074de30:Game::generate_home_level 0074de30:Game::generate_home_level 0074de30:Game::generate_home_level 0074de30:Game::generate_home_level 0074de30:Game::generate_home_level 0074de30:Game::generate_home_level 0074de30:Game::generate_home_level 0074de30:Game::generate_home_level 0074de30:Game::generate_home_level 0074de30:Game::generate_home_level 00545f70:NpcAI::ENTITY_FISTULOID 007cdf30:teleport_to_random_room_of_types 007cdf30:teleport_to_random_room_of_types 0071dfc0:GridEntity_Spikes::BeginBatches 0071dfc0:GridEntity_Spikes::BeginBatches 0071dfc0:GridEntity_Spikes::BeginBatches 00535280:NpcAI::ENTITY_SQUIRT 00535280:NpcAI::ENTITY_SQUIRT 0050d370:NpcAI::ENTITY_CLOTTY 006b5320:Entity_Tear::reroll_hit_entity 006b5320:Entity_Tear::reroll_hit_entity 007ed310:Room::SpawnEntry 007ed310:Room::SpawnEntry 007ed310:Room::SpawnEntry 007ed310:Room::SpawnEntry 007ed310:Room::SpawnEntry 007ed310:Room::SpawnEntry 0096d3f0:Entity_Laser::impact_tear_flag_effects 0096d3f0:Entity_Laser::impact_tear_flag_effects 0096d3f0:Entity_Laser::impact_tear_flag_effects 0096d3f0:Entity_Laser::impact_tear_flag_effects 006653e0:FUN_006653e0 00755470:Entity_Player::Init 00755470:Entity_Player::Init 00755470:Entity_Player::Init 00755470:Entity_Player::Init 00755470:Entity_Player::Init 00755470:Entity_Player::Init 00755470:Entity_Player::Init 00755470:Entity_Player::Init 00755470:Entity_Player::Init 006d5400:Entity_NPC::trigger_kill_item_effects 006d5400:Entity_NPC::trigger_kill_item_effects 006d5400:Entity_NPC::trigger_kill_item_effects 006d5400:Entity_NPC::trigger_kill_item_effects 0074d4a0:Level::prepare_blue_room 00705480:Game::DevolveEnemy 0063d570:FamiliarHelper::fly_head_pathfind_move 0063d570:FamiliarHelper::fly_head_pathfind_move 0093d510:Backdrop::render_wall_detail 009356a0:Backdrop::render_floor_to_target 009356a0:Backdrop::render_floor_to_target 009356a0:Backdrop::render_floor_to_target 009356a0:Backdrop::render_floor_to_target 009356a0:Backdrop::render_floor_to_target 006657a0:Entity_Slot::HandleCollision 006657a0:Entity_Slot::HandleCollision 006657a0:Entity_Slot::HandleCollision 0062c8d0:Entity_Familiar::farting_baby_fart 007f2800:Room::Init 007f2800:Room::Init 007f2800:Room::Init 007f2800:Room::Init 007f2800:Room::Init 007f2800:Room::Init 007f2800:Room::Init 007f2800:Room::Init 007f2800:Room::Init 007f2800:Room::Init 007f2800:Room::Init 007f2800:Room::Init 007f2800:Room::Init 007f2800:Room::Init 007f2800:Room::Init 00744940:Level::Init 00734900:ItemPool::GetPill 00734900:ItemPool::GetPill 00734900:ItemPool::GetPill 00504a40:NpcAI::ENTITY_DUSTY_DEATHS_HEAD 00504a40:NpcAI::ENTITY_DUSTY_DEATHS_HEAD 0065cb60:Entity_Projectile::Render 0065cb60:Entity_Projectile::Render 0065cb60:Entity_Projectile::Render 00634b10:Entity_Familiar::ai_lil_spewer 00634b10:Entity_Familiar::ai_lil_spewer 00634b10:Entity_Familiar::ai_lil_spewer 00634b10:Entity_Familiar::ai_lil_spewer 00634b10:Entity_Familiar::ai_lil_spewer 00634b10:Entity_Familiar::ai_lil_spewer 00634b10:Entity_Familiar::ai_lil_spewer 00634b10:Entity_Familiar::ai_lil_spewer 00634b10:Entity_Familiar::ai_lil_spewer 0051cb30:NpcAI::ENTITY_HANGER 0049cbf0:WeightedOutcomePicker::PickOutcome 007a4ba0:Entity_Player::level_start 007a4ba0:Entity_Player::level_start 007a4ba0:Entity_Player::level_start 007a4ba0:Entity_Player::level_start 007a4ba0:Entity_Player::level_start 007a4ba0:Entity_Player::level_start 007a4ba0:Entity_Player::level_start 007a4ba0:Entity_Player::level_start 007a4ba0:Entity_Player::level_start 00704c50:Game::RerollLevelPickups 00734cc0:ItemPool::remove_deathmatch_pill_effects 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 00624e10:Entity_Familiar::Render 0074cea0:Level::roll_red_room_type 00644e80:Entity_Familiar::ai_shadow_intruder_damocles 00644e80:Entity_Familiar::ai_shadow_intruder_damocles 00734f30:ItemPool::Init 00734f30:ItemPool::Init 00734f30:ItemPool::Init 00734f30:ItemPool::Init 0074406b:FUN_0074406b 005cc070:RNG::Shuffle 005240a0:NpcAI::ENTITY_PARA_BITE 00584140:NpcAI::ENTITY_SCOURGE_chain 00584140:NpcAI::ENTITY_SCOURGE_chain 0074413a:FUN_0074413a 007ec100:Room::TransformEntry 0063c1c0:Entity_Familiar::ai_minisaac 0063c1c0:Entity_Familiar::ai_minisaac 007c4180:Entity_Player::UsePill 007c4180:Entity_Player::UsePill 00734180:ItemPool::GetCardEx 00734180:ItemPool::GetCardEx 00734180:ItemPool::GetCardEx 00734180:ItemPool::GetCardEx 00734180:ItemPool::GetCardEx 00734180:ItemPool::GetCardEx 00744209:FUN_00744209 007dc2d0:_Entity_Player::SpawnTrinketRandomPickup 007dc2d0:_Entity_Player::SpawnTrinketRandomPickup 005442a0:NpcAI::ENTITY_TARBOY 005442a0:NpcAI::ENTITY_TARBOY 00744348:FUN_00744348 00744348:FUN_00744348 00744348:FUN_00744348 00824350:Room::init_rain 00824350:Room::init_rain 00824350:Room::init_rain 00824350:Room::init_rain 00824350:Room::init_rain 00824350:Room::init_rain 00744466:FUN_00744466 00664560:Entity_Slot::TakeDamage 00664560:Entity_Slot::TakeDamage 00664560:Entity_Slot::TakeDamage 00664560:Entity_Slot::TakeDamage 00664560:Entity_Slot::TakeDamage 00744500:FUN_00744500 00984550:GridEntity_PressurePlate::Reward 00984550:GridEntity_PressurePlate::Reward 00984550:GridEntity_PressurePlate::Reward 007bc740:Entity_Player::InitPostLevelInitStats 007bc740:Entity_Player::InitPostLevelInitStats 007bc740:Entity_Player::InitPostLevelInitStats 007bc740:Entity_Player::InitPostLevelInitStats 007bc740:Entity_Player::InitPostLevelInitStats 007bc740:Entity_Player::InitPostLevelInitStats 007bc740:Entity_Player::InitPostLevelInitStats 007bc740:Entity_Player::InitPostLevelInitStats 0082c7d0:RoomConfig::GetRandomRoom 0082c7d0:RoomConfig::GetRandomRoom 0082c7d0:RoomConfig::GetRandomRoom 007ac7e0:Entity_Player::DischargeActiveItem 00934770:Backdrop::PreRenderControls 006f5850:FUN_006f5850 006f5850:FUN_006f5850 006f6dd0:Game::StartDailyChallenge 00755470:Entity_Player::Init 00755470:Entity_Player::Init 0075d9f0:FUN_0075d9f0 007f2800:Room::Init 00816910:Room::SpawnGreedModeWave 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 006378c0:Entity_Familiar::ai_lil_harbingers 00610540:Entity_Familiar::Kill 00610540:Entity_Familiar::Kill 006e69b0:Entity_Pickup::Render 00580eae 00580f12 0058072b 005807a1 0043fd44 0043fcc5 0063f0b9 0063f132 00716019 00716085 0071612b 00744940:Level::Init 00740e10:Level::generate_dungeon 00740e10:Level::generate_dungeon 00740e10:Level::generate_dungeon 00740e10:Level::generate_dungeon 00740e10:Level::generate_dungeon 00742ef0:Level::generate_backwards 00743550:Level::generate_greed 00743d88 0075fe32 0075fef5 00760556 007601fa 0076024c 007607c8 0075ffbd 00760680 00760a18 00760ae2 00760c76 007f2800:Room::Init 007f2800:Room::Init 007f2800:Room::Init 007f2800:Room::Init 007f2800:Room::Init 007f2800:Room::Init 007f2800:Room::Init 007f2800:Room::Init 007f2800:Room::Init 007f2800:Room::Init 007f2800:Room::Init 007f2800:Room::Init 0093b760:Backdrop::spawn_wall_details 009e0e34 +00b6bf54 RNG Seed is zero!\n 009eb880:Seeds::set_start_seed 009eb880:Seeds::set_start_seed 007db8d0:Entity_Player::get_seeded_variant 009eb980:Seeds::ForgetStageSeed 00793970:Entity_Player::trigger_collectible_effect_removed 00793970:Entity_Player::trigger_collectible_effect_removed 007c3980:Entity_Player::add_random_stat_up 00633990:familiar_wisp_pick_tear_color 00633990:familiar_wisp_pick_tear_color 00633990:familiar_wisp_pick_tear_color 00633990:familiar_wisp_pick_tear_color 00633990:familiar_wisp_pick_tear_color 0074399a:FUN_0074399a 00743a6c:FUN_00743a6c 00743a03:FUN_00743a03 00743af9:FUN_00743af9 0060bae0:Entity_Effect::setup_loot_preview 0062bb70:Entity_Familiar::room_enter 00743b49:FUN_00743b49 00743bf8:FUN_00743bf8 007bbbd0:Entity_Player::Init 007bbbd0:Entity_Player::Init 007bbbd0:Entity_Player::Init 007bbbd0:Entity_Player::Init 007bbbd0:Entity_Player::Init 007bbbd0:Entity_Player::Init 007bbbd0:Entity_Player::Init 007bbbd0:Entity_Player::Init 007bbbd0:Entity_Player::Init 007bbbd0:Entity_Player::Init 007bbbd0:Entity_Player::Init 007dbba0:Entity_Player::add_random_drug_item_effect 00743ba3:FUN_00743ba3 00743c43:FUN_00743c43 006fbc10:Game::Render 00743ced:FUN_00743ced 0074bce0:FUN_0074bce0 00733ca0:ItemPool::GetTrinket 00733ca0:ItemPool::GetTrinket 007dbc80:Entity_Player::AddRandomMomItemEffect 00743c93:FUN_00743c93 00813d90:Room::init_shop_item_slots 00813d90:Room::init_shop_item_slots 00813d90:Room::init_shop_item_slots 00813d90:Room::init_shop_item_slots 00813d90:Room::init_shop_item_slots 00813d90:Room::init_shop_item_slots 00813d90:Room::init_shop_item_slots 00813d90:Room::init_shop_item_slots 007dbd70:Entity_Player::ModelingClay_roll 008e3db0:AnimationLayer::RenderFrame 0080bd20:Room::render_player_light 006bbdc0:Entity_Pickup::Update 006bbdc0:Entity_Pickup::Update 006bbdc0:Entity_Pickup::Update 006bbdc0:Entity_Pickup::Update 0080bd20:Room::render_player_light 006bbdc0:Entity_Pickup::Update 006bbdc0:Entity_Pickup::Update 006bbdc0:Entity_Pickup::Update 006bbdc0:Entity_Pickup::Update 006bbdc0:Entity_Pickup::Update 006bbdc0:Entity_Pickup::Update 006bbdc0:Entity_Pickup::Update 006bbdc0:Entity_Pickup::Update 006bbdc0:Entity_Pickup::Update 006bbdc0:Entity_Pickup::Update 006bbdc0:Entity_Pickup::Update 006bbdc0:Entity_Pickup::Update 006bbdc0:Entity_Pickup::Update 006bbdc0:Entity_Pickup::Update 006bbdc0:Entity_Pickup::Update 006bbdc0:Entity_Pickup::Update 006bbdc0:Entity_Pickup::Update 00743d94:FUN_00743d94 00743e72:FUN_00743e72 0085bed0:EntitySpawner::Spawn 007dbeb0:Entity_Player::twins_duplicate_familiars 007dbeb0:Entity_Player::twins_duplicate_familiars 0074beb0:Level::init_rotgut_dungeon_room 0074beb0:Level::init_rotgut_dungeon_room 00743f73:FUN_00743f73 00743f23:FUN_00743f23 005cbfe0:FUN_005cbfe0 00743fc3:Level::generate_greed_chunk_place 007abf80:Entity_Player::active_used_post 006e30a0:Entity_Pickup::Morph 006e30a0:Entity_Pickup::Morph 005b30b0:alabaster_box_timer_callback 005b30b0:alabaster_box_timer_callback 005b30b0:alabaster_box_timer_callback 005b30b0:alabaster_box_timer_callback 005b30b0:alabaster_box_timer_callback 007eb1b0:Room::PlayMusic 007eb1b0:Room::PlayMusic 007fb250:Room::SpawnClearAward 008332e0:Ambush::shuffle_waves 00763370:Entity_Player::CheckFamiliar 007333f0:ItemPool::should_force_magic_skin 007333f0:ItemPool::should_force_magic_skin 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0071b410:GridEntity_Rock::SpawnDrops 0042b560:ItemPool::ReplaceBlacklistedPickup 0042b560:ItemPool::ReplaceBlacklistedPickup 007435c8:FUN_007435c8 0099b520:GridEntity_Gravity::PostInit 00813520:Room::FindFreePickupSpawnPosition 0078b640:Entity_Player::Render 00733610:ItemPool::GetCollectible 00833600:Ambush::SpawnWave 00833600:Ambush::SpawnWave 00833600:Ambush::SpawnWave 00833600:Ambush::SpawnWave 00833600:Ambush::SpawnWave 00713760:GridEntity_Pit::BeginBatches 00713760:GridEntity_Pit::BeginBatches 00713760:GridEntity_Pit::BeginBatches 00543720:NpcAI::ENTITY_PORTAL 0074371e:FUN_0074371e 0074378b:Level::generate_greed_chunk_rooms 00422830:BossPool::GetBossId 00802980:Room::Update 00802980:Room::Update 00802980:Room::Update 00802980:Room::Update 00802980:Room::Update 00802980:Room::Update 007fa920:RoomClear_PickVariant 007fa920:RoomClear_PickVariant 007fa920:RoomClear_PickVariant 007fa920:RoomClear_PickVariant 007fa920:RoomClear_PickVariant 007fa920:RoomClear_PickVariant 007fa920:RoomClear_PickVariant 007fa920:RoomClear_PickVariant 007fa920:RoomClear_PickVariant 007fa920:RoomClear_PickVariant 007fa920:RoomClear_PickVariant 007fa920:RoomClear_PickVariant 007fa920:RoomClear_PickVariant 0062a930:Entity_Familiar::AddCoins 0062a930:Entity_Familiar::AddCoins 00802980:Room::Update 00802980:Room::Update 00802980:Room::Update 00802980:Room::Update 00802980:Room::Update 005caa70:Entity_Player::console_spawn 005caa70:Entity_Player::console_spawn 00612bb0:Entity_Familiar::FollowParent 00612bb0:Entity_Familiar::FollowParent 00682b90:string_scramble_seeded 00682b90:string_scramble_seeded 0099acc0:GridEntity_Decoration::BeginBatches 0065ad30:reroll_entity_to_free_tile 0065ad30:reroll_entity_to_free_tile 00732dc0:ItemPool::GetPoolForRoom 006dae40:Entity_Pickup::GetChestLoot 006dae40:Entity_Pickup::GetChestLoot 006dae40:Entity_Pickup::GetChestLoot 006dae40:Entity_Pickup::GetChestLoot 006dae40:Entity_Pickup::GetChestLoot 006dae40:Entity_Pickup::GetChestLoot 006dae40:Entity_Pickup::GetChestLoot 006dae40:Entity_Pickup::GetChestLoot 006dae40:Entity_Pickup::GetChestLoot 006dae40:Entity_Pickup::GetChestLoot 006dae40:Entity_Pickup::GetChestLoot 006dae40:Entity_Pickup::GetChestLoot 006dae40:Entity_Pickup::GetChestLoot 006dae40:Entity_Pickup::GetChestLoot 006dae40:Entity_Pickup::GetChestLoot 006dae40:Entity_Pickup::GetChestLoot 006dae40:Entity_Pickup::GetChestLoot 007c2e90:Entity_Player::GetGlitchBabySubType 0071af60:GridEntity_Rock::TrySpawnWorms 006a2050:Entity_Bomb::Init 008020d0:Room::update_deaths_list 008020d0:Room::update_deaths_list 008020d0:Room::update_deaths_list 0058a010:NpcHelper::singe_crater_ring 0058a010:NpcHelper::singe_crater_ring 00712180:GridEntity_Pit::Update 00712180:GridEntity_Pit::Update 00712180:GridEntity_Pit::Update 00712180:GridEntity_Pit::Update 0059a2d0:NpcAI::ENTITY_TUFF_TWINS 005b23f0:Entity_Player::use_card_hagalaz 005b23f0:Entity_Player::use_card_hagalaz 005ca470:Entity_Player::TriggerBookOfVirtues 0061a4e0:Entity_Familiar::ai_pickup_sack 0061a4e0:Entity_Familiar::ai_pickup_sack 0061a4e0:Entity_Familiar::ai_pickup_sack 0061a4e0:Entity_Familiar::ai_pickup_sack 0061a4e0:Entity_Familiar::ai_pickup_sack 0061a4e0:Entity_Familiar::ai_pickup_sack 0061a4e0:Entity_Familiar::ai_pickup_sack 0061a4e0:Entity_Familiar::ai_pickup_sack 0061a4e0:Entity_Familiar::ai_pickup_sack 0061a4e0:Entity_Familiar::ai_pickup_sack 0061a4e0:Entity_Familiar::ai_pickup_sack 0061a4e0:Entity_Familiar::ai_pickup_sack 0061a4e0:Entity_Familiar::ai_pickup_sack 0061a4e0:Entity_Familiar::ai_pickup_sack 0061a4e0:Entity_Familiar::ai_pickup_sack 0061a4e0:Entity_Familiar::ai_pickup_sack 0061a4e0:Entity_Familiar::ai_pickup_sack 0074a500:Level::generate_home 0074a500:Level::generate_home 0074a500:Level::generate_home 0074a500:Level::generate_home 0074a500:Level::generate_home 0074a500:Level::generate_home 0074a500:Level::generate_home 0074a500:Level::generate_home 0074a500:Level::generate_home 0074a500:Level::generate_home 0074a500:Level::generate_home 0074a500:Level::generate_home 0074a500:Level::generate_home 0074a500:Level::generate_home 0074a500:Level::generate_home 0074a500:Level::generate_home 0074a500:Level::generate_home 0074a500:Level::generate_home 0074a500:Level::generate_home 0074a500:Level::generate_home 0074a500:Level::generate_home 004da590:NpcAI::ENTITY_ROTTEN_GAPER 004218e0:BossPool::init 00579890:NpcAI::ENTITY_REAP_CREEP 00579890:NpcAI::ENTITY_REAP_CREEP 004098a0:AnimationLayer::GetSourceQuad 004098a0:AnimationLayer::GetSourceQuad 004b1910:NpcHelper::gideon_spawn_wave 004b1910:NpcHelper::gideon_spawn_wave 004b1910:NpcHelper::gideon_spawn_wave 004b1910:NpcHelper::gideon_spawn_wave 004b1910:NpcHelper::gideon_spawn_wave 006e1910:FUN_006e1910 007499a0:Level::InitializeDevilAngelRoom 007499a0:Level::InitializeDevilAngelRoom 007499a0:Level::InitializeDevilAngelRoom 006c1ac0:Entity_NPC::shopkeeper_get_loot 006c1ac0:Entity_NPC::shopkeeper_get_loot 006c1ac0:Entity_NPC::shopkeeper_get_loot 006c1ac0:Entity_NPC::shopkeeper_get_loot 006c1ac0:Entity_NPC::shopkeeper_get_loot 00631b20:Entity_Familiar::delirium_morph 00631b20:Entity_Familiar::delirium_morph 009b1b20:level_generator_rooms_shuffle 00759bf0:Entity_Player::AddSwarmFlyOrbital 00711bb0:GridEntity_Lock::break_open 00711bb0:GridEntity_Lock::break_open 00711bb0:GridEntity_Lock::break_open 00711bb0:GridEntity_Lock::break_open 00921ce0:NightmareScene::Show 00921ce0:NightmareScene::Show 00921ce0:NightmareScene::Show 00921ce0:NightmareScene::Show 00921ce0:NightmareScene::Show 00921ce0:NightmareScene::Show 00541ce0:NpcAI::ENTITY_MEATBALL 00541ce0:NpcAI::ENTITY_MEATBALL 007d9ca0:FUN_007d9ca0 007d9d00:Entity_Player::CalculateBagOfCraftingOutput 007d9d00:Entity_Player::CalculateBagOfCraftingOutput 00741e60:Level::place_rooms_backwards 00741e60:Level::place_rooms_backwards 00741e60:Level::place_rooms_backwards 00741e60:Level::place_rooms_backwards 00741e60:Level::place_rooms_backwards 00741e60:Level::place_rooms_backwards 00741e60:Level::place_rooms_backwards 00741e60:Level::place_rooms_backwards 00741e60:Level::place_rooms_backwards 00741e60:Level::place_rooms_backwards 00741e60:Level::place_rooms_backwards 00741e60:Level::place_rooms_backwards 00741e60:Level::place_rooms_backwards 00741e60:Level::place_rooms_backwards 00751650:Level::generate_dark_closet 00751650:Level::generate_dark_closet 00751650:Level::generate_dark_closet 006e1e90:Entity_Pickup::load_collectible_gfx 00751650:Level::generate_dark_closet 00751650:Level::generate_dark_closet 00751650:Level::generate_dark_closet 00709fb0:GridEntity::hurt_func 00709fb0:GridEntity::hurt_func 00709fb0:GridEntity::hurt_func 00709fb0:GridEntity::hurt_func 00709fb0:GridEntity::hurt_func 00719f80:GridEntity_Rock::BeginBatches 00719f80:GridEntity_Rock::BeginBatches 00719f80:GridEntity_Rock::BeginBatches 00719f80:GridEntity_Rock::BeginBatches 00719f80:GridEntity_Rock::BeginBatches 007e9020:RNG::RandomInt 007e90f0:RNG::Next 007e9080:RNG::RandomFloat 00739080:Level::pick_boss_room_config 00739080:Level::pick_boss_room_config 007a1090:Entity_Player::TriggerDeath 007a1090:Entity_Player::TriggerDeath 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 00739370:Level::place_special_rooms 005c93b0:Entity_Player::AddWisp 00591460:NpcAI::ENTITY_SIREN 009e14b0:trigger_effect_execute 009e14b0:trigger_effect_execute 009e14b0:trigger_effect_execute 009e14b0:trigger_effect_execute 00751650:Level::generate_dark_closet 005c96f0:Entity_Player::AddItemWisp 006d97e0:Entity_NPC::split 006d97e0:Entity_NPC::split 006d97e0:Entity_NPC::split 007c97f0:Entity_Player::apply_victory_lap_penalty 00740860:Level::GetRandomRoomIndex 00740860:Level::GetRandomRoomIndex 007c8830:Entity_Player::spawn_locusts 007508c0:Level::generate_random_layout 007508c0:Level::generate_random_layout 007508c0:Level::generate_random_layout 007508c0:Level::generate_random_layout 007508c0:Level::generate_random_layout 007508c0:Level::generate_random_layout 007508c0:Level::generate_random_layout 007508c0:Level::generate_random_layout 007508c0:Level::generate_random_layout 007508c0:Level::generate_random_layout 007508c0:Level::generate_random_layout 007508c0:Level::generate_random_layout 007508c0:Level::generate_random_layout 007508c0:Level::generate_random_layout 007508c0:Level::generate_random_layout 005c88a0:Entity_Player::reroll_collectibles_on_damage 005c88a0:Entity_Player::reroll_collectibles_on_damage 00428940:Seeds::Init3 00428940:Seeds::Init3 00428940:Seeds::Init3 00428940:Seeds::Init3 004d8910:spawn_small_maggot_jump 007009a0:Game::BombTearflagEffects 009e0ad0:ProceduralEffect::roll_spawn_target 009e0ad0:ProceduralEffect::roll_spawn_target 009e0ad0:ProceduralEffect::roll_spawn_target 009e0ad0:ProceduralEffect::roll_spawn_target 006e8ae0:Entity_Pickup::HandleCollision 006e8ae0:Entity_Pickup::HandleCollision 006e8ae0:Entity_Pickup::HandleCollision 00990a40:FXLayers::LoadConfig 00990a40:FXLayers::LoadConfig 00990a40:FXLayers::LoadConfig 00990a40:FXLayers::LoadConfig 00990a40:FXLayers::LoadConfig 00990a40:FXLayers::LoadConfig 00990a40:FXLayers::LoadConfig 00990a40:FXLayers::LoadConfig 00990a40:FXLayers::LoadConfig 00738ab0:Level::place_room 004d8b50:spawn_small_maggot 00618b00:FamiliarAI::gb_bug 00618b00:FamiliarAI::gb_bug 00618b00:FamiliarAI::gb_bug 009b0b00:LevelGenerator::get_neighbor_candidates 004d8d10:NpcHelper::gaper_l2_spawn_maggot 004f8df0:NpcAI::ENTITY_BOMB_GRIMACE 004f8df0:NpcAI::ENTITY_BOMB_GRIMACE 00540df0:NpcAI::ENTITY_SWARM 00930ee0:FUN_00930ee0 00528ec0:NpcHelper::migraine_timer_spawn 00528ec0:NpcHelper::migraine_timer_spawn 00528ec0:NpcHelper::migraine_timer_spawn 00528ec0:NpcHelper::migraine_timer_spawn 004b0fe0:NpcHelper::gideon_spawn_stairs 007a8fd0:Entity_Player::TriggerRoomClear 007a8fd0:Entity_Player::TriggerRoomClear 007a8fd0:Entity_Player::TriggerRoomClear 007a8fd0:Entity_Player::TriggerRoomClear 007a8fd0:Entity_Player::TriggerRoomClear 007a8fd0:Entity_Player::TriggerRoomClear 007a8fd0:Entity_Player::TriggerRoomClear 007a8fd0:Entity_Player::TriggerRoomClear 007a8fd0:Entity_Player::TriggerRoomClear 007a8fd0:Entity_Player::TriggerRoomClear 009e0f60:ProceduralEffect::roll_params 009e0f60:ProceduralEffect::roll_params 007c8050:Entity_Player::AddImmaculateConceptionCounter 005c8020:everything_jar_crack_the_sky_timer 005c8020:everything_jar_crack_the_sky_timer 005c8020:everything_jar_crack_the_sky_timer 00678080:Entity_Tear::fire_split_projectiles 007481d0:Level::ForceHorsemanBoss 00820170:Room::TrySpawnBlueWombDoor 00468180:NpcAI::ENTITY_DADDYLONGLEGS 00468180:NpcAI::ENTITY_DADDYLONGLEGS 006e02f0:Entity_Pickup::Init 006e02f0:Entity_Pickup::Init 007a8350:Entity_Player::TriggerNewRoom_TemporaryEffects 007a8350:Entity_Player::TriggerNewRoom_TemporaryEffects 007a8350:Entity_Player::TriggerNewRoom_TemporaryEffects 006d03e0:Entity_NPC::MakeChampion 006d03e0:Entity_NPC::MakeChampion 005c83f0:everything_jar_shopkeeper_rain_timer 005c83f0:everything_jar_shopkeeper_rain_timer 007f83b0:Room::TrySpawnDevilRoomDoor 007f83b0:Room::TrySpawnDevilRoomDoor 007f83b0:Room::TrySpawnDevilRoomDoor 009b04d0:LevelGenerator::generate_rooms 009b04d0:LevelGenerator::generate_rooms 009b04d0:LevelGenerator::generate_rooms 009b04d0:LevelGenerator::generate_rooms 009b04d0:LevelGenerator::generate_rooms 009b04d0:LevelGenerator::generate_rooms 009b04d0:LevelGenerator::generate_rooms 00790530:Entity_Player::DropCollectible 005505c0:NpcAI::ENTITY_SWARM_SPIDER 00838560:GridEntity_Statue::Destroy 00838560:GridEntity_Statue::Destroy 00838560:GridEntity_Statue::Destroy 00650610:FamiliarAI::vanishing_twin 00650610:FamiliarAI::vanishing_twin 00650610:FamiliarAI::vanishing_twin 00650610:FamiliarAI::vanishing_twin 008f06e0:Menu_SpecialSeeds::Render 008f06e0:Menu_SpecialSeeds::Render 009e0700:ProceduralEffect::roll_trigger_target 009e0700:ProceduralEffect::roll_trigger_target 00548720:NpcHelper::leper_flesh_ai 00548720:NpcHelper::leper_flesh_ai 0074f820:Level::InitStageSeeds 007178c0:GridEntity_Poop::spawn_drops 007178c0:GridEntity_Poop::spawn_drops 007178c0:GridEntity_Poop::spawn_drops 007178c0:GridEntity_Poop::spawn_drops 007178c0:GridEntity_Poop::spawn_drops 007178c0:GridEntity_Poop::spawn_drops 007178c0:GridEntity_Poop::spawn_drops 007178c0:GridEntity_Poop::spawn_drops 007178c0:GridEntity_Poop::spawn_drops 007178c0:GridEntity_Poop::spawn_drops 007178c0:GridEntity_Poop::spawn_drops 007178c0:GridEntity_Poop::spawn_drops 007178c0:GridEntity_Poop::spawn_drops 007178c0:GridEntity_Poop::spawn_drops 007178c0:GridEntity_Poop::spawn_drops 007178c0:GridEntity_Poop::spawn_drops 007178c0:GridEntity_Poop::spawn_drops 007178c0:GridEntity_Poop::spawn_drops 007178c0:GridEntity_Poop::spawn_drops 007178c0:GridEntity_Poop::spawn_drops 007178c0:GridEntity_Poop::spawn_drops 007178c0:GridEntity_Poop::spawn_drops 007178c0:GridEntity_Poop::spawn_drops 006ef890:Seeds::GetNextSeed 004878a0:NpcAI::ENTITY_CAGE 004878a0:NpcAI::ENTITY_CAGE 007c7960:Entity_Player::GetZodiacEffect 007f7a40:Room::TrySpawnSecretExit 005c7ad0:FUN_005c7ad0 00707ad0:r_key_timer_callback 00967a70:Entity_Knife::apply_wiggle 00827bf0:Room::spawn_sanguine_bond_spikes 0074fbe0:Level::try_place_random_room 0074fbe0:Level::try_place_random_room 0074fbe0:Level::try_place_random_room 0074fbe0:Level::try_place_random_room 0074fbe0:Level::try_place_random_room 0074fbe0:Level::try_place_random_room 0074fbe0:Level::try_place_random_room 0074fbe0:Level::try_place_random_room 0074fbe0:Level::try_place_random_room 0074fbe0:Level::try_place_random_room 0074fbe0:Level::try_place_random_room 0081fb70:LRoomTileDesc::GetRandomTile 0081fb70:LRoomTileDesc::GetRandomTile 0081fb70:LRoomTileDesc::GetRandomTile 0081fb70:LRoomTileDesc::GetRandomTile 0081fb70:LRoomTileDesc::GetRandomTile 007d7c30:Entity_Player::trigger_cracked_orb 0097fc10:Entity_Laser::ResetSpriteScale 004bfd30:NpcAI::ENTITY_HUSH 004bfd30:NpcAI::ENTITY_HUSH 004bfd30:NpcAI::ENTITY_HUSH 004bfd30:NpcAI::ENTITY_HUSH 004bfd30:NpcAI::ENTITY_HUSH 004bfd30:NpcAI::ENTITY_HUSH 004bfd30:NpcAI::ENTITY_HUSH 004f7e60:NpcAI::ENTITY_MORNINGSTAR 005c7f20:FUN_005c7f20 00737010:ItemPool::get_chaos_pool 00737010:ItemPool::get_chaos_pool 0067f0d0:RandomVector 0074f0c0:Level::generate_mirror_world 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 006bf120:NpcHelper::ChampionDrop 006bf120:NpcHelper::ChampionDrop 006bf120:NpcHelper::ChampionDrop 006bf120:NpcHelper::ChampionDrop 006bf120:NpcHelper::ChampionDrop 006bf120:NpcHelper::ChampionDrop 006bf120:NpcHelper::ChampionDrop 006bf120:NpcHelper::ChampionDrop 006bf120:NpcHelper::ChampionDrop 006bf120:NpcHelper::ChampionDrop 006bf120:NpcHelper::ChampionDrop 009dcc70:ItemPool::CreateGlitchedCollectible 007d7290:Entity_Player::UsePoopSpell 0074f360:Level::generate_mineshaft 0074f360:Level::generate_mineshaft 0074f360:Level::generate_mineshaft 0044f2b0:NpcAI::ENTITY_BEAST_ultra_war_bomb 0044f2b0:NpcAI::ENTITY_BEAST_ultra_war_bomb 00816910:Room::SpawnGreedModeWave 00816910:Room::SpawnGreedModeWave 00816910:Room::SpawnGreedModeWave 00816910:Room::SpawnGreedModeWave 00816910:Room::SpawnGreedModeWave 00816910:Room::SpawnGreedModeWave 0079f3c0:Entity_Player::update_ladder 0079f3c0:Entity_Player::update_ladder 00737380:ItemPool::GetCollectibleFromList 00737380:ItemPool::GetCollectibleFromList 00937420:Backdrop::pre_render_walls 00937420:Backdrop::pre_render_walls 00937420:Backdrop::pre_render_walls 00937420:Backdrop::pre_render_walls 00937420:Backdrop::pre_render_walls 00937420:Backdrop::pre_render_walls 0071f4b0:FUN_0071f4b0 0071f4b0:FUN_0071f4b0 007475b0:Level::RestoreGameState 007cf610:Entity_Player::RemoveCollectible 008276e0:Room::spawn_options_alternative 008276e0:Room::spawn_options_alternative 008276e0:Room::spawn_options_alternative 007bf6c0:Entity_Player::GetTearHitParams 007bf6c0:Entity_Player::GetTearHitParams 007376c0:ItemPool::GetCardImpl 007376c0:ItemPool::GetCardImpl 007376c0:ItemPool::GetCardImpl 007bf6c0:Entity_Player::GetTearHitParams 0062f7f0:FamiliarAI::bumbo 004d77b0:NpcAI::ENTITY_SMALL_MAGGOT 004d77b0:NpcAI::ENTITY_SMALL_MAGGOT 004d77b0:NpcAI::ENTITY_SMALL_MAGGOT 006ae820:Entity::Update 006ae820:Entity::Update 00816910:Room::SpawnGreedModeWave 00426a50:DailyChallenge::Init 00426a50:DailyChallenge::Init 00426a50:DailyChallenge::Init 00426a50:DailyChallenge::Init 00426a50:DailyChallenge::Init 00426a50:DailyChallenge::Init 0075ea40:Entity_Player::render_charge_bars 0043eb10:Entity_Familiar::GetRandomWisp 00996b30:FXLayers::grow_vein_branches 00736ba0:ItemPool::ForceAddPillEffect 007a6c50:Entity_Player::room_enter 007a6c50:Entity_Player::room_enter 007a6c50:Entity_Player::room_enter 00736c30:ItemPool::on_pill_used 006f6dd0:Game::StartDailyChallenge 00716db0:spawn_poop_rewards 00716db0:spawn_poop_rewards 00716db0:spawn_poop_rewards 00716db0:spawn_poop_rewards 00716db0:spawn_poop_rewards 00716db0:spawn_poop_rewards 00716db0:spawn_poop_rewards 00716db0:spawn_poop_rewards 00716db0:spawn_poop_rewards 00716db0:spawn_poop_rewards 00716db0:spawn_poop_rewards 00716db0:spawn_poop_rewards 00716db0:spawn_poop_rewards 00716db0:spawn_poop_rewards 00716db0:spawn_poop_rewards 00716db0:spawn_poop_rewards 00716db0:spawn_poop_rewards 00716db0:spawn_poop_rewards 00716db0:spawn_poop_rewards 006d6d80:Entity_NPC::room_enter 00996e90:FXLayers::update_vein_branch 006e6e40:Entity_Pickup::TryOpenChest 006e6e40:Entity_Pickup::TryOpenChest 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 00755470:Entity_Player::Init 009960b0:Game::start_poop_cloud_screen_effect 009960b0:Game::start_poop_cloud_screen_effect 009960b0:Game::start_poop_cloud_screen_effect 009960b0:Game::start_poop_cloud_screen_effect 009960b0:Game::start_poop_cloud_screen_effect 009960b0:Game::start_poop_cloud_screen_effect 00816000:Room::ShopReshuffle 00816000:Room::ShopReshuffle 0073e0a0:Level::load_room 0073e0a0:Level::load_room 0073e0a0:Level::load_room 0073e0a0:Level::load_room 0073e0a0:Level::load_room 009be140:PlayerManager::RandomCollectibleOwner 009ae170:LevelGenerator::place_secret_room 009ae170:LevelGenerator::place_secret_room 007fe220:Room::card_against_humanity_fill 007fe220:Room::card_against_humanity_fill 007fe220:Room::card_against_humanity_fill 007fe220:Room::card_against_humanity_fill 007fe220:Room::card_against_humanity_fill 007fe220:Room::card_against_humanity_fill 007fe220:Room::card_against_humanity_fill 0046e290:NpcAI::ENTITY_DUKE 0046e290:NpcAI::ENTITY_DUKE 0046e290:NpcAI::ENTITY_DUKE 0046e290:NpcAI::ENTITY_DUKE 009be3e0:PlayerManager::RandomTrinketOwner 00436330:Entity_Familiar::WispInit 00436330:Entity_Familiar::WispInit 00436330:Entity_Familiar::WispInit 00436330:Entity_Familiar::WispInit 00436330:Entity_Familiar::WispInit 00436330:Entity_Familiar::WispInit 0080e320:Room::pick_special_clear_award 006ee440:Isaac::GetRandomPickupVelocity 006ee440:Isaac::GetRandomPickupVelocity 004d64f0:NpcAI::ENTITY_MOMS_HEART_mausoleum_death 004d64f0:NpcAI::ENTITY_MOMS_HEART_mausoleum_death 004d64f0:NpcAI::ENTITY_MOMS_HEART_mausoleum_death 004d64f0:NpcAI::ENTITY_MOMS_HEART_mausoleum_death 004d64f0:NpcAI::ENTITY_MOMS_HEART_mausoleum_death 004d64f0:NpcAI::ENTITY_MOMS_HEART_mausoleum_death 004d64f0:NpcAI::ENTITY_MOMS_HEART_mausoleum_death 004d64f0:NpcAI::ENTITY_MOMS_HEART_mausoleum_death 004d64f0:NpcAI::ENTITY_MOMS_HEART_mausoleum_death 004d64f0:NpcAI::ENTITY_MOMS_HEART_mausoleum_death 004d64f0:NpcAI::ENTITY_MOMS_HEART_mausoleum_death 004d64f0:NpcAI::ENTITY_MOMS_HEART_mausoleum_death 004d64f0:NpcAI::ENTITY_MOMS_HEART_mausoleum_death 008ce430:Menu_CustomChallenge::Render 009be530:PlayerManager::GetRandomPlayer 007d6670:Entity_Player::poop_spell_roll 007d6670:Entity_Player::poop_spell_roll 007d6670:Entity_Player::poop_spell_roll 007d6670:Entity_Player::poop_spell_roll 007d6670:Entity_Player::poop_spell_roll 007d6670:Entity_Player::poop_spell_roll 007d6670:Entity_Player::poop_spell_roll 006ee640:FUN_006ee640 006ee640:FUN_006ee640 007ce6e0:Entity_Player::ChangePlayerType 007ce6e0:Entity_Player::ChangePlayerType 009ae640:LevelGenerator::try_place_room 009ae640:LevelGenerator::try_place_room 006d6690:NpcAI::ENTITY_MOVABLE_TNT 00956780:seed_fart_sound_override 0082d880:RoomConfig::GetRandomSplitRoom 0082d880:RoomConfig::GetRandomSplitRoom 008158a0:Room::ShopRestockPartial 008158a0:Room::ShopRestockPartial 007d58f0:Entity_Player::tainted_cain_pedestal_burst 007d58f0:Entity_Player::tainted_cain_pedestal_burst 007d58f0:Entity_Player::tainted_cain_pedestal_burst 007d58f0:Entity_Player::tainted_cain_pedestal_burst 007d58f0:Entity_Player::tainted_cain_pedestal_burst 007d58f0:Entity_Player::tainted_cain_pedestal_burst 007d58f0:Entity_Player::tainted_cain_pedestal_burst 007d58f0:Entity_Player::tainted_cain_pedestal_burst 007d58f0:Entity_Player::tainted_cain_pedestal_burst 007d58f0:Entity_Player::tainted_cain_pedestal_burst 007d58f0:Entity_Player::tainted_cain_pedestal_burst 007d58f0:Entity_Player::tainted_cain_pedestal_burst 007d58f0:Entity_Player::tainted_cain_pedestal_burst 007d58f0:Entity_Player::tainted_cain_pedestal_burst 007d58f0:Entity_Player::tainted_cain_pedestal_burst 007d58f0:Entity_Player::tainted_cain_pedestal_burst 007d58f0:Entity_Player::tainted_cain_pedestal_burst 007d58f0:Entity_Player::tainted_cain_pedestal_burst 0058d8b0:NpcAI::ENTITY_SINGE_ball 00715940:GridEntity_Poop::BeginBatches 00735a30:ItemPool::load_pools 00735a30:ItemPool::load_pools 006ddcd0:Pickup_PickVariant 006ddcd0:Pickup_PickVariant 006ddcd0:Pickup_PickVariant 00815ae0:Room::ShopRestockFull 00815ae0:Room::ShopRestockFull 0092dc30:SoundEffects::Play 009bdc60:PlayerManager::init_random_unlocks 00825de0:Room::render_darkness_overlay 00825de0:Room::render_darkness_overlay 00825de0:Room::render_darkness_overlay 00825de0:Room::render_darkness_overlay 00825de0:Room::render_darkness_overlay 00825de0:Room::render_darkness_overlay 0074de30:Game::generate_home_level 0074de30:Game::generate_home_level 0074de30:Game::generate_home_level 0074de30:Game::generate_home_level 0074de30:Game::generate_home_level 0074de30:Game::generate_home_level 0074de30:Game::generate_home_level 0074de30:Game::generate_home_level 0074de30:Game::generate_home_level 0074de30:Game::generate_home_level 0074de30:Game::generate_home_level 0074de30:Game::generate_home_level 0074de30:Game::generate_home_level 0074de30:Game::generate_home_level 0074de30:Game::generate_home_level 0074de30:Game::generate_home_level 00545f70:NpcAI::ENTITY_FISTULOID 007cdf30:teleport_to_random_room_of_types 007cdf30:teleport_to_random_room_of_types 0071dfc0:GridEntity_Spikes::BeginBatches 0071dfc0:GridEntity_Spikes::BeginBatches 0071dfc0:GridEntity_Spikes::BeginBatches 00535280:NpcAI::ENTITY_SQUIRT 00535280:NpcAI::ENTITY_SQUIRT 0050d370:NpcAI::ENTITY_CLOTTY 006b5320:Entity_Tear::reroll_hit_entity 006b5320:Entity_Tear::reroll_hit_entity 007ed310:Room::SpawnEntry 007ed310:Room::SpawnEntry 007ed310:Room::SpawnEntry 007ed310:Room::SpawnEntry 007ed310:Room::SpawnEntry 007ed310:Room::SpawnEntry 0096d3f0:Entity_Laser::impact_tear_flag_effects 0096d3f0:Entity_Laser::impact_tear_flag_effects 0096d3f0:Entity_Laser::impact_tear_flag_effects 0096d3f0:Entity_Laser::impact_tear_flag_effects 006653e0:FUN_006653e0 00755470:Entity_Player::Init 00755470:Entity_Player::Init 00755470:Entity_Player::Init 00755470:Entity_Player::Init 00755470:Entity_Player::Init 00755470:Entity_Player::Init 00755470:Entity_Player::Init 00755470:Entity_Player::Init 00755470:Entity_Player::Init 006d5400:Entity_NPC::trigger_kill_item_effects 006d5400:Entity_NPC::trigger_kill_item_effects 006d5400:Entity_NPC::trigger_kill_item_effects 006d5400:Entity_NPC::trigger_kill_item_effects 0074d4a0:Level::prepare_blue_room 00705480:Game::DevolveEnemy 0063d570:FamiliarHelper::fly_head_pathfind_move 0063d570:FamiliarHelper::fly_head_pathfind_move 0093d510:Backdrop::render_wall_detail 009356a0:Backdrop::render_floor_to_target 009356a0:Backdrop::render_floor_to_target 009356a0:Backdrop::render_floor_to_target 009356a0:Backdrop::render_floor_to_target 009356a0:Backdrop::render_floor_to_target 006657a0:Entity_Slot::HandleCollision 006657a0:Entity_Slot::HandleCollision 006657a0:Entity_Slot::HandleCollision 0062c8d0:Entity_Familiar::farting_baby_fart 007f2800:Room::Init 007f2800:Room::Init 007f2800:Room::Init 007f2800:Room::Init 007f2800:Room::Init 007f2800:Room::Init 007f2800:Room::Init 007f2800:Room::Init 007f2800:Room::Init 007f2800:Room::Init 007f2800:Room::Init 007f2800:Room::Init 007f2800:Room::Init 007f2800:Room::Init 007f2800:Room::Init 00744940:Level::Init 00734900:ItemPool::GetPill 00734900:ItemPool::GetPill 00734900:ItemPool::GetPill 00504a40:NpcAI::ENTITY_DUSTY_DEATHS_HEAD 00504a40:NpcAI::ENTITY_DUSTY_DEATHS_HEAD 0065cb60:Entity_Projectile::Render 0065cb60:Entity_Projectile::Render 0065cb60:Entity_Projectile::Render 00634b10:Entity_Familiar::ai_lil_spewer 00634b10:Entity_Familiar::ai_lil_spewer 00634b10:Entity_Familiar::ai_lil_spewer 00634b10:Entity_Familiar::ai_lil_spewer 00634b10:Entity_Familiar::ai_lil_spewer 00634b10:Entity_Familiar::ai_lil_spewer 00634b10:Entity_Familiar::ai_lil_spewer 00634b10:Entity_Familiar::ai_lil_spewer 00634b10:Entity_Familiar::ai_lil_spewer 0051cb30:NpcAI::ENTITY_HANGER 0049cbf0:WeightedOutcomePicker::PickOutcome 007a4ba0:Entity_Player::level_start 007a4ba0:Entity_Player::level_start 007a4ba0:Entity_Player::level_start 007a4ba0:Entity_Player::level_start 007a4ba0:Entity_Player::level_start 007a4ba0:Entity_Player::level_start 007a4ba0:Entity_Player::level_start 007a4ba0:Entity_Player::level_start 007a4ba0:Entity_Player::level_start 00704c50:Game::RerollLevelPickups 00734cc0:ItemPool::remove_deathmatch_pill_effects 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 00624e10:Entity_Familiar::Render 0074cea0:Level::roll_red_room_type 00644e80:Entity_Familiar::ai_shadow_intruder_damocles 00644e80:Entity_Familiar::ai_shadow_intruder_damocles 00734f30:ItemPool::Init 00734f30:ItemPool::Init 00734f30:ItemPool::Init 00734f30:ItemPool::Init 0074406b:FUN_0074406b 005cc070:RNG::Shuffle 005240a0:NpcAI::ENTITY_PARA_BITE 00584140:NpcAI::ENTITY_SCOURGE_chain 00584140:NpcAI::ENTITY_SCOURGE_chain 0074413a:FUN_0074413a 007ec100:Room::TransformEntry 0063c1c0:Entity_Familiar::ai_minisaac 0063c1c0:Entity_Familiar::ai_minisaac 007c4180:Entity_Player::UsePill 007c4180:Entity_Player::UsePill 00734180:ItemPool::GetCardEx 00734180:ItemPool::GetCardEx 00734180:ItemPool::GetCardEx 00734180:ItemPool::GetCardEx 00734180:ItemPool::GetCardEx 00734180:ItemPool::GetCardEx 00744209:FUN_00744209 007dc2d0:_Entity_Player::SpawnTrinketRandomPickup 007dc2d0:_Entity_Player::SpawnTrinketRandomPickup 005442a0:NpcAI::ENTITY_TARBOY 005442a0:NpcAI::ENTITY_TARBOY 00744348:FUN_00744348 00744348:FUN_00744348 00744348:FUN_00744348 00824350:Room::init_rain 00824350:Room::init_rain 00824350:Room::init_rain 00824350:Room::init_rain 00824350:Room::init_rain 00824350:Room::init_rain 00744466:FUN_00744466 00664560:Entity_Slot::TakeDamage 00664560:Entity_Slot::TakeDamage 00664560:Entity_Slot::TakeDamage 00664560:Entity_Slot::TakeDamage 00664560:Entity_Slot::TakeDamage 00744500:FUN_00744500 00984550:GridEntity_PressurePlate::Reward 00984550:GridEntity_PressurePlate::Reward 00984550:GridEntity_PressurePlate::Reward 007bc740:Entity_Player::InitPostLevelInitStats 007bc740:Entity_Player::InitPostLevelInitStats 007bc740:Entity_Player::InitPostLevelInitStats 007bc740:Entity_Player::InitPostLevelInitStats 007bc740:Entity_Player::InitPostLevelInitStats 007bc740:Entity_Player::InitPostLevelInitStats 007bc740:Entity_Player::InitPostLevelInitStats 007bc740:Entity_Player::InitPostLevelInitStats 0082c7d0:RoomConfig::GetRandomRoom 0082c7d0:RoomConfig::GetRandomRoom 0082c7d0:RoomConfig::GetRandomRoom 007ac7e0:Entity_Player::DischargeActiveItem 00934770:Backdrop::PreRenderControls 006f5850:FUN_006f5850 006f5850:FUN_006f5850 006f6dd0:Game::StartDailyChallenge 00755470:Entity_Player::Init 00755470:Entity_Player::Init 0075d9f0:FUN_0075d9f0 007f2800:Room::Init 00816910:Room::SpawnGreedModeWave 009dcc70:ItemPool::CreateGlitchedCollectible 009dcc70:ItemPool::CreateGlitchedCollectible 006378c0:Entity_Familiar::ai_lil_harbingers 00610540:Entity_Familiar::Kill 00610540:Entity_Familiar::Kill 006e69b0:Entity_Pickup::Render 00580eae 00580f12 0058072b 005807a1 0043fd44 0043fcc5 0063f0b9 0063f132 00716019 00716085 0071612b 00744940:Level::Init 00740e10:Level::generate_dungeon 00740e10:Level::generate_dungeon 00740e10:Level::generate_dungeon 00740e10:Level::generate_dungeon 00740e10:Level::generate_dungeon 00742ef0:Level::generate_backwards 00743550:Level::generate_greed 00743d88 0075fe32 0075fef5 00760556 007601fa 0076024c 007607c8 0075ffbd 00760680 00760a18 00760ae2 00760c76 007f2800:Room::Init 007f2800:Room::Init 007f2800:Room::Init 007f2800:Room::Init 007f2800:Room::Init 007f2800:Room::Init 007f2800:Room::Init 007f2800:Room::Init 007f2800:Room::Init 007f2800:Room::Init 007f2800:Room::Init 007f2800:Room::Init 0093b760:Backdrop::spawn_wall_details 009e0e34 00b6bf68 RNG: Invalid ShiftIdx\n 007d9d00:Entity_Player::CalculateBagOfCraftingOutput 007e8f90:RNG::game_constructor 00b6bf80 Floor Water Surface 007ea630:init_room_render_surfaces 00b6bf94 Shockwave Surface 007ea630:init_room_render_surfaces @@ -6275,7 +6275,7 @@ z 00b6c0c8 gfx/grid/grid_pit_mask.png 007ea630:init_room_render_surfaces 00b6c0e4 Textured Pit Surface 007ea630:init_room_render_surfaces 00b6c0fc Spawn Entity with Type(%d), Variant(%d), Pos(%.2f,%.2f)\n 00815ae0:Room::ShopRestockFull 007ed310:Room::SpawnEntry -00b6c138 SpawnGridEntity: Grid index invalid\n 007ebca0:Room::SpawnGridEntity 007ebd50:Room::SpawnGridEntityDesc 0071b1c0:GridEntity_Rock::TrySpawnLadder 006ab440:Entity::PlayerCollideWithGrid 0042a8b0:DeathmatchTypeBase::Update 0058a010:Entity_NPC::Render 0046a0f0:NpcAI::ENTITY_LARRYJR 0047a360:NpcAI::ENTITY_CHUB 006e2570:Entity_Pickup::update_price_sprite 007009a0:Game::BombTearflagEffects 007009a0:Game::BombTearflagEffects 00718ac0:GridEntity_Poop::get_giga_part 004b0fe0:NpcHelper::gideon_spawn_stairs 007f8190:Room::TrySpawnSecretShop 00460780:NpcAI::ENTITY_MEGA_FATTY 005af800:NpcAI::ENTITY_WORMWOOD_main 00827bf0:Room::spawn_sanguine_bond_spikes 006ff2a0:Game::BombDamage 006ff2a0:Game::BombDamage 007fe220:Room::card_against_humanity_fill 00576450:NpcHelper::raglich_slam_spawn_grid 007ee7e0:Room::make_wall 007ee7e0:Room::make_wall 004855b0:NpcAI::ENTITY_DINGLE 008257a0:Room::spawn_grid_from_desc 008257a0:Room::spawn_grid_from_desc 007f2800:Room::Init 00984550:GridEntity_PressurePlate::Reward 00984550:GridEntity_PressurePlate::Reward 007f2800:Room::Init 007f2800:Room::Init 00580502 +00b6c138 SpawnGridEntity: Grid index invalid\n 007ebca0:Room::SpawnGridEntity 007ebd50:Room::SpawnGridEntityDesc 0071b1c0:GridEntity_Rock::TrySpawnLadder 006ab440:Entity::PlayerCollideWithGrid 0042a8b0:DeathmatchTypeBase::Update 0058a010:NpcHelper::singe_crater_ring 0046a0f0:NpcAI::ENTITY_LARRYJR 0047a360:NpcAI::ENTITY_CHUB 006e2570:Entity_Pickup::update_price_sprite 007009a0:Game::BombTearflagEffects 007009a0:Game::BombTearflagEffects 00718ac0:GridEntity_Poop::get_giga_part 004b0fe0:NpcHelper::gideon_spawn_stairs 007f8190:Room::TrySpawnSecretShop 00460780:NpcAI::ENTITY_MEGA_FATTY 005af800:NpcAI::ENTITY_WORMWOOD_main 00827bf0:Room::spawn_sanguine_bond_spikes 006ff2a0:Game::BombDamage 006ff2a0:Game::BombDamage 007fe220:Room::card_against_humanity_fill 00576450:NpcHelper::raglich_slam_spawn_grid 007ee7e0:Room::make_wall 007ee7e0:Room::make_wall 004855b0:NpcAI::ENTITY_DINGLE 008257a0:Room::spawn_grid_from_desc 008257a0:Room::spawn_grid_from_desc 007f2800:Room::Init 00984550:GridEntity_PressurePlate::Reward 00984550:GridEntity_PressurePlate::Reward 007f2800:Room::Init 007f2800:Room::Init 00580502 00b6c160 invalid GridIndex while spawning door (slot %d) 007eea90:Room::MakeDoor 00b6c190 make_wall index out of bounds\n 007ee7e0:Room::make_wall 00b6c1b0 gfx/ash_mask.png 007ea630:init_room_render_surfaces @@ -9518,7 +9518,7 @@ z 00b7e694 KickButton 009b8990:PauseScreen::render_lobby_buttons 00b7e6a0 PasswordButton 009b8990:PauseScreen::render_lobby_buttons 00b7e6b0 PasswordPos 009b8990:PauseScreen::render_lobby_buttons -00b7e6bc PlayerManager::GetPlayer() : There are no players! \n 009bb840:PlayerManager::trigger_room_clear 0083b850:HUD::update_player_hud_slots 0099b980:GridEntity_Gravity::Update 00703950:Game::GetNearestPlayer 00703950:Game::GetNearestPlayer 009439d0:Camera::update_focus_position 009839f0:GridEntity_PressurePlate::update_greed_button 009839f0:GridEntity_PressurePlate::update_greed_button 009bb960:PlayerManager::trigger_level_start 009bba30:PlayerManager::enter_level 009bba30:PlayerManager::enter_level 009bba30:PlayerManager::enter_level 009bba30:PlayerManager::enter_level 00703ab0:Game::GetNearestPlayerEx 00833c40:Ambush::SpawnBossrushWave 006bbdc0:Entity_Pickup::Update 006bbdc0:Entity_Pickup::Update 009a3eb0:HUD::Render 00463100:NpcAI::ENTITY_ISAAC 0095b310:Manager::update_controller_popups 0095b310:Manager::update_controller_popups 0095b310:Manager::update_controller_popups 0071b410:GridEntity_Rock::SpawnDrops 005cb480:Entity_Player::update_mini_mush_costume 009bb5d0:PlayerManager::Update 009bb5d0:PlayerManager::Update 00703670:Game::ShakeScreen 00833600:Ambush::SpawnWave 0042a8b0:DeathmatchTypeBase::Update 00802980:Room::Update 0041ab50:EntityList::query_player_capsule_hits 006d2b50:Entity_NPC::Interpolate 009bac40:PlayerManager::handle_coop_join 009bac40:PlayerManager::handle_coop_join 009bac40:PlayerManager::handle_coop_join 009bac40:PlayerManager::handle_coop_join 009bac40:PlayerManager::handle_coop_join 0065ad30:reroll_entity_to_free_tile 004aafa0:NpcAI::ENTITY_DOGMA 008020d0:Room::update_deaths_list 0058a010:Entity_NPC::Render 00712180:GridEntity_Pit::Update 00712180:GridEntity_Pit::Update 009b23a0:Menu_Options::Update 0042a4d0:DeathmatchTypeBase::Init 0042a4d0:DeathmatchTypeBase::Init 006fa540:Manager::update_ingame_input 0095a7b0:PlayerManager::unlock_completion_mark 0041a790:EntityList::QueryRadius 00802740:random_position_away_from_players 00579890:NpcAI::ENTITY_REAP_CREEP 008d19a0:PauseScreen::build_player_user_list 00711950:GridEntity_Lock::Update 00921ce0:NightmareScene::Show 00921ce0:NightmareScene::Show 00541ce0:NpcAI::ENTITY_MEATBALL 00499de0:NpcAI::ENTITY_BUMBINO 00499de0:NpcAI::ENTITY_BUMBINO 00419e70:EntityList::rebuild_sublists 00419e70:EntityList::rebuild_sublists 00419e70:EntityList::rebuild_sublists 00419e70:EntityList::rebuild_sublists 00419e70:EntityList::rebuild_sublists 00419e70:EntityList::rebuild_sublists 00839070:FUN_00839070 00959180:save_rerun_to_steam_cloud 00569170:NpcAI::ENTITY_MOTHER 004291c0:update_cutscene_state_machine 009b92c0:PlayerManager::GetPlayer 004d1290:NpcAI::ENTITY_MOM 004d1290:NpcAI::ENTITY_MOM 006b9740:Entity::IsPlayerInRadius 007597e0:Entity_Player::ConsumableCountChanged 00721780:GridEntity_Web::Update 00830950:RoomTransition::ChangeRoom 009a8a40:FUN_009a8a40 007b0be0:Entity_Player::StoreGameState 007b0be0:Entity_Player::StoreGameState 004f8df0:NpcAI::ENTITY_BOMB_GRIMACE 00930ee0:FUN_00930ee0 00528ec0:NpcHelper::migraine_timer_spawn 00528ec0:NpcHelper::migraine_timer_spawn 00908070:netplay_lost_connection_callback 006f8140:Game::restore_game_state 004c8090:NpcAI::ENTITY_MEGA_SATAN 00468180:NpcAI::ENTITY_DADDYLONGLEGS 00708250:PlayerManager::GetGFuelCount 007584b0:Entity_Player::InvalidateCoPlayerItems 007584b0:Entity_Player::InvalidateCoPlayerItems 00800500:Room::update_ambient_sounds 009a8620:HUD::AssignPlayerHUDs 004186c0:EntityList::Update 009a0740:HomingLaser::truncate_samples_at_player 00417870:Game::GetPlayer 007178c0:GridEntity_Poop::spawn_drops 007178c0:GridEntity_Poop::spawn_drops 00757ac0:Entity_Player::release_weapons_and_effects 00757ac0:Entity_Player::release_weapons_and_effects 00707ad0:r_key_timer_callback 0096fd60:Entity_Laser::CalculateEndPoint 004f7e60:NpcAI::ENTITY_MORNINGSTAR 0071fef0:GridEntity_TrapDoor::Update 008271e0:Room::UpdateRedKey 009172f0:write_game_state_to_stream 0080f200:Room::Render 0080f200:Room::Render 0080f200:Room::Render 0044f2b0:NpcAI::ENTITY_BEAST_ultra_war_bomb 0079f3c0:Entity_Player::update_ladder 0079f3c0:Entity_Player::update_ladder 009bf530:PlayerManager::restore_controller_assignment 009bf530:PlayerManager::restore_controller_assignment 009bf530:PlayerManager::restore_controller_assignment 007475b0:Level::RestoreGameState 004f76f0:NpcAI::ENTITY_MOCKULUS 006be840:Entity_NPC::GetPlayerTarget 006ae820:Entity::Update 007069a0:Game::GetNearestTargetPlayer 009beba0:players_center_position 009beba0:players_center_position 007a6c50:Entity_Player::room_enter 00706020:Game::rewind 0073e0a0:Level::load_room 007fe220:Room::card_against_humanity_fill 006fe2f0:Game::ChangeRoom 006fe410:Game::SpawnEx 007ae4b0:Entity_Player::RestoreGameState 007ae4b0:Entity_Player::RestoreGameState 006f6500:Game::add_players 004a6500:NpcAI::ENTITY_DELIRIUM 00715940:GridEntity_Poop::BeginBatches 0098dba0:Game::update_map_input 0098dba0:Game::update_map_input 006ddcd0:Pickup_PickVariant 004cde30:Entity_NPC::update_physics 00535280:NpcAI::ENTITY_SQUIRT 009bd3b0:PlayerManager::spawn_coop_baby_for_join 006b5320:Entity_Tear::reroll_hit_entity 0096d3f0:Entity_Laser::impact_tear_flag_effects 0096d3f0:Entity_Laser::impact_tear_flag_effects 006d5400:Entity_NPC::trigger_kill_item_effects 0064d5f0:FamiliarAI::star_of_bethlehem 006ed690:Entity_Pickup::update_magnet_attraction 006ed690:Entity_Pickup::update_magnet_attraction 006ed690:Entity_Pickup::update_magnet_attraction 009aca90:ItemOverlay::Update 00944a40:Camera::IsPosVisible 00954b40:input_poll_active_device 00644e80:Entity_Familiar::ai_shadow_intruder_damocles 009bc000:PlayerManager::trigger_new_room_effects 00584140:NpcAI::ENTITY_SCOURGE_chain 0042c170:DeathmatchTypeBase::spawn_random_pickup 0063c1c0:Entity_Familiar::ai_minisaac 0084c170:FUN_0084c170 00714320:GridEntity_Pit::PostInit 00664560:Entity_Slot::TakeDamage 007bc740:Entity_Player::InitPostLevelInitStats 00934770:Backdrop::PreRenderControls 006f5850:FUN_006f5850 006f7ac0:Game::NextVictoryLap 006fdc10:Game::StartStageTransition 006fdc10:Game::StartStageTransition 006fdc10:Game::StartStageTransition 007a6450:Entity_Player::SetControllerIndex 00816910:Room::SpawnGreedModeWave 0082ee40:RoomTransition::start 0090d41e 0090e2a0:FUN_0090e2a0 0090e2a0:FUN_0090e2a0 00714770:GridEntity_Poop::Update 00714770:GridEntity_Poop::Update 00610540:Entity_Familiar::Kill 00580a4e 0044002e 0063f413 +00b7e6bc PlayerManager::GetPlayer() : There are no players! \n 009bb840:PlayerManager::trigger_room_clear 0083b850:HUD::update_player_hud_slots 0099b980:GridEntity_Gravity::Update 00703950:Game::GetNearestPlayer 00703950:Game::GetNearestPlayer 009439d0:Camera::update_focus_position 009839f0:GridEntity_PressurePlate::update_greed_button 009839f0:GridEntity_PressurePlate::update_greed_button 009bb960:PlayerManager::trigger_level_start 009bba30:PlayerManager::enter_level 009bba30:PlayerManager::enter_level 009bba30:PlayerManager::enter_level 009bba30:PlayerManager::enter_level 00703ab0:Game::GetNearestPlayerEx 00833c40:Ambush::SpawnBossrushWave 006bbdc0:Entity_Pickup::Update 006bbdc0:Entity_Pickup::Update 009a3eb0:HUD::Render 00463100:NpcAI::ENTITY_ISAAC 0095b310:Manager::update_controller_popups 0095b310:Manager::update_controller_popups 0095b310:Manager::update_controller_popups 0071b410:GridEntity_Rock::SpawnDrops 005cb480:Entity_Player::update_mini_mush_costume 009bb5d0:PlayerManager::Update 009bb5d0:PlayerManager::Update 00703670:Game::ShakeScreen 00833600:Ambush::SpawnWave 0042a8b0:DeathmatchTypeBase::Update 00802980:Room::Update 0041ab50:EntityList::query_player_capsule_hits 006d2b50:Entity_NPC::Interpolate 009bac40:PlayerManager::handle_coop_join 009bac40:PlayerManager::handle_coop_join 009bac40:PlayerManager::handle_coop_join 009bac40:PlayerManager::handle_coop_join 009bac40:PlayerManager::handle_coop_join 0065ad30:reroll_entity_to_free_tile 004aafa0:NpcAI::ENTITY_DOGMA 008020d0:Room::update_deaths_list 0058a010:NpcHelper::singe_crater_ring 00712180:GridEntity_Pit::Update 00712180:GridEntity_Pit::Update 009b23a0:Menu_Options::Update 0042a4d0:DeathmatchTypeBase::Init 0042a4d0:DeathmatchTypeBase::Init 006fa540:Manager::update_ingame_input 0095a7b0:PlayerManager::unlock_completion_mark 0041a790:EntityList::QueryRadius 00802740:random_position_away_from_players 00579890:NpcAI::ENTITY_REAP_CREEP 008d19a0:PauseScreen::build_player_user_list 00711950:GridEntity_Lock::Update 00921ce0:NightmareScene::Show 00921ce0:NightmareScene::Show 00541ce0:NpcAI::ENTITY_MEATBALL 00499de0:NpcAI::ENTITY_BUMBINO 00499de0:NpcAI::ENTITY_BUMBINO 00419e70:EntityList::rebuild_sublists 00419e70:EntityList::rebuild_sublists 00419e70:EntityList::rebuild_sublists 00419e70:EntityList::rebuild_sublists 00419e70:EntityList::rebuild_sublists 00419e70:EntityList::rebuild_sublists 00839070:FUN_00839070 00959180:save_rerun_to_steam_cloud 00569170:NpcAI::ENTITY_MOTHER 004291c0:update_cutscene_state_machine 009b92c0:PlayerManager::GetPlayer 004d1290:NpcAI::ENTITY_MOM 004d1290:NpcAI::ENTITY_MOM 006b9740:Entity::IsPlayerInRadius 007597e0:Entity_Player::ConsumableCountChanged 00721780:GridEntity_Web::Update 00830950:RoomTransition::ChangeRoom 009a8a40:FUN_009a8a40 007b0be0:Entity_Player::StoreGameState 007b0be0:Entity_Player::StoreGameState 004f8df0:NpcAI::ENTITY_BOMB_GRIMACE 00930ee0:FUN_00930ee0 00528ec0:NpcHelper::migraine_timer_spawn 00528ec0:NpcHelper::migraine_timer_spawn 00908070:netplay_lost_connection_callback 006f8140:Game::restore_game_state 004c8090:NpcAI::ENTITY_MEGA_SATAN 00468180:NpcAI::ENTITY_DADDYLONGLEGS 00708250:PlayerManager::GetGFuelCount 007584b0:Entity_Player::InvalidateCoPlayerItems 007584b0:Entity_Player::InvalidateCoPlayerItems 00800500:Room::update_ambient_sounds 009a8620:HUD::AssignPlayerHUDs 004186c0:EntityList::Update 009a0740:HomingLaser::truncate_samples_at_player 00417870:Game::GetPlayer 007178c0:GridEntity_Poop::spawn_drops 007178c0:GridEntity_Poop::spawn_drops 00757ac0:Entity_Player::release_weapons_and_effects 00757ac0:Entity_Player::release_weapons_and_effects 00707ad0:r_key_timer_callback 0096fd60:Entity_Laser::CalculateEndPoint 004f7e60:NpcAI::ENTITY_MORNINGSTAR 0071fef0:GridEntity_TrapDoor::Update 008271e0:Room::UpdateRedKey 009172f0:write_game_state_to_stream 0080f200:Room::Render 0080f200:Room::Render 0080f200:Room::Render 0044f2b0:NpcAI::ENTITY_BEAST_ultra_war_bomb 0079f3c0:Entity_Player::update_ladder 0079f3c0:Entity_Player::update_ladder 009bf530:PlayerManager::restore_controller_assignment 009bf530:PlayerManager::restore_controller_assignment 009bf530:PlayerManager::restore_controller_assignment 007475b0:Level::RestoreGameState 004f76f0:NpcAI::ENTITY_MOCKULUS 006be840:Entity_NPC::GetPlayerTarget 006ae820:Entity::Update 007069a0:Game::GetNearestTargetPlayer 009beba0:players_center_position 009beba0:players_center_position 007a6c50:Entity_Player::room_enter 00706020:Game::rewind 0073e0a0:Level::load_room 007fe220:Room::card_against_humanity_fill 006fe2f0:Game::ChangeRoom 006fe410:Game::SpawnEx 007ae4b0:Entity_Player::RestoreGameState 007ae4b0:Entity_Player::RestoreGameState 006f6500:Game::add_players 004a6500:NpcAI::ENTITY_DELIRIUM 00715940:GridEntity_Poop::BeginBatches 0098dba0:Game::update_map_input 0098dba0:Game::update_map_input 006ddcd0:Pickup_PickVariant 004cde30:Entity_NPC::update_physics 00535280:NpcAI::ENTITY_SQUIRT 009bd3b0:PlayerManager::spawn_coop_baby_for_join 006b5320:Entity_Tear::reroll_hit_entity 0096d3f0:Entity_Laser::impact_tear_flag_effects 0096d3f0:Entity_Laser::impact_tear_flag_effects 006d5400:Entity_NPC::trigger_kill_item_effects 0064d5f0:FamiliarAI::star_of_bethlehem 006ed690:Entity_Pickup::update_magnet_attraction 006ed690:Entity_Pickup::update_magnet_attraction 006ed690:Entity_Pickup::update_magnet_attraction 009aca90:ItemOverlay::Update 00944a40:Camera::IsPosVisible 00954b40:input_poll_active_device 00644e80:Entity_Familiar::ai_shadow_intruder_damocles 009bc000:PlayerManager::trigger_new_room_effects 00584140:NpcAI::ENTITY_SCOURGE_chain 0042c170:DeathmatchTypeBase::spawn_random_pickup 0063c1c0:Entity_Familiar::ai_minisaac 0084c170:FUN_0084c170 00714320:GridEntity_Pit::PostInit 00664560:Entity_Slot::TakeDamage 007bc740:Entity_Player::InitPostLevelInitStats 00934770:Backdrop::PreRenderControls 006f5850:FUN_006f5850 006f7ac0:Game::NextVictoryLap 006fdc10:Game::StartStageTransition 006fdc10:Game::StartStageTransition 006fdc10:Game::StartStageTransition 007a6450:Entity_Player::SetControllerIndex 00816910:Room::SpawnGreedModeWave 0082ee40:RoomTransition::start 0090d41e 0090e2a0:FUN_0090e2a0 0090e2a0:FUN_0090e2a0 00714770:GridEntity_Poop::Update 00714770:GridEntity_Poop::Update 00610540:Entity_Familiar::Kill 00580a4e 0044002e 0063f413 00b7e6f4 Clearing player color assignments \n 009b9150:FUN_009b9150 0090e2a0:FUN_0090e2a0 00b7e718 Clearing player color assignment for color %d \n 0090e2a0:FUN_0090e2a0 00b7e748 Clearing player color assignment for controllerId %d \n 009ba000:PlayerManager::RemoveCoPlayer diff --git a/generated-src/classes.h b/generated-src/classes.h index c63695c..a066c5c 100644 --- a/generated-src/classes.h +++ b/generated-src/classes.h @@ -1140,12 +1140,6 @@ struct DateTime { }; -struct DebugRenderer { - void Render(); // 0042dbb0 - void * Get(int Index, uint8_t Unk); // 0042eb10 -}; - - struct Vector { static Vector * operator_mul(Vector *outResult, float *scalar, Vector *vector); // 004171d0 static Vector * ToCardinal(Vector *outResult, Vector *vec); // 0067f170 @@ -3380,7 +3374,9 @@ struct NpcHelper { static int ReapCreep_CountOtherEnemies(); // 00579770 static Entity_Laser * ReapCreep_ThinLaser(Entity_NPC *npc, float startAngle, float endAngle, int unused); // 005797b0 static void scourge_whip(Entity_NPC *npc); // 00582f60 + void scourge_chain_strip_render(Vector *renderOffset); // 005832c0 static void scourge_chain_shoot(); // 00587480 + static void singe_crater_ring(Entity *pitEntity); // 0058a010 static void singe_explode_at(Entity_NPC *npc, Vector *position); // 0058ac10 static void siren_charm_familiar(Entity_NPC *npc, Entity_Familiar *familiar); // 0058e260 static void siren_familiar_counts(int *outFreeCount, int *outCharmedCount, int *outTotalCount); // 0058e490 @@ -3583,12 +3579,6 @@ struct Shader { }; -struct Shape { - Shape(void *other); // 0042f850 - Shape() = default; -}; - - struct SharedPtr { void assign(void *other); // 004d74a0 }; @@ -5440,7 +5430,6 @@ void FUN_0042c820(uint32_t param_1); // 0042c820 int FUN_0042d040(); // 0042d040 void FUN_0042edb0(); // 0042edb0 void FUN_0042ede0(uint32_t *param_1); // 0042ede0 -void push_shape_points(void *self, Capsule *capsule); // 0042eef0 void FUN_0042f050(uint32_t param_1); // 0042f050 void FUN_0042f060(); // 0042f060 void FUN_0042f0c0(); // 0042f0c0 @@ -5604,7 +5593,6 @@ void set_byte_0x101(void *self, uint8_t value); // 00505b50 int FUN_00505ca0(); // 00505ca0 uint32_t * FUN_00505ce0(); // 00505ce0 void npc_distribute_orbit_angles(Entity_NPC *npc); // 00547040 -int FUN_0054d1b0(int param_1); // 0054d1b0 void FUN_00557b50(uint32_t param_1); // 00557b50 void FUN_00557b70(uint8_t *param_1); // 00557b70 bool FUN_00557bb0(int *param_1); // 00557bb0 @@ -5655,9 +5643,6 @@ void FUN_005c7bf0(int *param_1, int *param_2); // 005c7bf0 void FUN_005c7d30(int param_1); // 005c7d30 void FUN_005c7e30(int param_1); // 005c7e30 void FUN_005c7ef0(int param_1); // 005c7ef0 -void FUN_005c7f20(int param_1); // 005c7f20 -void everything_jar_crack_the_sky_timer(int param_1); // 005c8020 -void everything_jar_shopkeeper_rain_timer(int param_1); // 005c83f0 void FUN_005ca566(uint32_t param_1, uint32_t param_2, int param_3); // 005ca566 void FUN_005ca880(); // 005ca880 void FUN_005cba20(); // 005cba20 @@ -6018,7 +6003,6 @@ void FUN_006daab0(); // 006daab0 void FUN_006dac00(uint32_t *param_1, uint32_t param_2); // 006dac00 float log_precise(float value); // 006dac30 void FUN_006daca0(uint32_t param_1); // 006daca0 -uint32_t FUN_006e1910(uint32_t param_1); // 006e1910 void FUN_006ee330(); // 006ee330 int FUN_006ee640(int param_1, int param_2, uint32_t *param_3, uint32_t param_4); // 006ee640 uint32_t FUN_006eeeb0(); // 006eeeb0 @@ -6210,7 +6194,6 @@ void FUN_00757980(uint32_t *param_1); // 00757980 void FUN_00757a10(); // 00757a10 uint32_t FUN_00758590(); // 00758590 int FUN_00759260(); // 00759260 -void FUN_00770640(float *param_1); // 00770640 void FUN_007792f0(uint32_t param_1, uint32_t param_2); // 007792f0 uint32_t FUN_007826c0(); // 007826c0 void FUN_0078b330(uint32_t *param_1); // 0078b330 @@ -6222,8 +6205,6 @@ void FUN_007b8c00(int param_1); // 007b8c00 void FUN_007c2e80(); // 007c2e80 void FUN_007cb4f0(); // 007cb4f0 void FUN_007cf940(); // 007cf940 -long double FUN_007cf9a0(float *param_1, KColor *param_2, uint32_t param_3); // 007cf9a0 -uint8_t * FUN_007cfa90(); // 007cfa90 void FUN_007d3330(int param_1); // 007d3330 void FUN_007d9360(); // 007d9360 uint32_t FUN_007d9ca0(); // 007d9ca0 @@ -20265,14 +20246,6 @@ void Update(); // 008e7250 namespace NetLogging { void format_callstack(uint32_t param_1, uint32_t param_2); // 00904a60 } -namespace NpcAI { -void ENTITY_BUTT_SLICKER(Entity_NPC *npc); // 0054d250 -void ENTITY_SINGE_body(Entity_NPC *npc); // 0058aed0 -void ENTITY_SIREN_main(Entity_NPC *npc); // 0058ec70 -void siren_release_stolen_items(Entity_NPC *npc); // 005911b0 -void ENTITY_SIREN(Entity_NPC *npc); // 00591460 -void ENTITY_SIREN_HELPER(Entity_NPC *npc); // 00591cc0 -} namespace OnlineStats { void compute_awards(); // 004254b0 } diff --git a/generated-src/debug_renderer.cpp b/generated-src/debug_renderer.cpp deleted file mode 100644 index 6727fe4..0000000 --- a/generated-src/debug_renderer.cpp +++ /dev/null @@ -1,533 +0,0 @@ -#include "classes.h" - -// 0042dbb0 -void DebugRenderer::Render() -{ - float *pfVar1; - float *line; - void *quad; - uint8_t *textChars; - uint32_t pointIndex; - uint16_t *cmd; - int prevStep; - int iVar2; - int *piVar3; - float fVar4; - float fVar5; - float sinQuarterTurn; - double dVar6; - uint8_t rectQuad [112]; - uint8_t lineQuad [112]; - uint32_t fontParams; - uint32_t local_118; - uint32_t local_114; - uint32_t local_110; - uint32_t local_10c; - uint32_t local_108; - uint32_t local_104; - Vector arcEndB; - Vector arcEndA; - Vector sideBFrom; - Vector sideBTo; - Vector sideAFrom; - Vector sideATo; - Vector circleNext; - Vector rectPos; - Vector rectSize; - Vector linePos; - Vector lineSize; - Vector segmentEnd; - Vector segmentStart; - DebugRenderer *renderer; - Vector arcStartB; - Vector arcStartA; - Vector circlePrev; - KColor color; - float capsuleCenterY; - float capsuleCenterX; - float capsuleOffsetY; - float capsuleOffsetX; - int *node; - float capsuleAxisY; - float roomOffsetY; - float roomOffsetX; - float local_48; - float local_44; - float local_40; - float local_3c; - uint16_t *local_38; - float local_34; - float local_30; - float local_2c; - uint8_t *local_28; - float local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - uint32_t local_14; - uint16_t *cmdLast; - - puStack_20 = GHIDRA_CAST((GHIDRA_INT(register0x00000010) + -4)); - local_14 = 0xffffffff; - puStack_18 = &LAB_00af1e50; - local_1c = ExceptionList; - ExceptionList = &local_1c; - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[1])) + 0x1)))) != 0) { - roomOffsetX = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x1204)); - roomOffsetY = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x1208)); - node = GHIDRA_CAST(**(int **))this; - renderer = this; - if (node != *GHIDRA_CAST(this)) { - do { - cmd = GHIDRA_CAST(node[4]); - color._unk = 0; - color._red = 1.0; - color._green = 1.0; - color._blue = 0.0; - color._alpha = 1.0; - piVar3 = node; - if (cmd != GHIDRA_CAST(node[5])) { - do { - cmdLast = cmd; - switch(*cmd) { - case 0xfff9: - cmdLast = cmd + 2; - local_28 = GHIDRA_CAST((piVar3[0xd] + GHIDRA_UINT(*cmdLast) * 0x18)); - local_24 = g_displayPixelRatio * g_screenPointScale; - local_40 = (*GHIDRA_CAST((piVar3[10] + 4 + GHIDRA_UINT(cmd[1]) * 8)) - 140.0) * 0.65 + - (g_screenHeight - 182.0) * 0.5; - local_44 = local_24 * - ((*GHIDRA_CAST((piVar3[10] + GHIDRA_UINT(cmd[1]) * 8)) - 60.0) * 0.65 + - (g_screenWidth - 338.0) * 0.5) + 0.5; - dVar6 = floor((double)local_44); - local_2c = (float)dVar6 / local_24; - local_44 = local_24 * local_40 + 0.5; - dVar6 = floor((double)local_44); - local_44 = (float)dVar6; - fontParams = 0; - local_118 = 0xffff; - local_114 = 0; - local_110 = 0x3f800000; - local_10c = 0xffffffff; - local_108 = 0; - local_104 = 0; - local_14 = 0; - textChars = local_28; - if (0xf < *GHIDRA_CAST((local_28 + 0x14))) { - textChars = *GHIDRA_CAST(local_28); - } - Font::DrawString(&g_manager->_font8_LuaMiniOutlined,textChars,&color,&fontParams, - roomOffsetX + local_2c,roomOffsetY + local_44 / local_24); - local_14 = 0xffffffff; - break; - case 0xfffa: - local_24 = (float)GHIDRA_UINT(cmd[2]); - local_30 = (float)GHIDRA_UINT(cmd[1]); - cmdLast = cmd + 3; - iVar2 = piVar3[10]; - pointIndex = GHIDRA_UINT(*cmdLast); - capsuleOffsetX = - *GHIDRA_CAST((iVar2 + 4 + pointIndex * 8)) * *GHIDRA_CAST((iVar2 + GHIDRA_INT(local_24) * 8)); - fVar4 = (*GHIDRA_CAST((iVar2 + pointIndex * 8)) * 6.2831855) / 10.0; - if (fVar4 <= 2.0) { - fVar4 = 2.0; - } - capsuleOffsetY = - *GHIDRA_CAST((iVar2 + 4 + GHIDRA_INT(local_24) * 8)) * - *GHIDRA_CAST((iVar2 + 4 + pointIndex * 8)); - if (12.0 <= fVar4) { - fVar4 = 12.0; - } - local_2c = (float)(GHIDRA_INT(fVar4) * 2); - local_38 = cmdLast; - local_28 = GHIDRA_CAST(cos(1.5707964)); - sinQuarterTurn = sin(1.5707964); - piVar3 = node; - iVar2 = node[10]; - fVar4 = *GHIDRA_CAST((iVar2 + GHIDRA_INT(local_24) * 8)); - fVar5 = *GHIDRA_CAST((iVar2 + 4 + GHIDRA_INT(local_24) * 8)); - local_34 = (fVar4 * (float)local_28 - sinQuarterTurn * fVar5) * - *GHIDRA_CAST((iVar2 + GHIDRA_UINT(*cmdLast) * 8)); - local_3c = g_displayPixelRatio * g_screenPointScale; - capsuleAxisY = (sinQuarterTurn * fVar4 + fVar5 * (float)local_28) * - *GHIDRA_CAST((iVar2 + GHIDRA_UINT(*cmdLast) * 8)); - local_24 = ((g_screenWidth - 338.0) * 0.5 + - (*GHIDRA_CAST((iVar2 + GHIDRA_INT(local_30) * 8)) - 60.0) * 0.65) * local_3c + 0.5; - dVar6 = floor((double)local_24); - local_28 = GHIDRA_CAST(((float)dVar6 / local_3c)); - local_24 = ((*GHIDRA_CAST((piVar3[10] + 4 + GHIDRA_INT(local_30) * 8)) - 140.0) * 0.65 + - (g_screenHeight - 182.0) * 0.5) * local_3c + 0.5; - dVar6 = floor((double)local_24); - capsuleCenterY = roomOffsetY + (float)dVar6 / local_3c; - capsuleCenterX = roomOffsetX + (float)local_28; - local_28 = GHIDRA_CAST(-capsuleOffsetY); - sideATo.x = (local_34 + capsuleOffsetX) * 0.65 + capsuleCenterX; - sideATo.y = (capsuleAxisY + capsuleOffsetY) * 0.65 + capsuleCenterY; - local_48 = -capsuleOffsetX; - sideAFrom.x = (local_48 + local_34) * 0.65 + capsuleCenterX; - sideAFrom.y = ((float)local_28 + capsuleAxisY) * 0.65 + capsuleCenterY; - local_40 = sideAFrom.y; - local_3c = sideAFrom.x; - local_30 = sideATo.y; - local_24 = sideATo.x; - render_color_quad(&sideAFrom,&sideATo,&color,&color,1.0); - sideBTo.x = (capsuleOffsetX - local_34) * 0.65 + capsuleCenterX; - sideBTo.y = (capsuleOffsetY - capsuleAxisY) * 0.65 + capsuleCenterY; - sideBFrom.x = (local_48 - local_34) * 0.65 + capsuleCenterX; - sideBFrom.y = ((float)local_28 - capsuleAxisY) * 0.65 + capsuleCenterY; - render_color_quad(&sideBFrom,&sideBTo,&color,&color,1.0); - arcStartA.x = local_24; - arcStartA.y = local_30; - arcStartB.x = local_3c; - arcStartB.y = local_40; - local_40 = 1.4013e-45; - if (0 < GHIDRA_INT(local_2c)) { - iVar2 = 1; - prevStep = -1; - local_24 = (float)GHIDRA_INT(local_2c); - do { - local_40 = (((float)prevStep * 180.0) / local_24) * 0.017453292; - local_3c = cos(local_40); - fVar4 = sin(local_40); - local_40 = (((float)iVar2 * 180.0) / local_24) * 0.017453292; - arcEndA.y = (local_3c * capsuleAxisY + fVar4 * local_34 + capsuleOffsetY) * 0.65 + - capsuleCenterY; - arcEndA.x = ((local_3c * local_34 - fVar4 * capsuleAxisY) + capsuleOffsetX) * 0.65 - + capsuleCenterX; - local_44 = arcEndA.x; - local_3c = arcEndA.y; - local_30 = cos(local_40); - fVar4 = sin(local_40); - arcEndB.x = ((local_30 * local_34 - capsuleAxisY * fVar4) + local_48) * 0.65 + - capsuleCenterX; - arcEndB.y = (local_30 * capsuleAxisY + local_34 * fVar4 + (float)local_28) * 0.65 - + capsuleCenterY; - local_40 = arcEndB.x; - local_30 = arcEndB.y; - render_color_quad(&arcStartA,&arcEndA,&color,&color,1.0); - render_color_quad(&arcStartB,&arcEndB,&color,&color,1.0); - iVar2 = iVar2 + 1; - arcStartA.x = local_44; - prevStep = prevStep + -1; - arcStartA.y = local_3c; - arcStartB.x = local_40; - arcStartB.y = local_30; - } while (iVar2 <= GHIDRA_INT(local_2c)); - cmdLast = local_38; - piVar3 = node; - } - break; - case 0xfffb: - local_2c = (float)GHIDRA_UINT(cmd[1]); - cmdLast = cmd + 2; - local_34 = *GHIDRA_CAST((piVar3[10] + GHIDRA_UINT(*cmdLast) * 8)); - fVar4 = (local_34 * 6.2831855) / 10.0; - local_30 = g_displayPixelRatio * g_screenPointScale; - if (fVar4 <= 2.0) { - fVar4 = 2.0; - } - if (12.0 <= fVar4) { - fVar4 = 12.0; - } - local_48 = (float)(GHIDRA_INT(fVar4) * 2); - local_24 = ((g_screenWidth - 338.0) * 0.5 + - (*GHIDRA_CAST((piVar3[10] + GHIDRA_INT(local_2c) * 8)) - 60.0) * 0.65) * local_30 + - 0.5; - local_38 = cmdLast; - dVar6 = floor((double)local_24); - local_28 = GHIDRA_CAST(((float)dVar6 / local_30)); - local_24 = ((g_screenHeight - 182.0) * 0.5 + - (*GHIDRA_CAST((piVar3[10] + 4 + GHIDRA_INT(local_2c) * 8)) - 140.0) * 0.65) * local_30 - + 0.5; - dVar6 = floor((double)local_24); - local_24 = (float)dVar6; - local_3c = roomOffsetY + local_24 / local_30; - local_30 = roomOffsetX + (float)local_28; - fVar4 = cos(0.0); - circlePrev.x = fVar4 * local_34 * 0.65 + local_30; - fVar5 = sin(0.0); - fVar4 = (float)(GHIDRA_INT(local_48) * 2); - circlePrev.y = fVar5 * local_34 * 0.65 + local_3c; - local_2c = fVar4; - if (0 < GHIDRA_INT(fVar4)) { - iVar2 = 1; - local_28 = GHIDRA_CAST((float)GHIDRA_INT(local_48)); - do { - local_24 = (((float)iVar2 * 180.0) / (float)local_28) * 0.017453292; - fVar5 = cos(local_24); - circleNext.x = fVar5 * local_34 * 0.65 + local_30; - local_2c = circleNext.x; - fVar5 = sin(local_24); - circleNext.y = fVar5 * local_34 * 0.65 + local_3c; - local_24 = circleNext.y; - render_color_quad(&circlePrev,&circleNext,&color,&color,1.0); - iVar2 = iVar2 + 1; - circlePrev.x = local_2c; - circlePrev.y = local_24; - } while (iVar2 <= GHIDRA_INT(fVar4)); - cmdLast = local_38; - piVar3 = node; - } - break; - case 0xfffc: - local_2c = (float)GHIDRA_UINT(cmd[1]); - iVar2 = piVar3[10]; - local_38 = GHIDRA_CAST((g_displayPixelRatio * g_screenPointScale)); - pointIndex = GHIDRA_UINT(cmd[2]); - fVar4 = *GHIDRA_CAST((iVar2 + GHIDRA_INT(local_2c) * 8)); - rectSize.x = (*GHIDRA_CAST((iVar2 + pointIndex * 8)) - fVar4) * 0.65; - rectSize.y = (*GHIDRA_CAST((iVar2 + 4 + pointIndex * 8)) - - *GHIDRA_CAST((iVar2 + 4 + GHIDRA_INT(local_2c) * 8))) * 0.65; - local_24 = ((g_screenWidth - 338.0) * 0.5 + (fVar4 - 60.0) * 0.65) * (float)local_38 + - 0.5; - dVar6 = floor((double)local_24); - local_48 = (float)dVar6 / (float)local_38; - local_24 = ((g_screenHeight - 182.0) * 0.5 + - (*GHIDRA_CAST((piVar3[10] + 4 + GHIDRA_INT(local_2c) * 8)) - 140.0) * 0.65) * - (float)local_38 + 0.5; - dVar6 = floor((double)local_24); - local_24 = (float)dVar6; - rectPos.x = local_48 + roomOffsetX; - rectPos.y = roomOffsetY + local_24 / (float)local_38; - render_quad_set_rect(rectQuad,&rectPos,&rectSize,&color); - render_color_shader_pass(quad); - cmdLast = cmd + 2; - break; - case 0xfffd: - local_2c = (float)GHIDRA_UINT(cmd[1]); - iVar2 = piVar3[10]; - local_38 = GHIDRA_CAST((g_displayPixelRatio * g_screenPointScale)); - pointIndex = GHIDRA_UINT(cmd[2]); - fVar4 = *GHIDRA_CAST((iVar2 + GHIDRA_INT(local_2c) * 8)); - lineSize.x = (*GHIDRA_CAST((iVar2 + pointIndex * 8)) - fVar4) * 0.65; - lineSize.y = (*GHIDRA_CAST((iVar2 + 4 + pointIndex * 8)) - - *GHIDRA_CAST((iVar2 + 4 + GHIDRA_INT(local_2c) * 8))) * 0.65; - local_24 = ((g_screenWidth - 338.0) * 0.5 + (fVar4 - 60.0) * 0.65) * (float)local_38 + - 0.5; - dVar6 = floor((double)local_24); - local_48 = (float)dVar6 / (float)local_38; - local_24 = ((g_screenHeight - 182.0) * 0.5 + - (*GHIDRA_CAST((piVar3[10] + 4 + GHIDRA_INT(local_2c) * 8)) - 140.0) * 0.65) * - (float)local_38 + 0.5; - dVar6 = floor((double)local_24); - local_24 = (float)dVar6; - linePos.x = roomOffsetX + local_48; - linePos.y = roomOffsetY + local_24 / (float)local_38; - render_quad_set_rect(lineQuad,&linePos,&lineSize,&color); - render_quad_draw_color_shader(line,1.0); - cmdLast = cmd + 2; - break; - case 0xfffe: - local_38 = GHIDRA_CAST(GHIDRA_UINT(cmd[1])); - cmdLast = cmd + 2; - local_34 = g_displayPixelRatio * g_screenPointScale; - local_30 = (g_screenHeight - 182.0) * 0.5; - local_28 = GHIDRA_CAST(((g_screenWidth - 338.0) * 0.5)); - local_24 = ((*GHIDRA_CAST((piVar3[10] + GHIDRA_UINT(*cmdLast) * 8)) - 60.0) * 0.65 + - (float)local_28) * local_34 + 0.5; - dVar6 = floor((double)local_24); - local_2c = (float)dVar6 / local_34; - local_24 = ((*GHIDRA_CAST((piVar3[10] + 4 + GHIDRA_UINT(*cmdLast) * 8)) - 140.0) * 0.65 + - local_30) * local_34 + 0.5; - dVar6 = floor((double)local_24); - segmentStart.x = local_2c + roomOffsetX; - segmentStart.y = roomOffsetY + (float)dVar6 / local_34; - local_24 = ((*GHIDRA_CAST((piVar3[10] + GHIDRA_INT(local_38) * 8)) - 60.0) * 0.65 + - (float)local_28) * local_34 + 0.5; - dVar6 = floor((double)local_24); - local_2c = (float)dVar6 / local_34; - local_24 = ((*GHIDRA_CAST((piVar3[10] + 4 + GHIDRA_INT(local_38) * 8)) - 140.0) * 0.65 + local_30 - ) * local_34 + 0.5; - dVar6 = floor((double)local_24); - local_24 = (float)dVar6; - segmentEnd.x = roomOffsetX + local_2c; - segmentEnd.y = roomOffsetY + local_24 / local_34; - render_color_quad(&segmentEnd,&segmentStart,&color,&color,1.0); - break; - case 0xffff: - pfVar1 = GHIDRA_CAST((piVar3[7] + GHIDRA_UINT(cmd[1]) * 0x14)); - color._red = *pfVar1; - color._green = pfVar1[1]; - color._blue = pfVar1[2]; - color._alpha = pfVar1[3]; - color._unk = *GHIDRA_CAST((piVar3[7] + 0x10 + GHIDRA_UINT(cmd[1]) * 0x14)); - cmdLast = cmd + 1; - } - cmd = cmdLast + 1; - } while (cmd != GHIDRA_CAST(piVar3[5])); - this = renderer; - } - node = GHIDRA_CAST(*piVar3); - } while (node != GHIDRA_CAST(*GHIDRA_CAST(this))); - } - } - ExceptionList = local_1c; - return; -} - -// 0042eb10 -void * DebugRenderer::Get(int Index, uint8_t Unk) -{ - int iVar1; - int *newNode; - void *ptr; - uint32_t size; - uint32_t uVar2; - void *pvVar3; - char *text; - int tmpShape; - uint32_t local_50; - void *pvStack_4c; - uint32_t uStack_48; - int iStack_44; - void *local_40; - uint32_t uStack_3c; - int iStack_38; - void *pvStack_34; - uint32_t local_30; - int iStack_2c; - int *piStack_28; - int *piStack_24; - int local_20; - DebugRenderer *local_1c; - int *local_18; - DebugRenderer *self; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - uint32_t *node; - char *textsEnd; - int *tmpTextsBegin; - int *tmpTextsEnd; - - local_8 = 0xffffffff; - puStack_c = &LAB_00af1e85; - local_10 = ExceptionList; - ExceptionList = &local_10; - self = this; - if (Index != -1) { - for (node = GHIDRA_CAST(**(uint32_t **))this; node != *GHIDRA_CAST(this); - node = GHIDRA_CAST(*node)) { - if (node[2] == Index) { - if (Unk != 0) { - node[8] = node[7]; - node[0xb] = node[10]; - node[5] = node[4]; - textsEnd = GHIDRA_CAST(node[0xe]); - text = GHIDRA_CAST(node[0xd]); - if (text != textsEnd) { - do { - (GHIDRA_CAST((text)))->msvc::string::_Tidy_deallocate(); - text = text + 0x18; - } while (text != textsEnd); - text = GHIDRA_CAST(node[0xd]); - } - node[0xe] = text; - node[3] = 5; - } - ExceptionList = local_10; - return node + 2; - } - } - } - local_50 = 5; - pvStack_4c = (void *)0x0; - uStack_48 = 0; - iStack_44 = 0; - tmpShape = Index; - local_20 = 0; - local_40 = (void *)0x0; - uStack_3c = 0; - iStack_38 = 0; - pvStack_34 = (void *)0x0; - local_30 = 0; - iStack_2c = 0; - piStack_28 = GHIDRA_CAST(0x0); - piStack_24 = GHIDRA_CAST(0x0); - local_8 = 0; - iVar1 = *GHIDRA_CAST(this); - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[1])) + 0x1)))) == 0x3ffffff) { - /* WARNING: Subroutine does not return */ - msvc::_Xlength_error("list too long"); - } - local_8 = 1; - local_18 = GHIDRA_CAST(0x0); - local_1c = this; - newNode = operator_new(0x40); - local_18 = newNode; - (GHIDRA_CAST((newNode + 2)))->Shape::Shape(&tmpShape); - tmpTextsEnd = piStack_24; - tmpTextsBegin = piStack_28; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[1])) + 0x1)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[1])) + 0x1)))) + 1; - node = *GHIDRA_CAST((iVar1 + 4)); - *newNode = iVar1; - newNode[1] = GHIDRA_INT(node); - *GHIDRA_CAST((iVar1 + 4)) = newNode; - *node = newNode; - newNode = piStack_28; - if (piStack_28 != GHIDRA_CAST(0x0)) { - for (; newNode != tmpTextsEnd; newNode = newNode + 6) { - uVar2 = newNode[5]; - if (0xf < uVar2) { - pvVar3 = (void *)*newNode; - size = uVar2 + 1; - ptr = pvVar3; - if (0xfff < size) { - ptr = *(void **)(GHIDRA_CAST(pvVar3) + -4); - size = uVar2 + 0x24; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(pvVar3) + (-4 - GHIDRA_INT(ptr))))) goto LAB_0042ed75; - } - operator_delete(ptr,size); - } - newNode[4] = 0; - newNode[5] = 0xf; - *GHIDRA_CAST(newNode) = 0; - } - uVar2 = ((local_20 - GHIDRA_INT(tmpTextsBegin)) / 0x18) * 0x18; - newNode = tmpTextsBegin; - if (0xfff < uVar2) { - newNode = GHIDRA_CAST(tmpTextsBegin[-1]); - uVar2 = uVar2 + 0x23; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST((GHIDRA_INT(tmpTextsBegin) + (-4 - GHIDRA_INT(newNode))))) - goto LAB_0042ed75; - } - operator_delete(newNode,uVar2); - this = self; - } - if (pvStack_34 != (void *)0x0) { - uVar2 = iStack_2c - GHIDRA_INT(pvStack_34) & 0xfffffff8; - pvVar3 = pvStack_34; - if (0xfff < uVar2) { - pvVar3 = *(void **)(GHIDRA_CAST(pvStack_34) + -4); - uVar2 = uVar2 + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(pvStack_34) + (-4 - GHIDRA_INT(pvVar3))))) goto LAB_0042ed75; - } - operator_delete(pvVar3,uVar2); - } - if (local_40 != (void *)0x0) { - uVar2 = ((iStack_38 - GHIDRA_INT(local_40)) / 0x14) * 0x14; - pvVar3 = local_40; - if (0xfff < uVar2) { - pvVar3 = *(void **)(GHIDRA_CAST(local_40) + -4); - uVar2 = uVar2 + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(local_40) + (-4 - GHIDRA_INT(pvVar3))))) goto LAB_0042ed75; - } - operator_delete(pvVar3,uVar2); - } - if (pvStack_4c != (void *)0x0) { - uVar2 = iStack_44 - GHIDRA_INT(pvStack_4c) & 0xfffffffe; - pvVar3 = pvStack_4c; - if (0xfff < uVar2) { - pvVar3 = *(void **)(GHIDRA_CAST(pvStack_4c) + -4); - uVar2 = uVar2 + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(pvStack_4c) + (-4 - GHIDRA_INT(pvVar3))))) { -LAB_0042ed75: - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pvVar3,uVar2); - } - ExceptionList = local_10; - return (void *)(*GHIDRA_CAST((*GHIDRA_CAST(this) + 4)) + 8); -} diff --git a/generated-src/npc_helper.cpp b/generated-src/npc_helper.cpp index c5fb89a..d131dae 100644 --- a/generated-src/npc_helper.cpp +++ b/generated-src/npc_helper.cpp @@ -136,664 +136,3 @@ void NpcHelper::mother_set_collision_class(Entity_NPC *npc, int collisionClass) } return; } - -// 0058ac10 -void NpcHelper::singe_explode_at(Entity_NPC *npc, Vector *position) -{ - int iVar1; - uint64_t qVar2; - uint32_t uVar3; - uint32_t angleRoll; - Entity *minion; - uint64_t *heapCounter; - float fVar4; - EntityList_EL minions; - EntityList_EL nearby; - Vector spawnPos; - float angle; - float angleSin; - ColorMod explosionColor; - uint32_t local_18; - void *local_10; - uint8_t *puStack_c; - float local_8; - uint32_t flagsHigh; - Game *game; - - local_8 = -NAN; - puStack_c = &LAB_00af54e5; - local_10 = ExceptionList; - local_18 = __security_cookie ^ GHIDRA_UINT(((&explosionColor)[1]._colorize + 1)); - ExceptionList = &local_10; - explosionColor._offset[0] = 0.0; - explosionColor._offset[1] = 0.0; - explosionColor._tint[0] = 1.0; - explosionColor._tint[1] = 1.0; - explosionColor._tint[2] = 1.0; - explosionColor._tint[3] = 1.0; - explosionColor._offset[2] = 0.0; - explosionColor._colorize[0] = 0.0; - explosionColor._colorize[1] = 0.0; - explosionColor._colorize[2] = 0.0; - explosionColor._colorize[3] = 0.0; - Game::BombExplosionEffects - (g_game,position,60.0,(BitSet128)ZEXT816(0),&explosionColor,GHIDRA_CAST(npc),1.15,1,4,0); - Game::ButterBeanFart(g_game,position,120.0,GHIDRA_CAST(npc),0,0); - Game::ShakeScreen(g_game,10); - game = g_game; - npc->_projectileCooldown = npc->_projectileCooldown + 1; - EntityList::QueryRadius(GHIDRA_CAST((GHIDRA_INT(game->_room) + 0x1218)),&nearby,position,100.0,8); - local_8 = 0.0; - uVar3 = 0; - if (nearby._size != 0) { - do { - iVar1 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(nearby)) + 0x4))) + uVar3 * 4)); - if ((*GHIDRA_CAST((iVar1 + 0x28)) == 0x393) && (*GHIDRA_CAST((iVar1 + 0x2c)) == 1)) { - npc->_projectileCooldown = 0; - break; - } - uVar3 = uVar3 + 1; - } while (uVar3 < GHIDRA_UINT(nearby._size)); - } - EntityList::QuerySublist(GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),&minions,0x393,1,-1,0,0); - local_8 = (float)CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),1); - if (GHIDRA_UINT(minions._size) < npc->_i1 + 4U) { - uVar3 = Random(); - angleRoll = Random(); - angle = (float)((double)GHIDRA_INT(angleRoll) + __uint_to_double_fixup[-(GHIDRA_INT(angleRoll) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - angle = angle + angle; - angleSin = sin(angle); - fVar4 = cos(angle); - spawnPos.x = fVar4 * 20.0 + (npc->_pos).x; - spawnPos.y = angleSin * 20.0 + (npc->_pos).y; - minion = Game::Spawn(g_game,0x393,1,&spawnPos,&g_vectorZero,GHIDRA_CAST(npc),0,uVar3); - flagsHigh = *GHIDRA_CAST((GHIDRA_INT(&minion->_flags) + 4)); - iVar1 = *GHIDRA_CAST(minion); - *GHIDRA_CAST(&minion->_flags) = GHIDRA_UINT(minion->_flags) & 0xfffffffb; - *GHIDRA_CAST((GHIDRA_INT(&minion->_flags) + 4)) = flagsHigh; - (**(code **)(iVar1 + 0xc))(); - iVar1 = *GHIDRA_CAST(minion); - minion[2]._speedMultiplier = -500.0; - minion[2]._prevVelocity.x = 10.0; - (**(code **)(iVar1 + 0xc))(); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(minions)) + 0x0))) == '\0') { - heapCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - if (g_mainHeap == (void *)0x0) { - heapCounter = &g_allocatedBytesNoHeap; - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(minions)) + 0x4))) != 0) { - uVar3 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(minions)) + 0x4))) + -4)); - qVar2 = *heapCounter; - *GHIDRA_CAST(heapCounter) = GHIDRA_UINT(*heapCounter) - uVar3; - *GHIDRA_CAST((GHIDRA_CAST(heapCounter) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(heapCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar2) < uVar3)); - free((void *)((*GHIDRA_CAST((GHIDRA_CAST(&(minions)) + 0x4))) + -4)); - } - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(nearby)) + 0x0))) == '\0') { - heapCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - if (g_mainHeap == (void *)0x0) { - heapCounter = &g_allocatedBytesNoHeap; - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(nearby)) + 0x4))) != 0) { - uVar3 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(nearby)) + 0x4))) + -4)); - qVar2 = *heapCounter; - *GHIDRA_CAST(heapCounter) = GHIDRA_UINT(*heapCounter) - uVar3; - *GHIDRA_CAST((GHIDRA_CAST(heapCounter) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(heapCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar2) < uVar3)); - free((void *)((*GHIDRA_CAST((GHIDRA_CAST(&(nearby)) + 0x4))) + -4)); - } - } - ExceptionList = local_10; - return; -} - -// 0058e260 -void NpcHelper::siren_charm_familiar(Entity_NPC *npc, Entity_Familiar *familiar) -{ - void *pvVar1; - ANM2 *pAVar2; - Entity_Familiar *pEVar3; - uint32_t seed; - Entity *secondEffect; - uint32_t *refSlot; - Vector local_1c; - Vector local_14; - int *eraseRef [2]; - int temp_5f68b46de4; - - pEVar3 = familiar; - if ((familiar->_flags & 0x100) == 0) { - seed = Random(); - local_14.x = (pEVar3->_velocity).x; - local_14.y = (pEVar3->_velocity).y; - local_1c.x = (pEVar3->_pos).x; - local_1c.y = (pEVar3->_pos).y; - familiar = (Entity_Familiar *) - Game::Spawn(g_game,1000,0xa5,&local_1c,&local_14,GHIDRA_CAST(npc),0,seed); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((familiar)) + 0x45c)))) = 0x4b; - refSlot = &familiar->_parent; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((familiar)) + 0x460)))) = 0x4b; - if (familiar->_parent != 0) { - eraseRef[0] = refSlot; - msvc::multiset::erase(eraseRef); - } - *refSlot = npc; - if (npc != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(refSlot); - } - refSlot = &familiar->_target; - if (*refSlot != 0) { - eraseRef[0] = refSlot; - msvc::multiset::erase(eraseRef); - } - *refSlot = pEVar3; - msvc::multiset::insert(refSlot); - local_14.y = (float)npc->_sirenPlayerEntity; - refSlot = &familiar->_child; - if (*refSlot != 0) { - eraseRef[0] = refSlot; - msvc::multiset::erase(eraseRef); - } - *refSlot = local_14.y; - if ((void *)local_14.y != (void *)0x0) { - msvc::multiset::insert(refSlot); - } - (**(code **)(*GHIDRA_CAST(familiar) + 0xc))(); - seed = Random(); - local_1c.x = (pEVar3->_velocity).x; - local_1c.y = (pEVar3->_velocity).y; - local_14.x = (pEVar3->_pos).x; - local_14.y = (pEVar3->_pos).y; - secondEffect = Game::Spawn(g_game,1000,0xa5,&local_14,&local_1c,GHIDRA_CAST(npc),1,seed); - temp_5f68b46de4 = secondEffect->_parent; - pAVar2 = &secondEffect[1]._sprite; - (pAVar2->_filename)._buf[4] = 'K'; - (pAVar2->_filename)._buf[5] = '\0'; - (pAVar2->_filename)._buf[6] = '\0'; - (pAVar2->_filename)._buf[7] = '\0'; - pAVar2 = &secondEffect[1]._sprite; - (pAVar2->_filename)._buf[8] = 'K'; - (pAVar2->_filename)._buf[9] = '\0'; - (pAVar2->_filename)._buf[10] = '\0'; - (pAVar2->_filename)._buf[0xb] = '\0'; - if (temp_5f68b46de4 != 0) { - familiar = GHIDRA_CAST(&secondEffect->_parent); - msvc::multiset::erase(&familiar); - } - secondEffect->_parent = npc; - msvc::multiset::insert(&secondEffect->_parent); - if (secondEffect->_target != 0) { - familiar = GHIDRA_CAST(&secondEffect->_target); - msvc::multiset::erase(&familiar); - } - secondEffect->_target = pEVar3; - msvc::multiset::insert(&secondEffect->_target); - pvVar1 = npc->_sirenPlayerEntity; - refSlot = &secondEffect->_child; - if (*refSlot != 0) { - familiar = GHIDRA_CAST(refSlot); - msvc::multiset::erase(&familiar); - } - *refSlot = pvVar1; - if (pvVar1 != (void *)0x0) { - msvc::multiset::insert(refSlot); - } - (**(code **)(*GHIDRA_CAST(secondEffect) + 0xc))(); - } - return; -} - -// 0058e490 -void NpcHelper::siren_familiar_counts(int *outFreeCount, int *outCharmedCount, int *outTotalCount) -{ - char isCharmable; - uint32_t uVar1; - int familiarsData; - int extraout_ECX; - uint32_t uVar2; - uint32_t extraout_EDX; - uint64_t *heapAllocatedBytes; - EntityList_EL local_24; - void *local_10; - uint8_t *puStack_c; - uint32_t uStack_8; - int familiar; - Game *game; - uint64_t oldAllocatedBytes; - - game = g_game; - uStack_8 = 0xffffffff; - puStack_c = &LAB_00af1690; - local_10 = ExceptionList; - uVar1 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U; - ExceptionList = &local_10; - *outFreeCount = 0; - *outCharmedCount = 0; - *outTotalCount = 0; - EntityList::QuerySublist(GHIDRA_CAST((GHIDRA_INT(game->_room) + 0x1218)),&local_24,3,-1,-1,0,0); - uVar2 = 0; - if (local_24._size != 0) { - familiarsData = (*GHIDRA_CAST((GHIDRA_CAST(&(local_24)) + 0x4))); - do { - familiar = *GHIDRA_CAST((familiarsData + uVar2 * 4)); - if ((familiar != 0) && (*GHIDRA_CAST((familiar + 0x28)) == 3)) { - isCharmable = FUN_0060dae0(uVar1); - if (isCharmable != '\0') { - if ((*GHIDRA_CAST((extraout_ECX + 0x168)) & 0x100) == 0) { - *outFreeCount = *outFreeCount + 1; - } - else { - *outCharmedCount = *outCharmedCount + 1; - } - *outTotalCount = *outTotalCount + 1; - } - familiarsData = (*GHIDRA_CAST((GHIDRA_CAST(&(local_24)) + 0x4))); - uVar2 = extraout_EDX; - } - uVar2 = uVar2 + 1; - } while (uVar2 < GHIDRA_UINT(local_24._size)); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_24)) + 0x0))) == '\0') { - if (g_mainHeap == (void *)0x0) { - heapAllocatedBytes = &g_allocatedBytesNoHeap; - } - else { - heapAllocatedBytes = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_24)) + 0x4))) != 0) { - uVar2 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_24)) + 0x4))) + -4)); - oldAllocatedBytes = *heapAllocatedBytes; - *GHIDRA_CAST(heapAllocatedBytes) = GHIDRA_UINT(*heapAllocatedBytes) - uVar2; - *GHIDRA_CAST((GHIDRA_CAST(heapAllocatedBytes) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(heapAllocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(oldAllocatedBytes) < uVar2)); - free(GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_24)) + 0x4))) + -4))); - } - } - ExceptionList = local_10; - return; -} - -// 0058e590 -int NpcHelper::siren_charmed_count(Entity_NPC *npc) -{ - uint64_t qVar1; - uint8_t isDetached; - uint64_t *allocatedBytes; - int extraout_ECX; - uint32_t uVar2; - uint32_t extraout_EDX; - int count; - EntityList_EL local_24; - Entity_NPC *siren; - void *local_10; - uint8_t *puStack_c; - uint32_t uStack_8; - Entity_Familiar *familiar; - - uStack_8 = 0xffffffff; - puStack_c = &LAB_00af38e0; - local_10 = ExceptionList; - ExceptionList = &local_10; - count = 0; - siren = npc; - EntityList::QuerySublist(GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),&local_24,3,-1,-1,0,0); - uVar2 = 0; - if (local_24._size != 0) { - do { - familiar = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_24)) + 0x4))) + uVar2 * 4)); - if ((((familiar != GHIDRA_CAST(0x0)) && (familiar->_type == 3)) && - ((familiar->_flags & 0x100) != 0)) && - ((isDetached = Entity_Familiar::is_detached_from_follow(familiar), uVar2 = extraout_EDX, - isDetached != 0 && (*(void **)(extraout_ECX + 0x410) == siren->_sirenPlayerEntity)))) { - count = count + 1; - } - uVar2 = uVar2 + 1; - } while (uVar2 < GHIDRA_UINT(local_24._size)); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_24)) + 0x0))) == '\0') { - if (g_mainHeap == (void *)0x0) { - allocatedBytes = &g_allocatedBytesNoHeap; - } - else { - allocatedBytes = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_24)) + 0x4))) != 0) { - uVar2 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_24)) + 0x4))) + -4)); - qVar1 = *allocatedBytes; - *GHIDRA_CAST(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar2; - *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar1) < uVar2)); - free((void *)((*GHIDRA_CAST((GHIDRA_CAST(&(local_24)) + 0x4))) + -4)); - } - } - ExceptionList = local_10; - return count; -} - -// 0058e680 -void NpcHelper::siren_pick(Entity_NPC *npc) -{ - RNG rng; - uint64_t qVar1; - int charmedCount; - uint32_t uVar2; - int familiar; - float fVar3; - uint32_t outcomeCount; - float fVar4; - uint64_t *heapCounter; - uint32_t *outcomesBegin; - uint32_t *controlledCount; - uint32_t *outcomeCursor; - float roomCenterY; - float rightEdgeStart; - float leftEdgeStart; - uint32_t *controlledTotal; - EntityList_EL local_64; - Entity_NPC *local_54; - uint32_t *picker; - uint32_t *outcomesEnd; - uint32_t *outcomesCapacity; - float local_44; - float local_40; - int local_3c [7]; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - uint32_t local_14; - void *room; - int *weight; - - puStack_20 = GHIDRA_CAST((local_3c + 0xe)); - puStack_18 = &LAB_00af55ad; - local_1c = ExceptionList; - local_3c[6] = __security_cookie ^ GHIDRA_UINT((local_3c + 0xb)); - ExceptionList = &local_1c; - controlledCount = GHIDRA_CAST(0x0); - local_3c[4] = 0xc; - local_3c[0] = 3; - local_3c[1] = 8; - local_3c[2] = 9; - local_3c[3] = 10; - local_3c[5] = 6; - picker = GHIDRA_CAST(0x0); - outcomesEnd = GHIDRA_CAST(0x0); - outcomesCapacity = GHIDRA_CAST(0x0); - local_14 = 0; - local_54 = npc; - siren_familiar_counts(GHIDRA_CAST(&local_40),GHIDRA_CAST(&local_44),&local_64._size); - charmedCount = siren_charmed_count(local_54); - controlledTotal = GHIDRA_CAST(0x0); - EntityList::QuerySublist(GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),&local_64,3,-1,-1,0,0); - fVar4 = 0.0; - outcomesBegin = controlledCount; - outcomeCursor = GHIDRA_CAST(0x0); - if ((float)local_64._size != 0.0) { - do { - familiar = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_64)) + 0x4))) + GHIDRA_INT(fVar4) * 4)); - if ((familiar == 0) || (*GHIDRA_CAST((familiar + 0x28)) != 3)) { - familiar = 0; - } - if (((*GHIDRA_CAST((familiar + 0x168)) & 0x100) != 0) && - (*(void **)(familiar + 0x410) == local_54->_sirenPlayerEntity)) { - controlledCount = GHIDRA_CAST((GHIDRA_INT(controlledCount) + 1)); - } - fVar4 = (float)(GHIDRA_INT(fVar4) + 1); - } while (GHIDRA_UINT(fVar4) < GHIDRA_UINT(local_64._size)); - outcomesBegin = picker; - outcomeCursor = outcomesEnd; - controlledTotal = controlledCount; - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_64)) + 0x0))) == '\0') { - if (g_mainHeap == (void *)0x0) { - heapCounter = &g_allocatedBytesNoHeap; - } - else { - heapCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_64)) + 0x4))) != 0) { - uVar2 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_64)) + 0x4))) + -4)); - qVar1 = *heapCounter; - *GHIDRA_CAST(heapCounter) = GHIDRA_UINT(*heapCounter) - uVar2; - *GHIDRA_CAST((GHIDRA_CAST(heapCounter) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(heapCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar1) < uVar2)); - free(GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_64)) + 0x4))) + -4))); - } - local_14 = local_14 & 0xffffff00; - } - if ((*GHIDRA_CAST((GHIDRA_INT(&(local_54->_v2).x) + 1)) == '\0') && (GHIDRA_INT(controlledTotal) < 2)) { - fVar3 = (float)(GHIDRA_INT(controlledTotal) * -0x21 + 100); - fVar4 = 0.0; - if (0 < GHIDRA_INT(fVar3)) { - fVar4 = fVar3; - } - if (0 < GHIDRA_INT(fVar4)) { - local_64._capacity = 1; - local_64._size = GHIDRA_INT(fVar4); - msvc::vector<8byte>::_Emplace_reallocate(0,&local_64._capacity); - outcomesBegin = picker; - outcomeCursor = outcomesEnd; - } - } - if (((*GHIDRA_CAST((GHIDRA_INT(&(local_54->_v2).x) + 3)) == '\0') && (GHIDRA_INT(local_44) < 6)) && - (0 < GHIDRA_INT(local_40))) { - fVar3 = (float)(GHIDRA_INT(local_40) * 0x21 + GHIDRA_INT(local_44) * -0xf); - fVar4 = 1.4013e-45; - if (1 < GHIDRA_INT(fVar3)) { - fVar4 = fVar3; - } - local_40 = 2.10195e-43; - if (GHIDRA_INT(fVar4) < 0x96) { - local_40 = fVar4; - } - uVar2 = 0; - outcomeCount = GHIDRA_INT(outcomeCursor) - GHIDRA_INT(outcomesBegin) >> 3; - if (outcomeCount != 0) { - do { - if (outcomesBegin[uVar2 * 2] == 3) { - weight = outcomesBegin + uVar2 * 2 + 1; - *weight = *weight + GHIDRA_INT(local_40); - if (*weight < 0) { - outcomesBegin[uVar2 * 2 + 1] = 0; - } - goto LAB_0058e8af; - } - uVar2 = uVar2 + 1; - } while (uVar2 < outcomeCount); - } - if (0 < GHIDRA_INT(local_40)) { - local_64._capacity = 3; - local_64._size = GHIDRA_INT(local_40); - if (outcomeCursor == outcomesCapacity) { - msvc::vector<8byte>::_Emplace_reallocate(outcomeCursor,&local_64._capacity); - outcomesBegin = picker; - outcomeCursor = outcomesEnd; - } - else { - *outcomeCursor = 3; - outcomeCursor[1] = local_40; - outcomesEnd = outcomeCursor + 2; - outcomeCursor = outcomesEnd; - } - } - } -LAB_0058e8af: - if (*GHIDRA_CAST(&(local_54->_v2).y) == '\0') { - fVar4 = 4.62428e-44; - if (0x21 < charmedCount * 0x21) { - fVar4 = (float)(charmedCount * 0x21); - } - local_40 = 1.4013e-43; - if (GHIDRA_INT(fVar4) < 100) { - local_40 = fVar4; - } - outcomeCount = GHIDRA_INT(outcomeCursor) - GHIDRA_INT(outcomesBegin) >> 3; - uVar2 = 0; - if (outcomeCount != 0) { - do { - if (outcomesBegin[uVar2 * 2] == 4) { - weight = outcomesBegin + uVar2 * 2 + 1; - *weight = *weight + GHIDRA_INT(local_40); - if (*weight < 0) { - outcomesBegin[uVar2 * 2 + 1] = 0; - } - goto LAB_0058e94b; - } - uVar2 = uVar2 + 1; - } while (uVar2 < outcomeCount); - } - if (0 < GHIDRA_INT(local_40)) { - local_64._capacity = 4; - local_64._size = GHIDRA_INT(local_40); - if (outcomeCursor == outcomesCapacity) { - msvc::vector<8byte>::_Emplace_reallocate(outcomeCursor,&local_64._capacity); - outcomesBegin = picker; - outcomeCursor = outcomesEnd; - } - else { - *outcomeCursor = 4; - outcomeCursor[1] = local_40; - outcomesEnd = outcomeCursor + 2; - outcomeCursor = outcomesEnd; - } - } - } -LAB_0058e94b: - if ((*GHIDRA_CAST((GHIDRA_INT(&(local_54->_v2).y) + 1)) == '\0') && (local_44 == 0.0)) { - local_64._size = GHIDRA_INT((local_54->_pos).y); - room = g_game->_room; - fVar4 = *GHIDRA_CAST((GHIDRA_CAST(room) + 0x1c)); - fVar3 = *GHIDRA_CAST((GHIDRA_CAST(room) + 0x20)); - rightEdgeStart = fVar4 - 80.0; - local_40 = *GHIDRA_CAST((GHIDRA_CAST(room) + 0x14)); - leftEdgeStart = local_40 + 80.0; - roomCenterY = (fVar3 - *GHIDRA_CAST((GHIDRA_CAST(room) + 0x18))) * 0.5 + *GHIDRA_CAST((GHIDRA_CAST(room) + 0x18)); - local_44 = (local_54->_pos).x; - if (rightEdgeStart == fVar4) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Start and End parameters cannot be the same!")); - } - fVar4 = (local_44 - rightEdgeStart) / (fVar4 - rightEdgeStart); - if (fVar4 <= 0.0) { - fVar4 = 0.0; - } - if (1.0 <= fVar4) { - fVar4 = 1.0; - } - if (leftEdgeStart == local_40) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Start and End parameters cannot be the same!")); - } - local_44 = (local_44 - leftEdgeStart) / (local_40 - leftEdgeStart); - if (local_44 <= 0.0) { - local_44 = 0.0; - } - if (1.0 <= local_44) { - local_44 = 1.0; - } - if (roomCenterY == fVar3) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Start and End parameters cannot be the same!")); - } - outcomeCount = GHIDRA_INT(outcomeCursor) - GHIDRA_INT(outcomesBegin) >> 3; - uVar2 = 0; - fVar3 = ((float)local_64._size - roomCenterY) / (fVar3 - roomCenterY); - if (fVar3 <= 0.0) { - fVar3 = 0.0; - } - if (1.0 <= fVar3) { - fVar3 = 1.0; - } - fVar4 = (float)GHIDRA_INT(((fVar3 + 0.0 + local_44 + 0.0 + fVar4 + 0.0) * 100.0)); - if (outcomeCount != 0) { - do { - if (outcomesBegin[uVar2 * 2] == 5) { - weight = outcomesBegin + uVar2 * 2 + 1; - *weight = *weight + GHIDRA_INT(fVar4); - if (*weight < 0) { - outcomesBegin[uVar2 * 2 + 1] = 0; - } - goto LAB_0058eb5f; - } - uVar2 = uVar2 + 1; - } while (uVar2 < outcomeCount); - } - if (0 < GHIDRA_INT(fVar4)) { - local_64._capacity = 5; - local_64._size = GHIDRA_INT(fVar4); - if (outcomeCursor == outcomesCapacity) { - msvc::vector<8byte>::_Emplace_reallocate(outcomeCursor,&local_64._capacity); - outcomesBegin = picker; - outcomeCursor = outcomesEnd; - } - else { - *outcomeCursor = 5; - outcomeCursor[1] = fVar4; - outcomesEnd = outcomeCursor + 2; - outcomeCursor = outcomesEnd; - } - } -LAB_0058eb5f: - if (outcomesBegin != outcomeCursor) goto LAB_0058ebbb; - } - else if (GHIDRA_INT(local_44) < 1) goto LAB_0058eb5f; - uVar2 = 0; - outcomeCount = GHIDRA_INT(outcomeCursor) - GHIDRA_INT(outcomesBegin) >> 3; - if (outcomeCount != 0) { - do { - if (outcomesBegin[uVar2 * 2] == 0) { - weight = outcomesBegin + uVar2 * 2 + 1; - *weight = *weight + 100; - if (*weight < 0) { - outcomesBegin[uVar2 * 2 + 1] = 0; - } - goto LAB_0058ebbb; - } - uVar2 = uVar2 + 1; - } while (uVar2 < outcomeCount); - } - local_64._size = 100; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_64)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_64)) + 0x4))) & 0xffffffff; - if (outcomeCursor == outcomesCapacity) { - msvc::vector<8byte>::_Emplace_reallocate(outcomeCursor,&local_64._capacity); - } - else { - *outcomeCursor = 0; - outcomeCursor[1] = 100; - outcomesEnd = outcomeCursor + 2; - } -LAB_0058ebbb: - (*GHIDRA_CAST((GHIDRA_CAST(&(local_64)) + 0x0))) = Random(); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_64)) + 0x0))) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_64)) + 0x0))) | 1; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_64)) + 0x4))) = 5; - local_64._capacity = 9; - local_64._size = 7; - rng._shift1 = 5; - rng._seed = (*GHIDRA_CAST((GHIDRA_CAST(&(local_64)) + 0x0))); - rng._shift2 = 9; - rng._shift3 = 7; - uVar2 = WeightedOutcomePicker::PickOutcome(GHIDRA_CAST(&picker),rng); - if (uVar2 == 0) { - *GHIDRA_CAST((GHIDRA_INT(&local_54->_projectileCooldown) + 2)) = 0; - } - else { - charmedCount = local_3c[uVar2]; - *GHIDRA_CAST(&local_54->_projectileCooldown) = 0xffff; - local_54->_state = charmedCount; - } - if (picker != GHIDRA_CAST(0x0)) { - uVar2 = GHIDRA_INT(outcomesCapacity) - GHIDRA_INT(picker) & 0xfffffff8; - outcomesBegin = picker; - if (0xfff < uVar2) { - outcomesBegin = GHIDRA_CAST(picker[-1]); - uVar2 = uVar2 + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(picker) + (-4 - GHIDRA_INT(outcomesBegin))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(outcomesBegin,uVar2); - } - ExceptionList = local_1c; - return; -} diff --git a/generated-src/shape.cpp b/generated-src/shape.cpp deleted file mode 100644 index 229269e..0000000 --- a/generated-src/shape.cpp +++ /dev/null @@ -1,96 +0,0 @@ -#include "classes.h" - -// 0042f850 -Shape::Shape(void *other) -{ - void *nameDst = this; - uint32_t uVar1; - size_t indexBytes; - uint32_t allocBytes; - void *pvVar2; - void *pvVar3; - uint32_t pointsEnd; - void *namesAlloc; - uint32_t extraout_ECX; - char *nameDst; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - uint32_t *namesBegin; - - local_8 = 0xffffffff; - puStack_c = &LAB_00af1ee6; - local_10 = ExceptionList; - uVar1 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U; - ExceptionList = &local_10; - *GHIDRA_CAST(nameDst) = *GHIDRA_CAST(other); - *GHIDRA_CAST((GHIDRA_CAST(nameDst) + 4)) = *GHIDRA_CAST((GHIDRA_CAST(other) + 4)); - *GHIDRA_CAST((GHIDRA_CAST(nameDst) + 8)) = 0; - *GHIDRA_CAST((GHIDRA_CAST(nameDst) + 0xc)) = 0; - *GHIDRA_CAST((GHIDRA_CAST(nameDst) + 0x10)) = 0; - pvVar3 = *(void **)(GHIDRA_CAST(other) + 8); - if (pvVar3 != *(void **)(GHIDRA_CAST(other) + 0xc)) { - indexBytes = GHIDRA_INT(*(void **)(GHIDRA_CAST(other) + 0xc)) - GHIDRA_INT(pvVar3); - allocBytes = GHIDRA_INT(indexBytes) >> 1; - if (0x7fffffff < allocBytes) { - /* WARNING: Subroutine does not return */ - FUN_0040cee0(uVar1); - } - allocBytes = allocBytes * 2; - pvVar2 = msvc::_Allocate(allocBytes); - *(void **)(GHIDRA_CAST(nameDst) + 8) = pvVar2; - *(void **)(GHIDRA_CAST(nameDst) + 0xc) = pvVar2; - *(void **)(GHIDRA_CAST(nameDst) + 0x10) = (void *)(GHIDRA_INT(pvVar2) + allocBytes); - pvVar2 = *(void **)(GHIDRA_CAST(nameDst) + 8); - memmove(pvVar2,pvVar3,indexBytes); - *(void **)(GHIDRA_CAST(nameDst) + 0xc) = (void *)(allocBytes + GHIDRA_INT(pvVar2)); - } - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))) = 0; - *GHIDRA_CAST((GHIDRA_CAST(nameDst) + 0x14)) = 0; - *GHIDRA_CAST((GHIDRA_CAST(nameDst) + 0x18)) = 0; - *GHIDRA_CAST((GHIDRA_CAST(nameDst) + 0x1c)) = 0; - if (*GHIDRA_CAST((GHIDRA_CAST(other) + 0x14)) != *GHIDRA_CAST((GHIDRA_CAST(other) + 0x18))) { - allocBytes = (*GHIDRA_CAST((GHIDRA_CAST(other) + 0x18)) - *GHIDRA_CAST((GHIDRA_CAST(other) + 0x14))) / 0x14; - if (0xccccccc < allocBytes) goto LAB_0042fa29; - allocBytes = allocBytes * 0x14; - pvVar3 = msvc::_Allocate(allocBytes); - *(void **)(GHIDRA_CAST(nameDst) + 0x14) = pvVar3; - *(void **)(GHIDRA_CAST(nameDst) + 0x18) = pvVar3; - *(void **)(GHIDRA_CAST(nameDst) + 0x1c) = (void *)(GHIDRA_INT(pvVar3) + allocBytes); - pointsEnd = FUN_0042f800(*GHIDRA_CAST((GHIDRA_CAST(nameDst) + 0x14)),extraout_ECX); - *GHIDRA_CAST((GHIDRA_CAST(nameDst) + 0x18)) = pointsEnd; - } - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 1; - FUN_0042f1a0(GHIDRA_INT(other) + 0x20); - namesBegin = GHIDRA_CAST((GHIDRA_INT(nameDst) + 0x2c)); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 2; - *namesBegin = 0; - *GHIDRA_CAST((GHIDRA_CAST(nameDst) + 0x30)) = 0; - *GHIDRA_CAST((GHIDRA_CAST(nameDst) + 0x34)) = 0; - pvVar3 = *(void **)(GHIDRA_CAST(other) + 0x2c); - pvVar2 = *(void **)(GHIDRA_CAST(other) + 0x30); - if (pvVar3 != pvVar2) { - allocBytes = (GHIDRA_INT(pvVar2) - GHIDRA_INT(pvVar3)) / 0x18; - if (0xaaaaaaa < allocBytes) { -LAB_0042fa29: - /* WARNING: Subroutine does not return */ - FUN_0040cee0(uVar1); - } - allocBytes = allocBytes * 0x18; - namesAlloc = msvc::_Allocate(allocBytes); - *namesBegin = namesAlloc; - *(void **)(GHIDRA_CAST(nameDst) + 0x30) = namesAlloc; - *(void **)(GHIDRA_CAST(nameDst) + 0x34) = (void *)(GHIDRA_INT(namesAlloc) + allocBytes); - nameDst = GHIDRA_CAST(*namesBegin); - local_8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),4); - do { - (GHIDRA_CAST((nameDst)))->msvc::string::string(pvVar3); - nameDst = nameDst + 0x18; - pvVar3 = (void *)(GHIDRA_INT(pvVar3) + 0x18); - } while (pvVar3 != pvVar2); - *GHIDRA_CAST((GHIDRA_CAST(nameDst) + 0x30)) = nameDst; - } - ExceptionList = local_10; - return nameDst; -} diff --git a/generated-src/stubs.cpp b/generated-src/stubs.cpp index 78e7015..b0c51ed 100644 --- a/generated-src/stubs.cpp +++ b/generated-src/stubs.cpp @@ -8250,8 +8250,6 @@ void CommandThread::post_command(void *command) { generated_stub("CommandThread: DamageInfo::DamageInfo() { generated_stub("DamageInfo::DamageInfo 006a8190"); } void DateTime::set_from_yyyymmdd(void *dateTime, int yyyymmdd) { generated_stub("DateTime::set_from_yyyymmdd 0085af30"); } void DateTime::constructor(uint8_t isNow) { generated_stub("DateTime::constructor 00a24270"); } -void DebugRenderer::Render() { generated_stub("DebugRenderer::Render 0042dbb0"); } -void * DebugRenderer::Get(int Index, uint8_t Unk) { generated_stub("DebugRenderer::Get 0042eb10"); } Vector * Vector::operator_mul(Vector *outResult, float *scalar, Vector *vector) { generated_stub("Vector::operator_mul 004171d0"); } Vector * Vector::ToCardinal(Vector *outResult, Vector *vec) { generated_stub("Vector::ToCardinal 0067f170"); } Vector * Vector::mul_065(Vector *outResult, Vector *source) { generated_stub("Vector::mul_065 0067f2b0"); } @@ -9130,11 +9128,6 @@ void NetworkManager::receive_packet(uint64_t *sender, void *buffer, int size) { void * NetworkManager::get_peer(void *outPeer, uint64_t *userId) { generated_stub("NetworkManager::get_peer 00a790b0"); } int * NpcHelper::chub_nearest_segment(int *param_1, int param_2) { generated_stub("NpcHelper::chub_nearest_segment 00499a50"); } void NpcHelper::mother_set_collision_class(Entity_NPC *npc, int collisionClass) { generated_stub("NpcHelper::mother_set_collision_class 005688c0"); } -void NpcHelper::singe_explode_at(Entity_NPC *npc, Vector *position) { generated_stub("NpcHelper::singe_explode_at 0058ac10"); } -void NpcHelper::siren_charm_familiar(Entity_NPC *npc, Entity_Familiar *familiar) { generated_stub("NpcHelper::siren_charm_familiar 0058e260"); } -void NpcHelper::siren_familiar_counts(int *outFreeCount, int *outCharmedCount, int *outTotalCount) { generated_stub("NpcHelper::siren_familiar_counts 0058e490"); } -int NpcHelper::siren_charmed_count(Entity_NPC *npc) { generated_stub("NpcHelper::siren_charmed_count 0058e590"); } -void NpcHelper::siren_pick(Entity_NPC *npc) { generated_stub("NpcHelper::siren_pick 0058e680"); } void OnlineChat::render(Vector *position, uint8_t isInputLine, uint8_t isCursorVisible, float alpha) { generated_stub("OnlineChat::render 0091d2b0"); } void OnlineChat::destructor() { generated_stub("OnlineChat::destructor 0091db20"); } void OnlineChat::render_all(Vector *pos, uint8_t isFocused) { generated_stub("OnlineChat::render_all 0091e650"); } @@ -9158,7 +9151,6 @@ void ReferenceCountBase::vfunc_5() { generated_stub("ReferenceCountBase::vfunc_5 ReferenceCountBase::ReferenceCountBase() { generated_stub("ReferenceCountBase::ReferenceCountBase 0040cc10"); } void * SaveDataManager::open_file_read(uint8_t *fileName) { generated_stub("SaveDataManager::open_file_read 00a24fd0"); } void * SaveDataManager::open_file_write(uint8_t *path, int mode) { generated_stub("SaveDataManager::open_file_write 00a25090"); } -Shape::Shape(void *other) { generated_stub("Shape::Shape 0042f850"); } void SharedPtr::assign(void *other) { generated_stub("SharedPtr::assign 004d74a0"); } void SharedPtrPair::constructor() { generated_stub("SharedPtrPair::constructor 00424c40"); } SharedPtrPair::~SharedPtrPair() { generated_stub("SharedPtrPair::~SharedPtrPair 00424cd0"); } @@ -9527,7 +9519,6 @@ ItemConfig * Isaac::GetItemConfig() { generated_stub("Isaac::GetItemConfig 0042c int FUN_0042d040() { generated_stub("FUN_0042d040 0042d040"); } void FUN_0042edb0() { generated_stub("FUN_0042edb0 0042edb0"); } void FUN_0042ede0(uint32_t *param_1) { generated_stub("FUN_0042ede0 0042ede0"); } -void push_shape_points(void *self, Capsule *capsule) { generated_stub("push_shape_points 0042eef0"); } void FUN_0042f050(uint32_t param_1) { generated_stub("FUN_0042f050 0042f050"); } void FUN_0042f060() { generated_stub("FUN_0042f060 0042f060"); } void FUN_0042f0c0() { generated_stub("FUN_0042f0c0 0042f0c0"); } @@ -9694,8 +9685,6 @@ void set_byte_0x101(void *self, uint8_t value) { generated_stub("set_byte_0x101 int FUN_00505ca0() { generated_stub("FUN_00505ca0 00505ca0"); } uint32_t * FUN_00505ce0() { generated_stub("FUN_00505ce0 00505ce0"); } void npc_distribute_orbit_angles(Entity_NPC *npc) { generated_stub("npc_distribute_orbit_angles 00547040"); } -int FUN_0054d1b0(int param_1) { generated_stub("FUN_0054d1b0 0054d1b0"); } -void NpcAI::ENTITY_BUTT_SLICKER(Entity_NPC *npc) { generated_stub("NpcAI::ENTITY_BUTT_SLICKER 0054d250"); } void FUN_00557b50(uint32_t param_1) { generated_stub("FUN_00557b50 00557b50"); } void FUN_00557b70(uint8_t *param_1) { generated_stub("FUN_00557b70 00557b70"); } bool FUN_00557bb0(int *param_1) { generated_stub("FUN_00557bb0 00557bb0"); } @@ -9709,13 +9698,8 @@ uint32_t * FUN_00575fe0(int *param_1, uint32_t param_2, uint32_t param_3, uint32 void FUN_00579700() { generated_stub("FUN_00579700 00579700"); } uint32_t FUN_00579760() { generated_stub("FUN_00579760 00579760"); } uint32_t FUN_0058ab60() { generated_stub("FUN_0058ab60 0058ab60"); } -void NpcAI::ENTITY_SINGE_body(Entity_NPC *npc) { generated_stub("NpcAI::ENTITY_SINGE_body 0058aed0"); } uint8_t FUN_0058e210() { generated_stub("FUN_0058e210 0058e210"); } void FUN_0058e240(uint32_t param_1) { generated_stub("FUN_0058e240 0058e240"); } -void NpcAI::ENTITY_SIREN_main(Entity_NPC *npc) { generated_stub("NpcAI::ENTITY_SIREN_main 0058ec70"); } -void NpcAI::siren_release_stolen_items(Entity_NPC *npc) { generated_stub("NpcAI::siren_release_stolen_items 005911b0"); } -void NpcAI::ENTITY_SIREN(Entity_NPC *npc) { generated_stub("NpcAI::ENTITY_SIREN 00591460"); } -void NpcAI::ENTITY_SIREN_HELPER(Entity_NPC *npc) { generated_stub("NpcAI::ENTITY_SIREN_HELPER 00591cc0"); } uint32_t * FUN_00598290(uint32_t *param_1, uint32_t *param_2) { generated_stub("FUN_00598290 00598290"); } void FUN_005a6fb0() { generated_stub("FUN_005a6fb0 005a6fb0"); } uint8_t * FUN_005aaf60(uint8_t *param_1) { generated_stub("FUN_005aaf60 005aaf60"); } @@ -9751,9 +9735,6 @@ void FUN_005c7bf0(int *param_1, int *param_2) { generated_stub("FUN_005c7bf0 005 void FUN_005c7d30(int param_1) { generated_stub("FUN_005c7d30 005c7d30"); } void FUN_005c7e30(int param_1) { generated_stub("FUN_005c7e30 005c7e30"); } void FUN_005c7ef0(int param_1) { generated_stub("FUN_005c7ef0 005c7ef0"); } -void FUN_005c7f20(int param_1) { generated_stub("FUN_005c7f20 005c7f20"); } -void everything_jar_crack_the_sky_timer(int param_1) { generated_stub("everything_jar_crack_the_sky_timer 005c8020"); } -void everything_jar_shopkeeper_rain_timer(int param_1) { generated_stub("everything_jar_shopkeeper_rain_timer 005c83f0"); } void FUN_005ca566(uint32_t param_1, uint32_t param_2, int param_3) { generated_stub("FUN_005ca566 005ca566"); } void FUN_005ca880() { generated_stub("FUN_005ca880 005ca880"); } void FUN_005cba20() { generated_stub("FUN_005cba20 005cba20"); } @@ -10117,7 +10098,6 @@ void FUN_006daab0() { generated_stub("FUN_006daab0 006daab0"); } void FUN_006dac00(uint32_t *param_1, uint32_t param_2) { generated_stub("FUN_006dac00 006dac00"); } float log_precise(float value) { generated_stub("log_precise 006dac30"); } void FUN_006daca0(uint32_t param_1) { generated_stub("FUN_006daca0 006daca0"); } -uint32_t FUN_006e1910(uint32_t param_1) { generated_stub("FUN_006e1910 006e1910"); } void FUN_006ee330() { generated_stub("FUN_006ee330 006ee330"); } Vector * Isaac::GetRandomPickupVelocity(Vector *outVelocity, Vector *position, uint32_t pickupVelType, RNG *rng) { generated_stub("Isaac::GetRandomPickupVelocity 006ee440"); } int FUN_006ee640(int param_1, int param_2, uint32_t *param_3, uint32_t param_4) { generated_stub("FUN_006ee640 006ee640"); } @@ -10310,7 +10290,6 @@ void FUN_00757980(uint32_t *param_1) { generated_stub("FUN_00757980 00757980"); void FUN_00757a10() { generated_stub("FUN_00757a10 00757a10"); } uint32_t FUN_00758590() { generated_stub("FUN_00758590 00758590"); } int FUN_00759260() { generated_stub("FUN_00759260 00759260"); } -void FUN_00770640(float *param_1) { generated_stub("FUN_00770640 00770640"); } void FUN_007792f0(uint32_t param_1, uint32_t param_2) { generated_stub("FUN_007792f0 007792f0"); } uint32_t FUN_007826c0() { generated_stub("FUN_007826c0 007826c0"); } void FUN_0078b330(uint32_t *param_1) { generated_stub("FUN_0078b330 0078b330"); } @@ -10322,8 +10301,6 @@ void FUN_007b8c00(int param_1) { generated_stub("FUN_007b8c00 007b8c00"); } void FUN_007c2e80() { generated_stub("FUN_007c2e80 007c2e80"); } void FUN_007cb4f0() { generated_stub("FUN_007cb4f0 007cb4f0"); } void FUN_007cf940() { generated_stub("FUN_007cf940 007cf940"); } -long double FUN_007cf9a0(float *param_1, KColor *param_2, uint32_t param_3) { generated_stub("FUN_007cf9a0 007cf9a0"); } -uint8_t * FUN_007cfa90() { generated_stub("FUN_007cfa90 007cfa90"); } void FUN_007d3330(int param_1) { generated_stub("FUN_007d3330 007d3330"); } void FUN_007d9360() { generated_stub("FUN_007d9360 007d9360"); } uint32_t FUN_007d9ca0() { generated_stub("FUN_007d9ca0 007d9ca0"); } diff --git a/src/active_items.h b/src/active_items.h index 5829013..2331b21 100644 --- a/src/active_items.h +++ b/src/active_items.h @@ -108,7 +108,6 @@ struct ActiveGain void sound_play_local(Entity_Player& player, int sound); void use_animate(ItemUse& use); -void use_raise(ItemUse& use); void sound_raise_use(ItemUse& use, int sound); EntityList_EL& room_entities(); bool is_item_target(Entity* entity, Entity_Player& player); @@ -118,7 +117,6 @@ void repentance_item_effect_run(ItemUse& use); void afterbirth_item_effect_run(ItemUse& use); void d12_use(ItemUse& use); void deeper_use(ItemUse& use); -void active_missing_report(ItemUse& use); bool input_is_action_pressed(ButtonAction action, int controllerIndex, Entity* entity); bool input_is_action_triggered(ButtonAction action, int controllerIndex, Entity* entity); diff --git a/src/bomb_explosion.cpp b/src/bomb_explosion.cpp index ee3d1ae..8f4bb3f 100644 --- a/src/bomb_explosion.cpp +++ b/src/bomb_explosion.cpp @@ -157,7 +157,6 @@ 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}}; constexpr int GIGA_RINGS = 2; constexpr int GIGA_CHIPS = 5; -constexpr int GIGA_CHIP_SUBTYPE = 0x20000; constexpr float GIGA_CHIP_SPREAD = 60; constexpr float GIGA_CHIP_SPEED_MIN = 6; constexpr float GIGA_CHIP_SPEED_RANGE = 6; diff --git a/src/boss_beast_horsemen.cpp b/src/boss_beast_horsemen.cpp index c6b0bd5..00b3094 100644 --- a/src/boss_beast_horsemen.cpp +++ b/src/boss_beast_horsemen.cpp @@ -3308,7 +3308,7 @@ static void ultra_death_swing_hit(Entity_NPC& npc) Capsule blade; npc.GetNullCapsule(blade, "Hit"); if (blade.radius <= 0) return; - if (g_game->debugFlags & DEBUG_HITSPHERES) reconstruction_missing("Entity::GetDebugShape 006b5f10, Ultra Death's swing"); + debug_capsule_show(npc, blade); for (Entity* entity : entity_query_radius(blade.center, blade.halfLength + blade.radius, QUERY_ALL)) { if (entity->entityCollisionClass == ENTCOLL_NONE || entity->entityGridCollisionClass == GRIDCOLL_BULLET || entity == &npc) diff --git a/src/boss_big_horn.cpp b/src/boss_big_horn.cpp index 8adb5f8..4e8050f 100644 --- a/src/boss_big_horn.cpp +++ b/src/boss_big_horn.cpp @@ -764,6 +764,8 @@ static void hand_slam(Entity_NPC& npc) Capsule slam; npc.GetNullCapsule(slam, "Slam"); if (slam.radius > 0) + { + debug_capsule_show(npc, slam); for (Entity* other : entity_query_radius(slam.center, slam.halfLength + slam.radius, QUERY_ALL)) { if (other->entityCollisionClass == ENTCOLL_NONE || other->entityGridCollisionClass == GRIDCOLL_BULLET || @@ -776,6 +778,7 @@ static void hand_slam(Entity_NPC& npc) float damage = other->is_player() || other->IsFamiliar() ? HORN_HAND_DAMAGE : SLAP_DAMAGE; other->TakeDamage(damage, 0, EntityRef(&npc), SLAP_COUNTDOWN); } + } npc.MakeGroundPoof(slam.center, SLAP_POOF_COLOR, SLAP_POOF_SIZE); water_drops_spawn(slam.center, vector_make(SLAP_DROPS_X, SLAP_DROPS_Y), 1); game_shake_screen(SLAP_SHAKE); diff --git a/src/boss_bumbino.cpp b/src/boss_bumbino.cpp index b2f8a8b..c2da70b 100644 --- a/src/boss_bumbino.cpp +++ b/src/boss_bumbino.cpp @@ -360,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 DebugRenderer is taken over. + debug_capsule_show(npc, hitbox); for (Entity* other : entity_query_radius(hitbox.center, hitbox.halfLength + hitbox.radius, QUERY_ALL)) { diff --git a/src/boss_death.cpp b/src/boss_death.cpp index 29688f8..e62ef4b 100644 --- a/src/boss_death.cpp +++ b/src/boss_death.cpp @@ -57,7 +57,6 @@ constexpr std::array HORNFEL_ITEMS = {256, 220, 19, 137, 646}; constexpr int ACHIEVEMENT_A_QUARTER = 10; constexpr int ACHIEVEMENT_LOKIS_HORNS = 15; constexpr int ACHIEVEMENT_BOOK_OF_SIN = 22; -constexpr int ACHIEVEMENT_EVERYTHING_TERRIBLE = 33; constexpr int ACHIEVEMENT_LEFT_HAND = 77; constexpr int ACHIEVEMENT_CELLAR = 86; constexpr int ACHIEVEMENT_CATACOMBS = 87; @@ -300,7 +299,7 @@ static void boss_hearts_drop(Room& room, Entity_NPC& boss, RNG& rng) PersistentGameData& save = g_manager->persistentGameData; RNG heartRng = rng_make(HEART_RNG_SHIFTS, rng.Next()); RNG directionRng = rng_make(HEART_DIRECTION_SHIFTS, boss.initSeed); - bool isTerrible = save.Unlocked(ACHIEVEMENT_EVERYTHING_TERRIBLE); + bool isTerrible = save.Unlocked(ACHIEVEMENT_EVERYTHING_IS_TERRIBLE); int hearts = isTerrible ? 1 : 2; if (room.roomType == ROOM_BOSSRUSH) hearts = isTerrible ? 1 - (int)heartRng.RandomInt(2) : 1; diff --git a/src/boss_mom.cpp b/src/boss_mom.cpp index 3b5e9e2..54e0968 100644 --- a/src/boss_mom.cpp +++ b/src/boss_mom.cpp @@ -122,7 +122,6 @@ constexpr std::array, 6> MOM_SUMMONS_MAUSOLEUM = { {{18, 0}, {61, 0}, {248, 0}, {886, 1}, {246, 1}, {24, 3}}}; constexpr std::pair CURSED_GLOBIN = {24, 3}; constexpr int CURSED_GLOBINS_MAX = 2; -constexpr int ENTITY_ATTACK_FLY = 18; // DamageRadius hurts with a 30 frame countdown, and passes 3.5 to the tear effects. Enemies are types 10 to 999. constexpr int RADIUS_DAMAGE_COUNTDOWN = 30; @@ -513,7 +512,7 @@ static void part_summon(Entity_NPC& npc) summon = MOM_SUMMONS_MAUSOLEUM[Random() % MOM_SUMMONS_MAUSOLEUM.size()]; bool isCrowded = summon == CURSED_GLOBIN && entity_query(CURSED_GLOBIN.first, CURSED_GLOBIN.second).size() >= CURSED_GLOBINS_MAX; - if (isCrowded) summon = {ENTITY_ATTACK_FLY, 0}; + if (isCrowded) summon = {ENTITY_ATTACKFLY, 0}; } else if (npc.subtype == MOM_BLUE) summon = MOM_SUMMONS_BLUE[Random() % MOM_SUMMONS_BLUE.size()]; else summon = MOM_SUMMONS[Random() % MOM_SUMMONS.size()]; diff --git a/src/boss_monstro.cpp b/src/boss_monstro.cpp index 5df9c0a..b21e1ef 100644 --- a/src/boss_monstro.cpp +++ b/src/boss_monstro.cpp @@ -92,8 +92,6 @@ constexpr int CLOT_LIMIT = 2; constexpr float CLOT_SPEED = 5; constexpr float CLOT_HEALTH_CUT = 5; constexpr float CLOT_PAIR_VOLUME = 1.5f; -constexpr ColorMod GISH_SHOT_COLOR = {{1, 1, 1, 1}, {0.5f, 0.5f, 0.5f, 1}, {0, 0, 0}}; -constexpr ColorMod GISH_SPLAT_COLOR = tint_color_make(0.02f, 0.05f, 0.05f, 1); constexpr ColorMod GISH_POOF_COLOR = {{3, 3, 3, 1}, {0.03f, 0.03f, 0.03f, 1}, {0, 0, 0}}; // A player's Monstro: input past half a push is kept as its heading (v1) and aim (v2), it hops toward a spot 250 along diff --git a/src/boss_mother.cpp b/src/boss_mother.cpp index e849f29..a5abe09 100644 --- a/src/boss_mother.cpp +++ b/src/boss_mother.cpp @@ -950,6 +950,7 @@ static void mother_scrape_update(Entity_NPC& npc) hand.center = vector_add(hand.center, npc.posOffset); hand.end = vector_add(hand.end, npc.posOffset); hand.start = vector_add(hand.start, npc.posOffset); + debug_capsule_show(npc, hand); for (Entity* other : entity_query_radius(hand.center, hand.halfLength + hand.radius, QUERY_ALL)) { if (other == &npc || other->entityCollisionClass == ENTCOLL_NONE || diff --git a/src/boss_repentance.h b/src/boss_repentance.h index 27d7097..18ce338 100644 --- a/src/boss_repentance.h +++ b/src/boss_repentance.h @@ -77,6 +77,11 @@ 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); +void singe_body_update(Entity_NPC& npc); + +// The Siren, her remains and her charm carrier, and the helper that keeps a familiar charmed (boss_siren.cpp). +void boss_siren_update(Entity_NPC& npc); +void siren_helper_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. diff --git a/src/boss_singe.cpp b/src/boss_singe.cpp index e4d2cb1..c80b44b 100644 --- a/src/boss_singe.cpp +++ b/src/boss_singe.cpp @@ -4,8 +4,17 @@ #include "grid_entity.h" #include "player_manager.h" #include "room_grid.h" +#include "entity_bomb.h" +#include "entity_projectile.h" +#include "npc_ai.h" +#include "npc_basement.h" +#include "path_finder.h" +#include "room.h" +#include "sfx_manager.h" #include +#include #include +#include // Singe's ball rolls about untouchable, bounced by blasts. Its roll frame stands for its turn (v1.x, 0 to 1), its // height (v2.y) and fall (v1.y) lift it, and i1 tells a sideways roll from an up-and-down one. @@ -186,3 +195,729 @@ void singe_ball_update(Entity_NPC& npc) int frame = (int)((float)data->length * npc.v1.x); if (frame != (int)std::floor(npc.sprite.animState.animFrame)) npc.sprite.animState.SetFrameFloat((float)frame); } + +// Singe walks and idles (stateFrame counts the wait down below 0, the walk up above 0) while his attack wait (v1.x, +// 1 to 4) runs out a 30th a frame, the damage he takes shortening it. Then he farts smoke, superfarts at a far target, +// or runs to blast a ball at his target (or jump at it). At two thirds and one third of his health (i1 counts them) +// he super blasts once the floor around him can take a crater, or within 89 frames. +constexpr float SINGE_PHASES = 3; +constexpr int SINGE_PHASE_LAST = 2; +constexpr int SINGE_CRATER_WAIT = 89; +constexpr float SINGE_CRATER_STEP = 40; +constexpr int SINGE_IDLE_FIRST = -15; +constexpr uint32_t SINGE_IDLE_RANGE = 15; +constexpr uint32_t SINGE_WALK_RANGE = 60; +constexpr int SINGE_WALK_MIN = 30; +constexpr float SINGE_WAIT_MIN = 1; +constexpr float SINGE_WAIT_RANGE = 3; +constexpr float SINGE_WAIT_STEP = 0.0333f; +constexpr float SINGE_WALK_SPEED = 0.8f; +constexpr int SINGE_PATH_MARKER = 900; +constexpr float SINGE_FLIP_SPEED = 1; +constexpr float SINGE_WALK_FRICTION = 0.8f; +constexpr float SINGE_ATTACK_FRICTION = 0.6f; +constexpr float SINGE_HURT_WAIT = 0.5f; + +// Picking an attack: under 5 smoke clouds a superfart one time in 20 (4 in his last phase) if the target is over 160 +// away across, else under 8 clouds a fart one time in 3 unless a cloud sits 120 to his side, else the run. +constexpr size_t SINGE_SUPERFART_CLOUDS = 5; +constexpr int SINGE_SUPERFART_ODDS = 20; +constexpr int SINGE_SUPERFART_LAST_ODDS = 4; +constexpr float SINGE_SUPERFART_REACH = 160; +constexpr size_t SINGE_FART_CLOUDS = 8; +constexpr uint32_t SINGE_FART_ODDS = 3; +constexpr float SINGE_FART_SIDE = 120; +constexpr float SINGE_CLOUD_NEAR_SQUARED = 100; +constexpr int SINGE_RUN_FRAMES = 90; + +// The run: he scores each ball he can reach by where he must stand to blast it toward where the target will be (40% +// of the way's length ahead): 50 behind it, beside it for 100 more when he must come around, or ahead of it for 500 +// more. A rolling ball (over 4) costs 500 more and the one he chose before half. Past 40 frames of running the balls +// cost up to 50 times as much, unless 2 explosions ago a ball was close (projectileCooldown). The target itself costs +// twice its distance, if he can reach it. +constexpr float SINGE_NO_COST = 9999; +constexpr float SINGE_LEAD_SHARE = 0.4f; +constexpr float SINGE_KICK_REACH = 50; +constexpr float SINGE_DETOUR_COST = 100; +constexpr float SINGE_AHEAD_COST = 500; +constexpr float SINGE_ROLLING_SPEED = 4; +constexpr float SINGE_ROLLING_COST = 500; +constexpr float SINGE_CHOSEN_SHARE = 0.5f; +constexpr int SINGE_BALL_COOLDOWN = 2; +constexpr float SINGE_TIRE_START = 40; +constexpr float SINGE_TIRE_SPAN = 50; +constexpr float SINGE_TIRE_MAX = 49; +constexpr float SINGE_DIAGONAL_SHARE = 0.75f; +constexpr int SINGE_RUN_MIN = 40; +constexpr int SINGE_RUN_CLOSE = 60; +constexpr float SINGE_BLAST_TRIGGER = 4; +constexpr float SINGE_JUMP_TRIGGER = 50; +constexpr float SINGE_RUN_SPEED = 2.1f; +constexpr float SINGE_CLOSE_SPEED = 1.4f; +constexpr float SINGE_CLOSE_SPEED_RANGE = 0.6999999f; +constexpr float SINGE_CLOSE_FAR = 100; +constexpr float SINGE_CLOSE_NEAR = 40; +constexpr float SINGE_CLOSE_SPAN = 60; +constexpr float SINGE_JUMP_LEAD = 0.1f; +constexpr float SINGE_JUMP_SPEED = 10; +constexpr float SINGE_BLAST_SNAP_SQUARED = 5; + +// His explosions: 60 strong (1.15 times the reach) with a 120 fart, a shake of 10 and a new ball 20 off while fewer +// than 4 (and one a phase) roll. projectileCooldown counts explosions without a ball within 100. +constexpr float SINGE_EXPLOSION_DAMAGE = 60; +constexpr float SINGE_EXPLOSION_SCALE = 1.15f; +constexpr float SINGE_FART_RADIUS = 120; +constexpr int SINGE_EXPLOSION_SHAKE = 10; +constexpr float SINGE_BALL_NEAR = 100; +constexpr uint32_t SINGE_BALL_MIN = 4; +constexpr float SINGE_BALL_GAP = 20; +constexpr float SINGE_BALL_DROP_HEIGHT = -500; +constexpr float SINGE_BALL_DROP_FALL = 10; + +// The fart: two smoke clouds at 10 to 20 up to 20 degrees off his facing, 10 to his side (pushing what is 40 there +// away at 10), then a dust puff a frame at 6 to 26, 1 to 2.5 times its size, until he lands. +constexpr int SINGE_FART_CLOUD_COUNT = 2; +constexpr int SINGE_FART_CLOUD_SUBTYPE = 1; +constexpr float SINGE_FART_SPREAD = 40; +constexpr float SINGE_FART_CLOUD_SPEED = 10; +constexpr float SINGE_FART_PUSH = 10; +constexpr float SINGE_FART_PUSH_REACH = 40; +constexpr float SINGE_FART_PUSH_RADIUS = 60; +constexpr float SINGE_PUFF_OFFSET = 4; +constexpr float SINGE_PUFF_SPEED = 6; +constexpr float SINGE_PUFF_SPEED_RANGE = 20; +constexpr float SINGE_PUFF_SCALE_RANGE = 1.5f; +constexpr int SINGE_PUFF_SUBTYPE = 1; +constexpr ColorMod SINGE_PUFF_COLOR = tint_color_make(0.4f, 0.42f, 0.25f, 1); + +// The superfart: a 120 frame flame turning 2.5 degrees a frame toward the target (65 off level facing right, at +// least 115 off it facing left), every other frame two times in three a fire shot 4 out at 8 to 10, swaying 10 +// degrees and scattered 8 either way, pushing him back at 2. +constexpr int SINGE_SUPERFART_FRAMES = 120; +constexpr int SINGE_MEGA_FART_DELAY = 150; +constexpr float SINGE_FLAME_TURN = 2.5f; +constexpr float SINGE_FLAME_RIGHT_LIMIT = 65; +constexpr float SINGE_FLAME_LEFT_LIMIT = 115; +constexpr uint32_t SINGE_FLAME_ODDS = 3; +constexpr float SINGE_FLAME_FALL_ACCEL = -0.05f; +constexpr int SINGE_FLAME_SWAY_START = 90; +constexpr float SINGE_FLAME_SWAY_RATE = 0.1f; +constexpr float SINGE_FLAME_SWAY = 10; +constexpr float SINGE_FLAME_SCATTER = 8; +constexpr float SINGE_FLAME_SPEED = 8; +constexpr float SINGE_FLAME_SPEED_RANGE = 2; +constexpr float SINGE_FLAME_OFFSET = 4; +constexpr int SINGE_FLAME_SHAKE = 2; +constexpr float SINGE_FLAME_RECOIL = 2; + +// The super blast: 100 strong (1.25 the reach) with a shake of 16 and a pit he falls out of; 15 frames before he +// lands he comes down on free floor near the target (90 away, ten tries) with a ball 15 off. The crater widens a +// ring of pits a second frame. Smoke rises from the SmokeGuide null while it shows: one cloud plus one per 100 of +// its scale's area, 3 times its scale out, rising at 3 to 8 for 30 to 39 frames. +constexpr float SINGE_SUPER_DAMAGE = 100; +constexpr float SINGE_SUPER_REACH_SCALE = 1.25f; +constexpr int SINGE_SUPER_SHAKE = 16; +constexpr uint32_t SINGE_CRATER_DELAY = 2; +constexpr uint32_t SINGE_CRATER_TIMES = 1; +constexpr int SINGE_SUPER_AIR_FRAMES = 59; +constexpr int SINGE_SUPER_DROP_FRAME = 15; +constexpr int SINGE_DROP_TRIES = 10; +constexpr float SINGE_DROP_DISTANCE = 90; +constexpr float SINGE_DROP_BALL_GAP = 15; +constexpr int SINGE_SMOKE_GUIDE = 3; +constexpr float SINGE_SMOKE_AREA = -100; +constexpr float SINGE_SMOKE_SPREAD = 3; +constexpr float SINGE_SMOKE_RISE = -3; +constexpr float SINGE_SMOKE_RISE_RANGE = 5; +constexpr float SINGE_SMOKE_SPIN_RANGE = 10; +constexpr float SINGE_SMOKE_SPIN_MIN = 2; +constexpr uint32_t SINGE_SMOKE_FRAMES_RANGE = 10; +constexpr int SINGE_SMOKE_FRAMES = 30; +constexpr float SINGE_SMOKE_DEPTH = 50; + +// The crater ring: each cell that can take an obstacle (breaking what collides there) becomes a pit with a poof and +// five rock chips flung out, up to 30 degrees off, at 6 to 12, from up to 20 around it. +constexpr int SINGE_CHIPS = 5; +constexpr float SINGE_CHIP_SPREAD = 60; +constexpr float SINGE_CHIP_SPEED = 6; +constexpr float SINGE_CHIP_SPEED_RANGE = 6; +constexpr float SINGE_CHIP_SCATTER = 20; +constexpr int SINGE_RING_SIDES = 4; + +// A ball dropped from high above a spot, made to fall at once. +static void singe_ball_drop(Entity_NPC& npc, Vector position, uint32_t seed) +{ + auto* ball = static_cast(g_game->Spawn( + {.position = position, .spawner = &npc, .type = ENTITY_SINGE, .variant = SINGE_BALL, .seed = seed})); + ball->ClearEntityFlags(FLAG_APPEAR); + ball->Update(); + ball->v2.y = SINGE_BALL_DROP_HEIGHT; + ball->v1.y = SINGE_BALL_DROP_FALL; + ball->Update(); +} + +// 0058ac10 (NpcHelper::singe_explode_at) An explosion of his at a position, with a new ball while few roll. +static void singe_explode_at(Entity_NPC& npc, Vector position) +{ + explosion_effects({.position = position, .source = &npc, .damage = SINGE_EXPLOSION_DAMAGE, + .radiusMultiplier = SINGE_EXPLOSION_SCALE}); + game_butter_bean_fart({.position = position, .source = &npc, .radius = SINGE_FART_RADIUS, .isShowEffect = false}); + game_shake_screen(SINGE_EXPLOSION_SHAKE); + npc.projectileCooldown++; + for (Entity* near : entity_query_radius(position, SINGE_BALL_NEAR, QUERY_ENEMIES)) + { + if (!near->IsType(ENTITY_SINGE, SINGE_BALL, -1)) continue; + npc.projectileCooldown = 0; + break; + } + + if (Entity_NPC::QueryNPCsType(ENTITY_SINGE, SINGE_BALL).size() >= (size_t)npc.i1 + SINGE_BALL_MIN) return; + uint32_t seed = Random(); + float angle = random_unit() * PI_ROUGH * 2; + singe_ball_drop(npc, vector_add(npc.pos, vector_make(std::cos(angle) * SINGE_BALL_GAP, std::sin(angle) * SINGE_BALL_GAP)), seed); +} + +// 0058a010 (NpcHelper::singe_crater_ring) The super blast's crater timer: each call rings its center (the timer's +// position) with pits one cell further out, then rumbles. +static void singe_crater_ring(Entity_Effect* timerEffect) +{ + Entity_Effect& timer = *timerEffect; + Room& room = *g_game->room; + int center = room.GetGridIndex(timer.pos); + int centerRow = center / room.gridWidth; + int centerColumn = center % room.gridWidth; + int ring = ++timer.state; + int stepX = -1; + int stepY = 0; + + for (int side = 0; side < SINGE_RING_SIDES; side++) + { + int column = stepX * ring + centerColumn; + int row = stepY * ring + centerRow; + for (int step = 0; step < ring; step++) + { + int index = room.GetGridIndexByTile(column, row); + if (room.CanSpawnObstacleAtPosition(index, false)) + { + GridEntity* grid = room.GetGridEntity((uint32_t)index); + if (grid && grid->collisionClass != COLLISION_NONE) grid->Destroy(true, EntityRef()); + room.SpawnGridEntity(index, GRID_PIT, 0, Random(), 0); + if ((grid = room.GetGridEntity((uint32_t)index)) && grid->type == GRID_PIT) grid->PostInit(); + + Vector pit = room.GetGridPosition(index); + Vector away = vector_normalized(vector_sub(pit, timer.pos)); + g_game->Spawn({.position = pit, .type = ENTITY_EFFECT, .variant = EFFECT_POOF01, .seed = Random()}); + for (int chip = 0; chip < SINGE_CHIPS; chip++) + { + uint32_t seed = Random(); + float turn = random_unit() * SINGE_CHIP_SPREAD - SINGE_CHIP_SPREAD / 2; + Vector velocity = vector_scale(vector_rotated(away, turn), random_between(SINGE_CHIP_SPEED, SINGE_CHIP_SPEED_RANGE)); + float angle = random_unit() * PI_ROUGH * 2; + float scatter = random_unit() * SINGE_CHIP_SCATTER; + g_game->Spawn({.position = vector_add(pit, vector_make(std::cos(angle) * scatter, std::sin(angle) * scatter)), + .velocity = velocity, .subType = GIGA_CHIP_SUBTYPE, .type = ENTITY_EFFECT, + .variant = EFFECT_ROCK_PARTICLE, .seed = seed}); + } + } + column -= stepY + stepX; + row += stepX - stepY; + } + int turned = stepX; + stepX = -stepY; + stepY = turned; + } + effect_sound_play(SOUND_ROCK_CRUMBLE); +} + +// Back to idling: a 15 to 29 frame wait, and an attack wait of 1 to 4. +static void singe_idle_start(Entity_NPC& npc) +{ + npc.state = NPC_STATE_IDLE; + npc.stateFrame = SINGE_IDLE_FIRST - (int)(Random() % SINGE_IDLE_RANGE); + npc.v1.x = random_between(SINGE_WAIT_MIN, SINGE_WAIT_RANGE); +} + +// Faces the way he moves once it is over 1 across. +static void singe_face_update(Entity_NPC& npc) +{ + if (npc.velocity.x < -SINGE_FLIP_SPEED) npc.sprite.isFlipX = true; + else if (npc.velocity.x > SINGE_FLIP_SPEED) npc.sprite.isFlipX = false; +} + +// Whether the floor at a spot could take his crater: a crushable or walkable grid (or none) that may become an obstacle. +static bool singe_crater_spot_is_free(Vector position) +{ + Room& room = *g_game->room; + int index = room.GetGridIndex(position); + if (index < 0) return false; + + GridEntity* grid = room.GetGridEntity((uint32_t)index); + if (grid && !grid->IsEasyCrushableOrWalkable() && !grid->IsDangerousCrushableOrWalkable()) return false; + return room.CanSpawnObstacleAtPosition(index, true); +} + +// Below his next third of health while idling or running, he super blasts as soon as the floor around him allows, +// or once 89 frames have passed. +static void singe_super_blast_check(Entity_NPC& npc) +{ + float threshold = (float)(SINGE_PHASE_LAST - npc.i1) * npc.maxHitPoints / SINGE_PHASES; + if (npc.i1 >= SINGE_PHASE_LAST || npc.health >= threshold) return; + if (npc.state != NPC_STATE_IDLE && npc.state != NPC_STATE_MOVE) return; + + bool isReady = false; + if (npc.i2 < 1) npc.i2 = SINGE_CRATER_WAIT; + else isReady = --npc.i2 == 0; + if (!isReady) + { + std::array spots = {vector_make(0, 0), vector_make(SINGE_CRATER_STEP, 0), vector_make(-SINGE_CRATER_STEP, 0), + vector_make(0, SINGE_CRATER_STEP), vector_make(0, -SINGE_CRATER_STEP)}; + isReady = std::ranges::all_of(spots, [&](Vector offset) { return singe_crater_spot_is_free(vector_add(npc.pos, offset)); }); + } + if (!isReady) return; + + npc.i1++; + npc.sprite.Play("SuperBlast"); + npc.state = NPC_STATE_ATTACK5; + npc.stateFrame = 0; +} + +// Idling and walking toward his target until his attack wait runs out, then picking an attack. +static void singe_idle_update(Entity_NPC& npc) +{ + singe_face_update(npc); + if (npc.stateFrame < 0) + { + npc.sprite.Play("Idle"); + if (++npc.stateFrame == 0) npc.stateFrame = (int)(Random() % SINGE_WALK_RANGE) + SINGE_WALK_MIN; + } + else if (npc.stateFrame > 0) + { + npc.sprite.Play("Walk"); + npc.pathfinder.FindGridPath(npc.CalcTargetPosition(0), SINGE_WALK_SPEED, SINGE_PATH_MARKER, DIRECT_PATH_FAR); + if (--npc.stateFrame == 0) npc.stateFrame = SINGE_IDLE_FIRST - (int)(Random() % SINGE_IDLE_RANGE); + } + if (npc.v1.x > 0) npc.v1.x -= SINGE_WAIT_STEP; + if (npc.v1.x <= 0) + { + std::vector clouds = Entity_NPC::QueryNPCsType(ENTITY_EFFECT, EFFECT_SMOKE_CLOUD); + Entity* target = npc.GetPlayerTarget(); + bool isSuperFart = clouds.size() >= SINGE_SUPERFART_CLOUDS || + random_below(npc.i1 == SINGE_PHASE_LAST ? SINGE_SUPERFART_LAST_ODDS : SINGE_SUPERFART_ODDS) == 0; + if (isSuperFart && std::abs(target->pos.x - npc.pos.x) > SINGE_SUPERFART_REACH) + { + npc.state = NPC_STATE_ATTACK4; + npc.sprite.Play("SuperFart"); + npc.sprite.isFlipX = target->pos.x < npc.pos.x; + npc.stateFrame = 0; + } + else if (clouds.size() < SINGE_FART_CLOUDS && Random() % SINGE_FART_ODDS == 0) + { + bool isTargetLeft = target->pos.x < npc.pos.x; + Vector side = vector_make(npc.pos.x + (isTargetLeft ? -SINGE_FART_SIDE : SINGE_FART_SIDE), npc.pos.y); + bool isClouded = std::ranges::any_of(clouds, [&](Entity* cloud) + { return vector_length_squared(vector_sub(side, cloud->pos)) < SINGE_CLOUD_NEAR_SQUARED; }); + if (!isClouded) + { + npc.state = NPC_STATE_ATTACK3; + npc.sprite.Play("Fart"); + npc.sprite.isFlipX = isTargetLeft; + } + } + if (npc.state == NPC_STATE_IDLE) + { + npc.state = NPC_STATE_MOVE; + npc.sprite.Play("RunStart"); + npc.stateFrame = SINGE_RUN_FRAMES; + npc.entityRef = nullptr; + } + } + npc.friction *= SINGE_WALK_FRICTION; +} + +// Where to stand to blast a ball along a kick direction, and what it costs, SINGE_NO_COST for nowhere. kickFrom is +// the spot behind (or ahead of) the ball the blast is aimed from. +static float singe_kick_spot_find(Entity_NPC& npc, Vector ball, Vector kick, Vector& kickFrom, Vector& stand) +{ + Room& room = *g_game->room; + auto isFree = [&](Vector spot) + { return room.GetGridCollision(room.GetGridIndex(spot)) == COLLISION_NONE && npc.pathfinder.HasPathToPos(spot, false); }; + Vector back = vector_scale(kick, SINGE_KICK_REACH); + + kickFrom = stand = vector_sub(ball, back); + if (isFree(stand)) + { + Vector toward = vector_sub(npc.pos, stand); + float cost = vector_length(toward); + toward = vector_normalized(toward); + Vector side = vector_rotated(toward, RIGHT_ANGLE_DEGREES); + // The original also asks that 50 exceed the side's dot with the kick, which two unit vectors always meet. + if (vector_dot(kick, toward) > 0 && SINGE_KICK_REACH > vector_dot(side, kick)) + { + cost += SINGE_DETOUR_COST; + Vector offset = vector_scale(side, SINGE_KICK_REACH); + stand = vector_sub(ball, offset); + if (!isFree(stand)) stand = vector_add(ball, offset); + if (!isFree(stand)) cost = SINGE_NO_COST; + } + if (cost != SINGE_NO_COST) return cost; + } + kickFrom = stand = vector_add(ball, back); + return isFree(stand) ? vector_distance(npc.pos, stand) + SINGE_AHEAD_COST : SINGE_NO_COST; +} + +// The run: toward the cheapest ball to blast (or the target), then the Blast at the ball or a JumpBlast at the target +// once in reach or out of time. +static void singe_run_update(Entity_NPC& npc) +{ + if (!npc.sprite.animState.animData || !npc.sprite.animState.isPlaying) + { + npc.sprite.Play("Run"); + npc.PlaySound(SOUND_CHILD_ANGRY_ROAR, 1, 2, false, 1); + } + + Entity* target = npc.GetPlayerTarget(); + Entity_NPC* bestBall = nullptr; + Vector kickFrom = vector_make(0, 0); + Vector goal = vector_make(0, 0); + float bestScore = SINGE_NO_COST; + float reach = SINGE_BLAST_TRIGGER; + + std::vector balls = Entity_NPC::QueryNPCsType(ENTITY_SINGE, SINGE_BALL); + for (Entity* entity : balls) + { + auto& ball = static_cast(*entity); + if (!npc.pathfinder.HasPathToPos(ball.pos, false)) continue; + float lead = vector_distance(ball.pos, target->pos) * SINGE_LEAD_SHARE; + Vector predicted = vector_add(target->pos, vector_scale(target->velocity, lead)); + if (vector_dot(vector_sub(predicted, npc.pos), vector_sub(ball.pos, npc.pos)) < 0) continue; + + Vector from{}; + Vector stand{}; + float score = singe_kick_spot_find(npc, ball.pos, vector_normalized(vector_sub(predicted, ball.pos)), from, stand); + if (score >= SINGE_NO_COST) continue; + if (vector_length(ball.velocity) > SINGE_ROLLING_SPEED) score += SINGE_ROLLING_COST; + if (&ball == npc.entityRef.get()) score *= SINGE_CHOSEN_SHARE; + if (score >= bestScore) continue; + bestBall = &ball; + kickFrom = from; + goal = stand; + bestScore = score; + } + if (!balls.empty() && bestScore < SINGE_NO_COST && npc.projectileCooldown < SINGE_BALL_COOLDOWN) + bestScore *= std::clamp(((float)npc.stateFrame - SINGE_TIRE_START) / SINGE_TIRE_SPAN, 0.0f, 1.0f) * SINGE_TIRE_MAX + 1; + + float targetDistance = vector_distance(target->pos, npc.pos); + if (!npc.pathfinder.HasPathToPos(target->pos, false) || npc.projectileCooldown >= SINGE_BALL_COOLDOWN) + targetDistance = SINGE_NO_COST; + if (targetDistance + targetDistance < bestScore) + { + Vector offset = vector_sub(npc.pos, target->pos); + float best = 0; + goal = target->pos; + for (Vector diagonal : {vector_make(-DIAGONAL, -DIAGONAL), vector_make(-DIAGONAL, DIAGONAL), vector_make(DIAGONAL, DIAGONAL), + vector_make(DIAGONAL, -DIAGONAL)}) + { + float along = vector_dot(offset, diagonal); + if (along <= best) continue; + goal = vector_add(target->pos, vector_scale(diagonal, along * SINGE_DIAGONAL_SHARE)); + best = along; + } + room_check_line({.start = target->pos, .end = goal, .stopPosition = &goal, .mode = LINE_MODE_CELL}); + kickFrom = target->pos; + bestBall = nullptr; + } + + float speed = SINGE_RUN_SPEED; + if (bestBall != npc.entityRef.get()) + { + if (!npc.entityRef && npc.stateFrame < SINGE_RUN_MIN) npc.stateFrame = SINGE_RUN_MIN; + npc.entityRef = bestBall; + } + if (!bestBall && targetDistance <= SINGE_CLOSE_FAR) + speed = std::clamp((targetDistance - SINGE_CLOSE_NEAR) / SINGE_CLOSE_SPAN, 0.0f, 1.0f) * SINGE_CLOSE_SPEED_RANGE + SINGE_CLOSE_SPEED; + npc.pathfinder.FindGridPath(goal, speed, SINGE_PATH_MARKER, DIRECT_PATH_FAR); + + if (!bestBall) reach = SINGE_JUMP_TRIGGER; + int frame = --npc.stateFrame; + if (frame < 1 || (frame < SINGE_RUN_CLOSE && vector_distance(npc.pos, kickFrom) < reach)) + { + if (!bestBall) + { + Vector lead = vector_add(target->pos, vector_scale(target->velocity, vector_distance(npc.pos, target->pos) * SINGE_JUMP_LEAD)); + Vector leap = vector_scale(vector_sub(lead, npc.pos), SINGE_JUMP_LEAD); + if (vector_length_squared(leap) > SINGE_JUMP_SPEED * SINGE_JUMP_SPEED) leap = vector_resized(leap, SINGE_JUMP_SPEED); + npc.targetPosition = leap; + npc.state = NPC_STATE_ATTACK2; + npc.sprite.Play("JumpBlast"); + } + else + { + npc.targetPosition = kickFrom; + npc.state = NPC_STATE_ATTACK; + npc.sprite.Play("Blast"); + } + } + npc.friction *= SINGE_WALK_FRICTION; + singe_face_update(npc); +} + +// The fart: smoke clouds out his side with a push, then dust puffs until he lands. +static void singe_fart_update(Entity_NPC& npc) +{ + float facing = npc.sprite.isFlipX ? -1.0f : 1.0f; + if (npc.sprite.IsEventTriggered("Shoot")) + { + effect_sound_play(SOUND_FART); + float push = facing * SINGE_FART_PUSH; + for (int i = 0; i < SINGE_FART_CLOUD_COUNT; i++) + { + Vector direction = vector_rotated(vector_make(facing, 0), random_unit() * SINGE_FART_SPREAD - SINGE_FART_SPREAD / 2); + Vector velocity = vector_scale(direction, random_between(SINGE_FART_CLOUD_SPEED, SINGE_FART_CLOUD_SPEED)); + auto* cloud = static_cast(g_game->Spawn({.position = vector_make(push + npc.pos.x, npc.pos.y), + .velocity = velocity, .spawner = &npc, + .subType = SINGE_FART_CLOUD_SUBTYPE, .type = ENTITY_EFFECT, + .variant = EFFECT_SMOKE_CLOUD, .seed = Random()})); + cloud->SetTimeout(-1); + cloud->Update(); + } + Vector pushed = vector_make(facing * SINGE_FART_PUSH_REACH + npc.pos.x, npc.pos.y); + for (Entity* other : entity_query_radius(pushed, SINGE_FART_PUSH_RADIUS, QUERY_ALL)) + if (other != &npc) other->velocity = vector_add(other->velocity, vector_make(push, 0)); + } + + AnimationState& anim = npc.sprite.animState; + if (!anim.animData) return singe_idle_start(npc); + if (anim.WasEventTriggered("Shoot") && !anim.WasEventTriggered("Land")) + { + uint32_t seed = Random(); + Vector direction = vector_rotated(vector_make(facing, 0), random_unit() * SINGE_FART_SPREAD - SINGE_FART_SPREAD / 2); + Vector velocity = vector_scale(direction, random_between(SINGE_PUFF_SPEED, SINGE_PUFF_SPEED_RANGE)); + Entity* puff = g_game->Spawn({.position = vector_make(facing * SINGE_PUFF_OFFSET + npc.pos.x, npc.pos.y), + .velocity = velocity, .subType = SINGE_PUFF_SUBTYPE, .type = ENTITY_EFFECT, + .variant = EFFECT_WATER_SPLASH, .seed = seed}); + puff->sprite.scale = vector_scale(puff->sprite.scale, random_between(1, SINGE_PUFF_SCALE_RANGE)); + puff->sprite.color = SINGE_PUFF_COLOR; + puff->Update(); + } + if (!anim.isPlaying) singe_idle_start(npc); +} + +// The superfart: a long flame he steers at the target, its shots pushing him back. +static void singe_superfart_update(Entity_NPC& npc) +{ + if (npc.stateFrame == 0) + { + if (npc.sprite.IsEventTriggered("Sound")) effect_sound_play(SOUND_MATCHSTICK); + if (!npc.sprite.IsEventTriggered("Shoot")) return; + effect_sound_play(SOUND_FART_MEGA, {.frameDelay = SINGE_MEGA_FART_DELAY}); + effect_sound_play(SOUND_FLAME_BURST); + npc.stateFrame = SINGE_SUPERFART_FRAMES; + npc.v1.y = npc.sprite.isFlipX ? HALF_TURN_DEGREES : 0; + return; + } + if (npc.stateFrame < 1) + { + if (npc.sprite.IsFinished()) singe_idle_start(npc); + return; + } + + if (npc.sprite.IsFinished()) npc.sprite.Play("SuperFartLoop"); + float aim = angle_approach(npc.v1.y, vector_angle(vector_sub(npc.GetPlayerTarget()->pos, npc.pos)), SINGE_FLAME_TURN); + if (!npc.sprite.isFlipX) aim = std::clamp(aim, -SINGE_FLAME_RIGHT_LIMIT, SINGE_FLAME_RIGHT_LIMIT); + else if (aim <= 0) aim = std::min(aim, -SINGE_FLAME_LEFT_LIMIT); + else aim = std::max(aim, SINGE_FLAME_LEFT_LIMIT); + npc.v1.y = aim; + Vector direction = vector_from_angle(aim); + + if (npc.IsFrame(2, 0) && Random() % SINGE_FLAME_ODDS != 0) + { + ProjectileParams params; + params.variant = PROJECTILE_FIRE; + params.bulletFlags = PROJECTILE_HIT_ENEMIES; + params.fallingAccelModifier = SINGE_FLAME_FALL_ACCEL; + float fall = random_unit(); + params.fallingSpeedModifier = (fall + fall - 1) + params.fallingSpeedModifier; + float sway = std::sin((float)(SINGE_FLAME_SWAY_START - npc.stateFrame) * SINGE_FLAME_SWAY_RATE); + float spread = random_unit() * (SINGE_FLAME_SCATTER * 2) + (sway * SINGE_FLAME_SWAY - SINGE_FLAME_SCATTER); + float speed = random_unit() * SINGE_FLAME_SPEED_RANGE + SINGE_FLAME_SPEED; + npc.FireProjectiles(vector_add(npc.pos, vector_scale(direction, SINGE_FLAME_OFFSET)), + vector_scale(vector_rotated(direction, spread), speed), PROJECTILES_SINGLE, params); + effect_sound_play(SOUND_CANDLE_LIGHT); + game_shake_screen(SINGE_FLAME_SHAKE); + } + npc.velocity = vector_add(npc.velocity, vector_scale(direction, -SINGE_FLAME_RECOIL * npc.speedMultiplier)); + if (--npc.stateFrame == 0) + { + npc.sprite.Play("SuperFartEnd"); + npc.stateFrame = -1; + } +} + +// Smoke rising from the SmokeGuide null while it shows. +static void singe_smoke_update(Entity_NPC& npc) +{ + const NullFrame* guide = npc.sprite.GetNullFrameById(SINGE_SMOKE_GUIDE); + if (!guide || !guide->isVisible) return; + + ANM2& sprite = npc.sprite; + Vector local = vector_make((sprite.offset.x + guide->pos.x) * sprite.scale.x, (sprite.offset.y + guide->pos.y) * sprite.scale.y); + Vector offset = vector_rotated(local, sprite.rotation); + if (sprite.isFlipX) offset.x *= -1; + if (sprite.isFlipY) offset.y *= -1; + offset = vector_scale(offset, 1 / ROOM_SCREEN_SCALE); + int count = 1 - (int)(guide->scale.y * guide->scale.x / SINGE_SMOKE_AREA); + bool isLeft = offset.x < 0; + + for (int i = 0; i < count; i++) + { + float angle = random_unit() * PI_ROUGH * 2; + Vector spot = vector_make(std::cos(angle) * guide->scale.x * SINGE_SMOKE_SPREAD + offset.x, + std::sin(angle) * guide->scale.y * SINGE_SMOKE_SPREAD + offset.y); + uint32_t seed = Random(); + Vector rise = vector_make(0, SINGE_SMOKE_RISE - random_unit() * SINGE_SMOKE_RISE_RANGE); + auto* smoke = static_cast(g_game->Spawn( + {.position = npc.pos, .velocity = rise, .type = ENTITY_EFFECT, .variant = EFFECT_DUST_CLOUD, .seed = seed})); + // The original multiplies a random 2 to 12 by the side to pick the spin, so only the side counts. + smoke->rotation = random_between(SINGE_SMOKE_SPIN_MIN, SINGE_SMOKE_SPIN_RANGE) * (float)isLeft == 0 ? 1.0f : -1.0f; + smoke->SetTimeout((int)(Random() % SINGE_SMOKE_FRAMES_RANGE) + SINGE_SMOKE_FRAMES); + smoke->SetColor(guide->color, -1, COLOR_PRIORITY_DEFAULT, false, true); + smoke->posOffset = spot; + smoke->renderDepthOffset = SINGE_SMOKE_DEPTH; + smoke->Update(); + } +} + +// The super blast: a crater where he stands, then he drops near the target with a ball and lands. +static void singe_super_blast_update(Entity_NPC& npc) +{ + Room& room = *g_game->room; + if (npc.stateFrame < 0) + { + if (npc.sprite.IsEventTriggered("Land")) + { + npc.entityCollisionClass = ENTCOLL_ALL; + npc.entityGridCollisionClass = GRIDCOLL_GROUND; + effect_sound_play(SOUND_MEAT_IMPACTS); + } + if (npc.sprite.IsEventTriggered("Sound")) effect_sound_play(SOUND_MEAT_IMPACTS); + if (npc.sprite.IsFinished()) singe_idle_start(npc); + } + else if (npc.sprite.IsEventTriggered("Shoot")) + { + explosion_effects({.position = npc.pos, .source = &npc, .damage = SINGE_SUPER_DAMAGE, + .radiusMultiplier = SINGE_SUPER_REACH_SCALE}); + game_butter_bean_fart({.position = npc.pos, .source = &npc, .radius = SINGE_FART_RADIUS, .isShowEffect = false}); + game_shake_screen(SINGE_SUPER_SHAKE); + if (room_can_spawn_obstacle_at(npc.pos, false)) + { + int index = room.GetGridIndex(npc.pos); + room.SpawnGridEntity(index, GRID_PIT, 0, Random(), 0); + GridEntity* pit = room.GetGridEntity((uint32_t)index); + if (pit && pit->type == GRID_PIT) pit->PostInit(); + } + Entity_Effect* timer = Entity_Effect::CreateTimer(reinterpret_cast(&singe_crater_ring), SINGE_CRATER_DELAY, + SINGE_CRATER_TIMES, false); + timer->pos = npc.pos; + timer->parent = &npc; + npc.entityCollisionClass = ENTCOLL_NONE; + npc.entityGridCollisionClass = GRIDCOLL_NONE; + npc.stateFrame = SINGE_SUPER_AIR_FRAMES; + } + else if (npc.stateFrame > 0) + { + if (--npc.stateFrame == SINGE_SUPER_DROP_FRAME) + { + for (int i = 0; i < SINGE_DROP_TRIES && room_grid_collision_at(npc.pos) != COLLISION_NONE; i++) + { + Vector around = npc.GetPlayerTarget()->pos; + float angle = random_unit() * PI_ROUGH * 2; + around = vector_add(around, vector_make(std::cos(angle) * SINGE_DROP_DISTANCE, std::sin(angle) * SINGE_DROP_DISTANCE)); + npc.pos = room_free_pickup_position_find({.position = around}); + } + uint32_t seed = Random(); + singe_ball_drop(npc, vector_add(npc.pos, vector_scale(random_direction(), SINGE_DROP_BALL_GAP)), seed); + } + if (npc.stateFrame == 0) + { + npc.stateFrame = -1; + npc.sprite.Play("SuperBlastLand"); + } + } + singe_smoke_update(npc); +} + +// His own and other enemies' explosions do not hurt him, and what does hurt him shortens his attack wait. +static void singe_damage_filter(Entity_NPC& npc) +{ + if (npc.pendingDamage <= 0) return; + + npc.pendingDamage = 0; + for (DamageEvent& hit : npc.damageEvents) + { + const EntityRef& source = hit.source; + bool isEnemyBlast = (hit.damageFlags & DAMAGE_EXPLOSION) && !source.IsFriendly() && source.type != ENTITY_PLAYER && + source.spawnerType != ENTITY_PLAYER && source.spawnerType != ENTITY_FAMILIAR && + !(hit.damageFlags & DAMAGE_TNT); + if (isEnemyBlast) hit.damage = 0; + npc.pendingDamage += hit.damage; + } + npc.v1.x -= npc.pendingDamage * SINGE_HURT_WAIT; +} + +// 0058aed0 NpcAI::ENTITY_SINGE_body (915.0): Singe idles and walks, then farts, superfarts or runs to blast his balls +// at his target, super blasting a crater at each third of his health. +void singe_body_update(Entity_NPC& npc) +{ + singe_super_blast_check(npc); + switch (npc.state) + { + case NPC_STATE_INIT: + singe_idle_start(npc); + npc.i1 = 0; + npc.projectileCooldown = 0; + break; + case NPC_STATE_IDLE: + singe_idle_update(npc); + break; + case NPC_STATE_MOVE: + singe_run_update(npc); + break; + case NPC_STATE_ATTACK: + if (npc.sprite.IsEventTriggered("Shoot")) + { + if (vector_length_squared(vector_sub(npc.targetPosition, npc.pos)) > SINGE_BLAST_SNAP_SQUARED) npc.targetPosition = npc.pos; + singe_explode_at(npc, npc.targetPosition); + } + if (npc.sprite.IsEventTriggered("Sound")) effect_sound_play(SOUND_MEAT_IMPACTS); + if (!npc.sprite.animState.animData || !npc.sprite.animState.isPlaying) singe_idle_start(npc); + npc.friction *= SINGE_ATTACK_FRICTION; + break; + case NPC_STATE_ATTACK2: + if (npc.sprite.IsEventTriggered("Jump")) + { + npc.velocity = npc.targetPosition; + npc.targetPosition = vector_make(0, 0); + } + if (!npc.sprite.WasEventTriggered("Jump") || npc.sprite.WasEventTriggered("Land")) npc.friction *= SINGE_ATTACK_FRICTION; + if (npc.sprite.IsEventTriggered("Jump")) effect_sound_play(SOUND_FETUS_JUMP); + if (npc.sprite.IsEventTriggered("Sound")) effect_sound_play(SOUND_MEAT_IMPACTS); + if (npc.sprite.IsEventTriggered("Shoot")) singe_explode_at(npc, npc.pos); + if (!npc.sprite.animState.animData || !npc.sprite.animState.isPlaying) singe_idle_start(npc); + break; + case NPC_STATE_ATTACK3: + singe_fart_update(npc); + npc.friction *= SINGE_ATTACK_FRICTION; + break; + case NPC_STATE_ATTACK4: + singe_superfart_update(npc); + npc.friction *= SINGE_ATTACK_FRICTION; + break; + case NPC_STATE_ATTACK5: + singe_super_blast_update(npc); + npc.friction *= SINGE_ATTACK_FRICTION; + break; + default: + break; + } + singe_damage_filter(npc); +} diff --git a/src/boss_siren.cpp b/src/boss_siren.cpp new file mode 100644 index 0000000..b640134 --- /dev/null +++ b/src/boss_siren.cpp @@ -0,0 +1,1041 @@ +#include "boss_repentance.h" +#include "boss_ai.h" +#include "entity_config.h" +#include "entity_effect_combat.h" +#include "entity_familiar.h" +#include "entity_pickup.h" +#include "entity_player.h" +#include "entity_projectile.h" +#include "grid_entity_rock.h" +#include "grid_entity_trap_door.h" +#include "loot_list.h" +#include "manager.h" +#include "npc_ai.h" +#include "path_finder.h" +#include "persistent_game_data.h" +#include "room.h" +#include "room_grid.h" +#include "sfx_manager.h" +#include +#include +#include + +// The Siren (904.0) sings with an invisible player of her own (sirenPlayerEntity) that her charmed familiars serve +// and circle (its targetPosition: the orbit's angle and speed, 1 to 5). Her remains (904.1) roll to a spot and +// break, and the carrier (904.10) she lunges with flies her charmed line off until it leaves the room. +constexpr int SIREN_REMAINS = 1; +constexpr int SIREN_CARRIER = 10; +constexpr int SIREN_CHARM_ALL_SUBTYPE = 999; +constexpr uint64_t SIREN_REMAINS_FLAGS = FLAG_NO_STATUS_EFFECTS | FLAG_NO_TARGET; +constexpr uint64_t SIREN_CARRIER_FLAGS = + FLAG_NO_STATUS_EFFECTS | FLAG_NO_TARGET | FLAG_NO_KNOCKBACK | FLAG_NO_PHYSICS_KNOCKBACK | FLAG_HIDE_HP_BAR | FLAG_NO_PLAYER_CONTROL; +constexpr ColorMod SIREN_SPLAT_COLOR = {{0, 0, 0, 1}, {0, 0, 0, 0}, {0.1f, 0.1f, 0.1f}}; +constexpr float SIREN_FRICTION = 0.8f; +constexpr float SIREN_ORBIT_MAX = 5; +constexpr float SIREN_ORBIT_MIN = 1; +constexpr float SIREN_ORBIT_SLOWING = 0.08f; +constexpr float SIREN_ORBIT_LUNGE = 0.3f; +constexpr int SIREN_COOLDOWN_TICK = 10; + +// Her light glows magenta while she sings (crimson while she charms), fading to and from black over 15 frames. +constexpr ColorMod SIREN_SING_COLOR = tint_color_make(0.8039216f, 0.003921569f, 0.91764706f, 1); +constexpr ColorMod SIREN_CHARM_GLOW_COLOR = tint_color_make(0.91764706f, 0, 0.20392157f, 1); +constexpr ColorMod SIREN_DARK_COLOR = tint_color_make(0, 0, 0, 1); +constexpr int SIREN_GLOW_FADE = 15; + +// The attacks' waits, in ticks of 10 frames, kept a byte each in i1 (lunge, scream, song, charm) and i2 (recall, +// teleport). +enum SirenCooldown +{ + SIREN_COOLDOWN_LUNGE, + SIREN_COOLDOWN_SCREAM, + SIREN_COOLDOWN_SONG, + SIREN_COOLDOWN_CHARM, + SIREN_COOLDOWN_RECALL, + SIREN_COOLDOWN_TELEPORT, + SIREN_COOLDOWN_COUNT +}; +constexpr int SIREN_COOLDOWNS_PER_WORD = 4; +constexpr int SIREN_COOLDOWN_BITS = 8; +constexpr uint32_t SIREN_COOLDOWN_MASK = 0xff; +constexpr int SIREN_ATTACK_WAIT = 30; +constexpr int SIREN_RECALL_WAIT = 15; +constexpr int SIREN_TELEPORT_WAIT = 9; +constexpr int SIREN_LUNGE_WAIT = 7; + +// Her states. projectileCooldown times the current attack (-1 before its start), stateFrame the idling and +// projectileDelay the lunge she owes. +enum SirenState +{ + SIREN_IDLE = NPC_STATE_IDLE, + SIREN_TELEPORT_MOVE = NPC_STATE_MOVE, + SIREN_SLASH = NPC_STATE_SUICIDE, + SIREN_TELEPORT = NPC_STATE_JUMP, + SIREN_TELEPORT_END = NPC_STATE_STOMP, + SIREN_SCREAM = NPC_STATE_ATTACK, + SIREN_SONG = NPC_STATE_ATTACK2, + SIREN_CHARM_SONG = NPC_STATE_ATTACK3, + SIREN_LUNGE = NPC_STATE_ATTACK4, + SIREN_RECALL = NPC_STATE_ATTACK5, + SIREN_HOVER = NPC_STATE_SUMMON, + SIREN_REVIVE = NPC_STATE_SPECIAL, + SIREN_DEATH = NPC_STATE_DEATH +}; + +// Idling: she drifts, keeping 100 off the bottom wall, and every 10 frames up to 30 one time in 5 more than her lunge +// wait lunges at a target within 180 below her (unless she holds a charmed familiar). Then she picks an attack. +constexpr int SIREN_IDLE_FRAMES = 30; +constexpr int SIREN_IDLE_STEP = 10; +constexpr int SIREN_LUNGE_ODDS = 5; +constexpr uint32_t SIREN_TURN_ODDS = 20; +constexpr float SIREN_BOTTOM_MARGIN = 100; +constexpr float SIREN_LUNGE_RANGE = 180; +constexpr float SIREN_LUNGE_BELOW = 0.1f; + +// The lunge (and the slash at a recalled line): 15 then 6 a frame along her aim 10 out for 4 frames, then easing +// off; the slash's carrier flies at 10. +constexpr float SIREN_LUNGE_SHOT_SPEED = 15; +constexpr float SIREN_LUNGE_SHOT_OFFSET = 10; +constexpr float SIREN_LUNGE_SPREAD = 0.7f; +constexpr int SIREN_LUNGE_AIM_FRAME = 4; +constexpr int SIREN_LUNGE_PUSH_FRAMES = 4; +constexpr float SIREN_LUNGE_PUSH = 6; +constexpr float SIREN_LUNGE_EASE = 1.1f; +constexpr float SIREN_LUNGE_EASE_STEP = 0.01f; +constexpr float SIREN_LUNGE_NUDGE = 0.01f; +constexpr float SIREN_SLASH_LEAD = 0.1f; +constexpr float SIREN_CARRIER_SPEED = 10; + +// The teleport: she sinks, trailing black creep, paths 10 above her target at 2.5 (for 30 to 90 frames) and rises. +constexpr float SIREN_TELEPORT_SPEED = 2.5f; +constexpr float SIREN_TELEPORT_RISE = 10; +constexpr float SIREN_TELEPORT_MARGIN = 5; +constexpr int SIREN_TELEPORT_MIN = 30; +constexpr int SIREN_TELEPORT_MAX = 90; +constexpr float SIREN_TELEPORT_NEAR = 20; +constexpr int SIREN_CREEP_FRAMES = 300; +constexpr uint32_t SIREN_SINK_CREEP_ODDS = 3; + +// The scream (Attack1): rings every 8 frames, a fan of shots at 5 every 16 (every 15 degrees, sparing 7.5 about two +// aims near and opposite her target), a shockwave every 24, and a push away from her for 150 frames. +constexpr int SIREN_RING_EVERY = 8; +constexpr float SIREN_RING_HEIGHT = -45; +constexpr int SIREN_FAN_EVERY = 16; +constexpr float SIREN_FAN_MARGIN = 60; +constexpr float SIREN_FAN_JITTER = 30; +constexpr float SIREN_FAN_TURN = 20; +constexpr float SIREN_FAN_FALL = 0.1f; +constexpr float SIREN_FAN_ACCEL = -0.14f; +constexpr float SIREN_FAN_STEP = 15; +constexpr float SIREN_FAN_GAP = 7.5f; +constexpr int SIREN_FAN_SHIFT_EVERY = 32; +constexpr float SIREN_FAN_SPEED = 5; +constexpr int SIREN_WAVE_EVERY = 24; +constexpr float SIREN_WAVE_STRENGTH = 0.015f; +constexpr int SIREN_WAVE_FRAMES = 20; +constexpr float SIREN_PUSH = 2; +constexpr float SIREN_PUSH_FALLOFF = 0.0001f; +constexpr float SIREN_PUSH_PLAYER = 0.7f; +constexpr float SIREN_PUSH_TEAR = 0.4f; +constexpr int SIREN_SCREAM_FRAMES = 150; + +// The songs (Attack2 and Attack2B) last 90 frames: six wiggling magenta shots at 10 every 8 frames, or charms on up +// to three free familiars on frame 3. +constexpr int SIREN_SONG_FRAMES = 90; +constexpr int SIREN_SONG_EVERY = 8; +constexpr float SIREN_SONG_ACCEL = -0.099f; +constexpr float SIREN_SONG_STEP = 60; +constexpr float SIREN_SONG_SPEED = 10; +constexpr int SIREN_CHARM_FRAME = 3; +constexpr int SIREN_CHARM_PICKS = 3; +constexpr int SIREN_CHARM_EFFECT_FRAMES = 75; +constexpr int SIREN_CHARM_FLOOR_SUBTYPE = 1; + +// The recall: minions to make three charmed familiars, then she hovers (0.3) until none is left or 300 frames (the +// damage she takes counting too) pass, and slashes. +constexpr int SIREN_RECALL_LINE = 3; +constexpr ColorMod SIREN_MINION_POOF = {{0.2f, 0.2f, 0.2f, 1}, {1, 1, 1, 1}, {0, 0, 0}}; +constexpr float SIREN_HOVER_SPEED = 0.3f; +constexpr int SIREN_HOVER_CHECK = 30; +constexpr int SIREN_HOVER_FRAMES = 300; + +// Her revival by a stolen 1up or Dead Cat: she stands again with her health (a fifth for Dead Cat). +constexpr int SIREN_REVIVE_SOUND_DELAY = 20; +constexpr float SIREN_DEAD_CAT_HEALTH = 0.2f; + +// Picking an attack: the scream under two charmed (100, 33 less each), the charm song with free familiars and under +// six charmed (33 each free, 15 less each charmed, 1 to 150), the recall (33 a charmed one, 33 to 100), the teleport +// with none charmed (by how near the side walls and the bottom she is, 80 out), else idling on. +constexpr int SIREN_PICK_BASE = 100; +constexpr int SIREN_PICK_STEP = 33; +constexpr int SIREN_PICK_CHARMED_STEP = 15; +constexpr int SIREN_PICK_CHARM_MAX = 150; +constexpr int SIREN_PICK_CHARMED_MAX = 6; +constexpr float SIREN_EDGE = 80; + +// The remains: they glide to their spot, ring with a bone sound and break (by an explosion or a crush) into seven +// chips and Forgotten Lullaby or a rock's drops. +constexpr int SIREN_CHIPS = 7; +constexpr float SIREN_CHIP_SCATTER = 12; +constexpr float SIREN_CHIP_SPEED = 5; +constexpr int SIREN_CHIP_SUBTYPE = 0x10007; +constexpr uint64_t SIREN_BREAK_DAMAGE = DAMAGE_EXPLOSION | DAMAGE_CRUSH; +constexpr uint32_t SIREN_ROCK_SHIFT_1 = 2; +constexpr uint32_t SIREN_ROCK_SHIFT_2 = 21; +constexpr uint32_t SIREN_ROCK_SHIFT_3 = 9; +constexpr int SIREN_ROCK_BACKDROP = 7; +constexpr float SIREN_REMAINS_SPOT = 60; + +// The carrier: its charmed line pulses grey every 6 frames, and once past 15 frames it breaks as soon as a familiar +// leaves the room or it meets a wall: a ring of 6 per familiar (6 to 18) shots at 8, a shake, and the familiars hurt. +constexpr ColorMod SIREN_CARRY_PULSE = {{0.6f, 0.6f, 0.6f, 1}, {0, 0, 0, 0}, {0.7f, 0, 0}}; +constexpr int SIREN_CARRY_PULSE_EVERY = 6; +constexpr float SIREN_CARRY_ARMED = 15; +constexpr float SIREN_CARRY_MARGIN = 2; +constexpr float SIREN_CARRY_CLAMP = 8; +constexpr float SIREN_CARRY_SHOT_SPEED = 8; +constexpr float SIREN_CARRY_SHOTS = 6; +constexpr float SIREN_CARRY_SHOTS_MAX = 18; +constexpr int SIREN_CARRY_SHAKE = 5; +constexpr float SIREN_CARRY_DAMAGE = 1000; +constexpr int SIREN_CARRY_COUNTDOWN = 30; + +// The helper keeps its familiar charmed (pink, priority 261) and flashes it when hit. +constexpr ColorMod SIREN_CHARM_TINT = {{1, 0.4f, 0.4f, 1}, {0, 0, 0, 0}, {0.18f, 0.04f, 0.04f}}; +constexpr ColorMod SIREN_HELPER_HIT_COLOR = {{0.5f, 0.5f, 0.5f, 1}, {0, 0, 0, 0}, {0.784f, 0, 0}}; +constexpr int SIREN_CHARM_PRIORITY = 261; +constexpr int SIREN_CHARM_FRAMES = 2; + +// The word and shift of a cooldown's byte. +static int& siren_cooldown_word(Entity_NPC& npc, SirenCooldown which) +{ + return which < SIREN_COOLDOWNS_PER_WORD ? npc.i1 : npc.i2; +} + +static int siren_cooldown_get(Entity_NPC& npc, SirenCooldown which) +{ + int shift = which % SIREN_COOLDOWNS_PER_WORD * SIREN_COOLDOWN_BITS; + return (int)(((uint32_t)siren_cooldown_word(npc, which) >> shift) & SIREN_COOLDOWN_MASK); +} + +static void siren_cooldown_set(Entity_NPC& npc, SirenCooldown which, int value) +{ + int shift = which % SIREN_COOLDOWNS_PER_WORD * SIREN_COOLDOWN_BITS; + uint32_t word = (uint32_t)siren_cooldown_word(npc, which) & ~(SIREN_COOLDOWN_MASK << shift); + siren_cooldown_word(npc, which) = (int)(word | (((uint32_t)value & SIREN_COOLDOWN_MASK) << shift)); +} + +// Whether a timer crossed a multiple of a period this update. +static bool siren_period_crossed(int timer, int frames, int period) +{ + return timer / period < (timer + frames) / period; +} + +// 0058e490 (NpcHelper::siren_familiar_counts) The familiars she could charm: free and charmed. +static std::pair siren_familiar_counts() +{ + int free = 0; + int charmed = 0; + for (Entity_Familiar* familiar : familiar_query(-1)) + { + if (!is_familiar_charmable(*familiar)) continue; + if (familiar->HasEntityFlags(FLAG_CHARM)) charmed++; + else free++; + } + return {free, charmed}; +} + +// 0058e590 (NpcHelper::siren_charmed_count) The charmed familiars in her line. +static int siren_charmed_count(Entity_NPC& npc) +{ + return (int)std::ranges::count_if(familiar_query(-1), [&](Entity_Familiar* familiar) + { return familiar->HasEntityFlags(FLAG_CHARM) && familiar->is_following() && + familiar->player == npc.sirenPlayerEntity; }); +} + +// 0058e260 (NpcHelper::siren_charm_familiar) Two charm effects (one on the floor) on a familiar not yet charmed, +// bound to her, the familiar and her player. +static void siren_charm_familiar(Entity_NPC& npc, Entity_Familiar& familiar) +{ + if (familiar.HasEntityFlags(FLAG_CHARM)) return; + for (int subType : {0, SIREN_CHARM_FLOOR_SUBTYPE}) + { + uint32_t seed = Random(); + auto* charm = static_cast(g_game->Spawn({.position = familiar.pos, .velocity = familiar.velocity, + .spawner = &npc, .subType = subType, .type = ENTITY_EFFECT, + .variant = EFFECT_CHARM_EFFECT, .seed = seed})); + charm->SetTimeout(SIREN_CHARM_EFFECT_FRAMES); + charm->parent = &npc; + charm->target = &familiar; + charm->child = npc.sirenPlayerEntity; + charm->Update(); + } +} + +// (00770640) Points her player's head and shots the way of an aim, nowhere for none. +static void siren_player_aim(Entity_Player& player, Vector aim) +{ + Direction direction = vector_is_zero(aim) ? DIRECTION_NONE : vector_to_direction(aim); + player.headDirection = direction; + player.fireDirection = direction; + player.aimDirection = aim; +} + +// A puddle of black creep under her. +static Entity* siren_creep_spawn(Entity_NPC& npc) +{ + Entity* creep = g_game->Spawn({.position = npc.pos, .type = ENTITY_EFFECT, .variant = EFFECT_CREEP_BLACK, .seed = Random()}); + creep->sprite.scale = vector_make(1, 1); + return creep; +} + +// Her light's glow: one color at once, then another faded in over 15 frames. +static void siren_glow(Entity_NPC& npc, const ColorMod& now, const ColorMod& next) +{ + Entity* light = npc.entityRef; + if (!light) return; + light->SetColor(now, -1, COLOR_PRIORITY_DEFAULT, false, true); + light->SetColor(next, SIREN_GLOW_FADE, COLOR_PRIORITY_DEFAULT, true, true); +} + +// The attack ends: back to idling, the attack's wait set. +static void siren_attack_end(Entity_NPC& npc, std::string_view animation, SirenCooldown cooldown, int wait) +{ + npc.sprite.Play(animation); + npc.state = SIREN_IDLE; + npc.stateFrame = 0; + siren_cooldown_set(npc, cooldown, wait); +} + +// Whether the animation has stopped. +static bool siren_is_anim_done(Entity_NPC& npc) +{ + return !npc.sprite.animState.animData || !npc.sprite.animState.isPlaying; +} + +// Her first frame: her own player (with the Intruder's look) following her, her light, and idling. +static void siren_init(Entity_NPC& npc) +{ + if (npc.sirenPlayerEntity) npc.ClearReferences(); + auto* player = new Entity_Player(); + npc.sirenPlayerEntity = player; + player->Init(ENTITY_PLAYER, 0, 0, npc.initSeed); + player->spawnerType = npc.type; + player->spawnerVariant = npc.variant; + player->spawnerEntity = &npc; + player->pos = npc.pos; + player->velocity = npc.velocity; + player->temporaryEffects.AddNullEffect(NULLITEM_INTRUDER, true, 1); + + npc.entityGridCollisionClass = GRIDCOLL_WALLS; + npc.state = SIREN_IDLE; + npc.projectileCooldown = 0; + npc.aiCallFlags = AI_CALL_PRE_UPDATE; + npc.splatColor = SIREN_SPLAT_COLOR; + npc.entityRef = effect_light_create({.position = npc.pos, .parent = &npc}); + npc.i1 = 0; + npc.i2 = 0; + npc.projectileDelay = 0; +} + +// 0058e680 (NpcHelper::siren_pick) Picks her next attack by weight, or idles on. +static void siren_pick(Entity_NPC& npc) +{ + auto [free, charmed] = siren_familiar_counts(); + int lined = siren_charmed_count(npc); + int held = (int)std::ranges::count_if(familiar_query(-1), [&](Entity_Familiar* familiar) + { return familiar->HasEntityFlags(FLAG_CHARM) && familiar->player == npc.sirenPlayerEntity; }); + WeightedOutcomePicker picker; + auto add = [&](SirenState state, int weight) { if (weight > 0) picker.outcomes.push_back({state, weight}); }; + + if (siren_cooldown_get(npc, SIREN_COOLDOWN_SCREAM) == 0 && held < 2) + add(SIREN_SCREAM, std::max(SIREN_PICK_BASE - held * SIREN_PICK_STEP, 0)); + if (siren_cooldown_get(npc, SIREN_COOLDOWN_CHARM) == 0 && charmed < SIREN_PICK_CHARMED_MAX && free > 0) + add(SIREN_CHARM_SONG, std::min(std::max(free * SIREN_PICK_STEP - charmed * SIREN_PICK_CHARMED_STEP, 1), SIREN_PICK_CHARM_MAX)); + if (siren_cooldown_get(npc, SIREN_COOLDOWN_RECALL) == 0) + add(SIREN_RECALL, std::min(std::max(lined * SIREN_PICK_STEP, SIREN_PICK_STEP), SIREN_PICK_BASE)); + + bool isTeleportWeighed = siren_cooldown_get(npc, SIREN_COOLDOWN_TELEPORT) == 0 && charmed == 0; + if (isTeleportWeighed) + { + Room& room = *g_game->room; + Vector topLeft = room.topLeftPos; + Vector bottomRight = room.bottomRightPos; + float middle = (bottomRight.y - topLeft.y) * HALF + topLeft.y; + float right = std::clamp((npc.pos.x - (bottomRight.x - SIREN_EDGE)) / SIREN_EDGE, 0.0f, 1.0f); + float left = std::clamp((npc.pos.x - (topLeft.x + SIREN_EDGE)) / -SIREN_EDGE, 0.0f, 1.0f); + float bottom = std::clamp((npc.pos.y - middle) / (bottomRight.y - middle), 0.0f, 1.0f); + add(SIREN_TELEPORT, (int)((bottom + 0 + left + 0 + right + 0) * SIREN_PICK_BASE)); + } + if (!isTeleportWeighed || picker.outcomes.empty()) add(SIREN_IDLE, SIREN_PICK_BASE); + + RNG rng = RNG_DEFAULT; + rng._seed = Random() | 1; + int state = picker.PickOutcome(rng); + if (state == SIREN_IDLE) npc.stateFrame = 0; + else + { + npc.projectileCooldown = -1; + npc.state = state; + } +} + +// Idling: drifting, the odd lunge at a target below, then an attack. +static void siren_idle_update(Entity_NPC& npc, int frames) +{ + if (siren_is_anim_done(npc)) npc.sprite.Play("Idle"); + if (npc.subtype == SIREN_CHARM_ALL_SUBTYPE) + { + for (Entity_Familiar* familiar : familiar_query(-1)) + if (!familiar->HasEntityFlags(FLAG_CHARM)) familiar->siren_charm(&npc, npc.sirenPlayerEntity); + return; + } + + if (npc.sprite.IsPlaying("Idle")) + { + npc.pathfinder.MoveRandomlyBoss(STATUS_OBEYED); + Vector& heading = npc.pathfinder.moveDirection; + if (Random() % SIREN_TURN_ODDS == 0 && npc.pos.y + SIREN_BOTTOM_MARGIN > g_game->room->bottomRightPos.y && heading.y > 0) + heading.y *= -1; + } + int idle = npc.stateFrame += frames; + if (idle > SIREN_IDLE_FRAMES) return siren_pick(npc); + + bool isLungeTurn = (idle - frames) / SIREN_IDLE_STEP < idle / SIREN_IDLE_STEP && + random_below(siren_cooldown_get(npc, SIREN_COOLDOWN_LUNGE) + SIREN_LUNGE_ODDS) == 0; + if (!isLungeTurn && npc.projectileDelay <= 0) return; + + Vector toward = vector_sub(npc.GetPlayerTarget()->pos, npc.pos); + if (vector_length(toward) >= SIREN_LUNGE_RANGE || vector_normalized(toward).y <= SIREN_LUNGE_BELOW) return; + if (siren_familiar_counts().second != 0) return; + + npc.projectileCooldown = 0; + npc.projectileDelay = 0; + npc.state = SIREN_LUNGE; + npc.targetPosition = vector_normalized(toward); + siren_cooldown_set(npc, SIREN_COOLDOWN_LUNGE, siren_cooldown_get(npc, SIREN_COOLDOWN_LUNGE) + SIREN_LUNGE_WAIT); + npc.sprite.Play(npc.targetPosition.x > 0 ? "SlashRight" : "SlashLeft"); +} + +// The lunge's motion: pushed along her aim for its first frames after Shoot, then easing her friction back up. +static void siren_lunge_motion(Entity_NPC& npc, bool isPushScaled) +{ + int timer = npc.projectileCooldown; + if (npc.sprite.WasEventTriggered("Shoot") && timer < SIREN_LUNGE_PUSH_FRAMES) + npc.velocity = vector_add(npc.velocity, vector_scale(npc.targetPosition, SIREN_LUNGE_PUSH * (isPushScaled ? npc.speedMultiplier : 1))); + else npc.friction *= std::max(SIREN_LUNGE_EASE - (float)(timer - SIREN_LUNGE_PUSH_FRAMES) * SIREN_LUNGE_EASE_STEP, 1.0f); +} + +// The slash after a recall: a lunge at where the target will be that throws her charmed line ahead in a carrier. +static void siren_slash_update(Entity_NPC& npc, int frames) +{ + if (npc.sprite.IsEventTriggered("Sound")) effect_sound_play(SOUND_SIREN_LUNGE); + if (npc.sprite.IsEventTriggered("Shoot")) + { + Entity* target = npc.GetPlayerTarget(); + float lead = vector_distance(npc.pos, target->pos) * SIREN_SLASH_LEAD; + npc.targetPosition = vector_normalized(vector_sub(vector_add(target->pos, vector_scale(target->velocity, lead)), npc.pos)); + npc.projectileCooldown = 0; + Entity* carrier = g_game->Spawn({.position = npc.pos, .velocity = vector_scale(npc.targetPosition, SIREN_CARRIER_SPEED), + .spawner = &npc, .type = ENTITY_SIREN, .variant = SIREN_CARRIER, .seed = Random()}); + carrier->isVisible = false; + carrier->entityCollisionClass = ENTCOLL_NONE; + carrier->entityGridCollisionClass = GRIDCOLL_WALLS; + carrier->parent = &npc; + carrier->Update(); + npc.child = carrier; + } + siren_lunge_motion(npc, false); + npc.projectileCooldown += frames; + if (siren_is_anim_done(npc)) + { + npc.state = SIREN_IDLE; + npc.stateFrame = 0; + siren_cooldown_set(npc, SIREN_COOLDOWN_RECALL, SIREN_RECALL_WAIT); + } + Entity_Player& player = *npc.sirenPlayerEntity; + player.targetPosition.y = std::min(npc.speedMultiplier * SIREN_ORBIT_LUNGE + player.targetPosition.y, SIREN_ORBIT_MAX); +} + +// The lunge: a five shot spread along her aim, the aim turned toward the target (and kept a little downward) before. +static void siren_lunge_update(Entity_NPC& npc, int frames) +{ + if (npc.sprite.IsEventTriggered("Sound")) effect_sound_play(SOUND_SIREN_LUNGE); + if (npc.sprite.IsEventTriggered("Shoot")) + { + npc.projectileCooldown = 0; + ProjectileParams params; + params.spread = SIREN_LUNGE_SPREAD; + npc.FireProjectiles(vector_add(npc.pos, vector_scale(npc.targetPosition, SIREN_LUNGE_SHOT_OFFSET)), + vector_scale(npc.targetPosition, SIREN_LUNGE_SHOT_SPEED), PROJECTILES_FIVE, params); + } + int timer = npc.projectileCooldown; + if (!npc.sprite.WasEventTriggered("Shoot")) + { + if (timer < SIREN_LUNGE_AIM_FRAME + 1 && timer + frames > SIREN_LUNGE_AIM_FRAME) + { + Vector aim = vector_sub(npc.GetPlayerTarget()->pos, npc.pos); + if (aim.x < 0 && npc.targetPosition.x > 0) aim.x = SIREN_LUNGE_NUDGE; + else if (aim.x > 0 && npc.targetPosition.x < 0) aim.x = -SIREN_LUNGE_NUDGE; + aim = vector_normalized(aim); + if (aim.y < SIREN_LUNGE_BELOW) + { + aim.y = SIREN_LUNGE_BELOW; + aim = vector_normalized(aim); + } + npc.targetPosition = aim; + } + } + else siren_lunge_motion(npc, true); + npc.projectileCooldown += frames; + if (siren_is_anim_done(npc)) + { + npc.state = SIREN_IDLE; + npc.stateFrame = 0; + } +} + +// Sinking for a teleport: out of reach once under, trailing creep. +static void siren_teleport_update(Entity_NPC& npc) +{ + npc.sprite.Play("Teleport"); + if (npc.sprite.IsEventTriggered("Shoot")) + { + npc.entityCollisionClass = ENTCOLL_NONE; + npc.entityGridCollisionClass = GRIDCOLL_GROUND; + npc.shadowSize = 0; + } + if (npc.sprite.WasEventTriggered("Shoot") && Random() % SIREN_SINK_CREEP_ODDS == 0) siren_creep_spawn(npc)->Update(); + if (!siren_is_anim_done(npc)) return; + npc.projectileCooldown = 0; + npc.state = SIREN_TELEPORT_MOVE; +} + +// Moving under the floor to just above her target, trailing creep, until near or out of time. +static void siren_teleport_move_update(Entity_NPC& npc, int frames) +{ + Vector goal = vector_add(npc.CalcTargetPosition(0), vector_make(0, -SIREN_TELEPORT_RISE)); + goal = g_game->room->GetClampedPositionImpl(goal, SIREN_TELEPORT_MARGIN, SIREN_TELEPORT_MARGIN, SIREN_TELEPORT_MARGIN, SIREN_TELEPORT_MARGIN); + npc.pathfinder.FindGridPath(goal, SIREN_TELEPORT_SPEED, 0, DIRECT_PATH_FAR); + int timer = npc.projectileCooldown += frames; + if ((timer > SIREN_TELEPORT_MIN && vector_distance(goal, npc.pos) < SIREN_TELEPORT_NEAR) || timer > SIREN_TELEPORT_MAX) + npc.state = SIREN_TELEPORT_END; + if ((Random() & 1) != 0) return; + + auto* creep = static_cast(siren_creep_spawn(npc)); + creep->SetTimeout(SIREN_CREEP_FRAMES); + creep->Update(); +} + +// Rising out of the floor. +static void siren_teleport_end_update(Entity_NPC& npc) +{ + npc.sprite.Play("TeleportEnd"); + if (npc.sprite.IsEventTriggered("Shoot")) + { + npc.entityCollisionClass = ENTCOLL_ALL; + npc.entityGridCollisionClass = GRIDCOLL_WALLS; + npc.shadowSize = npc.config->shadowSize; + } + if (!siren_is_anim_done(npc)) return; + npc.state = SIREN_IDLE; + npc.projectileCooldown = 0; + npc.stateFrame = SIREN_IDLE_FRAMES; + siren_cooldown_set(npc, SIREN_COOLDOWN_TELEPORT, SIREN_TELEPORT_WAIT); +} + +// Whether an angle is at least the fan's gap from another, both in degrees. +static bool siren_is_angle_apart(float angle, float other) +{ + float difference = angle - other; + if (std::abs(difference) > DEGREES_PER_TURN) difference = std::fmod(difference, DEGREES_PER_TURN); + if (difference > HALF_TURN_DEGREES) difference -= DEGREES_PER_TURN; + else if (difference < -HALF_TURN_DEGREES) difference += DEGREES_PER_TURN; + return std::abs(difference) >= SIREN_FAN_GAP; +} + +// The scream's fan: shots all around but for two gaps, one turning toward the target and one opposite. +static void siren_fan_fire(Entity_NPC& npc) +{ + Vector aimed = g_game->room->GetClampedPositionImpl(npc.GetPlayerTarget()->pos, SIREN_FAN_MARGIN, SIREN_FAN_MARGIN, + SIREN_FAN_MARGIN, SIREN_FAN_MARGIN); + float toward = vector_angle(vector_sub(aimed, npc.pos)); + float opposite = toward + HALF_TURN_DEGREES; + float near = (random_unit() - HALF) * SIREN_FAN_JITTER + toward; + float far = (random_unit() - HALF) * SIREN_FAN_JITTER + opposite; + if (npc.projectileCooldown > 0) near = angle_approach(npc.v1.x, near, SIREN_FAN_TURN); + npc.v1.x = near; + + ProjectileParams params; + params.fallingSpeedModifier -= SIREN_FAN_FALL; + params.fallingAccelModifier = SIREN_FAN_ACCEL; + params.bulletFlags = PROJECTILE_SINE_VELOCITY; + float shift = npc.projectileCooldown % SIREN_FAN_SHIFT_EVERY == 0 ? SIREN_FAN_GAP : 0; + for (float angle = 0; angle < DEGREES_PER_TURN; angle += SIREN_FAN_STEP) + if (siren_is_angle_apart(near, angle) && siren_is_angle_apart(far, angle)) + npc.FireProjectiles(npc.pos, vector_scale(vector_from_angle(angle + shift), SIREN_FAN_SPEED), PROJECTILES_SINGLE, params); +} + +// The scream pushes players, tears, bombs, pickups and enemies (not fires) away, less the farther. +static void siren_scream_push(Entity_NPC& npc) +{ + for (Entity* entity : g_game->room->entityList.updateEL) + { + if (entity == &npc) continue; + int kind = entity->type; + bool isThing = kind == ENTITY_PLAYER || kind == ENTITY_TEAR || kind == ENTITY_BOMB || kind == ENTITY_PICKUP; + if (!(is_npc_type(kind) && kind != ENTITY_FIREPLACE) && !isThing) continue; + + Vector away = vector_sub(entity->pos, npc.pos); + float push = SIREN_PUSH / (vector_length_squared(away) * SIREN_PUSH_FALLOFF + 1); + away = vector_normalized(away); + if (kind == ENTITY_PLAYER) push *= SIREN_PUSH_PLAYER; + else if (kind == ENTITY_TEAR) push *= SIREN_PUSH_TEAR; + float friction = entity->friction; + if (friction == 0) continue; + float strength = entity->speedMultiplier * push; + entity->velocity = vector_add(entity->velocity, vector_make(strength * away.x / friction, strength * away.y / friction)); + } +} + +// The scream: rings, fans of shots, shockwaves and a push. +static void siren_scream_update(Entity_NPC& npc, int frames) +{ + if (npc.projectileCooldown < 0) + { + npc.sprite.Play("Attack1Start"); + if (!npc.sprite.IsEventTriggered("Shoot")) return; + npc.projectileCooldown = 0; + effect_sound_play(SOUND_SIREN_SCREAM); + effect_sound_play(SOUND_SIREN_SCREAM_ATTACK); + return; + } + + if (siren_is_anim_done(npc)) npc.sprite.Play("Attack1Loop"); + int timer = npc.projectileCooldown; + if (siren_period_crossed(timer, frames, SIREN_RING_EVERY)) + { + Entity* ring = g_game->Spawn({.position = npc.pos, .type = ENTITY_EFFECT, .variant = EFFECT_SIREN_RING, .seed = Random()}); + ring->parent = &npc; + ring->posOffset = vector_make(0, SIREN_RING_HEIGHT); + } + if (siren_period_crossed(timer, frames, SIREN_FAN_EVERY)) siren_fan_fire(npc); + if (siren_period_crossed(timer, frames, SIREN_WAVE_EVERY)) + shockwave_make(vector_add(npc.pos, vector_make(0, SIREN_RING_HEIGHT)), SIREN_WAVE_STRENGTH, SIREN_WAVE_STRENGTH, SIREN_WAVE_FRAMES); + siren_scream_push(npc); + if ((npc.projectileCooldown += frames) > SIREN_SCREAM_FRAMES) + siren_attack_end(npc, "Attack1End", SIREN_COOLDOWN_SCREAM, SIREN_ATTACK_WAIT); +} + +// The song: rings of six wiggling magenta shots, her light glowing. +// The original's song is never picked, but it stays reachable through its state. +static void siren_song_update(Entity_NPC& npc, int frames) +{ + if (npc.projectileCooldown < 0) + { + npc.sprite.Play("Attack2Start"); + if (!npc.sprite.IsEventTriggered("Shoot")) return; + npc.projectileCooldown = 0; + siren_glow(npc, SIREN_SING_COLOR, SIREN_DARK_COLOR); + return; + } + + if (siren_is_anim_done(npc)) npc.sprite.Play("Attack2Loop"); + if (siren_period_crossed(npc.projectileCooldown, frames, SIREN_SONG_EVERY)) + { + ProjectileParams params; + params.fallingSpeedModifier -= SIREN_FAN_FALL; + params.fallingAccelModifier = SIREN_SONG_ACCEL; + params.color = SIREN_SING_COLOR; + params.bulletFlags = PROJECTILE_WIGGLE; + float base = random_unit() * SIREN_SONG_STEP; + for (float angle = 0; angle < DEGREES_PER_TURN; angle += SIREN_SONG_STEP) + npc.FireProjectiles(npc.pos, vector_scale(vector_from_angle(angle + base), SIREN_SONG_SPEED), PROJECTILES_SINGLE, params); + } + if ((npc.projectileCooldown += frames) <= SIREN_SONG_FRAMES) return; + siren_attack_end(npc, "Attack2End", SIREN_COOLDOWN_SONG, SIREN_ATTACK_WAIT); + siren_glow(npc, SIREN_DARK_COLOR, SIREN_SING_COLOR); +} + +// The charm song: on its third frame, charms on up to three free familiars picked at random. +static void siren_charm_song_update(Entity_NPC& npc, int frames) +{ + if (npc.projectileCooldown < 0) + { + npc.sprite.Play("Attack2BStart"); + if (!npc.sprite.IsEventTriggered("Shoot")) return; + effect_sound_play(SOUND_SIREN_SING); + npc.projectileCooldown = 0; + siren_glow(npc, SIREN_CHARM_GLOW_COLOR, SIREN_DARK_COLOR); + return; + } + + if (siren_is_anim_done(npc)) npc.sprite.Play("Attack2BLoop"); + int timer = npc.projectileCooldown; + if (timer < SIREN_CHARM_FRAME && timer + frames > SIREN_CHARM_FRAME - 1) + { + effect_sound_play(SOUND_SIREN_SING_STAB); + std::vector free; + for (Entity_Familiar* familiar : familiar_query(-1)) + if (is_familiar_charmable(*familiar) && !familiar->HasEntityFlags(FLAG_CHARM)) free.push_back(familiar); + int remaining = (int)free.size(); + for (int i = remaining - 1, picked = 0; i >= 0 && picked < SIREN_CHARM_PICKS; i--, picked++, remaining--) + { + int swap = remaining != 0 ? (int)(Random() % (uint32_t)remaining) : 0; + std::swap(free[i], free[swap]); + siren_charm_familiar(npc, *free[i]); + } + } + if ((npc.projectileCooldown += frames) <= SIREN_SONG_FRAMES) return; + siren_attack_end(npc, "Attack2BEnd", SIREN_COOLDOWN_CHARM, SIREN_ATTACK_WAIT); + siren_glow(npc, SIREN_DARK_COLOR, SIREN_CHARM_GLOW_COLOR); +} + +// The recall: minions to fill her line to three, her player's orbit reset, then hovering. +static void siren_recall_update(Entity_NPC& npc) +{ + npc.sprite.Play("Recall"); + if (npc.sprite.IsEventTriggered("Sound")) + { + effect_sound_play(SOUND_SIREN_MINION_SMOKE); + Entity_Player* first = g_game->GetPlayer(0); + for (int missing = SIREN_RECALL_LINE - siren_charmed_count(npc); missing > 0; missing--) + { + auto* minion = static_cast(g_game->Spawn({.position = npc.pos, .spawner = first, .type = ENTITY_FAMILIAR, + .variant = Entity_Familiar::SIREN_MINION, .seed = Random()})); + minion->ClearEntityFlags(FLAG_APPEAR); + minion->Update(); + minion->siren_charm(&npc, npc.sirenPlayerEntity); + Entity* poof = g_game->Spawn({.position = minion->pos, .type = ENTITY_EFFECT, .variant = EFFECT_POOF01, .seed = Random()}); + poof->SetColor(SIREN_MINION_POOF, -1, COLOR_PRIORITY_DEFAULT, false, true); + poof->Update(); + } + Entity_Player& player = *npc.sirenPlayerEntity; + player.AddEntityFlags(FLAG_SPAWN_STICKY_SPIDERS); + player.targetPosition = vector_make(0, SIREN_ORBIT_MAX); + } + if (!siren_is_anim_done(npc)) return; + npc.sprite.Play("HoverStart"); + npc.state = SIREN_HOVER; +} + +// Hovering over her line until it is gone, or slashing once she has waited (or been hurt) enough. +static void siren_hover_update(Entity_NPC& npc, int frames) +{ + if (siren_is_anim_done(npc)) npc.sprite.Play("HoverLoop"); + npc.pathfinder.FindGridPath(npc.CalcTargetPosition(0), SIREN_HOVER_SPEED, 0, DIRECT_PATH_FAR); + if (siren_period_crossed(npc.projectileCooldown, frames, SIREN_HOVER_CHECK) && siren_charmed_count(npc) == 0) + { + npc.sprite.Play("HoverEnd"); + npc.state = SIREN_IDLE; + npc.stateFrame = 0; + siren_cooldown_set(npc, SIREN_COOLDOWN_RECALL, SIREN_RECALL_WAIT); + return; + } + npc.projectileCooldown += frames; + if (npc.pendingDamage > 0) npc.projectileCooldown += (int)std::ceil(npc.pendingDamage); + if (npc.projectileCooldown <= SIREN_HOVER_FRAMES) return; + npc.sprite.Play(npc.GetPlayerTarget()->pos.x - npc.pos.x > 0 ? "SlashRight" : "SlashLeft"); + npc.state = SIREN_SLASH; +} + +// Reviving on a stolen life. +// The original compares the familiar's variant (Dead Cat 40, 1up 41) with Dead Cat's collectible id, so she always +// comes back with all her health. +static void siren_revive_update(Entity_NPC& npc) +{ + npc.sprite.Play("Revive"); + if (npc.sprite.IsEventTriggered("Sound")) + { + npc.PlaySound(SOUND_POWERUP1, 1, SIREN_REVIVE_SOUND_DELAY, false, 1); + npc.shadowSize = npc.config->shadowSize; + npc.health = (int)npc.v2.x == COLLECTIBLE_DEAD_CAT ? npc.maxHitPoints * SIREN_DEAD_CAT_HEALTH : npc.maxHitPoints; + npc.entityCollisionClass = ENTCOLL_ALL; + } + if (!siren_is_anim_done(npc)) return; + npc.state = SIREN_IDLE; + npc.ClearEntityFlags(SIREN_REMAINS_FLAGS); + npc.stateFrame = 0; + npc.isInvincible = false; + npc.sirenPlayerEntity->isPlayingExtraAnimation = false; + npc.sirenPlayerEntity->isPlayingItemAnimation = false; +} + +// 005911b0 (NpcAI::siren_release_stolen_items) Once her death animation ends: a stolen 1up or Dead Cat (taken from its +// player) revives her, else her remains spawn and roll to free floor. +static void siren_release_stolen_items(Entity_NPC& npc) +{ + if (!npc.sprite.animState.animData || npc.sprite.animState.isPlaying || npc.sprite.animState.GetAnimation() != "Death") return; + + for (Entity* entity : g_game->room->entityList.updateEL) + { + if (entity->type != ENTITY_FAMILIAR) continue; + auto& familiar = static_cast(*entity); + if (familiar.player != npc.sirenPlayerEntity) continue; + if (familiar.variant != Entity_Familiar::ONE_UP && familiar.variant != Entity_Familiar::DEAD_CAT) continue; + + npc.v2.x = (float)familiar.variant; + npc.AddEntityFlags(SIREN_REMAINS_FLAGS); + npc.isDead = false; + npc.state = SIREN_REVIVE; + npc.entityCollisionClass = ENTCOLL_NONE; + npc.isInvincible = true; + Entity_Player* owner = familiar.sirenOriginalPlayer ? familiar.sirenOriginalPlayer : familiar.player; + int item = familiar.variant == COLLECTIBLE_DEAD_CAT ? COLLECTIBLE_DEAD_CAT : COLLECTIBLE_1UP; + if (owner->GetCollectibleNum(item, ITEM_CHECK_OWNED) > 0) owner->RemoveCollectible(item, false, 0, true); + npc.sirenPlayerEntity->AnimateCollectible(item, "Pickup", "PlayerPickupSparkle"); + break; + } + if (!npc.isDead) return; + + Entity* remains = g_game->Spawn({.position = npc.pos, .type = ENTITY_SIREN, .variant = SIREN_REMAINS, .seed = npc.initSeed}); + auto& spot = static_cast(*remains).targetPosition; + if (room_grid_collision_at(npc.pos) == COLLISION_NONE) spot = npc.pos; + else spot = room_free_pickup_position_find({.position = npc.pos, .step = SIREN_REMAINS_SPOT}); +} + +// 0058ec70 NpcAI::ENTITY_SIREN_main The Siren herself: her player mirrored before the update, then her state, her +// cooldowns, her player's orbit and aim, and her line freed when she dies. +static void siren_main_update(Entity_NPC& npc) +{ + if (npc.aiCallPhase == AI_PHASE_PRE_UPDATE) + { + if (Entity_Player* player = npc.sirenPlayerEntity) + { + player->pos = npc.pos; + player->velocity = npc.velocity; + } + if (npc.state == SIREN_DEATH) siren_release_stolen_items(npc); + return; + } + + int frames = npc.update_ticks_get(); + npc.friction *= SIREN_FRICTION; + switch (npc.state) + { + case NPC_STATE_INIT: + siren_init(npc); + break; + case SIREN_IDLE: + siren_idle_update(npc, frames); + break; + case SIREN_TELEPORT_MOVE: + siren_teleport_move_update(npc, frames); + break; + case SIREN_SLASH: + siren_slash_update(npc, frames); + break; + case SIREN_TELEPORT: + siren_teleport_update(npc); + break; + case SIREN_TELEPORT_END: + siren_teleport_end_update(npc); + break; + case SIREN_SCREAM: + siren_scream_update(npc, frames); + break; + case SIREN_SONG: + siren_song_update(npc, frames); + break; + case SIREN_CHARM_SONG: + siren_charm_song_update(npc, frames); + break; + case SIREN_LUNGE: + siren_lunge_update(npc, frames); + break; + case SIREN_RECALL: + siren_recall_update(npc); + break; + case SIREN_HOVER: + siren_hover_update(npc, frames); + break; + case SIREN_REVIVE: + siren_revive_update(npc); + break; + default: + break; + } + + for (int tick = 0; tick < npc.GetIntervalTicks(SIREN_COOLDOWN_TICK, 0); tick++) + for (int which = 0; which < SIREN_COOLDOWN_COUNT; which++) + if (int left = siren_cooldown_get(npc, (SirenCooldown)which)) siren_cooldown_set(npc, (SirenCooldown)which, left - 1); + if (npc.projectileDelay > 0) npc.projectileDelay -= frames; + + Entity_Player& player = *npc.sirenPlayerEntity; + player.targetPosition.x += player.targetPosition.y * npc.speedMultiplier; + if (npc.child) siren_player_aim(player, vector_make(0, 0)); + else + { + siren_player_aim(player, vector_normalized(vector_sub(npc.GetPlayerTarget()->pos, npc.pos))); + player.targetPosition.y = std::max(player.targetPosition.y - npc.speedMultiplier * SIREN_ORBIT_SLOWING, SIREN_ORBIT_MIN); + } + if (npc.isDead) + { + for (Entity* entity : g_game->room->entityList.updateEL) + { + if (entity->type != ENTITY_FAMILIAR) continue; + auto& familiar = static_cast(*entity); + if (familiar.player == npc.sirenPlayerEntity && familiar.variant != Entity_Familiar::ONE_UP && + familiar.variant != Entity_Familiar::DEAD_CAT) + familiar.RemoveFromPlayer(); + } + player.ClearEntityFlags(FLAG_SPAWN_STICKY_SPIDERS); + } + player.Update(); +} + +// Her remains: appearing, gliding to their spot with a bone sound, and breaking under an explosion or a crush. +static void siren_remains_update(Entity_NPC& npc) +{ + if (npc.state == NPC_STATE_INIT) + { + npc.entityCollisionClass = ENTCOLL_NONE; + npc.sprite.Play("Appear"); + npc.state = NPC_STATE_IDLE; + npc.ClearEntityFlags(FLAG_APPEAR); + npc.AddEntityFlags(SIREN_REMAINS_FLAGS); + } + else if (npc.state == NPC_STATE_IDLE) + { + if (npc.sprite.animState.animData && npc.sprite.animState.IsEventTriggered("Sound")) + { + npc.PlaySound(SOUND_BONE_BOUNCE, 1, 2, false, 1); + npc.entityCollisionClass = ENTCOLL_ALL; + } + npc.velocity = vector_sub(npc.targetPosition, npc.pos); + } + + if (!npc.isDead) + { + if (npc.pendingDamage <= 0) return; + if (npc.pendingDamageFlags & SIREN_BREAK_DAMAGE) npc.isDead = true; + npc.damageEvents.clear(); + npc.pendingDamage = 0; + npc.pendingDamageFlags = 0; + if (!npc.isDead) return; + } + + for (int i = 0; i < SIREN_CHIPS; i++) + { + Vector direction = vector_from_angle(random_unit() * DEGREES_PER_TURN); + float scatter = random_unit(); + Vector position = vector_add(npc.pos, vector_scale(direction, scatter * SIREN_CHIP_SCATTER)); + g_game->Spawn({.position = position, .velocity = vector_scale(direction, SIREN_CHIP_SPEED), .subType = SIREN_CHIP_SUBTYPE, + .type = ENTITY_EFFECT, .variant = EFFECT_ROCK_PARTICLE, .seed = Random()}) + ->Update(); + } + if (g_manager->persistentGameData.TryUnlock(ACHIEVEMENT_FORGOTTEN_LULLABY)) + { + g_game->Spawn({.position = npc.pos, .velocity = Entity_Pickup::GetRandomPickupVelocity(npc.pos, nullptr, 0), .subType = TRINKET_FORGOTTEN_LULLABY, + .type = ENTITY_PICKUP, .variant = PICKUP_TRINKET, .seed = npc.initSeed}); + return; + } + RNG rng = {npc.initSeed, SIREN_ROCK_SHIFT_1, SIREN_ROCK_SHIFT_2, SIREN_ROCK_SHIFT_3}; + GridEntity_Rock::SpawnDrops({.position = npc.pos, .source = &npc, .type = GRID_ROCK_ALT, .origin = ROCK_DROP_LANDED, + .backdropType = SIREN_ROCK_BACKDROP, .seed = rng.Next()}); +} + +// The carrier: while it flies its charmed line pulses, and past 15 frames a familiar out of the room or a wall breaks +// it into a ring of shots that hurts the line. +static void siren_carrier_update(Entity_NPC& npc) +{ + if (npc.state == NPC_STATE_INIT) + { + npc.state = NPC_STATE_IDLE; + npc.ClearEntityFlags(FLAG_APPEAR); + npc.AddEntityFlags(SIREN_CARRIER_FLAGS); + return; + } + auto* siren = static_cast(npc.parent.get()); + if (!siren || !siren->IsType(ENTITY_SIREN, 0, -1)) return npc.Remove(); + + std::vector line; + for (Entity* helper : Entity_NPC::QueryNPCsType(ENTITY_SIREN_HELPER, -1)) + { + if (helper->parent.get() != siren) continue; + auto* familiar = static_cast(helper->target.get()); + if (familiar && familiar->HasEntityFlags(FLAG_CHARM) && familiar->is_following() && familiar->player == siren->sirenPlayerEntity) + line.push_back(familiar); + } + if (line.empty()) return npc.Remove(); + + if (npc.GetIntervalTicks(SIREN_CARRY_PULSE_EVERY, 0) != 0) + for (Entity_Familiar* familiar : line) familiar->SetColor(SIREN_CARRY_PULSE, SIREN_CARRY_PULSE_EVERY, 0, true, true); + Room& room = *g_game->room; + if (npc.updateTime > SIREN_CARRY_ARMED) + for (Entity_Familiar* familiar : line) + { + if (room.IsPositionInRoom(familiar->pos, SIREN_CARRY_MARGIN)) continue; + npc.isDead = true; + break; + } + if (npc.isCollidesWithGrid) npc.isDead = true; + else if (!npc.isDead) return; + + ProjectileParams params; + Vector clamped = room.GetClampedPositionImpl(npc.pos, SIREN_CARRY_CLAMP, SIREN_CARRY_CLAMP, SIREN_CARRY_CLAMP, SIREN_CARRY_CLAMP); + float shots = std::clamp((float)line.size() * SIREN_CARRY_SHOTS, SIREN_CARRY_SHOTS, SIREN_CARRY_SHOTS_MAX); + npc.FireProjectiles(clamped, vector_make(SIREN_CARRY_SHOT_SPEED, (float)(int)shots), PROJECTILES_RING, params); + npc.pos = clamped; + game_shake_screen(SIREN_CARRY_SHAKE); + for (Entity_Familiar* familiar : line) familiar->TakeDamage(SIREN_CARRY_DAMAGE, 0, EntityRef(), SIREN_CARRY_COUNTDOWN); + siren->sirenPlayerEntity->ClearEntityFlags(FLAG_SPAWN_STICKY_SPIDERS); + npc.Remove(); +} + +// 00591460 NpcAI::ENTITY_SIREN (904): the Siren, her remains or her carrier. +void boss_siren_update(Entity_NPC& npc) +{ + if (npc.variant == 0) siren_main_update(npc); + else if (npc.variant == SIREN_REMAINS) siren_remains_update(npc); + else if (npc.variant == SIREN_CARRIER) siren_carrier_update(npc); +} + +// 00591cc0 NpcAI::ENTITY_SIREN_HELPER (966): bound to a charmed familiar, it takes the familiar's size and place, +// keeps it charmed and pink, flashes it when hit, and kills a wisp with it. +void siren_helper_update(Entity_NPC& npc) +{ + auto* familiar = npc.target && npc.target->type == ENTITY_FAMILIAR ? static_cast(npc.target.get()) : nullptr; + if (npc.aiCallPhase != AI_PHASE_PRE_UPDATE) + { + if (npc.state != NPC_STATE_INIT) return; + npc.aiCallFlags |= AI_CALL_PRE_UPDATE; + npc.AddEntityFlags(FLAG_NO_STATUS_EFFECTS); + npc.state = NPC_STATE_IDLE; + npc.collisionDamage = 1; + if (npc.sprite.SetAnimation("Fly") && npc.sprite.animState.animData) + { + npc.sprite.animState.SetFrameFloat(0); + if (npc.sprite.animState.animData) npc.sprite.animState.isPlaying = false; + } + npc.sprite.GetLayer(0)->isVisible = false; + if (!familiar) return; + if (familiar->sirenHelper.get() != &npc) familiar->sirenHelper = &npc; + npc.SetSize(familiar->size, familiar->config->collisionRadiusMulti, familiar->config->gridCollisionPoints); + return; + } + + if (!npc.parent || !familiar || npc.HasEntityFlags(FLAG_CHARM)) return npc.Remove(); + npc.pos = familiar->pos; + npc.velocity = familiar->velocity; + npc.friction = familiar->friction; + if (familiar->charmedCountdown < SIREN_CHARM_FRAMES) + { + familiar->AddEntityFlags(FLAG_CHARM); + familiar->charmedCountdown = SIREN_CHARM_FRAMES; + if (familiar->variant != Entity_Familiar::SIREN_MINION) + { + bool isTinted = false; + for (ColorParams& tint : familiar->colorParams) + { + if (tint.priority != SIREN_CHARM_PRIORITY) continue; + tint.remaining = familiar->charmedCountdown; + tint.duration = familiar->charmedCountdown; + isTinted = true; + } + if (!isTinted) familiar->SetColor(SIREN_CHARM_TINT, familiar->charmedCountdown, SIREN_CHARM_PRIORITY, false, true); + } + } + if (npc.pendingDamage > 0) familiar->SetColor(SIREN_HELPER_HIT_COLOR, 1, 0, false, true); + if (npc.isDead && familiar->variant == Entity_Familiar::WISP) familiar->Kill(EntityRef()); +} diff --git a/src/debug_renderer.cpp b/src/debug_renderer.cpp new file mode 100644 index 0000000..56a1885 --- /dev/null +++ b/src/debug_renderer.cpp @@ -0,0 +1,320 @@ +#include "debug_renderer.h" +#include "entity.h" +#include "entity_player.h" +#include "font.h" +#include "fx_layers.h" +#include "game.h" +#include "item_pool.h" +#include "manager.h" +#include "menu_collection.h" +#include "minimap.h" +#include "render_passes.h" +#include "room.h" +#include "room_config.h" +#include +#include + +constexpr KColor SHAPE_DEFAULT_COLOR = kcolor_rgba(1, 1, 0, 1); + +// The player debug info's rows (debug 12): 120 wide (300 for history) and 8 apart under a title and its underline 3 +// below it, in columns 128 apart, its text drawn 5 high over a half black row. +constexpr KColor INFO_ROW_COLOR = kcolor_rgba(0, 0, 0, 0.5f); +constexpr KColor INFO_GAIN_COLOR = kcolor_rgba(0, 1, 0, 1); +constexpr KColor INFO_TRINKET_COLOR = kcolor_rgba(0, 1, 1, 1); +constexpr KColor INFO_PERSISTENT_COLOR = kcolor_rgba(1, 1, 0, 1); +constexpr float INFO_ROW_WIDTH = 120; +constexpr float INFO_HISTORY_ROW_WIDTH = 300; +constexpr float INFO_ROW_FILL_HEIGHT = 7; +constexpr float INFO_COLUMN_WIDTH = 128; +constexpr float INFO_ROW_HEIGHT = 8; +constexpr float INFO_UNDERLINE_GAP = 3; +constexpr float INFO_TEXT_RAISE = 5; +constexpr size_t INFO_NAME_LENGTH = 32; +constexpr int INFO_HEART_BITS = 32; +constexpr std::string_view INFO_UNDERLINE = "_____________________"; +constexpr std::string_view INFO_FORMS_CATEGORY = "Default"; + +// The segments a debug circle of a radius is drawn in over each half turn. +int debug_segments_get(float radius) +{ + return (int)std::clamp(radius * TAU / DEBUG_SEGMENT_LENGTH, DEBUG_SEGMENTS_MIN, DEBUG_SEGMENTS_MAX) * 2; +} + +// The hitspheres debug view (debug 6) of an entity's attack: its capsule as the entity's shape, for one frame. +void debug_capsule_show(Entity& entity, const Capsule& capsule) +{ + if (!(g_game->debugFlags & DEBUG_HITSPHERES)) return; + + Shape& shape = entity.GetDebugShape(true); + shape.timeout = 1; + shape.Capsula(capsule); +} + +// 0042eef0 Adds a capsule: its center, its direction, then its radius and half length as one point. +void Shape::Capsula(const Capsule& capsule) +{ + points.push_back(capsule.center); + points.push_back(capsule.direction); + points.push_back(vector_make(capsule.radius, capsule.halfLength)); + + uint16_t last = (uint16_t)points.size(); + commands.insert(commands.end(), {SHAPE_DRAW_CAPSULE, (uint16_t)(last - 3), (uint16_t)(last - 2), (uint16_t)(last - 1)}); +} + +// 0042eb10 The shape of an index, cleared and given a new timeout on a reset, or a new one at the end when none has +// it. Index -1 always adds one. +Shape& DebugRenderer::Get(int index, bool isReset) +{ + auto found = index == -1 ? shapes.end() : std::ranges::find(shapes, index, &Shape::index); + if (found == shapes.end()) + { + Shape& shape = shapes.emplace_back(); + shape.index = index; + return shape; + } + if (!isReset) return *found; + + found->colors.clear(); + found->points.clear(); + found->commands.clear(); + found->texts.clear(); + found->timeout = SHAPE_TIMEOUT; + return *found; +} + +// Part of 006fadc0: shapes out of time are dropped, the others count down. +void DebugRenderer::update() +{ + std::erase_if(shapes, [](const Shape& shape) { return shape.timeout == 0; }); + for (Shape& shape : shapes) + if (shape.timeout > 0) shape.timeout--; +} + +// Draws one shape's commands from room positions to the screen. +static void shape_render(const Shape& shape) +{ + Vector scroll = g_game->room->renderScrollOffset; + auto screen = [&](uint16_t point) { return vector_add(render_position_get(shape.points[point], RENDER_SNAPPED), scroll); }; + auto line = [](Vector from, Vector to, const KColor& color) { render_color_quad(from, to, color, color, 1); }; + KColor color = SHAPE_DEFAULT_COLOR; + + for (size_t i = 0; i < shape.commands.size(); i++) + { + const uint16_t* args = &shape.commands[i + 1]; + switch (shape.commands[i]) + { + case SHAPE_DRAW_TEXT: + { + FontSettings settings; + g_manager->font8_LuaMiniOutlined.DrawString(shape.texts[args[1]], screen(args[0]), vector_make(1, 1), color, + settings); + i += 2; + break; + } + case SHAPE_DRAW_CAPSULE: + { + Vector center = screen(args[0]); + Vector direction = shape.points[args[1]]; + Vector size = shape.points[args[2]]; + Vector axis = vector_scale(direction, size.y); + Vector side = vector_scale(vector_rotated(direction, RIGHT_ANGLE_DEGREES), size.x); + auto at = [&](Vector offset) { return vector_add(center, vector_scale(offset, ROOM_SCREEN_SCALE)); }; + int segments = debug_segments_get(size.x); + + Vector front = at(vector_add(side, axis)); + Vector back = at(vector_sub(side, axis)); + line(back, front, color); + line(at(vector_sub(vector_scale(axis, -1), side)), at(vector_sub(axis, side)), color); + for (int segment = 1; segment <= segments; segment++) + { + float angle = (float)segment * HALF_TURN_DEGREES / (float)segments; + Vector frontTo = at(vector_add(vector_rotated(side, -angle), axis)); + Vector backTo = at(vector_sub(vector_rotated(side, angle), axis)); + line(front, frontTo, color); + line(back, backTo, color); + front = frontTo; + back = backTo; + } + i += 3; + break; + } + case SHAPE_DRAW_CIRCLE: + { + Vector center = screen(args[0]); + float radius = shape.points[args[1]].x; + int segments = debug_segments_get(radius); + auto at = [&](float degrees) + { return vector_add(center, vector_scale(vector_from_angle(degrees), radius * ROOM_SCREEN_SCALE)); }; + + Vector from = at(0); + for (int segment = 1; segment <= segments * 2; segment++) + { + Vector to = at((float)segment * HALF_TURN_DEGREES / (float)segments); + line(from, to, color); + from = to; + } + i += 2; + break; + } + case SHAPE_DRAW_RECT: + case SHAPE_DRAW_RECT_OUTLINE: + { + Vector size = vector_scale(vector_sub(shape.points[args[1]], shape.points[args[0]]), ROOM_SCREEN_SCALE); + KAGE::Graphics::ColorQuad quad = KAGE::Graphics::color_quad_rect(screen(args[0]), size, color); + if (shape.commands[i] == SHAPE_DRAW_RECT) render_color_shader_pass(quad); + else quad_outline_render(quad, 1); + i += 2; + break; + } + case SHAPE_DRAW_LINE: + line(screen(args[0]), screen(args[1]), color); + i += 2; + break; + case SHAPE_DRAW_COLOR: + color = shape.colors[args[0]]; + i++; + break; + } + } +} + +// 0042dbb0 Draws every shape over the room. +void DebugRenderer::Render() +{ + for (const Shape& shape : shapes) shape_render(shape); +} + +// (007cf9a0) Draws a line of debug text over a position, giving its width. +static float info_text_draw(Vector position, const KColor& color, const std::string& text) +{ + Font& font = g_manager->font8_LuaMiniOutlined; + FontSettings settings; + font.DrawString(text, vector_make(position.x, position.y - INFO_TEXT_RAISE), vector_make(1, 1), color, settings); + return (float)(uint32_t)font.GetStringWidth(text); +} + +// A row of the player debug info: its half black background, then its text. +static float info_row_draw(Vector position, const KColor& color, const std::string& text, float width = INFO_ROW_WIDTH) +{ + Vector size = vector_make(width, INFO_ROW_FILL_HEIGHT); + render_color_shader_pass(KAGE::Graphics::color_quad_rect(position, size, INFO_ROW_COLOR)); + return info_text_draw(position, color, text); +} + +// (007cfa90) An item's English name cut to 32 characters, its kind and id while it has none, NULL for no item. +static std::string info_item_name(ItemConfig_Item* item) +{ + if (!item) return "NULL"; + if (item->name.empty()) return std::format("{}{}", item->type == ITEM_NULL ? 'n' : item->type == ITEM_TRINKET ? 't' : 'c', item->id); + return item->GetLocalizedName(LANGUAGE_ENGLISH).substr(0, INFO_NAME_LENGTH); +} + +// A count's bits from the lowest, '|' for a set bit and '.' for a clear one. +static std::string info_bits(int value) +{ + std::string bits; + for (int bit = 0; bit < INFO_HEART_BITS; bit++) bits += ((uint32_t)value >> bit) & 1 ? '|' : '.'; + return bits; +} + +// The items the player owns (green the ones counted more than owned, red the fewer), its own and the room's +// temporary effects (yellow the persistent ones) and its hearts and transformations, in three columns. +static void info_items_render(Entity_Player& player, Vector origin) +{ + ItemConfig& items = g_manager->itemConfig; + Vector row = origin; + auto title = [&](std::string_view text) + { + info_row_draw(row, WHITE, std::string(text)); + info_text_draw(vector_make(row.x, row.y + INFO_UNDERLINE_GAP), WHITE, std::string(INFO_UNDERLINE)); + row.y += INFO_UNDERLINE_GAP + INFO_ROW_HEIGHT; + }; + auto line = [&](const KColor& color, const std::string& text) + { + info_row_draw(row, color, text); + row.y += INFO_ROW_HEIGHT; + }; + + title("Player items"); + for (size_t id = 0; id < player.collectibleCounts.size(); id++) + { + int count = player.collectibleCounts[id]; + int owned = player.GetCollectibleNum((int)id, ITEM_CHECK_MODIFIED); + if (owned == 0 && count == 0) continue; + + float width = info_row_draw(row, WHITE, std::format("{}: {}", info_item_name(items.GetCollectible((int)id)), count)); + Vector after = vector_make(row.x + width, row.y); + if (count < owned) info_text_draw(after, INFO_GAIN_COLOR, std::format(" +{}", owned - count)); + else if (owned < count) info_text_draw(after, RED, std::format(" {}", owned - count)); + row.y += INFO_ROW_HEIGHT; + } + + row = vector_make(origin.x + INFO_COLUMN_WIDTH, origin.y); + title("Player effects"); + for (const TemporaryEffect& effect : player.temporaryEffects.effects) + line(effect.item->isPersistentEffect ? INFO_PERSISTENT_COLOR : WHITE, + std::format("{} x{}: {}", info_item_name(effect.item), effect.count, effect.cooldown)); + for (const TemporaryEffect& effect : g_game->room->temporaryEffects.effects) + line(INFO_TRINKET_COLOR, std::format("[R] {} x{}: {}", info_item_name(effect.item), effect.count, effect.cooldown)); + + row = vector_make(origin.x + INFO_COLUMN_WIDTH * 2, origin.y); + line(WHITE, std::format("Hearts: {}({} rotten)/{}(+{} bone)", player.redHearts, player.rottenHearts, player.maxHearts, + player.boneHearts)); + line(WHITE, std::format(" + {} soul + {} eternal", player.soulHearts, player.eternalHearts)); + line(WHITE, "Black hearts: " + info_bits(player.blackHearts)); + line(WHITE, "Bone hearts.: " + info_bits(player.boneHearts)); + line(WHITE, std::format("Heart limit: {} (base:{}, broken:{})\n", player.GetHeartLimit(false), player.GetHeartLimit(true), + player.brokenHearts)); + line(WHITE, std::format("Golden hearts: {}", player.goldenHearts)); + line(WHITE, std::format("Strength HP given: {}", player.strengthMaxHearts)); + line(WHITE, std::format("HP overflow from items: {}", player.itemHeartsOverflow)); + line(WHITE, std::format("Greed's Gullet: {} (overflow:{})", player.greedsGulletHearts, player.greedsGulletOverflow)); + line(WHITE, ""); + + StringTable& table = g_manager->stringTable; + for (int form = 0; form < PLAYER_FORM_SLOTS; form++) + { + ItemConfig_PlayerForm* config = form < (int)items.playerForms.size() ? items.playerForms[form].get() : nullptr; + if (!config) continue; + + std::string_view name = config->name; + bool isMissing = true; + if (name.starts_with('#')) + { + std::string_view localized = table.get_string(INFO_FORMS_CATEGORY, LANGUAGE_ENGLISH, name.substr(1), &isMissing); + if (!isMissing) name = localized; + } + line(WHITE, std::format("{}: {}", name, player.playerForms[form])); + } +} + +// The player's history in pickup order with when and where each was taken, trinkets in cyan. +static void info_history_render(Entity_Player& player, Vector origin) +{ + ItemConfig& items = g_manager->itemConfig; + Vector row = origin; + + info_row_draw(row, WHITE, "History"); + info_text_draw(vector_make(row.x, row.y + INFO_UNDERLINE_GAP), WHITE, std::string(INFO_UNDERLINE)); + row.y += INFO_UNDERLINE_GAP; + for (const HistoryItem& entry : player.history.historyItems) + { + row.y += INFO_ROW_HEIGHT; + ItemConfig_Item* item = entry.isTrinket ? items.GetTrinket((uint32_t)entry.id) : items.GetCollectible(entry.id); + bool isPool = entry.itemPoolType >= 0 && entry.itemPoolType < POOL_COUNT; + info_row_draw(row, entry.isTrinket ? INFO_TRINKET_COLOR : WHITE, + std::format("{}: time: {}, stage: {}.{}, room type: {}, pool: {}", info_item_name(item), entry.time, + entry.levelStage, entry.stageType, room_type_name(entry.roomType), + isPool ? POOL_NAMES[entry.itemPoolType] : std::string_view()), + INFO_HISTORY_ROW_WIDTH); + } +} + +// 007cfba0 (Game::render_debug_player_info) The player debug info (debug 12) at a position: the player's history +// while the large map shows, its items, effects and hearts otherwise. +void player_debug_info_render(Entity_Player& player, Vector position) +{ + Vector shown = g_game->minimap.GetDisplayedSize(); + if (shown.x == DEFAULT_DISPLAYED_SIZE && shown.y == DEFAULT_DISPLAYED_SIZE) info_items_render(player, position); + else info_history_render(player, position); +} diff --git a/src/debug_renderer.h b/src/debug_renderer.h new file mode 100644 index 0000000..3d7f30f --- /dev/null +++ b/src/debug_renderer.h @@ -0,0 +1,58 @@ +#pragma once + +#include "capsule.h" +#include +#include +#include +#include + +// The frames a new or reset debug shape stays drawn. +constexpr int SHAPE_TIMEOUT = 5; +// Debug circles and capsule ends are drawn in segments about 10 long, from 2 to 12 to the quarter turn, doubled. +constexpr float DEBUG_SEGMENT_LENGTH = 10; +constexpr float DEBUG_SEGMENTS_MIN = 2; +constexpr float DEBUG_SEGMENTS_MAX = 12; +// The player debug info's distance from the screen's top left. +constexpr float DEBUG_INFO_MARGIN = 10; + +// What a shape's command draws, followed in its stream by the indexes it reads. +enum ShapeCommand : uint16_t +{ + SHAPE_DRAW_TEXT = 0xfff9, + SHAPE_DRAW_CAPSULE, + SHAPE_DRAW_CIRCLE, + SHAPE_DRAW_RECT, + SHAPE_DRAW_RECT_OUTLINE, + SHAPE_DRAW_LINE, + SHAPE_DRAW_COLOR +}; + +// One debug drawing (Shape): a stream of commands indexing its colors, points and texts, drawn yellow until a color +// command, every frame until its timeout runs out. A negative timeout never runs out. +// Copies and destruction (0042f850) are the defaults. +struct Shape +{ + std::vector colors; + std::vector points; + std::vector texts; + std::vector commands; + int index = -1; + int timeout = SHAPE_TIMEOUT; + + void Capsula(const Capsule& capsule); +}; + +// The debug renderer (DebugRenderer): the shapes the hitspheres debug view adds, found by their owner's index. +class DebugRenderer +{ +public: + std::list shapes; + + Shape& Get(int index, bool isReset); + void Render(); + void update(); +}; + +int debug_segments_get(float radius); +void debug_capsule_show(Entity& entity, const Capsule& capsule); +void player_debug_info_render(Entity_Player& player, Vector position); diff --git a/src/entity.cpp b/src/entity.cpp index 2316812..ddc15f0 100644 --- a/src/entity.cpp +++ b/src/entity.cpp @@ -39,11 +39,8 @@ constexpr uint32_t DEBUG_EFFECT_POSITION_ARGB = 0xffffa500; constexpr std::array DEBUG_GRID_COLLISION_ARGB = {0xff000000, 0xff8b0000, 0xff006400, 0xffffff00, 0xffffa500, 0xffff0000, 0xff00ffff, 0xffff00ff}; constexpr std::array 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. +// A position's cross half a side. 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; @@ -1149,7 +1146,7 @@ void Entity::PostRender() 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; + int halfSegments = debug_segments_get(size); auto angleGet = [&](int segment) { return (float)segment * HALF_TURN_DEGREES / (float)halfSegments; }; if (sizeMulti.x == 1 && sizeMulti.y == 1) @@ -1349,9 +1346,9 @@ void debug_damage_text_spawn(const Vector& position, uint32_t argb, const std::s } // 006b5f10 The debug renderer's shape for this entity, by its index. -void* Entity::GetDebugShape(bool isUnknown) +Shape& Entity::GetDebugShape(bool isReset) { - return g_game->debugRenderer.Get((int)index, isUnknown); + return g_game->debugRenderer.Get((int)index, isReset); } // 006b6c20 The capsule its sprite's null layer covers: placed and turned like GetNullOffset, four times the null's diff --git a/src/entity.h b/src/entity.h index 0d557fa..a6031e1 100644 --- a/src/entity.h +++ b/src/entity.h @@ -312,6 +312,16 @@ enum EntityType : int ENTITY_TEXT = 9001 }; +// The shopkeepers (Lua's ShopkeeperVariant). +enum ShopkeeperVariant : int +{ + SHOPKEEPER_COMMON, + SHOPKEEPER_SECRET, + SHOPKEEPER_ERROR_ROOM, + SHOPKEEPER_SPECIAL, + SHOPKEEPER_SECRET_SPECIAL +}; + // The types an enemy can have, both ends included. constexpr int ENTITY_FIRST_ENEMY = 10; constexpr int ENTITY_LAST_ENEMY = 999; @@ -897,7 +907,7 @@ struct Entity Entity_NPC* GiveMinecart(const Vector& position, const Vector& cartVelocity); WaterClipInfo GetWaterClipInfo(); void water_ripples_update(); - void* GetDebugShape(bool isUnknown); + Shape& GetDebugShape(bool isReset); Vector GetNullOffset(std::string_view nullLayerName); void GetNullCapsule(Capsule& outCapsule, std::string_view nullLayerName); diff --git a/src/entity_combat.cpp b/src/entity_combat.cpp index 90d485d..1b2858a 100644 --- a/src/entity_combat.cpp +++ b/src/entity_combat.cpp @@ -68,7 +68,6 @@ constexpr int STATIC_OBSTACLE_EXTRA = 202; // The items, trinkets and player kinds the combat code reads (Lua's ids). constexpr int COLLECTIBLE_ARIES = 300; -constexpr int NULLITEM_TOOTH_AND_NAIL = 59; constexpr int PLAYER_FORM_COUNT_NEEDED = 3; constexpr int BABY_CROW = 12; constexpr int BLUE_FLY_MAX = 30; @@ -1225,7 +1224,7 @@ static float player_contact_damage(Entity_Player& player, Entity& collider, bool damage += isVersus ? ARIES_DAMAGE_VERSUS : ARIES_DAMAGE; player.mass = ARIES_MASS; } - if (effects.HasNullEffect(NULLITEM_TOOTH_AND_NAIL)) damage += isVersus ? NULL_CONTACT_DAMAGE_VERSUS : NULL_CONTACT_DAMAGE; + if (effects.HasNullEffect(NULLITEM_TOOTH_AND_NAIL_STATUE)) damage += isVersus ? NULL_CONTACT_DAMAGE_VERSUS : NULL_CONTACT_DAMAGE; if (player.HasEntityFlags(FLAG_THROWN)) damage = damage * THROWN_DAMAGE_SCALE + THROWN_DAMAGE_BONUS; return damage; } diff --git a/src/entity_effect.h b/src/entity_effect.h index db00e94..5b959e7 100644 --- a/src/entity_effect.h +++ b/src/entity_effect.h @@ -81,6 +81,7 @@ enum HaloSubtype { HALO_CURSE = 3, HALO_STATIC = 4, + HALO_SATURNUS = 5, HALO_TELEKINESIS = 1, HALO_SALVATION = 6, HALO_STATIC_PRERENDERED = 7, @@ -448,3 +449,10 @@ constexpr ColorMod tint_color_make(float red, float green, float blue, float alp { return {{red, green, blue, alpha}, {0, 0, 0, 0}, {0, 0, 0}}; } + +// The subtype of the rock chips a pit's making flings (a giga bomb's or Singe's crater). +constexpr int GIGA_CHIP_SUBTYPE = 0x20000; + +// The black blood of Gish and the Butt Slicker: their grey shots and their near black splats and creep. +constexpr ColorMod GISH_SHOT_COLOR = {{1, 1, 1, 1}, {0.5f, 0.5f, 0.5f, 1}, {0, 0, 0}}; +constexpr ColorMod GISH_SPLAT_COLOR = tint_color_make(0.02f, 0.05f, 0.05f, 1); diff --git a/src/entity_effect_ambient.cpp b/src/entity_effect_ambient.cpp index 32d050e..fa16322 100644 --- a/src/entity_effect_ambient.cpp +++ b/src/entity_effect_ambient.cpp @@ -1576,7 +1576,6 @@ constexpr int HEAVEN_DOOR_RESET = -10; constexpr int HEAVEN_DOOR_REOPEN = 25; constexpr int BEAM_READY = 32; constexpr int BEAM_FADE = 82; -constexpr int SOUND_POWER_UP = 128; constexpr int SOUND_HEAVEN_DOOR = 1051; constexpr int MOONLIGHT_GROUND_LAYER = 2; constexpr float MOONLIGHT_DEPTH = 10; @@ -1779,7 +1778,7 @@ static void moonlight_update(Entity_Effect& light) if (player->variant != 0 || player->parent || player->entityCollisionClass == ENTCOLL_NONE) continue; if (distance_squared(player->pos, light.pos) >= MOONLIGHT_RANGE_SQUARED || light.state <= MOONLIGHT_READY) continue; light.state = -1; - npc_sound_play(SOUND_POWER_UP, 1, 2, 1); + npc_sound_play(SOUND_POWERUP1, 1, 2, 1); Entity_Effect* timer = Entity_Effect::CreateTimer(reinterpret_cast(&Entity_Effect::moonlight_timer_callback), MOONLIGHT_BLESSING_DELAY, 0, false); timer->parent = player->resolve_tainted_soul(); diff --git a/src/entity_effect_combat.cpp b/src/entity_effect_combat.cpp index b89ea47..fde862d 100644 --- a/src/entity_effect_combat.cpp +++ b/src/entity_effect_combat.cpp @@ -206,7 +206,6 @@ constexpr float EXPLOSION_SMALL_SCALE = 0.7f; constexpr float EXPLOSION_LARGE_SCALE = 1.4f; constexpr float EXPLOSION_SMALL_VOLUME = 0.95f; constexpr float EXPLOSION_LARGE_VOLUME = 1.1f; -constexpr int ENTITY_DUKE_OF_FLIES = 67; constexpr const char* GFUEL_EXPLOSION_ANM2 = "gfx/promo/gfuel/effects/explosion3.anm2"; constexpr float SCISSORS_SCALE_DOUBLE = 0.75f; constexpr float SCISSORS_SCALE_TRIPLE = 0.5f; @@ -611,7 +610,7 @@ static void poof_update(Entity_Effect& effect) // into its promo explosion. static void explosion_sound_play(Entity_Effect& effect) { - if (effect.spawnerType == ENTITY_DUKE_OF_FLIES || effect.spawnerType == ENTITY_RAG_MEGA || effect.state != 0) + if (effect.spawnerType == ENTITY_DUKE || effect.spawnerType == ENTITY_RAG_MEGA || effect.state != 0) return; effect.state++; diff --git a/src/entity_effect_items.cpp b/src/entity_effect_items.cpp index 5b806b8..739cb78 100644 --- a/src/entity_effect_items.cpp +++ b/src/entity_effect_items.cpp @@ -264,7 +264,8 @@ static bool is_fire_hurtable(Entity& entity, bool isItemFire) } // 005f021a (Update's case 10) The blue flame slows and forgets what it burned every 5 frames. A player's or a -// familiar's fades and dims toward its end, burns enemies and puts out shots, then it goes once dead. +// familiar's fades and dims toward its end, burns enemies (hissing at each hit, whether it hurt or not) and puts out +// shots, then it goes once dead. static void blue_flame_update(Entity_Effect& flame) { flame.friction *= FIRE_FRICTION; @@ -279,8 +280,9 @@ static void blue_flame_update(Entity_Effect& flame) { if (is_fire_target(flame, *entity) && is_fire_hurtable(*entity, false)) { - if (!fire_hit(flame, *entity, flame.collisionDamage * damageScale, 0)) continue; + if (EntityList::HitListContains(flame.hitList, *entity)) continue; + fire_hit(flame, *entity, flame.collisionDamage * damageScale, 0); float volume = std::min(entity->health * FLAME_HISS_PER_HEALTH + FLAME_HISS_VOLUME, 1.0f); effect_sound_play(SOUND_FIREDEATH_HISS, {.volume = volume, .frameDelay = FLAME_HISS_DELAY}); } diff --git a/src/entity_factory.cpp b/src/entity_factory.cpp index a4b4883..e64b1b0 100644 --- a/src/entity_factory.cpp +++ b/src/entity_factory.cpp @@ -33,7 +33,6 @@ constexpr int SPAWN_STATUS_FRAMES = 90; // The entity types, variants and boss ids spawning and layouts single out. constexpr int ENTITY_HORF = 12; -constexpr int ENTITY_FLAMINGHOPPER = 54; constexpr int ENTITY_WALKINGBOIL = 88; constexpr int ENTITY_MUSHROOM = 300; constexpr int ENTITY_SUB_HORF = 812; @@ -42,8 +41,6 @@ constexpr int EFFECT_CRAWLSPACE_LADDER = 192; constexpr int PICKUP_RANDOM_CARD = 301; constexpr int SLOT_CLOSET_TAINTED = 14; -constexpr int SHOPKEEPER_SPECIAL = 3; -constexpr int SHOPKEEPER_SECRET_SPECIAL = 4; constexpr int EFFECT_VARIANT_TRAPDOOR_MARKER = 39; // The stairs a stage with no next one is left by, and the trapdoor to the Void. constexpr int STAIRS_VARIANT_EXIT = 3; @@ -612,7 +609,7 @@ static bool enemy_variant_transform(Room& room, RoomEntry& entry, int stage, int case ENTITY_BOOMFLY: return roll(isFloodedCaves, 2, 1, 2); case ENTITY_HOST: return isCavesOld && rng.RandomInt(5) == 0 && isUnlocked && morph(ENTITY_MUSHROOM, 0); case ENTITY_HOPPER: - return entry.variant == 0 && isBurningBasement && rng.RandomInt(5) < 3 && morph(ENTITY_FLAMINGHOPPER, 0); + return entry.variant == 0 && isBurningBasement && rng.RandomInt(5) < 3 && morph(ENTITY_FLAMING_HOPPER, 0); case ENTITY_MRMAW: return roll(true, 15, 1, 2); case ENTITY_VIS: return roll(entry.variant != 2 && isScarredWomb, 2, 1, 3); case ENTITY_GUTS: diff --git a/src/entity_familiar.cpp b/src/entity_familiar.cpp index 38ee65b..e676ac6 100644 --- a/src/entity_familiar.cpp +++ b/src/entity_familiar.cpp @@ -118,7 +118,7 @@ constexpr int SOUND_BUMBO = 842; constexpr int SOUND_SPRINKLER = 1070; constexpr float ANGRY_FLY_HEIGHT = -24; constexpr float SPIN_SIZE_BONUS = 5; -constexpr int NULLITEM_SPIN_TO_WIN_EFFECT = 50; +constexpr float VERSUS_BLUE_TINT_OFFSET = 0.6f; // Dip's splat colours by subtype (offsets on a cleared tint, Stone Dip's tint cleared too), and Corn Dip's double // damage. @@ -150,7 +150,6 @@ constexpr int SPIN_FLASH_INTERVAL = 4; constexpr int SPIN_HIT_INTERVAL = 8; constexpr ColorMod SPIN_FLASH = {{1, 1, 1, 1}, {0, 0, 0, 0}, {0.6f, 0.6f, 0.6f}}; constexpr int ORBIT_LAYER_WISPS = 8; -constexpr int COLLECTIBLE_UNICORN_STUMP_ID = 298; constexpr int VERSUS_PUNCHING_INTERVAL = 16; // How long a versus familiar leaves alone a target it chased too long. @@ -254,7 +253,7 @@ float angle_wrap(float angle) bool familiar_unicorn_active(Entity_Player& owner) { return owner.temporaryEffects.HasCollectibleEffect(COLLECTIBLE_MY_LITTLE_UNICORN) || - owner.temporaryEffects.HasCollectibleEffect(COLLECTIBLE_UNICORN_STUMP_ID); + owner.temporaryEffects.HasCollectibleEffect(COLLECTIBLE_UNICORN_STUMP); } // 0067f1d0 Isaac::GetAxisAlignedUnitVectorFromDir: the unit step of a direction, none for no direction. @@ -415,7 +414,9 @@ void Entity_Familiar::Init(int initType, int initVariant, int initSubtype, uint3 sprite.Play("FloatDown"); if (variant == ISAACS_HEART) player->isaacsHeart = this; if (variant == ISAACS_HEART || variant == SAMSONS_CHAINS) entityCollisionClass = ENTCOLL_ALL; - if (player->temporaryEffects.HasNullEffect(NULLITEM_SPIN_TO_WIN_EFFECT)) + if (variant == ABYSS_LOCUST) locust_init(*this); + if (variant == ISAACS_BODY && player) isaacs_body_init(*this); + if (player->temporaryEffects.HasNullEffect(NULLITEM_SPIN_TO_WIN)) { flags |= FLAG_SPIN; if (orbitLayer >= 0) size = config->collisionRadius + SPIN_SIZE_BONUS; @@ -440,7 +441,18 @@ static void bone_orbital_init(Entity_Familiar& bone) bone.collisionDamage = bone.player->meleeDamage; } -// Part of 0060de70: what each variant starts with. The rarer familiars stop the game. +// Part of 0060de70: a versus player's own blue fly or spider (subtype 0) shows its player's color. +static void versus_blue_tint(Entity_Familiar& familiar, int initSubtype) +{ + Entity* spawner = familiar.spawnerEntity; + if (initSubtype != 0 || !familiar_versus() || !spawner || spawner->type != ENTITY_PLAYER) return; + + ColorMod color = g_game->playerManager.player_color_mod_get(*static_cast(spawner)); + for (int i = 0; i < 3; i++) color._offset[i] = color._tint[i] * VERSUS_BLUE_TINT_OFFSET; + familiar.SetColor(color, -1, COLOR_PRIORITY_DEFAULT, false, true); +} + +// Part of 0060de70: what each variant starts with, before its versus adjustment. The rarer familiars stop the game. void Entity_Familiar::variant_init(int initSubtype) { if (familiar_listed(FLOAT_DOWN_VARIANTS, variant)) return sprite.Play("FloatDown"); @@ -448,22 +460,16 @@ void Entity_Familiar::variant_init(int initSubtype) switch (variant) { case FORGOTTEN_BODY: forgotten_body_init(*this); break; - case MINISAAC: minisaac_init(*this); break; - case STAR_OF_BETHLEHEM: star_of_bethlehem_init(*this); break; - case ABYSS_LOCUST: locust_init(*this); break; - case ISAACS_BODY: - if (player) isaacs_body_init(*this); - break; - case WISP: - case ITEM_WISP: WispInit(); break; case BLUE_FLY: collisionDamage = player->meleeDamage + player->meleeDamage; if (initSubtype >= 1 && initSubtype <= 5) sprite.Play(LOCUST_ANIMS[initSubtype]); + else versus_blue_tint(*this, initSubtype); break; case BLUE_SPIDER: counter = 0; collisionDamage = player->meleeDamage + player->meleeDamage; sprite.Play("Appear"); + versus_blue_tint(*this, initSubtype); break; case SACRIFICIAL_DAGGER: case SLIPPED_RIB: orbitDistance = vector_scale(GetOrbitDistance(orbitLayer), DAGGER_ORBIT_SCALE); break; @@ -513,17 +519,19 @@ void Entity_Familiar::variant_init(int initSubtype) case BONE_SPUR: bone_spur_init(*this); break; - case CUBE_BABY: - cube_baby_init(*this); - break; } } -// The end of 0060de70: Dip's splat colour and damage, and the few variants that pick an animation or state. +// The end of 0060de70: Dip's splat colour and damage, the wisps, and the variants set up after the versus adjustment. void Entity_Familiar::variant_finish() { switch (variant) { + case WISP: + case ITEM_WISP: WispInit(); break; + case MINISAAC: minisaac_init(*this); break; + case STAR_OF_BETHLEHEM: star_of_bethlehem_init(*this); break; + case CUBE_BABY: cube_baby_init(*this); break; case DIP: for (const DipSplat& splat : DIP_SPLATS) if (splat.subtype == subtype) @@ -590,8 +598,8 @@ void Entity_Familiar::Update() if (variant == FLY_ORBITAL) Remove(); else if (ringFly) ringFly->Remove(); } + if (!isExists) return Entity::Update(); } - if (!isExists) return Entity::Update(); } if (update_appearing()) return; @@ -1010,6 +1018,7 @@ void Entity_Familiar::update_tail() if (variant == FORGOTTEN_BODY) velocity.y += FORGOTTEN_BODY_FALL; else { + velocity.y *= HALF; velocity.x = velocity.x > 0 ? vector_length(velocity) : velocity.x < 0 ? -vector_length(velocity) : 0; velocity.y = 0; Vector below = vector_add(pos, vector_make(0, sizeMulti.y * size + CRAWLSPACE_LEDGE_PROBE)); @@ -1264,7 +1273,6 @@ bool Entity_Familiar::CanBlockProjectiles() case LIL_PORTAL: return fireCooldown < 0; case WISP: return subtype != WISP_UNBLOCKING; case ABYSS_LOCUST: return familiar_locust_config(*this).effects[0].tearFlags[TEAR_SHIELDED]; - return false; default: return familiar_listed(BLOCKING_VARIANTS, variant); } } diff --git a/src/entity_familiar.h b/src/entity_familiar.h index 68f5981..b24c094 100644 --- a/src/entity_familiar.h +++ b/src/entity_familiar.h @@ -147,6 +147,7 @@ struct Entity_Familiar : Entity FLY_ORBITAL = 33, SACRIFICIAL_DAGGER = 35, DEAD_CAT = 40, + ONE_UP = 41, GUPPYS_HAIRBALL = 42, BLUE_FLY = 43, CUBE_OF_MEAT_1 = 44, diff --git a/src/entity_knife_hits.cpp b/src/entity_knife_hits.cpp index 0e0b5dc..5d9632d 100644 --- a/src/entity_knife_hits.cpp +++ b/src/entity_knife_hits.cpp @@ -751,6 +751,7 @@ void Entity_Knife::UpdateSwingHits() if (owner && owner->type != ENTITY_PLAYER && owner->type != ENTITY_FAMILIAR && owner->type != ENTITY_TEAR) owner = nullptr; + Shape& debugShape = g_game->debugRenderer.Get((int)index, true); int baseVariant = GetBaseVariant(); bool isIdleSword = baseVariant == KNIFE_SPIRIT_SWORD && !isSwinging; if (subtype == KNIFE_SUBTYPE_HELD_ITEM || isIdleSword) @@ -787,6 +788,9 @@ void Entity_Knife::UpdateSwingHits() else if (!isIdleSword) hit.damage = hit.damage * SWORD_DAMAGE + SWORD_DAMAGE_BONUS; } hit.reach = swing_reach_get(*this, isIdleSword); + if (g_game->debugFlags & DEBUG_HITSPHERES) + for (const Capsule* capsule : {&hit.reach.tip, &hit.reach.extra}) + if (capsule->radius > 0) debugShape.Capsula(*capsule); if (!swing_grid_hit(*this, hit.reach, hit.isHit)) return; bool isShotsHit = hit.tearFlags[TEAR_SHIELDED] || variant == KNIFE_BAG_OF_CRAFTING || diff --git a/src/entity_npc.cpp b/src/entity_npc.cpp index 2427c08..94f1ad8 100644 --- a/src/entity_npc.cpp +++ b/src/entity_npc.cpp @@ -188,21 +188,12 @@ constexpr int TYPE_NO_TICK_A = 274; constexpr int TYPE_NO_TICK_B = 275; // The items and seeds whose effects the NPC update reads, by Lua id. -constexpr int COLLECTIBLE_HOURGLASS_ID = 66; -constexpr int COLLECTIBLE_GAMEKID_ID = 93; constexpr int COLLECTIBLE_CHAMPION_BELT_ID = 208; -constexpr int COLLECTIBLE_STOP_WATCH_ID = 232; constexpr int COLLECTIBLE_SOUL_ID = 335; -constexpr int COLLECTIBLE_TOXIC_SHOCK_ID = 350; constexpr int COLLECTIBLE_BETRAYAL_ID = 391; constexpr int COLLECTIBLE_SPIDER_MOD_ID = 403; -constexpr int COLLECTIBLE_BROKEN_MODEM_ID = 514; constexpr int COLLECTIBLE_GUPPYS_EYE_ID = 665; -constexpr int COLLECTIBLE_SALVATION_ID = 696; -constexpr int TRINKET_PURPLE_HEART_ID = 5; -constexpr int TRINKET_TICK_ID = 53; constexpr int TRINKET_SUPER_MAGNET_ID = 68; -constexpr int TRINKET_LIGHTER_ID = 135; constexpr int TRINKET_ICE_CUBE_ID = 188; constexpr int ROOM_TRINKET_STATUS_FRAMES = -90; constexpr int NULLITEM_DAMOCLES_WEAKNESS = 64; @@ -376,8 +367,8 @@ Entity_Player* game_nearest_player(const Vector& position) } // (00703ab0) Game::GetNearestPlayerEx for the main players only: the nearest player itself (not a co-op ghost, baby, -// twin's hold or hologram) that collides with entities. -Entity_Player* main_player_nearest(const Vector& position) +// twin's hold or hologram), one that collides with entities unless the mode takes any. +Entity_Player* main_player_nearest(const Vector& position, NearestPlayerMode mode) { Entity_Player* nearest = nullptr; float best = 1e10f; @@ -387,7 +378,7 @@ Entity_Player* main_player_nearest(const Vector& position) float distance = vector_length_squared(vector_sub(position, player->pos)); if (distance >= best) continue; if (player->variant != 0 || player->isCoopGhost || player->parent || player->IsHologram()) continue; - if (player->entityCollisionClass == ENTCOLL_NONE) continue; + if (mode == NEAREST_COLLIDING && player->entityCollisionClass == ENTCOLL_NONE) continue; nearest = player; best = distance; @@ -534,8 +525,11 @@ Entity* game_nearest_target_player(const Vector& position, Entity* source, bool float distance = target_distance_get(measure, position, source, *prey); bool isFriendly = prey->HasEntityFlags(FLAG_FRIENDLY); if (prey->type == ENTITY_BISHOP && !isFriendly) distance *= PUPPY_BISHOP_SCALE; - if (prey->type == ENTITY_BLOOD_PUPPY) distance += PUPPY_KIN_PENALTY; - if (!isFriendly) distance *= preyScale; + else if (prey->type != ENTITY_BISHOP) + { + if (prey->type == ENTITY_BLOOD_PUPPY) distance += PUPPY_KIN_PENALTY; + if (!isFriendly) distance *= preyScale; + } if (distance >= best) continue; best = distance; nearest = prey; @@ -781,8 +775,8 @@ static float boss_color_chance_get() Game& game = *g_game; float chance = g_manager->persistentGameData.Unlocked(ACHIEVEMENT_MORE_BOSS_COLORS) ? 0.3f : 0.1f; if (game.difficulty == DIFFICULTY_GREEDIER) chance = 0.6f; - if (game.playerManager.AnyoneHasTrinket(TRINKET_PURPLE_HEART_ID)) - chance *= (float)game.playerManager.GetTrinketMultiplier(TRINKET_PURPLE_HEART_ID) * 2; + if (game.playerManager.AnyoneHasTrinket(TRINKET_PURPLE_HEART)) + chance *= (float)game.playerManager.GetTrinketMultiplier(TRINKET_PURPLE_HEART) * 2; if (game.challenge == CHALLENGE_ULTRA_HARD || game.victoryLap > 0) chance = 1; return chance; } @@ -854,9 +848,9 @@ void Entity_NPC::LoadEntityConfig() ? CHAMPION_CHANCE_BELT : CHAMPION_CHANCE; if (game.stage == STAGE_VOID) chance = CHAMPION_CHANCE_VOID; - if (game.playerManager.AnyoneHasTrinket(TRINKET_PURPLE_HEART_ID)) + if (game.playerManager.AnyoneHasTrinket(TRINKET_PURPLE_HEART)) chance *= - (float)game.playerManager.GetTrinketMultiplier(TRINKET_PURPLE_HEART_ID) * CHAMPION_CHANCE_PURPLE_HEART; + (float)game.playerManager.GetTrinketMultiplier(TRINKET_PURPLE_HEART) * CHAMPION_CHANCE_PURPLE_HEART; if (room.isInitialized) chance *= CHAMPION_CHANCE_LATE_SPAWN; if (game.seedEffects.HasSeedEffect(SEED_ALL_CHAMPIONS)) chance = 1; @@ -1272,8 +1266,8 @@ int Entity_NPC::GetAliveEnemyCount() if (!IsFriendly()) return g_game->room->GetAliveEnemiesCount(); int count = 0; - for (Entity* entity : g_game->room->entityList.mainEL) - if (Entity::is_enemy_type(entity->type) && !entity->isDead && entity->IsFriendly()) count++; + for (Entity* entity : g_game->room->entityList.updateEL) + if (entity_is_prey(*entity) && !entity->isDead && entity->HasEntityFlags(FLAG_FRIENDLY)) count++; return count; } @@ -1292,30 +1286,37 @@ void Entity_NPC::status_overlay_update() { bool isShadowCharger = type == ENTITY_SHADOW_CHARGER && variant == 0 && subtype == SHADOW_CHARGER_SUBTYPE; TemporaryEffects& roomEffects = g_game->room->temporaryEffects; - bool isTimeSlowed = roomEffects.HasCollectibleEffect(COLLECTIBLE_STOP_WATCH_ID) || - roomEffects.HasCollectibleEffect(COLLECTIBLE_HOURGLASS_ID) || + bool isTimeSlowed = roomEffects.HasCollectibleEffect(COLLECTIBLE_STOP_WATCH) || + roomEffects.HasCollectibleEffect(COLLECTIBLE_HOURGLASS) || (g_game->challenge != CHALLENGE_SPEED && g_game->room->brokenWatchState == BROKEN_WATCH_SLOW); bool isTimeImmune = (flags & (FLAG_FRIENDLY | FLAG_NO_STATUS_EFFECTS)) && type != ENTITY_DEATHS_HEAD; + // Each status overrides the ones before it, so the last that applies shows. Charm overrides them all. std::string_view animation; - bool isShared = false; + bool isShared = championColorIdx == CHAMPION_KING; if (championColorIdx == CHAMPION_KING) animation = "Crown"; else if (championColorIdx == CHAMPION_DEATH) animation = "Skull"; - isShared = !animation.empty(); - if (HasEntityFlags(FLAG_CHARM) && !isShadowCharger) animation = "Charm", isShared = true; - else if (HasEntityFlags(FLAG_BRIMSTONE_MARKED)) animation = "BrimstoneCurse", isShared = true; - else if (HasEntityFlags(FLAG_MAGNETIZED)) animation = "Magnetize", isShared = true; - else if (HasEntityFlags(FLAG_BAITED)) animation = "Bait", isShared = false; - else if (HasEntityFlags(FLAG_CONFUSION)) animation = "Confuse", isShared = true; - else if (HasEntityFlags(FLAG_BURN)) animation = "Burning", isShared = false; - else if (HasEntityFlags(FLAG_POISON)) animation = "Poison", isShared = true; - else if (HasEntityFlags(FLAG_FEAR)) animation = "Fear", isShared = true; - else if (HasEntityFlags(FLAG_BLEED_OUT)) animation = "BleedingOut", isShared = true; - else if (HasEntityFlags(FLAG_SLOW) || (isTimeSlowed && !isTimeImmune)) animation = "Slow", isShared = true; - else if (HasEntityFlags(FLAG_WEAKNESS)) animation = "Weakness", isShared = true; - else if (type == ENTITY_SIREN_HELPER) animation = "EnemyCharm", isShared = true; - else if (animation.empty()) + if (HasEntityFlags(FLAG_CHARM) && !isShadowCharger) + { + animation = "Charm"; + isShared = true; + } + else + { + if (HasEntityFlags(FLAG_BRIMSTONE_MARKED)) animation = "BrimstoneCurse"; + if (HasEntityFlags(FLAG_MAGNETIZED)) animation = "Magnetize"; + if (HasEntityFlags(FLAG_BAITED)) animation = "Bait", isShared = false; + if (HasEntityFlags(FLAG_CONFUSION)) animation = "Confuse"; + if (HasEntityFlags(FLAG_BURN)) animation = "Burning", isShared = false; + if (HasEntityFlags(FLAG_POISON)) animation = "Poison"; + if (HasEntityFlags(FLAG_FEAR)) animation = "Fear"; + if (HasEntityFlags(FLAG_BLEED_OUT)) animation = "BleedingOut"; + if (HasEntityFlags(FLAG_SLOW) || (isTimeSlowed && !isTimeImmune)) animation = "Slow"; + if (HasEntityFlags(FLAG_WEAKNESS)) animation = "Weakness"; + if (type == ENTITY_SIREN_HELPER) animation = "EnemyCharm"; + } + if (animation.empty()) { if (statusEffectSprite.animState.animData) statusEffectSprite.animState.isPlaying = false; return; @@ -1432,9 +1433,9 @@ void Entity_NPC::appear_init() } PlayerManager& players = g_game->playerManager; - if (players.AnyoneHasTrinket(TRINKET_TICK_ID) && type != TYPE_NO_TICK_A && type != TYPE_NO_TICK_B && + if (players.AnyoneHasTrinket(TRINKET_TICK) && type != TYPE_NO_TICK_A && type != TYPE_NO_TICK_B && health > TICK_HEALTH_MIN) - for (int i = 0; i < players.GetTrinketMultiplier(TRINKET_TICK_ID); i++) health *= TICK_HEALTH_SCALE; + for (int i = 0; i < players.GetTrinketMultiplier(TRINKET_TICK); i++) health *= TICK_HEALTH_SCALE; auto isDirt = [](const LayerState& layer) { return layer.layerData && (layer.layerData->name == DIRT_LAYER || layer.layerData->name == HOLE_LAYER); @@ -1633,7 +1634,7 @@ void Entity_NPC::ladder_drop() // Part of 006c4b30: a gold enemy's coins, one to three (none to two for a coin hearted player). void Entity_NPC::midas_coins_spawn() { - Entity_Player* player = game_nearest_player(pos); + Entity_Player* player = main_player_nearest(pos, NEAREST_ANY); int coins = player && player->GetHealthType() == HEALTH_COIN ? random_below(3) : random_below(3) + 1; for (int i = 0; i < coins; i++) { @@ -1651,7 +1652,7 @@ void Entity_NPC::midas_coins_spawn() // 006d5350 Toxic Shock leaves its green creep where the enemy died, sized to it. void Entity_NPC::toxic_shock_creep_spawn() { - Entity_Player* owner = g_game->playerManager.FirstCollectibleOwner(COLLECTIBLE_TOXIC_SHOCK_ID, LAZARUS_SHARE_CHECK); + Entity_Player* owner = g_game->playerManager.FirstCollectibleOwner(COLLECTIBLE_TOXIC_SHOCK, LAZARUS_SHARE_IGNORE); if (!owner) return; Entity* creep = spawn_at(ENTITY_EFFECT, EFFECT_PLAYER_CREEP_GREEN, 0, pos, owner); @@ -1688,7 +1689,7 @@ void Entity_NPC::player_aura_update() { bool isSoul = player->HasCollectible(COLLECTIBLE_SOUL_ID); bool isMagnet = player->HasTrinket(TRINKET_SUPER_MAGNET_ID); - bool isSalvation = player->HasCollectible(COLLECTIBLE_SALVATION_ID); + bool isSalvation = player->HasCollectible(COLLECTIBLE_SALVATION); if (!isSoul && !isMagnet && !isSalvation) continue; float distance = vector_length_squared(vector_sub(player->pos, pos)); @@ -1757,10 +1758,10 @@ void Entity_NPC::item_effects_update() PlayerManager& players = g_game->playerManager; if (g_game->room->GetFrameCount() == 0 && IsVulnerableEnemy(nullptr)) { - if (Entity_Player* owner = players.FirstCollectibleOwner(COLLECTIBLE_TOXIC_SHOCK_ID, LAZARUS_SHARE_IGNORE)) + if (Entity_Player* owner = players.FirstCollectibleOwner(COLLECTIBLE_TOXIC_SHOCK, LAZARUS_SHARE_IGNORE)) AddPoison(EntityRef(owner), TOXIC_SHOCK_POISON, 0, false); - Entity_Player* toxicOwner = players.FirstCollectibleOwner(COLLECTIBLE_TOXIC_SHOCK_ID, LAZARUS_SHARE_IGNORE); - if (Entity_Player* lighter = players.FirstTrinketOwner(TRINKET_LIGHTER_ID); lighter && is_room_trinket_struck(*this, *lighter, TRINKET_LIGHTER_ID)) + Entity_Player* toxicOwner = players.FirstCollectibleOwner(COLLECTIBLE_TOXIC_SHOCK, LAZARUS_SHARE_IGNORE); + if (Entity_Player* lighter = players.FirstTrinketOwner(TRINKET_LIGHTER); lighter && is_room_trinket_struck(*this, *lighter, TRINKET_LIGHTER)) AddBurn(EntityRef(lighter), ROOM_TRINKET_STATUS_FRAMES, 0, false); // The original freezes from the Toxic Shock owner's reference, usually none. if (Entity_Player* ice = players.FirstTrinketOwner(TRINKET_ICE_CUBE_ID); ice && is_room_trinket_struck(*this, *ice, TRINKET_ICE_CUBE_ID)) @@ -1772,7 +1773,7 @@ void Entity_NPC::item_effects_update() Entity_Player* targetPlayer = GetPlayerTarget()->ToPlayer(); if (targetPlayer && targetPlayer->IsInvisible()) AddConfusion(EntityRef(this), STATUS_REFRESH, false); - if (players.FirstCollectibleOwner(COLLECTIBLE_BROKEN_MODEM_ID, LAZARUS_SHARE_IGNORE)) + if (players.FirstCollectibleOwner(COLLECTIBLE_BROKEN_MODEM, LAZARUS_SHARE_IGNORE)) { int odds = std::max(MODEM_MIN_ODDS, MODEM_ODDS - (int)players.get_total_luck()); odds *= IsBoss() ? 3 : 2; @@ -1787,7 +1788,7 @@ void Entity_NPC::item_effects_update() modem_release(); if (!HasEntityFlags(FLAG_NO_TARGET) && std::ranges::any_of(players.playerList, [](Entity_Player* player) { - return player->temporaryEffects.HasCollectibleEffect(COLLECTIBLE_GAMEKID_ID); + return player->temporaryEffects.HasCollectibleEffect(COLLECTIBLE_GAMEKID); })) { SetColor(GAME_KID_COLOR, 2, 0, false, true); @@ -1795,8 +1796,8 @@ void Entity_NPC::item_effects_update() } TemporaryEffects& roomEffects = g_game->room->temporaryEffects; - bool isTimeSlowed = roomEffects.HasCollectibleEffect(COLLECTIBLE_STOP_WATCH_ID) || - roomEffects.HasCollectibleEffect(COLLECTIBLE_HOURGLASS_ID) || + bool isTimeSlowed = roomEffects.HasCollectibleEffect(COLLECTIBLE_STOP_WATCH) || + roomEffects.HasCollectibleEffect(COLLECTIBLE_HOURGLASS) || g_game->room->GetBrokenWatchState() == BROKEN_WATCH_SLOW; bool isTimeImmune = HasEntityFlags(FLAG_FRIENDLY | FLAG_NO_STATUS_EFFECTS) && type != ENTITY_DEATHS_HEAD; if (isTimeSlowed && !isTimeImmune) SetColor(SLOWED_TIME_COLOR, 2, SLOWED_TIME_COLOR_PRIORITY, false, true); @@ -1958,7 +1959,7 @@ void Entity_NPC::Update() // Part of 006c4b30: a persistent enemy or a Delirium form (Delirious's friendly boss) wastes a quarter of health every // 15 frames down to 1, greying and shrinking with it. A hit this frame that is not fire, spikes or poop passes on as 1 -// damage from its biggest hit, or as 5 from an explosion. +// damage from its biggest hit, or as 5 from an explosion no bigger than the hits before it. // The shrink is lost at once, as the frame's scale reset (FUN_006d6650) overwrites it. void Entity_NPC::captured_update() { @@ -1988,7 +1989,6 @@ void Entity_NPC::captured_update() { felt = &event; feltDamage = CAPTURED_BLAST_DAMAGE; - break; } if (event.damage <= biggest) continue; felt = &event; @@ -2167,10 +2167,10 @@ float Entity_NPC::compute_speed_multiplier() float speed = room.GetTimeScale(this); if (!IsFriendly()) { - if (room.temporaryEffects.HasCollectibleEffect(COLLECTIBLE_STOP_WATCH_ID) || + if (room.temporaryEffects.HasCollectibleEffect(COLLECTIBLE_STOP_WATCH) || (g_game->challenge != CHALLENGE_SPEED && room.brokenWatchState == BROKEN_WATCH_SLOW)) speed *= SPEED_HALF; - else if (TemporaryEffect* hourglass = room.temporaryEffects.GetCollectibleEffect(COLLECTIBLE_HOURGLASS_ID)) + else if (TemporaryEffect* hourglass = room.temporaryEffects.GetCollectibleEffect(COLLECTIBLE_HOURGLASS)) speed *= 1 - std::clamp((float)hourglass->cooldown / SLOW_TIMESCALE_EFFECT_FRAMES, 0.0f, 1.0f) * SPEED_HALF; } else if (room.slowdownDuration > 0) speed *= SPEED_HALF; @@ -2255,7 +2255,7 @@ void Entity_NPC::Kill(const EntityRef& source) Entity::Kill(source); } -// 006b8f30 Lets go of everything it points at, Gideon's chain and Mother's sounds included. +// 006b8f30 Lets go of everything it points at, Gideon's chain and Mother's and Visage's chain sounds included. void Entity_NPC::ClearReferences() { auto* charmed = dynamic_cast(target.get()); @@ -2284,6 +2284,15 @@ void Entity_NPC::ClearReferences() hitList.shrink_to_fit(); secondaryHitList.clear(); secondaryHitList.shrink_to_fit(); + if (sirenPlayerEntity) + { + for (Entity_Familiar* familiar : familiar_query(-1)) + if (familiar->player == sirenPlayerEntity) familiar->RemoveFromPlayer(); + sirenPlayerEntity->ClearReferences(); + delete sirenPlayerEntity; + sirenPlayerEntity = nullptr; + } + if (type == ENTITY_VISAGE && variant == VISAGE_CHAIN) g_manager->sfxManager.Stop(SOUND_CHAIN_LOOP); } // 006d81c0 Lets go of the entities its deque holds, and the deque. @@ -2997,8 +3006,12 @@ void Entity_NPC::trigger_kill_item_effects() else Remove(); kill_items_trigger(); + // A frozen statue is noted as the enemy it was, kept in its stateFrame. g_game->room->isFirstEnemyDead = true; + bool isStatue = type == ENTITY_FROZEN_ENEMY; + if (isStatue) type = stateFrame; room_killed_npc_record(*g_game->room, *this); + if (isStatue) type = ENTITY_FROZEN_ENEMY; entityRef = nullptr; aimTargetEffect = nullptr; if (HasEntityFlags(FLAG_BRIMSTONE_MARKED) && HasEntityFlags(FLAG_EXTRA_GORE)) marked_status_spread(); diff --git a/src/entity_npc.h b/src/entity_npc.h index 4fcabce..69ba37e 100644 --- a/src/entity_npc.h +++ b/src/entity_npc.h @@ -449,7 +449,14 @@ using TargetDistance = float (*)(const Vector& position, Entity* source, Entity& // Game's, Room's and PlayerManager's queries the enemies need, until those classes carry them. Entity_Player* game_nearest_player(const Vector& position); -Entity_Player* main_player_nearest(const Vector& position); +// Whether a nearest main player must collide with entities. +enum NearestPlayerMode +{ + NEAREST_COLLIDING, + NEAREST_ANY +}; + +Entity_Player* main_player_nearest(const Vector& position, NearestPlayerMode mode = NEAREST_COLLIDING); Entity* game_nearest_enemy(const Vector& position, Entity* source, float radius, TargetDistance distance = nullptr); bool any_player_flying(); Entity* game_nearest_target_player(const Vector& position, Entity* source, bool isPlayersOnly, bool isTargetDecoys, diff --git a/src/entity_npc_drop.cpp b/src/entity_npc_drop.cpp index bd9b6ac..adbd448 100644 --- a/src/entity_npc_drop.cpp +++ b/src/entity_npc_drop.cpp @@ -101,24 +101,6 @@ constexpr int SIZE_PILLS_PURPLE_HEART = 2; constexpr int CAMO_RUNE_CHANCE = 1; constexpr int NECRONOMICON_BOOK_DELAY = 3; -// The player nearest a position among the main players (Game::GetNearestPlayerEx 00703ab0 with main players only and -// the uncollidable included), else the first player. -static Entity_Player* main_player_nearest_get(const Vector& position) -{ - Entity_Player* nearest = nullptr; - float best = 1e10f; - - for (Entity_Player* player : g_game->playerManager.playerList) - { - float distance = vector_length_squared(vector_sub(position, player->pos)); - if (distance >= best || player->variant != 0 || player->isCoopGhost || player->parent) continue; - if (player->IsHologram()) continue; - nearest = player; - best = distance; - } - return nearest ? nearest : g_game->GetPlayer(0); -} - // Whether the champion drops at all: its drop roll against the chance, never in Greed, from a portal, in Ultra Hard, on // a victory lap or in a room seen before, and rarely in the Void without Purple Heart. static bool is_champion_dropping(Entity_NPC& npc, bool isSure) @@ -351,9 +333,12 @@ void Entity_NPC::champion_drop() if (isDropping) champion_king_drop(*this); return; case CHAMPION_DEATH: - main_player_nearest_get(pos)->UseActiveItem({.item = COLLECTIBLE_NECRONOMICON, .flags = USE_NOANIM}); + { + Entity_Player* reader = main_player_nearest(pos, NEAREST_ANY); + (reader ? reader : g_game->GetPlayer(0))->UseActiveItem({.item = COLLECTIBLE_NECRONOMICON, .flags = USE_NOANIM}); g_game->itemOverlay.Show(GIANTBOOK_NECRONOMICON, NECRONOMICON_BOOK_DELAY, nullptr); return; + } case CHAMPION_RAINBOW: return champion_rainbow_drop(*this, isDropping, isIceFrozen); case CHAMPION_PINK: case CHAMPION_BROWN: return; diff --git a/src/entity_pickup.cpp b/src/entity_pickup.cpp index 5ce1151..2c0b10b 100644 --- a/src/entity_pickup.cpp +++ b/src/entity_pickup.cpp @@ -1,5 +1,6 @@ #include "entity_pickup.h" #include "active_items.h" +#include "boss_ai.h" #include "entity_bomb.h" #include "entity_config.h" #include "entity_effect.h" @@ -48,8 +49,6 @@ constexpr int COLLECTIBLE_BOGO_BOMBS = 250; constexpr int COLLECTIBLE_MAGGYS_BOW = 312; constexpr int COLLECTIBLE_SACK_HEAD = 424; constexpr int COLLECTIBLE_GUPPYS_EYE = 665; -constexpr int COLLECTIBLE_THE_POLAROID = 327; -constexpr int COLLECTIBLE_THE_NEGATIVE = 328; constexpr float OPTIONS_POOF_DROP = 10; constexpr int OPTIONS_ITEM_TIMEOUT = 4; constexpr int TRINKET_BROKEN_MAGNET = 6; @@ -77,8 +76,6 @@ constexpr int ACHIEVEMENT_STICKY_NICKEL = 240; constexpr int ACHIEVEMENT_LUCKY_PENNY = 242; constexpr int ACHIEVEMENT_SCARED_HEART = 328; constexpr int ACHIEVEMENT_CHARGED_KEY = 333; -constexpr int ACHIEVEMENT_BONE_HEART = 391; -constexpr int ACHIEVEMENT_ROTTEN_HEART = 411; constexpr int ACHIEVEMENT_BLACK_SACK = 604; constexpr int ACHIEVEMENT_GOLDEN_PENNY = 613; constexpr int ACHIEVEMENT_GOLDEN_BATTERY = 615; @@ -382,7 +379,7 @@ static int super_secret_heart_get() int layout = g_game->GetCurrentRoomDesc()->data->subtype; std::span hearts = isGreed ? std::span(GREED_HEARTS) : HEARTS; for (auto [room, heart] : hearts) - if (room == layout) return heart == HEART_ROTTEN && !is_unlocked(ACHIEVEMENT_ROTTEN_HEART) ? 0 : heart; + if (room == layout) return heart == HEART_ROTTEN && !is_unlocked(ACHIEVEMENT_ROTTEN_HEARTS) ? 0 : heart; return 0; } @@ -399,7 +396,7 @@ static void heart_subtype_pick(PickupChoice& choice, RNG& rng) ? ODDS_DOUBLE_HEART_HARD : ODDS_DOUBLE_HEART)) kind = HEART_DOUBLEPACK; - if (rng_chance(rng, ODDS_ROTTEN_HEART) && is_unlocked(ACHIEVEMENT_ROTTEN_HEART)) kind = HEART_ROTTEN; + if (rng_chance(rng, ODDS_ROTTEN_HEART) && is_unlocked(ACHIEVEMENT_ROTTEN_HEARTS)) kind = HEART_ROTTEN; if (rng_chance(rng, ODDS_SCARED_HEART) && is_unlocked(ACHIEVEMENT_SCARED_HEART)) kind = HEART_SCARED; if (rng_chance(rng, ODDS_BLENDED_HEART)) kind = HEART_BLENDED; @@ -419,7 +416,7 @@ static void heart_subtype_pick(PickupChoice& choice, RNG& rng) { kind = HEART_SOUL; if (rng_chance(rng, ODDS_HALF_SOUL) && is_unlocked(ACHIEVEMENT_HALF_SOUL_HEART)) kind = HEART_HALF_SOUL; - if (rng_chance(rng, ODDS_BONE_HEART) && is_unlocked(ACHIEVEMENT_BONE_HEART)) kind = HEART_BONE; + if (rng_chance(rng, ODDS_BONE_HEART) && is_unlocked(ACHIEVEMENT_BONE_HEARTS)) kind = HEART_BONE; bool isBlack = rng_chance(rng, ODDS_BLACK_HEART); if (!isBlack && players.AnyoneHasTrinket(TRINKET_BLACK_LIPSTICK)) @@ -1536,8 +1533,10 @@ static void glitch_update(Entity_Pickup& pickup) else if (Random() % GLITCH_FLICKER_ODDS == 0) sprite.bitflags |= ANIM_RENDER_GLITCH; else if ((Random() & GLITCH_KEEP_MASK) == 0) { + // The original compares unsigned, so a jump below frame 0 is kept. int jump = (int)(Random() % GLITCH_JUMP_RANGE); - sprite.SetFrame((float)std::max(GLITCH_FIRST_FRAME, sprite.GetFrame() - GLITCH_JUMP_BACK + jump)); + int frame = sprite.GetFrame() - GLITCH_JUMP_BACK + jump; + sprite.SetFrame((float)((uint32_t)frame > GLITCH_FIRST_FRAME ? frame : GLITCH_FIRST_FRAME)); } return; } @@ -1648,7 +1647,7 @@ static void magneto_chest_open(Entity_Pickup& pickup, Entity_Player& player) bool isFree = is_listed({PICKUP_CHEST, PICKUP_WOODENCHEST, PICKUP_REDCHEST, PICKUP_SPIKEDCHEST, PICKUP_MIMICCHEST}, pickup.variant); bool isKeyed = is_listed({PICKUP_LOCKEDCHEST, PICKUP_ETERNALCHEST, PICKUP_OLDCHEST}, pickup.variant) && - player.GetTrinketMultiplier(TRINKET_PAPER_CLIP) > 0; + player.HasTrinket(TRINKET_PAPER_CLIP); if (!isFree && !isKeyed) return; Vector away = vector_make(pickup.pos.x - player.pos.x, pickup.pos.y - player.pos.y); if (away.y * away.y + away.x * away.x < OPEN_DISTANCE_SQUARED) pickup.TryOpenChest(&player); @@ -1678,8 +1677,8 @@ void Entity_Pickup::update_magnet_attraction() if (player->variant != PLAYER_VARIANT_PLAYER) continue; bool isMagneto = player->HasCollectible(COLLECTIBLE_MAGNETO); bool isStrong = isMagneto || player->GetTrinketMultiplier(TRINKET_BROKEN_MAGNET) >= 2; - bool isCoinPulled = player->GetTrinketMultiplier(TRINKET_BROKEN_MAGNET) > 0 && variant == PICKUP_COIN; - bool isPulling = isStrong || player->GetTrinketMultiplier(TRINKET_SUPER_MAGNET) > 0 || isCoinPulled; + bool isCoinPulled = player->HasTrinket(TRINKET_BROKEN_MAGNET) && variant == PICKUP_COIN; + bool isPulling = isStrong || player->HasTrinket(TRINKET_SUPER_MAGNET) || isCoinPulled; if (isPulling && price == 0 && is_magnet_pulled(*this, *player)) { float distance = (pos.x - player->pos.x) * (pos.x - player->pos.x) + (pos.y - player->pos.y) * (pos.y - player->pos.y); @@ -1885,12 +1884,35 @@ static void coop_copy_spawn(Entity_Pickup& pickup, Entity& collider) if (pickup.subtype != 0) pickup.coopDuplicateIndex = -1; } +// The Store Credit a free ware costs: a Store Credit the player dropped for it goes, a golden one dropped turns plain +// one time in four, else the buyer's (or the first owner's) is used up, a golden one only turning plain one time in +// four. +static void store_credit_spend(Entity_Player& player, Entity_Pickup* dropped) +{ + constexpr uint32_t GOLDEN_CREDIT_SPEND_ODDS = 4; + bool isDroppedTrinket = dropped && dropped->type == ENTITY_PICKUP && dropped->variant == PICKUP_TRINKET; + if (isDroppedTrinket && dropped->subtype == TRINKET_STORE_CREDIT) return dropped->Remove(); + if (isDroppedTrinket && dropped->subtype == (int)(TRINKET_STORE_CREDIT | TRINKET_GOLDEN_FLAG)) + { + if (player.GetTrinketRNG(TRINKET_STORE_CREDIT).RandomInt(GOLDEN_CREDIT_SPEND_ODDS) == 0) + dropped->Morph(ENTITY_PICKUP, PICKUP_TRINKET, TRINKET_STORE_CREDIT, false, true, true); + return; + } + + Entity_Player* owner = player.HasTrinket(TRINKET_STORE_CREDIT) + ? &player + : g_game->playerManager.FirstTrinketOwner(TRINKET_STORE_CREDIT); + if (!owner) return; + if (!owner->HasGoldenTrinket(TRINKET_STORE_CREDIT)) owner->TryRemoveTrinket(TRINKET_STORE_CREDIT); + else if (owner->GetTrinketRNG(TRINKET_STORE_CREDIT).RandomInt(GOLDEN_CREDIT_SPEND_ODDS) == 0) owner->replace_trinket(); +} + // 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. // A priced pickup is bought with the player's coins or health, and chests open (entity_pickup_chest.cpp). Taking an -// item, opening a chest or a sack starts a challenge room's fight, and a bed sends the players to sleep. Familiars -// that collect and the rarer items and trinkets that change what a pickup gives are not reconstructed yet. +// item, opening a chest or a sack starts a challenge room's fight, and a bed sends the players to sleep. A free ware +// spends a Store Credit. bool Entity_Pickup::HandleCollision(Entity* collider, bool isLow) { if (variant == PICKUP_COLLECTIBLE && megaChestCollectible[0] && g_forceCollideDepth == 0) return true; @@ -1991,6 +2013,7 @@ bool Entity_Pickup::HandleCollision(Entity* collider, bool isLow) bool isChestOpened = false; bool isPickedUp = false; int collectedSubtype = subtype; + Entity_Pickup* droppedTrinket = nullptr; switch (variant) { case PICKUP_HEART: @@ -2022,7 +2045,7 @@ bool Entity_Pickup::HandleCollision(Entity* collider, bool isLow) isPickedUp = pocket_item_collect(*this, *player); break; case PICKUP_TRINKET: - isPickedUp = trinket_collect(*this, *player); + isPickedUp = trinket_collect(*this, *player, droppedTrinket); break; case PICKUP_CHEST: case PICKUP_SPIKEDCHEST: @@ -2062,6 +2085,7 @@ bool Entity_Pickup::HandleCollision(Entity* collider, bool isLow) break; } + if (paidPrice == PRICE_FREE && isPickedUp) store_credit_spend(*player, droppedTrinket); Room& room = *g_game->room; if (isPickedUp || isChestOpened) { @@ -2689,33 +2713,51 @@ bool Entity_Pickup::CanRerollVariant(int pickupVariant, int pickupSubType) bool isChallenge = g_game->challenge != 0 || g_game->dailyChallenge.id != 0; PathType path = isChallenge ? g_game->GetChallengeParams().pathType : PATH_TYPE_SHEOL; bool isKnifePiece = pickupSubType == COLLECTIBLE_KNIFE_PIECE_1 || pickupSubType == COLLECTIBLE_KNIFE_PIECE_2; - bool isPhoto = pickupSubType == COLLECTIBLE_THE_POLAROID || pickupSubType == COLLECTIBLE_THE_NEGATIVE; + bool isPhoto = pickupSubType == COLLECTIBLE_POLAROID || pickupSubType == COLLECTIBLE_NEGATIVE; if (isChallenge && isKnifePiece && path == PATH_TYPE_REPENTANCE) return false; return !(isChallenge && isPhoto && (path == PATH_TYPE_HOME || g_game->GetChallengeParams().endStage == STAGE_VOID)); } // 006ee750 Taking one of a set of options removes the others in a poof, items after a short timeout. Taking an item -// on the Death Certificate's floor starts its 90 frames to the way back. +// on the Death Certificate's floor starts its 90 frames to the way back. Taking one of Genesis's items removes the +// others and brings the next set 10 frames later. void Entity_Pickup::RemoveOtherOptions() { - if (optionsPickupIndex == 0) return; - if (optionsPickupIndex == 1 && variant == PICKUP_COLLECTIBLE && - g_game->currentDimensionIdx == DIMENSION_DEATH_CERTIFICATE && g_game->deathCertificateExitTimer < 1) - g_game->deathCertificateExitTimer = DEATH_CERTIFICATE_EXIT_FRAMES; - - std::vector pickups(g_game->room->entityList.updateEL); - for (Entity* entity : pickups) + constexpr int GENESIS_NEXT_FRAMES = 10; + auto poof = [](Entity* other) { - if (!entity || entity->type != ENTITY_PICKUP || entity == this) continue; - Entity_Pickup* other = static_cast(entity); - bool isEmptyPedestal = other->variant == PICKUP_COLLECTIBLE && other->subtype == 0; - if (other->optionsPickupIndex != optionsPickupIndex || isEmptyPedestal) continue; entity_spawn({vector_make(other->pos.x, other->pos.y + OPTIONS_POOF_DROP), {}, nullptr, 0, ENTITY_EFFECT, EFFECT_POOF01, Random()}); - if (other->variant == PICKUP_COLLECTIBLE) other->timeout = OPTIONS_ITEM_TIMEOUT; - else other->Remove(); + }; + + if (optionsPickupIndex != 0) + { + if (optionsPickupIndex == 1 && variant == PICKUP_COLLECTIBLE && + g_game->currentDimensionIdx == DIMENSION_DEATH_CERTIFICATE && g_game->deathCertificateExitTimer < 1) + g_game->deathCertificateExitTimer = DEATH_CERTIFICATE_EXIT_FRAMES; + + for (Entity* entity : entity_query(ENTITY_PICKUP, -1)) + { + Entity_Pickup* other = static_cast(entity); + bool isEmptyPedestal = other->variant == PICKUP_COLLECTIBLE && other->subtype == 0; + if (other->optionsPickupIndex != optionsPickupIndex || other == this || isEmptyPedestal) continue; + poof(other); + if (other->variant == PICKUP_COLLECTIBLE) other->timeout = OPTIONS_ITEM_TIMEOUT; + else other->Remove(); + } + optionsPickupIndex = 0; } - optionsPickupIndex = 0; + + bool isGenesisItem = variant == PICKUP_COLLECTIBLE && g_game->currentRoomIdx == ROOM_GENESIS_IDX && + HasEntityFlags(FLAG_NO_DEATH_TRIGGER); + if (!isGenesisItem) return; + for (Entity* other : entity_query(ENTITY_PICKUP, PICKUP_COLLECTIBLE)) + { + if (!other->HasEntityFlags(FLAG_NO_DEATH_TRIGGER)) continue; + poof(other); + other->Remove(); + } + g_game->room->genesisTimer = GENESIS_NEXT_FRAMES; } // 006e3800 A held chest thrown by a source: it flies from the ground up at the force, pushed along the direction. diff --git a/src/entity_pickup.h b/src/entity_pickup.h index 584bb7a..a4ff341 100644 --- a/src/entity_pickup.h +++ b/src/entity_pickup.h @@ -236,6 +236,7 @@ struct Entity_Pickup : Entity void update_magnet_attraction(); void mag_baby_pull(); void update_cycle_collectible(bool isForce); + bool TryInitOptionCycle(uint32_t count); bool CanReroll(); static bool CanRerollVariant(int variant, int subType); static bool IsChest(int pickupVariant); diff --git a/src/entity_pickup_shop.cpp b/src/entity_pickup_shop.cpp index 898f21c..6b1d1d1 100644 --- a/src/entity_pickup_shop.cpp +++ b/src/entity_pickup_shop.cpp @@ -300,10 +300,12 @@ static void coins_spent_count(Entity_Player& player, int coins) } // The health a devil deal takes: the price's containers and soul hearts, Your Soul's trinket (sometimes kept when -// golden), nothing for a player without health, who takes every other deal away instead. +// golden), nothing for a player without health, who takes every other deal away instead. Another negative price (a +// free ware's) pays and takes nothing. static bool deal_health_pay(Entity_Player& player, int price) { bool isFree = player.GetHealthType() == HEALTH_NO_HEALTH || player.HasInstantDeathCurse(); + if (-price >= (int)HEART_COSTS.size()) return false; if (price == PRICE_SOUL) { int multiplier = player.GetTrinketMultiplier(TRINKET_YOUR_SOUL); diff --git a/src/entity_player.cpp b/src/entity_player.cpp index 3724f91..ff1db99 100644 --- a/src/entity_player.cpp +++ b/src/entity_player.cpp @@ -13,6 +13,7 @@ #include "seeds.h" #include "sfx_manager.h" #include "game.h" +#include "game_state_player.h" #include "log.h" #include "lua_engine.h" #include "manager.h" @@ -511,6 +512,7 @@ void Entity_Player::links_reset() reverseChariotMoveCooldown = 0; reverseSunBoneHearts = 0; pendingPill = -1; + damageChargeCooldown = 0; revelationChargeTimer = 0; montezumaChargeTimer = 0; jupiterCharge = 0; @@ -870,8 +872,8 @@ void Entity_Player::InitPostLevelInitStats() eden_items_roll(rng); if (challenge.isMegaSatan) { - starting_collectible_add(COLLECTIBLE_KEY_PIECE_1); - starting_collectible_add(COLLECTIBLE_KEY_PIECE_2); + rolled_collectible_add(COLLECTIBLE_KEY_PIECE_1, 0); + rolled_collectible_add(COLLECTIBLE_KEY_PIECE_2, 0); } if (game.challenge == 0 && game.dailyChallenge.id == 0) { @@ -881,13 +883,13 @@ void Entity_Player::InitPostLevelInitStats() { for (int id : challenge.collectibleTwinList) if (id < 0) RemoveCollectible(-id, false, 0, true); - else starting_collectible_add(id); + else rolled_collectible_add(id, -1); } else { for (int id : challenge.collectibleList) if (id < 0) RemoveCollectible(-id, false, 0, true); - else starting_collectible_add(id); + else rolled_collectible_add(id, -1); for (int id : challenge.trinketList) starting_trinket_add(id); if (challenge.startingPill != PILLEFFECT_NULL) { @@ -895,8 +897,8 @@ void Entity_Player::InitPostLevelInitStats() AddPocketItem(pillColor, POCKET_PILL); game.itemPool.IdentifyPill((uint32_t)pillColor); } - if (challenge.startingCard > 0) AddPocketItem(challenge.startingCard, POCKET_CARD); - else if (challenge.startingCard < 0) AddPocketItem(card_roll(rng.Next(), 0, false), POCKET_CARD); + if (challenge.startingCard == -1) AddPocketItem(card_roll(rng.Next(), 0, false), POCKET_CARD); + else if (challenge.startingCard != 0) AddPocketItem(challenge.startingCard, POCKET_CARD); } EvaluateItems(); @@ -1114,7 +1116,11 @@ void Entity_Player::level_items_apply(bool isForced) game.Spawn( {.position = spot, .spawner = this, .type = ENTITY_PICKUP, .variant = PICKUP_GRAB_BAG, .seed = seed}); } - if (!isForced && backupPlayer) backupPlayer->isLevelStartPending = true; + if (!isForced && backupPlayer) + { + backupPlayer->isLevelStartPending = true; + if (backupPlayer->unlistedRestoreState) backupPlayer->unlistedRestoreState->isLevelStartPending = true; + } for (Entity_Player* player : {this, subPlayer}) if (player && player->eternalHearts > 0) { @@ -1238,7 +1244,7 @@ void Entity_Player::missing_no_reroll() bodySprite.Reset(); sprite.playbackSpeed = 1; sprite.overlayAnimState.SetAnimationData(nullptr); - if (sprite.SetAnimation("Glitch", SWITCH_KEEP_FRAME)) + if (sprite.SetAnimation("Glitch")) { sprite.animState.Rewind(); sprite.animState.isPlaying = true; @@ -1294,6 +1300,7 @@ void Entity_Player::stem_cell_heal() { uint32_t seed = Random(); g_game->Spawn({.position = room_pickup_position_random(false, false), + .subType = HEART_FULL, .type = ENTITY_PICKUP, .variant = PICKUP_HEART, .seed = seed}); @@ -1617,7 +1624,9 @@ void Entity_Player::release_weapons_and_effects(bool isRemoveEntities) if (weapon) weapon->ClearReferences(); weapon.reset(); } + link_release(ladder, isRemoveEntities); link_release(azazelsRageLaser, isRemoveEntities); + link_release(tractorBeam, isRemoveEntities); link_release(dadsRingAura, isRemoveEntities); link_release(telekinesisHalo, isRemoveEntities); link_release(breathOfLifeEffect, isRemoveEntities); @@ -1631,6 +1640,7 @@ void Entity_Player::release_weapons_and_effects(bool isRemoveEntities) link_release(forgottenBody, isRemoveEntities); link_release(monstranceAura, isRemoveEntities); link_release(babyFamiliar, isRemoveEntities); + link_release(saturnusRing, isRemoveEntities); link_release(salvationEffect, isRemoveEntities); link_release(darkArtsAura, isRemoveEntities); link_release(tetheredEffect, isRemoveEntities); diff --git a/src/entity_player.h b/src/entity_player.h index 8ffbf8a..92420c4 100644 --- a/src/entity_player.h +++ b/src/entity_player.h @@ -402,7 +402,9 @@ enum PlayerItemId : int COLLECTIBLE_BONE_SPURS = 683, COLLECTIBLE_SPEAR_OF_DESTINY = 400, COLLECTIBLE_HUNGRY_SOUL = 684, + COLLECTIBLE_SKELETON_KEY = 17, COLLECTIBLE_DOLLAR = 18, + COLLECTIBLE_BOOM = 19, COLLECTIBLE_LUNCH = 22, COLLECTIBLE_ROTTEN_MEAT = 26, COLLECTIBLE_BLOOD_BAG = 119, @@ -480,6 +482,7 @@ enum PlayerItemId : int COLLECTIBLE_WHITE_PONY = 181, COLLECTIBLE_SACRED_HEART = 182, COLLECTIBLE_BLOOD_RIGHTS = 186, + COLLECTIBLE_PYRO = 190, COLLECTIBLE_3_DOLLAR_BILL = 191, COLLECTIBLE_MOMS_KEY = 199, COLLECTIBLE_MIDAS_TOUCH = 202, @@ -981,6 +984,7 @@ enum PlayerItemId : int NULLITEM_SPIRIT_SHACKLES_DISABLED = 102, NULLITEM_FORGOTTEN_BOMB = 106, NULLITEM_JACOBS_CURSE = 109, + NULLITEM_ESAU_JR_FAMILIAR = 131, NULLITEM_BLOODY_BABYLON = 110, NULLITEM_DARK_ARTS = 111, NULLITEM_LOST_CURSE = 112, @@ -1195,7 +1199,7 @@ struct ActiveItemDesc int batteryCharge = 0; int charge = 0; int item = 0; - int partialCharge = 0; + float partialCharge = 0; int subCharge = 0; int timeRechargeCooldown = 0; int unknown = 0; @@ -1634,6 +1638,7 @@ public: EntityRef lastDamageSource; uint64_t lastDamageFlags = 0; + int damageChargeCooldown = 0; int damageCooldown = 0; int flashCountdown = 0; int lastDamageSourceVariant = 0; @@ -1670,6 +1675,7 @@ public: EntityPtr monstranceAura; EntityPtr redemptionEffect; EntityPtr salvationEffect; + EntityPtr saturnusRing; EntityPtr telekinesisHalo; EntityPtr tetheredEffect; EntityPtr tractorBeam; @@ -1681,10 +1687,10 @@ public: Entity* darkArtsLastSnare = nullptr; Entity* heldEntity = nullptr; EntityPtr markedTarget; + EntityPtr megaBlastLaser; EntityPtr montezumaLaser; EntityPtr spearOfDestiny; Entity_Familiar* forgottenBody = nullptr; - Entity_Laser* megaBlastLaser = nullptr; Vector forgottenBodyPos{}; Vector minecartOffset{}; Vector suplexLandPos{}; diff --git a/src/entity_player_actives.cpp b/src/entity_player_actives.cpp index e3f1647..76cfdf3 100644 --- a/src/entity_player_actives.cpp +++ b/src/entity_player_actives.cpp @@ -15,6 +15,9 @@ #include "entity_effect.h" #include "entity_pickup.h" #include "entity_tear.h" +#include "entity_effect_combat.h" +#include "item_pool.h" +#include "player_manager.h" #include "game.h" #include "grid_entity_door.h" #include "grid_entity_poop.h" @@ -134,16 +137,6 @@ constexpr UseOverlay USE_OVERLAYS[] = { {COLLECTIBLE_SATANIC_BIBLE, 15}, {COLLECTIBLE_D12, 37}, {COLLECTIBLE_D8, 36}, {COLLECTIBLE_GLOWING_HOUR_GLASS, 14}}; -// The actives the original's dispatch has a case for. Any other item used only adds its room effect. -constexpr int CASED_ACTIVES[] = { - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 44, 45, 47, 49, 56, 58, 59, 65, 66, 78, 83, 84, 85, 86, 93, 97, 102, 105, - 107, 111, 123, 124, 126, 127, 130, 133, 135, 136, 145, 146, 147, 158, 160, 164, 166, 171, 175, 177, 181, 186, 192, - 263, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 323, 324, 325, 326, 338, 347, - 348, 349, 351, 352, 357, 382, 383, 386, 396, 406, 419, 421, 422, 427, 434, 437, 439, 441, 475, 476, 477, 478, 479, - 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 504, 507, 510, 512, 515, 521, 522, 523, 527, 536, 545, 550, - 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; @@ -160,16 +153,6 @@ constexpr ColorMod BELIAL_BONUS_FLAME_COLOR = {{5, 0.5f, 0.2f, 1}, {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 -{ - int lastItem = 0; - const char* name = nullptr; -}; - -constexpr ActiveRelease ACTIVE_RELEASES[] = { - {346, "Rebirth"}, {441, "Afterbirth"}, {552, "Afterbirth+"}, {COLLECTIBLE_VANILLA_COUNT - 1, "Repentance"}}; - // Plays a sound at the player's volume, unless the seeds swap it for a fart. void sound_play_local(Entity_Player& player, int sound) { @@ -621,8 +604,155 @@ bool Entity_Player::FullCharge(int slot, bool isForce, bool isOvercharge) return (uint8_t)AddActiveCharge(charge, slot, true, isOvercharge, isForce) != 0; } +// Esau Jr.: a new one's hearts (three black ones), the tries at rerolling each of its items, the item a reroll falls +// back on and the draws it rerolls with (no actives, no modifiers), and the burst of teeth when no slot is free. +constexpr int ESAU_JR_SOUL_HEARTS = 6; +constexpr int ESAU_JR_BLACK_MASK = -1; +constexpr int ESAU_JR_REROLL_TRIES = 10; +constexpr int ESAU_JR_FALLBACK_ITEM = COLLECTIBLE_BREAKFAST; +constexpr uint32_t ESAU_JR_POOL_FLAGS = POOL_FLAG_BAN_ACTIVES | POOL_FLAG_IGNORE_MODIFIERS; +constexpr int ESAU_JR_FAIL_TEETH = 8; +constexpr float ESAU_JR_FAIL_SPEED = 2; +constexpr float ESAU_JR_FAIL_SPEED_RANGE = 3; +constexpr int ESAU_JR_FAIL_BLOOD = 2; + +// Part of 007ac7e0: a new Esau Jr. in the first free slot, which the active's data then names. It is the player's kind +// with three black hearts, the player's stats and consumables, and each passive item the player has held rerolled from +// its pool. None when every slot is taken. +static Entity_Player* esau_jr_create(Entity_Player& player, ActiveItemDesc& active) +{ + auto& states = g_game->playerManager.esauJrState; + auto free = std::ranges::find(states, nullptr); + if (free == states.end()) return nullptr; + + Entity_Player& esau = *(*free = new Entity_Player()); + active.varData = (int)(free - states.begin()) + 1; + esau.Init(player.type, player.variant, 0, player.initSeed); + esau.pos = player.pos; + esau.velocity = player.velocity; + esau.temporaryEffects.AddNullEffect(NULLITEM_ESAU_JR, true, 1); + esau.maxHearts = 0; + esau.redHearts = 0; + esau.eternalHearts = 0; + // The original clears the user's bone heart mask here, not the new player's. + player.boneHeartsMask = 0; + esau.boneHearts = 0; + esau.rottenHearts = 0; + esau.soulHearts = ESAU_JR_SOUL_HEARTS; + esau.blackHearts = ESAU_JR_BLACK_MASK; + esau.UpdateBlackHeartMask(); + esau.edenSpeed = player.edenSpeed; + esau.edenFireDelay = player.edenFireDelay; + esau.edenDamage = player.edenDamage; + esau.edenTearRange = player.edenTearRange; + esau.edenShotSpeed = player.edenShotSpeed; + esau.edenLuck = player.edenLuck; + esau.totalDamageTaken = player.totalDamageTaken; + player.SyncConsumables(&esau, CONSUMABLE_ALL); + + RNG& rng = player.GetCollectibleRNG(COLLECTIBLE_ESAU_JR); + esau.history.isLocked = true; + for (const HistoryItem& held : player.history.historyItems) + { + if (held.isTrinket || player.collectibleCounts[held.id] <= 0) continue; + ItemConfig_Item* item = g_manager->itemConfig.GetCollectible(held.id); + if (!item || item->type == ITEM_ACTIVE || !player.CanRerollCollectible(held.id, false) || held.time <= 0) continue; + + HistoryItem rolled = held; + rolled.id = 0; + for (int tries = 0; rolled.id == 0 && tries < ESAU_JR_REROLL_TRIES; tries++) + rolled.id = g_game->itemPool.GetCollectible((ItemPoolType)held.itemPoolType, rng.Next(), ESAU_JR_POOL_FLAGS, 0, 0); + if (rolled.id == 0) rolled.id = ESAU_JR_FALLBACK_ITEM; + esau.AddCollectible(rolled.id, 0, false, ACTIVE_SLOT_PRIMARY, 0, 0); + esau.history.historyItems.push_back(rolled); + } + esau.history.isLocked = false; + return &esau; +} + +// Part of 007ac7e0: with every Esau Jr. slot taken, glass breaks in a burst of teeth and blood and the player gets the +// Esau Jr. familiar instead. The item goes unless the use removes it anyway. Whether the discharge goes on. +static bool esau_jr_fail(Entity_Player& player, uint32_t slot, bool isRemoved) +{ + sound_play(SOUND_GLASS_BREAK); + uint32_t seed = Random(); + g_game->Spawn({.position = player.pos, .type = ENTITY_EFFECT, .variant = EFFECT_IMPACT, .seed = seed})->Update(); + float height = player.posOffset.y; + game_particles_spawn({.position = player.pos, .height = height, + .speed = random_between(ESAU_JR_FAIL_SPEED, ESAU_JR_FAIL_SPEED_RANGE), + .count = ESAU_JR_FAIL_TEETH, .variant = EFFECT_TOOTH_PARTICLE}); + seed = Random(); + g_game->Spawn({.position = player.pos, .subType = ESAU_JR_FAIL_BLOOD, .type = ENTITY_EFFECT, + .variant = EFFECT_BLOOD_EXPLOSION, .seed = seed})->Update(); + player.temporaryEffects.AddNullEffect(NULLITEM_ESAU_JR_FAMILIAR, true, 1); + player.EvaluateItems(); + player.AnimateCollectible(COLLECTIBLE_ESAU_JR, "UseItem", "PlayerPickupSparkle"); + if (isRemoved) return true; + + player.RemoveCollectible(player.activeItems[slot].item, false, (int)slot, true); + return false; +} + +// Part of 007ac7e0: the swap with the Esau Jr. the active names. The stored player takes the user's place, kind, Dark +// Esau, Jacob's Curse, quest items and this active, in a poof, and the user waits in its slot. +static void esau_jr_swap(Entity_Player& player, uint32_t slot) +{ + ActiveItemDesc& active = player.activeItems[slot]; + if (active.varData <= 0) return; + Entity_Player*& stored = g_game->playerManager.esauJrState[active.varData - 1]; + Entity_Player* esau = stored; + if (!esau) return; + + esau->isControlsEnabled = false; + Entity* darkEsau = player.darkEsau; + if (darkEsau) player.darkEsau = nullptr; + std::optional curse; + if (TemporaryEffect* effect = player.temporaryEffects.GetNullEffect(NULLITEM_JACOBS_CURSE)) curse = *effect; + esau->totalDamageTaken = player.totalDamageTaken; + g_game->playerManager.replace_player(&player, esau); + stored = &player; + sound_play(SOUND_ESAUJR); + if (esau->playerType != player.playerType) esau->ChangePlayerType(player.playerType, true); + if (darkEsau) esau->darkEsau = darkEsau; + esau->temporaryEffects.RemoveNullEffect(NULLITEM_JACOBS_CURSE, -1); + if (curse) esau->temporaryEffects.AddEffect(*curse, true, 1); + + std::vector& held = player.history.historyItems; + bool isMoved = false; + for (auto each = held.begin(); each != held.end();) + { + ItemConfig_Item* item = each->isTrinket ? nullptr : g_manager->itemConfig.GetCollectible(each->id); + if (!item || item->type == ITEM_ACTIVE || !item->HasTags(TAG_QUEST)) + { + ++each; + continue; + } + esau->collectibleCounts[each->id] = player.collectibleCounts[each->id]; + player.collectibleCounts[each->id] = 0; + esau->history.AddHistoryItem(*each); + each = held.erase(each); + esau->cacheFlags |= item->cacheFlags; + isMoved = true; + } + if (isMoved) esau->temporaryEffects.isEvaluateCachePending = true; + + uint32_t seed = Random(); + g_game->Spawn({.position = player.pos, .type = ENTITY_EFFECT, .variant = EFFECT_POOF01, .seed = seed})->Update(); + int esauItem = esau->activeItems[slot].item; + if (esauItem != active.item && esauItem != 0) esau->RemoveCollectible(esauItem, true, ACTIVE_SLOT_PRIMARY, true); + esau->activeItems[slot] = active; + esau->AnimateCollectible(COLLECTIBLE_ESAU_JR, "UseItem", "PlayerPickupSparkle"); + player.SyncConsumables(esau, CONSUMABLE_ALL); + esau->isControlsEnabled = true; + esau->controlsCooldown = 1; + if (player.HasCollectible(COLLECTIBLE_BOOK_OF_VIRTUES) || esau->HasCollectible(COLLECTIBLE_BOOK_OF_VIRTUES)) + esau->AddWisp(COLLECTIBLE_ESAU_JR, player.pos, false, false); + esau->TriggerNewRoom_TemporaryEffects(); +} + // 007ac7e0 Spends an active slot's charge after a use, its battery charge becoming the charge. Bethany pays what was -// missing in soul or blood charges, 9 Volt gives one back. Esau Jr. and Flip move the item, the rest is the after use. +// missing in soul or blood charges, 9 Volt gives one back. Esau Jr. swaps with its stored player (making one first), +// Flip moves the item, the rest is the after use. void Entity_Player::DischargeActiveItem(uint32_t slot, bool isRemoved) { if (slot >= (uint32_t)ACTIVE_SLOT_COUNT || activeItems[slot].item == 0) return; @@ -664,10 +794,14 @@ void Entity_Player::DischargeActiveItem(uint32_t slot, bool isRemoved) int chargeBefore = active.charge; SetActiveCharge(newCharge, slot); isActiveUsed = false; - if (active.item == COLLECTIBLE_ESAU_JR) - reconstruction_missing("Entity_Player::DischargeActiveItem 007ac7e0 (Esau Jr.'s swap)"); Entity_Player* otherLazarus = twin_get() ? twin_get() : backupPlayer; - if (active.item == COLLECTIBLE_FLIP && slot == ACTIVE_SLOT_POCKET && otherLazarus) + if (active.item == COLLECTIBLE_ESAU_JR) + { + bool isReady = active.varData != 0 || esau_jr_create(*this, active); + if (!isReady && !esau_jr_fail(*this, slot, isRemoved)) return; + esau_jr_swap(*this, slot); + } + else if (active.item == COLLECTIBLE_FLIP && slot == ACTIVE_SLOT_POCKET && otherLazarus) { otherLazarus->activeItems[ACTIVE_SLOT_POCKET] = active; active_used_post(slot, isRemoved, chargeBefore); @@ -728,8 +862,8 @@ static void m_trinket_swap(Entity_Player& player) } } -// 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). +// Expansion Pack: a spent active also uses a random one- or two-charge active (twice with two copies, after a +// three-charge one with three). A timed, special or chargeless active does it once a room, except in a versus match. static void expansion_pack_use(Entity_Player& player) { constexpr int EXCLUDED[] = {COLLECTIBLE_D_INFINITY, COLLECTIBLE_GLOWING_HOUR_GLASS, COLLECTIBLE_METRONOME, @@ -737,8 +871,9 @@ static void expansion_pack_use(Entity_Player& player) 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; + bool isRoomLimited = active_charge_type(player, ACTIVE_SLOT_PRIMARY) != CHARGE_NORMAL || spent->maxCharges < 1; + DeathmatchManager& versus = g_game->deathmatchManager; + if (isRoomLimited && effects.HasTrinketEffect(TRINKET_EXPANSION_PACK) && !versus.is_active()) return; effects.AddTrinketEffect(TRINKET_EXPANSION_PACK, true, 1); WeightedOutcomePicker small; @@ -747,13 +882,14 @@ static void expansion_pack_use(Entity_Player& player) { if (!is_trinket_active(player, item.get()) || std::ranges::find(EXCLUDED, item->id) != std::end(EXCLUDED)) continue; + if (versus.is_active() && versus.type->is_collectible_banned(item->id)) 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--) + for (int use = copies == 2 || copies == 3 ? 2 : 1; use > 0; use--) trinket_active_use(player, small.PickOutcome(rng_make(rng.Next(), DEFAULT_SHIFT_INDEX))); } @@ -1142,7 +1278,7 @@ static void tammys_head_use(ItemUse& use) if (player.megaBlastLaser) { tammys_head_mega_blast(player, turn, scale * TAMMY_BEAM_DAMAGE); - use.isShowAnimation = false; + use.isLuaAnimationAllowed = false; return; } bool isOtherWeapon = player.HasWeaponType(WEAPON_BOMBS) || player.HasWeaponType(WEAPON_BRIMSTONE) || @@ -1233,6 +1369,7 @@ static void yum_heart_use(ItemUse& use) sound_play(player.playerType == PLAYER_MAGDALENE_B ? SOUND_VAMP_DOUBLE : SOUND_VAMP_GULP); for (Entity_Player* each : g_game->playerManager.playerList) each->AddHearts(each == &player ? YUM_HEART_OWN_HEARTS : YUM_HEART_OTHER_HEARTS, false, false); + use_animate(use); } // Lemon Mishap: a pool of lemon creep under the player. @@ -1256,6 +1393,7 @@ static void book_of_revelations_use(ItemUse& use) player.AddSoulHearts(REVELATIONS_SOUL_HEARTS, false); g_game->ForceHorsemanBoss(player.GetCollectibleRNG(COLLECTIBLE_BOOK_OF_REVELATIONS).Next()); g_game->SetStateFlag(REVELATIONS_STATE_FLAG, true); + use_animate(use); } // A pedestal the D6 rerolls: another item from the pools (with a wisp for Book of Virtues), or none a quarter of the @@ -1345,6 +1483,7 @@ static void razor_blade_use(ItemUse& use) player.TakeDamage(damage * (isFirst ? RAZOR_BLADE_FIRST_SCALE : 1), RAZOR_BLADE_DAMAGE_FLAGS, EntityRef(), DAMAGE_COUNTDOWN_FRAMES); sound_play(SOUND_RAZOR_BLADE); + use_animate(use); } // Spider Butt: every enemy slowed for the item's cooldown, hurt, and set to leave a spider when it dies. @@ -1365,6 +1504,7 @@ static void spider_butt_use(ItemUse& use) entity->AddEntityFlags(FLAG_SPAWN_STICKY_SPIDERS); entity->TakeDamage(SPIDER_BUTT_DAMAGE, SPIDER_BUTT_DAMAGE_FLAGS, EntityRef(&player), DAMAGE_COUNTDOWN_FRAMES); } + use_animate(use); } // Metronome's pick: a random collectible from its own generator, never Metronome itself or an item that would undo the @@ -1417,7 +1557,6 @@ static void metronome_use(ItemUse& use) if (player.metronomeCollectibleId == 0) { log_printf(LOG_INFO, "[warn] No Collectible found for Metronome!\n"); - use.isLuaAnimationAllowed = false; return use_animate(use); } @@ -1446,7 +1585,7 @@ static void metronome_use(ItemUse& use) player.AnimateCollectible(player.metronomeCollectibleId, "UseItem", "PlayerPickupSparkle"); } -// Delirious: a random boss from its list comes as a friend, the item raised by hand. +// Delirious: a random boss from its list comes as a friend, the item raised. static void delirious_use(ItemUse& use) { Entity_Player& player = use.player; @@ -1455,7 +1594,6 @@ static void delirious_use(ItemUse& use) uint32_t boss = player.GetCollectibleRNG(COLLECTIBLE_DELIRIOUS).RandomInt(DELIRIOUS_BOSS_COUNT); player.console_spawn(DELIRIOUS_BOSSES[boss], use.isWispAllowed); } - use.isLuaAnimationAllowed = false; use_animate(use); } @@ -1588,18 +1726,11 @@ void Game::ShowHallucination(int frames, int backdrop) room->backdrop.load_details(); } -// Holds the item up once, so a mod's use does not raise it again. -void use_raise(ItemUse& use) -{ - use_animate(use); - use.isLuaAnimationAllowed = false; -} - // The books whose effect is all in their room effect: their sound, the item raised. void sound_raise_use(ItemUse& use, int sound) { sound_play(sound); - use_raise(use); + use_animate(use); } // The items held up until fired or let go (Bob's Rotten Head, Doctor's Remote, the candles): the item lifted. @@ -1616,6 +1747,7 @@ static void nail_use(ItemUse& use) if (use.player.variant != PLAYER_VARIANT_PLAYER) return; sound_play(SOUND_MONSTER_YELL_A); use.player.AddBlackHearts(1); + use_animate(use); } // A Pony and the White Pony: a dash the way the player moves, when it moves. @@ -1637,8 +1769,6 @@ static void pony_use(ItemUse& use) // Birthright adds its damage effect for the first slot. static void guppys_paw_use(ItemUse& use) { - constexpr int NULL_BELIAL_BIRTHRIGHT_PAW = 130; - Entity_Player& player = use.player; if (player.variant != PLAYER_VARIANT_PLAYER || player.maxHearts <= 1) return; @@ -1649,7 +1779,7 @@ static void guppys_paw_use(ItemUse& use) player.UpdateHeartDependentEffects(); use_animate(use); if (use.request.slot == ACTIVE_SLOT_PRIMARY && player.HasCollectible(COLLECTIBLE_BOOK_OF_BELIAL_PASSIVE)) - player.temporaryEffects.AddNullEffect(NULL_BELIAL_BIRTHRIGHT_PAW, true, 1); + player.temporaryEffects.AddNullEffect(NULLITEM_JUDAS_BIRTHRIGHT_PERMANENT, true, 1); } // Guppy's Head: two to four blue flies, or as many wisps with Book of Virtues. @@ -1663,6 +1793,7 @@ static void guppys_head_use(ItemUse& use) player.AddBlueFlies(count, player.pos, nullptr); else for (int i = 0; i < count; i++) player.AddWisp(COLLECTIBLE_GUPPYS_HEAD, player.pos, false, false); + use_animate(use); } // Notched Axe: the axe drawn for the room, once, its charge kept. @@ -1704,6 +1835,7 @@ static void blood_rights_use(ItemUse& use) player.RemoveCollectible(COLLECTIBLE_BLOOD_RIGHTS, true, use.request.slot, true); player.cacheFlags |= CACHE_FIREDELAY; player.EvaluateItems(); + use_animate(use); } // Telepathy for Dummies: homing tears from the room effect, the achievement when the player already has homing. @@ -1714,14 +1846,13 @@ static void telepathy_book_use(ItemUse& use) sound_play(SOUND_TELEPATHY_DUMMY); if ((use.player.tearFlags & TearFlags().set(TEAR_HOMING)).any()) g_manager->persistentGameData.TryUnlock(ACHIEVEMENT_TELEPATHY_HOMING); - use_raise(use); + use_animate(use); } // The Smelter: the held trinkets smelted for good, with its sound. static void smelter_use(ItemUse& use) { trinkets_smelt(use.player); - use.isLuaAnimationAllowed = false; if (!use.isShowAnimation) return; sound_play_local(use.player, SOUND_SMELTER); use_animate(use); @@ -1738,6 +1869,7 @@ static void moms_pad_use(ItemUse& use) for (Entity* entity : room_entities()) if (entity->IsVulnerableEnemy(nullptr) && entity != &player) entity->AddFear(EntityRef(&player), duration, false); player.AddBlueFlies(1, player.pos, nullptr); + use_animate(use); } // Deck of Cards and Mom's Bottle of Pills: a card or a pill in the pockets, held up. Little Baggy turns the deck's @@ -1837,7 +1969,7 @@ static void item_effect_run(ItemUse& use) return guppys_head_use(use); case COLLECTIBLE_PRAYER_CARD: if (use.player.variant == PLAYER_VARIANT_PLAYER) use.player.AddEternalHearts(1); - return; + return use_animate(use); case COLLECTIBLE_NOTCHED_AXE: return notched_axe_use(use); case COLLECTIBLE_CRACK_THE_SKY: @@ -1857,7 +1989,7 @@ static void item_effect_run(ItemUse& use) case COLLECTIBLE_BAG_OF_CRAFTING: { const char* animation = bag_of_crafting_use(use.player, use.request.slot); - if (animation && use.isShowAnimation) use.player.AnimateCollectible(use.id, animation, "PlayerPickupSparkle"); + if (animation) use.player.AnimateCollectible(use.id, animation, "PlayerPickupSparkle"); return; } } @@ -1865,19 +1997,6 @@ static void item_effect_run(ItemUse& use) else repentance_item_effect_run(use); } -// Stops the game at an active whose own case is not written yet, named by the release that added it. The items without -// a case only add their room effect. -void active_missing_report(ItemUse& use) -{ - if (std::ranges::find(CASED_ACTIVES, use.id) == std::end(CASED_ACTIVES)) return; - - const ActiveRelease* release = std::ranges::find_if(ACTIVE_RELEASES, [&](const ActiveRelease& each) - { return use.id <= each.lastItem; }); - std::string name = std::string("Entity_Player::UseActiveItem 005b39d0 (the ") + release->name + " active " + - std::to_string(use.id) + ")"; - reconstruction_missing(name.c_str()); -} - // 005b39d0 Uses an active item: co-op babies copy the main player's first use since a discharge, the item is raised // with its sound, its own effect runs, mods see the use, its room effect and costume go on and the stats are reread. // What its slot does next: discharge unless an item state holds the item, and remove it if a mod asks. @@ -1953,7 +2072,7 @@ static int wavy_cap_recharge_step(Entity_Player& player) // The first slot's frame for every slot: recharge cooldowns count down, a timed item fills a charge a frame and beeps // when full, 9 Volt refills an empty one-charge item after a while in a room with enemies, and 4.5 Volt turns a whole -// partial charge into a charge (the original's partial charge is a float, which only 4.5 Volt's damage fills). +// partial charge (which the damage dealt fills) into a charge. static void timed_items_recharge(Entity_Player& player) { for (int slot = 0; slot < ACTIVE_SLOT_COUNT; slot++) @@ -2216,7 +2335,8 @@ static void breath_of_life_control(Entity_Player& player, int slot, ItemButton& int maxCharge = player.GetActiveMaxCharge(slot); if (active.charge < maxCharge) return; button.isHeldUse = true; - if (active.batteryCharge < maxCharge) active.batteryCharge = 0; + if (active.batteryCharge >= maxCharge) return; + active.batteryCharge = 0; active.timeRechargeCooldown = HELD_COOLDOWN; return; } @@ -2339,20 +2459,20 @@ static UseResult aprils_fool_use(Entity_Player& player, int slot) return result; } -// A use Panic Button made spends the item only one time in ten with two copies, one in five with three or more. +// A use Panic Button made keeps its charge one time in ten with two copies, one in five with three or more. static bool is_panic_discharge_kept(Entity_Player& player) { constexpr int TWO_COPY_ODDS = 10; constexpr int MORE_COPY_ODDS = 5; int copies = player.GetTrinketMultiplier(TRINKET_PANIC_BUTTON); if (copies < 2) return false; - return player.GetTrinketRNG(TRINKET_PANIC_BUTTON).RandomInt(copies == 2 ? TWO_COPY_ODDS : MORE_COPY_ODDS) != 0; + return player.GetTrinketRNG(TRINKET_PANIC_BUTTON).RandomInt(copies == 2 ? TWO_COPY_ODDS : MORE_COPY_ODDS) == 0; } // Uses a slot's item from the item button: only when charged and payable, else Mine Crafter's barrels go off or Sharp -// Plug may pay health for it. A held use (Spin to Win's spin, a full Breath of Life) skips that. A zero-charge item -// waits out its room effect. The use discharges the slot or removes the item as it asks, and Car Battery uses it -// again. +// Plug may pay health for it. A held use (Spin to Win's spin, a full Breath of Life) comes first and takes a charge +// from the first slot. A zero-charge item waits out its room effect. The use discharges the slot or removes the item +// as it asks, and Car Battery uses it again. static void active_slot_use(Entity_Player& player, int slot, int itemStateBefore, const ItemButton& button) { constexpr uint32_t CAR_BATTERY_FLAGS = USE_NOANIM | USE_CARBATTERY | USE_ALLOWWISPSPAWN | USE_CUSTOMVARDATA; @@ -2363,14 +2483,12 @@ static void active_slot_use(Entity_Player& player, int slot, int itemStateBefore int maxCharge = player.GetActiveMaxCharge(slot); int charge = player.activeItems[slot].charge; if (item == COLLECTIBLE_SPIN_TO_WIN && button.isHeldUse && charge >= SPIN_TO_WIN_START_CHARGE) - return spin_to_win_start(player); + spin_to_win_start(player); if (button.isHeldUse && charge == maxCharge) { if (player.HasEntityFlags(FLAG_INTERPOLATION_UPDATE)) return; player.UseActiveItem({.item = item, .flags = USE_NOANIM | USE_OWNED, .slot = slot}); player.AddActiveCharge(-1, ACTIVE_SLOT_PRIMARY, false, false, false); - if (player.HasTrinket(TRINKET_BROKEN_REMOTE) && slot == ACTIVE_SLOT_PRIMARY) player.isBrokenRemotePending = true; - return; } if (!is_active_usable(player, item, slot)) { diff --git a/src/entity_player_actives_afterbirth.cpp b/src/entity_player_actives_afterbirth.cpp index c5ab98f..77cc326 100644 --- a/src/entity_player_actives_afterbirth.cpp +++ b/src/entity_player_actives_afterbirth.cpp @@ -17,7 +17,12 @@ #include "log.h" #include "manager.h" #include "npc_ai.h" +#include "entity_effect_combat.h" +#include "entity_npc.h" +#include "player_manager.h" #include +#include +#include #include // The achievement a character entry carries when nothing unlocks it at all. @@ -134,7 +139,8 @@ static void clicker_use(ItemUse& use) if (isBelial) player.AddCollectible(COLLECTIBLE_PENTAGRAM, 0, true, ACTIVE_SLOT_PRIMARY, 0); } - if (use.isShowAnimation && twin) twin->AnimateCollectible(use.id, "UseItem", "PlayerPickupSparkle"); + Entity_Player* newTwin = player.twin_get(); + if (use.isShowAnimation && newTwin) newTwin->AnimateCollectible(use.id, "UseItem", "PlayerPickupSparkle"); if (player.HasCollectible(COLLECTIBLE_BOOK_OF_VIRTUES) && use.isWispAllowed) player.AddWisp(Entity_Familiar::GetRandomWisp(&rng), player.pos, false, false); g_game->itemOverlay.Show(GIANTBOOK_CLICKER, 0, nullptr); @@ -269,7 +275,6 @@ static void void_use(ItemUse& use) player.EvaluateItems(); int roomType = g_game->room->roomType; if (isAbsorbed && (roomType == ROOM_CHALLENGE || roomType == ROOM_BOSSRUSH)) g_game->ambush.StartChallenge(); - use.isLuaAnimationAllowed = isAbsorbed; use_animate(use); } @@ -448,7 +453,6 @@ static void moving_box_use(ItemUse& use) } if (isTaken && (room.roomType == ROOM_CHALLENGE || room.roomType == ROOM_BOSSRUSH)) g_game->ambush.StartChallenge(); - use.isLuaAnimationAllowed = isTaken; return use_animate(use); } @@ -605,7 +609,192 @@ static void sacrificial_altar_use(ItemUse& use) use_animate(use); } -// The Afterbirth and Afterbirth+ actives whose effects are large (477 to 545), else the stop for an uncased active. +// Book of the Dead: at most eight of the fallen rise, every one after the first two times in three. One in five comes +// back as a friendly skeleton (its pick seeded off the item's generator), the rest as bone orbitals thrown out at most 8 +// fast, the oldest crumbling past twelve. A skeleton has twice its health. The Big Bony's health (18, 3 a stage) is +// what a fallen one needs to rise as one. Teeth and two or three bone shards burst where one rises. +constexpr int DEAD_RAISED_MAX = 8; +constexpr int DEAD_SKIP_ODDS = 3; +constexpr int DEAD_SKELETON_ODDS = 5; +constexpr uint32_t DEAD_PICK_SHIFT_INDEX = 4; +constexpr int DEAD_KIND_ODDS = 4; +constexpr int REVENANT_ODDS = 100; +constexpr int REVENANT_FLOOR_MISS_ODDS = 12; +constexpr int BONE_FLY = 4; +constexpr float BIG_BONY_BASE_HP = 18; +constexpr float BIG_BONY_STAGE_HP = 3; +constexpr float RAISED_HEALTH_SCALE = 2; +constexpr size_t BONE_ORBITALS_KEPT = 12; +constexpr float BONE_ORBITAL_THROW = 8; +constexpr int RAISE_TEETH = 4; +constexpr float RAISE_BURST_SPEED = 2; +constexpr float RAISE_BURST_SPEED_RANGE = 3; +constexpr int RAISE_SHARDS = 2; +constexpr int RAISE_SHARDS_RANGE = 2; +constexpr int BONE_SHARD = 1; +constexpr int RAISE_SOUND_DELAY = 20; + +// A Book of the Dead use: its player, the item's generator and the player's bone orbitals, oldest first. +struct DeadRaising +{ + Entity_Player& player; + RNG& rng; + std::deque orbitals; +}; + +// Whether an enemy may come back: one the player has killed, or any in a daily. +static bool is_kill_known(int type, int variant) +{ + return g_manager->persistentGameData.GetBestiaryKillCount(type, variant) != 0 || g_game->dailyChallenge.id != 0; +} + +// The skeleton a fallen enemy rises as: a Bony, a Black Bony one time in four, a Bone Fly one in four for a flier, a +// Big Bony one in four for one as hardy, and a Revenant one time in a hundred (eleven in twelve on the floors it lives +// on), each only once killed. A fallen kind without a config counts as neither a flier nor hardy, where the original +// would crash. +static EntitySpawn skeleton_pick(RNG& rng, const KilledNpc& fallen) +{ + RNG pick; + pick.game_constructor(rng.Next(), DEAD_PICK_SHIFT_INDEX); + EntitySpawn skeleton = {.position = fallen.position, .type = ENTITY_BONY}; + if (pick.RandomInt(DEAD_KIND_ODDS) == 0) skeleton.type = ENTITY_BLACK_BONY; + + EntityConfig_Entity* config = + g_manager->entityConfig.GetEntity(fallen.type, (uint16_t)fallen.variant, (uint16_t)fallen.subtype); + bool isFlier = config && (config->gridCollisionClassString != "ground" || config->gridCollisionPoints == 0); + if (pick.RandomInt(DEAD_KIND_ODDS) == 0 && isFlier && is_kill_known(ENTITY_BOOMFLY, BONE_FLY)) + { + skeleton.type = ENTITY_BOOMFLY; + skeleton.variant = BONE_FLY; + } + + bool isHardy = config && stage_health_get(config->baseHP, config->stageHP) >= + stage_health_get(BIG_BONY_BASE_HP, BIG_BONY_STAGE_HP); + if (pick.RandomInt(DEAD_KIND_ODDS) == 0 && isHardy && is_kill_known(ENTITY_BIG_BONY, 0)) + { + skeleton.type = ENTITY_BIG_BONY; + skeleton.variant = 0; + } + + int stage = g_game->GetStageID(); + bool isRevenantFloor = stage == STAGE_ID_SHEOL || stage == STAGE_ID_DARK_ROOM || stage == STAGE_ID_MAUSOLEUM || + stage == STAGE_ID_GEHENNA; + bool isRevenant = pick.RandomInt(REVENANT_ODDS) == 0 || (pick.RandomInt(REVENANT_FLOOR_MISS_ODDS) != 0 && isRevenantFloor); + if (isRevenant && is_kill_known(ENTITY_REVENANT, 0)) + { + skeleton.type = ENTITY_REVENANT; + skeleton.variant = 0; + } + return skeleton; +} + +// The skeleton a versus ghost's spot raises: a Bony, then a Black Bony and a Big Bony one time in four each, and a +// Revenant one in a hundred once one has killed the player. +static EntitySpawn ghost_skeleton_pick(RNG& rng, Vector position) +{ + RNG pick; + pick.game_constructor(rng.Next(), DEAD_PICK_SHIFT_INDEX); + EntitySpawn skeleton = {.position = position, .type = ENTITY_BONY}; + if (pick.RandomInt(DEAD_KIND_ODDS) == 0) skeleton.type = ENTITY_BLACK_BONY; + if (pick.RandomInt(DEAD_KIND_ODDS) == 0) skeleton.type = ENTITY_BIG_BONY; + if (pick.RandomInt(REVENANT_ODDS) == 0 && g_manager->persistentGameData.GetBestiaryDeathCount(ENTITY_REVENANT, 0) != 0) + skeleton.type = ENTITY_REVENANT; + return skeleton; +} + +// A skeleton rises charmed for good, settles in at once, never holds the doors shut and has twice its health. +static void skeleton_raise(DeadRaising& raising, EntitySpawn skeleton) +{ + skeleton.spawner = &raising.player; + skeleton.seed = raising.rng.Next(); + auto* npc = static_cast(g_game->Spawn(skeleton)->to_npc_or_coop_player()); + npc->AddCharmed(EntityRef(), -1, false, false); + npc->Update(); + npc->isCanShutDoors = false; + npc->maxHitPoints *= RAISED_HEALTH_SCALE; + npc->health = npc->maxHitPoints; + npc_sound_play(SOUND_MONSTER_ROAR_0, 1, 2, 1); +} + +// A bone orbital is thrown out from a spot, the oldest crumbling past twelve. +static void bone_orbital_raise(DeadRaising& raising, Vector position) +{ + if (raising.orbitals.size() >= BONE_ORBITALS_KEPT) + { + raising.orbitals.front()->Remove(); + raising.orbitals.pop_front(); + } + Entity* orbital = raising.player.AddBoneOrbital(position); + Vector direction = random_direction(); + orbital->velocity = vector_scale(vector_scale(direction, BONE_ORBITAL_THROW), random_unit()); + orbital->ClearEntityFlags(FLAG_APPEAR); + raising.orbitals.push_back(orbital); +} + +// One rises at a spot, a skeleton picked from the fallen (or for a versus ghost without one) or a bone orbital, in a +// burst of teeth and bone shards. +static void dead_raise(DeadRaising& raising, Vector position, const KilledNpc* fallen) +{ + if (raising.rng.RandomInt(DEAD_SKELETON_ODDS) == 0) + skeleton_raise(raising, fallen ? skeleton_pick(raising.rng, *fallen) : ghost_skeleton_pick(raising.rng, position)); + else bone_orbital_raise(raising, position); + + float teethSpeed = random_between(RAISE_BURST_SPEED, RAISE_BURST_SPEED_RANGE); + game_particles_spawn({.position = position, .speed = teethSpeed, .count = RAISE_TEETH, .variant = EFFECT_TOOTH_PARTICLE}); + float shardSpeed = random_between(RAISE_BURST_SPEED, RAISE_BURST_SPEED_RANGE); + for (int shards = random_below(RAISE_SHARDS_RANGE) + RAISE_SHARDS; shards > 0; shards--) + { + uint32_t seed = Random(); + Vector direction = random_direction(); + Vector velocity = vector_scale(vector_make(direction.x, direction.y * HALF), shardSpeed); + Entity* shard = g_game->Spawn({.position = position, .velocity = velocity, .subType = BONE_SHARD, + .type = ENTITY_EFFECT, .variant = EFFECT_BLOOD_PARTICLE, .seed = seed}); + shard->AddEntityFlags(FLAG_NO_BLOOD_SPLASH); + shard->Update(); + } +} + +// 005b39d0 (case 545) Book of the Dead: the room's fallen rise (and in a versus match the ghosts' spots raise more) as +// the player's skeletons and bone orbitals, with a roar if any rose. +static void book_of_the_dead_use(ItemUse& use) +{ + DeadRaising raising = {.player = use.player, .rng = use.player.GetCollectibleRNG(COLLECTIBLE_BOOK_OF_THE_DEAD), .orbitals = {}}; + for (Entity* orbital : entity_query(ENTITY_FAMILIAR, Entity_Familiar::BONE_ORBITAL)) + if (static_cast(orbital)->player == &use.player) raising.orbitals.push_back(orbital); + + bool isRaised = false; + std::list& fallen = g_game->room->killedNpcs; + int raised = 0; + for (auto each = fallen.begin(); each != fallen.end() && raised < DEAD_RAISED_MAX;) + { + if (raised > 0 && raising.rng.RandomInt(DEAD_SKIP_ODDS) == 0) + { + ++each; + continue; + } + dead_raise(raising, each->position, &*each); + raised++; + each = fallen.erase(each); + isRaised = true; + } + + if (g_game->deathmatchManager.is_active()) + { + std::vector ghosts; + for (Entity_Player* each : g_game->playerManager.playerList) + if (each->isCoopGhost) ghosts.push_back(each->pos); + for (Vector position : ghosts) + { + isRaised = true; + dead_raise(raising, position, nullptr); + } + } + + if (isRaised) npc_sound_play(SOUND_DEVILROOM_DEAL, 1, RAISE_SOUND_DELAY, 1); + if (use.isShowAnimation) use.player.AnimateCollectible(use.id, "UseItem", "PlayerPickupSparkle"); +} + +// The Afterbirth and Afterbirth+ actives whose effects are large (477 to 545). Any other only adds its room effect. void afterbirth_item_effect_run(ItemUse& use) { switch (use.id) @@ -622,7 +811,9 @@ void afterbirth_item_effect_run(ItemUse& use) return moving_box_use(use); case COLLECTIBLE_SACRIFICIAL_ALTAR: return sacrificial_altar_use(use); + case COLLECTIBLE_BOOK_OF_THE_DEAD: + return book_of_the_dead_use(use); default: - return active_missing_report(use); + return; } } diff --git a/src/entity_player_actives_rebirth.cpp b/src/entity_player_actives_rebirth.cpp index 19d523e..e91d800 100644 --- a/src/entity_player_actives_rebirth.cpp +++ b/src/entity_player_actives_rebirth.cpp @@ -690,7 +690,7 @@ static void clear_rune_use(ItemUse& use) } // How to Jump: a leap 60 frames along the player's way, pulled back off blocked cells and enemies onto free ground, -// or kept in place. +// or kept in place. The original measures the way back in squared lengths, kept as it is. static void how_to_jump_use(ItemUse& use) { constexpr float JUMP_LOOKAHEAD = 60; @@ -705,7 +705,7 @@ static void how_to_jump_use(ItemUse& use) Vector target = room.GetClampedPosition(vector_add(player.pos, vector_scale(player.velocity, JUMP_LOOKAHEAD)), JUMP_MARGIN); Vector step = vector_sub(player.pos, target); - float remaining = vector_length(step); + float remaining = vector_length_squared(step); step = vector_scale(vector_normalized(step), JUMP_BACK_STEP); bool isFound = false; while (remaining > 0 && !isFound) @@ -713,7 +713,7 @@ static void how_to_jump_use(ItemUse& use) if (room_grid_collision_at(target) != 0) { target = vector_add(target, step); - remaining -= vector_length(step); + remaining -= vector_length_squared(step); continue; } isFound = true; @@ -724,7 +724,7 @@ static void how_to_jump_use(ItemUse& use) float reach = enemy->size + player.size + JUMP_ENEMY_GAP; if (!enemy->IsEnemy() || vector_length_squared(vector_sub(enemy->pos, target)) >= reach * reach) continue; target = vector_add(target, step); - remaining -= vector_length(step); + remaining -= vector_length_squared(step); isFound = false; } player.targetPosition = room.GetClampedPosition(target, JUMP_MARGIN); @@ -1615,8 +1615,8 @@ static void pandoras_box_use(ItemUse& use) use_animate(use); } -// Runs the own effect of a Rebirth or early Afterbirth active (below 400) the main dispatch does not case. The ones not -// written yet stop the game. +// Runs the own effect of a Rebirth or early Afterbirth active (below 400) the main dispatch does not case. Any other +// only adds its room effect. void rebirth_item_effect_run(ItemUse& use) { switch (use.id) @@ -1719,6 +1719,6 @@ void rebirth_item_effect_run(ItemUse& use) case COLLECTIBLE_BLUE_BOX: return pandoras_box_use(use); default: - return active_missing_report(use); + return; } } diff --git a/src/entity_player_actives_repentance.cpp b/src/entity_player_actives_repentance.cpp index 4abbb5b..f795a51 100644 --- a/src/entity_player_actives_repentance.cpp +++ b/src/entity_player_actives_repentance.cpp @@ -6,11 +6,18 @@ #include "entity_familiar.h" #include "entity_npc.h" #include "entity_pickup.h" +#include "entity_projectile.h" #include "entity_tear.h" #include "game.h" #include "hud.h" #include "item_overlay.h" #include "loot_list.h" +#include "persistent_game_data.h" +#include "player_manager.h" +#include "room_descriptor.h" +#include "grid_entity_door.h" +#include "entity_bomb.h" +#include "entity_effect_combat.h" #include "npc_basement.h" #include "pocket_items.h" #include "procedural_item_manager.h" @@ -87,6 +94,7 @@ constexpr std::array, 21> FRIEND_FINDER_FRIENDS = { constexpr int LARYNX_MAX_CHARGE = 12; constexpr int LARYNX_MED_CHARGE = 5; constexpr int LARYNX_HIGH_CHARGE = 9; +constexpr int LARYNX_MEDIUM_LAST = LARYNX_HIGH_CHARGE - 1; constexpr int LARYNX_EFFECT_EXTRA_FRAMES = 8; constexpr int LARYNX_SHAKE_BASE = 2; constexpr int LARYNX_SHAKE_STEP = 3; @@ -645,13 +653,14 @@ static void sumptorium_use(ItemUse& use) player.temporaryEffects.RemoveCollectibleEffect(COLLECTIBLE_SUMPTORIUM, -1); } -// Suplex!: a dash the way the player moves, when it moves and is not already grabbing, then the leap waits on an aim. +// Suplex!: a dash the way the player moves, when it moves, is not already grabbing and is not huge from Mega Mush, +// then the leap waits on an aim. static void suplex_use(ItemUse& use) { Entity_Player& player = use.player; if (player.suplexState != 0 || vector_length_squared(player.velocity) <= 1 || - player.temporaryEffects.HasCollectibleEffect(COLLECTIBLE_SUPLEX)) + player.temporaryEffects.HasCollectibleEffect(COLLECTIBLE_MEGA_MUSH)) return; sound_play(SOUND_SUPLEX_ACTIVATE); player.velocity = vector_scale(vector_normalized(player.velocity), SUPLEX_DASH_SPEED); @@ -790,7 +799,7 @@ static void d_infinity_use(ItemUse& use) bool isOwnSlot = (flags & USE_OWNED) && slot >= 0 && player.activeItems[slot].item == COLLECTIBLE_D_INFINITY; if (flags & USE_CUSTOMVARDATA) face = (int)((uint32_t)use.request.varData >> D_INFINITY_FACE_SHIFT); else if (isOwnSlot) face = (int)((uint32_t)player.activeItems[slot].varData >> D_INFINITY_FACE_SHIFT); - else face = (int)(player.GetCollectibleRNG(COLLECTIBLE_D_INFINITY).Next() % D_INFINITY_FACES); + else face = (int)(player.GetCollectibleRNG(COLLECTIBLE_D_INFINITY)._seed % D_INFINITY_FACES); int die = D_INFINITY_DICE[face]; if ((flags & USE_OWNED) && slot >= 0 && player.activeItems[slot].item == COLLECTIBLE_D_INFINITY) @@ -1000,7 +1009,7 @@ static void larynx_use(ItemUse& use) { int sound = SOUND_LARYNX_SCREAM_HI; seed_fart_sound_override(&sound); - g_manager->sfxManager.Play(sound, {.volume = (charge - LARYNX_HIGH_CHARGE) * LARYNX_HIGH_VOLUME_STEP + LARYNX_LOUD_VOLUME}); + g_manager->sfxManager.Play(sound, {.volume = (charge - LARYNX_MEDIUM_LAST) * LARYNX_HIGH_VOLUME_STEP + LARYNX_LOUD_VOLUME}); } if (charge > LARYNX_MED_CHARGE) { @@ -1552,8 +1561,305 @@ static void mega_mush_use(ItemUse& use) player.isVisible = false; } +// Everything Jar: the most charges it reads, what each charge from two to eleven buys, the surprises a full jar rolls +// among (one does nothing), and the timers some start: blue friends every 2 frames 5 to 14 times, beams every 5 frames +// 18 to 27 times, shopkeepers every 2 frames 6 to 17 times. The beams fall 20 in from the walls, three times the +// player's damage plus 4, scaled 0.7 to 2.1, bright at 0.6 to 0.8. The shopkeepers scatter up to 20. The ambush +// comes 4 strong, Gaper-hardy (8, 3 a stage), up to 20 about doors over 80 from every player. A shower is 6 to 17 +// pickups, one in three glitched. A wisp gains half a heart and a fifth of its damage a charge. +constexpr int EVERYTHING_JAR_CHARGES = 12; +constexpr uint32_t JAR_SURPRISES = 12; +constexpr uint32_t JAR_SWARM_DELAY = 2; +constexpr uint32_t JAR_SWARM_TIMES = 5; +constexpr uint32_t JAR_SWARM_TIMES_RANGE = 10; +constexpr uint32_t JAR_SWARM_KINDS = 3; +constexpr uint32_t JAR_STORM_DELAY = 5; +constexpr uint32_t JAR_STORM_TIMES = 18; +constexpr uint32_t JAR_STORM_TIMES_RANGE = 10; +constexpr uint32_t JAR_SHOPKEEPER_DELAY = 2; +constexpr uint32_t JAR_SHOPKEEPER_TIMES = 6; +constexpr uint32_t JAR_SHOPKEEPER_TIMES_RANGE = 12; +constexpr float JAR_ROOM_MARGIN = 20; +constexpr float JAR_BEAM_DAMAGE_SCALE = 3; +constexpr float JAR_BEAM_DAMAGE = 4; +constexpr float JAR_BEAM_SCALE = 0.7f; +constexpr float JAR_BEAM_SCALE_RANGE = 1.4f; +constexpr float JAR_BEAM_SIZE = 20; +constexpr float JAR_BEAM_VALUE = 0.6f; +constexpr float JAR_BEAM_VALUE_RANGE = 0.2f; +constexpr int JAR_BEAM_SUBTYPE = 2; +constexpr float JAR_SCATTER = 20; +constexpr uint32_t JAR_AMBUSH_ENEMIES = 4; +constexpr float JAR_AMBUSH_BASE_HP = 8; +constexpr float JAR_AMBUSH_STAGE_HP = 3; +constexpr float JAR_AMBUSH_DOOR_DISTANCE_SQUARED = 6400; +constexpr uint32_t JAR_SHOWER = 6; +constexpr uint32_t JAR_SHOWER_RANGE = 12; +constexpr uint32_t JAR_SHOWER_DELAY_RANGE = 5; +constexpr uint32_t JAR_GLITCH_ODDS = 3; +constexpr uint32_t JAR_GIGA_LIT_ODDS = 4; +constexpr float JAR_WISP_SCALE = 0.2f; +constexpr uint32_t JAR_USE_FLAGS = USE_NOANIM | USE_NOCOSTUME; +constexpr uint32_t JAR_CARD_FLAGS = USE_NOANIM | USE_NOCOSTUME | USE_MIMIC | USE_NOANNOUNCER; + +// A pickup the jar buys. +struct JarPickup +{ + int variant = 0; + int subType = 0; +}; + +constexpr JarPickup JAR_PICKUPS[] = {{PICKUP_COIN, COIN_PENNY}, {PICKUP_BOMB, BOMB_SUBTYPE_NORMAL}, + {PICKUP_KEY, KEY_NORMAL}, {PICKUP_HEART, HEART_FULL}, + {PICKUP_PILL, 0}, {PICKUP_TAROTCARD, 0}, + {PICKUP_HEART, HEART_SOUL}, {PICKUP_HEART, HEART_GOLDEN}, + {PICKUP_KEY, KEY_GOLDEN}, {PICKUP_BOMB, BOMB_SUBTYPE_GOLDEN}}; + +// The player a jar timer is tied to, if any. +static Entity_Player* jar_timer_player(Entity_Effect* timer) +{ + Entity* parent = timer->parent; + return parent && parent->type == ENTITY_PLAYER ? static_cast(parent) : nullptr; +} + +// 005c7f20 A full jar's swarm tick: the timer's player gains a blue fly, a blue spider or a dip. +static void jar_swarm_timer(Entity_Effect* timer) +{ + Entity_Player* player = jar_timer_player(timer); + if (!player) return; + + uint32_t kind = timer->dropRNG.Next() % JAR_SWARM_KINDS; + Vector at = player->pos; + Vector still{}; + if (kind == 0) player->AddBlueFlies(1, at, nullptr); + else if (kind == 1) + { + player->numBlueSpiders++; + spawn_blue_spider(at, player, still); + } + else spawn_dip_at(0, &at, player, &still); +} + +// 005c8020 A full jar's storm tick: a beam of light falls somewhere in the room for the timer's player, its damage and +// size scaled alike, tinted a random bright hue and drawn additively. +static void jar_storm_timer(Entity_Effect* timer) +{ + Vector at = g_game->room->GetRandomPosition(JAR_ROOM_MARGIN); + Entity_Player* player = jar_timer_player(timer); + if (!player) return; + + RNG& rng = timer->dropRNG; + float scale = rng.RandomFloat() * JAR_BEAM_SCALE_RANGE + JAR_BEAM_SCALE; + Entity* beam = g_game->Spawn({.position = at, .spawner = player, .subType = JAR_BEAM_SUBTYPE, .type = ENTITY_EFFECT, + .variant = EFFECT_CRACK_THE_SKY, .seed = Random()}); + beam->SetCollisionDamage((player->meleeDamage * JAR_BEAM_DAMAGE_SCALE + JAR_BEAM_DAMAGE) * scale); + beam->SetSize(scale * JAR_BEAM_SIZE, vector_make(-1, -1), -1); + beam->parent = player; + + float value = rng.RandomFloat() * JAR_BEAM_VALUE_RANGE + JAR_BEAM_VALUE; + KColor tint = hsv_to_rgb(rng.RandomFloat() * FULL_TURN_DEGREES, 1, value, 1); + float* beamTint = beam->sprite.color._tint; + beamTint[0] = tint._red; + beamTint[1] = tint._green; + beamTint[2] = tint._blue; + beamTint[3] = tint._alpha; + layer_additive_set(*beam->sprite.GetLayer(0)); + layer_additive_set(*beam->sprite.GetLayer(1)); + beam->sprite.scale = vector_make(scale, scale); + beam->Update(); +} + +// 005c83f0 A full jar's shopkeeper tick: one falls by a random spot of the room and keeps paths off its cell. Plain and +// secret ones are three times likelier than an error room one, and the special ones show up once unlocked (a plain one +// in their place before). +static void jar_shopkeeper_timer(Entity_Effect* timer) +{ + Room& room = *g_game->room; + Vector spot = room_free_pickup_position_find({.position = room.GetRandomPosition(JAR_ROOM_MARGIN), .step = PICKUP_SPOT_STEP}); + Vector offset = vector_scale(random_direction(), JAR_SCATTER); + float reach = random_unit(); + spot = vector_make(spot.x + reach * offset.x, spot.y + reach * offset.y); + room_path_raise_at(spot, GRID_PATH_FREED); + + int special = is_run_unlocked(ACHIEVEMENT_SPECIAL_SHOPKEEPERS) ? SHOPKEEPER_SPECIAL : SHOPKEEPER_COMMON; + int hanging = is_run_unlocked(ACHIEVEMENT_SPECIAL_HANGING_SHOPKEEPERS) ? SHOPKEEPER_SECRET_SPECIAL : SHOPKEEPER_COMMON; + WeightedOutcomePicker picker; + picker.outcomes = {{SHOPKEEPER_COMMON, 3}, {SHOPKEEPER_SECRET, 3}, {SHOPKEEPER_ERROR_ROOM, 1}, {special, 1}, {hanging, 1}}; + uint32_t seed = timer->dropRNG.Next(); + RNG pick = RNG_DEFAULT; + pick._seed = timer->dropRNG.Next(); + g_game->Spawn({.position = spot, .type = ENTITY_SHOPKEEPER, .variant = picker.PickOutcome(pick), .seed = seed}); +} + +// Starts a full jar's timer, seeded off the jar's generator. +static Entity_Effect* jar_timer_start(RNG& rng, void (*tick)(Entity_Effect*), uint32_t delay, uint32_t times) +{ + Entity_Effect* timer = Entity_Effect::CreateTimer(reinterpret_cast(tick), delay, times, false); + timer->dropRNG.SetSeed(rng.Next(), DEFAULT_SHIFT_INDEX); + return timer; +} + +// A full jar's ambush: Gapers and Attack Flies come in about the doors far from every player (or the middle of the +// room), D10 rerolls the room, and if more enemies are left than before the doors close and the room is no longer +// clear, forfeiting its reward if it was. +static void jar_ambush(Entity_Player& player, RNG& rng) +{ + Room& room = *g_game->room; + int enemiesBefore = room.GetAliveEnemiesCount(); + std::vector spots; + for (GridEntity_Door* door : room.doors) + { + if (!door) continue; + Vector at = door->Position(); + if (vector_length_squared(vector_sub(at, game_nearest_player(at)->pos)) > JAR_AMBUSH_DOOR_DISTANCE_SQUARED) + spots.push_back(door->Position()); + } + if (spots.empty()) spots.push_back(Room::GetCenterPos()); + + uint32_t first = rng.RandomInt(JAR_AMBUSH_ENEMIES); + float health = stage_health_get(JAR_AMBUSH_BASE_HP, JAR_AMBUSH_STAGE_HP); + for (uint32_t i = first; i < first + JAR_AMBUSH_ENEMIES; i++) + { + uint32_t seed = rng.Next(); + Vector at = room_free_pickup_position_find({.position = spots[i % spots.size()]}); + Vector direction = random_direction(); + float reach = random_unit(); + at = vector_add(at, vector_scale(vector_scale(direction, reach), JAR_SCATTER)); + int type = rng.RandomInt(2) != 0 ? ENTITY_ATTACKFLY : ENTITY_GAPER; + Entity* enemy = g_game->Spawn({.position = at, .type = type, .seed = seed}); + enemy->health = health; + enemy->maxHitPoints = health; + } + + player.UseActiveItem({.item = COLLECTIBLE_D10, .flags = JAR_USE_FLAGS}); + if (room.GetAliveEnemiesCount() <= enemiesBefore) return; + for (int slot = 0; slot < DOOR_SLOT_COUNT; slot++) + if (GridEntity_Door* door = room.GetDoor(slot)) door->Close(false); + if (room.IsClear()) g_game->GetRoomByIdx(g_game->currentRoomIdx)->flags |= ROOM_DESCRIPTOR_FLAG_NO_REWARD; + room.SetClear(false); +} + +// A full jar's surprise: a Dataminer use, a swarm of blue friends, a fly, a storm of light, a cycling item, Anarchist +// Cookbook's bombs, Humanity, falling shopkeepers, a giga bomb (lit one time in four), an ambush or a shower of +// pickups. One roll does nothing. +static void jar_surprise(Entity_Player& player, RNG& rng) +{ + auto spot = [&] { return room_free_pickup_position_find({.position = player.pos, .step = PICKUP_SPOT_STEP}); }; + switch (rng.RandomInt(JAR_SURPRISES)) + { + case 0: + player.UseActiveItem({.item = COLLECTIBLE_DATAMINER, .flags = JAR_USE_FLAGS}); + return; + case 1: + { + Entity_Effect* timer = jar_timer_start(rng, jar_swarm_timer, JAR_SWARM_DELAY, + rng.RandomInt(JAR_SWARM_TIMES_RANGE) + JAR_SWARM_TIMES); + timer->pos = player.pos; + timer->parent = &player; + return timer->Update(); + } + case 2: + g_game->Spawn({.position = spot(), .spawner = &player, .type = ENTITY_FLY, .seed = rng.Next()}); + return; + case 4: + { + Entity_Effect* timer = jar_timer_start(rng, jar_storm_timer, JAR_STORM_DELAY, + rng.RandomInt(JAR_STORM_TIMES_RANGE) + JAR_STORM_TIMES); + timer->parent = &player; + return timer->Update(); + } + case 5: + { + Vector at = spot(); + g_pickupIgnoreModifiers++; + auto* item = static_cast(g_game->Spawn( + {.position = at, .spawner = &player, .type = ENTITY_PICKUP, .variant = PICKUP_COLLECTIBLE, .seed = rng.Next()})); + item->TryInitOptionCycle(CYCLE_COLLECTIBLE_LIMIT); + g_pickupIgnoreModifiers--; + return; + } + case 6: + player.temporaryEffects.AddEffect( + TemporaryEffect(g_manager->itemConfig.GetCollectible(COLLECTIBLE_ANARCHIST_COOKBOOK)), true, 1); + return; + case 7: + return player.UseCard(CARD_HUMANITY, JAR_CARD_FLAGS); + case 8: + { + Entity_Effect* timer = jar_timer_start(rng, jar_shopkeeper_timer, JAR_SHOPKEEPER_DELAY, + rng.RandomInt(JAR_SHOPKEEPER_TIMES_RANGE) + JAR_SHOPKEEPER_TIMES); + timer->pos = player.pos; + return timer->Update(); + } + case 9: + { + Vector at = spot(); + if (rng.RandomInt(JAR_GIGA_LIT_ODDS) == 0) + g_game->Spawn({.position = at, .spawner = &player, .type = ENTITY_BOMB, .variant = BOMB_GIGA, .seed = rng.Next()}); + else + g_game->Spawn({.position = at, .spawner = &player, .subType = BOMB_SUBTYPE_GIGA, .type = ENTITY_PICKUP, + .variant = PICKUP_BOMB, .seed = rng.Next()}); + return; + } + case 10: + return jar_ambush(player, rng); + case 11: + for (uint32_t i = 0, count = rng.RandomInt(JAR_SHOWER_RANGE) + JAR_SHOWER; i < count; i++) + { + Vector at = spot(); + auto* pickup = static_cast(g_game->Spawn({.position = at, .spawner = &player, + .subType = RANDOM_NO_CHESTS_A, .type = ENTITY_PICKUP, + .variant = PICKUP_NULL, .seed = rng.Next()})); + pickup->dropDelay = (int)(rng.RandomInt(JAR_SHOWER_DELAY_RANGE) + i); + if (!Entity_Pickup::IsChest(pickup->variant) && rng.RandomInt(JAR_GLITCH_ODDS) == 0) + pickup->AddEntityFlags(FLAG_GLITCH); + } + return; + default: + return; + } +} + +// 005b39d0 (case 720) Everything Jar: its charges (at most 12, or the custom data) buy a poop, a pickup, or with all +// twelve a surprise, and a wisp grows with them. +static void everything_jar_use(ItemUse& use) +{ + Entity_Player& player = use.player; + const ActiveUse& request = use.request; + if (use.isShowAnimation) player.AnimateCollectible(use.id, "UseItem", "PlayerPickupSparkle"); + + int charges = 1; + if (request.flags & USE_CUSTOMVARDATA) charges = std::max(request.varData, 1); + else if ((request.flags & USE_OWNED) && request.slot >= 0 && + player.activeItems[request.slot].item == COLLECTIBLE_EVERYTHING_JAR) + { + charges = std::min(player.GetTotalActiveCharge(request.slot), EVERYTHING_JAR_CHARGES); + if (player.wildCardItemType == WILD_CARD_ACTIVE && player.wildCardItem == COLLECTIBLE_EVERYTHING_JAR) + player.wildCardVarData = charges; + } + if (charges < 1) return; + + RNG& rng = player.GetCollectibleRNG(COLLECTIBLE_EVERYTHING_JAR); + if (charges == 1) player.UseActiveItem({.item = COLLECTIBLE_POOP, .flags = JAR_USE_FLAGS}); + else if (charges < EVERYTHING_JAR_CHARGES) + { + const JarPickup& bought = JAR_PICKUPS[charges - 2]; + Vector at = room_free_pickup_position_find({.position = player.pos, .step = PICKUP_SPOT_STEP}); + g_game->Spawn({.position = at, .spawner = &player, .subType = bought.subType, .type = ENTITY_PICKUP, + .variant = bought.variant, .seed = rng.Next()}); + } + else if (charges == EVERYTHING_JAR_CHARGES) jar_surprise(player, rng); + + if (!player.HasCollectible(COLLECTIBLE_BOOK_OF_VIRTUES) || !use.isWispAllowed) return; + Entity_Familiar* wisp = player.AddWisp(Entity_Familiar::GetRandomWisp(&rng), player.pos, false, false); + if (!wisp) return; + wisp->maxHitPoints += (float)charges * HALF; + wisp->health = wisp->maxHitPoints; + wisp->wispScale = (float)charges * JAR_WISP_SCALE; +} + // Runs the own effect of a late Afterbirth, Afterbirth+ or Repentance active (400 and up) the main dispatch does not -// case. The ones not written yet stop the game. +// case. void repentance_item_effect_run(ItemUse& use) { Entity_Player& player = use.player; @@ -1701,6 +2007,8 @@ void repentance_item_effect_run(ItemUse& use) return; case COLLECTIBLE_MOMS_SHOVEL: return rebirth_item_effect_run(use); + case COLLECTIBLE_EVERYTHING_JAR: + return everything_jar_use(use); default: return afterbirth_item_effect_run(use); } @@ -1754,9 +2062,124 @@ bool Entity_Player::TryDecreaseGlowingHourglassUses(bool isDecrease, bool isRefi return isDecreased; } -// 005b1a20 Mom's Bracelet's grab: the grid entity ahead (lifted through Room::CanPickupGridEntity and -// PickupGridEntity), else an enemy, host or shot within reach, held over the head. +// Mom's Bracelet: the step ahead it reaches, the reach and lowest height of the grid shots it catches, the frames a +// Host it takes the shell of stays bombed, and the looks of a lifted shell and of the bare Hosts. +constexpr float BRACELET_REACH = 22; +constexpr float BRACELET_SHOT_REACH = 44; +constexpr float BRACELET_SHOT_LOWEST = -75; +constexpr int BRACELET_HOST_BOMBED_FRAMES = 15; +constexpr std::string_view BRACELET_SHELL_ANM2 = "gfx/002.040_thrown tear.anm2"; +constexpr std::string_view RED_HOST_SHEET = "gfx/monsters/classic/monster_127_redhost.png"; +constexpr std::string_view FLESH_MOBILE_HOST_SHEET = "gfx/monsters/rebirth/monster_247_flesh mobile host.png"; + +// The hidden effect a lifted grid entity rides in, spawned at the player. +static Entity_Effect& lifted_spawn(Entity_Player& player) +{ + uint32_t seed = Random(); + return *static_cast(g_game->Spawn( + {.position = player.pos, .type = ENTITY_EFFECT, .variant = EFFECT_GRID_ENTITY_PROJECTILE_HELPER, .seed = seed})); +} + +// The player takes a lifted grid entity in its hands. +static void lifted_hold(Entity_Player& player, Entity_Effect& lifted) +{ + lifted.parent = &player; + player.TryHoldEntity(&lifted); +} + +// A plain Host or Flesh Mobile Host loses its shell to the bracelet: it shows its bare look, bombed, and the shell is +// lifted as a rock-like grid entity. +static void host_shell_lift(Entity_Player& player, Entity_NPC& host) +{ + bool isMobile = host.type == ENTITY_MOBILE_HOST; + host.subtype = HOST_UNSHELLED; + host.sprite.ReplaceSpritesheet(isMobile ? 1 : 0, isMobile ? FLESH_MOBILE_HOST_SHEET : RED_HOST_SHEET); + host.sprite.LoadGraphics(); + host.stateFrame = BRACELET_HOST_BOMBED_FRAMES; + host.sprite.SetFrame("Bombed", 0); + if (isMobile) host.ClearEntityFlags(FLAG_NO_TARGET); + + Entity_Effect& shell = lifted_spawn(player); + shell.sprite.Load(BRACELET_SHELL_ANM2, GRAPHICS_LOAD); + shell.sprite.Play("Rock1"); + shell.gridDesc._type = GRID_ROCK; + shell.gridDesc._variant = ROCKLIKE_VARIANT; + shell.gridDesc._spawnSeed = host.initSeed; + lifted_hold(player, shell); +} + +// A movable TNT or a thrown grid shot goes and is lifted in its own look as the grid entity it was, a poop as damaged +// as the shot was. +static void entity_lift(Entity_Player& player, Entity& entity, int gridType, int gridVariant) +{ + entity.Remove(); + Entity_Effect& lifted = lifted_spawn(player); + lifted.sprite = entity.sprite; + lifted.gridDesc._type = gridType; + lifted.gridDesc._variant = gridVariant; + lifted.gridDesc._state = gridType == GRID_POOP ? (int)entity.health : 0; + lifted.gridDesc._spawnSeed = entity.initSeed; + lifted_hold(player, lifted); +} + +// What the bracelet does with an enemy (or a versus player) within reach that collides: a plain Host gives its shell, +// a poop pile is held, a movable TNT is lifted. Whether it took it. +static bool bracelet_enemy_grab(Entity_Player& player, Entity& entity) +{ + bool isPlain = entity.variant == 0 && entity.subtype == 0; + switch (entity.type) + { + case ENTITY_HOST: + case ENTITY_MOBILE_HOST: + if (isPlain) host_shell_lift(player, static_cast(entity)); + return isPlain; + case ENTITY_POOP: + player.TryHoldEntity(&entity); + return true; + case ENTITY_MOVABLE_TNT: + entity_lift(player, entity, GRID_TNT, 0); + return true; + default: + return false; + } +} + +// 005b1a20 Mom's Bracelet's grab: the grid entity a step ahead, else what lies there (a Host's shell, a poop pile, a +// movable TNT, anything the hands take), else another's thrown grid shot nearby. With nothing the player lifts empty +// hands, ready to grab later. void Entity_Player::moms_bracelet_grab() { - reconstruction_missing("Entity_Player::moms_bracelet_grab 005b1a20"); + if (itemState == COLLECTIBLE_MOMS_BRACELET) return; + + Room& room = *g_game->room; + Vector reach = vector_add(pos, vector_scale(vector_from_direction(moveDirection), BRACELET_REACH)); + int gridIndex = room.GetGridIndex(reach); + if (gridIndex >= 0 && room.CanPickupGridEntity(gridIndex)) + if (Entity_Effect* lifted = room.PickupGridEntity(gridIndex)) return lifted_hold(*this, *lifted); + + for (Entity* entity : entity_query_radius(reach, BRACELET_REACH, QUERY_ALL)) + { + if (is_npc_type(entity->type) && entity->entityCollisionClass != ENTCOLL_NONE) + { + if (bracelet_enemy_grab(*this, *entity)) return; + } + else if (TryHoldEntity(entity)) return; + } + + for (Entity* shot : entity_query_radius(pos, BRACELET_SHOT_REACH, QUERY_PROJECTILES | QUERY_TEARS)) + { + bool isGridShot = (shot->type == ENTITY_TEAR && shot->variant == TEAR_GRIDENT) || + (shot->type == ENTITY_PROJECTILE && shot->variant == PROJECTILE_GRID); + if (!isGridShot || shot->parent.get() == this || shot->isDead || !(shot->posOffset.y > BRACELET_SHOT_LOWEST)) + continue; + + int gridType = (int)((uint32_t)shot->subtype >> GRID_TYPE_SHIFT); + return entity_lift(*this, *shot, gridType, shot->subtype & GRID_VARIANT_MASK); + } + + PlayExtraAnimation("LiftItem", false); + heldSprite.Reset(); + FlushQueueItem(); + itemState = COLLECTIBLE_MOMS_BRACELET; + itemStateCooldown = 0; } diff --git a/src/entity_player_cards.cpp b/src/entity_player_cards.cpp index 564bb82..62ea874 100644 --- a/src/entity_player_cards.cpp +++ b/src/entity_player_cards.cpp @@ -25,6 +25,8 @@ #include "room_render.h" #include #include +#include +#include #include // The room transition's flags Tarot Cloth's Hermit and Stars set. @@ -853,6 +855,219 @@ static PocketUseEnd null_effect_renew(PocketUse& use, int nullItem) return POCKET_END_ANIMATE; } +// 0 - The Fool?: its drop generator's shift, how far out an item it drops goes, and the most passive items Tarot Cloth +// drops. +constexpr uint32_t REVERSE_FOOL_SHIFT_INDEX = 44; +constexpr float REVERSE_FOOL_ITEM_STEP = 10; +constexpr size_t REVERSE_FOOL_ITEMS = 3; + +// A pickup Reverse Fool drops for an amount of a consumable (an item for big amounts). +struct FoolDropStep +{ + int amount = 0; + int variant = 0; + int subType = 0; +}; + +constexpr FoolDropStep FOOL_RED_STEPS[] = {{4, PICKUP_HEART, HEART_DOUBLEPACK}, {2, PICKUP_HEART, HEART_FULL}, {1, PICKUP_HEART, HEART_HALF}}; +constexpr FoolDropStep FOOL_SOUL_STEPS[] = {{2, PICKUP_HEART, HEART_SOUL}, {1, PICKUP_HEART, HEART_HALF_SOUL}}; +constexpr FoolDropStep FOOL_COIN_STEPS[] = {{100, PICKUP_COLLECTIBLE, COLLECTIBLE_DOLLAR}, {25, PICKUP_COLLECTIBLE, COLLECTIBLE_QUARTER}, + {10, PICKUP_COIN, COIN_DIME}, {5, PICKUP_COIN, COIN_NICKEL}, + {2, PICKUP_COIN, COIN_DOUBLEPACK}, {1, PICKUP_COIN, COIN_PENNY}}; +constexpr FoolDropStep FOOL_BOMB_STEPS[] = {{99, PICKUP_COLLECTIBLE, COLLECTIBLE_PYRO}, {10, PICKUP_COLLECTIBLE, COLLECTIBLE_BOOM}, + {2, PICKUP_BOMB, BOMB_SUBTYPE_DOUBLEPACK}, {1, PICKUP_BOMB, BOMB_SUBTYPE_NORMAL}}; +constexpr FoolDropStep FOOL_KEY_STEPS[] = {{99, PICKUP_COLLECTIBLE, COLLECTIBLE_SKELETON_KEY}, {2, PICKUP_KEY, KEY_DOUBLEPACK}, + {1, PICKUP_KEY, KEY_NORMAL}}; + +// What Reverse Fool took from the players' hearts: half hearts of red, soul and coins, and hearts of the other kinds. +struct FoolHearts +{ + int black = 0; + int bone = 0; + int coins = 0; + int eternal = 0; + int golden = 0; + int red = 0; + int rotten = 0; + int soul = 0; +}; + +// The black hearts among a player's soul hearts. +static int black_heart_count(Entity_Player& player) +{ + int count = 0; + uint32_t bit = 1; + for (int heart = (player.soulHearts + 1) / 2; heart > 0; heart--) + { + if (bit & (uint32_t)player.blackHearts) count++; + bit = std::rotl(bit, 1); + } + return count; +} + +// Reverse Fool leaves a player one heart: a red one (a coin heart keeps a whole one), else a bone one, else half a soul +// heart. What went joins the tally, the black hearts apart from the soul hearts and a coin heart's halves as coins. +static void fool_hearts_take(Entity_Player& player, FoolHearts& taken) +{ + taken.eternal += player.eternalHearts; + taken.golden += player.goldenHearts; + int rotten = player.rottenHearts; + int red = player.redHearts; + player.eternalHearts = 0; + player.goldenHearts = 0; + int black = black_heart_count(player); + int soul = player.soulHearts; + int bone = player.boneHearts; + if (player.redHearts > 0 && player.maxHearts > 0) + { + int kept = player.GetHealthType() == HEALTH_COIN ? 2 : 1; + if (player.redHearts > kept) player.AddHearts(kept - player.redHearts, false, false); + player.AddSoulHearts(-player.soulHearts, false); + player.boneHearts = 0; + player.update_bone_hearts(); + } + else if (bone > 0) + { + player.AddHearts(-player.redHearts, false, false); + player.AddSoulHearts(-player.soulHearts, false); + player.boneHearts = 1; + player.update_bone_hearts(); + } + else if (soul > 0) player.AddSoulHearts(1 - soul, false); + + int rottenLost = rotten - player.rottenHearts; + int redLost = red - rottenLost * 2 - player.redHearts; + int blackLost = black - black_heart_count(player); + int soulLost = soul - blackLost * 2 - player.soulHearts; + if (redLost > 0 && player.GetHealthType() == HEALTH_COIN) + { + taken.coins += (redLost + 1) / 2; + redLost = 0; + } + if (soulLost < 0) + { + int halves = (1 - soulLost) / 2; + blackLost -= halves; + soulLost += halves * 2; + } + taken.red += redLost; + taken.rotten += rottenLost; + taken.black += blackLost; + taken.soul += soulLost; + taken.bone += bone - player.boneHearts; +} + +// One pickup Reverse Fool drops by the player, an item further out and in a poof. +static void fool_drop(Entity_Player& player, RNG& rng, int variant, int subType) +{ + uint32_t seed = rng.Next(); + bool isItem = variant == PICKUP_COLLECTIBLE; + Vector at = room_free_pickup_position_find({.position = player.pos, .step = isItem ? REVERSE_FOOL_ITEM_STEP : PICKUP_SPOT_STEP}); + Entity* pickup = g_game->Spawn({.position = at, .spawner = &player, .subType = subType, .type = ENTITY_PICKUP, + .variant = variant, .seed = seed}); + if (!isItem) return; + + uint32_t poofSeed = Random(); + g_game->Spawn({.position = pickup->pos, .type = ENTITY_EFFECT, .variant = EFFECT_POOF01, .seed = poofSeed}); +} + +// Drops an amount in its biggest pickups first, the last step taking any rest. Heart amounts scale in versus matches. +static void fool_amount_drop(Entity_Player& player, RNG& rng, std::span steps, int amount, bool isScaled) +{ + auto scaled = [&](int value) { return isScaled ? scale_for_hard_difficulty(value) : value; }; + while (amount > 0) + { + const FoolDropStep* step = &steps.back(); + for (const FoolDropStep& each : steps.first(steps.size() - 1)) + if (amount >= scaled(each.amount)) + { + step = &each; + break; + } + amount -= scaled(step->amount); + fool_drop(player, rng, step->variant, step->subType); + } +} + +// Drops a pickup a number of times. +static void fool_repeat_drop(Entity_Player& player, RNG& rng, int count, int variant, int subType) +{ + for (int i = 0; i < count; i++) fool_drop(player, rng, variant, subType); +} + +// 007b2230 (case 56) 0 - The Fool?: the players keep one heart each and the user keeps nothing else. Everything goes +// down as pickups (its soul and blood charges as hearts), its trinkets and pocket items too, and with Tarot Cloth +// three of its passive items. +static PocketUseEnd reverse_fool_use(PocketUse& use) +{ + Entity_Player& player = use.player; + FoolHearts taken; + for (Entity_Player* each : {&player, player.subPlayer}) + if (each) fool_hearts_take(*each, taken); + if (player.effectiveSoulCharge > 0) + { + taken.soul += player.effectiveSoulCharge; + player.effectiveSoulCharge = 0; + } + if (player.effectiveBloodCharge > 0) + { + taken.red += player.effectiveBloodCharge; + player.effectiveBloodCharge = 0; + } + + int coins = taken.coins + player.numCoins; + int gigaBombs = player.numGigaBombs; + int bombs = player.numBombs - gigaBombs; + int keys = player.numKeys; + bool hasGoldenBomb = player.hasGoldenBomb; + bool hasGoldenKey = player.hasGoldenKey; + player.numCoins = 0; + player.numBombs = 0; + player.numGigaBombs = 0; + player.numKeys = 0; + player.hasGoldenBomb = false; + player.hasGoldenKey = false; + + g_pickupIgnoreModifiers++; + RNG rng; + rng.game_constructor(use.rng.Next(), REVERSE_FOOL_SHIFT_INDEX); + fool_amount_drop(player, rng, FOOL_RED_STEPS, taken.red, true); + fool_repeat_drop(player, rng, taken.rotten, PICKUP_HEART, HEART_ROTTEN); + fool_amount_drop(player, rng, FOOL_SOUL_STEPS, taken.soul, true); + fool_repeat_drop(player, rng, scale_for_hard_difficulty(taken.black), PICKUP_HEART, HEART_BLACK); + fool_repeat_drop(player, rng, taken.bone, PICKUP_HEART, HEART_BONE); + fool_repeat_drop(player, rng, taken.eternal, PICKUP_HEART, HEART_ETERNAL); + fool_repeat_drop(player, rng, taken.golden, PICKUP_HEART, HEART_GOLDEN); + fool_amount_drop(player, rng, FOOL_COIN_STEPS, coins, false); + fool_amount_drop(player, rng, FOOL_BOMB_STEPS, bombs, false); + fool_repeat_drop(player, rng, hasGoldenBomb, PICKUP_BOMB, BOMB_SUBTYPE_GOLDEN); + fool_repeat_drop(player, rng, gigaBombs, PICKUP_BOMB, BOMB_SUBTYPE_GIGA); + fool_amount_drop(player, rng, FOOL_KEY_STEPS, keys, false); + fool_repeat_drop(player, rng, hasGoldenKey, PICKUP_KEY, KEY_GOLDEN); + + for (int i = 0; i < 2; i++) player.DropTrinket(room_free_pickup_position_find({.position = player.pos}), false); + for (uint32_t slot = 0; slot < player.GetMaxPocketItems(); slot++) + player.DropPocketItem((int)slot, room_free_pickup_position_find({.position = player.pos})); + if (use.isDoubled) + { + std::vector items; + std::vector& history = player.history.historyItems; + for (int i = (int)history.size() - 1; i >= 0; i--) + { + int id = history[i].id; + if (history[i].isTrinket || !player.CanRerollCollectible(id, false)) continue; + if (g_manager->itemConfig.GetCollectible(id)->type == ITEM_ACTIVE) continue; + for (int copy = 0; copy < player.collectibleCounts[id] && items.size() < REVERSE_FOOL_ITEMS; copy++) + items.push_back(id); + } + for (int id : items) player.DropCollectible(id, nullptr, true); + } + g_pickupIgnoreModifiers--; + player.ConsumableCountChanged((int)CONSUMABLE_ALL); + g_game->hud.refresh_request(HUD_REFRESH_PLAYER); + return POCKET_END_ANIMATE; +} + // III - The Empress?: the effect renewed and two heart containers for the room (three when doubled), filled, within // the heart limit. The containers it gave before are kept counted. static PocketUseEnd reverse_empress_use(PocketUse& use) @@ -1968,6 +2183,8 @@ PocketUseEnd card_effect_run(PocketUse& use, int card) return era_walk_use(use); case RUNE_SHARD: return rune_shard_use(use); + case CARD_REVERSE_FOOL: + return reverse_fool_use(use); case CARD_REVERSE_MAGICIAN: return null_effect_renew(use, NULLITEM_REVERSE_MAGICIAN); case CARD_REVERSE_HIGH_PRIESTESS: @@ -2066,6 +2283,5 @@ 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 if (card == CARD_REVERSE_FOOL) reconstruction_missing("Entity_Player::UseCard 007b2230 (Reverse Fool, case 56)"); return POCKET_END_ANIMATE; } diff --git a/src/entity_player_characters.cpp b/src/entity_player_characters.cpp index a8797aa..0da9444 100644 --- a/src/entity_player_characters.cpp +++ b/src/entity_player_characters.cpp @@ -964,8 +964,7 @@ static void animation_restore(ANM2& sprite, const std::string& animation, bool i // 007ce6e0 Turns the player into another character: The Forgotten and The Soul only swap forms when isKeepState, Bethany // hands her soul charges back, the costume, hearts, halves and twin follow the new character, the sprite reloads with // the animation kept, and the stats, innate items and costumes are redone. Tainted Forgotten gets its soul and Tainted -// Lazarus its other form unless isKeepState. Becoming Jacob, who splits his hearts with a new Esau, is not -// reconstructed yet. +// Lazarus its other form unless isKeepState. Becoming Jacob splits the hearts and items with a new Esau. void Entity_Player::ChangePlayerType(int newType, bool isKeepState) { EntityConfig& configs = g_manager->entityConfig; diff --git a/src/entity_player_crafting.cpp b/src/entity_player_crafting.cpp index b17445c..c412e88 100644 --- a/src/entity_player_crafting.cpp +++ b/src/entity_player_crafting.cpp @@ -158,8 +158,6 @@ constexpr float BURST_HEART_BELOW = 0.55f; constexpr float BURST_KEY_BELOW = 0.7f; constexpr int BURST_TRINKET_ODDS = 100; constexpr int BURST_TRINKET_CHANCES[] = {33, 66, 100}; -constexpr int ACHIEVEMENT_BONE_HEART_UNLOCK = 391; -constexpr int ACHIEVEMENT_ROTTEN_HEART_UNLOCK = 411; constexpr int ACHIEVEMENT_GOLD_BOMB_UNLOCK = 226; // A trinket that may add one pickup to the burst, in the order they roll, with that pickup's variant. @@ -425,12 +423,12 @@ static BurstPickup burst_pool_pickup(Entity_Player& player, RNG& rng, int poolTy return {PICKUP_HEART, HEART_ETERNAL}; case POOL_SECRET: case POOL_GREED_SECRET: - return gated(ACHIEVEMENT_BONE_HEART_UNLOCK, {PICKUP_HEART, HEART_BONE_SUBTYPE}); + return gated(ACHIEVEMENT_BONE_HEARTS, {PICKUP_HEART, HEART_BONE_SUBTYPE}); case POOL_RED_CHEST: return gated(ACHIEVEMENT_RED_KEY, {PICKUP_TAROTCARD, CRACKED_KEY_CARD}); case POOL_CURSE: case POOL_GREED_CURSE: - return gated(ACHIEVEMENT_ROTTEN_HEART_UNLOCK, {PICKUP_HEART, HEART_ROTTEN_SUBTYPE}); + return gated(ACHIEVEMENT_ROTTEN_HEARTS, {PICKUP_HEART, HEART_ROTTEN_SUBTYPE}); case POOL_ULTRA_SECRET: return {PICKUP_TAROTCARD, CRACKED_KEY_CARD}; case POOL_PLANETARIUM: diff --git a/src/entity_player_damage.cpp b/src/entity_player_damage.cpp index 4e2a0e7..d2a8193 100644 --- a/src/entity_player_damage.cpp +++ b/src/entity_player_damage.cpp @@ -226,6 +226,7 @@ static void voice_play(int sound, float volume, int frameDelay, float pitch) // Cone Head's chances, and Jelly Belly's bounce. constexpr float HEART_ICON_RISE = -24; constexpr int HOST_HAT_VOLLEY_ODDS = 5; +constexpr int HOST_HAT_VOLLEY_ODDS_DEATHMATCH = 9; constexpr float RETURN_SHOT_SPEED = 10; constexpr float HOST_HAT_SPREAD = 15; constexpr uint32_t RETURN_SHOT_FLAGS = 7; @@ -268,7 +269,8 @@ static bool jelly_belly_bounce(Entity_Player& player, const EntityRef& source, u Entity* hitter = source.entity; bool isLiving = hitter && ((source.type >= ENTITY_FIRST_ENEMY && source.type <= ENTITY_LAST_ENEMY) || source.type == ENTITY_PROJECTILE || source.type == ENTITY_PLAYER); - if (random_below(JELLY_BELLY_ODDS) != 0 || !isLiving) return false; + int odds = g_game->deathmatchManager.is_fighting() ? 1 : JELLY_BELLY_ODDS; + if (random_below(odds) != 0 || !isLiving) return false; float reach = hitter->size * std::max(hitter->sizeMulti.x, hitter->sizeMulti.y) + player.size + JELLY_BELLY_REACH; bool isTouching = vector_distance(hitter->pos, player.pos) <= reach; @@ -364,8 +366,10 @@ static bool damage_reactions_check(Entity_Player& player, const EntityRef& sourc if (player.variant == PLAYER_VARIANT_COOP_BABY && player.babySkin == BABY_BOMB && isExplosion) return true; if (jelly_belly_bounce(player, source, damageFlags)) return true; - if (player.HasCollectible(COLLECTIBLE_HOST_HAT) && random_below(HOST_HAT_VOLLEY_ODDS) == 0 && - source.type == ENTITY_PROJECTILE) + bool isDeathmatch = g_game->deathmatchManager.is_active(); + bool isVolleyShot = source.type == ENTITY_PROJECTILE || (isDeathmatch && source.type == ENTITY_TEAR); + if (player.HasCollectible(COLLECTIBLE_HOST_HAT) && + random_below(isDeathmatch ? HOST_HAT_VOLLEY_ODDS_DEATHMATCH : HOST_HAT_VOLLEY_ODDS) == 0 && isVolleyShot) { Vector back = return_shot_velocity(source); for (float turn : {-HOST_HAT_SPREAD, 0.0f, HOST_HAT_SPREAD}) @@ -784,7 +788,11 @@ static void glass_cannon_break(Entity_Player& player) .variant = EFFECT_TOOTH_PARTICLE}); TemporaryEffects& effects = player.temporaryEffects; if (!effects.HasCollectibleEffect(COLLECTIBLE_ANEMIC)) - effects.AddEffect(TemporaryEffect(g_manager->itemConfig.GetCollectible(COLLECTIBLE_ANEMIC)), true, 1); + { + TemporaryEffect anemic(g_manager->itemConfig.GetCollectible(COLLECTIBLE_ANEMIC)); + if (g_game->deathmatchManager.is_active()) anemic.cooldown = ANEMIC_VERSUS_FRAMES; + effects.AddEffect(anemic, true, 1); + } if (player.HasCollectible(COLLECTIBLE_BOOK_OF_BELIAL_PASSIVE)) effects.AddNullEffect(NULLITEM_JUDAS_BIRTHRIGHT, true, BELIAL_BOOST_FRAMES); for (int hit = 0; hit < 2; hit++) @@ -1657,7 +1665,7 @@ void Entity_Player::ResetItemState() } bool isHiding = bodySprite.animState.animData && bodySprite.animState.isPlaying && bodySprite.GetAnimation() == "HideItem"; if ((isPlayingExtraAnimation || isPlayingItemAnimation) && !isHiding && itemState == COLLECTIBLE_MOMS_BRACELET) - PlayExtraAnimation("HideItem"); + PlayExtraAnimation("HideItem", false); itemState = 0; } diff --git a/src/entity_player_death.cpp b/src/entity_player_death.cpp index cc5c7bf..b1870ef 100644 --- a/src/entity_player_death.cpp +++ b/src/entity_player_death.cpp @@ -958,8 +958,7 @@ void Entity_Player::death_update() // 007a6680 Leaves the room: the queued item is added, room-long states end (Holy Mantle's unless kept), the compass, // Metronome's item, Bat Wing's wings and Wavy Cap's trip wear off, the temporary effects clear, the costumes of actives // no longer worn come off, a held item is put away, the room's trail is kept for the Void's hallucinations when it is -// the longest walked, and a soul player of the Forgotten or Jacob leaves. -// The after-images are not modeled. +// the longest walked, the after-images go, and a soul player of the Forgotten or Jacob leaves. void Entity_Player::room_exit(bool isKeepHolyMantle) { ItemConfig& items = g_manager->itemConfig; @@ -967,6 +966,7 @@ void Entity_Player::room_exit(bool isKeepHolyMantle) FlushQueueItem(); if (!isKeepHolyMantle) holyMantleState = 0; + isHurtThisRoom = false; isBrokenRemotePending = false; cursedPennyPending = 0; roomDamageTaken = 0; @@ -1023,6 +1023,7 @@ void Entity_Player::room_exit(bool isKeepHolyMantle) hallucinationTrail.distance = roomTrail.distance; } hallucinationTrail.current = 0; + afterImageFrames.clear(); bool isSoulPlayer = temporaryEffects.HasNullEffect(NULLITEM_SOUL_FORGOTTEN) || temporaryEffects.HasNullEffect(NULLITEM_SOUL_JACOB); diff --git a/src/entity_player_effects.cpp b/src/entity_player_effects.cpp index 49a447b..6c6c5cc 100644 --- a/src/entity_player_effects.cpp +++ b/src/entity_player_effects.cpp @@ -31,10 +31,24 @@ // The Ladder's reach: how near a player must stand to a laid ladder to keep it, and the turn of a ladder laid across. constexpr float LADDER_KEEP_DISTANCE_SQUARED = 3249; constexpr float LADDER_ACROSS_ROTATION = 90; -// Azazel's Rage's beam: its damage scale, how high over the player it starts and how long it lasts. +// Azazel's Rage's beam: its damage scale, how high over the player it (and Mega Blast's) starts and how long it lasts. constexpr float RAGE_DAMAGE_SCALE = 1.5f; -constexpr float RAGE_LASER_RISE = -30; +constexpr float HELD_BEAM_RISE = -30; constexpr int RAGE_LASER_TIMEOUT = 90; +// The held beams (Mega Blast's and Azazel's Rage's): how far toward the aim they turn a frame, the push back on the +// player, the aim below which they draw behind it, their depths, and the player's blink while firing. Mega Blast's +// beam is a Technology one with Technology, outlasted by its effect's last 15 frames, five times the tear damage. +constexpr float HELD_BEAM_TURN = 0.3f; +constexpr float MEGA_BLAST_RECOIL = 0.85f; +constexpr float RAGE_RECOIL = 0.15f; +constexpr float HELD_BEAM_UP = -0.5f; +constexpr float HELD_BEAM_DEPTH_FRONT = 3000; +constexpr float HELD_BEAM_DEPTH_BEHIND = -10; +constexpr int HELD_BEAM_BLINK_FRAMES = 7; +constexpr int MEGA_BLAST_TAIL_FRAMES = 15; +constexpr float MEGA_BLAST_DAMAGE_SCALE = 5; +constexpr int RAGE_HEAD_SHOOT_FRAME = 15; +constexpr int RAGE_HEAD_REWIND_FRAME = 8; // The pit at a cell, or null off the grid or on any other grid entity. static GridEntity_Pit* pit_at(Room& room, int gridIndex) @@ -539,7 +553,7 @@ static void azazels_rage_fire(Entity_Player& player) if (player.aimDirection.x != 0 || player.aimDirection.y != 0) direction = player.aimDirection; Entity_Laser* laser = Entity_Laser::ShootAngle({.position = player.pos, - .posOffset = vector_make(0, RAGE_LASER_RISE), + .posOffset = vector_make(0, HELD_BEAM_RISE), .source = &player, .angleDegrees = vector_angle(direction), .timeout = RAGE_LASER_TIMEOUT, @@ -555,6 +569,199 @@ static void azazels_rage_fire(Entity_Player& player) player.play_null_costume_anim(NULLITEM_AZAZELS_RAGE_4, HEAD_SHOOT_ANIMS[vector_to_direction(direction)], -1); } +// Saturnus: the ring it catches shots in (85 to 100 from the player), every other frame, four enemy shots in ten and +// in versus three of the players' tears in twenty (by each shot's seed). A caught shot's damage is its size times 3 +// and a half per floor deep. It orbits no lower than 20 up, falling slowly. +constexpr float SATURNUS_RING_NEAR = 85; +constexpr float SATURNUS_RING_FAR = 100; +constexpr int SATURNUS_FRAMES = 2; +constexpr uint32_t SATURNUS_SHIFT_INDEX = 23; +constexpr float SATURNUS_CATCH_CHANCE = 0.4f; +constexpr double SATURNUS_TEAR_CATCH_CHANCE = 0.15; +constexpr float SATURNUS_DAMAGE_PER_DEPTH = 0.5f; +constexpr float SATURNUS_DAMAGE_BASE = 3; +constexpr float SATURNUS_ORBIT_HEIGHT = -20; +constexpr float SATURNUS_ORBIT_FALL = -0.09f; + +// Whether a shot is caught this frame: by its own seed's chance, inside the ring. +static bool is_saturnus_caught(Entity_Player& player, Entity& shot, double chance) +{ + RNG rng; + rng.game_constructor(shot.initSeed, SATURNUS_SHIFT_INDEX); + if (!((double)rng.RandomFloat() < chance)) return false; + float distance = vector_length(vector_sub(shot.pos, player.pos)); + return distance <= SATURNUS_RING_FAR && distance >= SATURNUS_RING_NEAR; +} + +// A caught shot's flags: orbiting, spectral, sparing the grid, exploding or splitting if it did. +static void saturnus_flags_set(Entity_Tear& tear, bool isExplosive, bool isSplitting) +{ + TearFlags flags; + flags.set(TEAR_ORBIT_ADVANCED); + flags.set(TEAR_SPECTRAL); + flags.set(TEAR_NO_GRID_DAMAGE); + if (isExplosive) flags.set(TEAR_EXPLOSIVE); + if (isSplitting) flags.set(TEAR_QUADSPLIT); + tear.SetTearFlags(flags); +} + +// A caught shot settles into its orbit at a damage, no lower than the ring and falling slowly. +static void saturnus_orbit(Entity_Tear& tear, float damage, float height) +{ + tear.SetCollisionDamage(damage); + tear.tearIdx = 1; + tear.SetHeight(std::max(height, SATURNUS_ORBIT_HEIGHT)); + tear.fallingSpeed = 0; + tear.fallingAccel = SATURNUS_ORBIT_FALL; +} + +// Saturnus' part of 00794e50: every other frame enemy shots crossing the ring turn into the player's orbiting tears +// (bones, coins and rocks in kind, Hush's and tear shots blue, the rest bloody) in the shot's color and size, and in +// versus the other players' tears are taken over. The ring's halo stays while the item does. +static void saturnus_update(Entity_Player& player) +{ + if (!player.HasCollectible(COLLECTIBLE_SATURNUS)) + { + if (Entity* ring = player.saturnusRing.get()) ring->Remove(); + player.saturnusRing = nullptr; + return; + } + + if (player.IsFrame(SATURNUS_FRAMES, 0)) + { + float damageScale = (float)g_game->stage_depth_get() * SATURNUS_DAMAGE_PER_DEPTH + SATURNUS_DAMAGE_BASE; + for (Entity* entity : entities_live(g_game->room->GetEntities()->updateEL)) + { + bool isLiveShot = entity->IsProjectile() && !entity->isDead && entity->entityCollisionClass != ENTCOLL_NONE && + !entity->HasEntityFlags(FLAG_DONT_COUNT_BOSS_HP); + if (isLiveShot) + { + auto* shot = static_cast(entity); + if (!is_saturnus_caught(player, *shot, SATURNUS_CATCH_CHANCE)) continue; + + int variant = TEAR_BLOOD; + if (shot->variant == PROJECTILE_BONE) variant = TEAR_BONE; + else if (shot->variant == PROJECTILE_TEAR || shot->variant == PROJECTILE_HUSH) variant = TEAR_BLUE; + else if (shot->variant == PROJECTILE_COIN) variant = TEAR_COIN; + else if (shot->variant == PROJECTILE_ROCK) variant = TEAR_ROCK; + uint32_t seed = Random(); + auto* tear = static_cast(g_game->Spawn({.position = shot->pos, .velocity = shot->velocity, + .spawner = &player, .type = ENTITY_TEAR, + .variant = variant, .seed = seed})); + tear->parent = &player; + saturnus_flags_set(*tear, shot->projectileFlags & PROJECTILE_EXPLODE, shot->projectileFlags & PROJECTILE_BURST); + tear->SetColor(shot->sprite.color, -1, COLOR_PRIORITY_DEFAULT, false, true); + saturnus_orbit(*tear, shot->scale * damageScale, shot->height); + tear->SetScale(tear_size_scale(tear_size_from_scale(shot->scale))); + shot->Remove(); + continue; + } + bool isRivalTear = g_game->deathmatchManager.is_active() && entity->IsTear() && !entity->isDead && + entity->entityCollisionClass != ENTCOLL_NONE; + if (!isRivalTear || !is_saturnus_caught(player, *entity, SATURNUS_TEAR_CATCH_CHANCE)) continue; + + auto* tear = static_cast(entity); + saturnus_flags_set(*tear, tear->tearFlags[TEAR_EXPLOSIVE], tear->tearFlags[TEAR_QUADSPLIT]); + saturnus_orbit(*tear, tear->fScale * damageScale, tear->height); + tear->spawnerEntity = &player; + tear->parent = &player; + } + } + if (player.saturnusRing) return; + + uint32_t seed = Random(); + Entity* ring = g_game->Spawn({.position = player.pos, .spawner = &player, .subType = HALO_SATURNUS, + .type = ENTITY_EFFECT, .variant = EFFECT_HALO, .seed = seed}); + ring->parent = &player; + player.saturnusRing = ring; +} + +// The tear hit flags a held beam carries this frame, and the way it points: where the player aims, else faces. +static TearParams held_beam_params(Entity_Player& player, Vector& direction) +{ + int displacement = random_below(2) * 2 - 1; + TearParams params = player.GetTearHitParams(WEAPON_LASER, 1, displacement, nullptr); + direction = vector_from_direction(player.headDirection); + if (player.aimDirection.x != 0 || player.aimDirection.y != 0) direction = player.aimDirection; + return params; +} + +// A held beam turns a little toward the aim, leaves from the player's Brimstone spot with the hit flags (without +// delay) and the laser color, its follow-up beam too, drawn behind the player only when aimed up. The player is +// pushed back along it. +static void held_beam_steer(Entity_Player& player, Entity_Laser* laser, const TearParams& params, Vector direction, + float recoil) +{ + if (laser) + { + laser->set_aim_angle(angle_lerp(laser->angleDegrees, vector_angle(direction), HELD_BEAM_TURN)); + laser->posOffset = player.GetLaserOffset(LASER_OFFSET_BRIMSTONE, direction); + laser->tearFlags = params.tearFlags; + laser->tearFlags.reset(TEAR_WAIT); + laser->SetColor(player.laserColor, -1, COLOR_PRIORITY_DEFAULT, false, true); + if (laser->child) laser->child->SetColor(player.laserColor, -1, COLOR_PRIORITY_DEFAULT, false, true); + laser->renderDepthOffset = direction.y > HELD_BEAM_UP ? HELD_BEAM_DEPTH_FRONT : HELD_BEAM_DEPTH_BEHIND; + } + player.AddVelocity_divided(vector_scale(vector_scale(direction, -1), recoil), false); +} + +// The laser a held beam link points to, if it is one. +static Entity_Laser* held_beam_get(Entity* link) +{ + return link && link->type == ENTITY_LASER ? static_cast(link) : nullptr; +} + +// Mega Blast's (and Soul of Azazel's) part of 00794e50: while its effect lasts and the player is in control, a giant +// beam fires the way the player aims for all but its last 15 frames, steered each frame, and the costume goes when it +// ends. A versus match keeps the tear damage, where the original reads a stale value. +static void mega_blast_update(Entity_Player& player) +{ + if (player.megaBlastDuration <= 0 || !player.AreControlsEnabled()) return; + + player.megaBlastDuration--; + Vector direction; + TearParams params = held_beam_params(player, direction); + float angle = vector_angle(direction); + if (!player.megaBlastLaser && player.megaBlastDuration > MEGA_BLAST_TAIL_FRAMES) + { + int variant = player.HasCollectible(COLLECTIBLE_TECHNOLOGY) ? LASER_GIANT_BRIM_TECH : LASER_GIANT_RED; + Entity_Laser* laser = Entity_Laser::ShootAngle({.position = player.pos, + .posOffset = vector_make(0, HELD_BEAM_RISE), + .source = &player, + .angleDegrees = angle, + .timeout = std::max(player.megaBlastDuration - MEGA_BLAST_TAIL_FRAMES, 0), + .variant = variant}); + float scale = g_game->deathmatchManager.is_active() ? 1 : MEGA_BLAST_DAMAGE_SCALE; + laser->SetCollisionDamage(params.tearDamage * scale); + laser->isDisableInitSound = g_game->room->GetFrameCount() <= 1; + player.megaBlastLaser = laser; + laser->tearFlags = params.tearFlags; + laser->tearFlags.reset(TEAR_WAIT); + laser->SetColor(player.laserColor, -1, COLOR_PRIORITY_DEFAULT, false, true); + laser->Update(); + } + held_beam_steer(player, held_beam_get(player.megaBlastLaser), params, direction, MEGA_BLAST_RECOIL); + player.blinkTime = HELD_BEAM_BLINK_FRAMES; + if (player.megaBlastDuration < 1) player.RemoveCostume(g_manager->itemConfig.GetNullItem(NULLITEM_MEGABLAST)); +} + +// Azazel's Rage's steering part of 00794e50: while its beam lasts and the player is in control, the beam follows the +// aim and the rage costume's head shoots along it (back to its frame 8 past frame 15). +static void azazels_rage_steer(Entity_Player& player) +{ + if (!player.azazelsRageLaser || !player.AreControlsEnabled()) return; + + Vector direction; + TearParams params = held_beam_params(player, direction); + held_beam_steer(player, held_beam_get(player.azazelsRageLaser), params, direction, RAGE_RECOIL); + std::string_view shoot = HEAD_SHOOT_ANIMS[vector_to_direction(direction)]; + player.play_null_costume_anim(NULLITEM_AZAZELS_RAGE_4, shoot, -2); + ItemConfig_Item* rage = g_manager->itemConfig.GetNullItem(NULLITEM_AZAZELS_RAGE_4); + if (costume_item_frame_get(player, rage) > RAGE_HEAD_SHOOT_FRAME) + costume_item_frame_set(player, rage, shoot, RAGE_HEAD_REWIND_FRAME); + player.blinkTime = HELD_BEAM_BLINK_FRAMES; +} + // Azazel's Rage: on a room's third frame (or once its beam is spent) the rage ends with the item gone. With four // rooms gathered, a room still fighting (an ambush not yet over) unleashes its beam. A spent beam's rage settles back // into the item's costume. @@ -1327,6 +1534,36 @@ static void extension_cord_update(Entity_Player& player) if (--index < 0) index = count - 1; } +// 4.5 Volt's part of 00794e50: once its cooldown has run down by the ticks passed, the damage dealt this frame fills +// the partial charges of the normal actives not yet full (or not yet doubled with The Battery), in slot order, at +// most to one charge each. +static void volt_45_charge_update(Entity_Player& player) +{ + if (!player.HasCollectible(COLLECTIBLE_4_5_VOLT)) return; + if (player.damageChargeCooldown > 0) + { + player.damageChargeCooldown = std::max(player.damageChargeCooldown - player.update_ticks_get(), 0); + return; + } + + float damage = damage_dealt_get(player); + if (!(damage > 0)) return; + float left = damage_charge_scale() * damage; + for (int slot = 0; slot < ACTIVE_SLOT_COUNT && left > 0; slot++) + { + ActiveItemDesc& active = player.activeItems[slot]; + if (active.item == 0) continue; + int maxCharge = player.GetActiveMaxCharge(slot); + if (active_charge_type(player, slot) != CHARGE_NORMAL) continue; + bool isBatteryUnfilled = player.HasCollectible(COLLECTIBLE_BATTERY) && active.batteryCharge < maxCharge; + if (active.charge >= maxCharge && !isBatteryUnfilled) continue; + + float added = std::min(left, std::max(0.0f, 1 - active.partialCharge)); + left -= added; + active.partialCharge += added; + } +} + // The written pieces of the items' frame (update_effects 00794e50) the plain path runs after its others, in their // order there. void items_frame_update(Entity_Player& player) @@ -1355,6 +1592,7 @@ void items_frame_update(Entity_Player& player) spooky_venus_update(player); volt_120_update(player); monstrance_update(player); + saturnus_update(player); dashes_frame_update(player); mars_recharge_update(player); divine_intervention_recharge(player); @@ -1366,6 +1604,7 @@ void items_frame_update(Entity_Player& player) pending_pill_update(player); if (effects.HasNullEffect(NULLITEM_REVERSE_STARS) && player.IsExtraAnimationFinished()) effects.RemoveNullEffect(NULLITEM_REVERSE_STARS, 1); + volt_45_charge_update(player); ibs_charge_update(player); birthright_dead_bird_update(player); azazels_rage_update(player); @@ -1373,6 +1612,8 @@ void items_frame_update(Entity_Player& player) purgatory_update(player); isaacs_heart_update(player); extension_cord_update(player); + mega_blast_update(player); + azazels_rage_steer(player); montezuma_aim_update(player); plan_c_update(player); linger_bean_update(player); diff --git a/src/entity_player_frame.cpp b/src/entity_player_frame.cpp index 38001d4..df56356 100644 --- a/src/entity_player_frame.cpp +++ b/src/entity_player_frame.cpp @@ -16,7 +16,6 @@ #include "entity_laser.h" #include "entity_knife.h" #include "game.h" -#include "key_configs.h" #include "log.h" #include "lua_engine.h" #include "manager.h" @@ -185,21 +184,6 @@ static bool is_overlay_pass() return mode == RENDER_NORMAL || mode == RENDER_WATER_ABOVE; } -// Whether an action is held on a controller, or on any device for -1, as the input manager's pressed test reads it. -static bool is_action_held(ButtonAction action, int controllerIndex) -{ - KAGE::Input::Manager& input = KAGE::Input::manager; - - for (int i = 0; i < input.get_device_count(); i++) - { - std::shared_ptr 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)) - if (button != KAGE::Input::BUTTON_NONE && device->is_button_pressed(button)) return true; - } - return false; -} - // 0067f260 The direction a vector mostly points in, down when it is zero. Direction vector_to_direction(const Vector& v) { @@ -239,8 +223,7 @@ Vector Entity_Player::GetMovementJoystick() bool isFollower = playerType == PLAYER_ESAU || (parent && parent->is_player()) || ((playerType == PLAYER_LAZARUS_B || playerType == PLAYER_LAZARUS2_B) && twin && twin->playerIndex != -1 && twin->playerIndex < playerIndex && twin != this); - if (isFollower && isControlsEnabled && controlsCooldown < 1 && - input_action_value_get(ACTION_DROP, controllerIndex, this) > 0) + if (isFollower && isControlsEnabled && controlsCooldown < 1 && input_is_action_pressed(ACTION_DROP, controllerIndex, nullptr)) return {}; Vector input = vector_make(input_action_value_get(ACTION_RIGHT, controllerIndex, this) - @@ -502,8 +485,11 @@ void Entity_Player::update_body_animations() if (input.x != 0 || input.y != 0) recentMovementVector = input; Vector walkInput = walk_direction_update(input); walk_velocity_update(walkInput); - if (!HasEntityFlags(FLAG_INTERPOLATION_UPDATE)) walking_items_animate(*this); - jupiter_update(*this, input); + if (!HasEntityFlags(FLAG_INTERPOLATION_UPDATE)) + { + walking_items_animate(*this); + jupiter_update(*this, input); + } if (HasCollectible(COLLECTIBLE_MARS) && isControlsEnabled) mars_taps_read(*this); marsTapFrames = std::min(marsTapFrames + 1, MARS_TAP_FRAMES_MAX); if (!HasTrinket(TRINKET_DUCT_TAPE) || GetTrinketMultiplier(TRINKET_DUCT_TAPE) < 2) ductTapeMode = 0; @@ -710,10 +696,10 @@ void Entity_Player::shoot_input_read(ShootInput& input) bool isMovementShooting = game.seedEffects.HasSeedEffect(SEED_SHOOT_IN_MOVEMENT_DIRECTION) || game.seedEffects.HasSeedEffect(SEED_SHOOT_OPPOSITE_MOVEMENT_DIRECTION); int first = isMovementShooting ? ACTION_LEFT : ACTION_SHOOT_LEFT; - bool isLeft = is_action_held((ButtonAction)first, controllerIndex); - bool isRight = is_action_held((ButtonAction)(first + 1), controllerIndex); - bool isUp = is_action_held((ButtonAction)(first + 2), controllerIndex); - bool isDown = is_action_held((ButtonAction)(first + 3), controllerIndex); + bool isLeft = input_is_action_pressed((ButtonAction)first, controllerIndex, this); + bool isRight = input_is_action_pressed((ButtonAction)(first + 1), controllerIndex, this); + bool isUp = input_is_action_pressed((ButtonAction)(first + 2), controllerIndex, this); + bool isDown = input_is_action_pressed((ButtonAction)(first + 3), controllerIndex, this); input.isOpposing = (isDown && isUp) || (isLeft && isRight); bool isMouse = GetMouseAimTarget(input.direction, false); @@ -1207,7 +1193,7 @@ static WeaponType weapon_override_get(Entity_Player& player) } // What the charged items of 0077b020 read: whether fire is held, whether a forced shot (Marked) releases a full -// charge at once, and the aim. +// charge at once, and the aim the head turns to. struct ChargeShot { Vector direction{}; @@ -1407,8 +1393,8 @@ static void eve_clot_update(Entity_Player& player, bool isShootHeld) // Epiphora: fire held one way speeds the tears up frame by frame (to 180), and turning away or letting go resets it, // though the bone keeps it 10 frames past each swing. A reset on an interpolated frame still sets off the fire -// items. Nothing resets while fire is blocked. -static void epiphora_update(Entity_Player& player, const ChargeShot& shot) +// items when the player can fire. Nothing resets while fire is blocked. +static void epiphora_update(Entity_Player& player, const ChargeShot& shot, bool canFire) { constexpr int EPIPHORA_GRACE = 10; constexpr int EPIPHORA_CHARGE_MAX = 180; @@ -1439,8 +1425,7 @@ static void epiphora_update(Entity_Player& player, const ChargeShot& shot) player.epiphoraCharge = 0; faced = DIRECTION_NONE; player.EvaluateItems(); - bool isFiring = player.isCoopGhost || player.canShoot; - if (!isInterpolation || !isFiring || !player.IsExtraAnimationFinished() || g_game->stageTransition.state != 0) + if (!isInterpolation || !canFire || !player.IsExtraAnimationFinished() || g_game->stageTransition.state != 0) return; player.ClearEntityFlags(FLAG_INTERPOLATION_UPDATE); player.trigger_fire_item_effects(shot.direction, shot.isShootHeld); @@ -1620,7 +1605,9 @@ static void headless_blood_spray(Entity_Player& player, const PassiveShot& shot) scale = random_unit() * SCALE_JITTER + scale; Vector aim = vector_normalized(shot.direction); Vector velocity = shot.isAiming ? vector_scale(aim, BLOOD_SPRAY_AIM_SPEED) : Vector{}; - velocity = vector_add(velocity, vector_scale(vector_scale(random_direction(), random_unit()), BLOOD_SPRAY_SCATTER)); + Vector scatter = random_direction(); + scatter = vector_scale(scatter, random_unit() * BLOOD_SPRAY_SCATTER); + velocity = vector_add(velocity, scatter); velocity = vector_add(velocity, player.GetTearMovementInheritance(aim, INHERIT_ALWAYS)); auto* tear = static_cast(g_game->Spawn({.position = player.pos, .velocity = velocity, .spawner = &player, @@ -1827,7 +1814,7 @@ void Entity_Player::update_shooting() } bool isFireReady = IsExtraAnimationFinished() && game.stageTransition.state == 0 && isInputAllowed; - if (isFireReady) charged_items_update(*this, {shootDirection, isForcedShot, isShootHeld}); + if (isFireReady) charged_items_update(*this, {headAim, isForcedShot, isShootHeld}); if (isFireReady && playerType == PLAYER_EVE_B && !isInterpolation) eve_clot_update(*this, isShootHeld); uint32_t modifiers = (uint32_t)GetWeaponModifiers(); @@ -1871,11 +1858,12 @@ void Entity_Player::update_shooting() (playerType == PLAYER_LILITH && HasCollectible(COLLECTIBLE_BIRTHRIGHT))) blinkTime = std::max(blinkTime, POINTY_RIB_BLINK); PassiveShot shot{shootDirection, isAiming, isShootHeld}; + PassiveShot headShot{headAim, isAiming, isShootHeld}; trinity_shield_update(*this, shot); double_tap_update(*this); doubleTapFrames++; spear_of_destiny_update(*this, shot); - if (!isInterpolation && IsFrame(2, 0)) headless_blood_spray(*this, shot); + if (!isInterpolation && IsFrame(2, 0)) headless_blood_spray(*this, headShot); float savedLuck = luck; if (HasTrinket(TRINKET_TEARDROP_CHARM)) { @@ -1886,8 +1874,9 @@ void Entity_Player::update_shooting() if (itemState != 0) item_state_update(*this, {shootDirection, vector_cardinal(shootDirection), isAiming, isShootHeld}); else if (canFire || playerType == PLAYER_LILITH || playerType == PLAYER_LILITH_B) { - tech_five_update(*this, shot); - if (canFire && isFireReady) trigger_fire_item_effects(shootDirection, isShootHeld); + tech_five_update(*this, headShot); + bool isReady = IsExtraAnimationFinished() && game.stageTransition.state == 0 && isInputAllowed; + if (canFire && isReady) trigger_fire_item_effects(shootDirection, isShootHeld); } if (luck == shotLuck) luck = savedLuck; @@ -1919,7 +1908,9 @@ void Entity_Player::update_shooting() costume_heads_update(blinkFrame); } } - if (isFireReady && HasCollectible(COLLECTIBLE_EPIPHORA)) epiphora_update(*this, {shootDirection, false, isShootHeld}); + isFireReady = IsExtraAnimationFinished() && game.stageTransition.state == 0 && isInputAllowed; + if (isFireReady && HasCollectible(COLLECTIBLE_EPIPHORA)) + epiphora_update(*this, {shootDirection, false, isShootHeld}, canFire); if (fireBlockCooldown > 0) return; aimDirection = shootDirection; @@ -1989,14 +1980,14 @@ void Entity_Player::Render(const Vector& offset) render_pass(renderOffset, RENDER_PASS_MAIN); held_entity_render(renderOffset, HELD_FRONT); lua_engine_get().PostPlayerRender(this, offset); - if (!is_overlay_pass()) return; - if (playerHUD) + bool isOverlayPass = is_overlay_pass(); + if (playerHUD && isOverlayPass) hud_bubble_render(*playerHUD, vector_make(renderPosition.x, renderPosition.y + playerSpriteScale.y * HUD_BUBBLE_RISE)); - if (g_game->playerManager.playerList.size() > 1 && g_game->roomTransition.mode == TRANSITION_NONE) + if (g_game->playerManager.playerList.size() > 1 && isOverlayPass && g_game->roomTransition.mode == TRANSITION_NONE) coop_indicator_render(); - if (!isDead) + if (!isDead && isOverlayPass) { render_charge_bars(renderPosition); if (statusEffectSprite.isLoaded && statusEffectSprite.animState.animData && @@ -2216,7 +2207,7 @@ void Entity_Player::RenderHead(const Vector& position) { if (!isVisible || IsFullSpriteRendering()) return; - for (int layer = PLAYER_LAYER_HEAD; layer <= PLAYER_LAYER_EXTRA - 1; layer++) + for (int layer = PLAYER_LAYER_HEAD; layer < PLAYER_LAYER_TOP0; layer++) layer_sprite(layer).RenderLayer(layer_id(layer), SpriteDraw{position, {}, {}}); for (auto [collectible, crown] : {std::pair{COLLECTIBLE_DARK_PRINCES_CROWN, &darkPrincesCrownSprite}, std::pair{COLLECTIBLE_CROWN_OF_LIGHT, &crownOfLightSprite}}) diff --git a/src/entity_player_health.cpp b/src/entity_player_health.cpp index 3a46c56..262acb3 100644 --- a/src/entity_player_health.cpp +++ b/src/entity_player_health.cpp @@ -241,7 +241,7 @@ void Entity_Player::red_hearts_add(int hearts, bool isUnknown2) } // 00758d00 Adds soul hearts up to the limit, or takes them away. Esau's ghost passes them to its twin and The Forgotten -// to The Soul. Alabaster Box's charge eats them first, a Blanket's shield takes two, Keeper gets flies, Bethany soul +// to The Soul. Alabaster Box's charge eats them first, Spirit Shackles' broken chain takes two, Keeper gets flies, Bethany soul // charge, and characters without health a single soul heart when given any. void Entity_Player::AddSoulHearts(int amount, bool isUnknown) { @@ -279,8 +279,8 @@ void Entity_Player::AddSoulHearts(int amount, bool isUnknown) owner->soul_hearts_add(amount, isUnknown); } -// Fills Alabaster Box charges and lets a Blanket shield take two from soul hearts about to be added, returning what is -// left. +// Fills Alabaster Box charges, after the Spirit Shackles' broken chain takes two, from soul hearts about to be added, +// returning what is left. int Entity_Player::soul_hearts_absorb(int amount) { if (temporaryEffects.HasNullEffect(NULLITEM_SPIRIT_SHACKLES_DISABLED)) @@ -873,7 +873,6 @@ void Entity_Player::SyncConsumables(Entity_Player* target, uint32_t mask) void Entity_Player::charge_store_changed(int effectiveCharge, int oldCharge) { constexpr int SOUND_BATTERY_CHARGE = 171; - constexpr int SOUND_ITEM_RECHARGE = 218; constexpr int POCKET_SLOT = 3; constexpr int RED_KEY_SLOT = 2; @@ -891,7 +890,7 @@ void Entity_Player::charge_store_changed(int effectiveCharge, int oldCharge) int before = total - effectiveCharge + oldCharge; if (before >= total || before >= maxCharge) continue; g_game->hud.FlashChargeBar(this, slot); - sound_play(total < maxCharge ? SOUND_BATTERY_CHARGE : SOUND_ITEM_RECHARGE); + sound_play(total < maxCharge ? SOUND_BATTERY_CHARGE : SOUND_ITEMRECHARGE); } if (!HasTrinket(TRINKET_VIBRANT_BULB) && !HasTrinket(TRINKET_DIM_BULB)) return; cacheFlags |= CACHE_DAMAGE | CACHE_FIREDELAY | CACHE_SHOTSPEED | CACHE_RANGE | CACHE_LUCK; diff --git a/src/entity_player_hits.cpp b/src/entity_player_hits.cpp index 23a22f6..d9f5a8a 100644 --- a/src/entity_player_hits.cpp +++ b/src/entity_player_hits.cpp @@ -396,7 +396,7 @@ static void butter_hit(Entity_Player& player) // Stompy, the Bird Cage, Larynx, Swallowed Penny, Cartridge, Curse of the Tower, Cracked Dice, Purity, the Crown of // Light, the Shard of Glass, Varicose Veins, It Hurts, the Cracked Orb, the Vengeful Spirit, Torn Pocket, // Hypercoagulation, Large Zit, Tonsil, Bag Lunch, Umbilical Cord, Wish Bone, Bozo and Butter. Whether the hurt -// animation still plays (Cartridge's Gamekid stops it). Cambion Conception stops the game until reached. +// animation still plays (Cartridge's Gamekid stops it). bool late_items_hit_trigger(Entity_Player& player, const ItemsHit& hit) { Game& game = *g_game; diff --git a/src/entity_player_items.cpp b/src/entity_player_items.cpp index 12afa5c..5f3055f 100644 --- a/src/entity_player_items.cpp +++ b/src/entity_player_items.cpp @@ -605,7 +605,6 @@ void Entity_Player::TriggerNewRoom_TemporaryEffects() } // The items, tags, unlocks and counters taking a collectible asks about. -constexpr int COLLECTIBLE_BOOK_OF_BELIAL_ACTIVE = 34; constexpr int COLLECTIBLE_RUBBER_CEMENT = 221; constexpr int COLLECTIBLE_COUNT_UNLOCK = 50; constexpr int ACHIEVEMENT_MANY_COLLECTIBLES = 330; @@ -808,9 +807,9 @@ void Entity_Player::UpdateBookOfVirtues(bool isAddedBookOfVirtues) if (HasCollectible(COLLECTIBLE_BOOK_OF_BELIAL_PASSIVE)) { book = COLLECTIBLE_BOOK_OF_BELIAL_PASSIVE; - if ((int)removed.size() > COLLECTIBLE_BOOK_OF_BELIAL_ACTIVE && !removed[COLLECTIBLE_BOOK_OF_BELIAL_ACTIVE] && + if ((int)removed.size() > COLLECTIBLE_BOOK_OF_BELIAL && !removed[COLLECTIBLE_BOOK_OF_BELIAL] && game.challenge != CHALLENGE_CANTRIPPED) - removed[COLLECTIBLE_BOOK_OF_BELIAL_ACTIVE] = true; + removed[COLLECTIBLE_BOOK_OF_BELIAL] = true; } ActiveItemDesc& active = activeItems[0]; diff --git a/src/entity_player_kills.cpp b/src/entity_player_kills.cpp index cd4eab7..93fec91 100644 --- a/src/entity_player_kills.cpp +++ b/src/entity_player_kills.cpp @@ -11,7 +11,6 @@ #include constexpr int COLLECTIBLE_CHARM_OF_THE_VAMPIRE = 62; -constexpr int COLLECTIBLE_BERSERK_KILLS = 704; // Charm of the Vampire heals every 13 kills, every 8 in a versus match. The heart rises 24 above the player. constexpr int VAMPIRE_KILLS = 13; @@ -122,10 +121,10 @@ static void deaths_list_update(Entity_Player& player, Entity& npc) // Berserk: a gory kill lengthens it and destroys the enemy shots around the player. static void berserk_update(Entity_Player& player, Entity& npc) { - TemporaryEffect* berserk = player.temporaryEffects.GetCollectibleEffect(COLLECTIBLE_BERSERK_KILLS); + TemporaryEffect* berserk = player.temporaryEffects.GetCollectibleEffect(COLLECTIBLE_BERSERK); if (!npc.HasEntityFlags(FLAG_EXTRA_GORE) || !berserk) return; - ItemConfig_Item* item = g_manager->itemConfig.GetCollectible(COLLECTIBLE_BERSERK_KILLS); + ItemConfig_Item* item = g_manager->itemConfig.GetCollectible(COLLECTIBLE_BERSERK); bool isLong = player.playerType == PLAYER_SAMSON_B && player.HasCollectible(COLLECTIBLE_BIRTHRIGHT); TemporaryEffect added; added.item = item; diff --git a/src/entity_player_passives.cpp b/src/entity_player_passives.cpp index bc727f0..0d487a4 100644 --- a/src/entity_player_passives.cpp +++ b/src/entity_player_passives.cpp @@ -82,7 +82,6 @@ constexpr uint64_t SPIDERBABY_VERSUS_MS = 1501; constexpr int SPIDERBABY_VERSUS_SPIDERS_MIN = 1; constexpr int SPIDERBABY_VERSUS_SPIDERS_RANGE = 2; constexpr int HABIT_VERSUS_DAMAGE = 20; -constexpr int ANEMIC_VERSUS_FRAMES = 300; constexpr float OLD_BANDAGE_VERSUS_CHANCE = 0.1f; constexpr int VIRGO_VERSUS_CHANCES[] = {10, 20, 35, 50}; constexpr float VIRGO_VERSUS_LUCK[] = {4, 7, 10}; diff --git a/src/entity_player_passives.h b/src/entity_player_passives.h index a45ab80..fcf6b16 100644 --- a/src/entity_player_passives.h +++ b/src/entity_player_passives.h @@ -10,6 +10,8 @@ struct TemporaryEffect; // Toxic Shock's green poop clouds, and how fast Unicorn Stump's music changes volume. constexpr ColorMod TOXIC_SHOCK_COLOR = {{1, 1, 1, 1}, {0, 1, 0, 1}, {0, 0, 0}}; constexpr float STUMP_VOLUME_RATE = 0.08f; +// How long Anemic's bleeding lasts in a versus match. +constexpr int ANEMIC_VERSUS_FRAMES = 300; // The passive collectibles' (1 to 366) pieces other files call: the effects the frame and stats are written for, the // items' frame, the walking items' costumes and the hit, Cursed Eye's teleport and the last heart's saves. diff --git a/src/entity_player_pockets.cpp b/src/entity_player_pockets.cpp index 5db9ea0..7335a84 100644 --- a/src/entity_player_pockets.cpp +++ b/src/entity_player_pockets.cpp @@ -34,7 +34,6 @@ constexpr int PILL_ID_COUNT = 50; constexpr int ACHIEVEMENT_GULP = 386; constexpr int ANNOUNCER_FRAMES_RANDOM = 900; constexpr int ANNOUNCER_FRAMES = 2; -constexpr int CHALLENGE_RANDOM_POCKETS = 32; constexpr int COLLECTIBLE_ECHO_CHAMBER = 700; constexpr int GULP_UNLOCK_USES = 4; constexpr float CARD_HELD_RISE = -12; @@ -347,7 +346,7 @@ void Entity_Player::UseCard(int cardType, uint32_t useFlag) Player_stats_add(g_game->onlinePlayerStats, ONLINE_STAT_CARDS, this, 1); int frames = announcer_frames(); - if (g_game->challenge == CHALLENGE_RANDOM_POCKETS) cardType = (int)(GetCardRNG(cardType).Next() % CARD_ID_VANILLA_LAST) + 1; + if (g_game->challenge == CHALLENGE_APRILS_FOOL) cardType = (int)(GetCardRNG(cardType).Next() % CARD_ID_VANILLA_LAST) + 1; PocketUse use = {.player = *this, .rng = GetCardRNG(cardType), .flags = useFlag}; use.isCarBattery = useFlag & USE_CARBATTERY; @@ -404,7 +403,7 @@ void Entity_Player::UsePill(int pillEffect, int pillColor, uint32_t useFlags) ItemConfig& config = g_manager->itemConfig; ItemConfig_Pill* pill = pillEffect >= 0 ? config.GetPillEffect(pillEffect) : nullptr; - if (game.challenge == CHALLENGE_RANDOM_POCKETS && pillEffect >= 0 && pillEffect < PILL_ID_COUNT) + if (game.challenge == CHALLENGE_APRILS_FOOL && pillEffect >= 0 && pillEffect < PILL_ID_COUNT) pill = config.GetPillEffect((int)(GetPillRNG(pillEffect).Next() % PILL_ID_COUNT)); std::string name = pill ? pocket_text(pill->name) : std::string(); std::string description = pill ? pocket_text(pill->desc) : std::string(); diff --git a/src/entity_player_trinkets.cpp b/src/entity_player_trinkets.cpp index d030764..05eea66 100644 --- a/src/entity_player_trinkets.cpp +++ b/src/entity_player_trinkets.cpp @@ -467,9 +467,9 @@ void Entity_Player::spawn_lil_clot_familiars() } // The trinket part of 006e8ae0: a player not holding an item up who can take the trinket sees its name, drops the -// trinket it swaps out (or the Tick a Match Stick or Lighter burns), and holds the new one up, golden or not, until it -// is added. Whether it was taken. -bool trinket_collect(Entity_Pickup& pickup, Entity_Player& player) +// trinket it swaps out (or the Tick a Match Stick or Lighter burns) as dropped, and holds the new one up, golden or not, +// until it is added. Whether it was taken. +bool trinket_collect(Entity_Pickup& pickup, Entity_Player& player, Entity_Pickup*& dropped) { int id = pickup.subtype; if (player.IsHoldingItem() || player.parent || !player.TryHoldTrinket(id)) return false; @@ -481,7 +481,7 @@ bool trinket_collect(Entity_Pickup& pickup, Entity_Player& player) [](uint32_t held) { return (held & TRINKET_ID_MASK) == TRINKET_TICK; }); bool isTickBurnt = isTickHeld && is_tick_burner(id); bool isFull = player.trinkets[0] != 0 && (slots < 2 || player.trinkets[1] != 0); - if (isFull || isTickBurnt) player.DropTrinket(player.pos, isTickBurnt); + if (isFull || isTickBurnt) dropped = player.DropTrinket(player.pos, isTickBurnt); uint32_t flags = pickup.isTouched ? QUEUED_TOUCHED : 0; if (id & TRINKET_GOLDEN_FLAG) flags |= QUEUED_GOLDEN; diff --git a/src/entity_player_trinkets.h b/src/entity_player_trinkets.h index c3b476a..077813b 100644 --- a/src/entity_player_trinkets.h +++ b/src/entity_player_trinkets.h @@ -22,7 +22,7 @@ struct ItemsHit // The trinkets' and late collectibles' (367 on) pieces other files call (entity_player_trinkets.cpp and // entity_player_hits.cpp). Pickups: a trinket taken and lifted, a coin's penny trinkets, the Smelter's smelting. -bool trinket_collect(Entity_Pickup& pickup, Entity_Player& player); +bool trinket_collect(Entity_Pickup& pickup, Entity_Player& player, Entity_Pickup*& dropped); void trinket_lift(Entity_Pickup& pickup, Entity_Player& player); void coin_trinkets_collect(Entity_Pickup& pickup, Entity_Player& player, int value); void trinkets_smelt(Entity_Player& player); diff --git a/src/entity_player_weapons.cpp b/src/entity_player_weapons.cpp index c6756f2..3a2b0ab 100644 --- a/src/entity_player_weapons.cpp +++ b/src/entity_player_weapons.cpp @@ -70,8 +70,6 @@ constexpr int TRANSFORMATION_COUNT = 3; constexpr float TECH_X_THICKER_SCALE = 1.5f; constexpr float TECH_X_RING_LIFT = -20; -constexpr int COLLECTIBLE_BRIMSTONE_WEAPON = 118; -constexpr int COLLECTIBLE_CURSED_EYE_WEAPON = 316; constexpr float DEAD_TOOTH_RING_SCALE = 0.8f; constexpr int LARGE_ZIT_INTERVAL = 30; constexpr uint32_t LARGE_ZIT_ODDS = 3; @@ -86,8 +84,8 @@ constexpr int COLLECTIBLE_EYE_SORE = 558; // The items GetWeaponModifiers turns into modifier bits, in the order it asks. constexpr std::pair MODIFIER_ITEMS[] = { - {COLLECTIBLE_CHOCOLATE_MILK, WEAPON_MOD_CHOCOLATE_MILK}, {COLLECTIBLE_CURSED_EYE_WEAPON, WEAPON_MOD_CURSED_EYE}, - {COLLECTIBLE_BRIMSTONE_WEAPON, WEAPON_MOD_BRIMSTONE}, {COLLECTIBLE_MONSTROS_LUNG, WEAPON_MOD_MONSTROS_LUNG}, + {COLLECTIBLE_CHOCOLATE_MILK, WEAPON_MOD_CHOCOLATE_MILK}, {COLLECTIBLE_CURSED_EYE, WEAPON_MOD_CURSED_EYE}, + {COLLECTIBLE_BRIMSTONE, WEAPON_MOD_BRIMSTONE}, {COLLECTIBLE_MONSTROS_LUNG, WEAPON_MOD_MONSTROS_LUNG}, {COLLECTIBLE_LUDOVICO, WEAPON_MOD_LUDOVICO_TECHNIQUE}, {COLLECTIBLE_ANTI_GRAVITY, WEAPON_MOD_ANTI_GRAVITY}, {COLLECTIBLE_TRACTOR_BEAM, WEAPON_MOD_TRACTOR_BEAM}, {COLLECTIBLE_NEPTUNUS, WEAPON_MOD_NEPTUNUS}}; // The items whose copies past the first each add a tear to the volley. diff --git a/src/entity_projectile.cpp b/src/entity_projectile.cpp index 974b678..47e30e3 100644 --- a/src/entity_projectile.cpp +++ b/src/entity_projectile.cpp @@ -123,6 +123,7 @@ constexpr float COIN_LAYER_SCALE = 2.75f; constexpr float FIRE_GROW_FRAMES = 15; constexpr float FIRE_SIZE_MIN = 0.1f; constexpr int ANIM_KEY_BONE = 100; +constexpr const char* HOLY_BONE_SHEET = "gfx/bone_projectile_holy.png"; constexpr int ANIM_KEY_FIRE = 200; constexpr int ANIM_KEY_CORN = 300; constexpr int ANIM_KEY_COIN = 400; @@ -165,7 +166,7 @@ constexpr int HEAD_GIBS = 8; constexpr float HEAD_GIB_SPREAD = 40; constexpr uint32_t HEAD_GIB_FLAGS = GIB_FLAG_BLOOD | GIB_FLAG_BONE | GIB_FLAG_GUT | GIB_FLAG_EYE; constexpr float DOGMA_DEPTH_OFFSET = 300; -constexpr uint64_t DOGMA_ELECTRIC_FLAGS = PROJECTILE_SHIELDED | PROJECTILE_BLUE_FIRE_SPAWN; +constexpr uint64_t DOGMA_ELECTRIC_FLAGS = PROJECTILE_LASER_SHOT | PROJECTILE_GODHEAD; // Homing: the reach of SMART and its pull, and SMART_PERFECT's reach and pull. constexpr float SMART_RANGE = 500; @@ -365,7 +366,6 @@ constexpr int SOUND_BLOOD_SPLASH = 30; constexpr int SOUND_COIN_IMPACT = 138; constexpr int SOUND_INFAMY_BLOCK = 863; constexpr int SOUND_PIN_GOO = 934; -constexpr int SOUND_BEAST_FIRE = 700; constexpr int COLLECTIBLE_SOUL = 335; constexpr int COLLECTIBLE_BETRAYAL = 391; @@ -551,8 +551,6 @@ float Entity_Projectile::time_scale_get() return timeScale; } -// 00653070 Flies the shot for a frame: its animation, the base update, its flags' steering and wiggles, its fall, - // A fly ball (a broccoli shot): a shot whose subtype counts the flies (less 100 past 100, which then carry the count) // that orbit it from its first frame, itself unseen. It homes in on the nearest player (not Mother's), goes once its // flies are gone, and bursts them out backwards when it dies. @@ -780,6 +778,7 @@ void Entity_Projectile::Update() } fly_orbit_update(*this); trails_update(); + if (variant == PROJECTILE_LAVA) isDead = false; if (isDead) return death_update(); if ((projectileFlags & PROJECTILE_STASIS) && stasis_update()) return lua_engine_get().PostProjectileUpdate(this); @@ -889,6 +888,11 @@ void Entity_Projectile::animation_update() break; case PROJECTILE_BONE: if (animKey == ANIM_KEY_BONE) break; + if (projectileFlags & PROJECTILE_BLUE_FIRE_SPAWN) + { + sprite.ReplaceSpritesheet(0, HOLY_BONE_SHEET); + sprite.LoadGraphics(); + } sprite.Play("Move"); if (sprite.animState.animData) frame_randomize(); animKey = ANIM_KEY_BONE; @@ -1169,6 +1173,70 @@ static void side_wave_spawn(Entity_Projectile& shot) } } +// A lava shot smokes every other tick: while young a dust cloud, likelier the younger it is, then a slow flame from a +// random spot within its size. +static void lava_trail_spawn(Entity_Projectile& shot) +{ + constexpr float LAVA_SMOKE_FRAMES = 40; + constexpr float LAVA_SMOKE_CHANCE_FRAMES = 50; + constexpr float LAVA_SMOKE_SCALE = 1.5f; + constexpr float LAVA_SMOKE_SPIN = 10; + constexpr float LAVA_SMOKE_SPIN_LEAST = 2; + constexpr int LAVA_SMOKE_TIMEOUT = 15; + constexpr int LAVA_SMOKE_FADE_FRAMES = 12; + constexpr float LAVA_SMOKE_DEPTH = -1000; + constexpr ColorMod LAVA_SMOKE_COLOR = {{0.4f, 0.35f, 0.3f, 0.6f}, {0, 0, 0, 0}, {0, 0, 0}}; + constexpr ColorMod LAVA_SMOKE_FADE_COLOR = {{3, 0.8f, 0, 0.8f}, {0, 0, 0, 0}, {0, 0, 0}}; + constexpr float LAVA_FLAME_GLOW = 0.7f; + constexpr float LAVA_FLAME_GLOW_LEAST = 0.3f; + constexpr int LAVA_FLAME_FADE_RANGE = 19; + constexpr int LAVA_FLAME_FADE_LEAST = 12; + constexpr int LAVA_FLAME_DEPTH = -1000; + constexpr float LAVA_FLAME_PLAYBACK = 0.6f; + constexpr ColorMod LAVA_FLAME_COLOR = {{0, 0, 0, 0}, {0, 0, 0, 0}, {0.2f, -0.5f, 0}}; + Vector drift = vector_scale(shot.velocity, HALF); + Vector drop = vector_add(shot.posOffset, vector_make(0, shot.fallingSpeed * HALF)); + + if (shot.updateTime < LAVA_SMOKE_FRAMES && random_unit() < (LAVA_SMOKE_CHANCE_FRAMES - shot.updateTime) / LAVA_SMOKE_FRAMES) + { + auto* smoke = static_cast(g_game->Spawn({.position = shot.pos, + .velocity = drift, + .spawner = &shot, + .type = ENTITY_EFFECT, + .variant = EFFECT_DUST_CLOUD, + .seed = Random()})); + smoke->posOffset = drop; + smoke->sprite.scale = vector_make(LAVA_SMOKE_SCALE, LAVA_SMOKE_SCALE); + smoke->rotation = random_unit() * LAVA_SMOKE_SPIN + LAVA_SMOKE_SPIN_LEAST; + smoke->SetTimeout(random_below(LAVA_SMOKE_TIMEOUT) + LAVA_SMOKE_TIMEOUT); + smoke->SetColor(LAVA_SMOKE_COLOR, -1, COLOR_PRIORITY, false, true); + smoke->SetColor(LAVA_SMOKE_FADE_COLOR, LAVA_SMOKE_FADE_FRAMES, 1, true, true); + smoke->renderDepthOffset = LAVA_SMOKE_DEPTH; + smoke->Update(); + } + + uint32_t seed = Random(); + Vector spot = vector_scale(random_direction(), shot.size); + spot = vector_add(shot.pos, vector_scale(spot, random_unit())); + Entity* flame = g_game->Spawn({.position = spot, + .velocity = drift, + .spawner = &shot, + .type = ENTITY_EFFECT, + .variant = EFFECT_HAEMO_TRAIL, + .seed = seed}); + flame->posOffset = drop; + ColorMod glow = tint_color_make(0, 0, 0, 1); + glow._offset[0] = 1; + glow._offset[1] = random_unit() * LAVA_FLAME_GLOW + LAVA_FLAME_GLOW_LEAST; + float scale = random_unit() + 1; + flame->sprite.scale = vector_make(scale, scale); + flame->SetColor(LAVA_FLAME_COLOR, -1, COLOR_PRIORITY, false, true); + flame->SetColor(glow, random_below(LAVA_FLAME_FADE_RANGE) + LAVA_FLAME_FADE_LEAST, COLOR_PRIORITY, true, true); + flame->renderZOffset = LAVA_FLAME_DEPTH; + flame->sprite.playbackSpeed = LAVA_FLAME_PLAYBACK; + flame->Update(); +} + // The trails shots leave: a blue fire spawning shot's and a Necro bone's glow, a side wave's shots, the Beast's fire // trail and the drops Mother's pound shots leave. void Entity_Projectile::trails_update() @@ -1177,6 +1245,7 @@ void Entity_Projectile::trails_update() else if (spawnerType == ENTITY_NECRO && variant == PROJECTILE_BONE && GetIntervalTicks(TRAIL_TICKS, 0)) glow_trail_spawn(true); if ((projectileFlags & PROJECTILE_SIDE_WAVE) && GetIntervalTicks(SIDE_WAVE_TICKS, 0)) side_wave_spawn(*this); + if (variant == PROJECTILE_LAVA && GetIntervalTicks(TRAIL_TICKS, 0)) lava_trail_spawn(*this); // War's fire balls in the Beast's fight leave a glowing trail of haemo every other frame, its glow random. constexpr float FIRE_TRAIL_SPEED = 0.5f; @@ -1241,7 +1310,7 @@ void Entity_Projectile::death_update() if (projectileFlags & PROJECTILE_SIDE_WAVE) side_wave_burst(); if (variant == PROJECTILE_HEAD) head_splash(); Remove(); - if (variant == PROJECTILE_FIRE && spawnerType == ENTITY_BEAST) npc_sound_play(SOUND_BEAST_FIRE, 1, 2, 1); + if (variant == PROJECTILE_FIRE && spawnerType == ENTITY_BEAST) npc_sound_play(SOUND_BEAST_FIRE_RING, 1, 2, 1); } // Part of 00653070: a dead laser shot leaves a Tech dot shining toward its target (found anywhere when it had none), diff --git a/src/entity_projectile.h b/src/entity_projectile.h index d810322..667bbe7 100644 --- a/src/entity_projectile.h +++ b/src/entity_projectile.h @@ -38,6 +38,8 @@ constexpr ColorMod CIRCLE_TEAR_COLOR = {{0.4f, 0.15f, 0.38f, 1}, {0, 0, 0, 0}, { // A thrown grid entity's subtype packs its grid type above its variant. constexpr int GRID_TYPE_SHIFT = 16; constexpr int GRID_VARIANT_MASK = 0xffff; +// The variant of a grid shot that is not a grid entity but looks like a rock (a Host's shell). +constexpr int ROCKLIKE_VARIANT = 9000; constexpr ColorMod SHOT_COLOR_FIERY = {{1, 1, 1, 1}, {3.5f, 2.5f, 1, 1}, {0, 0, 0}}; diff --git a/src/entity_rock_drop.cpp b/src/entity_rock_drop.cpp index f38e3db..509ae2e 100644 --- a/src/entity_rock_drop.cpp +++ b/src/entity_rock_drop.cpp @@ -10,7 +10,6 @@ // What a thrown grid entity leaves when it lands: a bomb rock's or barrel's blast of 60, a rock's four bits of rubble // (in the thrower's look unless it was a rock-like shot, variant 9000), or a poop's rewards, gibs and drops. constexpr float LANDED_BLAST_DAMAGE = 60; -constexpr int ROCKLIKE_VARIANT = 9000; constexpr int RUBBLE_PIECES = 4; constexpr float RUBBLE_SCATTER = 12; constexpr float RUBBLE_SPEED = 5; diff --git a/src/entity_tear.h b/src/entity_tear.h index ca59fed..fef9c38 100644 --- a/src/entity_tear.h +++ b/src/entity_tear.h @@ -18,6 +18,13 @@ inline float tear_size_scale(int size) return TEAR_ANIMATION_SCALES[std::clamp(size, 1, (int)TEAR_ANIMATION_SCALES.size()) - 1]; } +// FUN_00652ae0: the RegularTear animation number a scale draws with, three a unit up from 3, at most 13. +inline int tear_size_from_scale(float scale) +{ + constexpr float SIZES_PER_SCALE = 3; + return std::min((int)(scale * SIZES_PER_SCALE + SIZES_PER_SCALE), (int)TEAR_ANIMATION_SCALES.size()); +} + // Lua's TearFlags bits the game reads. Bits 84 and 101 to 103 have no Lua name: It Hurts' creep on death, flags // swapped in on an interval, a speed reset on an interval, and steering back toward the parent. enum TearFlagBit : int diff --git a/src/familiar_ai.cpp b/src/familiar_ai.cpp index b25465c..73e3d69 100644 --- a/src/familiar_ai.cpp +++ b/src/familiar_ai.cpp @@ -22,7 +22,6 @@ constexpr int FISH_TAIL_TRIPLED_FACTOR = 4; constexpr float CHARMED_INTRUDER_RANGE = 300; constexpr int BLUE_FLY_ACHIEVEMENT_COUNT = 20; constexpr int ACHIEVEMENT_BLUE_FLIES = 388; -constexpr int COLLECTIBLE_MILK_ID = 436; // The hits that do not make Damocles fall: red heart, fake and no-penalty damage. constexpr uint64_t DAMAGE_FAKE_HITS = 0x10200020; @@ -105,7 +104,6 @@ constexpr float AUTO_SHOOTER_DAMAGE = 3; constexpr int LINE_GRID_PATH_LIMIT = 900; // The target search's scoring. -constexpr int ENTITY_BLOOD_PUPPY_ENEMY = 802; constexpr float TARGET_STICKINESS = 400; constexpr float TARGET_CLOSENESS = 800; constexpr float TARGET_PLAYER_CLOSENESS = 400; @@ -229,7 +227,7 @@ void Entity_Familiar::PickEnemyTarget(const TargetSearch& search) bool isOut = entity->entityCollisionClass == ENTCOLL_NONE || entity->entityCollisionClass == ENTCOLL_PLAYERONLY || entity->isInvincible || entity->isDead || entity->IsDescendantOf(spawnerEntity) || entity->HasEntityFlags(FLAG_FRIENDLY | FLAG_NO_TARGET) || - entity->type == ENTITY_BLOOD_PUPPY_ENEMY || + entity->type == ENTITY_BLOOD_PUPPY || (search.range < distance && (!isNearPlayer || search.range <= playerDistance)); bool isVersusBag = isVersus && entity->type == ENTITY_FAMILIAR && entity->variant == PUNCHING_BAG && !entity->IsDescendantOf(spawnerEntity); @@ -411,9 +409,9 @@ void Entity_Familiar::ai_blue_fly() // unlocks its achievement. Entity* Entity_Player::AddBlueFlies(int amount, Vector spawnPos, Entity* chased) { - int fishTail = GetTrinketMultiplier(TRINKET_FISH_TAIL); - if (fishTail > 0) + if (HasTrinket(TRINKET_FISH_TAIL)) { + int fishTail = GetTrinketMultiplier(TRINKET_FISH_TAIL); int factor = 2; if (fishTail == 2 && Random() % 5 == 0) factor = 3; if (fishTail == 3 && Random() % 5 == 0) factor = FISH_TAIL_TRIPLED_FACTOR; @@ -748,7 +746,7 @@ void Entity_Familiar::level_start() isVisible = true; shadowSize = config->shadowSize; sprite.Play("Idle"); - if (ItemConfig_Item* milk = g_manager->itemConfig.GetCollectible(COLLECTIBLE_MILK_ID)) + if (ItemConfig_Item* milk = g_manager->itemConfig.GetCollectible(COLLECTIBLE_MILK)) player->temporaryEffects.RemoveEffect(milk, 1); } if (variant == GUPPYS_HAIRBALL) subtype >>= 1; diff --git a/src/familiar_follow.cpp b/src/familiar_follow.cpp index 006de2a..cdee93a 100644 --- a/src/familiar_follow.cpp +++ b/src/familiar_follow.cpp @@ -844,7 +844,7 @@ Vector Entity_Familiar::GetOrbitPosition(const Vector& center) float angle = std::fmod(orbitAngleOffset - phase * orbitSpeed * PI_F * 0.5f, TAU); if (variant == SACRIFICIAL_DAGGER) { - if (sprite.SetAnimation("Rotation", SWITCH_KEEP_FRAME) && sprite.animState.animData) + if (sprite.SetAnimation("Rotation", SWITCH_RESET) && sprite.animState.animData) { sprite.animState.SetFrameFloat(SACRIFICIAL_DAGGER_ROTATION_FRAME); sprite.animState.isPlaying = false; diff --git a/src/familiar_gello.cpp b/src/familiar_gello.cpp index 1754a55..f9d9ccd 100644 --- a/src/familiar_gello.cpp +++ b/src/familiar_gello.cpp @@ -504,6 +504,7 @@ static void gello_fling_hits(Entity_Familiar& gello, UmbilicalBabyData& data) } if (owner.HasCollectible(COLLECTIBLE_BFFS)) radius *= CORD_BFFS_SCALE; strike.cord = Capsule(owner.pos, gello.pos, radius); + if (g_game->debugFlags & DEBUG_HITSPHERES) gello.GetDebugShape(true).Capsula(strike.cord); cord_grid_hits(gello, strike.cord); bool isVersus = g_game->deathmatchManager.state >= DEATHMATCH_INTRO; diff --git a/src/familiar_repentance.cpp b/src/familiar_repentance.cpp index 2f78109..87ad3eb 100644 --- a/src/familiar_repentance.cpp +++ b/src/familiar_repentance.cpp @@ -332,7 +332,8 @@ static void boiled_shot_fire(Entity_Familiar& baby, float damage) } // Part of 0061da10: Boiled Baby follows and, every few frames with enemies in the room, may burst (more likely with -// enemies near), spraying four to six tears on its Spawn animation's Shoot event. +// enemies near, or for a charmed one players and uncharmed familiars), spraying four to six tears on its Spawn +// animation's Shoot event. void boiled_baby_update(Entity_Familiar& baby) { ANM2& sprite = baby.sprite; @@ -359,7 +360,7 @@ void boiled_baby_update(Entity_Familiar& baby) for (Entity* entity : entity_query_radius(baby.pos, isCharmed ? BOILED_CHARMED_RANGE : BOILED_RANGE, QUERY_ENEMIES)) { if (!entity) continue; - if (isCharmed) near += !entity->is_player() && (!entity->IsFamiliar() || entity->HasEntityFlags(FLAG_CHARM)); + if (isCharmed) near += entity->is_player() || (entity->IsFamiliar() && !entity->HasEntityFlags(FLAG_CHARM)); else near += entity->IsVulnerableEnemy(nullptr); } if (random_below(near < 1 ? BOILED_FAR_ODDS : BOILED_NEAR_ODDS) == 0) sprite.Play("Spawn", PLAY_FORCED); diff --git a/src/familiar_shoot.cpp b/src/familiar_shoot.cpp index a7aae6f..5b67dff 100644 --- a/src/familiar_shoot.cpp +++ b/src/familiar_shoot.cpp @@ -35,7 +35,6 @@ constexpr int FIRE_DELAY_ROTTEN_VERSUS = 33; constexpr float FIRE_DELAY_CHARMED = 1.4f; constexpr int HEAD_SHOOT_FRAMES = 18; constexpr int HEAD_FLOAT_FRAME = 8; -constexpr int FAMILIAR_ABEL_TWIN = 244; constexpr int MIMIC_ROBO_BABY = 4; constexpr int MIMIC_ROTTEN_BABY = 9; constexpr float ROTTEN_FLY_RANGE = 200; @@ -160,8 +159,8 @@ float Entity_Familiar::GetMultiplier() ((tags & TAG_FAMILIAR_FLY) || (tags & TAG_FAMILIAR_SPIDER) || variant == ABYSS_LOCUST); float multiplier = isBffs || isHiveMind ? 2.0f : 1.0f; - int leash = player->GetTrinketMultiplier(TRINKET_CHILD_LEASH); - if (leash > 0) multiplier = (float)leash * 0.25f + multiplier; + if (player->HasTrinket(TRINKET_CHILD_LEASH)) + multiplier = (float)player->GetTrinketMultiplier(TRINKET_CHILD_LEASH) * 0.25f + multiplier; if (player->playerType == PLAYER_BETHANY_B) multiplier *= 0.75f; Entity_Player* twin = static_cast(player->twinPlayer.get()); @@ -294,7 +293,7 @@ void Entity_Familiar::Shoot() if (variant == FATES_REWARD) fireDelay = FIRE_DELAY_FATES_REWARD; if (HasEntityFlags(FLAG_CHARM)) fireDelay = (int)((float)fireDelay * FIRE_DELAY_CHARMED); int mimic = -1; - if (variant == FAMILIAR_ABEL_TWIN) fireDelay = FIRE_DELAY_FAST; + if (variant == ESAU_JR) fireDelay = FIRE_DELAY_FAST; else if (variant == MONGO_BABY) mimic = subtype; if (familiar_versus() && variant == ROTTEN_BABY) fireDelay = FIRE_DELAY_ROTTEN_VERSUS; @@ -306,7 +305,7 @@ void Entity_Familiar::Shoot() } Vector toPlayer = vector_sub(player->pos, pos); - if (variant == ABEL || variant == FAMILIAR_ABEL_TWIN) direction = cardinal_direction(toPlayer); + if (variant == ABEL || variant == ESAU_JR) direction = cardinal_direction(toPlayer); Vector aim = direction_unit(direction); bool isMarked = TryAimAtMarkedTarget(aim, direction, nullptr); FireMode mode = isMarked ? FIRE_EXACT : FIRE_INHERIT_MOTION; @@ -324,7 +323,7 @@ void Entity_Familiar::Shoot() } else if (variant == ROBO_BABY || mimic == MIMIC_ROBO_BABY) fire_robo_baby_laser(aim); else if (variant != ROTTEN_BABY && mimic != MIMIC_ROTTEN_BABY) - FireProjectile(variant == ABEL || variant == FAMILIAR_ABEL_TWIN ? vector_normalized(toPlayer) : aim, mode); + FireProjectile(variant == ABEL || variant == ESAU_JR ? vector_normalized(toPlayer) : aim, mode); else if (!linkedEntity) { PickEnemyTarget({.range = ROTTEN_FLY_RANGE}); @@ -480,7 +479,7 @@ static void shot_variant_apply(Entity_Familiar& familiar, FamiliarShot& shot, in } else if ((variant == Entity_Familiar::ABEL && (player.playerType == PLAYER_CAIN || player.playerType == PLAYER_CAIN_B)) || - variant == FAMILIAR_ABEL_TWIN) + variant == Entity_Familiar::ESAU_JR) { shot.tearVariant = TEAR_BLOOD; shot.damage = 7.5f; @@ -506,9 +505,17 @@ static void shot_variant_apply(Entity_Familiar& familiar, FamiliarShot& shot, in } } +// Whether a spawned shot rolls Intruder's slowing (nine times in ten) after its damage. +enum ShotRoll +{ + SHOT_ROLL_NONE, + SHOT_ROLL_SLOW +}; + // Spawns one of a familiar's tears and finishes it: its arc, damage, flags, size and look, the familiar as its parent, // Baby-Bender, and an owner's charm (part of 00639750). -static Entity_Tear* shot_spawn(Entity_Familiar& familiar, const FamiliarShot& shot, Vector velocity) +static Entity_Tear* shot_spawn(Entity_Familiar& familiar, const FamiliarShot& shot, Vector velocity, + ShotRoll roll = SHOT_ROLL_NONE) { auto* tear = static_cast(g_game->Spawn({.position = vector_add(familiar.pos, shot.offset), .velocity = velocity, @@ -519,7 +526,9 @@ static Entity_Tear* shot_spawn(Entity_Familiar& familiar, const FamiliarShot& sh tear->fallingSpeed = random_unit() * SHOT_FALL_JITTER + shot.fallingSpeed; tear->fallingAccel = shot.fallingAccel; tear->SetCollisionDamage(shot.damage); - tear->SetTearFlags(shot.flags); + TearFlags flags = shot.flags; + if (roll == SHOT_ROLL_SLOW && Random() % INTRUDER_PLAIN_ODDS != 0) flags.set(TEAR_SLOW); + tear->SetTearFlags(flags); tear->baseScale = shot.scale; tear->fScale = shot.scale; tear->ResetSpriteScale(); @@ -535,31 +544,36 @@ static Entity_Tear* shot_spawn(Entity_Familiar& familiar, const FamiliarShot& sh static Entity_Tear* intruder_shots_fire(Entity_Familiar& intruder, FamiliarShot& shot, Vector aimDirection) { Entity_Tear* tear = nullptr; - TearFlags flags = shot.flags; for (int i = 0; i < INTRUDER_SHOTS; i++) { float step = (float)i / (INTRUDER_SHOTS - 1); Vector side = vector_rotated(aimDirection, step * INTRUDER_SPREAD - INTRUDER_SPREAD / 2); shot.offset = vector_scale(side, INTRUDER_SPREAD_DISTANCE); - shot.flags = flags; - if (Random() % INTRUDER_PLAIN_ODDS != 0) shot.flags.set(TEAR_SLOW); - tear = shot_spawn(intruder, shot, vector_rotated(shot.velocity, step * INTRUDER_FAN - INTRUDER_FAN / 2)); + Vector velocity = vector_rotated(shot.velocity, step * INTRUDER_FAN - INTRUDER_FAN / 2); + tear = shot_spawn(intruder, shot, velocity, SHOT_ROLL_SLOW); } return tear; } -// 00639750 Fires a familiar's tear: at ten speed, with the player's motion unless aimed at a mark, its damage and size -// scaled by BFFS!, and the variant's flags and look. Harlequin Baby fires two, Intruder four and the wisps their own -// way. Intruder works out the player's motion too but fires from its bare aim. +// 00639750 Fires a familiar's tear: at ten speed, with the player's motion unless aimed at a mark (Intruder only the +// part not against its aim), its damage and size scaled by BFFS!, and the variant's flags and look. Harlequin Baby +// fires two, Intruder four and the wisps their own way. Entity_Tear* Entity_Familiar::FireProjectile(const Vector& aimDirection, FireMode mode) { FamiliarShot shot; shot.velocity = vector_scale(aimDirection, SHOT_SPEED); - if (mode == FIRE_INHERIT_MOTION && variant != INTRUDER) + Vector inherited = vector_scale(player->velocity, SHOT_INHERIT * 2); + if (mode == FIRE_INHERIT_MOTION && variant == INTRUDER) { - Vector inherited = vector_scale(player->velocity, SHOT_INHERIT * 2); - shot.velocity = variant == ABEL || variant == FAMILIAR_ABEL_TWIN ? vector_sub(shot.velocity, inherited) - : vector_add(shot.velocity, inherited); + Vector aim = vector_normalized(aimDirection); + Vector along = vector_scale(aim, vector_dot(aim, inherited)); + if (vector_dot(along, aimDirection) < 0) inherited = vector_sub(inherited, along); + shot.velocity = vector_add(shot.velocity, inherited); + } + else if (mode == FIRE_INHERIT_MOTION) + { + shot.velocity = variant == ABEL || variant == ESAU_JR ? vector_sub(shot.velocity, inherited) + : vector_add(shot.velocity, inherited); if (vector_length_squared(shot.velocity) < SHOT_SPEED * SHOT_SPEED && variant != LIL_MONSTRO) shot.velocity = vector_scale(vector_normalized(shot.velocity), SHOT_SPEED); } @@ -620,7 +634,7 @@ bool Entity_Familiar::apply_baby_bender_tear_params(TearFlags& flags, ColorMod& // 00634000 Applies Baby-Bender to a familiar's tear, keeping it at its height (low in a crawlspace). bool Entity_Familiar::TryFireTear(Entity_Tear* tear) { - if (player->GetTrinketMultiplier(TRINKET_BABY_BENDER) <= 0) return false; + if (!player->HasTrinket(TRINKET_BABY_BENDER)) return false; TearFlags flags = tear->tearFlags; ColorMod color = tear->sprite.color; @@ -651,9 +665,9 @@ static void converted_shot_strengthen(Entity& enemy) } // 0064bb70 (Entity::convert_shot_for_enemy_owner) A shot of a familiar the Siren charmed turns on the player, owned by -// the Siren: a tear becomes a slower enemy shot, a blue fly an attack fly (Rotten Baby's own fly then), a blue spider -// a spider (thrown when in the air), a laser changes owner, and the red and white creep become the enemies' (the red -// only once the Siren's helper is past 30 frames). Anything else stays. +// the Siren (or a versus player): a tear becomes a slower enemy shot, a blue fly an attack fly (Rotten Baby's own fly +// then), a blue spider a spider (thrown when in the air), a laser changes owner, and the red and white creep become the +// enemies' (the red only once the Siren's helper is past 30 frames). Anything else stays. // The original reads past a missing shot. Here nothing happens then. void Entity_Familiar::shot_owner_convert(Entity* shot) { @@ -661,12 +675,14 @@ void Entity_Familiar::shot_owner_convert(Entity* shot) constexpr float CREEP_HELPER_FRAMES = 30; Entity* owner = player->spawnerEntity; - if (!shot || !HasEntityFlags(FLAG_CHARM) || !owner || !Entity::is_enemy_type(owner->type)) return; + if (!shot || !HasEntityFlags(FLAG_CHARM) || !owner) return; + if (!(familiar_versus() && owner->type == ENTITY_PLAYER) && !Entity::is_enemy_type(owner->type)) return; - EntitySpawn spawn = {.position = shot->pos, .velocity = shot->velocity, .spawner = owner, .seed = Random()}; + EntitySpawn spawn = {.position = shot->pos, .velocity = shot->velocity, .spawner = owner}; if (shot->type == ENTITY_TEAR) { auto& tear = *static_cast(shot); + spawn.seed = Random(); spawn.velocity = vector_scale(shot->velocity, TEAR_SPEED_SHARE); spawn.type = ENTITY_PROJECTILE; auto& projectile = *static_cast(g_game->Spawn(spawn)); @@ -680,6 +696,7 @@ void Entity_Familiar::shot_owner_convert(Entity* shot) else if (shot->type == ENTITY_FAMILIAR && shot->variant == BLUE_FLY) { spawn.type = ENTITY_ATTACKFLY; + spawn.seed = Random(); Entity* fly = g_game->Spawn(spawn); converted_shot_strengthen(*fly); shot->Remove(); @@ -689,8 +706,13 @@ void Entity_Familiar::shot_owner_convert(Entity* shot) { bool isAirborne = shot->posOffset.y < 0 || static_cast(shot)->orbitSpeed < 0; spawn.type = ENTITY_SPIDER; - Entity* spider = - isAirborne ? Entity_NPC::ThrowSpider(shot->pos, owner, {}, false, posOffset.y) : g_game->Spawn(spawn); + Entity* spider = nullptr; + if (isAirborne) spider = Entity_NPC::ThrowSpider(shot->pos, owner, {}, false, posOffset.y); + else + { + spawn.seed = Random(); + spider = g_game->Spawn(spawn); + } converted_shot_strengthen(*spider); shot->Remove(); } @@ -707,6 +729,7 @@ void Entity_Familiar::shot_owner_convert(Entity* shot) if (!isRedCreep && shot->variant != EFFECT_PLAYER_CREEP_WHITE) return; spawn.type = ENTITY_EFFECT; + spawn.seed = Random(); spawn.variant = isRedCreep ? EFFECT_CREEP_RED : EFFECT_CREEP_WHITE; Entity* creep = g_game->Spawn(spawn); creep->sprite.scale = shot->sprite.scale; diff --git a/src/familiar_update.cpp b/src/familiar_update.cpp index f7b18b0..19dec15 100644 --- a/src/familiar_update.cpp +++ b/src/familiar_update.cpp @@ -324,7 +324,7 @@ void charged_baby_update(Entity_Familiar& baby) if (!g_game->room->IsClear() || g_game->deathmatchManager.is_active()) { int age = baby.FrameCount(); - bool isChance = age % CHARGED_CHANCE_FRAMES == 0 && random_below(2) == 0; + bool isChance = age > 0 && age % CHARGED_CHANCE_FRAMES == 0 && random_below(2) == 0; if (age > 0 && (isChance || age % CHARGED_SURE_FRAMES == 0)) charged_baby_act(baby); } baby.FollowParent(); @@ -379,12 +379,12 @@ void lost_fly_update(Entity_Familiar& fly) } } -// Part of 0061da10: the Censer follows, slowing the enemies around it, and halves once the speed of the tears (marked -// with Lump of Coal's growth) and, in a versus match, the enemy shots passing through. +// Part of 0061da10: the Censer follows, slowing the enemies around it, and halves once the speed of the enemy shots +// passing through and, in a versus match, of the tears (marked with Lump of Coal's growth). void censer_update(Entity_Familiar& censer) { - uint32_t partitions = QUERY_TEARS | QUERY_ENEMIES; - if (g_game->deathmatchManager.is_active()) partitions |= QUERY_PROJECTILES; + uint32_t partitions = QUERY_PROJECTILES | QUERY_ENEMIES; + if (g_game->deathmatchManager.is_active()) partitions |= QUERY_TEARS; for (Entity* entity : entity_query_radius(censer.pos, CENSER_RANGE, partitions)) { if (entity->HasEntityFlags(FLAG_FRIENDLY)) continue; diff --git a/src/game.cpp b/src/game.cpp index d435980..8ba2738 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -897,7 +897,7 @@ static void hallucination_resolve(Game& game) // Draws what a run shows over its room: the debug shapes, the HUD, the transitions and overlays, then the prompts and // menus of a run between the popup layers, and the mods' shaders. -// The debug shapes stay empty until DebugRenderer's takeover, and the online stats screen never shows offline. +// The online stats screen never shows offline. static void overlays_render(Game& game) { KAGE::Graphics::Manager& graphics = KAGE::Graphics::manager; @@ -905,6 +905,7 @@ static void overlays_render(Game& game) bool isFighting = game.deathmatchManager.state == DEATHMATCH_FIGHT; int stageState = game.stageTransition.state; + game.debugRenderer.Render(); popups.render_layer(0); game.hud.Render(); if (isFighting) game.deathmatchManager.type->timer_render(); @@ -1038,7 +1039,7 @@ static void effects_resolve(Game& game, bool isRoomSnapshot, bool isOldTv) render_color_shader_pass(KAGE::Graphics::color_quad_rect({}, screen, game.fadeOutColor)); if (game.debugFlags & DEBUG_PLAYER_INFO && !game.playerManager.playerList.empty()) - reconstruction_missing("Game::Render 006fbc10: the player debug info"); + player_debug_info_render(*game.playerManager.GetPlayer(0), vector_make(DEBUG_INFO_MARGIN, DEBUG_INFO_MARGIN)); if (game.debugFlags & DEBUG_LUA_MEMORY) lua_memory_render(); } diff --git a/src/game.h b/src/game.h index 96f5246..070fc71 100644 --- a/src/game.h +++ b/src/game.h @@ -10,6 +10,7 @@ #include "challenge_params.h" #include "console.h" #include "deathmatch_manager.h" +#include "debug_renderer.h" #include "entity_factory.h" #include "game_over.h" #include "game_state.h" @@ -92,7 +93,7 @@ enum GameStateFlag : int GAME_STATE_DEVILROOM_VISITED = 6, GAME_STATE_BOOK_PICKED_UP = 8, GAME_STATE_HEAVEN_PATH = 19, - GAME_STATE_KRAMPUS_SPAWNED = 29, + GAME_STATE_KRAMPUS_SPAWNED = 29, // also a December 5 daily's surprise miniboss seen GAME_STATE_BOSSRUSH_DONE = 33, GAME_STATE_SUPERBUM_APPEARED = 37, GAME_STATE_BOSSRUSH_DOOR_SPAWNED = 38, @@ -244,7 +245,7 @@ public: Minimap minimap; ScoreSheet scoreSheet; GenericPrompt genericPrompt{}; - DebugRenderer debugRenderer{}; + DebugRenderer debugRenderer; EmoteWheel emoteWheel; ANM2 completionWidgetSprite; diff --git a/src/game_restore.cpp b/src/game_restore.cpp index b572895..df36c75 100644 --- a/src/game_restore.cpp +++ b/src/game_restore.cpp @@ -810,6 +810,7 @@ void Entity_Player::RestoreGameState(GameStatePlayer& saved) reverseEmpressMaxHearts = saved.reverseEmpressMaxHearts; reverseSunBoneHearts = saved.reverseSunBoneHearts; pendingPill = saved.pendingPill; + damageChargeCooldown = saved.damageChargeCooldown; forgottenBodyRoomIdx = saved.forgottenBodyRoomIdx; forgottenBodyPos = saved.forgottenBodyPos; maggyHealthDrainCooldown = saved.maggyHealthDrainCooldown; diff --git a/src/game_save.cpp b/src/game_save.cpp index 3a7728c..a336cc6 100644 --- a/src/game_save.cpp +++ b/src/game_save.cpp @@ -379,6 +379,7 @@ void Entity_Player::StoreGameState(GameStatePlayer* saveState, bool isSaveTempor state.reverseEmpressMaxHearts = reverseEmpressMaxHearts; state.reverseSunBoneHearts = reverseSunBoneHearts; state.pendingPill = pendingPill; + state.damageChargeCooldown = damageChargeCooldown; state.forgottenBodyRoomIdx = forgottenBodyRoomIdx; state.forgottenBodyPos = forgottenBodyPos; state.maggyHealthDrainCooldown = maggyHealthDrainCooldown; diff --git a/src/game_state.cpp b/src/game_state.cpp index b8aa102..1510caa 100644 --- a/src/game_state.cpp +++ b/src/game_state.cpp @@ -342,8 +342,8 @@ void StateWriter::player_write(const GameStatePlayer& player) write(player.jumperCablesKills); for (const ActiveItemDesc& active : player.activeItems) - for (int value : {active.item, active.unknown, active.charge, active.batteryCharge, active.partialCharge, - active.varData}) + for (int value : {active.item, active.unknown, active.charge, active.batteryCharge, + std::bit_cast(active.partialCharge), active.varData}) write(value); for (float value : {player.playerSpriteScale.x, player.playerSpriteScale.y, player.headScale.x, player.headScale.y, player.bodyScale.x, player.bodyScale.y}) @@ -425,7 +425,7 @@ void StateWriter::player_write(const GameStatePlayer& player) for (int value : {effect.type, effect.id, effect.count, effect.cooldown}) write(value); write(player.reverseSunBoneHearts); write(player.pendingPill); - write((uint16_t)player.unknownValue); + write((uint16_t)player.damageChargeCooldown); write(player.forgottenBodyRoomIdx); write(player.forgottenBodyPos.x); write(player.forgottenBodyPos.y); @@ -1124,7 +1124,7 @@ bool StateReader::player_read(GameStatePlayer& player) return fail(LOG_INFO, "[warn] Invalid temporary effect (type: %d, ID: %d)\n", effect.type, effect.id); } fields_read(player.reverseSunBoneHearts, player.pendingPill); - player.unknownValue = read(); + player.damageChargeCooldown = read(); fields_read(player.forgottenBodyRoomIdx, player.forgottenBodyPos, player.lastCollectibleFrame, player.maggyHealthDrainCooldown); diff --git a/src/game_state_player.h b/src/game_state_player.h index aa4c712..a276064 100644 --- a/src/game_state_player.h +++ b/src/game_state_player.h @@ -179,7 +179,7 @@ struct GameStatePlayer int strengthMaxHearts = 0; int tearRangeModifier = 0; int pendingPill = -1; - int unknownValue = 0; + int damageChargeCooldown = 0; int wildCardItem = 0; int wildCardVarData = 0; uint32_t conceptionFamiliarFlags = 0; diff --git a/src/game_update.cpp b/src/game_update.cpp index c642c6f..70243df 100644 --- a/src/game_update.cpp +++ b/src/game_update.cpp @@ -336,8 +336,7 @@ static void screen_effects_update(Game& game) // playing takes the tick: a hit stop, the game over or leaderboard screen, a stage or room transition, the prompt or // item overlay, the fade in, the pause screen (opened when the window loses focus) or the co-op revive menu. Otherwise // the run's timers count, the room and the players update, and the mods' post update runs. -// The online stats are not registered: Game's onlinePlayerStats stays a generated vector, as do the debug renderer's -// shapes, which never exist while DebugRenderer is generated. +// The online stats are not registered: Game's onlinePlayerStats stays a generated vector. void Game::Update() { if (console.update_state()) return; @@ -397,6 +396,7 @@ void Game::Update() playerManager.Update(); screen_effects_update(*this); hud.PostUpdate(); + debugRenderer.update(); lua_engine_get().PostUpdate(); } diff --git a/src/grid_entity_statue.cpp b/src/grid_entity_statue.cpp index 722e759..145a188 100644 --- a/src/grid_entity_statue.cpp +++ b/src/grid_entity_statue.cpp @@ -16,7 +16,6 @@ constexpr int STATUE_ANGEL = 1; // alternate floors' boss music and the music fade. constexpr int GAME_STATE_URIEL_SPAWNED = 25; constexpr int GAME_STATE_GABRIEL_SPAWNED = 26; -constexpr int ACHIEVEMENT_ANGEL_STATUES = 155; constexpr uint32_t ROOM_DESCRIPTOR_FLAG_BOSS_MUSIC_2 = 1 << 6; constexpr float ANGEL_MUSIC_FADE = 0.08f; @@ -48,7 +47,7 @@ void GridEntity_Statue::Update() static bool is_angel_unlocked() { Manager& manager = *g_manager; - return manager.persistentGameData.achievements[ACHIEVEMENT_ANGEL_STATUES] || + return manager.persistentGameData.achievements[ACHIEVEMENT_ANGELS] || (manager.state == MANAGER_STATE_GAME && g_game && (g_game->dailyChallenge.id != 0 || g_game->isDebug)); } diff --git a/src/item_pickup.cpp b/src/item_pickup.cpp index a6d4bbd..57d7a31 100644 --- a/src/item_pickup.cpp +++ b/src/item_pickup.cpp @@ -167,6 +167,26 @@ static bool is_cycle_allowed(int collectibleId) return !isGlitchedFuel; } +// 006e1910 Starts a pedestal cycling through items drawn from the room's pool, at most 8, unless it already cycles, is +// gone, holds a quest item or cannot be rerolled. Whether it started. +bool Entity_Pickup::TryInitOptionCycle(uint32_t count) +{ + if (variant != PICKUP_COLLECTIBLE || cycleCollectibleCount != 0 || isDead) return false; + if (!CanRerollVariant(PICKUP_COLLECTIBLE, subtype)) return false; + for (int quest : {COLLECTIBLE_KNIFE_PIECE_1, COLLECTIBLE_KNIFE_PIECE_2, COLLECTIBLE_KEY_PIECE_1, COLLECTIBLE_KEY_PIECE_2, + COLLECTIBLE_POLAROID, COLLECTIBLE_NEGATIVE}) + if (subtype == quest) return false; + + uint32_t seed = dropRNG._seed; + cycleCollectibleCount = std::min(count, (uint32_t)CYCLE_COLLECTIBLE_LIMIT); + for (uint32_t i = 0; i < cycleCollectibleCount; i++) + { + seed = cycle_seed_next(seed); + cycleCollectibleList[i] = (uint32_t)g_game->itemPool.GetSeededCollectible(seed, 0, *g_game->room->descriptor); + } + return true; +} + // The pedestal part of 006e02f0: the item idles on its pedestal and stays solid, Damocles marks it to be doubled, // Isaac's Birthright, Tainted Isaac and Glitched Crown make it cycle through more items, Binge Eater adds a food, a // new error or secret room may hold a glitched item, and an item spawned into the room the players are in appears in diff --git a/src/item_pool.cpp b/src/item_pool.cpp index 42f922c..49bfab8 100644 --- a/src/item_pool.cpp +++ b/src/item_pool.cpp @@ -22,13 +22,6 @@ struct WeightedOutcome int weight; }; -constexpr std::string_view POOL_NAMES[POOL_COUNT] = { - "treasure", "shop", "boss", "devil", "angel", "secret", "library", - "shellGame", "goldenChest", "redChest", "beggar", "demonBeggar", "curse", "keyMaster", - "batteryBum", "momsChest", "greedTreasure", "greedBoss", "greedShop", "greedDevil", "greedAngel", - "greedCurse", "greedSecret", "craneGame", "ultraSecret", "bombBum", "planetarium", "oldChest", - "babyShop", "woodenChest", "rottenBeggar"}; - constexpr int ROOM_TYPE_SLOTS = 31; constexpr int ROOM_ERROR_POOLS = 30; // The pool each room type draws from, normally and in Greed mode (set up by Game's constructor). @@ -89,13 +82,11 @@ constexpr float REPICK_EDGE_DIVISOR = 3.37317f; constexpr int MAX_DEFAULT_ITEM = 732; constexpr int ROSARY_CHANCE_PER_MULTIPLIER = 2; constexpr int GOLDEN_TRINKET_ODDS = 50; -constexpr uint32_t TRINKET_GOLDEN = 0x8000; constexpr uint32_t STATE_SATANIC_BIBLE_USED = 0x20000; constexpr uint32_t DESCRIPTOR_DEVIL_TREASURE = 0x800; constexpr int HOME_CHEST_SUBTYPE = 2; constexpr int COLLECTIBLE_ROSARY = 72; -constexpr int ACHIEVEMENT_GOLDEN_TRINKETS = 617; constexpr int ACHIEVEMENT_GOLD_PILLS = 603; constexpr int ACHIEVEMENT_HORSE_PILLS = 606; @@ -110,7 +101,6 @@ constexpr int DAILY_TREASURE_RANDOM_PASSIVES = 20; constexpr int DAILY_TREASURE_FOUR_ITEMS[] = {334, 335, 333, 331}; constexpr int ONANS_STREAK_BANNED[] = {68, 118, 329, 52, 168, 114, 395, 394, 55, 87, 229}; -constexpr int PILL_HORSE = 0x800; constexpr int PILL_COLORS = 13; constexpr int PILL_GOLD_ODDS = 140; constexpr int PILL_HORSE_ODDS = 70; @@ -833,11 +823,11 @@ uint32_t ItemPool::GetTrinket(TrinketDraw draw) trinket = trinketPoolItems[*found].id; } if (uint32_t overridden = lua_engine_get().GetTrinket((int)trinket, trinketPoolRNG)) return overridden; - if (!g_manager->persistentGameData.Unlocked(ACHIEVEMENT_GOLDEN_TRINKETS)) return trinket; + if (!g_manager->persistentGameData.Unlocked(ACHIEVEMENT_GOLDEN_TRINKET)) return trinket; bool isGolden = rng_make(rng._seed, GOLDEN_SHIFT).Next() % GOLDEN_TRINKET_ODDS == 0 || (g_game && (g_game->debugFlags & DEBUG_HIGH_DAMAGE)); - return isGolden ? trinket | TRINKET_GOLDEN : trinket; + return isGolden ? trinket | TRINKET_GOLDEN_FLAG : trinket; } // 00734130 Takes a trinket out of the pool. Whether it was there to take. @@ -883,7 +873,7 @@ int ItemPool::GetPill(uint32_t drawSeed) if (rng.Next() % PILL_GOLD_ODDS == 0 && g_manager->persistentGameData.Unlocked(ACHIEVEMENT_GOLD_PILLS)) color = PILL_COLOR_GOLD; if (rng.Next() % PILL_HORSE_ODDS == 0 && g_manager->persistentGameData.Unlocked(ACHIEVEMENT_HORSE_PILLS)) - color |= PILL_HORSE; + color |= PILL_HORSE_FLAG; int overridden = lua_engine_get().GetPillColor(drawSeed); return overridden ? overridden : color; diff --git a/src/item_pool.h b/src/item_pool.h index dec04a7..99e49a2 100644 --- a/src/item_pool.h +++ b/src/item_pool.h @@ -52,6 +52,14 @@ enum ItemPoolType : int POOL_COUNT }; +// The pools by the names itempools.xml gives them. +constexpr std::string_view POOL_NAMES[POOL_COUNT] = { + "treasure", "shop", "boss", "devil", "angel", "secret", "library", + "shellGame", "goldenChest", "redChest", "beggar", "demonBeggar", "curse", "keyMaster", + "batteryBum", "momsChest", "greedTreasure", "greedBoss", "greedShop", "greedDevil", "greedAngel", + "greedCurse", "greedSecret", "craneGame", "ultraSecret", "bombBum", "planetarium", "oldChest", + "babyShop", "woodenChest", "rottenBeggar"}; + // How GetCollectible draws: whether the pick loses weight, which collectibles it bans, and whether Magic Skin and the // Rosary Bead may replace it. A quality q is banned by POOL_FLAG_BAN_QUALITY_0 << q. enum PoolFlag : uint32_t diff --git a/src/level.cpp b/src/level.cpp index 47b34cb..55e2dc2 100644 --- a/src/level.cpp +++ b/src/level.cpp @@ -504,6 +504,7 @@ void Level::Init(bool isResetLilPortalRoom) uint32_t effectiveStage = stage + (IsAltPath() ? 1 : 0); game.gameStateFlags &= ~(1ull << GAME_STATE_SECRET_PATH); + game.isLilPortalOpened = false; myosotisPickups.clear(); if (isMyosotis) myosotis_pickups_collect(); @@ -870,7 +871,10 @@ bool Level::place_room(const LevelGenerator_Room& slot, RoomConfig_Room* data, u { if (!data) log_printf(LOG_ASSERT, "Level::place_room data is NULL!\n"); if (nbRooms >= ROOM_MAP_CELLS) + { log_printf(LOG_INFO, "[warn] Could not place room, limit of %d exceeded!\n", ROOM_MAP_CELLS); + return false; + } RoomDescriptor& desc = roomList[nbRooms]; RNG rng{}; @@ -1148,7 +1152,7 @@ void Level::InitStageSeeds() XY cell = XY::NewFromGridIdx(i); float octave2 = noise_octave(raw, cell, 2); - noise[i] = NOISE_NORMALIZE * (noise_octave(raw, cell, 4) * 4 + (octave2 * 2 + raw[i])); + noise[i] = NOISE_NORMALIZE * (noise_octave(raw, cell, 4) * 4 + octave2 + octave2 + raw[i]); } } } @@ -1495,7 +1499,7 @@ static bool shop_place(SpecialRoomPlacement& placement) if (!room) return false; placement.shopIdx = level.nbRooms; level.place_room(*room, config, level.generationRNG._seed, &desc); - if (crownMultiplier >= 3) desc->displayFlags |= ROOM_DISPLAY_ICON; + if (desc && crownMultiplier >= 3) desc->displayFlags |= ROOM_DISPLAY_ICON; return true; } @@ -1551,7 +1555,7 @@ static bool treasure_rooms_place(SpecialRoomPlacement& placement) STAGE_ID_SPECIAL_ROOMS); if (!(room = end_room_take(placement.generator, config))) return false; level.place_room(*room, config, level.generationRNG._seed, &desc); - if (crown_multiplier_get(level) >= 3) desc->displayFlags |= ROOM_DISPLAY_ICON; + if (desc && crown_multiplier_get(level) >= 3) desc->displayFlags |= ROOM_DISPLAY_ICON; if (i == 0) firstSeed = level.generationRNG._seed; } level.generationRNG.SetSeed(firstSeed, DEFAULT_SHIFT_INDEX); @@ -1844,7 +1848,7 @@ static void secret_rooms_place(SpecialRoomPlacement& placement) if (!room || !config) continue; placement.secretIdx = level.nbRooms; level.place_room(*room, config, rng._seed, &desc); - if (isRevealed) desc->displayFlags |= ROOM_DISPLAY_ICON; + if (desc && isRevealed) desc->displayFlags |= ROOM_DISPLAY_ICON; } } @@ -3516,7 +3520,7 @@ void Level::generate_mirror_world() slot.position = XY::NewFromGridIdx(source.gridIndex); slot.shape = data->shape; slot.doors = source.allowedDoors; - place_room(slot, data, source.decorationSeed, &mirrored); + if (!place_room(slot, data, source.decorationSeed, &mirrored)) continue; mirrored->decorationSeed = source.decorationSeed; if (data->type == ROOM_DEFAULT && data->subtype == TREASURE_SUBTYPE_KNIFE_PIECE) mirrored->spawnSeed = source.spawnSeed; diff --git a/src/menu_character.cpp b/src/menu_character.cpp index 307b213..5be745d 100644 --- a/src/menu_character.cpp +++ b/src/menu_character.cpp @@ -160,7 +160,6 @@ constexpr float SPIN_FRAMES = 30; constexpr int SPIN_TURNS = 3; constexpr int INPUT_COOLDOWN = 10; constexpr int SEED_TEXT_MAX = 9; -constexpr size_t SEED_HALF = 4; constexpr int SEED_UNLOCK_FRAMES = 60; constexpr float ALPHA_STEP = 0.05f; constexpr float COLOR_MOD_RATE = 0.015f; @@ -923,7 +922,7 @@ void Menu_Character::seed_entry_input() if (is_key(KEY_KEYPAD_0 + digit, ACTION_TRIGGERED)) seed_add_char((char)('0' + digit)); } if (!is_key(KEY_BACKSPACE, ACTION_TRIGGERED) || seedText.empty()) return; - if (seedText.size() == SEED_HALF + 1) seedText.erase(SEED_HALF - 1, 2); + if (seedText.size() == SEED_HALF_LENGTH + 1) seedText.erase(SEED_HALF_LENGTH - 1, 2); else seedText.pop_back(); } @@ -936,7 +935,7 @@ void Menu_Character::seed_add_char(char character) bool isDigit = upper >= '0' && upper <= '9' && upper != '5'; if (!isLetter && !isDigit) return; - if (seedText.size() == SEED_HALF) seedText.push_back(' '); + if (seedText.size() == SEED_HALF_LENGTH) seedText.push_back(' '); seedText.push_back(upper == 'I' ? '1' : upper == 'O' ? '0' : upper == 'U' ? 'V' : upper); } @@ -1102,9 +1101,9 @@ void Menu_Character::render_seed_page(Vector origin) layer_show(seedPageSprite, SEED_LAYER_KEY, false); text_draw_centered(small, seedText, offset_add(origin, SEED_TEXT_OFFSET)); float entryX = origin.x + MENU_WIDTH + SEED_ENTRY_TEXT_X; - text_draw(large, seedText.substr(0, SEED_HALF), vector_make(entryX, origin.y + SEED_ENTRY_TOP_Y), INK_ARGB); - if (seedText.size() > SEED_HALF + 1) - text_draw(large, seedText.substr(SEED_HALF + 1, SEED_HALF), vector_make(entryX, origin.y + SEED_ENTRY_BOTTOM_Y), + text_draw(large, seedText.substr(0, SEED_HALF_LENGTH), vector_make(entryX, origin.y + SEED_ENTRY_TOP_Y), INK_ARGB); + if (seedText.size() > SEED_HALF_LENGTH + 1) + text_draw(large, seedText.substr(SEED_HALF_LENGTH + 1, SEED_HALF_LENGTH), vector_make(entryX, origin.y + SEED_ENTRY_BOTTOM_Y), INK_ARGB); } diff --git a/src/menu_manager.cpp b/src/menu_manager.cpp index 377ae94..62d7984 100644 --- a/src/menu_manager.cpp +++ b/src/menu_manager.cpp @@ -78,16 +78,11 @@ KColor kcolor_argb(uint32_t argb) return kcolor_make(channel(16), channel(8), channel(0), channel(24)); } -// Whether a device's default bindings meet the test for an action: KeyConfigs' saved bindings and the analog action -// values the device keeps are not taken over yet. +// Whether a device's saved bindings meet the test for an action. static bool is_device_action(const KAGE::Input::InputDevice& device, ButtonAction action, ActionTest test) { - const InputBindings& bindings = platform.bindings; - const std::vector& table = - device.type == KAGE::Input::DEVICE_KEYBOARD ? bindings.keyboard : bindings.controller; - - if (!device.isConnected || action >= (int)table.size()) return false; - for (int button : table[action]) + if (!device.isConnected) return false; + for (int button : 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)) return true; diff --git a/src/minimap.cpp b/src/minimap.cpp index a587ce0..c35ed4b 100644 --- a/src/minimap.cpp +++ b/src/minimap.cpp @@ -71,7 +71,6 @@ constexpr float LARGE_RIGHT = 24; constexpr float LARGE_TOP = 14; constexpr float LARGE_ICONS_X = 32; constexpr float LARGE_ICONS_Y = 16 + 8; -constexpr float DEFAULT_DISPLAYED_SIZE = 47; constexpr float SCORE_HISTORY_ALPHA = 0.5f; constexpr int HISTORY_HUD_ON = 1; diff --git a/src/minimap.h b/src/minimap.h index 2df6fd5..a49ddd3 100644 --- a/src/minimap.h +++ b/src/minimap.h @@ -21,6 +21,9 @@ enum MinimapSize : int MINIMAP_SIZE_COUNT }; +// The size GetDisplayedSize gives while the large map is hidden. +constexpr float DEFAULT_DISPLAYED_SIZE = 47; + // Copies and destruction are the defaults. // One of the two maps (MinimapConfig): its frame sheet, the surface the rooms are drawn on, the room cell size and the // gap between cells, how many cells fit across and down, the margin around them, the room icons' size and how many diff --git a/src/npc_ai.cpp b/src/npc_ai.cpp index b8867e2..980826b 100644 --- a/src/npc_ai.cpp +++ b/src/npc_ai.cpp @@ -605,7 +605,7 @@ static void npc_ai_routine_run(Entity_NPC& npc) case 877: return npc_grudge_update(npc); case 878: - return (void)NpcAI::ENTITY_BUTT_SLICKER(&npc); + return npc_butt_slicker_update(npc); case 879: return npc_bloaty_update(npc); case 880: @@ -645,7 +645,7 @@ static void npc_ai_routine_run(Entity_NPC& npc) case 903: return boss_visage_update(npc); case 904: - return (void)NpcAI::ENTITY_SIREN(&npc); + return boss_siren_update(npc); case 905: return boss_heretic_update(npc); case 906: @@ -667,7 +667,7 @@ static void npc_ai_routine_run(Entity_NPC& npc) case 914: return boss_clog_update(npc); case 915: - return npc.variant == SINGE_BALL ? singe_ball_update(npc) : NpcAI::ENTITY_SINGE_body(&npc); + return npc.variant == SINGE_BALL ? singe_ball_update(npc) : singe_body_update(npc); case 916: return boss_bumbino_update(npc); case 917: @@ -692,7 +692,7 @@ static void npc_ai_routine_run(Entity_NPC& npc) case 965: return npc_minecart_update(npc); case 966: - return (void)NpcAI::ENTITY_SIREN_HELPER(&npc); + return siren_helper_update(npc); case 967: return hornfel_door_update(npc); default: diff --git a/src/npc_ai.h b/src/npc_ai.h index b979897..3311f38 100644 --- a/src/npc_ai.h +++ b/src/npc_ai.h @@ -11,6 +11,8 @@ // The friction an evading enemy keeps. constexpr float FLEE_FRICTION = 0.8f; constexpr int GURGLING_TURDLING = 2; +// A Host or a Mobile Host of this subtype has lost its shell or armor. +constexpr int HOST_UNSHELLED = 99; // Isaac::Random: a random number below max, or 0 for none. inline int random_below(int max) diff --git a/src/npc_alt.h b/src/npc_alt.h index 477f78a..ef7d3ad 100644 --- a/src/npc_alt.h +++ b/src/npc_alt.h @@ -48,6 +48,7 @@ void npc_gutted_fatty_update(Entity_NPC& npc); void npc_fatty_wander(Entity_NPC& npc); Vector npc_weave_direction_get(Entity_NPC& npc); void npc_bloaty_update(Entity_NPC& npc); +void npc_butt_slicker_update(Entity_NPC& npc); void npc_rotten_gaper_update(Entity_NPC& npc); void npc_unborn_update(Entity_NPC& npc); void npc_charger_l2_update(Entity_NPC& npc); diff --git a/src/npc_basement.h b/src/npc_basement.h index 357ed1c..7bdec31 100644 --- a/src/npc_basement.h +++ b/src/npc_basement.h @@ -72,27 +72,11 @@ void game_butter_bean_fart(const ButterBeanFart& fart); // Room::GetLaserTarget: where a beam from a position along a direction first meets a pit, block or wall. Vector room_laser_target_get(const Vector& position, const Vector& direction); -// Keeps an overlay animation playing, restarting it once it ends or another shows. -inline void npc_overlay_loop(ANM2& sprite, std::string_view name) -{ - const AnimationData* data = sprite.overlayAnimState.animData; - bool isShown = data && data->name == name && (!data->isLooping || sprite.overlayAnimState.isPlaying); - if (isShown || !sprite.SetOverlayAnimation(name, SWITCH_KEEP_FRAME)) return; +// Keeps an overlay animation playing, restarting it once it ends or another shows: the original's inlined unforced Play. +inline void npc_overlay_loop(ANM2& sprite, std::string_view name) { sprite.PlayOverlay(name); } - sprite.overlayAnimState.Rewind(); - sprite.overlayAnimState.isPlaying = true; -} - -// Keeps an animation playing, restarting it once it ends (when it loops) or another shows. -inline void npc_anim_loop(ANM2& sprite, std::string_view name) -{ - const AnimationData* data = sprite.animState.animData; - bool isShown = data && data->name == name && (!data->isLooping || sprite.animState.isPlaying); - if (isShown || !sprite.SetAnimation(name, SWITCH_KEEP_FRAME)) return; - - sprite.animState.Rewind(); - sprite.animState.isPlaying = true; -} +// Keeps an animation playing, restarting it once it ends (when it loops) or another shows: the inlined unforced Play. +inline void npc_anim_loop(ANM2& sprite, std::string_view name) { sprite.Play(name); } // Isaac::GetAxisAlignedUnitVectorFromDir: the unit step of a direction (left, up, right, down), none for others. inline Vector vector_from_direction(int direction) diff --git a/src/npc_butt_slicker.cpp b/src/npc_butt_slicker.cpp new file mode 100644 index 0000000..fa8364e --- /dev/null +++ b/src/npc_butt_slicker.cpp @@ -0,0 +1,297 @@ +#include "npc_alt.h" +#include "boss_ai.h" +#include "entity_projectile.h" +#include "grid_entity.h" +#include "path_finder.h" +#include "room.h" +#include "room_grid.h" +#include "sfx_manager.h" +#include +#include + +// The Butt Slicker links with up to 8 others into a crawling chain: each link pulls toward the slickers it holds, +// and follows the link that ranks highest (nearest its target) so the chain trails one head. A link stretched too far +// for too long snaps. +constexpr size_t SLICKER_LINKS = 8; +constexpr int SLICKER_GROWL_DELAY = 120; +constexpr uint32_t SLICKER_GROWL_ODDS = 120; +constexpr float SLICKER_WANDER_SPEED = 2; +constexpr float SLICKER_PATH_CLOSE = 20; +constexpr float SLICKER_GRID_REACH = 40; +constexpr float SLICKER_WANDER_FRICTION = 0.8f; +constexpr float SLICKER_CHASE_SPEED = 0.9f; +constexpr float SLICKER_CHASE_PUSH = 0.65f; +constexpr float SLICKER_LINK_START = 1000; +constexpr float SLICKER_LINK_SLACK = 40; +constexpr float SLICKER_LINK_SNAP = 30; +constexpr float SLICKER_LINK_PULL = 0.05f; +constexpr int SLICKER_RANK_BASE = 10000; +constexpr uint32_t SLICKER_RANK_PENALTY = 200; +constexpr uint64_t SLICKER_DAZED_FLAGS = FLAG_CHARM | FLAG_CONFUSION | FLAG_FEAR | FLAG_SHRINK; + +// Its black creep while hurt: every other frame one time in three, a fifth smaller, for 90 frames, and a splat one +// frame in 15. +constexpr uint32_t SLICKER_CREEP_ODDS = 3; +constexpr float SLICKER_CREEP_SCALE = 0.8f; +constexpr int SLICKER_CREEP_FRAMES = 90; +constexpr uint32_t SLICKER_SPLAT_ODDS = 15; +constexpr float SLICKER_SPLAT_SIZE = 0.3f; +constexpr float SLICKER_SPLAT_RANGE = 0.6f; + +// A killed link stuns its whole chain for 30 to 89 frames and heals the others a quarter. A chain of more than one +// bursts at its middle in four (more than three: eight) shots at 10, and leaves a pool of creep for 300 frames that +// grows a quarter a link. +constexpr uint32_t SLICKER_STUN_RANGE = 60; +constexpr int SLICKER_STUN_MIN = 30; +constexpr float SLICKER_HEAL_SHARE = 0.25f; +constexpr float SLICKER_BURST_SPEED = 10; +constexpr int SLICKER_BURST_EIGHT_LINKS = 3; +constexpr float SLICKER_POOL_GROWTH = 0.25f; +constexpr int SLICKER_POOL_FRAMES = 300; +constexpr int SLICKER_BURST_SUBTYPE = 2; +constexpr float SLICKER_BURST_DEPTH = -10; +constexpr float SLICKER_DEATH_SPLAT_SIZE = 0.6f; + +// (0054d1b0) The link slot of a slicker holding another, or an empty slot for none. +static EntityPtr* slicker_link_find(Entity_NPC& npc, Entity* other) +{ + for (EntityPtr& link : npc.entityDeque) + if (link.get() == other) return &link; + return nullptr; +} + +// Crawls the way it moves, the side walk flipped to the left. +static void slicker_walk_animate(Entity_NPC& npc) +{ + Vector velocity = npc.velocity; + bool isSideways = std::abs(velocity.y) < std::abs(velocity.x); + npc.sprite.Play(isSideways ? "WalkHori" : velocity.y < 0 ? "WalkUp" : "WalkDown"); + npc.sprite.isFlipX = isSideways && velocity.x < 0; +} + +// Alone: wanders along the axes (or paths toward its target position, which only a stun clears), bumps the grid it +// crawls into and slows. +// The original also queries the enemies around it every third frame and drops the list unused. +static void slicker_alone_update(Entity_NPC& npc) +{ + if (npc.projectileCooldown > 0) npc.targetPosition = vector_make(0, 0); + if (vector_is_zero(npc.targetPosition)) npc.pathfinder.MoveRandomlyAxisAligned(SLICKER_WANDER_SPEED, STATUS_OBEYED); + else + { + npc.pathfinder.FindGridPath(npc.targetPosition, SLICKER_WANDER_SPEED, 0, DIRECT_PATH_FAR); + if (vector_distance(npc.pos, npc.targetPosition) > SLICKER_PATH_CLOSE) + npc.velocity = vector_scale(vector_cardinal(npc.velocity), vector_length(npc.velocity)); + } + slicker_walk_animate(npc); + + Room& room = *g_game->room; + Vector front = vector_add(npc.pos, vector_scale(vector_normalized(npc.velocity), SLICKER_GRID_REACH)); + GridEntity* grid = room.GetGridEntity((uint32_t)room.GetGridIndex(front)); + if (grid) grid->Hurt(1, EntityRef(&npc)); + npc.friction *= SLICKER_WANDER_FRICTION; +} + +// Linked: chases its target straight in sight, or paths to it. +// The original walks up to 20 parents first and only logs the ones that are not NPCs. +static void slicker_linked_update(Entity_NPC& npc) +{ + Vector before = npc.velocity; + Vector target = npc.GetPlayerTarget()->pos; + if (!room_check_line(npc.pos, target, 0, 0)) + npc.pathfinder.FindGridPath(npc.CalcTargetPosition(0), SLICKER_CHASE_SPEED, 0, DIRECT_PATH_FAR); + else + { + npc.friction = SLICKER_CHASE_SPEED; + Vector toward = vector_normalized(vector_sub(target, npc.pos)); + npc.velocity = vector_add(npc.velocity, vector_scale(toward, SLICKER_CHASE_PUSH * npc.speedMultiplier / SLICKER_CHASE_SPEED)); + } + npc.v1 = vector_scale(vector_sub(npc.velocity, before), 1 / npc.speedMultiplier); + slicker_walk_animate(npc); +} + +// Every other frame a slicker with free slots links with the farthest touching one it does not hold yet, of its +// side and with free slots, while none is closer than its own size. +static void slicker_link_search(Entity_NPC& npc, bool isFriendly) +{ + Entity_NPC* best = nullptr; + float bestDistance = 0; + float nearest = SLICKER_LINK_START; + + for (Entity* entity : entity_query_radius(npc.pos, npc.size * 2, QUERY_ENEMIES)) + { + if (!entity || entity == &npc || entity->type != npc.type || entity->isDead) continue; + auto& other = static_cast(*entity); + if (other.HasEntityFlags(FLAG_FRIENDLY) != isFriendly || (uint32_t)other.i2 >= SLICKER_LINKS) continue; + + float distance = vector_distance(other.pos, npc.pos); + nearest = std::min(nearest, distance); + if (slicker_link_find(npc, &other)) continue; + if (distance <= other.size + npc.size && bestDistance < distance) + { + bestDistance = distance; + best = &other; + } + } + if (!best || nearest <= npc.size) return; + + EntityPtr* mine = slicker_link_find(npc, nullptr); + EntityPtr* theirs = slicker_link_find(*best, nullptr); + if (!mine || !theirs) return; + *mine = best; + *theirs = &npc; +} + +// Pulls toward each linked slicker (twice as hard when too close), counting its links in i2, snaps a link strained +// past its slack for long enough, and follows the highest ranked link that is not its own follower. +static void slicker_links_pull(Entity_NPC& npc, bool isFriendly) +{ + Vector pull = vector_make(0, 0); + Entity_NPC* leader = nullptr; + int bestRank = npc.i1; + + npc.i2 = 0; + for (size_t i = 0; i < npc.entityDeque.size(); i++) + { + EntityPtr& link = npc.entityDeque[i]; + auto* other = static_cast(link.get()); + if (!other) continue; + if (other->type != npc.type || other->isDead || other->HasEntityFlags(FLAG_FRIENDLY) != isFriendly) + { + link = nullptr; + continue; + } + + Vector delta = vector_sub(other->prevPosition, npc.prevPosition); + float distance = vector_length(delta); + float slack = npc.size + other->size + SLICKER_LINK_SLACK; + float& strain = npc.vectorDeque1[i].x; + if (distance <= slack) strain = 0; + else + { + strain += (distance - slack) * npc.speedMultiplier; + if (strain > SLICKER_LINK_SNAP) + { + if (EntityPtr* back = slicker_link_find(*other, &npc)) *back = nullptr; + link = nullptr; + } + } + + float force = (distance - (npc.size + other->size)) * SLICKER_LINK_PULL; + if (force < 0) force += force; + npc.i2++; + pull = vector_add(pull, vector_scale(vector_normalized(delta), force)); + if (bestRank >= other->i1) continue; + + Entity* root = other; + while (root->parent) root = root->parent; + if (root == &npc || other->parent.get() == &npc || other == &npc) continue; + bestRank = other->i1; + leader = other; + } + + npc.parent = leader; + if (npc.IsFrame(10, 0)) + { + npc.i1 = SLICKER_RANK_BASE - (int)(vector_distance(npc.prevPosition, npc.GetPlayerTarget()->pos) * 2); + if (!isFriendly && npc.HasEntityFlags(SLICKER_DAZED_FLAGS)) npc.i1 -= (int)(Random() % SLICKER_RANK_PENALTY + SLICKER_RANK_PENALTY); + } + npc.velocity = vector_add(npc.velocity, vector_scale(pull, npc.speedMultiplier)); +} + +// A puddle of black creep under it, timed and scaled. +static Entity_Effect* slicker_creep_spawn(Entity_NPC& npc, float scale, int frames) +{ + auto* creep = static_cast(g_game->Spawn( + {.position = npc.pos, .spawner = &npc, .type = ENTITY_EFFECT, .variant = EFFECT_CREEP_BLACK, .seed = Random()})); + creep->sprite.scale = vector_scale(vector_make(1, 1), scale); + creep->SetTimeout(frames); + return creep; +} + +// Killed: its chain comes apart link by link (each stunned, the others healed) and bursts if it was more than one. +static void slicker_chain_break(Entity_NPC& npc) +{ + std::deque pending = {&npc}; + Vector middle = vector_make(0, 0); + int count = 0; + + while (!pending.empty()) + { + Entity_NPC* link = pending.back(); + pending.pop_back(); + for (EntityPtr& slot : link->entityDeque) + { + auto* other = static_cast(slot.get()); + if (!other) continue; + pending.push_back(other); + EntityPtr* mine = slicker_link_find(*link, other); + EntityPtr* theirs = slicker_link_find(*other, link); + if (mine) *mine = nullptr; + if (theirs) *theirs = nullptr; + } + middle = vector_add(link->pos, middle); + count++; + link->i2 = 0; + link->projectileCooldown = (int)(Random() % SLICKER_STUN_RANGE) + SLICKER_STUN_MIN; + if (link != &npc) link->health = std::min(link->maxHitPoints * SLICKER_HEAL_SHARE + link->health, link->maxHitPoints); + } + if (count <= 1) return; + + float growth = (float)count * SLICKER_POOL_GROWTH + 1; + ProjectileParams params; + params.color = GISH_SHOT_COLOR; + ProjectilesMode burst = count > SLICKER_BURST_EIGHT_LINKS ? PROJECTILES_EIGHT : PROJECTILES_PLUS; + npc.FireProjectiles(vector_scale(middle, 1 / (float)count), vector_make(SLICKER_BURST_SPEED, 0), burst, params); + slicker_creep_spawn(npc, growth, SLICKER_POOL_FRAMES)->Update(); + + Entity* blood = g_game->Spawn({.position = npc.pos, .subType = SLICKER_BURST_SUBTYPE, .type = ENTITY_EFFECT, + .variant = EFFECT_BLOOD_EXPLOSION, .seed = Random()}); + blood->SetColor(npc.splatColor, -1, COLOR_PRIORITY_DEFAULT, false, true); + blood->sprite.offset = vector_make(0, 0); + blood->renderDepthOffset = SLICKER_BURST_DEPTH; + npc.MakeSplat(random_between(SLICKER_DEATH_SPLAT_SIZE, SLICKER_DEATH_SPLAT_SIZE) * growth) + ->SetColor(npc.splatColor, -1, COLOR_PRIORITY_DEFAULT, false, true); +} + +// 0054d250 NpcAI::ENTITY_BUTT_SLICKER (878): growls while it leads, trails creep while stunned, crawls alone or with +// its chain, links up, and breaks its chain when it dies. +void npc_butt_slicker_update(Entity_NPC& npc) +{ + if (npc.state == NPC_STATE_INIT) + { + npc.entityGridCollisionClass = GRIDCOLL_GROUND; + npc.entityCollisionClass = ENTCOLL_ALL; + npc.splatColor = GISH_SPLAT_COLOR; + npc.sprite.Play("WalkDown"); + npc.state = NPC_STATE_MOVE; + npc.entityDeque.resize(SLICKER_LINKS); + npc.vectorDeque1.resize(SLICKER_LINKS, vector_make(0, 0)); + } + else if (npc.state == NPC_STATE_MOVE) + { + bool isFriendly = npc.HasEntityFlags(FLAG_FRIENDLY); + if (!npc.parent && Random() % SLICKER_GROWL_ODDS != 0) + npc.PlaySound(SOUND_BUTTLICKER_GROWL, 1, SLICKER_GROWL_DELAY, false, 1); + if (npc.projectileCooldown > 0) + { + if (npc.IsFrame(2, 0) && Random() % SLICKER_CREEP_ODDS == 0) + { + Entity_Effect* creep = slicker_creep_spawn(npc, SLICKER_CREEP_SCALE, SLICKER_CREEP_FRAMES); + creep->parent = &npc; + creep->Update(); + } + if (Random() % SLICKER_SPLAT_ODDS == 0) + npc.MakeSplat(random_between(SLICKER_SPLAT_SIZE, SLICKER_SPLAT_RANGE)) + ->SetColor(npc.splatColor, -1, COLOR_PRIORITY_DEFAULT, false, true); + } + + if (npc.i2 > 0) slicker_linked_update(npc); + else slicker_alone_update(npc); + if (npc.IsFrame(2, 0) && npc.projectileCooldown <= 0 && (uint32_t)npc.i2 < SLICKER_LINKS) + slicker_link_search(npc, isFriendly); + slicker_links_pull(npc, isFriendly); + } + + if (npc.isDead) slicker_chain_break(npc); + if (npc.projectileCooldown > 0) npc.projectileCooldown--; +} diff --git a/src/npc_clotty.cpp b/src/npc_clotty.cpp index ec8d74f..a12a6d0 100644 --- a/src/npc_clotty.cpp +++ b/src/npc_clotty.cpp @@ -7,7 +7,6 @@ #include // The clotties this AI runs: the Clotty with its Clot, I.Blob and Grilled variants, the Mega Clotty and the Cloggy. -constexpr int ENTITY_GLOBIN_SPAWN = 24; constexpr int ENTITY_MEGA_CLOTTY = 282; constexpr int CLOT = 1; constexpr int I_BLOB = 2; @@ -174,7 +173,7 @@ static void mega_clotty_shoot(Entity_NPC& npc) uint32_t seed = Random(); Vector spot = room_free_pickup_position_find({.position = npc.pos, .step = MEGA_SPAWN_STEP}); Entity* spawned = g_game->Spawn({.position = spot, .spawner = &npc, - .type = isGlobin ? ENTITY_GLOBIN_SPAWN : ENTITY_CLOTTY, .seed = seed}); + .type = isGlobin ? ENTITY_GLOBIN : ENTITY_CLOTTY, .seed = seed}); if (!isGlobin) return; auto* globin = static_cast(spawned); diff --git a/src/npc_dip.cpp b/src/npc_dip.cpp index 2ca754c..38b6d10 100644 --- a/src/npc_dip.cpp +++ b/src/npc_dip.cpp @@ -10,7 +10,6 @@ constexpr int DIP_BIG_CORN = 3; constexpr int FAMILIAR_DIP_CORN = 2; constexpr int FAMILIAR_DIP_BROWNIE = 20; -constexpr int COLLECTIBLE_DIRTY_MIND_ID = 576; constexpr int TRINKET_DIPPING_TRINKET_ID = 163; // How a Dip hops: one chance in ten a frame from rest, at a random speed (doubled for the corn dip), and how it @@ -80,11 +79,11 @@ void npc_dip_update(Entity_NPC& npc) { bool isDrip = npc.type == ENTITY_DRIP; PlayerManager& players = g_game->playerManager; - bool isTamed = players.FirstCollectibleOwner(COLLECTIBLE_DIRTY_MIND_ID, LAZARUS_SHARE_CHECK) || + bool isTamed = players.FirstCollectibleOwner(COLLECTIBLE_DIRTY_MIND, LAZARUS_SHARE_CHECK) || players.AnyoneHasTrinket(TRINKET_DIPPING_TRINKET_ID); if (!npc.isDead && isTamed) { - Entity* owner = players.RandomCollectibleOwner(COLLECTIBLE_DIRTY_MIND_ID, npc.initSeed, nullptr); + Entity* owner = players.RandomCollectibleOwner(COLLECTIBLE_DIRTY_MIND, npc.initSeed, nullptr); if (!owner) owner = players.RandomTrinketOwner(TRINKET_DIPPING_TRINKET_ID, npc.initSeed, nullptr); if (owner) { diff --git a/src/npc_dirt.cpp b/src/npc_dirt.cpp index 23e406c..88e021d 100644 --- a/src/npc_dirt.cpp +++ b/src/npc_dirt.cpp @@ -57,15 +57,19 @@ KColor room_floor_color_get(Room& room, const Vector& position, float radius) if (radius <= 0) color = image_pixel_get(*floor, (uint32_t)screen.x, (uint32_t)screen.y); else { - std::array samples; + // The original keeps the samples in a set by luma, so a repeated luma counts once, and takes the third. + // With fewer than three distinct lumas it read past the set, where this takes the brightest. + std::vector samples; for (int i = 0; i < SAMPLE_COUNT; i++) { float reach = radius * FLOOR_SCALE; Vector at = vector_make(screen.x + SAMPLE_POINTS[i][0] * reach, screen.y + SAMPLE_POINTS[i][1] * reach); - samples[i] = image_pixel_get(*floor, (uint32_t)at.x, (uint32_t)at.y); + KColor sample = image_pixel_get(*floor, (uint32_t)at.x, (uint32_t)at.y); + auto isSameLuma = [&](const KColor& kept) { return luma_get(kept) == luma_get(sample); }; + if (std::ranges::none_of(samples, isSameLuma)) samples.push_back(sample); } - std::ranges::stable_sort(samples, {}, luma_get); - color = samples[SAMPLE_COUNT / 2]; + std::ranges::sort(samples, {}, luma_get); + color = samples[std::min(SAMPLE_COUNT / 2, samples.size() - 1)]; } RoomSurfaces& surfaces = roomSurfaces; diff --git a/src/npc_embryo.cpp b/src/npc_embryo.cpp index aee6900..f4a4b23 100644 --- a/src/npc_embryo.cpp +++ b/src/npc_embryo.cpp @@ -10,7 +10,11 @@ constexpr float LAND_VOLUME_RANGE = 0.3f; // soft splat. void npc_embryo_update(Entity_NPC& npc) { - if (npc.state == NPC_STATE_INIT) npc.state = NPC_STATE_IDLE; + if (npc.state == NPC_STATE_INIT) + { + npc.state = NPC_STATE_IDLE; + return; + } npc.friction *= EMBRYO_FRICTION; AnimationState& anim = npc.sprite.animState; diff --git a/src/npc_fly.cpp b/src/npc_fly.cpp index 88b70bf..9c84d60 100644 --- a/src/npc_fly.cpp +++ b/src/npc_fly.cpp @@ -685,9 +685,9 @@ constexpr float DART_FRICTION = 0.95f; constexpr float DART_CONTROLLED_CIRCLE = 6; constexpr float DART_CONTROLLED_SHARE = 1.2f; -// 005400d0 The dart fly's AI: Lord of the Flies turns it blue and Skatole tames it into a fly. It weaves along a -// circle while homing in on where its target is heading, at up to 8. A controlled one weaves less and follows its -// controller's walking input. +// 005400d0 The dart fly's AI: Lord of the Flies turns it blue and Skatole tames it into a fly, and either way the +// frame goes on. It weaves along a circle while homing in on where its target is heading, at up to 8. A controlled +// one weaves less and follows its controller's walking input. void npc_dart_fly_update(Entity_NPC& npc) { PlayerManager& players = g_game->playerManager; @@ -697,14 +697,12 @@ void npc_dart_fly_update(Entity_NPC& npc) g_game->scoreSheet.AddKilledEnemy(npc); npc.Remove(); beelzebub->AddBlueFlies(1, npc.pos, nullptr); - return; } if (players.FirstCollectibleOwner(COLLECTIBLE_SKATOLE, LAZARUS_SHARE_CHECK) && !npc.IsFriendly()) { npc.Morph(ENTITY_FLY, 0, 0, -1); npc.v2 = {}; npc.v1 = {}; - return; } if (npc.state == NPC_STATE_INIT) { @@ -712,7 +710,6 @@ void npc_dart_fly_update(Entity_NPC& npc) npc.state = NPC_STATE_MOVE; float turn = random_unit(); npc.v1.x = (turn + turn) * PI_F; - return; } if (npc.state == NPC_STATE_MOVE) diff --git a/src/npc_host.cpp b/src/npc_host.cpp index 49293bf..a940c6c 100644 --- a/src/npc_host.cpp +++ b/src/npc_host.cpp @@ -15,7 +15,6 @@ enum HostVariant : int HOST_SHELL_ALT, HOST_HARD }; -constexpr int HOST_UNSHELLED = 99; constexpr int ENTITY_FLOATING_HOST = 859; // A shelled Host shrugs off hits while closed: a hit holds it closed longer (up to 10 checks), and a big one bombs it. diff --git a/src/npc_mobile_host.cpp b/src/npc_mobile_host.cpp index e1e0776..c3cf32a 100644 --- a/src/npc_mobile_host.cpp +++ b/src/npc_mobile_host.cpp @@ -1,9 +1,6 @@ #include "boss_ai.h" #include "npc_depths.h" -// The Mobile Host (armored unless subtype 99) and the Flesh Mobile Host. -constexpr int MOBILE_HOST_UNARMORED = 99; - // Its shell: how hits shake it shut, the blast that knocks its skull loose, and the charge a controlled one builds. constexpr float MOBILE_HOST_SHAKE_LOSS = 0.05f; constexpr int MOBILE_HOST_SHAKE_MAX = 10; @@ -180,7 +177,7 @@ static void mobile_host_open(Entity_NPC& npc, bool isArmored) // nothing) and opens it to spit shots. The Flesh Mobile Host spits five and has no shell. void npc_mobile_host_update(Entity_NPC& npc) { - bool isArmored = npc.type == ENTITY_MOBILE_HOST && npc.subtype != MOBILE_HOST_UNARMORED; + bool isArmored = npc.type == ENTITY_MOBILE_HOST && npc.subtype != HOST_UNSHELLED; if (npc.state == NPC_STATE_INIT) { npc.state = NPC_STATE_MOVE; diff --git a/src/npc_whipper.cpp b/src/npc_whipper.cpp index ed7f8bf..861f68b 100644 --- a/src/npc_whipper.cpp +++ b/src/npc_whipper.cpp @@ -307,6 +307,7 @@ static void whip_update(Entity_NPC& npc) if (npc.variant == WHIPPER_FLAGELLANT) npc.secondaryHitList.clear(); return; } + debug_capsule_show(npc, whip); Room& room = *g_game->room; int column = (int)((whip.center.x - GRID_ORIGIN_X) / GRID_CELL_SIZE + 0.5f); diff --git a/src/persistent_game_data.h b/src/persistent_game_data.h index 1141a43..b73001e 100644 --- a/src/persistent_game_data.h +++ b/src/persistent_game_data.h @@ -16,6 +16,7 @@ constexpr int ACHIEVEMENT_IT_LIVES = 34; constexpr int ACHIEVEMENT_BONE_HEARTS = 391; constexpr int ACHIEVEMENT_ROTTEN_HEARTS = 411; constexpr int ACHIEVEMENT_PLANETARIUMS = 406; +constexpr int ACHIEVEMENT_FORGOTTEN_LULLABY = 408; constexpr int ACHIEVEMENT_THE_POLAROID = 57; constexpr int ACHIEVEMENT_THE_NEGATIVE = 78; constexpr int ACHIEVEMENT_THE_LOST = 82; @@ -44,6 +45,8 @@ constexpr int ACHIEVEMENT_STORE_UPGRADE_4 = 154; constexpr int ACHIEVEMENT_ITEM_INFO = 641; constexpr int ACHIEVEMENT_LIL_SPEWER = 384; constexpr int ACHIEVEMENT_SUPER_TINTED_ROCK = 323; +constexpr int ACHIEVEMENT_SPECIAL_HANGING_SHOPKEEPERS = 243; +constexpr int ACHIEVEMENT_SPECIAL_SHOPKEEPERS = 247; constexpr int BOSS_COUNT = 104; constexpr int CHALLENGE_COUNT = 46; constexpr int COLLECTIBLE_SEEN_COUNT = 733; diff --git a/src/procedural_item_manager.cpp b/src/procedural_item_manager.cpp index 84edd28..2852556 100644 --- a/src/procedural_item_manager.cpp +++ b/src/procedural_item_manager.cpp @@ -131,7 +131,6 @@ constexpr float CHANCE_ALWAYS = 1; constexpr float CHANCE_SPAWN_BASE = 0.1f; constexpr float TRIGGER_CHANCE = 0.05f; constexpr float KILL_TRIGGER_CHANCE = 0.2f; -constexpr int COLLECTIBLE_BERSERK_SCORE = 704; constexpr float BERSERK_SCORE = 6; constexpr float CONVERT_RADIUS = 1000; constexpr float CONVERT_SCORE_UNBOUNDED = 10000; @@ -461,7 +460,7 @@ void ProceduralEffect::roll_params(ProceduralCondition rolledCondition, Procedur ItemConfig_Item& active = *actives[index]; if (active.chargeType == CHARGE_TIMED) score = (float)active.quality; else if (active.chargeType == CHARGE_NORMAL) score = (float)active.maxCharges * HALF + 1; - if (active.id == COLLECTIBLE_BERSERK_SCORE) score += BERSERK_SCORE; + if (active.id == COLLECTIBLE_BERSERK) score += BERSERK_SCORE; target = (uint32_t)active.id; break; } diff --git a/src/room.cpp b/src/room.cpp index 5454327..bae5acf 100644 --- a/src/room.cpp +++ b/src/room.cpp @@ -254,9 +254,6 @@ constexpr int SHOP_LEVEL_MAX = 5; constexpr int CARD_READING_PORTALS = (int)PORTAL_ROOM_TYPES.size(); constexpr int CARD_READING_PORTAL_SPREAD = 2; -// The run state and floor state bits Init and Update read. -constexpr uint64_t GAME_STATE_SURPRISE_MINIBOSS_SEEN = 1ull << 29; - // Init's ambient decoration: how many spawn at most, and how the second door chance raises them. constexpr int AMBIENT_FLIES_MAX = 15; constexpr int AMBIENT_DUST_MAX = 10; @@ -464,7 +461,7 @@ void Room::Init(RoomConfig_Room& config, RoomDescriptor& roomDescriptor) isSurpriseMiniboss = descriptor->flags & ROOM_DESCRIPTOR_FLAG_SURPRISE_MINIBOSS; if (g_game->dailyChallenge.specialDailyId == SPECIAL_DAILY_DECEMBER_5 && isSurpriseMiniboss) - g_game->gameStateFlags |= GAME_STATE_SURPRISE_MINIBOSS_SEEN; + g_game->gameStateFlags |= 1ull << GAME_STATE_KRAMPUS_SPAWNED; isTriggerPressurePlates = false; update_bounds(true); init_shop_level(); @@ -2196,7 +2193,7 @@ float Room::GetDevilRoomChance() if (is_owned(COLLECTIBLE_GOAT_HEAD) || temporaryEffects.HasCollectibleEffect(COLLECTIBLE_GOAT_HEAD)) chance = DEAL_CHANCE_GOAT_HEAD; if (game.dailyChallenge.specialDailyId == SPECIAL_DAILY_DECEMBER_5 && - !(game.gameStateFlags & GAME_STATE_SURPRISE_MINIBOSS_SEEN)) + !(game.gameStateFlags & (1ull << GAME_STATE_KRAMPUS_SPAWNED))) chance = 1; if (is_owned(COLLECTIBLE_EUCHARIST)) chance = 1; uint32_t greedDealWave = GREED_DEAL_WAVE + (game.difficulty == DIFFICULTY_GREEDIER ? 1 : 0); diff --git a/src/room_clear.cpp b/src/room_clear.cpp index 580bd60..597bac6 100644 --- a/src/room_clear.cpp +++ b/src/room_clear.cpp @@ -31,27 +31,21 @@ #include #include -constexpr int COLLECTIBLE_LUCKY_FOOT_CLEAR = 46; constexpr int COLLECTIBLE_GUPPYS_TAIL = 134; constexpr int COLLECTIBLE_CONTRACT_FROM_BELOW = 241; -constexpr int COLLECTIBLE_DEEP_POCKETS_CLEAR = 416; constexpr int COLLECTIBLE_OPTIONS = 670; constexpr int COLLECTIBLE_LITTLE_CHAD = 96; constexpr int COLLECTIBLE_LITTLE_GISH = 99; constexpr int COLLECTIBLE_STEVEN = 50; -constexpr int TRINKET_AAA_BATTERY_CLEAR = 3; constexpr int TRINKET_ISAACS_FORK = 46; constexpr int TRINKET_DINGLE_BERRY = 163; constexpr int TRINKET_POLISHED_BONE = 167; constexpr int TRINKET_CRYSTAL_KEY = 170; constexpr int TRINKET_TEMPORARY_TATTOO = 177; -constexpr int NULLITEM_WAVY_CAP = 71; constexpr int FAMILIAR_BLUE_FLY_CLEAR = 43; constexpr int GRID_PATH_TRODDEN = 900; constexpr int BABY_SKIN_WISP = 64; constexpr int WISP_BABY_ODDS = 10; -constexpr int SOUND_VAMP_GULP_CLEAR = 157; -constexpr int SOUND_VAMP_DOUBLE_CLEAR = 614; constexpr int ACHIEVEMENT_LITTLE_CHAD = 25; constexpr int ACHIEVEMENT_LITTLE_GISH = 23; constexpr int ACHIEVEMENT_LITTLE_STEVEN = 24; @@ -353,14 +347,14 @@ static float award_roll_get(RNG& rng, AwardRoll roll) { PlayerManager& players = g_game->playerManager; float base = rng.RandomFloat(); - bool isLuckyFoot = players.FirstCollectibleOwner(COLLECTIBLE_LUCKY_FOOT_CLEAR, LAZARUS_SHARE_CHECK); + bool isLuckyFoot = players.FirstCollectibleOwner(COLLECTIBLE_LUCKY_FOOT, LAZARUS_SHARE_CHECK); if (isLuckyFoot) base = base * LUCKY_FOOT_SCALE + LUCKY_FOOT_FLOOR; float luck = award_luck_get(); float pick = rng.RandomFloat() * luck * AWARD_LUCK_SCALE + base; if (players.AnyoneHasTrinket(TRINKET_LUCKY_TOE)) { - bool isFootLuck = players.FirstCollectibleOwner(COLLECTIBLE_LUCKY_FOOT_CLEAR, LAZARUS_SHARE_CHECK) && luck > 0; + bool isFootLuck = players.FirstCollectibleOwner(COLLECTIBLE_LUCKY_FOOT, LAZARUS_SHARE_CHECK) && luck > 0; pick = isFootLuck ? pick * LUCKY_TOE_SCALE + LUCKY_TOE_FLOOR : pick * LUCKY_FOOT_SCALE + LUCKY_FOOT_FLOOR; } if (players.FirstCollectibleOwner(COLLECTIBLE_OPTIONS, LAZARUS_SHARE_CHECK) && pick < AWARD_OPTIONS_LOW) @@ -504,7 +498,7 @@ static void award_coins_apply(ClearAward& award) { PlayerManager& players = g_game->playerManager; bool isEmpty = award.variant == PICKUP_COIN || award.variant == PICKUP_NULL || award.count == 0; - if (isEmpty && players.FirstCollectibleOwner(COLLECTIBLE_DEEP_POCKETS_CLEAR, LAZARUS_SHARE_IGNORE)) + if (isEmpty && players.FirstCollectibleOwner(COLLECTIBLE_DEEP_POCKETS, LAZARUS_SHARE_IGNORE)) { award.variant = PICKUP_COIN; RNG pockets; @@ -1516,7 +1510,7 @@ static void active_clear_charge(Entity_Player& player, int slot) charge += player.GetTrinketMultiplier(TRINKET_WATCH_BATTERY); int maxCharge = player.GetActiveMaxCharge(slot); - int overcharge = std::min(player.GetTrinketMultiplier(TRINKET_AAA_BATTERY_CLEAR), AAA_BATTERY_MAX); + int overcharge = std::min(player.GetTrinketMultiplier(TRINKET_AAA_BATTERY), AAA_BATTERY_MAX); if (overcharge < 1 || active.charge + charge < maxCharge - overcharge) { player.AddActiveCharge(charge, slot, false, false, false); @@ -1535,7 +1529,7 @@ static void isaacs_fork_heal(Entity_Player& player) if (Random() % (uint32_t)odds != 0) return; player.AddHearts(player.GetTrinketMultiplier(TRINKET_ISAACS_FORK), false, false); - sound_play(player.playerType == PLAYER_MAGDALENE_B ? SOUND_VAMP_DOUBLE_CLEAR : SOUND_VAMP_GULP_CLEAR); + sound_play(player.playerType == PLAYER_MAGDALENE_B ? SOUND_VAMP_DOUBLE : SOUND_VAMP_GULP); clear_heart_spawn(player, 0); } @@ -1719,7 +1713,7 @@ void Entity_Player::TriggerRoomClear() try_end_astral_projection(); lost_curse_renew(*this); if (HasCollectible(COLLECTIBLE_SWARM)) AddSwarmFlyOrbital(pos); - temporaryEffects.RemoveNullEffect(NULLITEM_WAVY_CAP, 1); + temporaryEffects.RemoveNullEffect(NULLITEM_WAVY_CAP_1, 1); if (HasCollectible(COLLECTIBLE_AZAZELS_RAGE)) azazels_rage_charge(*this); if (HasTrinket(TRINKET_DINGLE_BERRY)) dingle_berry_dips_throw(*this); diff --git a/src/room_special.cpp b/src/room_special.cpp index 74a2cc8..be248e8 100644 --- a/src/room_special.cpp +++ b/src/room_special.cpp @@ -828,8 +828,6 @@ void npc_shopkeeper_update(Entity_NPC& npc) constexpr int SOUND_MIRROR_BREAK = 610; constexpr int FAMILIAR_KNIFE_FULL = 223; -constexpr int TRINKET_PAPER_CLIP_ID = 19; -constexpr int TRINKET_STORE_KEY_ID = 83; constexpr int EVENT_DOORS_BOMBED = 199; constexpr int MIRROR_LUCK_PENALTY = -7; constexpr int PHOTO_HOLDER_CHECKS = 3; @@ -1148,11 +1146,11 @@ static bool door_lock_pay(GridEntity_Door& door, Entity_Player& player) { bool isCoinLock = door.doorFlags & DOOR_FLAG_COIN_LOCK; if (isCoinLock && player.numCoins > 0) return true; - if (!isCoinLock && door.targetRoomType == ROOM_SHOP && player.HasTrinket(TRINKET_STORE_KEY_ID)) return true; + if (!isCoinLock && door.targetRoomType == ROOM_SHOP && player.HasTrinket(TRINKET_STORE_KEY)) return true; if (door.targetRoomType == ROOM_BOSS && door.targetRoomIdx >= 0 && g_game->stage == STAGE_BLUE_WOMB) return true; if (isCoinLock) return false; bool isKeyLock = door.variant == DOOR_LOCKED || door.variant == DOOR_LOCKED_DOUBLE; - if (isKeyLock && player.GetTrinketMultiplier(TRINKET_PAPER_CLIP_ID) > 2) return true; + if (isKeyLock && player.GetTrinketMultiplier(TRINKET_PAPER_CLIP) > 2) return true; return player.TryUseKey(); } diff --git a/src/room_transition.cpp b/src/room_transition.cpp index a34908a..ebe3022 100644 --- a/src/room_transition.cpp +++ b/src/room_transition.cpp @@ -45,7 +45,6 @@ constexpr int SOUND_TELEPORT_LAND = 214; constexpr int ITEM_STATE_HELD = 604; constexpr int MINECART_RIDDEN = 10; constexpr int NPC_STATE_MINECART_MOVING = 4; -constexpr int COLLECTIBLE_GLOWING_HOURGLASS = 422; constexpr const char* ANIMATION_APPEAR = "Appear"; constexpr float APPEAR_FRAME = 2; constexpr const char* ANIMATION_JUMP = "Jump"; @@ -541,7 +540,7 @@ void RoomTransition::arrival_update() if (!(teleported->flags & FLAG_HELD)) teleported->isVisible = true; } if (animation == TRANSITION_GLOWING_HOURGLASS && player) - player->AnimateCollectible(COLLECTIBLE_GLOWING_HOURGLASS, ANIMATION_PICKUP, ANIMATION_PICKUP_SPARKLE); + player->AnimateCollectible(COLLECTIBLE_GLOWING_HOUR_GLASS, ANIMATION_PICKUP, ANIMATION_PICKUP_SPARKLE); else if (animation == TRANSITION_D7 && player) player->AnimateCollectible(COLLECTIBLE_D7, ANIMATION_PICKUP, ANIMATION_PICKUP_SPARKLE); return; diff --git a/src/sfx_manager.h b/src/sfx_manager.h index 1e5c006..c02d089 100644 --- a/src/sfx_manager.h +++ b/src/sfx_manager.h @@ -277,6 +277,8 @@ enum SoundId : int SOUND_BULLET_SHOT = 482, SOUND_FLAME_BURST = 483, SOUND_INFLATE = 484, + SOUND_FART_MEGA = 489, + SOUND_MATCHSTICK = 490, SOUND_BULB_FLASH = 492, SOUND_BATTERYDISCHARGE = 493, SOUND_FREEZE = 496, @@ -596,6 +598,7 @@ enum SoundId : int SOUND_GLOWING_HOURGLASS_ACTIVATE = 861, SOUND_GLOWING_HOURGLASS_FIZZLE = 862, SOUND_DECAP_ACTIVATE = 1046, + SOUND_ESAUJR = 1048, SOUND_PORTAL_ENTITY_LOOP = 846, SOUND_PORTAL_ENTITY_ENTER = 847, SOUND_MEGABEAN_BLAST = 869, @@ -649,6 +652,8 @@ enum SoundId : int SOUND_BUMBINO_RAM = 724, SOUND_BUMBINO_SLAM = 725, SOUND_BUMBINO_SNAP_OUT = 726, + SOUND_SIREN_SCREAM = 727, + SOUND_SIREN_SING = 728, SOUND_BEAST_LAVA_BALL_SPLASH = 703, SOUND_BEAST_LAVA_RISE = 704, SOUND_BEAST_SUCTION_LOOP = 705, @@ -714,6 +719,10 @@ enum SoundId : int SOUND_BEAST_BACKGROUND_DIVE = 699, SOUND_BEAST_INTRO_SCREAM = 708, SOUND_DEATH_SKULL_SUMMON_LOOP = 729, + SOUND_SIREN_LUNGE = 810, + SOUND_SIREN_MINION_SMOKE = 811, + SOUND_SIREN_SCREAM_ATTACK = 812, + SOUND_SIREN_SING_STAB = 813, SOUND_DEATH_SKULL_SUMMON_END = 730, SOUND_FAMINE_GRUNT = 817, SOUND_SAFETY_SCISSORS = 900, diff --git a/src/weapon.cpp b/src/weapon.cpp index 2b4b9f3..50019d6 100644 --- a/src/weapon.cpp +++ b/src/weapon.cpp @@ -133,7 +133,6 @@ constexpr int MAX_SHOTS_PER_FRAME = 8; constexpr int NUMBER_ONE_BLINK = 16; constexpr int COLLECTIBLE_EYE_DROPS = 600; -constexpr int COLLECTIBLE_KIDNEY_STONE_WEAPON = 440; constexpr int COLLECTIBLE_TECHNOLOGY_2 = 152; // Technology 2: its laser's damage share, blink, depth (behind the player when aimed up or left), and the odds of // Mom's Eye's and Loki's Horns' extra lasers, better with luck. @@ -1454,7 +1453,7 @@ void Weapon_Tears::Fire(const Vector& shootDirection, bool isShooting, bool isIn eyeSide = 0; if (shooter->HasCollectible(COLLECTIBLE_NUMBER_ONE) || shooter->temporaryEffects.HasCollectibleEffect(COLLECTIBLE_NUMBER_ONE) || - shooter->HasCollectible(COLLECTIBLE_KIDNEY_STONE_WEAPON)) + shooter->HasCollectible(COLLECTIBLE_KIDNEY_STONE)) { eyeSide = 0; shooter->blinkTime = std::max(shooter->blinkTime, NUMBER_ONE_BLINK); diff --git a/src/weapon_lasers.cpp b/src/weapon_lasers.cpp index 9bdd967..ed76c7b 100644 --- a/src/weapon_lasers.cpp +++ b/src/weapon_lasers.cpp @@ -1081,8 +1081,8 @@ BrimstoneAim Weapon_Brimstone::aim_get(bool isShooting) // 009ff360 Charges and fires Brimstone: while shooting the head charges, on release (or once a fixed aim or Marked's // charge is enough) the beams fire. A rapid fire keeps one beam going and sweeps it, Ludovico steers a ring beam. -// Hemoptysis sneezes when a shot starts. C Section's fetuses are not reconstructed yet, and with it the body faces -// the beam. +// Hemoptysis sneezes when a shot starts. With C Section the beams throw fetuses (fire_c_section_fetuses) and the +// body faces the beam. void Weapon_Brimstone::Fire(const Vector& shootDirection, bool isShooting, bool isInterpolated) { Weapon::Fire(shootDirection, isShooting, isInterpolated); @@ -1337,7 +1337,9 @@ bool Weapon_Brimstone::fire_hitscan(const Vector& direction, float damageScale) Vector tip = vector_add(vector_add(hit.ownerPosition, offset), vector_scale(direction, scale * SNEEZE_REACH + SNEEZE_REACH_BASE)); Capsule beam(tip, vector_make(SNEEZE_WIDTH, 1), vector_angle(direction), scale * SNEEZE_SIZE); float reach = beam.halfLength + beam.radius; - // The debug mode's hit shape for the burst is drawn once DebugRenderer is taken over. + // The original reads the owner's index without a null check, a burst without one draws no debug shape here. + if ((g_game->debugFlags & DEBUG_HITSPHERES) && beam.radius > 0 && owner) + g_game->debugRenderer.Get((int)owner->index, true).Capsula(beam); Room& room = *g_game->room; int center = room.GetGridIndex(beam.center);