Skip to content

Commit 20ef2b9

Browse files
committed
Add PAL Debug option to NTSC
1 parent 0f50b93 commit 20ef2b9

File tree

9 files changed

+89
-26
lines changed

9 files changed

+89
-26
lines changed

Diff for: src/cutscenes.asm

+2-1
Original file line numberDiff line numberDiff line change
@@ -1592,7 +1592,8 @@ cutscenes_mb_escape_earthquake_start:
15921592

15931593
cutscenes_mb_custom_damage:
15941594
{
1595-
LDA !sram_suit_properties : CMP #$0004 : BPL .dash_custom_damage
1595+
LDA !sram_suit_properties : AND !SUIT_PROPERTIES_MASK
1596+
CMP #$0004 : BPL .dash_custom_damage
15961597
JML $A6D453
15971598

15981599
.dash_custom_damage

Diff for: src/damage.asm

+35-3
Original file line numberDiff line numberDiff line change
@@ -163,15 +163,47 @@ damage_overwritten_movement_routine:
163163

164164
periodic_damage_table:
165165
if !FEATURE_PAL
166-
dw $E9CB ; vanilla routine
167-
else
168-
dw $E9CE ; vanilla routine
166+
dw $E9CB
167+
else ; vanilla routine
168+
dw $E9CE
169169
endif
170170
dw periodic_damage_balanced
171171
dw periodic_damage_progressive
172172
dw periodic_damage_progressive
173173
dw periodic_damage_dash_recall
174174
dw periodic_damage_heat_shield
175+
if !FEATURE_PAL
176+
dw $E9CB
177+
dw $E9CB
178+
else ; vanilla routine
179+
dw $E9CE
180+
dw $E9CE
181+
endif
182+
dw periodic_damage_pal_debug
183+
dw periodic_damage_pal_debug
184+
dw periodic_damage_pal_debug
185+
dw periodic_damage_pal_debug
186+
dw periodic_damage_pal_debug
187+
dw periodic_damage_pal_debug
188+
dw periodic_damage_pal_debug
189+
dw periodic_damage_pal_debug
190+
191+
periodic_damage_pal_debug:
192+
{
193+
; If we are here then the PAL debug flag was set
194+
; First execute the correct periodic damage routine
195+
LDA !sram_suit_properties : AND !SUIT_PROPERTIES_MASK
196+
ASL : TAX : JSR (periodic_damage_table,X)
197+
198+
; Now jump to demo recorder routine, but first fix the stack
199+
; Skip over an RTS and pull X from stack
200+
PLA : PLX
201+
if !FEATURE_PAL
202+
JMP $E75B
203+
else
204+
JMP $E75E
205+
endif
206+
}
175207

176208
periodic_damage_balanced:
177209
{

Diff for: src/defines.asm

+5
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@
221221
!ram_seed_Y = !WRAM_MENU_START+$62
222222

223223
!ram_timers_autoupdate = !WRAM_MENU_START+$64
224+
!ram_cm_suit_properties = !WRAM_MENU_START+$66
224225

225226
; ^ FREE SPACE ^ up to +$7E
226227

@@ -526,6 +527,7 @@
526527
!IGT_SECONDS = $09DC
527528
!IGT_MINUTES = $09DE
528529
!IGT_HOURS = $09E0
530+
!PAL_DEBUG_MOVEMENT = $09E6
529531
!SAMUS_AUTO_CANCEL = $0A04
530532
!SAMUS_LAST_HP = $0A06
531533
!SAMUS_DOUBLE_JUMP = $0A14 ; Only used during demos in vanilla
@@ -692,6 +694,9 @@ endif
692694
!ACTION_DYNAMIC = #$0026
693695
!ACTION_MANAGE_PRESETS = #$0028
694696

697+
!SUIT_PROPERTIES_MASK = #$0007
698+
!SUIT_PROPRETIES_PAL_DEBUG_FLAG = #$0008
699+
695700
!TOP_DISPLAY_VANILLA = #$0002
696701

697702
!ROOM_LAYOUT_MAGNET_STAIRS = #$0001

Diff for: src/main.asm

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ lorom
1212

1313
!VERSION_MAJOR = 2
1414
!VERSION_MINOR = 6
15-
!VERSION_BUILD = 0
15+
!VERSION_BUILD = 1
1616
!VERSION_REV = 0
1717

1818
table ../resources/normal.tbl

Diff for: src/mainmenu.asm

+39-18
Original file line numberDiff line numberDiff line change
@@ -1959,8 +1959,8 @@ misc_metronome_sfx:
19591959

19601960
misc_suit_properties:
19611961
dw !ACTION_CHOICE
1962-
dl #!sram_suit_properties
1963-
dw init_suit_properties_ram
1962+
dl #!ram_cm_suit_properties
1963+
dw .routine
19641964
db #$28, "Suit Properties", #$FF
19651965
db #$28, " VANILLA", #$FF
19661966
db #$28, " BALANCED", #$FF
@@ -1969,21 +1969,36 @@ misc_suit_properties:
19691969
db #$28, " DASHRECALL", #$FF
19701970
db #$28, " HEATSHIELD", #$FF
19711971
db #$FF
1972+
.routine
1973+
LDA !ram_cm_suit_properties : STA !sram_suit_properties
1974+
LDA !PAL_DEBUG_MOVEMENT : BNE init_suit_properties_ram
1975+
LDA !sram_suit_properties : ORA !SUIT_PROPRETIES_PAL_DEBUG_FLAG
1976+
STA !sram_suit_properties
1977+
; Fallthrough to init_suit_properties_ram
19721978

19731979
init_suit_properties_ram:
19741980
{
1981+
LDA !sram_suit_properties : BIT !SUIT_PROPRETIES_PAL_DEBUG_FLAG : BNE .palDebug
1982+
TDC : INC : STA !PAL_DEBUG_MOVEMENT
1983+
BRA .initProperties
1984+
1985+
.palDebug
1986+
STZ !PAL_DEBUG_MOVEMENT
1987+
1988+
.initProperties
19751989
; Default to both suits getting 50% damage reduction (gravity gets extra 50%)
19761990
; and both suits getting full heat protection
19771991
LDA #$0021 : STA !ram_suits_enemy_damage_check : STA !ram_suits_heat_damage_check
19781992

1979-
LDA !sram_suit_properties : CMP #$0002 : BMI .init_heat_damage
1993+
LDA !sram_suit_properties : AND !SUIT_PROPERTIES_MASK
1994+
CMP #$0002 : BMI .initHeatDamage
19801995

19811996
; Progressive, Complementary, and DASH Recall/Heat Shield
19821997
; give less enemy damage protection to gravity
19831998
LDA #$0001 : STA !ram_suits_enemy_damage_check
19841999

1985-
.init_heat_damage
1986-
LDA !sram_suit_properties : BEQ .end
2000+
.initHeatDamage
2001+
LDA !sram_suit_properties : AND !SUIT_PROPERTIES_MASK : BEQ .end
19872002

19882003
; Not vanilla, so only varia gets full heat protection
19892004
LDA #$0001 : STA !ram_suits_heat_damage_check
@@ -2000,7 +2015,8 @@ init_heat_damage_ram:
20002015
; Default to 0.25 damage per frame
20012016
LDA #$4000 : STA !ram_suits_heat_damage_value
20022017

2003-
LDA !sram_suit_properties : CMP #$0004 : BPL .dash_recall
2018+
LDA !sram_suit_properties : AND !SUIT_PROPERTIES_MASK
2019+
CMP #$0004 : BPL .dashRecall
20042020
CMP #$0003 : BEQ .complementary
20052021
RTL
20062022

@@ -2016,8 +2032,8 @@ init_heat_damage_ram:
20162032
LDA #$8000 : STA !ram_suits_heat_damage_value
20172033
RTL
20182034

2019-
.dash_recall
2020-
BNE .heat_shield
2035+
.dashRecall
2036+
BNE .heatShield
20212037

20222038
; If no gravity than nothing to do
20232039
LDA $09A2 : BIT #$0020 : BEQ .end
@@ -2029,18 +2045,18 @@ init_heat_damage_ram:
20292045
.end
20302046
RTL
20312047

2032-
.heat_shield
2033-
LDA !ROOM_ID : CMP #$B742 : BPL .no_damage : CMP #$AF13 : BMI .no_damage
2034-
CMP #$B1BA : BPL .heat_shield_damage : CMP #$AF40 : BPL .no_damage
2048+
.heatShield
2049+
LDA !ROOM_ID : CMP #$B742 : BPL .noDamage : CMP #$AF13 : BMI .noDamage
2050+
CMP #$B1BA : BPL .heatShieldDamage : CMP #$AF40 : BPL .noDamage
20352051

2036-
.heat_shield_damage
2052+
.heatShieldDamage
20372053
; We want Lower Norfair heat damage to be 50%
20382054
; However if gravity is equipped then the damage is already halved
20392055
LDA $09A2 : BIT #$0020 : BNE .end
20402056
LDA #$2000 : STA !ram_suits_heat_damage_value
20412057
RTL
20422058

2043-
.no_damage
2059+
.noDamage
20442060
TDC : STA !ram_suits_heat_damage_value
20452061
RTL
20462062
}
@@ -2886,9 +2902,7 @@ game_goto_debug:
28862902

28872903
DebugMenu:
28882904
dw #game_debugmode
2889-
if !FEATURE_PAL
28902905
dw #game_paldebug
2891-
endif
28922906
dw #game_debugbrightness
28932907
dw #game_invincibility
28942908
dw #game_pacifist
@@ -2901,10 +2915,17 @@ endif
29012915
game_debugmode:
29022916
%cm_toggle("Debug Mode", $7E05D1, #$0001, #0)
29032917

2904-
if !FEATURE_PAL
29052918
game_paldebug:
2906-
%cm_toggle_inverted("PAL Debug Movement", $7E09E6, #$0001, #0)
2907-
endif
2919+
%cm_toggle_inverted("PAL Debug Movement", $7E09E6, #$0001, .routine)
2920+
.routine
2921+
LDA !PAL_DEBUG_MOVEMENT : BNE .clearFlag
2922+
LDA !sram_suit_properties : ORA !SUIT_PROPRETIES_PAL_DEBUG_FLAG
2923+
BRA .set
2924+
.clearFlag
2925+
LDA !sram_suit_properties : AND !SUIT_PROPERTIES_MASK
2926+
.set
2927+
STA !sram_suit_properties
2928+
RTL
29082929

29092930
game_debugbrightness:
29102931
%cm_toggle("Debug CPU Brightness", $7E0DF4, #$0001, #0)

Diff for: src/menu.asm

+2
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@ cm_init:
157157

158158
JSL cm_calculate_max
159159
JSL cm_set_etanks_and_reserve
160+
LDA !sram_suit_properties : AND !SUIT_PROPERTIES_MASK
161+
STA !ram_cm_suit_properties
160162
RTS
161163
}
162164

Diff for: src/symbols.asm

+1
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ ram_seed_X = !ram_seed_X ; !WRAM_MENU_START+$60
215215
ram_seed_Y = !ram_seed_Y ; !WRAM_MENU_START+$62
216216

217217
ram_timers_autoupdate = !ram_timers_autoupdate ; !WRAM_MENU_START+$64
218+
ram_cm_suit_properties = !ram_cm_suit_properties ; !WRAM_MENU_START+$66
218219

219220
; ^ FREE SPACE ^ up to +$7E
220221

Diff for: web/data/changelog.mdx

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
- Use enemy ID to determine which enemies are cleared on preset load (2.6.0)
44
- Add boot-to-menu functionality (2.6.0)
55
- Use correct VRAM transfer mode for savestates (2.6.0)
6-
- General system improvements to enhance the user's experience (2.6.0)
6+
- Custom demos added (2.6.0)
7+
- PAL Debug option added to NTSC and is persistent (2.6.1)
78

89
# Version 2.5.x
910
- Added a separate version of savestates for MiSTer, Everdrives, and most modern emulators (not SNES Classic/VC) (2.5.0)

Diff for: web/data/help.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,9 @@ If you experience crashes or severe glitches when using savestates, your platfor
185185
| - Clear Minimap | Clears the map tile counter and all minimap data.
186186
| **Debug Settings** | Located within the Game menu
187187
| - Debug Mode | Toggles the debug mode. Note that debug mode shortcuts and features may not be well supported in the practice rom.
188+
| - PAL Debug Movement | Gives Samus extra movement correlated to the dpad input.
188189
| - Debug CPU Brightness | Toggles a built-in debug feature to darken the screen after the game is done processing the next frame. Useful for estimating CPU usage.
189-
| - Invincibility | Prevents Samus from taking damage or knockback
190-
| - PAL Debug Movement | PAL-only feature that gives Samus extra movement correlated to the dpad input.
190+
| - Invincibility | Prevents Samus from taking damage or knockback.
191191
| - Pacifist Mode | Reduces Samus' attack damage to zero, allowing for never-ending boss battles.
192192
| - Pseudo G-Mode | Disables PLMs to imitate the primary effect of G-Mode.
193193
| - Enable Projectiles | Toggles a built-in debug feature to disable enemy projectiles.

0 commit comments

Comments
 (0)