Refactor sprite logging macros and enhance debug output for better traceability

This commit is contained in:
scawful
2025-10-03 13:49:45 -04:00
parent 07e5717ea2
commit f2b92e816b
3 changed files with 217 additions and 126 deletions

View File

@@ -1,8 +1,18 @@
; Defines common macros for the project.
; Set to 1 to enable debug printing, 0 to disable.
; Set to 1 to enable global debug printing, 0 to disable.
!DEBUG = 1
; --- Section-specific Log Flags ---
; Set these to 1 to see detailed logs for that section, or 0 to hide them.
!LOG_MUSIC = 1
!LOG_OVERWORLD = 1
!LOG_DUNGEON = 1
!LOG_SPRITES = 1
!LOG_MASKS = 1
!LOG_ITEMS = 1
!LOG_MENU = 1
; Prints a message and the current PC value during assembly, but only if !DEBUG is enabled.
; Usage: %print_debug("My message")
macro print_debug(message)
@@ -10,3 +20,27 @@ macro print_debug(message)
print "<message> ", pc
endif
endmacro
; Prints a header for a major section.
; Usage: %log_section("Sprites", !LOG_SPRITES)
macro log_section(name, flag)
if !DEBUG == 1 && <flag> == 1
print "\n--- <name> ---"
endif
endmacro
; Prints a standardized log message for the start of a named block.
; Usage: %log_start("MySprite", !LOG_SPRITES)
macro log_start(name, flag)
if !DEBUG == 1 && <flag> == 1
print "$", pc, " > <name>"
endif
endmacro
; Prints a standardized log message for the end of a named block.
; Usage: %log_end("MySprite", !LOG_SPRITES)
macro log_end(name, flag)
if !DEBUG == 1 && <flag> == 1
print "$", pc, " < <name>"
endif
endmacro