Skip to content

Commit

Permalink
Finish labelling Bank 0D (#113)
Browse files Browse the repository at this point in the history
* Labelling Bank 0D, part 1

* Untangled math HRAM variables

* Bank 10's out of the bag, I guess

* Label Bank 0D, part 2, decompiled related Bank 0E functions

* Fix data outside section

* Finished labeling Bank 0D and connected variables and functions

---------

Co-authored-by: vulcandth <vulcandth@gmail.com>
  • Loading branch information
DrippingYellow and vulcandth authored Feb 15, 2025
1 parent ce247cc commit 9e05bc9
Show file tree
Hide file tree
Showing 52 changed files with 8,096 additions and 7,792 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

# build artifacts
/build
rgbdscheck.o

# build tools
tools/scan_includes
Expand Down
3 changes: 3 additions & 0 deletions constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ INCLUDE "macros/scripts.asm"
INCLUDE "macros/queue.asm"
INCLUDE "macros/maps.asm"

INCLUDE "macros/battle_commands.asm"
INCLUDE "macros/asserts.asm"

INCLUDE "constants/audio_constants.asm"
INCLUDE "constants/gfx_constants.asm"
INCLUDE "constants/hardware_constants.asm"
Expand Down
27 changes: 14 additions & 13 deletions constants/battle_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ DEF EFFECTIVE EQU 10
DEF NOT_VERY_EFFECTIVE EQU 05
DEF NO_EFFECT EQU 00

; wTypeModifier
DEF EFFECTIVENESS_MASK EQU %01111111
const_def 7
shift_const STAB_DAMAGE

; wPlayerStatLevels and wEnemyStatLevels indexes (see wram.asm)
; GetStatName arguments (see data/battle/stat_names.asm)
const_def
Expand Down Expand Up @@ -63,7 +68,7 @@ DEF MOVE_LENGTH EQU const_value
const STAT_SATK
DEF NUM_EXP_STATS EQU const_value - 1
const STAT_SDEF
DEF NUM_STATS EQU const_value
DEF NUM_STATS EQU const_value - 1
DEF NUM_BATTLE_STATS EQU NUM_STATS - 1 ; don't count HP
DEF STAT_SPC EQU STAT_SATK

Expand Down Expand Up @@ -181,8 +186,8 @@ DEF ALL_STATUS EQU (1 << PSN) | (1 << BRN) | (1 << FRZ) | (1 << PAR) | SLP
const SUBSTATUS_IN_LOOP
const SUBSTATUS_FLINCHED
const SUBSTATUS_CHARGED
const SUBSTATUS_UNDERGROUND
const SUBSTATUS_FLYING
const SUBSTATUS_USING_TRAPPING_MOVE
const SUBSTATUS_INVULNERABLE
const SUBSTATUS_CONFUSED

; wPlayerSubStatus4 or wEnemySubStatus4 bit flags
Expand All @@ -199,8 +204,8 @@ DEF ALL_STATUS EQU (1 << PSN) | (1 << BRN) | (1 << FRZ) | (1 << PAR) | SLP
; wPlayerSubStatus5 or wEnemySubStatus5 bit flags
const_def
const SUBSTATUS_TOXIC
const_skip
const_skip
const SUBSTATUS_LIGHT_SCREEN
const SUBSTATUS_REFLECT
const SUBSTATUS_TRANSFORMED
const SUBSTATUS_ENCORED
const SUBSTATUS_LOCK_ON
Expand All @@ -210,7 +215,7 @@ DEF ALL_STATUS EQU (1 << PSN) | (1 << BRN) | (1 << FRZ) | (1 << PAR) | SLP
; wPlayerScreens or wEnemyScreens bit flags
const_def
const SCREENS_SPIKES
const_skip
const SCREENS_SANDSTORM
const SCREENS_SAFEGUARD
const SCREENS_LIGHT_SCREEN
const SCREENS_REFLECT
Expand All @@ -220,10 +225,6 @@ DEF ALL_STATUS EQU (1 << PSN) | (1 << BRN) | (1 << FRZ) | (1 << PAR) | SLP
const WEATHER_NONE
const WEATHER_RAIN
const WEATHER_SUN
const WEATHER_SANDSTORM
const WEATHER_RAIN_END
const WEATHER_SUN_END
const WEATHER_SANDSTORM_END

; wBattleAction
const_def
Expand All @@ -241,14 +242,14 @@ DEF ALL_STATUS EQU (1 << PSN) | (1 << BRN) | (1 << FRZ) | (1 << PAR) | SLP
const BATTLEACTION_B
const BATTLEACTION_C
const BATTLEACTION_D
const BATTLEACTION_E
const BATTLEACTION_STRUGGLE
const BATTLEACTION_FORFEIT

; wBattleResult
const_def
const WIN
const LOSE
const DRAW
const LOSE
const WIN

DEF BATTLERESULT_BOX_FULL EQU 7
DEF BATTLERESULT_BITMASK EQU (1 << BATTLERESULT_BOX_FULL)
2 changes: 1 addition & 1 deletion constants/charmap.asm
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@

charmap "<LV>", $6e

charmap "<DO>", $70 ; hiragana small do, unused
charmap "<DO>", $70 ; hiragana small do
charmap "◀", $71

charmap "<ID>", $73
Expand Down
2 changes: 1 addition & 1 deletion constants/item_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
const ITEM_STIMULUS_ORB ; 74 *BLUE_CARD
const ITEM_CALM_BERRY ; 75 *MIRACLE_SEED
const ITEM_THICK_CLUB ; 76
const ITEM_FOCUS_ORB ; 77 FOCUS_BAND
const ITEM_FOCUS_ORB ; 77 FOCUS_ORB
const ITEM_78 ; 78
const ITEM_DETECT_ORB ; 79 *ENERGYPOWDER
const ITEM_LONG_TONGUE ; 7a *ENERGY_ROOT
Expand Down
12 changes: 6 additions & 6 deletions constants/item_data_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,18 @@ DEF MAX_PC_ITEMS EQU 50
const_def
const HELD_NONE
const HELD_BERRY
const HELD_2
const HELD_FULL_RESTORE
const HELD_LEFTOVERS
const HELD_4
const HELD_5
const HELD_REVIVE
const HELD_RESTORE_PP
const HELD_RESTORE_ALL_PP
const HELD_CLEANSE_TAG

const_next 10
const HELD_HEAL_POISON
const HELD_HEAL_FREEZE
const HELD_HEAL_BURN
const HELD_HEAL_FREEZE
const HELD_HEAL_SLEEP
const HELD_HEAL_PARALYZE
const HELD_HEAL_STATUS
Expand Down Expand Up @@ -114,7 +114,7 @@ DEF MAX_PC_ITEMS EQU 50
const HELD_ICE_BOOST
const HELD_DRAGON_BOOST
const HELD_DARK_BOOST
const HELD_STEEL_BOOST
const HELD_METAL_BOOST

const_next 70
const HELD_CATCH_CHANCE
Expand All @@ -124,6 +124,6 @@ DEF MAX_PC_ITEMS EQU 50
const HELD_QUICK_CLAW
const HELD_FLINCH
const HELD_AMULET_COIN
const HELD_BRIGHTPOWDER
const HELD_STRANGE_THREAD
const HELD_78
const HELD_FOCUS_BAND
const HELD_FOCUS_ORB
15 changes: 15 additions & 0 deletions constants/misc_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@
DEF FALSE EQU 0
DEF TRUE EQU 1

; time of day boundaries
DEF MORN_HOUR EQU 6 ; 6 AM
DEF DAY_HOUR EQU 9 ; 9 AM
DEF NITE_HOUR EQU 15 ; 3 PM
DEF NOON_HOUR EQU 12 ; 12 PM
DEF MAX_HOUR EQU 24 ; 12 AM

; wTimeOfDay::
const_def
shift_const DAY ; 0
shift_const NITE ; 1
shift_const DARKNESS ; 2
shift_const MORN ; 3
DEF NUM_DAYTIMES EQU const_value

; RedrawRowOrColumn functions
DEF REDRAW_COL EQU 1
DEF REDRAW_ROW EQU 2
Expand Down
38 changes: 19 additions & 19 deletions constants/move_effect_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@
const EFFECT_MIRROR_MOVE
const EFFECT_ATTACK_UP
const EFFECT_DEFENSE_UP
const EFFECT_0C
const EFFECT_SPEED_UP
const EFFECT_SP_ATK_UP
const EFFECT_0E
const EFFECT_0F
const EFFECT_SP_DEF_UP
const EFFECT_ACCURACY_UP
const EFFECT_EVASION_UP
const EFFECT_SWIFT
const EFFECT_ATTACK_DOWN
const EFFECT_DEFENSE_DOWN
const EFFECT_SPEED_DOWN
const EFFECT_MEGAPHONE
const EFFECT_16
const EFFECT_SP_ATK_DOWN
const EFFECT_SP_DEF_DOWN
const EFFECT_ACCURACY_DOWN
const EFFECT_TEMPT
const EFFECT_EVASION_DOWN
const EFFECT_RESET_STATS
const EFFECT_BIDE
const EFFECT_RAMPAGE
Expand Down Expand Up @@ -53,28 +53,28 @@
const EFFECT_ATTACK_UP_2
const EFFECT_DEFENSE_UP_2
const EFFECT_SPEED_UP_2
const EFFECT_35
const EFFECT_SP_ATK_UP_2
const EFFECT_SP_DEF_UP_2
const EFFECT_37
const EFFECT_38
const EFFECT_ACCURACY_UP_2
const EFFECT_EVASION_UP_2
const EFFECT_TRANSFORM
const EFFECT_ATTACK_DOWN_2
const EFFECT_DEFENSE_DOWN_2
const EFFECT_3C
const EFFECT_3D
const EFFECT_3E
const EFFECT_3F
const EFFECT_40
const EFFECT_SPEED_DOWN_2
const EFFECT_SP_ATK_DOWN_2
const EFFECT_SP_DEF_DOWN_2
const EFFECT_ACCURACY_DOWN_2
const EFFECT_EVASION_DOWN_2
const EFFECT_REFLECT
const EFFECT_POISON
const EFFECT_PARALYZE
const EFFECT_ATTACK_DOWN_HIT
const EFFECT_ACID
const EFFECT_DEFENSE_DOWN_HIT
const EFFECT_SPEED_DOWN_HIT
const EFFECT_47
const EFFECT_SP_ATK_DOWN_HIT
const EFFECT_SP_DEF_DOWN_HIT
const EFFECT_49
const EFFECT_4A
const EFFECT_ACCURACY_DOWN_HIT
const EFFECT_EVASION_DOWN_HIT
const EFFECT_4B
const EFFECT_CONFUSE_HIT
const EFFECT_POISON_MULTI_HIT
Expand All @@ -96,7 +96,7 @@
const EFFECT_CONVERSION2
const EFFECT_LOCK_ON
const EFFECT_SKETCH
const EFFECT_60
const EFFECT_DEFROST_OPPONENT
const EFFECT_SLEEP_TALK
const EFFECT_DESTINY_BOND
const EFFECT_REVERSAL
Expand Down
2 changes: 2 additions & 0 deletions constants/script_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
DEF PLAYER EQU 0
DEF FOLLOWER EQU 1

DEF STRING_BUFFER_LENGTH EQU 10

; Script IDs
const_def
const SCRIPT_ID_00 ; 00
Expand Down
43 changes: 36 additions & 7 deletions constants/wram_constants.asm
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
DEF TEXT_DELAY_MASK EQU %111
const_def 3
const SGB_BORDER ; 3
const NO_TEXT_SCROLL ; 4
const STEREO ; 5
const BATTLE_SHIFT ; 6
const BATTLE_SCENE ; 7

DEF TEXT_DELAY_FAST EQU %001 ; 1
DEF TEXT_DELAY_MED EQU %011 ; 3
DEF TEXT_DELAY_SLOW EQU %101 ; 5

; wTextboxFrame::
const_def
const FRAME_1 ; 0
const FRAME_2 ; 1
const FRAME_3 ; 2
const FRAME_4 ; 3
const FRAME_5 ; 4
const FRAME_6 ; 5
const FRAME_7 ; 6
const FRAME_8 ; 7
DEF NUM_FRAMES EQU const_value

; wMonType::
const_def
const PARTYMON ; 0
const OTPARTYMON ; 1
const BOXMON ; 2
const TEMPMON ; 3
const WILDMON ; 4

; wWalkingDirection::
const_def -1
const STANDING ; -1
Expand All @@ -7,13 +39,10 @@
const RIGHT ; 3
DEF NUM_DIRECTIONS EQU const_value

; wMonType::
const_def
const PARTYMON ; 0
const OTPARTYMON ; 1
const BOXMON ; 2
const TEMPMON ; 3
const WILDMON ; 4
DEF DOWN_MASK EQU 1 << DOWN
DEF UP_MASK EQU 1 << UP
DEF LEFT_MASK EQU 1 << LEFT
DEF RIGHT_MASK EQU 1 << RIGHT

; wJohtoBadges:: ; d163
const_def
Expand Down
26 changes: 26 additions & 0 deletions data/battle/held_consumables.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
ConsumableEffects:
db HELD_BERRY
db HELD_FULL_RESTORE
db HELD_REVIVE

db HELD_HEAL_POISON
db HELD_HEAL_BURN
db HELD_HEAL_FREEZE
db HELD_HEAL_SLEEP
db HELD_HEAL_PARALYZE
db HELD_HEAL_STATUS

db HELD_30
db HELD_ATTACK_UP
db HELD_DEFENSE_UP
db HELD_SPEED_UP
db HELD_SP_ATTACK_UP
db HELD_SP_DEFENSE_UP
db HELD_ACCURACY_UP
db HELD_EVASION_UP
db HELD_38

db HELD_71
db HELD_ESCAPE
db HELD_CRITICAL_UP
db -1
18 changes: 18 additions & 0 deletions data/battle/stat_multipliers.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
; Multiplier ratios for all stats from modifier -6 to +6

; This table is INCLUDEd thrice in different ROM banks.

db 25, 100 ; -6 = 25%
db 28, 100 ; -5 = 28%
db 33, 100 ; -4 = 33%
db 40, 100 ; -3 = 40%
db 50, 100 ; -2 = 50%
db 66, 100 ; -1 = 66%
db 1, 1 ; 0 = 100%
db 15, 10 ; +1 = 150%
db 2, 1 ; +2 = 200%
db 25, 10 ; +3 = 250%
db 3, 1 ; +4 = 300%
db 35, 10 ; +5 = 350%
db 4, 1 ; +6 = 400%
9 changes: 9 additions & 0 deletions data/battle/stat_names.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
StatNames:
; entries correspond to stat ids
db "こうげきりょく@" ; ATTACK
db "ぼうぎょりょく@" ; DEFENSE
db "すばやさ@" ; SPEED
db "とくしゅこうげき@" ; SP.ATK
db "とくしゅぼうぎょ@" ; SP.DEF
db "めいちゅうりつ@" ; ACCURACY
db "かいひりつ@" ; EVASION
Loading

0 comments on commit 9e05bc9

Please sign in to comment.