Commit Graph

63 Commits

Author SHA1 Message Date
Youpeoples
69f931d646
Mass naming: Ball/PinballGame Unk variables, function names (#210)
Some checks failed
CI / build (push) Has been cancelled
* sha1 compliant

fingers crossed

* oops. You need these too.

missing files.

* renames

* renames 2

* renames 4

* more renames

347 replacements, 31 files. SHA1 verified.

## Ramp Prize (was "rubyPondBumper")

- `rubyPondBumperHitFlag` -> `rampPrizeType` -- controls Nuzleaf ramp prize (0=none, 1=1UP, 2-100=powerUp). Not pond-related at all, it's the prize platform at the top of the Ruby ramp.
- `rubyPondBumperTimer` -> `rampPrizeRespawnTimer` -- 600-frame cooldown before ramp prize respawns with random type.

Files: global.h, board_process3_ruby.c, collision_checks.c, ruby_ramp_entities.c + PC port (26 total)

## Screen Shake

- `horizontalShakeOffset` -> `screenShakeX` -- X-axis camera shake (Whiscash + Rayquaza). Shorter, clearer.
- `bonusBoardYOffset` -> `screenShakeY` -- Y-axis camera shake (Rayquaza + Groudon, bonus stages only). Pairs with screenShakeX.

Files: global.h, board_process2.c, board_process3_rayquaza.c, board_process3_groudon.c, board_process7.c, ruby_board_entities.c + PC port (44 total)

## Gauntlet Flash (drop "Boss")

- `gauntletBossFlashTimer` -> `gauntletFlashTimer` -- not a boss fight, it's a projectile launcher board feature. "Boss" was misleading.
- `gauntletBossFlashActive` -> `gauntletFlashActive` -- same. The `gauntletProjectile*` fields were already correct and kept as-is.

Files: global.h, collision_checks.c, ruby_board_entities.c + PC port (20 total)

## Egg Delivery System (was "TravelMode"/"EvolutionMode")

Two delivery paths exist after the hatch cave: Pelipper (rare, Totodile) and egg drop (common, Aerodactyl). The old names "Travel" and "Evolution" referred to the delivery mechanism, not the game modes of the same name. This was confusing.

Fields:
- `travelSpriteFrame` -> `pelipperDeliveryFrame`
- `pikaSaverAnimFrameTimer` -> `pelipperDeliveryTimer` -- "PikaSaver" was a leftover decompilation artifact
- `modeSpriteTimer` -> `eggDropTimer`
- `modeSpriteX` -> `eggDeliveryX`
- `modeSpriteY` -> `eggDeliveryY`
- `modeSpriteVelX` -> `eggDeliveryVelX`
- `modeSpriteVelY` -> `eggDeliveryVelY`
- `eggAnimTravelState` -> `eggDeliveryState` -- dropped misleading "Travel"

Functions:
- `InitTravelModeSprites` -> `InitPelipperEggDelivery`
- `AnimateTravelModeSprite` -> `AnimatePelipperEggDelivery`
- `InitEvolutionModeSprites` -> `InitEggDropDelivery`
- `AnimateEvolutionModeSprite` -> `AnimateEggDropDelivery`

Files: global.h, functions.h, catch_hatch_animations.c, ruby_catch_mode.c + PC port (132 total)

## Catch Hole Animation (was "sharpedo")

- `sharpedoOamIndex` -> `catchHoleAnimFrame` -- used by both Sharpedo (Ruby) and Wailmer (Sapphire). Named after the shared mechanic, matches adjacent `catchHolePauseTimer`.
- `sharpedoTileVariant` -> `catchHoleTileVariant` -- same, shared between both boards.

Files: global.h, ruby_catch_mode.c, board_process3_sapphire.c, ruby_board_entities.c, sapphire_board_entities.c, pinball_game_main.c + PC port (73 total)

* more renames

362 replacements across 28 files. GBA ROM SHA1 verified.

## Renames

### gravityFrozen -> ballGrabbed
This field is set to 1 when a legendary boss grabs the ball during its attack sequence, and cleared to 0 when the ball is released. The old name described what happens as a side effect (gravity stops updating), but the actual state being tracked is whether the boss is holding the ball. Used by Kyogre, Groudon, and Rayquaza boss fights.

### bossColorState -> kecleonFramesetBase
Only used by the Kecleon bonus stage. It stores a base animation frameset index derived from Kecleon's movement direction angle (via `gKecleonVisibleWalkDirectionMap`), then various offsets are added to select specific walk/stand/fall frames. Nothing to do with color.

### bossSubEntityState -> dusclopsWalkFootIndex
Only used by the Dusclops bonus stage. Cycles through values 0-4 to track which foot Dusclops is leading with during its walk cycle. The parity (`& 1`) determines animation direction. Other bonus stages initialize it to 0 and never touch it again.

### kecleonHitState -> kecleonBoardHitState
Tracks collision with any of the 14 berry zones on the Kecleon board (4 large + 10 small, collision cases 8-12), not just Kecleon's body being hit directly. The broader name better reflects that this covers all scope/berry overlay collisions.

### catchSpinRadius -> trapSpinRadius
### captureAngleQ16 -> trapAngleQ16
These two fields control the ball's spiral orbit during trap captures (boss fights, center hole traps, Jirachi bonus). They are not used by the regular catch system (Sharpedo hole). The old names mixed "catch" and "capture" inconsistently and were ambiguous with the separate catch mode. "trap" distinguishes this mechanic clearly.

### travelPelipperPosX/PosY/VelX/VelY -> travelPainterPosX/PosY/VelX/VelY
### gRubyTravelPelipper_Gfx -> gRubyTravelVolbeat_Gfx
### gSapphireTravelPelipper_Gfx -> gSapphireTravelIllumise_Gfx
The travel cutscene entity is Volbeat (Ruby board) and Illumise (Sapphire board), not Pelipper. The actual Pelipper has its own separate fields (`pelipperState`, `pelipperPosX`, `pelipperPosY` at offsets 0x306-0x322) and its own graphics (`gPelipper_Gfx` from `pelipper.4bpp`). The travel sprites at ROM 0x08483D8C / 0x08488A0C are 44-53% different from real Pelipper pixel data, and the Ruby and Sapphire variants differ from each other by 22-37% per frame, consistent with two distinct but related Pokemon. The previous "travelPelipper" labels were a misidentification.

### rouletteSpeciesId -> rouletteAreaIndex
This array stores area-based portrait indices (0-12) used to look up graphics sets, not actual species IDs. The lookup table `gAreaToSpeciesTable` is essentially an identity mapping (area N maps to index N). The old name made it sound like the roulette was selecting a specific Pokemon species, when it is selecting an area index for portrait rendering.

## Source File Reverts

17 source files reverted from descriptive names back to their original ROM-offset names. The `ld_script.txt` linker order was updated to match.

| Descriptive Name | Reverted To |
|------------------|-------------|
| `interrupt_handlers.c` | `rom_850.c` |
| `text_graphics_util.c` | `rom_1068C.c` |
| `banner_camera.c` | `rom_1A0F4.c` |
| `ruby_catch_mode.c` | `rom_1A98C.c` |
| `ruby_board_entities.c` | `rom_201B8.c` |
| `catch_hatch_animations.c` | `rom_27E08.c` |
| `catch_roulette_rendering.c` | `rom_27F94.c` |
| `sprite_link_init.c` | `rom_2414.c` |
| `ruby_ramp_entities.c` | `rom_2C538.c` |
| `sapphire_board_entities.c` | `rom_2E67C.c` |
| `sapphire_egg_cave.c` | `rom_30480.c` |
| `sapphire_visual_effects.c` | `rom_31BE8.c` |
| `capture_registry.c` | `rom_31CF8.c` |
| `bonus_stage_transitions.c` | `rom_356A0.c` |
| `board_layout_init.c` | `rom_467F4.c` |
| `ruby_hud_animations.c` | `rom_4F258.c` |
| `sapphire_hud_animations.c` | `rom_50AD4.c` |

* removal

Removed duplicated & unwanted renames

* renames

## Changes Made

### Misidentified Pokemon Entities (6 functions + 2 fields)

Wrong Pokemon names from initial decompilation. Corrected based on in-game sprite identification.

| Old Name | New Name | File | Notes |
|----------|----------|------|-------|
| `InitPelipperEggDelivery` | `InitTotodileEggDelivery` | rom_27E08.c | Sprite group 82; Totodile carries egg when `rubyPondState == RUBY_POND_STATE_LOTAD` |
| `AnimatePelipperEggDelivery` | `AnimateTotodileEggDelivery` | rom_27E08.c | Same entity |
| `InitEggDropDelivery` | `InitAerodactylEggDelivery` | rom_27E08.c | Sprite group 12; Aerodactyl flies in with the egg |
| `AnimateEggDropDelivery` | `AnimateAerodactylEggDelivery` | rom_27E08.c | Same entity |
| `UpdateGauntletBossAnimation` | `UpdateChikoritaAttackAnimation` | rom_201B8.c | Sprite groups 13-14; Chikorita shoots leaf projectiles at bumpers |
| `AnimateGauntletBossSprite` | `AnimateChikoritaSprite` | rom_201B8.c | Sprite group 53, flash animation |
| `pelipperDeliveryFrame` | `totodileDeliveryFrame` | global.h (0x2C3) | Misattributed to Pelipper |
| `pelipperDeliveryTimer` | `totodileDeliveryTimer` | global.h (0x2C4) | Same |

### Chikorita Fields (7 fields, 0x2B0-0x2BC)

| Old | New |
|-----|-----|
| `gauntletFlashTimer` | `chikoritaFlashTimer` |
| `gauntletFlashActive` | `chikoritaFlashActive` |
| `gauntletProjectileX` | `chikoritaProjectileX` |
| `gauntletProjectileY` | `chikoritaProjectileY` |
| `gauntletProjectileVelX` | `chikoritaProjectileVelX` |
| `gauntletProjectileUnused` | `chikoritaProjectileUnused` |
| `gauntletProjectileTimer` | `chikoritaProjectileTimer` |

### Chikorita Data Labels (3)

| Old | New |
|-----|-----|
| `gGauntletExplosionTiles` | `gChikoritaExplosionTiles` |
| `gGauntletProjectileTiles` | `gChikoritaProjectileTiles` |
| `gGauntletBossFlashFrameIndices` | `gChikoritaFlashFrameIndices` |

### Spheal Stage Entity Disambiguation (3 functions + 1 struct + 1 data label)

The Spheal bonus stage has two Pokemon: Spheal (flying enemies) and Sealeo (ground minions that get knocked down). Functions were lumping both under "Spheal."

| Old Name | New Name | Notes |
|----------|----------|-------|
| `UpdateSphealMinionLogic` | `UpdateSealeoEntityLogic` | "Minions" use `minionState`/`minionFramesetIx` - these are Sealeo |
| `UpdateSphealFlyingEnemyLogic` | `UpdateSphealEntityLogic` | Flying enemies ARE Spheal; dropped redundant "FlyingEnemy" |
| `UpdateSphealKnockdownPhysics` | `UpdateSealeoKnockdownPhysics` | Knockdown targets are Sealeo (operates on `minionState[var0]`) |
| `struct FlyingEnemyPath` | `struct SphealFlightPath` | Flight path data for Spheal patterns |
| `gSphealFlyingEnemyPathData` | `gSphealFlightPathData` | Matching struct rename |

### Ruby Board Distinction (4 functions)

These are Ruby-only but lacked the "Ruby" prefix. Sapphire counterparts already had it.

| Old Name | New Name |
|----------|----------|
| `DispatchCatchModeInit` | `DispatchRubyCatchModeInit` |
| `UpdateCatchModeAnimation` | `UpdateRubyCatchModeAnimation` |
| `InitEvolutionShopMode` | `InitRubyEvolutionShopMode` |
| `AnimateEvolutionShopSequence` | `AnimateRubyEvolutionShopSequence` |

### Improved Descriptiveness (3 functions + 2 data labels + 1 field)

| Old Name | New Name | Notes |
|----------|----------|-------|
| `ProcessMainBoardBallDrain` | `ProcessMainBoardBallDrainAndLaunch` | Also handles plunger charging/launch (lines 421-438) |
| `HideCaughtPokemonSprite` | `CleanupCaughtPokemonSprite` | Sets OAM off-screen AND sets `available=0` |
| `HideJirachiSprites` | `CleanupJirachiSprites` | Hides sprite group 33 AND deactivates 4 star tag groups (45-48) |
| `gMonIconTilesGfx` | `gPikaSaverTilesGfx` | Pikachu saver icon tiles, indexed via `gPikaSaverAnimFrameTable` |
| `monIconTileIndex` | `pikaSaverTileIndex` | Indexes into `gPikaSaverTilesGfx` |
| `field` (0x10FD) | `savedField` | Adjacent fields are `savedTempField`, `savedIsBonusField`, etc. |

### Comments Added (4)

| Location | Comment |
|----------|---------|
| `progressLevel` (0x70E) | Becomes bonusMultiplier at end-of-ball; displayed on the blue bonus sign |
| `ballLaunchTimer` (0x1328) | Countdown to activate secondaryBall (multiball) |
| Fields 0x1106-0x110E | Values applied by the pause process (set when pausing) |
| Fields 0x1110-0x1118 | Values preserved from before pause (restored when unpausing) |
2026-03-15 19:40:33 -05:00
Retnuhytnuob
15da57f3f7
Dusclops Bonus Deep Dive Naming & incidental dump/naming (#202)
Some checks failed
CI / build (push) Has been cancelled
* checkpoint

* checkpoint 2

* checkpoint

* checkpoint

* checkpoint

* checkpoint

* final mode_change update

* remove temporary whitespace from gDuskullSpritesheetOam

* correct spelling of collision

* remove unneeded .orig files

* remove unneeded comment

* Rename PlayRumble function
2026-02-28 13:06:45 -06:00
Smileynator
0fdca67e6c Merge with master - resolved conflicts 2025-09-04 20:36:38 +02:00
Smileynator
4e14c22985 some unsaved files i forgot 2025-09-04 20:26:41 +02:00
Smileynator
e3b6f0a472 Named some score counting related variables 2025-09-04 20:26:38 +02:00
Marcus Huderle
ea6bfc3bf9 document some functions and ball state
Some checks are pending
CI / build (push) Waiting to run
2025-09-04 09:01:57 -05:00
Eduardo Quezada
3ed9688f82
Document with some field constant usage (#165) 2025-08-30 15:06:25 -05:00
Marcus Huderle
af63c47397 sub_4FD88 2025-08-13 08:50:48 -05:00
Retnuhytnuob
2e155ddfdb
Stage 1 comprehension naming of functions for main.substate, board processes, and board specific collision (#150)
Some checks are pending
CI / build (push) Waiting to run
* context marking for some items

* Tag State related functions

* cleanup

* board proc pair names
2025-08-12 07:31:53 -05:00
Marcus Huderle
94c3ddf906 match some more funcs 2025-08-11 15:54:07 -05:00
Marcus Huderle
c7007c27f5 sub_47100, sub_47110, sub_47160 2025-07-21 15:18:40 -05:00
Marcus Huderle
2318665986 sub_48190
Some checks are pending
CI / build (push) Waiting to run
2025-07-20 20:26:20 -05:00
Retnuhytnuob
ce8bb30b36
Data Dump for multiple small arrays; Corrections in Game obj; Add decomp reference aide (#128)
Some checks are pending
CI / build (push) Waiting to run
* initial data

* cleanup incorrect marker in pinballGame object

* Fix raw pointers

---------

Co-authored-by: Marcus Huderle <huderlem@gmail.com>
2025-07-15 08:12:10 -05:00
Retnuhytnuob
2e873e095e
Rename gUnknown_0200... refs that point to the gMain space (#129)
* mark gMain variable refs

* removed address grid reference for spriteGroup; included on separate pr

* adjust labels in rom files
2025-07-15 07:44:36 -05:00
Smileynator
1c0a9314f8
Decompile sub_19048, IdlePinballGameMain, sub_19190, sub_19288 and sub_19304 (#114)
* decompile IdlePinballGameMain
documented gMain.subState
Broken state due to gIdlePinballGameStateFuncs definition

* Fixed definition of gIdlePinballGameStateFuncs

* Decimpile sub_19048

* Decomp sub_19190

* Fixed the io_reg macro name for joystick without LR as an input check.

* used proper macro's for field checks

* Decompile sub_19288 and sub_19304

* cleanup

---------

Co-authored-by: Marcus Huderle <huderlem@gmail.com>
2025-06-19 10:17:05 -05:00
Retnuhytnuob
43302a9134
Define gUnknown_086BB910 (#107)
* define gUnknown_086BB910

* remove unintended name for Substate 9

* Document buttonConfigs 2d array
2025-06-13 16:31:19 -05:00
Marcus Huderle
ecb5f9f0b8 Dump Gb Player screen data 2025-05-31 12:13:15 -05:00
ColinT
09403d1e89
Decompile sub_12BF8 (#96)
* Decompile sub_12BF8

* Fix up types and DmaCopy calls

* formatting cleanup

---------

Co-authored-by: Marcus Huderle <huderlem@gmail.com>
2025-05-19 08:07:30 -05:00
ColinT
e9378c83b6
Decompile function 27E08 (#95)
* temp

* Decomp 27E08

* Delete expected_obj

* Rewrite as for loop

* Fix non-matching code

* Delete asm of decompiled function

* Fix styles
2025-04-27 08:19:34 -05:00
Marcus Huderle
fe9052db37 best try at sub_12524
Some checks failed
CI / build (push) Has been cancelled
2025-03-02 15:08:38 -06:00
Marcus Huderle
05f8f3ba0a document buttonActions struct members
Some checks are pending
CI / build (push) Waiting to run
2025-02-20 08:41:29 -06:00
Marcus Huderle
875723ffeb Document some gCurrentPinballGame struct members 2025-02-17 09:47:38 -06:00
Marcus Huderle
92cd662876 sub_4B408 2025-02-17 09:44:40 -06:00
Marcus Huderle
2cbab2489a sub_4B280
Some checks are pending
CI / build (push) Waiting to run
2025-02-16 15:17:07 -06:00
Marcus Huderle
8bb8c74d29 sub_4A90C 2025-02-16 10:35:14 -06:00
Marcus Huderle
f91ff1cdbd sub_4A6A0 and document gMain.bgOffsets 2025-02-16 09:51:33 -06:00
Marcus Huderle
fda30ab7c3 sub_4A518 2025-02-15 14:37:34 -06:00
Marcus Huderle
ca6d793627 sub_49ED4 2025-02-15 13:09:37 -06:00
WhenGryphonsFly
02fdab535c
Merge pull request #67 from Hyenate/master
Decompile sub_19B64
2025-02-09 15:21:06 -06:00
Nate Bouchat
3c60be6ad9 Fix style issues 2025-02-09 16:08:48 -05:00
Seyed Mahdi Hosseini
701dc00804 match sub_CFD4 2025-02-09 10:21:32 +09:00
Nate Bouchat
23a3753808 Decompile sub_19B64 2025-02-08 13:47:59 -05:00
Eduardo Quezada
e824290b26
Option menu documentation + other (#59)
* gUnknown_020314E0 -> gCurrentPinballGame

* JOY macros

* Partly document options

* Misc. documentation

* EOF fix
2025-02-02 10:15:33 -06:00
Marcus Huderle
211f782fcb More high_scores.c decomp 2024-02-19 16:07:14 -06:00
Marcus Huderle
eca51011c9 Decompile sub_D664 2024-02-11 11:53:10 -06:00
Seth Barberee
bba1157f96 first attempt at high scores decomp 2023-08-25 10:43:10 -07:00
Seth Barberee
84d344ba62 document some things 2023-06-25 11:13:17 -07:00
Seth Barberee
f67da66678 initial work of ereader and document bg music songs 2023-06-25 10:26:50 -07:00
WhenGryphonsFly
11efa5038f [WIP] Rename functions
This commit allows calcrom to correctly calculate the number of undocumented and partially documented symbols
2023-06-23 21:36:03 -05:00
WhenGryphonsFly
38dc4ef308 Revoke execute privileges 2023-06-16 20:22:20 -05:00
WhenGryphonsFly
16dbaa6f87 Revert "Update ereaderData in struct Main"
This reverts commit 4ee0f422ce.
2023-06-05 18:04:04 -05:00
WhenGryphonsFly
4ee0f422ce Update ereaderData in struct Main 2023-06-03 15:04:19 -05:00
WhenGryphonsFly
3a8ca70e36 Update frame counts in struct Main 2023-06-03 15:04:06 -05:00
Marcus Huderle
d49b981915 Decompile some functions in options.c 2020-07-05 17:07:48 -05:00
Cameron Hall
0648ededb9 more labeling 2019-08-12 18:47:16 -05:00
Cameron Hall
93f755636b more labeling 2019-08-11 20:57:10 -05:00
Cameron Hall
0de7fdc613 decompile field_select.s 2019-08-11 18:28:44 -05:00
Cameron Hall
68de07eabf cleanup 2019-08-11 14:20:54 -05:00
Cameron Hall
b0870ee7fb decompile through sub_51C3C 2019-08-11 13:11:32 -05:00
Cameron Hall
254f7f6a21 decompile rom_528AC.s 2019-08-07 17:44:24 -05:00