Finish labelling bank $0f (#127)
Some checks failed
CI / build (push) Has been cancelled

* Split bank $0f into engine/battle/core.asm and engine/overworld/wildmons.asm
* Split wildmon probabilities into separate data/wild/probabilities.inc file for consistency
This commit is contained in:
DrippingYellow 2026-01-21 17:43:18 -06:00 committed by GitHub
parent 7f3e77acbe
commit 452a322140
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
23 changed files with 7147 additions and 6964 deletions

View File

@ -234,13 +234,19 @@ DEF ALL_STATUS EQU (1 << PSN) | (1 << BRN) | (1 << FRZ) | (1 << PAR) | SLP
const BATTLEACTION_SWITCH4 const BATTLEACTION_SWITCH4
const BATTLEACTION_SWITCH5 const BATTLEACTION_SWITCH5
const BATTLEACTION_SWITCH6 const BATTLEACTION_SWITCH6
const BATTLEACTION_A const_skip
const BATTLEACTION_B const_skip
const BATTLEACTION_C const_skip
const BATTLEACTION_D const BATTLEACTION_SKIPTURN
const BATTLEACTION_STRUGGLE const BATTLEACTION_STRUGGLE
const BATTLEACTION_FORFEIT const BATTLEACTION_FORFEIT
; wBattlePlayerAction
const_def
const BATTLEPLAYERACTION_USEMOVE
const BATTLEPLAYERACTION_USEITEM
const BATTLEPLAYERACTION_SWITCH
; wBattleEnded ; wBattleEnded
const_def const_def
const WIN const WIN

View File

@ -19,6 +19,8 @@
; 6 - ??? E - unused ; 6 - ??? E - unused
; 7 - Warps F - unused ; 7 - Warps F - unused
; TODO: Replace all instances of COLLISION with COLL for consistency with pokegold.
DEF COLLISION_TYPE_MASK EQU $f0 DEF COLLISION_TYPE_MASK EQU $f0
DEF COLLISION_SUBTYPE_MASK EQU $07 DEF COLLISION_SUBTYPE_MASK EQU $07
DEF COLLISION_WATER_SUBTYPE_MASK EQU $03 DEF COLLISION_WATER_SUBTYPE_MASK EQU $03
@ -42,7 +44,7 @@ DEF OLD_COLLISION_WATER2_S EQU $40
DEF OLD_COLLISION_ROCK EQU $51 DEF OLD_COLLISION_ROCK EQU $51
DEF OLD_COLLISION_CARPED EQU $60 DEF OLD_COLLISION_CARPET EQU $60
DEF OLD_COLLISION_DOOR EQU $61 DEF OLD_COLLISION_DOOR EQU $61
DEF OLD_COLLISION_SIGNPOST EQU $70 DEF OLD_COLLISION_SIGNPOST EQU $70
@ -57,14 +59,17 @@ DEF OLD_COLLISION_GRASS EQU $82
DEF COLLISION_WALKABLE EQU $00 DEF COLLISION_WALKABLE EQU $00
DEF COLLISION_SOLID EQU $07 DEF COLLISION_SOLID EQU $07
DEF COLLISION_08 EQU $08 ; triggers wild encounters
DEF COLLISION_CUT_TREE EQU $12 DEF COLLISION_CUT_TREE EQU $12
DEF COLLISION_GRASS EQU $18 DEF COLLISION_GRASS EQU $18
; water collisions ; water collisions
DEF COLLISION_WATER EQU $21 DEF COLLISION_WATER_21 EQU $21
DEF COLLISION_WATERFALL EQU $22 DEF COLLISION_WATERFALL EQU $22
DEF COLLISION_WATER_SOLID EQU $27 DEF COLLISION_WATER_SOLID EQU $27
DEF COLLISION_WATER_28 EQU $28 ; triggers wild encounters
DEF COLLISION_WATER EQU $29
; water collisions 2 ; water collisions 2
DEF COLLISION_WATER2_E EQU $30 DEF COLLISION_WATER2_E EQU $30
@ -81,6 +86,13 @@ DEF COLLISION_LAND_N EQU $43
DEF COLLISION_LAND_S EQU $44 DEF COLLISION_LAND_S EQU $44
; $45..$47 will behave like COLLISION_LAND_E ; $45..$47 will behave like COLLISION_LAND_E
; All of these are listed in CheckGrassCollision. That's about all we know.
DEF COLLISION_48 EQU $48
DEF COLLISION_49 EQU $49
DEF COLLISION_4A EQU $4A
DEF COLLISION_4B EQU $4B
DEF COLLISION_4C EQU $4C
; land collisions 2 ; land collisions 2
DEF COLLISION_LAND2_E EQU $50 DEF COLLISION_LAND2_E EQU $50
DEF COLLISION_LAND2_W EQU $51 DEF COLLISION_LAND2_W EQU $51

View File

@ -280,6 +280,7 @@ DEF ITEM_X_ATTACK_RED EQU $41
DEF ITEM_X_DEFEND_RED EQU $42 DEF ITEM_X_DEFEND_RED EQU $42
DEF ITEM_X_SPEED_RED EQU $43 DEF ITEM_X_SPEED_RED EQU $43
DEF ITEM_X_SPECIAL_RED EQU $44 DEF ITEM_X_SPECIAL_RED EQU $44
DEF ITEM_EXP_ALL_RED EQU $4b
DEF ITEM_ETHER_RED EQU $50 DEF ITEM_ETHER_RED EQU $50
DEF ITEM_MAX_ETHER_RED EQU $51 DEF ITEM_MAX_ETHER_RED EQU $51
DEF ITEM_ELIXER_RED EQU $52 DEF ITEM_ELIXER_RED EQU $52

View File

@ -120,11 +120,13 @@ DEF NUM_HOF_TEAMS EQU 30
; wild data ; wild data
DEF NUM_GRASSMON EQU 6 ; data/wild/*_grass.asm table size DEF NUM_GRASSMON EQU 18 ; data/wild/*_grass.asm table size
DEF NUM_WATERMON EQU 3 ; data/wild/*_water.asm table size
DEF GRASS_WILDDATA_DAYBLOCK_START EQU 3 ;
DEF GRASS_WILDDATA_NITEBLOCK_START EQU 7 ; the slot in GrassMonProbTable to start at
DEF GRASS_WILDDATA_LENGTH EQU (NUM_GRASSMON * 2) + 3 + 2
DEF GRASS_WILDDATA_LENGTH EQU (NUM_GRASSMON * 2 + 1) * 3 + 2
DEF WATER_WILDDATA_LENGTH EQU (NUM_WATERMON * 2 + 1) * 1 + 2
DEF BASE_HAPPINESS EQU 70 DEF BASE_HAPPINESS EQU 70

View File

@ -146,3 +146,5 @@ ENDM
trainerclass TRAINER_ELITE_FOUR_F ; 40 trainerclass TRAINER_ELITE_FOUR_F ; 40
DEF NUM_TRAINER_CLASSES EQU __trainer_class__ DEF NUM_TRAINER_CLASSES EQU __trainer_class__
DEF TRAINER_OPP_RIVAL3_RED EQU $2b

View File

@ -0,0 +1,9 @@
HeldStatUpItems:
db HELD_ATTACK_UP, EFFECT_ATTACK_UP
db HELD_DEFENSE_UP, EFFECT_DEFENSE_UP
db HELD_SPEED_UP, EFFECT_SPEED_UP
db HELD_SP_ATTACK_UP, EFFECT_SP_ATK_UP
db HELD_SP_DEFENSE_UP, EFFECT_SP_DEF_UP
db HELD_ACCURACY_UP, EFFECT_ACCURACY_UP
db HELD_EVASION_UP, EFFECT_EVASION_UP
db -1 ; end

View File

@ -44,12 +44,12 @@ GiveItemPredef::
add_predef PrintMoveDescription add_predef PrintMoveDescription
add_predef UpdatePlayerHUD add_predef UpdatePlayerHUD
add_predef PlaceGraphic add_predef PlaceGraphic
add_predef Function3f068 ; 20 add_predef Old_ScaleSpriteByTwo ; 20
add_predef LoadMonBackPic add_predef LoadMonBackPic
add_predef AnyPartyAlive add_predef CheckPlayerPartyForFitMon
add_predef UpdateEnemyHUD add_predef UpdateEnemyHUD
add_predef DoubleOrHalveSelectedStats_Old add_predef DoubleOrHalveSelectedStats_Old
add_predef Function3ef19 add_predef StartBattle
add_predef CalcAndPlaceExpBar add_predef CalcAndPlaceExpBar
add_predef GetBattleMonBackpic add_predef GetBattleMonBackpic
add_predef GetEnemyMonFrontpic ; 28 add_predef GetEnemyMonFrontpic ; 28

View File

@ -1,6 +1,4 @@
INCLUDE "constants.asm" ; TODO: These aren't bespoke morning/day/night chunks. Find a way to indicate this.
SECTION "data/wild.asm", ROMX
GrassWildMons:: GrassWildMons::

View File

@ -0,0 +1,24 @@
MACRO mon_prob
; percent, index
db \1, \2 * 2
ENDM
GrassMonProbTable:
mon_prob 1, 0 ; start of morning block (#1)
mon_prob 4, 1 ;
mon_prob 5, 2 ;
mon_prob 1, 3 ; start of day block (#4)
mon_prob 4, 4 ;
mon_prob 15, 5 ;
mon_prob 20, 6 ;
mon_prob 5, 7 ; start of night block (#8)
mon_prob 10, 8 ;
mon_prob 20, 9 ;
mon_prob 15, 10 ; end of morning block (#11)
mon_prob 5, 11 ;
mon_prob 5, 12 ; end of day block (#13)
mon_prob 20, 13 ;
mon_prob 10, 14 ;
mon_prob 5, 15 ;
mon_prob 4, 16 ;
mon_prob 1, 17 ; end of night block (#18)

File diff suppressed because it is too large Load Diff

View File

@ -238,9 +238,9 @@ BattleCommand_CheckTurn:
; Repurposed as hardcoded turn handling. Useless as a command. ; Repurposed as hardcoded turn handling. Useless as a command.
ldh a, [hBattleTurn] ldh a, [hBattleTurn]
and a and a
ld a, [wCurPlayerSelectedMove] ld a, [wCurPlayerMove]
jr z, .go jr z, .go
ld a, [wCurEnemySelectedMove] ld a, [wCurEnemyMove]
.go .go
inc a inc a
@ -289,14 +289,14 @@ BattleCommand_CheckTurn:
call PrintText call PrintText
; Snore and Sleep Talk bypass sleep. ; Snore and Sleep Talk bypass sleep.
ld a, [wCurPlayerSelectedMove] ld a, [wCurPlayerMove]
cp MOVE_SNORE cp MOVE_SNORE
jr z, .not_asleep jr z, .not_asleep
cp MOVE_SLEEP_TALK cp MOVE_SLEEP_TALK
jr z, .not_asleep jr z, .not_asleep
xor a xor a
ld [wCurPlayerMove], a ld [wLastPlayerCounterMove], a
jp EndTurn jp EndTurn
.not_asleep .not_asleep
@ -305,7 +305,7 @@ BattleCommand_CheckTurn:
jr z, .not_frozen jr z, .not_frozen
; Flame Wheel and Sacred Fire thaw the user. ; Flame Wheel and Sacred Fire thaw the user.
ld a, [wCurPlayerSelectedMove] ld a, [wCurPlayerMove]
cp MOVE_FLAME_WHEEL cp MOVE_FLAME_WHEEL
jr z, .not_frozen jr z, .not_frozen
cp MOVE_SACRED_FIRE cp MOVE_SACRED_FIRE
@ -314,7 +314,7 @@ BattleCommand_CheckTurn:
ld hl, FrozenSolidText ld hl, FrozenSolidText
call PrintText call PrintText
xor a xor a
ld [wCurPlayerMove], a ld [wLastPlayerCounterMove], a
jp EndTurn jp EndTurn
.not_frozen .not_frozen
@ -323,7 +323,7 @@ BattleCommand_CheckTurn:
jp z, .not_trapped jp z, .not_trapped
; Rapid Spin breaks the player free of trapping moves ; Rapid Spin breaks the player free of trapping moves
ld a, [wCurPlayerSelectedMove] ld a, [wCurPlayerMove]
cp MOVE_RAPID_SPIN cp MOVE_RAPID_SPIN
jp z, .not_trapped jp z, .not_trapped
ld hl, CantMoveText ld hl, CantMoveText
@ -428,7 +428,7 @@ BattleCommand_CheckTurn:
and a and a
jr z, .no_disabled_move jr z, .no_disabled_move
ld hl, wCurPlayerSelectedMove ld hl, wCurPlayerMove
cp [hl] cp [hl]
jr nz, .no_disabled_move jr nz, .no_disabled_move
@ -504,14 +504,14 @@ CheckEnemyTurn:
.fast_asleep .fast_asleep
; Snore and Sleep Talk bypass sleep. ; Snore and Sleep Talk bypass sleep.
ld a, [wCurPlayerSelectedMove] ld a, [wCurPlayerMove]
cp MOVE_SNORE cp MOVE_SNORE
jr z, .not_asleep jr z, .not_asleep
cp MOVE_SLEEP_TALK cp MOVE_SLEEP_TALK
jr z, .not_asleep jr z, .not_asleep
xor a xor a
ld [wCurEnemyMove], a ld [wLastEnemyCounterMove], a
jp EndTurn jp EndTurn
.not_asleep .not_asleep
@ -520,7 +520,7 @@ CheckEnemyTurn:
jr z, .not_frozen jr z, .not_frozen
; Flame Wheel and Sacred Fire thaw the user. ; Flame Wheel and Sacred Fire thaw the user.
ld a, [wCurEnemySelectedMove] ld a, [wCurEnemyMove]
cp MOVE_FLAME_WHEEL cp MOVE_FLAME_WHEEL
jr z, .not_frozen jr z, .not_frozen
cp MOVE_SACRED_FIRE cp MOVE_SACRED_FIRE
@ -529,7 +529,7 @@ CheckEnemyTurn:
ld hl, FrozenSolidText ld hl, FrozenSolidText
call PrintText call PrintText
xor a xor a
ld [wCurEnemyMove], a ld [wLastEnemyCounterMove], a
jp EndTurn jp EndTurn
.not_frozen .not_frozen
@ -538,7 +538,7 @@ CheckEnemyTurn:
jp z, .not_trapped jp z, .not_trapped
; Rapid Spin breaks the player free of trapping moves ; Rapid Spin breaks the player free of trapping moves
ld a, [wCurEnemySelectedMove] ld a, [wCurEnemyMove]
cp MOVE_RAPID_SPIN cp MOVE_RAPID_SPIN
jp z, .not_trapped jp z, .not_trapped
ld hl, CantMoveText ld hl, CantMoveText
@ -657,7 +657,7 @@ CheckEnemyTurn:
and a and a
jr z, .no_disabled_move jr z, .no_disabled_move
ld hl, wCurEnemySelectedMove ld hl, wCurEnemyMove
cp [hl] cp [hl]
jr nz, .no_disabled_move jr nz, .no_disabled_move
@ -800,12 +800,12 @@ InfatuationText:
prompt prompt
MoveDisabled: MoveDisabled:
ld hl, wCurPlayerSelectedMove ld hl, wCurPlayerMove
ld de, wPlayerSubStatus3 ld de, wPlayerSubStatus3
ldh a, [hBattleTurn] ldh a, [hBattleTurn]
and a and a
jr z, .ok jr z, .ok
inc hl ; wCurEnemySelectedMove inc hl ; wCurEnemyMove
ld de, wEnemySubStatus3 ld de, wEnemySubStatus3
.ok .ok
@ -1084,7 +1084,7 @@ BattleCommand_CheckObedience:
ld hl, wBattleMonMoves ld hl, wBattleMonMoves
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
ld [wCurPlayerSelectedMove], a ld [wCurPlayerMove], a
call UpdateMoveData call UpdateMoveData
.EndDisobedience .EndDisobedience
@ -1125,10 +1125,10 @@ UsedMoveText:
ldh a, [hBattleTurn] ldh a, [hBattleTurn]
and a and a
ld a, [wPlayerMoveStruct] ld a, [wPlayerMoveStruct]
ld hl, wCurPlayerMove ld hl, wLastPlayerCounterMove
jr z, .playerTurn jr z, .playerTurn
ld a, [wEnemyMoveStruct] ld a, [wEnemyMoveStruct]
ld hl, wCurEnemyMove ld hl, wLastEnemyCounterMove
.playerTurn: .playerTurn:
ld [hl], a ld [hl], a
@ -1343,12 +1343,12 @@ MoveGrammar:
BattleCommand_DoTurn: BattleCommand_DoTurn:
ldh a, [hBattleTurn] ldh a, [hBattleTurn]
and a and a
ld a, [wCurPlayerSelectedMove] ld a, [wCurPlayerMove]
ld hl, wBattleMonPP ld hl, wBattleMonPP
ld de, wPlayerSubStatus3 ld de, wPlayerSubStatus3
jr z, .proceed jr z, .proceed
ld a, [wCurEnemySelectedMove] ld a, [wCurEnemyMove]
ld hl, wEnemyMonPP ld hl, wEnemyMonPP
ld de, wEnemySubStatus3 ld de, wEnemySubStatus3
@ -2003,12 +2003,12 @@ BattleCommand_CheckHit:
bit SUBSTATUS_INVULNERABLE, [hl] bit SUBSTATUS_INVULNERABLE, [hl]
jp z, .EnemyMonMist jp z, .EnemyMonMist
ld hl, wCurEnemyMove ld hl, wLastEnemyCounterMove
ld de, wPlayerMoveStruct ld de, wPlayerMoveStruct
ldh a, [hBattleTurn] ldh a, [hBattleTurn]
and a and a
jr z, .fly_moves jr z, .fly_moves
ld hl, wCurPlayerMove ld hl, wLastPlayerCounterMove
ld de, wEnemyMoveStruct ld de, wEnemyMoveStruct
.fly_moves: .fly_moves:
@ -2553,7 +2553,7 @@ Unreferenced_Gen1HealEffect:
.updateHPBar: .updateHPBar:
ld [wWhichHPBar], a ld [wWhichHPBar], a
predef UpdateHPBar predef UpdateHPBar
ld hl, DrawHUDsAndHPBars ld hl, UpdateBattleHuds
call CallFromBank0F call CallFromBank0F
ld hl, Unused_RegainedHealthText ld hl, Unused_RegainedHealthText
jp PrintText jp PrintText
@ -3146,7 +3146,7 @@ GetEnemyMonStat:
push de push de
push bc push bc
ld a, [wLinkMode] ld a, [wLinkMode]
cp 3 ; LINK_COLOSSEUM cp LINK_COLOSSEUM
jr nz, .notLinkBattle jr nz, .notLinkBattle
ld hl, wOTPartyMon1MaxHP ld hl, wOTPartyMon1MaxHP
@ -3563,10 +3563,10 @@ INCLUDE "data/moves/flail_reversal_power.inc"
BattleCommand_Counter: BattleCommand_Counter:
ldh a, [hBattleTurn] ldh a, [hBattleTurn]
and a and a
ld hl, wCurEnemySelectedMove ld hl, wCurEnemyMove
ld de, wEnemyMoveStructPower ld de, wEnemyMoveStructPower
jr z, .got_enemy_move jr z, .got_enemy_move
ld hl, wCurPlayerSelectedMove ld hl, wCurPlayerMove
ld de, wPlayerMoveStructPower ld de, wPlayerMoveStructPower
.got_enemy_move .got_enemy_move
@ -3611,11 +3611,11 @@ BattleCommand_Encore:
and a and a
ld hl, wEnemySubStatus5 ld hl, wEnemySubStatus5
ld de, wEnemyEncoreCount ld de, wEnemyEncoreCount
ld a, [wCurEnemyMove] ld a, [wLastEnemyCounterMove]
jr z, .ok jr z, .ok
ld hl, wPlayerSubStatus5 ld hl, wPlayerSubStatus5
ld de, wPlayerEncoreCount ld de, wPlayerEncoreCount
ld a, [wCurPlayerMove] ld a, [wLastPlayerCounterMove]
.ok .ok
; Struggle, Mirror Move, and Encore itself can be encored, unlike the final game. ; Struggle, Mirror Move, and Encore itself can be encored, unlike the final game.
@ -3857,7 +3857,7 @@ TookAimText:
BattleCommand_Sketch: BattleCommand_Sketch:
ld a, [wLinkMode] ld a, [wLinkMode]
cp 3 ; LINK_COLOSSEUM cp LINK_COLOSSEUM
jr z, .failed jr z, .failed
call CheckSubstituteOpp call CheckSubstituteOpp
@ -3870,7 +3870,7 @@ BattleCommand_Sketch:
ld c, a ld c, a
ld b, 0 ld b, 0
add hl, bc add hl, bc
ld a, [wCurEnemyMove] ld a, [wLastEnemyCounterMove]
ld [hl], a ld [hl], a
ld hl, wPartyMon1Moves ld hl, wPartyMon1Moves
@ -3928,12 +3928,12 @@ BattleCommand_SleepTalk:
ldh a, [hBattleTurn] ldh a, [hBattleTurn]
and a and a
ld hl, wBattleMonMoves + 1 ld hl, wBattleMonMoves + 1
ld de, wCurPlayerSelectedMove ld de, wCurPlayerMove
ld bc, wPlayerMoveStruct ld bc, wPlayerMoveStruct
ld a, [wBattleMonStatus] ld a, [wBattleMonStatus]
jr z, .go jr z, .go
ld hl, wEnemyMonMoves + 1 ld hl, wEnemyMonMoves + 1
ld de, wCurEnemySelectedMove ld de, wCurEnemyMove
ld bc, wEnemyMoveStruct ld bc, wEnemyMoveStruct
ld a, [wEnemyMonStatus] ld a, [wEnemyMonStatus]
@ -4019,11 +4019,11 @@ BattleCommand_Spite:
and a and a
ld hl, wEnemyMonMoves ld hl, wEnemyMonMoves
ld de, wOTPartyMon1PP ld de, wOTPartyMon1PP
ld a, [wCurEnemyMove] ld a, [wLastEnemyCounterMove]
jr z, .got_moves jr z, .got_moves
ld hl, wBattleMonMoves ld hl, wBattleMonMoves
ld de, wPartyMon1PP ld de, wPartyMon1PP
ld a, [wCurPlayerMove] ld a, [wLastPlayerCounterMove]
.got_moves .got_moves
and a and a
@ -4241,7 +4241,7 @@ DoEnemyDamage:
ld [wWhichHPBar], a ld [wWhichHPBar], a
predef UpdateHPBar predef UpdateHPBar
.did_no_damage: .did_no_damage:
ld hl, DrawHUDsAndHPBars ld hl, UpdateBattleHuds
jp CallFromBank0F jp CallFromBank0F
DoPlayerDamage: DoPlayerDamage:
@ -4296,7 +4296,7 @@ DoPlayerDamage:
predef UpdateHPBar predef UpdateHPBar
.did_no_damage: .did_no_damage:
ld hl, DrawHUDsAndHPBars ld hl, UpdateBattleHuds
jp CallFromBank0F jp CallFromBank0F
DoSubstituteDamage: DoSubstituteDamage:
@ -4352,7 +4352,7 @@ DoSubstituteDamage:
.got_move_effect: .got_move_effect:
xor a xor a
ld [hl], a ld [hl], a
ld hl, DrawHUDsAndHPBars ld hl, UpdateBattleHuds
jp CallFromBank0F jp CallFromBank0F
SubTookDamageText: SubTookDamageText:
@ -4372,18 +4372,18 @@ UpdateMoveData:
ld hl, wEnemySubStatus5 ld hl, wEnemySubStatus5
ld de, wEnemyMoveStruct ld de, wEnemyMoveStruct
ld bc, wCurEnemyMove ld bc, wLastEnemyCounterMove
push bc push bc
ld a, [wCurEnemySelectedMove] ld a, [wCurEnemyMove]
ld b, a ld b, a
jr .get_move_data jr .get_move_data
.player: .player:
ld hl, wPlayerSubStatus5 ld hl, wPlayerSubStatus5
ld de, wPlayerMoveStruct ld de, wPlayerMoveStruct
ld bc, wCurPlayerMove ld bc, wLastPlayerCounterMove
push bc push bc
ld a, [wCurPlayerSelectedMove] ld a, [wCurPlayerMove]
ld b, a ld b, a
ld a, [wPlayerDebugSelectedMove] ld a, [wPlayerDebugSelectedMove]
and a and a
@ -4463,7 +4463,7 @@ Unreferenced_OldSleepTarget:
ld [de], a ld [de], a
call PlayDamageAnim call PlayDamageAnim
push de push de
ld hl, DrawHUDsAndHPBars ld hl, UpdateBattleHuds
call CallFromBank0F call CallFromBank0F
ld hl, FellAsleepText ld hl, FellAsleepText
@ -4487,9 +4487,9 @@ Unreferenced_OldSleepTarget:
and ~SLP and ~SLP
ld [de], a ld [de], a
ld a, [hl] ld a, [hl]
call PrintRecoveredUsingItem call PrintUsersItemActivated
call ConsumeHeldItem call ConsumeHeldItem
ld hl, DrawHUDsAndHPBars ld hl, UpdateBattleHuds
jp CallFromBank0F jp CallFromBank0F
FellAsleepText: FellAsleepText:
@ -4558,7 +4558,7 @@ BattleCommand_SleepTarget:
ld [de], a ld [de], a
call PlayDamageAnim call PlayDamageAnim
push de push de
ld hl, DrawHUDsAndHPBars ld hl, UpdateBattleHuds
call CallFromBank0F call CallFromBank0F
ld hl, FellAsleepText ld hl, FellAsleepText
@ -4580,9 +4580,9 @@ BattleCommand_SleepTarget:
and ~SLP and ~SLP
ld [de], a ld [de], a
ld a, [hl] ld a, [hl]
call PrintRecoveredUsingItem call PrintUsersItemActivated
call ConsumeHeldItem call ConsumeHeldItem
ld hl, DrawHUDsAndHPBars ld hl, UpdateBattleHuds
jp CallFromBank0F jp CallFromBank0F
.fail: .fail:
@ -4630,7 +4630,7 @@ BattleCommand_PoisonTarget:
push de push de
ld de, ANIM_PSN ld de, ANIM_PSN
call PlayOpponentBattleAnim call PlayOpponentBattleAnim
ld hl, DrawHUDsAndHPBars ld hl, UpdateBattleHuds
call CallFromBank0F call CallFromBank0F
ld hl, WasPoisonedText ld hl, WasPoisonedText
call PrintText call PrintText
@ -4651,9 +4651,9 @@ BattleCommand_PoisonTarget:
res PSN, a res PSN, a
ld [de], a ld [de], a
ld a, [hl] ld a, [hl]
call PrintRecoveredUsingItem call PrintUsersItemActivated
call ConsumeHeldItem call ConsumeHeldItem
ld hl, DrawHUDsAndHPBars ld hl, UpdateBattleHuds
jp CallFromBank0F jp CallFromBank0F
WasPoisonedText: WasPoisonedText:
@ -4724,7 +4724,7 @@ BattleCommand_Poison:
xor a xor a
ld [de], a ld [de], a
call PlayDamageAnim call PlayDamageAnim
ld hl, DrawHUDsAndHPBars ld hl, UpdateBattleHuds
call CallFromBank0F call CallFromBank0F
ld hl, BadlyPoisonedText ld hl, BadlyPoisonedText
@ -4747,9 +4747,9 @@ BattleCommand_Poison:
res PSN, a res PSN, a
ld [de], a ld [de], a
ld a, [hl] ld a, [hl]
call PrintRecoveredUsingItem call PrintUsersItemActivated
call ConsumeHeldItem call ConsumeHeldItem
ld hl, DrawHUDsAndHPBars ld hl, UpdateBattleHuds
call CallFromBank0F call CallFromBank0F
call .check_toxic call .check_toxic
ret nz ret nz
@ -4937,7 +4937,7 @@ BattleCommand_BurnTarget:
call CallFromBank0F call CallFromBank0F
ld de, ANIM_BRN ld de, ANIM_BRN
call PlayOpponentBattleAnim call PlayOpponentBattleAnim
ld hl, DrawHUDsAndHPBars ld hl, UpdateBattleHuds
call CallFromBank0F call CallFromBank0F
ld hl, WasBurnedText ld hl, WasBurnedText
call PrintText call PrintText
@ -4958,9 +4958,9 @@ BattleCommand_BurnTarget:
res BRN, a res BRN, a
ld [de], a ld [de], a
ld a, [hl] ld a, [hl]
call PrintRecoveredUsingItem call PrintUsersItemActivated
call ConsumeHeldItem call ConsumeHeldItem
ld hl, DrawHUDsAndHPBars ld hl, UpdateBattleHuds
jp CallFromBank0F jp CallFromBank0F
WasBurnedText: WasBurnedText:
@ -5032,7 +5032,7 @@ BattleCommand_FreezeTarget:
ld de, ANIM_FRZ ld de, ANIM_FRZ
call PlayOpponentBattleAnim call PlayOpponentBattleAnim
ld hl, DrawHUDsAndHPBars ld hl, UpdateBattleHuds
call CallFromBank0F call CallFromBank0F
ld hl, WasFrozenText ld hl, WasFrozenText
call PrintText call PrintText
@ -5053,9 +5053,9 @@ BattleCommand_FreezeTarget:
res FRZ, a res FRZ, a
ld [de], a ld [de], a
ld a, [hl] ld a, [hl]
call PrintRecoveredUsingItem call PrintUsersItemActivated
call ConsumeHeldItem call ConsumeHeldItem
ld hl, DrawHUDsAndHPBars ld hl, UpdateBattleHuds
jp CallFromBank0F jp CallFromBank0F
WasFrozenText: WasFrozenText:
@ -5100,7 +5100,7 @@ BattleCommand_ParalyzeTarget:
call CallFromBank0F call CallFromBank0F
ld de, ANIM_PAR ld de, ANIM_PAR
call PlayOpponentBattleAnim call PlayOpponentBattleAnim
ld hl, DrawHUDsAndHPBars ld hl, UpdateBattleHuds
call CallFromBank0F call CallFromBank0F
call PrintParalyze call PrintParalyze
@ -5120,9 +5120,9 @@ BattleCommand_ParalyzeTarget:
res PAR, a res PAR, a
ld [de], a ld [de], a
ld a, [hl] ld a, [hl]
call PrintRecoveredUsingItem call PrintUsersItemActivated
call ConsumeHeldItem call ConsumeHeldItem
ld hl, DrawHUDsAndHPBars ld hl, UpdateBattleHuds
jp CallFromBank0F jp CallFromBank0F
BattleCommand_StatUp: BattleCommand_StatUp:
@ -5347,7 +5347,7 @@ BattleCommand_StatDown:
ld hl, wPlayerStatLevels ld hl, wPlayerStatLevels
ld de, wEnemyMoveStructEffect ld de, wEnemyMoveStructEffect
ld a, [wLinkMode] ld a, [wLinkMode]
cp 3 ; LINK_COLOSSEUM cp LINK_COLOSSEUM
jr z, .got_stat_levels jr z, .got_stat_levels
; 25% chance for enemy monsters' stat-lowering moves to fail ; 25% chance for enemy monsters' stat-lowering moves to fail
call BattleRandom call BattleRandom
@ -6557,7 +6557,7 @@ BattleCommand_Paralyze:
ld c, 30 ld c, 30
call DelayFrames call DelayFrames
call LoadMoveAnim call LoadMoveAnim
ld hl, DrawHUDsAndHPBars ld hl, UpdateBattleHuds
call CallFromBank0F call CallFromBank0F
call PrintParalyze call PrintParalyze
@ -6577,9 +6577,9 @@ BattleCommand_Paralyze:
res PAR, a res PAR, a
ld [de], a ld [de], a
ld a, [hl] ld a, [hl]
call PrintRecoveredUsingItem call PrintUsersItemActivated
call ConsumeHeldItem call ConsumeHeldItem
ld hl, DrawHUDsAndHPBars ld hl, UpdateBattleHuds
jp CallFromBank0F jp CallFromBank0F
.paralyzed .paralyzed
@ -6650,7 +6650,7 @@ BattleCommand_Substitute:
.played_anim .played_anim
ld hl, MadeSubstituteText ld hl, MadeSubstituteText
call PrintText call PrintText
ld hl, DrawHUDsAndHPBars ld hl, UpdateBattleHuds
jp CallFromBank0F jp CallFromBank0F
.already_has_sub .already_has_sub
@ -6719,12 +6719,12 @@ BattleCommand_Mimic:
jr nz, .fail jr nz, .fail
ld hl, wBattleMonMoves ld hl, wBattleMonMoves
ld de, wCurEnemyMove ld de, wLastEnemyCounterMove
ldh a, [hBattleTurn] ldh a, [hBattleTurn]
and a and a
jr z, .player_turn jr z, .player_turn
ld hl, wEnemyMonMoves ld hl, wEnemyMonMoves
ld de, wCurPlayerMove ld de, wLastPlayerCounterMove
.player_turn .player_turn
; BUG: No checks for Struggle, so it can be mimicked. ; BUG: No checks for Struggle, so it can be mimicked.
@ -6814,13 +6814,13 @@ BattleCommand_Disable:
ld de, wEnemyDisableCount ld de, wEnemyDisableCount
ld hl, wEnemyMonMoves ld hl, wEnemyMonMoves
ld bc, wCurEnemyMove ld bc, wLastEnemyCounterMove
ldh a, [hBattleTurn] ldh a, [hBattleTurn]
and a and a
jr z, .got_moves jr z, .got_moves
ld de, wPlayerDisableCount ld de, wPlayerDisableCount
ld hl, wBattleMonMoves ld hl, wBattleMonMoves
ld bc, wCurPlayerMove ld bc, wLastPlayerCounterMove
.got_moves .got_moves
ld a, [de] ld a, [de]
@ -6965,7 +6965,7 @@ BattleCommand_ResetStats:
call .CopyStats call .CopyStats
ld hl, wEnemyMonStatus ld hl, wEnemyMonStatus
ld de, wCurEnemySelectedMove ld de, wCurEnemyMove
ldh a, [hBattleTurn] ldh a, [hBattleTurn]
and a and a
jr z, .cure_status jr z, .cure_status
@ -7110,7 +7110,7 @@ BattleCommand_Heal:
callfar RestoreHP callfar RestoreHP
pop af pop af
ldh [hBattleTurn], a ldh [hBattleTurn], a
ld hl, DrawHUDsAndHPBars ld hl, UpdateBattleHuds
call CallFromBank0F call CallFromBank0F
ld hl, RegainedHealthText ld hl, RegainedHealthText
jp PrintText jp PrintText
@ -7456,13 +7456,13 @@ BattleCommand_Selfdestruct:
BattleCommand_MirrorMove: BattleCommand_MirrorMove:
ldh a, [hBattleTurn] ldh a, [hBattleTurn]
and a and a
ld a, [wCurEnemyMove] ld a, [wLastEnemyCounterMove]
ld hl, wCurPlayerSelectedMove ld hl, wCurPlayerMove
ld de, wPlayerMoveStruct ld de, wPlayerMoveStruct
jr z, .got_moves jr z, .got_moves
ld a, [wCurPlayerMove] ld a, [wLastPlayerCounterMove]
ld de, wEnemyMoveStruct ld de, wEnemyMoveStruct
ld hl, wCurEnemySelectedMove ld hl, wCurEnemyMove
.got_moves .got_moves
cp MOVE_MIRROR_MOVE cp MOVE_MIRROR_MOVE
@ -7508,12 +7508,12 @@ MirrorMoveFailedText:
BattleCommand_Metronome: BattleCommand_Metronome:
call LoadMoveAnim call LoadMoveAnim
ld de, wPlayerMoveStructEffect ld de, wPlayerMoveStructEffect
ld hl, wCurPlayerSelectedMove ld hl, wCurPlayerMove
ldh a, [hBattleTurn] ldh a, [hBattleTurn]
and a and a
jr z, .GetMove jr z, .GetMove
ld de, wEnemyMoveStructEffect ld de, wEnemyMoveStructEffect
ld hl, wCurEnemySelectedMove ld hl, wCurEnemyMove
.GetMove .GetMove
call BattleRandom call BattleRandom
@ -8450,7 +8450,7 @@ BattleCommand_BatonPass:
cp [hl] cp [hl]
jr nz, .picked_mon jr nz, .picked_mon
ld hl, BattleText_MonIsAlreadyOut ld hl, BattleText_MonIsAlreadyOut_0d
call PrintText call PrintText
.pressed_b .pressed_b
@ -8458,7 +8458,7 @@ BattleCommand_BatonPass:
jr .player_loop jr .player_loop
.picked_mon .picked_mon
callfar HasMonFainted callfar CheckIfCurPartyMonIsFitToFight
jr z, .pressed_b jr z, .pressed_b
call ClearPalettes call ClearPalettes
@ -8543,7 +8543,7 @@ BattleCommand_BatonPass:
call BattleCommand_MoveDelay call BattleCommand_MoveDelay
jp PrintButItFailed jp PrintButItFailed
BattleText_MonIsAlreadyOut: BattleText_MonIsAlreadyOut_0d:
text_from_ram wBattleMonNickname text_from_ram wBattleMonNickname
text "はもうでています" text "はもうでています"
prompt prompt
@ -8943,20 +8943,20 @@ ConsumeHeldItem:
INCLUDE "data/battle/held_consumables.inc" INCLUDE "data/battle/held_consumables.inc"
PrintRecoveredUsingItem: PrintUsersItemActivated:
push hl push hl
push de push de
push bc push bc
ld [wNamedObjectIndexBuffer], a ld [wNamedObjectIndexBuffer], a
call GetItemName call GetItemName
ld hl, RecoveredUsingText ld hl, BattleText_UsersStringBuffer1Activated
call PrintText call PrintText
pop bc pop bc
pop de pop de
pop hl pop hl
ret ret
RecoveredUsingText: BattleText_UsersStringBuffer1Activated:
text "そうびしていた" text "そうびしていた"
line "@" line "@"
text_from_ram wStringBuffer1 text_from_ram wStringBuffer1

View File

@ -906,7 +906,7 @@ AIChooseMove::
and a and a
jr z, .ChooseMove jr z, .ChooseMove
ld [wCurEnemySelectedMove], a ld [wCurEnemyMove], a
ld a, c ld a, c
ld [wCurEnemyMoveNum], a ld [wCurEnemyMoveNum], a
ret ret
@ -1278,7 +1278,7 @@ AI_Smart_DreamEater:
AI_Smart_MirrorMove: AI_Smart_MirrorMove:
; If the player did not use any move last turn... ; If the player did not use any move last turn...
ld a, [wCurPlayerMove] ld a, [wLastPlayerCounterMove]
and a and a
jr nz, .usedmove jr nz, .usedmove
@ -1466,7 +1466,7 @@ AI_Smart_Substitute:
; that would not be effective against itself. ; that would not be effective against itself.
; Consequently, the Smart AI might still use Mimic even if no move has actually been used yet. ; Consequently, the Smart AI might still use Mimic even if no move has actually been used yet.
AI_Smart_Mimic: AI_Smart_Mimic:
ld a, [wCurPlayerMove] ld a, [wLastPlayerCounterMove]
and a and a
ret z ret z
@ -1485,7 +1485,7 @@ AI_Smart_Mimic:
dec [hl] dec [hl]
.skip_encourage .skip_encourage
ld a, [wCurPlayerMove] ld a, [wLastPlayerCounterMove]
and a and a
ret z ; Pointless repeat of an earlier check... ret z ; Pointless repeat of an earlier check...
@ -1551,7 +1551,7 @@ AI_Smart_Counter:
cp 3 cp 3
jr nc, .encourage jr nc, .encourage
ld a, [wCurPlayerMove] ld a, [wLastPlayerCounterMove]
and a and a
jr z, .done jr z, .done
@ -1584,7 +1584,7 @@ AI_Smart_Encore:
jr nz, .discourage jr nz, .discourage
push hl push hl
ld a, [wCurPlayerMove] ld a, [wLastPlayerCounterMove]
ld hl, EncoreMoves ld hl, EncoreMoves
ld de, 1 ld de, 1
call FindItemInTable call FindItemInTable
@ -1664,7 +1664,7 @@ AI_Smart_DefrostOpponent:
; less than four moves encourages the AI to use Spite against them. ; less than four moves encourages the AI to use Spite against them.
AI_Smart_Spite: AI_Smart_Spite:
push hl push hl
ld a, [wCurPlayerMove] ld a, [wLastPlayerCounterMove]
ld b, a ld b, a
ld c, NUM_MOVES ld c, NUM_MOVES
ld hl, wBattleMonMoves ld hl, wBattleMonMoves
@ -2590,7 +2590,7 @@ ReadTrainerParty::
.skip_name .skip_name
ld a, [hli] ld a, [hli]
cp "@" cp '@'
jr nz, .skip_name jr nz, .skip_name
ld a, [hli] ld a, [hli]

File diff suppressed because it is too large Load Diff

View File

@ -1074,12 +1074,12 @@ OpenPartyMenu::
ld [w2DMenuNumRows], a ld [w2DMenuNumRows], a
ld b, a ld b, a
ld a, [wce38] ld a, [wFailedToFlee]
and a and a
ld a, $03 ld a, $03
jr z, .asm_507b4 jr z, .asm_507b4
xor a xor a ; FALSE
ld [wce38], a ld [wFailedToFlee], a
ld a, $01 ld a, $01
.asm_507b4 .asm_507b4
ld [wMenuJoypadFilter], a ld [wMenuJoypadFilter], a

View File

@ -0,0 +1,264 @@
INCLUDE "constants.asm"
SECTION "engine/overworld/wildmons.asm", ROMX
_LoadWildMonData::
xor a
ld hl, wWildMonData
ld bc, GRASS_WILDDATA_LENGTH
call ByteFill
ld a, [wMapGroup]
ld d, a
ld a, [wMapId]
ld e, a
ld bc, GRASS_WILDDATA_LENGTH
ld hl, GrassWildMons
.find
ld a, [hl]
cp -1
ret z
cp d
jr nz, .got_map_group
inc hl
ld a, [hl]
dec hl
cp e
jr z, .got_map
.got_map_group
add hl, bc
jr .find
.got_map
inc hl
inc hl
ld de, wWildMonData
ld bc, GRASS_WILDDATA_LENGTH - 2
jp CopyBytes
; Load nest landmarks into wTilemap[0,0]
FindNest:
hlcoord 0, 0
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
xor a
call ByteFill
ld hl, GrassWildMons
decoord 0, 0
.FindGrass:
ld a, [hl]
cp -1
jr z, .done
push hl
ld b, a
inc hl
ld c, [hl]
call .SearchMapForMon
jr nc, .next_grass
push de
call GetWorldMapLocation
call .AppendNest
pop de
jr c, .next_grass
ld [de], a
inc de
.next_grass
pop hl
ld bc, GRASS_WILDDATA_LENGTH
add hl, bc
jr .FindGrass
.done:
ret
.SearchMapForMon:
rept 5
inc hl
endr
ld a, NUM_GRASSMON
.ScanMapLoop:
push af
ld a, [wNamedObjectIndexBuffer]
cp [hl]
jr z, .found
inc hl
inc hl
pop af
dec a
jr nz, .ScanMapLoop
and a
ret
.found
pop af
scf
ret
.AppendNest:
ld c, a
ld hl, wTileMap
ld de, SCREEN_WIDTH * SCREEN_HEIGHT
.AppendNestLoop:
ld a, [hli]
cp c
jr z, .found_nest
dec de
ld a, e
or d
jr nz, .AppendNestLoop
ld a, c
and a
ret
.found_nest
scf
ret
INCLUDE "data/wild/grassmons.inc"
TryWildBattle::
; If there is no active Repel, there's no need to be here.
ld a, [wRepelEffect]
and a
jr z, .encounter
dec a
jp z, .repel_wore_off
ld [wRepelEffect], a
.encounter
call .CheckGrassCollision
jr nc, .no_battle
; Get encounter rate for the time of day.
call WildMon_GetTimeOfDay
ld c, a
ld b, 0
ld hl, wWildMonData
add hl, bc
ld a, [hl]
ld b, a
call Random
ldh a, [hRandomAdd]
cp b
jr nc, .no_battle
call Random
ld b, a
ld hl, GrassMonProbTable
call WildMon_GetTimeOfDay
cp NITE_F
ld bc, 0
jr c, .got_time
ld bc, GRASS_WILDDATA_DAYBLOCK_START * 2
jr z, .got_time
ld bc, GRASS_WILDDATA_NITEBLOCK_START * 2
.got_time
add hl, bc
.random_loop
call Random
cp 100
jr nc, .random_loop
ld b, a
ld c, 0
.prob_bracket_loop
ld a, [hli]
add c
ld c, a
cp b
jr nc, .got_it
inc hl
jr .prob_bracket_loop
.got_it
ld c, [hl]
ld b, 0
ld hl, wWildMons
add hl, bc
ld a, [hli]
ld [wCurPartyLevel], a
ld a, [hl]
call ValidateTempWildMonSpecies
jr c, .no_battle
ld [wCurPartySpecies], a
ld [wTempEnemyMonSpecies], a
ld a, [wRepelEffect]
and a
jr z, .ok
ld a, [wPartyMon1Level]
ld b, a
ld a, [wCurPartyLevel]
cp b
jr c, .no_battle
jr .ok
.repel_wore_off
ld [wRepelEffect], a
.no_battle
ld a, 1
and a
ret
.ok
ld a, WILD_BATTLE
ld [wBattleMode], a
xor a
ret
.CheckGrassCollision:
ld a, [wPlayerTile]
ld hl, .blocks
ld de, 1
call FindItemInTable
ret
.blocks
db COLLISION_08
db COLLISION_GRASS
db COLLISION_WATER_28
db COLLISION_WATER
db COLLISION_48
db COLLISION_49
db COLLISION_4A
db COLLISION_4B
db COLLISION_4C
db -1
INCLUDE "data/wild/probabilities.inc"
; This actually works as intended in the proto!
; In the final game, due to a development oversight,
; this function is called with the wild Pokemon's level, not its species, in a.
ValidateTempWildMonSpecies:
and a
jr z, .nowildmon ; = 0
cp NUM_POKEMON + 1 ; 252
jr nc, .nowildmon ; >= 252
and a ; 1 <= Species <= 251
ret
.nowildmon
scf
ret
WildMon_GetTimeOfDay:
ld a, [wTimeOfDay]
inc a
maskbits NUM_DAYTIMES
cp MORN_F
ret nz
dec a
ret

View File

@ -78,12 +78,14 @@ UncompressSpriteFromDE::
ld [hl], d ld [hl], d
jp UncompressSpriteData jp UncompressSpriteData
; TODO: Rename to LoadTilemapToTempTilemap
BackUpTilesToBuffer:: BackUpTilesToBuffer::
hlcoord 0, 0 hlcoord 0, 0
decoord 0, 0, wTileMapBackup decoord 0, 0, wTileMapBackup
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
jp CopyBytes jp CopyBytes
; TODO: Rename to SafeLoadTempTilemapToTilemap
ReloadTilesFromBuffer:: ReloadTilesFromBuffer::
xor a xor a
ldh [hBGMapMode], a ldh [hBGMapMode], a

View File

@ -299,7 +299,7 @@ MapSetup_Reload::
ld [wMusicFade], a ld [wMusicFade], a
ld b, 9 ; TODO: constantify this ld b, 9 ; TODO: constantify this
call GetSGBLayout call GetSGBLayout
call LoadWildMons call LoadWildMonData
call FadeIn call FadeIn
ret ret
@ -345,7 +345,7 @@ MapSetup_Continue::
ld [wMusicFade], a ld [wMusicFade], a
ld b, 9 ; TODO: constantify this ld b, 9 ; TODO: constantify this
call GetSGBLayout call GetSGBLayout
call LoadWildMons call LoadWildMonData
call Function242c ; TODO call Function242c ; TODO
call FadeIn call FadeIn
ret ret
@ -373,7 +373,7 @@ MapSetup_Warp::
call PlayMapMusic call PlayMapMusic
ld b, 9 ; TODO: constantify this ld b, 9 ; TODO: constantify this
call GetSGBLayout call GetSGBLayout
call LoadWildMons call LoadWildMonData
call FadeIn call FadeIn
call Function2407 ; TODO call Function2407 ; TODO
ret ret
@ -419,8 +419,8 @@ LoadMapTimeOfDay::
jr nz, .row jr nz, .row
ret ret
LoadWildMons:: LoadWildMonData::
callfar _LoadWildMons callfar _LoadWildMonData
ret ret
LoadGraphics:: LoadGraphics::
@ -484,7 +484,7 @@ MapSetup_Connection::
call FadeToMapMusic call FadeToMapMusic
ld b, 9 ; TODO: constantify this ld b, 9 ; TODO: constantify this
call GetSGBLayout call GetSGBLayout
call LoadWildMons call LoadWildMonData
scf scf
ret ret

View File

@ -2,7 +2,7 @@ INCLUDE "constants.asm"
SECTION "home/misc_32c8.asm@Unknown 32c8", ROM0 SECTION "home/misc_32c8.asm@Unknown 32c8", ROM0
Function32c8:: Call_GetItemAmount::
predef GetItemAmount predef GetItemAmount
ld a, b ld a, b
and a and a

View File

@ -22,6 +22,7 @@ WaitBGMap::
call DelayFrames call DelayFrames
ret ret
; TODO: Change to SetDefaultBGPAndOBP
SetPalettes:: SetPalettes::
ld a, %11100100 ld a, %11100100
ldh [rBGP], a ldh [rBGP], a

View File

@ -50,7 +50,7 @@ TestWildBattleStart::
ret z ; if no directions are down, don't try and trigger a wild encounter ret z ; if no directions are down, don't try and trigger a wild encounter
call CheckBPressedDebug call CheckBPressedDebug
jp nz, xor_a ; if b button is down, clear acc jp nz, xor_a ; if b button is down, clear acc
callfar Function3ee3e callfar TryWildBattle
ld a, [wBattleMode] ld a, [wBattleMode]
and a and a
ret z ; if no battle, return ret z ; if no battle, return
@ -60,7 +60,7 @@ TestWildBattleStart::
ret ret
OverworldLoop_StartBattle:: OverworldLoop_StartBattle::
predef Function3ef19 predef StartBattle
ld a, $f3 ld a, $f3
ldh [hMapEntryMethod], a ldh [hMapEntryMethod], a
ld hl, wd4a9 ld hl, wd4a9

View File

@ -70,7 +70,7 @@ AddNTimes::
jr nz, .loop jr nz, .loop
ret ret
memcmp:: ; TODO: rename CompareBytes::
; Compare c bytes at hl and de ; Compare c bytes at hl and de
; Returns z if all equal, nz otherwise. ; Returns z if all equal, nz otherwise.
.loop: .loop:

View File

@ -280,11 +280,9 @@ ROMX $0e
ROMX $0f ROMX $0f
org $4000 org $4000
"engine/dumps/bank0f.asm@StartBattle" "engine/battle/core.asm@DoBattle"
"engine/battle/core.asm" "engine/overworld/wildmons.asm"
"engine/dumps/bank0f.asm@PlayMoveAnimation" "engine/battle/core.asm@StartBattle"
"data/wild.asm"
"engine/dumps/bank0f.asm@Function3ee3e"
ROMX $10 ROMX $10
org $4000 org $4000

View File

@ -626,8 +626,7 @@ wEnemyEvaLevel:: db
wForceEvolution:: db wForceEvolution:: db
wAILayer2Encouragement:: wEnemyTurnsTaken:: db
wEnemyTurnsTaken:: ds 1
ds 1 ds 1
@ -639,10 +638,8 @@ wPlayerDebugSelectedMove:: ds 1
wMoveSelectionMenuType:: ds 1 wMoveSelectionMenuType:: ds 1
; TODO: Replace these with just wCurPlayer/EnemyMove wCurPlayerMove:: db
; and replace the original wCurPlayerMove/wCurEnemyMove with wLastPlayer/EnemyCounterMove wCurEnemyMove:: db
wCurPlayerSelectedMove:: db
wCurEnemySelectedMove:: db
wLinkBattleRNCount:: db wLinkBattleRNCount:: db
@ -661,27 +658,21 @@ wcacb:: ds 1
wcacc:: ds 1 wcacc:: ds 1
ENDU ENDU
wcacd:: ds 1 wUnused_SafariEscapeFactor:: db
wcace:: ds 1 wUnused_SafariBaitFactor:: db
ds 1 ds 1
wEnemyBackupDVs:: dw wEnemyBackupDVs:: dw
wAlreadyDisobeyed:: wAlreadyDisobeyed:: db
wcad2:: ds 1
wDisabledMove:: ds 1 wDisabledMove:: db
wEnemyDisabledMove:: ds 1 wEnemyDisabledMove:: db
wcad5:: ds 1 wWhichMonFaintedFirst:: db
UNION wLastPlayerCounterMove:: db
wCurPlayerMove:: ds 1 wLastEnemyCounterMove:: db
wCurEnemyMove:: ds 1
NEXTU
wcad6:: ds 1
wcad7:: ds 1
ENDU
wEnemyMinimized:: db wEnemyMinimized:: db
wAlreadyFailed:: db wAlreadyFailed:: db
@ -690,11 +681,8 @@ wBattleParticipantsIncludingFainted:: db
wBattleLowHealthAlarm:: db wBattleLowHealthAlarm:: db
wPlayerMinimized:: db wPlayerMinimized:: db
wPlayerScreens:: wPlayerScreens:: db
wcadd:: db wEnemyScreens:: db
wEnemyScreens::
wcade:: db
wPlayerSafeguardCount:: db wPlayerSafeguardCount:: db
wEnemySafeguardCount:: db wEnemySafeguardCount:: db
@ -710,6 +698,7 @@ ENDU
SECTION "CB14", WRAM0[$CB14] SECTION "CB14", WRAM0[$CB14]
wBattleEnd::
UNION UNION
wRedrawRowOrColumnSrcTiles:: wRedrawRowOrColumnSrcTiles::
@ -730,7 +719,8 @@ ENDU
SECTION "CB56", WRAM0[$CB4C] SECTION "CB56", WRAM0[$CB4C]
UNION UNION
wOtherPlayerLinkMode:: db wOtherPlayerLinkMode:: db
wOtherPlayerLinkAction:: db wOtherPlayerLinkAction::
wBattleAction:: db
ds 3 ; TODO ds 3 ; TODO
wPlayerLinkAction:: db wPlayerLinkAction:: db
@ -1064,6 +1054,11 @@ wHPBarTempHP:: dw
NEXTU NEXTU
wStringBuffer2:: ds STRING_BUFFER_LENGTH wStringBuffer2:: ds STRING_BUFFER_LENGTH
NEXTU
ds 2
wGainBoostedExp:: db
NEXTU NEXTU
wcd31:: db wcd31:: db
@ -1074,7 +1069,6 @@ ENDU
SECTION "CD3C", WRAM0[$CD3C] SECTION "CD3C", WRAM0[$CD3C]
wcd3c::
wPartyMenuCursor:: wPartyMenuCursor::
wBillsPCCursor:: db wBillsPCCursor:: db
wRegularItemsCursor:: db wRegularItemsCursor:: db
@ -1087,8 +1081,7 @@ wCurMoveNum:: db
wCurBattleMon:: db wCurBattleMon:: db
wTMHolderCursor:: db wTMHolderCursor:: db
wFieldDebugMenuCursorBuffer:: wFieldDebugMenuCursorBuffer:: db
wcd43:: db
wRegularItemsScrollPosition:: db wRegularItemsScrollPosition:: db
wBackpackAndKeyItemsScrollPosition:: db wBackpackAndKeyItemsScrollPosition:: db
wBillsPCScrollPosition:: db wBillsPCScrollPosition:: db
@ -1198,6 +1191,7 @@ wPrevWarp:: db
wEvolvableFlags:: db wEvolvableFlags:: db
UNION UNION
wBoostExpByExpAll::
wSkipMovesBeforeLevelUp:: wSkipMovesBeforeLevelUp::
wListMovesLineSpacing:: wListMovesLineSpacing::
wFieldMoveScriptID:: db wFieldMoveScriptID:: db
@ -1278,14 +1272,15 @@ wTempBattleMonSpecies:: ds 1
wEnemyMon:: battle_struct wEnemyMon wEnemyMon:: battle_struct wEnemyMon
wEnemyMonBaseStats:: ds NUM_EXP_STATS wEnemyMonBaseStats:: ds NUM_EXP_STATS
wEnemyMonCatchRate:: db wEnemyMonCatchRate:: db
wcdff:: ds 1 wEnemyMonBaseExp:: db
wEnemyMonEnd::
wBattleMode:: db wBattleMode:: db
wTempWildMonSpecies:: ds 1 wTempWildMonSpecies:: ds 1
wOtherTrainerClass:: ds 1 wOtherTrainerClass:: ds 1
wBattleType:: db wBattleType:: db
wce04:: ds 1 wUnused_GymLeaderNo:: ds 1 ; Unused
wOtherTrainerID:: ds 1 wOtherTrainerID:: ds 1
wBattleEnded:: ds 1 wBattleEnded:: ds 1
@ -1354,7 +1349,7 @@ wMonHLearnset::
wMonHeaderEnd:: wMonHeaderEnd::
wce26:: ds 1 wMapAnimsBackup:: db
ds 2 ds 2
@ -1388,10 +1383,8 @@ wApplyStatLevelMultipliersToEnemy::
wce37:: wce37::
db db
wce38:: ds 1 wFailedToFlee:: db
wNumFleeAttempts:: db
wNumFleeAttempts::
wce39:: ds 1
wMonTriedToEvolve:: db wMonTriedToEvolve:: db
@ -1840,8 +1833,16 @@ wOTPartySpeciesEnd:: db
SECTION "Wild mon buffer", WRAM0[$D91B] SECTION "Wild mon buffer", WRAM0[$D91B]
UNION UNION
wWildMons:: wWildMonData::
ds 41
wMornEncounterRate:: db
wDayEncounterRate:: db
wNiteEncounterRate:: db
wWildMons:: ds NUM_GRASSMON * 2
ds 2
NEXTU NEXTU
wOTPartyMons:: wOTPartyMons::
; wOTPartyMon1 - wOTPartyMon6 ; wOTPartyMon1 - wOTPartyMon6