From e31637ca19730e77499ed40c302694bdf24592cf Mon Sep 17 00:00:00 2001 From: shweet Date: Sun, 25 Oct 2026 22:43:19 -0400 Subject: [PATCH] notes: Greed/Greedier fidelity pass (rooms/greed stage ids, generate_greed map and antechamber trigger, SpawnGreedModeWave tables, button, devil door, rewards, donation machine unlocks); greed wave fields --- db/fields.tsv | 3 ++ notes/README.md | 1 + notes/systems/greed.md | 113 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 117 insertions(+) create mode 100644 notes/systems/greed.md diff --git a/db/fields.tsv b/db/fields.tsv index 62ec4d8..5b2de38 100644 --- a/db/fields.tsv +++ b/db/fields.tsv @@ -1589,3 +1589,6 @@ BackwardsStageDesc 0x318 uint32_t _stageType Game::SaveBackwardsStage 00708050 s BackwardsStageDesc 0x31c bool _isXL Game::SaveBackwardsStage 00708050 sets byte desc+0x31c = (_bossRoomsCount > 1); stride 800 (get_backwards_stage 00738340) Entity_Projectile 0x448 int _wiggleFrameOffset Entity_Projectile::Update 006595f3 / 006596a9 add it to the +0x3a4 update time for the WIGGLE and MEGA_WIGGLE phase (ProjectileParams +0x7c WiggleFrameOffset; the red Mega Maw adds 2 a ring) Entity_Projectile 0x438 uint64_t _projectileFlags Entity_Projectile::Update tests its bits (0x200000 SINE_VELOCITY 00659527, 0x400000 MEGA_WIGGLE 0065966c, 0x800000 SAWTOOTH_WIGGLE 0065976e, 0x40000/0x80000 CURVE_LEFT/RIGHT 00658ea2); FireProjectiles ORs ProjectileParams.BulletFlags in +Game 0x18338 uint32_t _greedWaveSeeds[12] Level::generate_greed (00743550) stores 12 generation-RNG draws here after placing the rooms; Room::SpawnGreedModeWave (00816910) seeds the wave's GetRandomRoom from roomMap[wave+0x216] (the same dwords) +Game 0x18368 int _greedLastBeatenWave Room::TriggerClear (008068f0) and Room::UpdateGreedWave (00801ee0, no enemies and timer > 19) set it to _greedModeWave; Entity_Player::room_enter (007a6c50) rolls _greedModeWave back to it; Level::Init zeroes it +Game 0x1836c int _greedLastPaidWave Room::SpawnGreedModeWave (00816e57): coins, trigger_room_clear and locusts only when the new wave index is above it, then stores it; Level::Init zeroes it diff --git a/notes/README.md b/notes/README.md index a8d4b14..a832401 100644 --- a/notes/README.md +++ b/notes/README.md @@ -7,6 +7,7 @@ stored here: `./decompile.sh 0xADDR` prints it from the dump, with the current n |---|---| | `entities/` | per-entity findings from the monster-fidelity passes (state machines, timings, speeds, what the port changed or skipped) | | `entities/boss_fidelity_*.md` | boss fidelity pass: Rebirth bosses whose port cited no decompile, re-read against their NpcAI routine by boss room count (The Cage, Dingle/Dangle, ...), what changed and what is still not expressible | +| `systems/greed.md` | Greed/Greedier as the exe runs them: rooms/greed stage ids and floor forms, Level::generate_greed's map and the Ultra Greed antechamber trigger, SpawnGreedModeWave's tables (difficulty, timers, coins, music, paid-once charge), the button, devil door, rewards, the Greed Donation Machine's unlocks and jam | | `systems/greed_mode.md` | Greed waves' coins and music, Ultra Greed/coins/doors states, donation machine spawn, Greed doors/button, Mega Satan door | | `systems/alt_path.md` | Repentance's path: secret exit kinds and doors, Level::SetNextStage's routing, the mirror world and mineshaft dimensions, quest doors, the white fire's Lost Curse, minecarts | | `entities/rotgut.md` | Rotgut's maggot (911.1) attacks, its crawl space rooms and what the side view needs | diff --git a/notes/systems/greed.md b/notes/systems/greed.md new file mode 100644 index 0000000..2819958 --- /dev/null +++ b/notes/systems/greed.md @@ -0,0 +1,113 @@ +# Greed and Greedier mode (fidelity pass 2026-10-25, isaac-classic rif/greed-polish) + +Earlier findings (Ultra Greed's states, coins, doors, the button's flag 11, the Greed doors) are in +[greed_mode.md](greed_mode.md). This file is the whole mode as the exe runs it. Greed is `Game::_difficulty` 2, +Greedier 3; `Game::IsGreedMode` 0x6f8120. + +## Floors and stage ids (Level::SetNextStage 0x7467c0, RoomConfig::GetStageID 0x82d030) + +- Greed floors are level stages 1..7 (Basement, Caves, Depths, Womb, Sheol, The Shop, Ultra Greed); stage 6 and 7 go + to 7 (0x7467c0's "Wrong Stage (Greed Mode)" switch). There is no XL, no Repentance path (types 4/5). +- Stage type for stages 1..4 is rolled from `Seeds::GetStageSeed(stage)` exactly like a normal run: even -> type 1 + (Cellar/Catacombs/Necropolis/Utero, behind achievements 0x56..0x58, Utero free), seed % 3 == 0 -> type 2 (Burning + Basement/Flooded Caves/Dank Depths/Scarred Womb, achievements 0x156..0x159; seed effect 0x4f forces Flooded on 3/4). + So each form is a third. Stages 5+ are type 0. +- GetStageID in Greed (or mode 1): 7 -> 25, 6 -> 24, 5 -> 14, else `stage * 3 - 2 + type` (types 4/5: 2*stage+25/26). + RoomConfig::LoadStagesXml 0x82b2f0 reads those stage ids from `greedroot` = `rooms/greed/` (stages.xml). The old + 18-25 "Greed" .stb files of rooms/ are never asked for. rooms/greed/0N..stb holds per stage: ~10 type 1 + rooms (the start rooms, tall 1x2), 120-250 type 11 challenge rooms (the normal waves, tall, difficulty 1/5/10, a few + 0) and type 5 boss rooms (the boss waves, subtype = boss id). rooms/greed/00.special rooms.stb is Greed's special set + (shops wide, treasure subtypes 0-3, curse, super secret, devil/angel, greed exit 23, blue 28). + +## Layout (Level::generate_greed 0x743550) + +LevelGenerator coordinates (x, y), start room at (6,6): +- stage < 7: start (6,6) shape 4 (tall) = GetRandomRoom(stage, type 1, shape 4, difficulty 1-10); shop (5,5) shape 6 + (wide) from stage 0 (special); treasure rooms (7,7) and (7,6) shape 1 only if stage != 6, via + GetRandomRoomWithFallbackStage(stage, type 4, subtype 0/1/2/3 by More Options-style trinkets 0x52/0x70 rolls); + curse (5,6); greed exit (6,8) type 0x17; super secret on a dead end (try_add_dead_end). `_greedModeTreasureRoomIdx` + (Game+0x18370) = 0x55 = grid 85 = (7,6): that treasure room has the plain door and its pool; the other is the boss + pool (ItemPool::get_pool_from_room_entities 0x7ebe20: room type 4 -> 5 when its index != 0x55) behind the silver + door (GridEntity_Door::LoadSprite 0x70d3f0). `_lastBossRoomListIndex` = the start room (devil door host). + Then 12 wave seeds are stored at Game+0x18338 (one per wave, so a wave called again draws the same room). +- stage 7: start (6,6) 1x1 = GetRoomByStageTypeAndVariant(25, type 1, variant 0); antechamber (6,5) 1x1 = + GetRandomRoom(25, type 5, variants 0-999, difficulty 1-10); Ultra Greed's room (6,3) shape 4 = variant 1000. + +## The antechamber trigger (Room::UpdateGreedWave 0x801ee0) + +In stage 7, in a type 5 room, once per level (levelStateFlags 0x1000, STATE_GREED_MONSTRO_SPAWNED): the first player +with y < 320 starts `Music::Play(9)` (Boss), clears the room's alt-boss-music flag (desc+0x44 & 0x40), spawns Monstro +(type 0x14) at that player when the room's config variant is 0 (the empty one), calls `TriggerOutput(0)` (releases +the 1000.120 Spawners of output group 0: the 969.0 markers beside the Greeds/Super Greeds/Keepers) and plays sound +190 (castleportcullis). Ultra Greed's own room plays music 28 (Room::PlayMusic 0x7eb1b0, boss id 0x3e); on its death +Room::SpawnClearAward crossfades 37 (The Calm), spawns the big chest 5.340 and the Greed Donation Machine. + +## Waves (Room::SpawnGreedModeWave 0x816910; the decompile stops at a KAGE_LogMessage, read the rest with --asm) + +`wave` = Game::_greedModeWave (0x18334) before the call; new = wave+1; boss threshold B = 9 (Greedier 10). +- Room difficulty: Greed waves 0-2,8 -> 1; 3-5,9 -> 5; 6,7,10 -> 10. Greedier 0-2,9 -> 1; 3-5,10 -> 5; 6-8,11 -> 10. +- Room: GetRandomRoom(stageID, new < B ? type 11 : type 5, the start room's shape, any variant, exact difficulty, + subtype any) seeded from the wave's level seed. +- Timer (Room+0x723c, ticks): normal waves `(base + wave) * 30`; Greed base 8 (stage 3: 7, stage 4: 6), minus 1 with + achievement 0xf6 (Everything Is Terrible 2!!!); Greedier base 9/7/5/4/3 by stage 1/2/3/4/5+. Boss waves + `((wave - 6) * k + c) * 30`: Greed k 3, c 28 (25 with 0xf6); Greedier k 0, c 15. Untimed (-1): Greed new 8, 10, 11+; + Greedier new 9, 11, 12+. +- Coins: normal 2 (Greedier 1), boss 4 (3); Greedier wave 9 +1, 11 +3; the last wave (B+2) 0. If the base is not 0 and + levelStateFlags & 0x800 (STATE_GREED_LOST_PENALTY, set by the button) -1 and the flag clears. Then +1 when + `_greedWavesClearedWithoutRedHeartDamage` (0x18374) > 0 and divisible by 3; it is incremented here, zeroed by + Level::SetRedHeartDamage 0x74b5b0 (from Entity_Player::TakeDamage's red heart loss) and Level::Init. +- Music: normal waves EnableLayer(0) (the floor track's layer), but stage id 24 (The Shop) Crossfade 0x26 (Challenge + Room fight); the last wave Crossfade 0x17 (Satan); boss waves 0x29 on stage types 4/5, else 9 or 0x1a with the + alt-boss-music flag. Sound 871 (summonpenta_wave) every wave. +- Paid once: only when new > Game+0x1836c (last paid): `PlayerManager::trigger_room_clear` 0x9bb840 (actives' charge, + familiars), the pennies (5.20.1, AppearFast, coin particles 95) at FindFreePickupSpawnPosition of grid + (width/2, 4) = (320, 280), `Entity_Player::spawn_locusts` per player, then 0x1836c = new. +- Room::TriggerClear 0x8068f0 skips trigger_room_clear for room type 1 in Greed (the charge is the wave's), sets + Game+0x18368 (last beaten wave) = wave, revives co-op ghosts after the last wave / Ultra Greed. +- Room::UpdateGreedWave: timer counts down; with no enemies alive and timer > 19 it sets 0x18368 = wave and + timer = 19; at 0 the next wave spawns. +- Entity_Player::room_enter 0x7a6c50: if 0x18368 < wave, wave = 0x18368 (a continued run calls the unbeaten wave + again; 0x1836c keeps it from paying twice). Level::Init zeroes 0x18334/0x18368/0x1836c. + +## Button (GridEntity_PressurePlate::update_greed_button 0x9839f0) + +Pressed within 25 px (released past 30 px, all players). Pressed while the timer runs: health type 2 (Lost) or +HasInstantDeathCurse -> flag 0x800, else TakeDamage(1.0 = half a heart, flags 0x10000080). When its animation ends: +timer < 1 -> SpawnGreedModeWave + Taurus speed reset; else timer = -1 (the next wave waits). It rises again (state 0) +when players are away and the timer runs or the room is clear, never after the last wave; up with no timer in an +uncleared room it shows off (state 2). Looks: update_greed_button_anim 0x9837b0 (Skull = Game::IsGreedBoss 0x983970: +wave+1 >= B; Pentagram = IsGreedFinalBoss 0x9839b0: wave+1 >= B+2). + +## Doors and rewards + +- Exit door (target type 0x17) stays locked (variant 6) while wave < 10 (Greedier 11) (door setup beside GridEntity_Door::Open 0x710dd0). +- Room::GetDevilRoomChance 0x7f92b0: Greed 0 until wave >= 11 (Greedier 12), then 1.0, so the devil or + angel door always comes once the last wave is beaten; Level::CanSpawnDevilRoom 0x749830 waives its stage limits in + Greed. +- Room::SpawnClearAward 0x7fb250: Greed pays no room award at all; only the start room's and Ultra Greed's branches + run. Room::TriggerBossDeath 0x7fec00: no boss drops in Greed's start room (local flag for room type 1). +- Entity_Slot::Init 0x65d200: in Greed a Blood Donation Machine (6.2) becomes 6.5. +- Room::Init 0x7f2800: Greed shop level = stage (stage 6: 5 in the start room, else 1); the start room scatters + (seed % 5) + 3 decorations around grid (width/2, 4). + +## Greed Donation Machine (Entity_Slot::Update case 0xb, 0x65d950) + +On "CoinInsert": the player type's event counter +1 (the per-character count) and event counter 0x73 (all +characters; its value % 1000 + 1 is the three-digit display). Unlocks by that total: >1 0xf2 Lucky Pennies, >13 0xf3, +>32 0xf4, >67 0xf5, >110 0xf6 Everything Is Terrible 2!!!, >233 0xf7, >438 0xf8, >499 0x155 Greedier, >665 0xf9, >878 +0xfa, 999 0x113 (+ effect 1000.104 at -80), >=1000 0xfb and the machine breaks into pennies. Jam chance +(Entity_Player::GetGreedDonationJamChance 0x7cbb90, per-character count n): `floor(0.2 * min(e^(0.023 n) - 1, 100) + .5)` +percent, capped at 1 in Greedier, 99.9 for player types > 0x28; rolled with RandomFloat*100 after each coin. + +## Keeper / Tainted Keeper + +No Greed-only branch for them besides the shared rules: T.Keeper's enemy coins (Entity_Pickup::Update 0x6bbdc0, +RoomDescriptor+0x52 TKeeperCoinSpawns: 1/(n+1), at most 10 a room, for enemies with no spawn grid index or in a +revisited room) apply to the start room's waves too. + +## Port (isaac-classic) + +stages.json greed (floors with stage lists, rooms map incl. the antechamber, waves with challenge kind, coins, sounds, +pool for the second treasure room), room_sets rooms[]/trigger, music.json layer/waves and stage keys, effects' +chance/whole for the jam. Not ported: Greed's item pools (the Rebirth version uses the base game's pools), the +achievements (0xf6's faster timers included), the per-wave seed, shop levels, the 6.2 -> 6.5 swap.