Skip to content

Commit

Permalink
Label Bank 0D, part 2, decompiled related Bank 0E functions
Browse files Browse the repository at this point in the history
  • Loading branch information
DrippingYellow authored and vulcandth committed Jan 29, 2025
1 parent d8c4cb6 commit 2e98bb8
Show file tree
Hide file tree
Showing 15 changed files with 1,224 additions and 977 deletions.
11 changes: 8 additions & 3 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 @@ -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_WRAPPING_MOVE
const SUBSTATUS_INVULNERABLE
const SUBSTATUS_CONFUSED

; wPlayerSubStatus4 or wEnemySubStatus4 bit flags
Expand All @@ -207,7 +212,7 @@ DEF ALL_STATUS EQU (1 << PSN) | (1 << BRN) | (1 << FRZ) | (1 << PAR) | SLP
const SUBSTATUS_DESTINY_BOND
const SUBSTATUS_CANT_RUN

; wPlayerScreens or wEnemyScreens bit flags
; wPlayerScreens or wEnemySafeguardCount bit flags
const_def
const SCREENS_SPIKES
const_skip
Expand Down
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
6 changes: 3 additions & 3 deletions constants/item_data_constants.asm
Original file line number Diff line number Diff line change
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
4 changes: 2 additions & 2 deletions data/items/attributes.asm
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ ItemAttributes::
; ITEM_UP_GRADE
item_attribute 10, HELD_48, 10, CANT_SELECT, ITEM, ITEMMENU_NOUSE, ITEMMENU_NOUSE
; ITEM_STRANGE_THREAD
item_attribute 10, HELD_BRIGHTPOWDER, 30, CANT_SELECT, ITEM, ITEMMENU_NOUSE, ITEMMENU_NOUSE
item_attribute 10, HELD_STRANGE_THREAD, 30, CANT_SELECT, ITEM, ITEMMENU_NOUSE, ITEMMENU_NOUSE
; ITEM_BIG_LEAF
item_attribute 10, HELD_GRASS_BOOST, 20, CANT_SELECT, ITEM, ITEMMENU_NOUSE, ITEMMENU_NOUSE
; ITEM_QUICK_NEEDLE
Expand Down Expand Up @@ -247,7 +247,7 @@ ItemAttributes::
; ITEM_THICK_CLUB
item_attribute 10, HELD_GROUND_BOOST, 20, CANT_SELECT, ITEM, ITEMMENU_NOUSE, ITEMMENU_NOUSE
; ITEM_FOCUS_ORB
item_attribute 10, HELD_FOCUS_BAND, 30, CANT_SELECT, ITEM, ITEMMENU_NOUSE, ITEMMENU_NOUSE
item_attribute 10, HELD_FOCUS_ORB, 30, CANT_SELECT, ITEM, ITEMMENU_NOUSE, ITEMMENU_NOUSE
; ITEM_78
item_attribute 0, HELD_NONE, 0, NO_LIMITS, 0, ITEMMENU_NOUSE, ITEMMENU_NOUSE
; ITEM_DETECT_ORB
Expand Down
6 changes: 3 additions & 3 deletions data/predef_pointers.inc
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ GiveItemPredef::
add_predef GetTMHMMove
add_predef LinkTextboxAtHL
add_predef Function2d663
add_predef Function3d5ce
add_predef UpdatePlayerHUD
add_predef PlaceGraphic
add_predef Function3f068 ; 20
add_predef Function3f04a
add_predef AnyPartyAlive
add_predef Function3d67c
add_predef UpdateEnemyHUD
add_predef Function3e1a4
add_predef Function3ef19
add_predef Function3e874
Expand All @@ -64,7 +64,7 @@ GiveItemPredef::
add_predef CopyMonToTempMon
add_predef ListMoves
add_predef Function50bcd
add_predef Function50b92
add_predef PlaceNonFaintStatus
add_predef Function508c4
add_predef PartyMenuInBattle_Setup
add_predef PartyMenuInBattle
Expand Down
20 changes: 20 additions & 0 deletions data/types/type_boost_items.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
TypeBoostItems:
db HELD_NORMAL_BOOST, TYPE_NORMAL ; SHARP_FANG/STICK
db HELD_FIGHTING_BOOST, TYPE_FIGHTING ; POWER_BRACER
db HELD_FLYING_BOOST, TYPE_FLYING ; BLACK_FEATHER
db HELD_POISON_BOOST, TYPE_POISON ; TOXIC_NEEDLE/POISON_FANG
db HELD_GROUND_BOOST, TYPE_GROUND ; THICK_CLUB
db HELD_ROCK_BOOST, TYPE_ROCK ; SHARP_STONE
db HELD_BUG_BOOST, TYPE_BUG ; ATTACK_NEEDLE
db HELD_GHOST_BOOST, TYPE_GHOST ; SPIKE
db HELD_FIRE_BOOST, TYPE_FIRE ; FIRE_CLAW
db HELD_WATER_BOOST, TYPE_WATER ; WET_HORN
db HELD_GRASS_BOOST, TYPE_GRASS ; BIG_LEAF
db HELD_ELECTRIC_BOOST, TYPE_ELECTRIC ; THUNDER_FANG
db HELD_PSYCHIC_BOOST, TYPE_PSYCHIC ; MIGRAINE_SEED
db HELD_ICE_BOOST, TYPE_ICE ; ICE_FANG
db HELD_DRAGON_BOOST, TYPE_DRAGON ; DRAGON_FANG
; Boosting effects for new types not implemented yet in this build:
; db HELD_DARK_BOOST, TYPE_DARK
; db HELD_METAL_BOOST, TYPE_METAL
db -1
18 changes: 13 additions & 5 deletions engine/dumps/bank03.asm
Original file line number Diff line number Diff line change
Expand Up @@ -1850,12 +1850,14 @@ CalcMonStatC:
jr nz, .not_spdef
dec hl
dec hl
.not_spdef
sla c
ld a, d
and a
jr z, .no_stat_exp
add hl, bc

.sqrt_loop
xor a
ldh [hMultiplicand], a
Expand Down Expand Up @@ -1923,6 +1925,7 @@ CalcMonStatC:
add b
pop bc
jr .GotDV

.Attack
ld a, [hl]
swap a
Expand Down Expand Up @@ -1952,6 +1955,7 @@ CalcMonStatC:
ld e, a
jr nc, .no_overflow_1
inc d

.no_overflow_1
sla e
rl d
Expand All @@ -1961,6 +1965,7 @@ CalcMonStatC:
add e
jr nc, .no_overflow_2
inc d
.no_overflow_2
ldh [hMultiplicand + 2], a
ld a, d
Expand Down Expand Up @@ -2009,21 +2014,24 @@ CalcMonStatC:
ldh a, [hDividend+2]
inc a
ldh [hDividend+2], a

.no_overflow_4
ldh a, [hDividend+2]
cp HIGH(MAX_STAT_VALUE + 1) + 1
jr nc, .sub_e094
jr nc, .max_stat
cp HIGH(MAX_STAT_VALUE + 1)
jr c, .sub_e09c
jr c, .stat_value_okay
ldh a, [hDividend+3]
cp LOW(MAX_STAT_VALUE + 1)
jr c, .sub_e09c
.sub_e094
jr c, .stat_value_okay

.max_stat
ld a, HIGH(MAX_STAT_VALUE)
ldh [hDividend+2], a
ld a, LOW(MAX_STAT_VALUE)
ldh [hDividend+3], a
.sub_e09c

.stat_value_okay
pop bc
pop de
pop hl
Expand Down
Loading

0 comments on commit 2e98bb8

Please sign in to comment.