@gaialabs/iog-baserom 0.2.7 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/baserom/auto-use-items/CellKeysAutoUse.patch.asm +30 -0
  2. package/baserom/auto-use-items/CrystalBallAutoUse.patch.asm +131 -0
  3. package/baserom/auto-use-items/DiamondBlockAutoUse.patch.asm +50 -0
  4. package/baserom/auto-use-items/ElevatorKeyAutoUse.patch.asm +26 -0
  5. package/baserom/auto-use-items/GorgonFlowerAutoUse.patch.asm +153 -0
  6. package/baserom/auto-use-items/HieroglyphPuzzle.patch.asm +1187 -0
  7. package/baserom/auto-use-items/HopeStatueAutoUse.patch.asm +99 -0
  8. package/baserom/auto-use-items/IncanStatueAutoUse.patch.asm +75 -0
  9. package/baserom/auto-use-items/ItemUseStub.patch.asm +24 -0
  10. package/baserom/auto-use-items/MagicPowerAutoUse.patch.asm +55 -0
  11. package/baserom/auto-use-items/MeatAutoUse.patch.asm +33 -0
  12. package/baserom/auto-use-items/MushroomDropAutoUse.patch.asm +100 -0
  13. package/baserom/auto-use-items/PalaceKeyAutoUse.patch.asm +52 -0
  14. package/baserom/auto-use-items/PrisonKeyAutoUse.patch.asm +84 -0
  15. package/baserom/auto-use-items/PurificationStoneAutoUse.patch.asm +49 -0
  16. package/baserom/auto-use-items/RamaStatueAutoUse.patch.asm +100 -0
  17. package/baserom/auto-use-items/TearpotAutoUse.patch.asm +41 -0
  18. package/baserom/{spritemaps → boot-logo}/spm_boot_logos.sprite.asm +10 -0
  19. package/baserom/collectible-system/RelicMenu.patch.asm +250 -0
  20. package/baserom/collectible-system/key_item_core.asm +445 -0
  21. package/baserom/{patches → equipped-icon}/EquippedIcon.patch.asm +41 -24
  22. package/baserom/equipped-icon/ItemSwapping.patch.asm +99 -0
  23. package/baserom/{palettes → equipped-icon}/pal_item_exprite2.pal +0 -0
  24. package/baserom/{spritemaps → equipped-icon}/spm_sc02_main_characters.sprite.asm +10 -0
  25. package/baserom/equipped-icon/spriteset_aura.asm +131 -0
  26. package/baserom/equipped-icon/spriteset_dark_friar.asm +277 -0
  27. package/baserom/equipped-icon/spriteset_darkgaia_projectile.asm +233 -0
  28. package/baserom/fixes-tweaks/BCDHex.patch.asm +60 -0
  29. package/baserom/fixes-tweaks/HudRedesign.patch.asm +108 -0
  30. package/baserom/fixes-tweaks/NeilsFatherFix.patch.asm +26 -0
  31. package/baserom/fixes-tweaks/PyramidPortalExit.patch.asm +41 -0
  32. package/baserom/fixes-tweaks/SceneTitles.patch.asm +84 -0
  33. package/baserom/fixes-tweaks/ThankfulFlower.patch.asm +28 -0
  34. package/baserom/fixes-tweaks/Utils.patch.asm +111 -0
  35. package/baserom/{spritemaps → fixes-tweaks}/spm_goldship_sprites.sprite.asm +11 -0
  36. package/baserom/fonts/EnhancedOverworldText.patch.asm +44 -0
  37. package/baserom/fonts/EnhancedPrologueText.patch.asm +252 -0
  38. package/baserom/{graphics → fonts}/gfx_fonts.bin +0 -0
  39. package/baserom/fonts/gfx_overworld_font.bin +0 -0
  40. package/baserom/inventory/EnhancedSlotActor.patch.asm +50 -0
  41. package/baserom/inventory/InventoryCounters.patch.asm +407 -0
  42. package/baserom/inventory/InventoryManagement.patch.asm +390 -0
  43. package/baserom/kara-run/gfx_castle_sprites.bin +0 -0
  44. package/baserom/new-game-plus/NGPEpilogueSwitch.patch.asm +52 -0
  45. package/baserom/{patches → new-game-plus}/NewGamePlus.patch.asm +42 -23
  46. package/baserom/oakton/map_fr30.map +0 -0
  47. package/baserom/oakton/map_fr30_effect.map +0 -0
  48. package/baserom/options-menu/EnhancedInvItemPicker.patch.asm +130 -0
  49. package/baserom/options-menu/MinimalHudOption.patch.asm +109 -0
  50. package/baserom/options-menu/OptionsMenu.patch.asm +218 -0
  51. package/baserom/options-menu/TextSpeedOption.patch.asm +108 -0
  52. package/baserom/options-menu/options_input_remap.asm +373 -0
  53. package/baserom/options-menu/options_menu_core.asm +1221 -0
  54. package/baserom/patches/APUWaitFixes.patch.asm +30 -17
  55. package/baserom/patches/AccentMap.patch.asm +16 -5
  56. package/baserom/patches/MusicTransitions.patch.asm +41 -24
  57. package/baserom/player-input/MergeInputFlags.patch.asm +146 -0
  58. package/baserom/player-input/PlayerInput.patch.asm +51 -0
  59. package/baserom/red-jewels/AnnSparkle.patch.asm +28 -0
  60. package/baserom/red-jewels/ChestFlaggedHiddenRedJewel.patch.asm +50 -0
  61. package/baserom/red-jewels/FishermanRedJewel.patch.asm +55 -0
  62. package/baserom/red-jewels/LanceSparkle.patch.asm +38 -0
  63. package/baserom/red-jewels/RedJewelSparkle.patch.asm +49 -0
  64. package/baserom/red-jewels/SnakePanicSparkle.patch.asm +45 -0
  65. package/baserom/red-jewels/SparkleAlways.patch.asm.example +19 -0
  66. package/baserom/red-jewels/StoneGirlSparkle.patch.asm +26 -0
  67. package/baserom/red-jewels/TrappedSlaveSparkle.patch.asm +63 -0
  68. package/baserom/red-jewels/generic_sparkle.asm +57 -0
  69. package/baserom/run-button/RunButtonCore.patch.asm +89 -0
  70. package/baserom/run-button/RunButtonOption.patch.asm +50 -0
  71. package/baserom/{patches/BitmapPatch.patch.asm → scene-load/BitmapLoad.patch.asm} +27 -12
  72. package/baserom/scene-load/Cop51Decompress.patch.asm +98 -0
  73. package/baserom/scene-load/ExpriteLoader.patch.asm +82 -0
  74. package/baserom/scene-load/MapNameLookup.patch.asm +27 -0
  75. package/baserom/scene-load/MenuBGLoad.patch.asm +70 -0
  76. package/baserom/scene-load/SFXTable.patch.asm +92 -0
  77. package/baserom/scene-load/SceneMetaLoad.patch.asm +68 -0
  78. package/baserom/scene-load/SpritemapLoad.patch.asm +61 -0
  79. package/baserom/scene-load/TilemapLoad.patch.asm +109 -0
  80. package/baserom/scene-load/TilesetLoad.patch.asm +41 -0
  81. package/baserom/set_overworld.set +0 -0
  82. package/baserom/seths-jewel/SethsJewelGoldShip.patch.asm +22 -0
  83. package/baserom/seths-jewel/SethsJewelIcon.patch.asm +22 -0
  84. package/baserom/seths-jewel/SethsJewelItem.patch.asm +62 -0
  85. package/baserom/seths-jewel/SethsJewelSprites.patch.asm +49 -0
  86. package/baserom/{patches → sky-delivery}/SouthCapeDeliveryman.patch.asm +12 -3
  87. package/baserom/sky-delivery/WatermiaDeliveryman.patch.asm +15 -0
  88. package/dist/index.cjs +10159 -964
  89. package/dist/index.cjs.map +1 -1
  90. package/dist/index.d.cts +9 -1
  91. package/dist/index.d.cts.map +1 -1
  92. package/dist/index.d.mts +9 -1
  93. package/dist/index.d.mts.map +1 -1
  94. package/dist/index.mjs +10161 -967
  95. package/dist/index.mjs.map +1 -1
  96. package/package.json +10 -8
  97. package/baserom/asm/spriteset_aura.asm +0 -122
  98. package/baserom/asm/spriteset_dark_friar.asm +0 -268
  99. package/baserom/asm/spriteset_will_projectile.asm +0 -224
  100. package/baserom/patches/Cop51Patch.patch.asm +0 -81
  101. package/baserom/patches/DPShop.asm.old +0 -328
  102. package/baserom/patches/DeathWarp.asm.old +0 -174
  103. package/baserom/patches/ExpandedHealthBars.old +0 -203
  104. package/baserom/patches/ExpriteLoader.patch.asm +0 -66
  105. package/baserom/patches/GemShop.asm.old +0 -345
  106. package/baserom/patches/InventoryCounters.patch.asm +0 -292
  107. package/baserom/patches/InventoryManagement.patch.asm +0 -324
  108. package/baserom/patches/InventoryScript.asm.old +0 -319
  109. package/baserom/patches/ItemDictionary.asm.old +0 -86
  110. package/baserom/patches/ItemRewards.asm.old +0 -49
  111. package/baserom/patches/ItemSwapping.patch.asm +0 -80
  112. package/baserom/patches/MapNameLookup.patch.asm +0 -13
  113. package/baserom/patches/MenuBGPatch.patch.asm +0 -54
  114. package/baserom/patches/NGPEpilogueSwitch.patch.asm +0 -44
  115. package/baserom/patches/PixelConverter.patch.asm.old +0 -60
  116. package/baserom/patches/QuickScripts.asm.old +0 -210
  117. package/baserom/patches/RunButton.patch.asm +0 -79
  118. package/baserom/patches/SFXTable.patch.asm +0 -73
  119. package/baserom/patches/SceneLoadPatch.patch.asm +0 -52
  120. package/baserom/patches/SpritemapPatch.patch.asm +0 -45
  121. package/baserom/patches/Teleporter.patch.asm.old +0 -203
  122. package/baserom/patches/TilemapPatch.patch.asm +0 -94
  123. package/baserom/patches/TilesetPatch.patch.asm +0 -27
  124. package/baserom/patches/Utils.patch.asm +0 -414
  125. package/baserom/patches/WatermiaDeliveryman.patch.asm +0 -2
  126. /package/baserom/{graphics → boot-logo}/gfx_boot_exprite.raw.bin +0 -0
  127. /package/baserom/{graphics → boot-logo}/gfx_boot_logos.bin +0 -0
  128. /package/baserom/{palettes → boot-logo}/pal_boot_logos.pal +0 -0
  129. /package/baserom/{palettes → equipped-icon}/fx_palette_198000.pal +0 -0
  130. /package/baserom/{graphics → equipped-icon}/gfx_item_exprite.raw.bin +0 -0
  131. /package/baserom/{graphics → equipped-icon}/misc_fx_1CD580.bin +0 -0
  132. /package/baserom/{palettes → equipped-icon}/pal_item_exprite.pal +0 -0
  133. /package/baserom/{palettes → equipped-icon}/pal_sc02_main_characters.pal +0 -0
  134. /package/baserom/{graphics → fonts}/gfx_credits_font.bin +0 -0
  135. /package/baserom/{graphics → inventory}/gfx_inventory_sprites.bin +0 -0
