Curation round 20: player update, costumes and render, Missing No., the last actives and cards, familiars, Pin, the Frail, Wormwood and the Heretic, Dross to Gehenna, effects and the devil room purchase, champion colours, the quit path, save fields, shared vector helpers

This commit is contained in:
shweet committed 2026-11-22 00:33:35 -05:00
1 parent ee863e70e6
commit 8dbeb1bc4a
168 files changed
+15682 -2399

No files matched your search

+99 -9
View File
@@ -6,6 +6,10 @@
#include "entity_laser.h"
#include "entity_npc.h"
#include "entity_slot.h"
#include "active_items.h"
#include "hud.h"
#include "pocket_items.h"
#include "sfx_manager.h"
#include "game.h"
#include "log.h"
#include "lua_engine.h"
@@ -49,6 +53,10 @@ constexpr uint32_t PRE_LEVEL_RNG_SHIFT = 2;
constexpr uint32_t FLOOR_RNG_SHIFT = 12;
constexpr uint32_t JACOBS_CURSE_RNG_SHIFT = 66;
constexpr int JACOBS_CURSE_STEPS = 20;
constexpr int REDEMPTION_LIGHT_FADE = 2;
constexpr int NECROMANCER_OVERLAY_DELAY = 3;
// The step from a door slot (left, up, right, down) into the room.
constexpr float ASCENT_DOOR_STEPS[][2] = {{40, 0}, {0, 40}, {-40, 0}, {0, -40}};
constexpr int JACOBS_CURSE_STEP_FRAMES = 30;
constexpr int JACOBS_CURSE_MIN_FRAMES = 610;
@@ -907,6 +915,7 @@ void Entity_Player::level_start(bool isForced)
if (!isPostLevelInitFinished) return;
spawn_low_health_blood_splat();
ventricleRazorPortal = 0;
if (variant == PLAYER_VARIANT_COOP_BABY)
{
if (isGlitchBaby) reconstruction_missing("Entity_Player::level_start 007a4ba0 (the glitched co-op baby)");
@@ -936,14 +945,42 @@ void Entity_Player::start_position_set()
uint32_t curses =
(Seeds::GetForcedCurses() | game.debugCurses | game.curses) & ~Seeds::GetPreventedCurses();
int stage = (int)game.stage + (curses & CURSE_OF_LABYRINTH ? 1 : 0);
if (game.IsAscent() && !(stage == ASCENT_HOME_STAGE && game.IsAltPath()))
reconstruction_missing("Entity_Player::level_start 007a4ba0 (the Ascent's door start)");
if (game.IsAscent() && !(stage == ASCENT_HOME_STAGE && game.IsAltPath())) ascent_start_set();
return;
}
}
pos = PlayerManager::get_player_start_position(this, vector_make(START_SPOT_X, startY));
}
// The Ascent starts the player a cell inside a door: the room's first, or from a random slot the next one its shape
// allows. A trapdoor reachable from there takes the start instead.
void Entity_Player::ascent_start_set()
{
Room& room = *g_game->room;
auto door = std::ranges::find_if(room.doors, [](GridEntity_Door* slot) { return slot != nullptr; });
int slot = (int)(door - room.doors.begin());
if (door == room.doors.end())
{
slot = (int)(Random() & (DOOR_SLOT_COUNT - 1));
uint32_t allowed = room.descriptor->data->doors;
for (int tries = 0; tries < DOOR_SLOT_COUNT && !(allowed & (1u << slot)); tries++)
slot = (slot + 1) % DOOR_SLOT_COUNT;
}
Vector start = room.GetGridPosition(room.doorGridPositions[slot]);
start = vector_make(start.x + ASCENT_DOOR_STEPS[slot % 4][0], start.y + ASCENT_DOOR_STEPS[slot % 4][1]);
pos = start;
for (int cell = 0; cell < room.gridHeight * room.gridWidth && cell < ROOM_GRID_CELLS; cell++)
{
GridEntity* grid = room.gridEntities[cell];
if (!grid || grid->type != GRID_TRAPDOOR) continue;
Vector trapdoor = room.GetGridPosition(grid->gridIndex);
if (!pathfinder_can_reach_pos(&trapdoor, &start, &room)) continue;
pos = trapdoor;
return;
}
}
// Ends the floor-long effects and restores what each floor gives back: Holy Mantle from Wooden Cross, the floor's
// health, map and compass effects, items that recharge, pickups some trinkets spawn, the Backasswards penalty and the
// per-floor generators, then evaluates. A forced start also restarts the player's familiars.
@@ -974,9 +1011,14 @@ void Entity_Player::level_items_apply(bool isForced)
player->AddMaxHearts(2, false);
game.itemOverlay.Show(GIANTBOOK_EMPTY_HEART, 0, nullptr);
}
if (TemporaryEffect* redemption = temporaryEffects.GetCollectibleEffect(COLLECTIBLE_REDEMPTION))
if (redemption->count > 0)
reconstruction_missing("Entity_Player::level_start 007a4ba0 (Redemption's blessing)");
if (TemporaryEffect* redemption = temporaryEffects.GetCollectibleEffect(COLLECTIBLE_REDEMPTION);
redemption && redemption->count > 0)
{
if (Entity* light = redemptionEffect; light && light->type == ENTITY_EFFECT && redemption->count == 1)
static_cast<Entity_Effect*>(light)->state = REDEMPTION_LIGHT_FADE;
if (ItemConfig_Item* item = items.GetCollectible(COLLECTIBLE_REDEMPTION))
temporaryEffects.RemoveEffect(item, -1);
}
forgottenBodyRoomIdx = FORGOTTEN_BODY_ROOM_NONE;
for (int i = HasTrinket(TRINKET_LUCKY_SACK) ? GetTrinketMultiplier(TRINKET_LUCKY_SACK) : 0; i > 0; i--)
{
@@ -1003,8 +1045,7 @@ void Entity_Player::level_items_apply(bool isForced)
floor_maps_apply();
floor_items_recharge();
if (HasTrinket(TRINKET_HOLLOW_HEART)) AddBoneHearts(GetTrinketMultiplier(TRINKET_HOLLOW_HEART));
if (HasCollectible(COLLECTIBLE_MISSING_NO))
reconstruction_missing("Entity_Player::level_start 007a4ba0 (Missing No.)");
if (HasCollectible(COLLECTIBLE_MISSING_NO)) missing_no_reroll();
if (HasCollectible(COLLECTIBLE_ZODIAC))
{
if (!HasCollectible(COLLECTIBLE_TAURUS) && !temporaryEffects.HasCollectibleEffect(COLLECTIBLE_TAURUS))
@@ -1096,12 +1137,59 @@ void Entity_Player::floor_items_recharge()
}
else if (active.item == COLLECTIBLE_ERASER) AddActiveCharge(1, slot, false, false, true);
}
if (!hasCurseMistEffect && !isCoopGhost && playerForms[PLAYER_FORM_NECROMANCER] > 2)
reconstruction_missing("Entity_Player::level_start 007a4ba0 (the Necronomicon transformation)");
if (!hasCurseMistEffect && !isCoopGhost && playerForms[PLAYER_FORM_NECROMANCER] > 2) necromancer_recharge();
for (int i = HasTrinket(TRINKET_BETHS_FAITH) ? GetTrinketMultiplier(TRINKET_BETHS_FAITH) * 4 : 0; i > 0; i--)
AddWisp(COLLECTIBLE_BOOK_OF_VIRTUES, pos, false, false);
}
// Missing No. rerolls the player's items for the new floor with the D4 (no animation, from no slot), and the player
// glitches into it.
void Entity_Player::missing_no_reroll()
{
UseActiveItem({.item = COLLECTIBLE_D4, .flags = USE_NOANIM, .slot = ACTIVE_SLOT_NONE});
isPlayingItemAnimation = false;
bodySprite.Reset();
sprite.playbackSpeed = 1;
sprite.overlayAnimState.SetAnimationData(nullptr);
if (sprite.SetAnimation("Glitch", SWITCH_KEEP_FRAME))
{
sprite.animState.Rewind();
sprite.animState.isPlaying = true;
}
isPlayingExtraAnimation = true;
isPlayingItemAnimation = false;
}
// The Necromancer transformation recharges the first Necronomicon a slot holds with its form's charge (none in the
// pocket's book slot), the others losing theirs, with the giant book and its sound. Without one marked the main active
// becomes the transformation's book, fully charged.
void Entity_Player::necromancer_recharge()
{
Game& game = *g_game;
bool isRecharged = false;
for (int slot = 0; slot < ACTIVE_SLOT_COUNT; slot++)
{
ActiveItemDesc& active = activeItems[slot];
if (active.item != COLLECTIBLE_NECRONOMICON) continue;
if (isRecharged) active.varData = 0;
else if (active.varData == 1)
{
int charge = slot == POCKET_ACTIVE_SLOT + 1 ? 0 : GetCollectibleMaxCharge(COLLECTIBLE_NECRONOMICON, 1);
AddActiveCharge(charge, slot, false, false, true);
game.itemOverlay.Show(GIANTBOOK_NECROMANCER, NECROMANCER_OVERLAY_DELAY, nullptr);
sound_fart_play(SOUND_NECROMANCER);
isRecharged = true;
}
game.hud.InvalidateActiveItem(this, slot);
}
if (isRecharged) return;
activeItems[ACTIVE_SLOT_PRIMARY].varData = 1;
AddActiveCharge(GetCollectibleMaxCharge(activeItems[ACTIVE_SLOT_PRIMARY].item, 1), ACTIVE_SLOT_PRIMARY, false,
false, true);
game.itemOverlay.Show(GIANTBOOK_NECROMANCER, NECROMANCER_OVERLAY_DELAY, nullptr);
}
// Stem Cell heals half the missing red hearts, all of them at two, and all of them with two heart drops at three.
void Entity_Player::stem_cell_heal()
{
@@ -1435,6 +1523,8 @@ void Entity_Player::release_weapons_and_effects(bool isRemoveEntities)
link_release(azazelsRageLaser, isRemoveEntities);
link_release(breathOfLifeEffect, isRemoveEntities);
link_release(trinityShield, isRemoveEntities);
link_release(deadToothRing, isRemoveEntities);
link_release(redemptionEffect, isRemoveEntities);
link_release(bestFriend, isRemoveEntities);
link_release(megaBlastLaser, isRemoveEntities);
link_release(markedTarget, isRemoveEntities);