@@ -0,0 +1,390 @@
1
+ ; ==============================================================================
2
+ ; Inventory management extensions - give/remove items, counters, Auto-Jewels
3
+ ; ==============================================================================
4
+ ; What it does: Extends pickup and use so red jewels can auto-consume (options
5
+ ; bit at $0B3A:4), herbs/jewels/crystals use per-type counts ($0B55-$0B57),
6
+ ; and the jeweler can bulk-cash stored jewel count into BCD $0AB0.
7
+ ; Vanilla behavior: GiveItemToPlayer scans 16 slots only; red jewel use removes
8
+ ; slot and spawns sparkle; jeweler scans slots for item $01 in a loop.
9
+ ; Hooks (overrides): inventory_mgmt (give/remove/search), item_use_system (red
10
+ ; jewel use, RemoveEquippedItem), jeweler_gem (JewelerCountJewels + loop).
11
+ ; Adds: InventoryCheckAndStore, AutoUseRedJewelHandler, inv_remove_stub (JSR).
12
+ ; Depends on: InventoryCounters (JSL), KeyItemCheckAndStore, options_menu_core
13
+ ; OptionSettingPreset chain, chunk_03BAE1, jeweler_gem.
14
+ ; State: $0AB0 jewels BCD, $0AB4 slots, $0AC4/$0AC6 equip, $0B55-$0B58 counts.
15
+ ; Hazards/notes: GiveItemToPlayer uses PHP/SEP; jewel math uses SED; COP spawn
16
+ ; needs X=actor slot; loc_08CF74/84 stubs empty jeweler loop bodies.
17
+ ; ==============================================================================
18
+
19
+ ?BANK 03
20
+
21
+ ?INCLUDE 'chunk_038000'
22
+ ?INCLUDE 'chunk_03BAE1'
23
+ ?INCLUDE 'jeweler_gem'
24
+
25
+ !player_actor 09AA
26
+ !jewels_collected 0AB0
27
+ !inventory_slots 0AB4
28
+ !inventory_equipped_index 0AC4
29
+ !inventory_equipped_type 0AC6
30
+ ;!page_2 0B34 ;16 items per page
31
+
32
+ !state_1 0B54
33
+ !herb_count 0B55
34
+ !jewel_count 0B56
35
+ !crystal_count 0B57
36
+ !key_item_flags 0B58
37
+
38
+ ;Options menu setting (registry format: options_menu_core.asm)
39
+ ;Storage: $0B3A bit 4 (set = Auto-Jewels off). Temp (TBL switch) word: $0BE4
40
+ !auto_jewels_setting 0B3A
41
+
42
+ AutoJewelsChoices [
43
+ &auto_jewels_on
44
+ &auto_jewels_off
45
+ ]
46
+
47
+ auto_jewels_on |On|
48
+ auto_jewels_off |Off|
49
+
50
+ optstr_auto_jewels |[PAL:0]Auto-Jewels[N] [PAL:14][TBL:@AutoJewelsChoices,BE4][PAL:0]|
51
+ optstr_auto_jewels_desc |[PAL:0][POS:96,5]Red Jewels are used[DBL]automatically when[DBL]they are picked up.|
52
+
53
+ ------------------------------------------------
54
+ ;Checks for an available inventory slot
55
+ ;Assumes: M == 1, preserves A and X and Y
56
+ ;Accepts: A = item ID
57
+ ;Returns: carry set = no slot found
58
+
59
+ InventoryCheckAndStore {
60
+ PHY
61
+ PHA
62
+ LDY #$0000
63
+
64
+ icas_check_loop:
65
+ LDA $inventory_slots, Y
66
+ BEQ icas_check_found
67
+ INY
68
+ CPY #$0010
69
+ BCC icas_check_loop
70
+
71
+ PLA
72
+ PLY
73
+ SEC
74
+ RTL
75
+
76
+ icas_check_found:
77
+ PLA
78
+ STA $inventory_slots, Y
79
+ PLY
80
+ CLC
81
+ RTL
82
+ }
83
+
84
+ ------------------------------------------------
85
+
86
+ inv_remove_stub:
87
+ SEP #$20
88
+ LDA $inventory_slots, X
89
+ CMP #$01
90
+ BEQ inv_remove_jewel
91
+ CMP #$06
92
+ BEQ inv_remove_herb
93
+ CMP #$0E
94
+ BEQ inv_remove_crystal
95
+ BRA inv_remove_item
96
+
97
+ inv_remove_jewel:
98
+ SED
99
+ REP #$20
100
+ LDA $jewels_collected
101
+
102
+ inv_add_jewel_count:
103
+ CLC
104
+ ADC #$0001
105
+
106
+ SEP #$20
107
+ DEC $jewel_count
108
+ BMI inv_remove_jewel_minus
109
+ REP #$20
110
+ BEQ inv_finish_jewel_item
111
+ BRA inv_add_jewel_count
112
+
113
+ inv_remove_jewel_minus:
114
+ STZ $jewel_count
115
+ REP #$20
116
+
117
+ inv_finish_jewel_item:
118
+ STA $jewels_collected
119
+ CLD
120
+ SEP #$20
121
+ BRA inv_remove_item
122
+
123
+ inv_remove_herb:
124
+ DEC $herb_count
125
+ BMI inv_remove_herb_minus
126
+ BEQ inv_remove_item
127
+ RTS
128
+
129
+ inv_remove_herb_minus:
130
+ STZ $herb_count
131
+ BRA inv_remove_item
132
+
133
+ inv_remove_crystal:
134
+ DEC $crystal_count
135
+ BMI inv_remove_crystal_minus
136
+ BEQ inv_remove_item
137
+ RTS
138
+
139
+ inv_remove_crystal_minus:
140
+ STZ $crystal_count
141
+
142
+ inv_remove_item:
143
+ STZ $inventory_slots, X
144
+ CPX $inventory_equipped_index
145
+ BNE inv_remove_finish
146
+ REP #$20
147
+ LDA #$0000
148
+ STA $inventory_equipped_type
149
+ DEC
150
+ STA $inventory_equipped_index
151
+ LDA #$1000
152
+ TRB $06EE
153
+
154
+ inv_remove_finish:
155
+ RTS
156
+
157
+ ------------------------------------------------
158
+ ;Entry point for gem use (prevent increase, this is done elsewhere)
159
+ item_use_system.UseItem_RedJewel! {
160
+ COP [PrintDialogString] ( &dialogstring_038517 )
161
+ JSR $&RemoveEquippedItem
162
+ BRA UseItem_SpawnSparkle
163
+
164
+ UseItem_AddAndSpawn:
165
+ SED
166
+ LDA $jewels_collected
167
+ CLC
168
+ ADC #$0001
169
+ STA $jewels_collected
170
+ CLD
171
+
172
+ UseItem_SpawnSparkle:
173
+ PHX
174
+ PHD
175
+ LDA $player_actor
176
+ TCD
177
+ TAX
178
+ COP [SpawnListAppend] ( @code_038566, #00, #00, #$2000 )
179
+ TYX
180
+ LDA #$0000
181
+ STA $0012, X
182
+ LDA #$3000
183
+ STA $000E, X
184
+ LDY $player_actor
185
+ LDA $0014, Y
186
+ STA $0014, X
187
+ LDA $0016, Y
188
+ STA $0016, X
189
+ PLD
190
+ PLX
191
+ RTS
192
+ }
193
+
194
+ ---------------------------------------------
195
+ ;Entry point for removing an item from the inventory upon use
196
+
197
+ item_use_system.RemoveEquippedItem! {
198
+ PHX
199
+ LDX $inventory_equipped_index
200
+ JSR inv_remove_stub
201
+ PLX
202
+ REP #$20
203
+ RTS
204
+ }
205
+
206
+ ---------------------------------------------
207
+
208
+ AutoUseRedJewelHandler {
209
+ CMP #$01
210
+ BEQ aurjh_continue
211
+ RTS
212
+
213
+ aurjh_continue:
214
+ PHA
215
+ LDA $auto_jewels_setting
216
+ AND #$10
217
+ BNE aurjh_disabled
218
+ PLA
219
+ REP #$20
220
+ JSR $&UseItem_AddAndSpawn
221
+ PLA ;Pull the last JSR from the stack
222
+ SEP #$20
223
+ JMP GiveItem_StoreInSlot+4
224
+
225
+ aurjh_disabled:
226
+ PLA ;Restore the item ID and let it go to the inventory normally
227
+ RTS
228
+ }
229
+
230
+ --------------------------------------------------
231
+ ;Entry point for adding an item to the inventory
232
+
233
+ inventory_mgmt.GiveItemToPlayer! {
234
+ PHP
235
+ SEP #$20
236
+ BIT #$80
237
+ BNE GiveItem_SpecialItem
238
+ JSR $&AutoUseRedJewelHandler
239
+ JSL $@KeyItemCheckAndStore
240
+ BCC inv_give_item_normal
241
+ JMP GiveItem_StoreInSlot+4
242
+
243
+ inv_give_item_full:
244
+ JMP GiveItem_InventoryFull+1
245
+
246
+ inv_give_item_normal:
247
+ CPY #$0001
248
+ BEQ inv_give_item_full
249
+ JSL $@InventoryCountersCheckAndStore
250
+ BCC inv_give_item_continue
251
+ JMP GiveItem_StoreInSlot+4
252
+
253
+ inv_give_item_continue:
254
+ CPY #$0001
255
+ BEQ inv_give_item_full
256
+ JSL $@InventoryCheckAndStore
257
+ BCS inv_give_item_full
258
+ JMP GiveItem_StoreInSlot+4
259
+
260
+ inventory_mgmt.GiveItem_RegularSlotScan!:
261
+ inventory_mgmt.GiveItem_SlotOccupied!:
262
+ }
263
+
264
+ ---------------------------------------------
265
+ ;Entry point for checking inventory for item
266
+
267
+ inventory_mgmt.CheckInventory_SlotScan! {
268
+ CMP $inventory_slots, Y
269
+ BEQ CheckInventory_Found
270
+ INY
271
+ CPY #$0010
272
+ BNE CheckInventory_SlotScan
273
+ ;LDY #$0000
274
+
275
+ ;inv_search_page2:
276
+ ;CMP $page_2, Y
277
+ ;BEQ code_03F0C7
278
+ ;INY
279
+ ;CPY #$0010
280
+ ;BNE inv_search_page2
281
+
282
+ PLP
283
+ SEC
284
+ RTL
285
+ }
286
+
287
+ ---------------------------------------------
288
+ ;Route COP item removal through common process
289
+
290
+ inventory_mgmt.RemoveItemFromInventory! {
291
+ PHP
292
+ SEP #$20
293
+ CMP $inventoryEquippedType
294
+ BEQ rifi_normal
295
+ LDY $inventoryEquippedIndex
296
+ BRA RemoveItem_Match
297
+
298
+ rifi_normal:
299
+ LDY #$0000
300
+ }
301
+
302
+ inventory_mgmt.RemoveItem_Match! {
303
+ PHX
304
+ TYX
305
+ JSR inv_remove_stub
306
+ PLX
307
+ REP #$20
308
+ }
309
+
310
+ -----------------------------------------
311
+ ;Entry point for giving Jewels to Gem
312
+
313
+ jeweler_gem.JewelerCountJewels! {
314
+ SEP #$20
315
+ LDA #$00
316
+ XBA
317
+ LDA $jewel_count
318
+ BEQ search_inventory
319
+ STZ $jewel_count
320
+ REP #$20
321
+ STA $26
322
+ SED
323
+ LDA $0AB0
324
+
325
+ search_add_top:
326
+ CLC
327
+ ADC #$0001
328
+ DEC $26
329
+ BEQ search_store_gems
330
+ BRA search_add_top
331
+
332
+ search_store_gems:
333
+ STA $0AB0
334
+ CLD
335
+ SEP #$20
336
+
337
+ search_inventory:
338
+ LDA #$01
339
+ LDY #$000F
340
+
341
+ search_top_1:
342
+ CMP $inventory_slots, Y
343
+ BNE search_next_1
344
+ PHA
345
+ LDA #$00
346
+ STA $inventory_slots, Y
347
+ PLA
348
+
349
+ search_next_1:
350
+ DEY
351
+ BPL search_top_1
352
+ ;LDY #$000F
353
+
354
+ ;search_top_2:
355
+ ;CMP $page_2, Y
356
+ ;BNE search_next_2
357
+ ;PHA
358
+ ;LDA #$00
359
+ ;STA $page_2, Y
360
+ ;PLA
361
+
362
+ ;search_next_2:
363
+ ; DEY
364
+ ; BPL search_top_2
365
+
366
+ REP #$20
367
+ }
368
+
369
+ jeweler_gem.loc_08CF74! {
370
+ }
371
+
372
+ jeweler_gem.loc_08CF84! {
373
+ }
374
+
375
+ ------------------------------------------------
376
+ ;Registration of the Auto-Jewels setting (must stay after the overrides above)
377
+
378
+ OptionSettingPreset- [
379
+ @optstr_auto_jewels ;+00 render
380
+ @optstr_auto_jewels_desc ;+03 desc
381
+ #$0BE4 ;+06 temp
382
+ #$0B3A ;+08 store
383
+ #$0004 ;+0A shift
384
+ #$0001 ;+0C mask
385
+ #$0000 ;+0E xor
386
+ #$0002 ;+10 count
387
+ #$0000 ;+12 load (packed bits)
388
+ #$0000 ;+14 change
389
+ #$0000 ;+16 commit (packed bits)
390
+ ]
@@ -0,0 +1,52 @@
1
+ ; ==============================================================================
2
+ ; NGP epilogue thinker - epilogue slot flag on thinker spawn table
3
+ ; ==============================================================================
4
+ ; What it does: Adds h_epilogue_thinker (sets epilogue-related SRAM flag bits on
5
+ ; the selected save slot) and appends its spawn entry to scene $CEA9B table.
6
+ ; Vanilla behavior: thinker_spawn_0CEA9B listed only vanilla thinkers for that
7
+ ; scene; no epilogue-init thinker on slot select.
8
+ ; Hooks (overrides): scene_thinkers.thinker_spawn_0CEA9B+= (extra spawn row).
9
+ ; Adds: h_epilogue_thinker / e_epilogue_thinker (COP [3D] then RTL).
10
+ ; Depends on: scene_thinkers include; SRAM mirror $306354/$3063FC/$3063FE layout.
11
+ ; State: Reads/writes slot index via $0D8C and SRAM indexed by X from ASL table.
12
+ ; Hazards: Thinker runs with PHX; ORA #$0080 on checksum-related words; verify
13
+ ; slot index math matches DiaryScanSramSlots flag at $0DC6.
14
+ ; ==============================================================================
15
+
16
+ h_epilogue_thinker [
17
+ thinker_def < #00, #08, {
18
+
19
+ e_epilogue_thinker:
20
+ PHX
21
+ LDA $0D8C
22
+ XBA
23
+ ASL
24
+ TAX
25
+ LDA $306354, X
26
+ BIT #$0080
27
+ BNE epilogue_init_next
28
+ ORA #$0080
29
+ STA $306354, X
30
+
31
+ LDA $3063FC, X
32
+ CLC
33
+ ADC #$0080
34
+ STA $3063FC, X
35
+
36
+ LDA $3063FE, X
37
+ EOR #$0080
38
+ STA $3063FE, X
39
+
40
+ epilogue_init_next:
41
+ PLX
42
+ COP [3D]
43
+ RTL
44
+ } > ]
45
+
46
+
47
+ ------------------------------------------
48
+ ?INCLUDE 'scene_thinkers'
49
+ ------------------------------------------
50
+
51
+ scene_thinkers.thinker_spawn_0CEA9B+=: thinker-spawn < #00, @h_epilogue_thinker >
52
+
@@ -1,3 +1,22 @@
1
+ ; ==============================================================================
2
+ ; New Game Plus - fifth diary menu option and carry-over load
3
+ ; ==============================================================================
4
+ ; What it does: When DiaryScanSramSlots sees epilogue flag ($0DC6), enables a
5
+ ; fifth tab "New Game +"; confirm loads slot then clears most WRAM progress
6
+ ; while keeping selected carry-over state; extends window DMA for 5th highlight.
7
+ ; Vanilla behavior: Four diary tabs only; DiaryMenuInit always printed 4-option
8
+ ; dialog; tab dispatch had four handlers; SRAM scan did not set menu flag $20.
9
+ ; Hooks (overrides): sFA_diary_menu.DiaryMenuInit, DiaryMainMenuEntry,
10
+ ; DiaryTabCursorUp/Down, DiaryTabConfirm, diary_tab_dispatch_table,
11
+ ; DiaryScanSramSlots (+ DiaryScanSramSlots_StoreLastUsed, DiaryScanSramLoop, DiaryScanSramSlots_ChecksumMismatch);
12
+ ; diary_menu_window_dma.DiaryBandTab3PlusQueue (fifth tab window band).
13
+ ; Adds: diary_ngp_option, diary_ngp_confirm, diary_ngp_str; dma_data_extra table.
14
+ ; Depends on: sFA_diary_menu, chunk_03BAE1, thinker_00BBAF include, LoadGameState_Scene.
15
+ ; State: $0D92/$0D96/$0D98 cursors; $0D98 tab index (5 entries when $20 set);
16
+ ; $0DC6 per-slot NGP flag; clears $0A00-$0B28 ranges on NGP confirm.
17
+ ; Hazards: DiaryScanSramSlots override is large; COP/C2 camera path; sets
18
+ ; playerFlags $2800 on init; NGP confirm calls ApplySoundAndRemap after load.
19
+ ; ==============================================================================
1
20
  ?BANK 0B
2
21
 
3
22
  ?INCLUDE 'system_strings'
@@ -107,7 +126,7 @@ diary_ngp_str `[DLG:6,A][SIZ:A,5]Start Journey[N]Erase Trip Diary[N]Copy Tri
107
126
  ?INCLUDE 'sFA_diary_menu'
108
127
  --------------------------------------------------
109
128
 
110
- DiaryMenuInit! {
129
+ sFA_diary_menu.DiaryMenuInit! {
111
130
  LDA #$0000
112
131
  STA $7F0A00
113
132
  SEP #$20
@@ -166,37 +185,37 @@ DiaryMenuInit! {
166
185
  STZ $18
167
186
  COP [C1]
168
187
  LDA $0654
169
- BNE loc_0BE2CA
188
+ BNE DiaryMenuSceneReadyJoin
170
189
  RTL
171
190
  }
172
191
 
173
192
  -----------------------------------------------
174
193
 
175
- DiaryTabCursorUp! {
194
+ sFA_diary_menu.DiaryTabCursorUp! {
176
195
  COP [06] ( #10 )
177
196
  LDA $20
178
197
  BEQ diary_main_dec_normal
179
198
  LDA $0D98
180
199
  DEC
181
- BPL loc_0BE302
200
+ BPL DiaryTabCursorUpStore
182
201
  LDA #$0004
183
- BRA loc_0BE302
202
+ BRA DiaryTabCursorUpStore
184
203
  }
185
204
 
186
205
  diary_main_dec_normal {
187
206
  LDA $0D98
188
207
  DEC
189
- BPL loc_0BE302
208
+ BPL DiaryTabCursorUpStore
190
209
  LDA #$0003
191
210
  }
192
211
 
193
212
  ------------------------------------------------
194
213
 
195
- DiaryMainMenuEntry! {
214
+ sFA_diary_menu.DiaryMainMenuEntry! {
196
215
  LDA $20
197
216
  BEQ diary_print_normal
198
217
  COP [6B] ( &diary_ngp_str )
199
- BRA loc_0BE2D0
218
+ BRA DiaryTabSelectResetCursors
200
219
 
201
220
  diary_print_normal:
202
221
  COP [6B] ( &dialogstring_0BF3F4 )
@@ -204,29 +223,29 @@ DiaryMainMenuEntry! {
204
223
 
205
224
  ------------------------------------------------
206
225
 
207
- DiaryTabCursorDown! {
226
+ sFA_diary_menu.DiaryTabCursorDown! {
208
227
  COP [06] ( #10 )
209
228
  LDA $20
210
229
  BEQ diary_main_inc_normal
211
230
  LDA $0D98
212
231
  INC
213
232
  CMP #$0005
214
- BCC loc_0BE31E
233
+ BCC DiaryTabCursorDownStore
215
234
  LDA #$0000
216
- BRA loc_0BE31E
235
+ BRA DiaryTabCursorDownStore
217
236
  }
218
237
 
219
238
  diary_main_inc_normal {
220
239
  LDA $0D98
221
240
  INC
222
241
  CMP #$0004
223
- BCC loc_0BE31E
242
+ BCC DiaryTabCursorDownStore
224
243
  LDA #$0000
225
244
  }
226
245
 
227
246
  -----------------------------------------------
228
247
 
229
- DiaryTabConfirm! {
248
+ sFA_diary_menu.DiaryTabConfirm! {
230
249
  COP [06] ( #11 )
231
250
  LDA $0656
232
251
  ORA $0658
@@ -236,10 +255,10 @@ DiaryTabConfirm! {
236
255
  STA $0000
237
256
  LDA #$FFFF
238
257
  STA $0D98
239
- COP [D9] ( #$0000, &code_list_0BE34C )
258
+ COP [D9] ( #$0000, &diary_tab_dispatch_table )
240
259
  }
241
260
 
242
- code_list_0BE34C! [
261
+ sFA_diary_menu.diary_tab_dispatch_table! [
243
262
  &DiaryStartJourney ;00
244
263
  &DiaryEraseTab ;01
245
264
  &DiaryCopyTab ;02
@@ -250,7 +269,7 @@ code_list_0BE34C! [
250
269
  -----------------------------------------------
251
270
  ;Code for loading diary data into temp variables
252
271
 
253
- DiaryScanSramSlots! {
272
+ sFA_diary_menu.DiaryScanSramSlots! {
254
273
  PHX
255
274
  LDA #$0000
256
275
  STA $0D74
@@ -277,14 +296,14 @@ DiaryScanSramSlots! {
277
296
  STZ $20
278
297
  LDA $306000
279
298
  CMP #$0003
280
- BCC loc_0BEDA3
299
+ BCC DiaryScanSramSlots_StoreLastUsed
281
300
  LDA #$0000
282
301
  STA $306000
283
302
 
284
- loc_0BEDA3!:
303
+ sFA_diary_menu.DiaryScanSramSlots_StoreLastUsed!:
285
304
  STA $0D8C
286
305
 
287
- DiaryScanSramLoop!:
306
+ sFA_diary_menu.DiaryScanSramLoop!:
288
307
  LDA $24
289
308
  XBA
290
309
  ASL
@@ -300,7 +319,7 @@ DiaryScanSramSlots! {
300
319
 
301
320
  diary_noload:
302
321
  CLC
303
- JMP loc_0BEE12
322
+ JMP DiaryScanSramSlots_NextSlot
304
323
 
305
324
  diary_preload:
306
325
  PHX
@@ -360,7 +379,7 @@ DiaryScanSramSlots! {
360
379
  SEC
361
380
  }
362
381
 
363
- loc_0BEE11! {
382
+ sFA_diary_menu.DiaryScanSramSlots_ChecksumMismatch! {
364
383
  }
365
384
 
366
385
 
@@ -369,10 +388,10 @@ loc_0BEE11! {
369
388
  ------------------------------------------------
370
389
  ;Enable 5th menu option highlight
371
390
 
372
- loc_00BC45! {
391
+ diary_menu_window_dma.DiaryBandTab3PlusQueue! {
373
392
  DEC
374
393
  BNE code_extra
375
- COP [02] ( @dma_channel_00BC8D, #26 )
394
+ COP [02] ( @diary_band_tab3, #26 )
376
395
  RTL
377
396
  }
378
397
 
Binary file