mirror of
https://github.com/thornAvery/kep-hack.git
synced 2025-09-17 02:40:50 +12:00
Merge pull request #301 from Rangi42/master
Sync home and macro code with pokeyellow
This commit is contained in:
commit
d3f1352875
|
@ -2,16 +2,6 @@ TILE_WIDTH EQU 8 ; pixels
|
||||||
LEN_1BPP_TILE EQU 1 * TILE_WIDTH ; bytes
|
LEN_1BPP_TILE EQU 1 * TILE_WIDTH ; bytes
|
||||||
LEN_2BPP_TILE EQU 2 * TILE_WIDTH ; bytes
|
LEN_2BPP_TILE EQU 2 * TILE_WIDTH ; bytes
|
||||||
|
|
||||||
const_def
|
|
||||||
const SHADE_WHITE ; %00
|
|
||||||
const SHADE_LIGHT ; %01
|
|
||||||
const SHADE_DARK ; %10
|
|
||||||
const SHADE_BLACK ; %11
|
|
||||||
NUM_PAL_COLORS EQU const_value
|
|
||||||
|
|
||||||
PAL_COLOR_SIZE EQU 2
|
|
||||||
PALETTE_SIZE EQU NUM_PAL_COLORS * PAL_COLOR_SIZE
|
|
||||||
|
|
||||||
SCREEN_WIDTH EQU 20
|
SCREEN_WIDTH EQU 20
|
||||||
SCREEN_HEIGHT EQU 18
|
SCREEN_HEIGHT EQU 18
|
||||||
SCREEN_WIDTH_PX EQU SCREEN_WIDTH * TILE_WIDTH ; pixels
|
SCREEN_WIDTH_PX EQU SCREEN_WIDTH * TILE_WIDTH ; pixels
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
; monochrome palette color ids
|
; monochrome palette color ids
|
||||||
const_def
|
const_def
|
||||||
const WHITE
|
const SHADE_WHITE ; %00
|
||||||
const LIGHT_GRAY
|
const SHADE_LIGHT ; %01
|
||||||
const DARK_GRAY
|
const SHADE_DARK ; %10
|
||||||
const BLACK
|
const SHADE_BLACK ; %11
|
||||||
|
NUM_PAL_COLORS EQU const_value
|
||||||
|
|
||||||
|
PAL_COLOR_SIZE EQU 2
|
||||||
|
PALETTE_SIZE EQU NUM_PAL_COLORS * PAL_COLOR_SIZE
|
||||||
|
|
||||||
; pal/blk packets
|
; pal/blk packets
|
||||||
; SetPalFunctions indexes (see engine/gfx/palettes.asm)
|
; SetPalFunctions indexes (see engine/gfx/palettes.asm)
|
||||||
|
|
|
@ -48,11 +48,11 @@ FirstMapSpec:
|
||||||
special_warp_spec REDS_HOUSE_2F, 3, 6, REDS_HOUSE_2
|
special_warp_spec REDS_HOUSE_2F, 3, 6, REDS_HOUSE_2
|
||||||
TradeCenterSpec1:
|
TradeCenterSpec1:
|
||||||
special_warp_spec TRADE_CENTER, 3, 4, CLUB
|
special_warp_spec TRADE_CENTER, 3, 4, CLUB
|
||||||
TradeCenterSpec2:
|
TradeCenterSpec2:
|
||||||
special_warp_spec TRADE_CENTER, 6, 4, CLUB
|
special_warp_spec TRADE_CENTER, 6, 4, CLUB
|
||||||
ColosseumSpec1:
|
ColosseumSpec1:
|
||||||
special_warp_spec COLOSSEUM, 3, 4, CLUB
|
special_warp_spec COLOSSEUM, 3, 4, CLUB
|
||||||
ColosseumSpec2:
|
ColosseumSpec2:
|
||||||
special_warp_spec COLOSSEUM, 6, 4, CLUB
|
special_warp_spec COLOSSEUM, 6, 4, CLUB
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
; unique moves for gym leaders
|
; unique moves for gym leaders
|
||||||
; this is not automatic! you have to write the index you want to [wLoneAttackNo]
|
; this is not automatic! you have to write the index you want to [wLoneAttackNo]
|
||||||
; first. e.g., erika's script writes 4 to [wLoneAttackNo] to get mega drain,
|
; first. e.g., erika's script writes 4 to [wLoneAttackNo] to get mega drain,
|
||||||
; the fourth entry in the list.
|
; the fourth entry in the list.
|
||||||
LoneMoves:
|
LoneMoves:
|
||||||
; pokemon index, move to give nth pokemon
|
; pokemon index, move to give nth pokemon
|
||||||
|
|
|
@ -133,7 +133,7 @@ DrawFrameBlock:
|
||||||
.afterDrawingTiles
|
.afterDrawingTiles
|
||||||
ld a, [wFBMode]
|
ld a, [wFBMode]
|
||||||
cp FRAMEBLOCKMODE_02
|
cp FRAMEBLOCKMODE_02
|
||||||
jr z, .advanceFrameBlockDestAddr; skip delay and don't clean OAM buffer
|
jr z, .advanceFrameBlockDestAddr ; skip delay and don't clean OAM buffer
|
||||||
ld a, [wSubAnimFrameDelay]
|
ld a, [wSubAnimFrameDelay]
|
||||||
ld c, a
|
ld c, a
|
||||||
call DelayFrames
|
call DelayFrames
|
||||||
|
@ -2410,7 +2410,7 @@ FallingObjects_InitXCoords:
|
||||||
ret
|
ret
|
||||||
|
|
||||||
FallingObjects_InitialXCoords:
|
FallingObjects_InitialXCoords:
|
||||||
db $38,$40,$50,$60,$70,$88,$90,$56,$67,$4A,$77,$84,$98,$32,$22,$5C,$6C,$7D,$8E,$99
|
db $38, $40, $50, $60, $70, $88, $90, $56, $67, $4A, $77, $84, $98, $32, $22, $5C, $6C, $7D, $8E, $99
|
||||||
|
|
||||||
FallingObjects_InitMovementData:
|
FallingObjects_InitMovementData:
|
||||||
ld hl, wFallingObjectsMovementData
|
ld hl, wFallingObjectsMovementData
|
||||||
|
@ -2426,7 +2426,7 @@ FallingObjects_InitMovementData:
|
||||||
ret
|
ret
|
||||||
|
|
||||||
FallingObjects_InitialMovementData:
|
FallingObjects_InitialMovementData:
|
||||||
db $00,$84,$06,$81,$02,$88,$01,$83,$05,$89,$09,$80,$07,$87,$03,$82,$04,$85,$08,$86
|
db $00, $84, $06, $81, $02, $88, $01, $83, $05, $89, $09, $80, $07, $87, $03, $82, $04, $85, $08, $86
|
||||||
|
|
||||||
AnimationShakeEnemyHUD:
|
AnimationShakeEnemyHUD:
|
||||||
; Shakes the enemy HUD.
|
; Shakes the enemy HUD.
|
||||||
|
@ -2583,7 +2583,7 @@ TossBallAnimation:
|
||||||
|
|
||||||
.PokeBallAnimations:
|
.PokeBallAnimations:
|
||||||
; sequence of animations that make up the Poké Ball toss
|
; sequence of animations that make up the Poké Ball toss
|
||||||
db POOF_ANIM,HIDEPIC_ANIM,SHAKE_ANIM,POOF_ANIM,SHOWPIC_ANIM
|
db POOF_ANIM, HIDEPIC_ANIM, SHAKE_ANIM, POOF_ANIM, SHOWPIC_ANIM
|
||||||
|
|
||||||
.BlockBall
|
.BlockBall
|
||||||
ld a, TOSS_ANIM
|
ld a, TOSS_ANIM
|
||||||
|
|
|
@ -1098,7 +1098,7 @@ ChooseNextMon:
|
||||||
ld a, [wLinkState]
|
ld a, [wLinkState]
|
||||||
cp LINK_STATE_BATTLING
|
cp LINK_STATE_BATTLING
|
||||||
jr nz, .notLinkBattle
|
jr nz, .notLinkBattle
|
||||||
inc a
|
inc a ; 1
|
||||||
ld [wActionResultOrTookBattleTurn], a
|
ld [wActionResultOrTookBattleTurn], a
|
||||||
call LinkBattleExchangeData
|
call LinkBattleExchangeData
|
||||||
.notLinkBattle
|
.notLinkBattle
|
||||||
|
@ -1724,7 +1724,7 @@ SendOutMon:
|
||||||
ld hl, wEnemyMonHP
|
ld hl, wEnemyMonHP
|
||||||
ld a, [hli]
|
ld a, [hli]
|
||||||
or [hl] ; is enemy mon HP zero?
|
or [hl] ; is enemy mon HP zero?
|
||||||
jp z, .skipDrawingEnemyHUDAndHPBar; if HP is zero, skip drawing the HUD and HP bar
|
jp z, .skipDrawingEnemyHUDAndHPBar ; if HP is zero, skip drawing the HUD and HP bar
|
||||||
call DrawEnemyHUDAndHPBar
|
call DrawEnemyHUDAndHPBar
|
||||||
.skipDrawingEnemyHUDAndHPBar
|
.skipDrawingEnemyHUDAndHPBar
|
||||||
call DrawPlayerHUDAndHPBar
|
call DrawPlayerHUDAndHPBar
|
||||||
|
@ -2017,14 +2017,16 @@ DisplayBattleMenu::
|
||||||
dec a
|
dec a
|
||||||
jp nz, .handleBattleMenuInput ; handle menu input if it's not the old man tutorial
|
jp nz, .handleBattleMenuInput ; handle menu input if it's not the old man tutorial
|
||||||
; the following happens for the old man tutorial
|
; the following happens for the old man tutorial
|
||||||
|
; Temporarily save the player name in wGrassRate,
|
||||||
|
; which is supposed to get overwritten when entering a
|
||||||
|
; map with wild Pokémon.
|
||||||
|
; Due to an oversight, the data may not get
|
||||||
|
; overwritten (on Cinnabar and Route 21) and the infamous
|
||||||
|
; Missingno. glitch can show up.
|
||||||
ld hl, wPlayerName
|
ld hl, wPlayerName
|
||||||
ld de, wGrassRate
|
ld de, wGrassRate
|
||||||
ld bc, NAME_LENGTH
|
ld bc, NAME_LENGTH
|
||||||
call CopyData ; temporarily save the player name in unused space,
|
call CopyData
|
||||||
; which is supposed to get overwritten when entering a
|
|
||||||
; map with wild Pokémon. Due to an oversight, the data
|
|
||||||
; may not get overwritten (cinnabar) and the infamous
|
|
||||||
; Missingno. glitch can show up.
|
|
||||||
ld hl, .oldManName
|
ld hl, .oldManName
|
||||||
ld de, wPlayerName
|
ld de, wPlayerName
|
||||||
ld bc, NAME_LENGTH
|
ld bc, NAME_LENGTH
|
||||||
|
@ -2206,7 +2208,7 @@ BagWasSelected:
|
||||||
OldManItemList:
|
OldManItemList:
|
||||||
db 1 ; # items
|
db 1 ; # items
|
||||||
db POKE_BALL, 50
|
db POKE_BALL, 50
|
||||||
db -1
|
db -1 ; end
|
||||||
|
|
||||||
DisplayPlayerBag:
|
DisplayPlayerBag:
|
||||||
; get the pointer to player's bag when in a normal battle
|
; get the pointer to player's bag when in a normal battle
|
||||||
|
@ -4101,7 +4103,7 @@ CheckForDisobedience:
|
||||||
call GetCurrentMove
|
call GetCurrentMove
|
||||||
.canUseMove
|
.canUseMove
|
||||||
ld a, $1
|
ld a, $1
|
||||||
and a; clear Z flag
|
and a ; clear Z flag
|
||||||
ret
|
ret
|
||||||
.cannotUseMove
|
.cannotUseMove
|
||||||
xor a ; set Z flag
|
xor a ; set Z flag
|
||||||
|
@ -4485,7 +4487,7 @@ CalculateDamage:
|
||||||
ld b, 4
|
ld b, 4
|
||||||
call Divide
|
call Divide
|
||||||
|
|
||||||
; Update wCurDamage.
|
; Update wCurDamage.
|
||||||
; Capped at MAX_NEUTRAL_DAMAGE - MIN_NEUTRAL_DAMAGE: 999 - 2 = 997.
|
; Capped at MAX_NEUTRAL_DAMAGE - MIN_NEUTRAL_DAMAGE: 999 - 2 = 997.
|
||||||
ld hl, wDamage
|
ld hl, wDamage
|
||||||
ld b, [hl]
|
ld b, [hl]
|
||||||
|
@ -4574,7 +4576,7 @@ JumpToOHKOMoveEffect:
|
||||||
INCLUDE "data/battle/unused_critical_hit_moves.asm"
|
INCLUDE "data/battle/unused_critical_hit_moves.asm"
|
||||||
|
|
||||||
; determines if attack is a critical hit
|
; determines if attack is a critical hit
|
||||||
; azure heights claims "the fastest pokémon (who are,not coincidentally,
|
; Azure Heights claims "the fastest pokémon (who are, not coincidentally,
|
||||||
; among the most popular) tend to CH about 20 to 25% of the time."
|
; among the most popular) tend to CH about 20 to 25% of the time."
|
||||||
CriticalHitTest:
|
CriticalHitTest:
|
||||||
xor a
|
xor a
|
||||||
|
@ -6302,7 +6304,7 @@ LoadPlayerBackPic:
|
||||||
dec a ; is it the old man tutorial?
|
dec a ; is it the old man tutorial?
|
||||||
ld de, RedPicBack
|
ld de, RedPicBack
|
||||||
jr nz, .next
|
jr nz, .next
|
||||||
ld de, OldManPic
|
ld de, OldManPicBack
|
||||||
.next
|
.next
|
||||||
ld a, BANK(RedPicBack)
|
ld a, BANK(RedPicBack)
|
||||||
call UncompressSpriteFromDE
|
call UncompressSpriteFromDE
|
||||||
|
|
|
@ -37,7 +37,7 @@ DecrementPP:
|
||||||
ld a, [wPlayerMoveListIndex] ; which move (0, 1, 2, 3) did we use?
|
ld a, [wPlayerMoveListIndex] ; which move (0, 1, 2, 3) did we use?
|
||||||
ld c, a
|
ld c, a
|
||||||
ld b, 0
|
ld b, 0
|
||||||
add hl ,bc ; calculate the address in memory of the PP we need to decrement
|
add hl, bc ; calculate the address in memory of the PP we need to decrement
|
||||||
; based on the move chosen.
|
; based on the move chosen.
|
||||||
dec [hl] ; Decrement PP
|
dec [hl] ; Decrement PP
|
||||||
ret
|
ret
|
||||||
|
|
|
@ -198,7 +198,7 @@ FreezeBurnParalyzeEffect:
|
||||||
ret nz ; return if they have a substitute, can't effect them
|
ret nz ; return if they have a substitute, can't effect them
|
||||||
ldh a, [hWhoseTurn]
|
ldh a, [hWhoseTurn]
|
||||||
and a
|
and a
|
||||||
jp nz, opponentAttacker
|
jp nz, .opponentAttacker
|
||||||
ld a, [wEnemyMonStatus]
|
ld a, [wEnemyMonStatus]
|
||||||
and a
|
and a
|
||||||
jp nz, CheckDefrost ; can't inflict status if opponent is already statused
|
jp nz, CheckDefrost ; can't inflict status if opponent is already statused
|
||||||
|
@ -224,17 +224,17 @@ FreezeBurnParalyzeEffect:
|
||||||
ret nc ; do nothing if random value is >= 1A or 4D [no status applied]
|
ret nc ; do nothing if random value is >= 1A or 4D [no status applied]
|
||||||
ld a, b ; what type of effect is this?
|
ld a, b ; what type of effect is this?
|
||||||
cp BURN_SIDE_EFFECT1
|
cp BURN_SIDE_EFFECT1
|
||||||
jr z, .burn
|
jr z, .burn1
|
||||||
cp FREEZE_SIDE_EFFECT
|
cp FREEZE_SIDE_EFFECT
|
||||||
jr z, .freeze
|
jr z, .freeze1
|
||||||
; .paralyze
|
; .paralyze1
|
||||||
ld a, 1 << PAR
|
ld a, 1 << PAR
|
||||||
ld [wEnemyMonStatus], a
|
ld [wEnemyMonStatus], a
|
||||||
call QuarterSpeedDueToParalysis ; quarter speed of affected mon
|
call QuarterSpeedDueToParalysis ; quarter speed of affected mon
|
||||||
ld a, ANIM_A9
|
ld a, ANIM_A9
|
||||||
call PlayBattleAnimation
|
call PlayBattleAnimation
|
||||||
jp PrintMayNotAttackText ; print paralysis text
|
jp PrintMayNotAttackText ; print paralysis text
|
||||||
.burn
|
.burn1
|
||||||
ld a, 1 << BRN
|
ld a, 1 << BRN
|
||||||
ld [wEnemyMonStatus], a
|
ld [wEnemyMonStatus], a
|
||||||
call HalveAttackDueToBurn ; halve attack of affected mon
|
call HalveAttackDueToBurn ; halve attack of affected mon
|
||||||
|
@ -242,7 +242,7 @@ FreezeBurnParalyzeEffect:
|
||||||
call PlayBattleAnimation
|
call PlayBattleAnimation
|
||||||
ld hl, BurnedText
|
ld hl, BurnedText
|
||||||
jp PrintText
|
jp PrintText
|
||||||
.freeze
|
.freeze1
|
||||||
call ClearHyperBeam ; resets hyper beam (recharge) condition from target
|
call ClearHyperBeam ; resets hyper beam (recharge) condition from target
|
||||||
ld a, 1 << FRZ
|
ld a, 1 << FRZ
|
||||||
ld [wEnemyMonStatus], a
|
ld [wEnemyMonStatus], a
|
||||||
|
@ -250,7 +250,7 @@ FreezeBurnParalyzeEffect:
|
||||||
call PlayBattleAnimation
|
call PlayBattleAnimation
|
||||||
ld hl, FrozenText
|
ld hl, FrozenText
|
||||||
jp PrintText
|
jp PrintText
|
||||||
opponentAttacker:
|
.opponentAttacker
|
||||||
ld a, [wBattleMonStatus] ; mostly same as above with addresses swapped for opponent
|
ld a, [wBattleMonStatus] ; mostly same as above with addresses swapped for opponent
|
||||||
and a
|
and a
|
||||||
jp nz, CheckDefrost
|
jp nz, CheckDefrost
|
||||||
|
@ -265,10 +265,10 @@ opponentAttacker:
|
||||||
ld a, [wEnemyMoveEffect]
|
ld a, [wEnemyMoveEffect]
|
||||||
cp PARALYZE_SIDE_EFFECT1 + 1
|
cp PARALYZE_SIDE_EFFECT1 + 1
|
||||||
ld b, $1a
|
ld b, $1a
|
||||||
jr c, .next1
|
jr c, .next2
|
||||||
ld b, $4d
|
ld b, $4d
|
||||||
sub $1e
|
sub $1e
|
||||||
.next1
|
.next2
|
||||||
push af
|
push af
|
||||||
call BattleRandom
|
call BattleRandom
|
||||||
cp b
|
cp b
|
||||||
|
@ -276,20 +276,21 @@ opponentAttacker:
|
||||||
ret nc
|
ret nc
|
||||||
ld a, b
|
ld a, b
|
||||||
cp BURN_SIDE_EFFECT1
|
cp BURN_SIDE_EFFECT1
|
||||||
jr z, .burn
|
jr z, .burn2
|
||||||
cp FREEZE_SIDE_EFFECT
|
cp FREEZE_SIDE_EFFECT
|
||||||
jr z, .freeze
|
jr z, .freeze2
|
||||||
|
; .paralyze2
|
||||||
ld a, 1 << PAR
|
ld a, 1 << PAR
|
||||||
ld [wBattleMonStatus], a
|
ld [wBattleMonStatus], a
|
||||||
call QuarterSpeedDueToParalysis
|
call QuarterSpeedDueToParalysis
|
||||||
jp PrintMayNotAttackText
|
jp PrintMayNotAttackText
|
||||||
.burn
|
.burn2
|
||||||
ld a, 1 << BRN
|
ld a, 1 << BRN
|
||||||
ld [wBattleMonStatus], a
|
ld [wBattleMonStatus], a
|
||||||
call HalveAttackDueToBurn
|
call HalveAttackDueToBurn
|
||||||
ld hl, BurnedText
|
ld hl, BurnedText
|
||||||
jp PrintText
|
jp PrintText
|
||||||
.freeze
|
.freeze2
|
||||||
; hyper beam bits aren't reseted for opponent's side
|
; hyper beam bits aren't reseted for opponent's side
|
||||||
ld a, 1 << FRZ
|
ld a, 1 << FRZ
|
||||||
ld [wBattleMonStatus], a
|
ld [wBattleMonStatus], a
|
||||||
|
@ -458,14 +459,14 @@ UpdateStatDone:
|
||||||
ld bc, wPlayerMonMinimized
|
ld bc, wPlayerMonMinimized
|
||||||
ldh a, [hWhoseTurn]
|
ldh a, [hWhoseTurn]
|
||||||
and a
|
and a
|
||||||
jr z, .asm_3f4e6
|
jr z, .playerTurn
|
||||||
ld hl, wEnemyBattleStatus2
|
ld hl, wEnemyBattleStatus2
|
||||||
ld de, wEnemyMoveNum
|
ld de, wEnemyMoveNum
|
||||||
ld bc, wEnemyMonMinimized
|
ld bc, wEnemyMonMinimized
|
||||||
.asm_3f4e6
|
.playerTurn
|
||||||
ld a, [de]
|
ld a, [de]
|
||||||
cp MINIMIZE
|
cp MINIMIZE
|
||||||
jr nz, .asm_3f4f9
|
jr nz, .notMinimize
|
||||||
; if a substitute is up, slide off the substitute and show the mon pic before
|
; if a substitute is up, slide off the substitute and show the mon pic before
|
||||||
; playing the minimize animation
|
; playing the minimize animation
|
||||||
bit HAS_SUBSTITUTE_UP, [hl]
|
bit HAS_SUBSTITUTE_UP, [hl]
|
||||||
|
@ -476,7 +477,7 @@ UpdateStatDone:
|
||||||
push de
|
push de
|
||||||
call nz, Bankswitch
|
call nz, Bankswitch
|
||||||
pop de
|
pop de
|
||||||
.asm_3f4f9
|
.notMinimize
|
||||||
call PlayCurrentMoveAnimation
|
call PlayCurrentMoveAnimation
|
||||||
ld a, [de]
|
ld a, [de]
|
||||||
cp MINIMIZE
|
cp MINIMIZE
|
||||||
|
|
|
@ -74,7 +74,7 @@ CopyMonPicFromBGToSpriteVRAM:
|
||||||
ld [hli], a
|
ld [hli], a
|
||||||
ld a, d
|
ld a, d
|
||||||
ld [hli], a
|
ld [hli], a
|
||||||
ld a, $10 ; use OBP1
|
ld a, OAM_OBP1
|
||||||
ld [hli], a
|
ld [hli], a
|
||||||
inc d
|
inc d
|
||||||
dec c
|
dec c
|
||||||
|
|
|
@ -86,7 +86,7 @@ HealEffect_:
|
||||||
ld [wHPBarNewHP], a
|
ld [wHPBarNewHP], a
|
||||||
.playAnim
|
.playAnim
|
||||||
ld hl, PlayCurrentMoveAnimation
|
ld hl, PlayCurrentMoveAnimation
|
||||||
call BankswitchEtoF
|
call EffectCallBattleCore
|
||||||
ldh a, [hWhoseTurn]
|
ldh a, [hWhoseTurn]
|
||||||
and a
|
and a
|
||||||
hlcoord 10, 9
|
hlcoord 10, 9
|
||||||
|
@ -98,14 +98,14 @@ HealEffect_:
|
||||||
ld [wHPBarType], a
|
ld [wHPBarType], a
|
||||||
predef UpdateHPBar2
|
predef UpdateHPBar2
|
||||||
ld hl, DrawHUDsAndHPBars
|
ld hl, DrawHUDsAndHPBars
|
||||||
call BankswitchEtoF
|
call EffectCallBattleCore
|
||||||
ld hl, RegainedHealthText
|
ld hl, RegainedHealthText
|
||||||
jp PrintText
|
jp PrintText
|
||||||
.failed
|
.failed
|
||||||
ld c, 50
|
ld c, 50
|
||||||
call DelayFrames
|
call DelayFrames
|
||||||
ld hl, PrintButItFailedText_
|
ld hl, PrintButItFailedText_
|
||||||
jp BankswitchEtoF
|
jp EffectCallBattleCore
|
||||||
|
|
||||||
StartedSleepingEffect:
|
StartedSleepingEffect:
|
||||||
text_far _StartedSleepingEffect
|
text_far _StartedSleepingEffect
|
||||||
|
|
|
@ -23,14 +23,14 @@ ReflectLightScreenEffect_:
|
||||||
.playAnim
|
.playAnim
|
||||||
push hl
|
push hl
|
||||||
ld hl, PlayCurrentMoveAnimation
|
ld hl, PlayCurrentMoveAnimation
|
||||||
call BankswitchEtoF
|
call EffectCallBattleCore
|
||||||
pop hl
|
pop hl
|
||||||
jp PrintText
|
jp PrintText
|
||||||
.moveFailed
|
.moveFailed
|
||||||
ld c, 50
|
ld c, 50
|
||||||
call DelayFrames
|
call DelayFrames
|
||||||
ld hl, PrintButItFailedText_
|
ld hl, PrintButItFailedText_
|
||||||
jp BankswitchEtoF
|
jp EffectCallBattleCore
|
||||||
|
|
||||||
LightScreenProtectedText:
|
LightScreenProtectedText:
|
||||||
text_far _LightScreenProtectedText
|
text_far _LightScreenProtectedText
|
||||||
|
@ -40,6 +40,6 @@ ReflectGainedArmorText:
|
||||||
text_far _ReflectGainedArmorText
|
text_far _ReflectGainedArmorText
|
||||||
text_end
|
text_end
|
||||||
|
|
||||||
BankswitchEtoF:
|
EffectCallBattleCore:
|
||||||
ld b, BANK(BattleCore)
|
ld b, BANK(BattleCore)
|
||||||
jp Bankswitch
|
jp Bankswitch
|
||||||
|
|
|
@ -141,7 +141,7 @@ TransformEffect_:
|
||||||
|
|
||||||
.failed
|
.failed
|
||||||
ld hl, PrintButItFailedText_
|
ld hl, PrintButItFailedText_
|
||||||
jp BankswitchEtoF
|
jp EffectCallBattleCore
|
||||||
|
|
||||||
TransformedText:
|
TransformedText:
|
||||||
text_far _TransformedText
|
text_far _TransformedText
|
||||||
|
|
|
@ -16,7 +16,7 @@ ReadTrainer:
|
||||||
|
|
||||||
; get the pointer to trainer data for this class
|
; get the pointer to trainer data for this class
|
||||||
ld a, [wCurOpponent]
|
ld a, [wCurOpponent]
|
||||||
sub $C9 ; convert value from pokemon to trainer
|
sub OPP_ID_OFFSET + 1 ; convert value from pokemon to trainer
|
||||||
add a
|
add a
|
||||||
ld hl, TrainerDataPointers
|
ld hl, TrainerDataPointers
|
||||||
ld c, a
|
ld c, a
|
||||||
|
@ -79,7 +79,7 @@ ReadTrainer:
|
||||||
pop hl
|
pop hl
|
||||||
jr .SpecialTrainer
|
jr .SpecialTrainer
|
||||||
.AddLoneMove
|
.AddLoneMove
|
||||||
; does the trainer have a single monster with a different move
|
; does the trainer have a single monster with a different move?
|
||||||
ld a, [wLoneAttackNo] ; Brock is 01, Misty is 02, Erika is 04, etc
|
ld a, [wLoneAttackNo] ; Brock is 01, Misty is 02, Erika is 04, etc
|
||||||
and a
|
and a
|
||||||
jr z, .AddTeamMove
|
jr z, .AddTeamMove
|
||||||
|
|
|
@ -2,18 +2,18 @@ PrintSafariZoneBattleText:
|
||||||
ld hl, wSafariBaitFactor
|
ld hl, wSafariBaitFactor
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
and a
|
and a
|
||||||
jr z, .asm_4284
|
jr z, .no_bait
|
||||||
dec [hl]
|
dec [hl]
|
||||||
ld hl, SafariZoneEatingText
|
ld hl, SafariZoneEatingText
|
||||||
jr .asm_429f
|
jr .done
|
||||||
.asm_4284
|
.no_bait
|
||||||
dec hl
|
dec hl
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
and a
|
and a
|
||||||
ret z
|
ret z
|
||||||
dec [hl]
|
dec [hl]
|
||||||
ld hl, SafariZoneAngryText
|
ld hl, SafariZoneAngryText
|
||||||
jr nz, .asm_429f
|
jr nz, .done
|
||||||
push hl
|
push hl
|
||||||
ld a, [wEnemyMonSpecies]
|
ld a, [wEnemyMonSpecies]
|
||||||
ld [wd0b5], a
|
ld [wd0b5], a
|
||||||
|
@ -21,7 +21,7 @@ PrintSafariZoneBattleText:
|
||||||
ld a, [wMonHCatchRate]
|
ld a, [wMonHCatchRate]
|
||||||
ld [wEnemyMonActualCatchRate], a
|
ld [wEnemyMonActualCatchRate], a
|
||||||
pop hl
|
pop hl
|
||||||
.asm_429f
|
.done
|
||||||
push hl
|
push hl
|
||||||
call LoadScreenTilesFromBuffer1
|
call LoadScreenTilesFromBuffer1
|
||||||
pop hl
|
pop hl
|
||||||
|
|
|
@ -4,11 +4,11 @@
|
||||||
ScaleSpriteByTwo:
|
ScaleSpriteByTwo:
|
||||||
ld de, sSpriteBuffer1 + (4*4*8) - 5 ; last byte of input data, last 4 rows already skipped
|
ld de, sSpriteBuffer1 + (4*4*8) - 5 ; last byte of input data, last 4 rows already skipped
|
||||||
ld hl, sSpriteBuffer0 + SPRITEBUFFERSIZE - 1 ; end of destination buffer
|
ld hl, sSpriteBuffer0 + SPRITEBUFFERSIZE - 1 ; end of destination buffer
|
||||||
call ScaleLastSpriteColumnByTwo ; last tile column is special case
|
call ScaleLastSpriteColumnByTwo ; last tile column is special case
|
||||||
call ScaleFirstThreeSpriteColumnsByTwo ; scale first 3 tile columns
|
call ScaleFirstThreeSpriteColumnsByTwo ; scale first 3 tile columns
|
||||||
ld de, sSpriteBuffer2 + (4*4*8) - 5 ; last byte of input data, last 4 rows already skipped
|
ld de, sSpriteBuffer2 + (4*4*8) - 5 ; last byte of input data, last 4 rows already skipped
|
||||||
ld hl, sSpriteBuffer1 + SPRITEBUFFERSIZE - 1 ; end of destination buffer
|
ld hl, sSpriteBuffer1 + SPRITEBUFFERSIZE - 1 ; end of destination buffer
|
||||||
call ScaleLastSpriteColumnByTwo ; last tile column is special case
|
call ScaleLastSpriteColumnByTwo ; last tile column is special case
|
||||||
|
|
||||||
ScaleFirstThreeSpriteColumnsByTwo:
|
ScaleFirstThreeSpriteColumnsByTwo:
|
||||||
ld b, $3 ; 3 tile columns
|
ld b, $3 ; 3 tile columns
|
||||||
|
|
|
@ -294,7 +294,7 @@ TrainerAI:
|
||||||
ret z ; if not a trainer, we're done here
|
ret z ; if not a trainer, we're done here
|
||||||
ld a, [wLinkState]
|
ld a, [wLinkState]
|
||||||
cp LINK_STATE_BATTLING
|
cp LINK_STATE_BATTLING
|
||||||
ret z
|
ret z ; if in a link battle, we're done as well
|
||||||
ld a, [wTrainerClass] ; what trainer class is this?
|
ld a, [wTrainerClass] ; what trainer class is this?
|
||||||
dec a
|
dec a
|
||||||
ld c, a
|
ld c, a
|
||||||
|
|
|
@ -353,10 +353,10 @@ SendSGBPacket:
|
||||||
ld d, a
|
ld d, a
|
||||||
.nextBit0
|
.nextBit0
|
||||||
bit 0, d
|
bit 0, d
|
||||||
; if 0th bit is not zero set P14=HIGH,P15=LOW (send bit 1)
|
; if 0th bit is not zero set P14=HIGH, P15=LOW (send bit 1)
|
||||||
ld a, $10
|
ld a, $10
|
||||||
jr nz, .next0
|
jr nz, .next0
|
||||||
; else (if 0th bit is zero) set P14=LOW,P15=HIGH (send bit 0)
|
; else (if 0th bit is zero) set P14=LOW, P15=HIGH (send bit 0)
|
||||||
ld a, $20
|
ld a, $20
|
||||||
.next0
|
.next0
|
||||||
ldh [rJOYP], a
|
ldh [rJOYP], a
|
||||||
|
@ -364,7 +364,7 @@ SendSGBPacket:
|
||||||
ld a, $30
|
ld a, $30
|
||||||
ldh [rJOYP], a
|
ldh [rJOYP], a
|
||||||
; rotation will put next bit in 0th position (so we can always use command
|
; rotation will put next bit in 0th position (so we can always use command
|
||||||
; "bit 0,d" to fetch the bit that has to be sent)
|
; "bit 0, d" to fetch the bit that has to be sent)
|
||||||
rr d
|
rr d
|
||||||
; decrease bit counter so we know when we have sent all 8 bits of current byte
|
; decrease bit counter so we know when we have sent all 8 bits of current byte
|
||||||
dec e
|
dec e
|
||||||
|
@ -608,9 +608,7 @@ CopySGBBorderTiles:
|
||||||
; This function converts 2BPP planar data into this format by mapping
|
; This function converts 2BPP planar data into this format by mapping
|
||||||
; 2BPP colors 0-3 to 4BPP colors 0-3. 4BPP colors 4-15 are not used.
|
; 2BPP colors 0-3 to 4BPP colors 0-3. 4BPP colors 4-15 are not used.
|
||||||
ld b, 128
|
ld b, 128
|
||||||
|
|
||||||
.tileLoop
|
.tileLoop
|
||||||
|
|
||||||
; Copy bit planes 1 and 2 of the tile data.
|
; Copy bit planes 1 and 2 of the tile data.
|
||||||
ld c, 16
|
ld c, 16
|
||||||
.copyLoop
|
.copyLoop
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
; b = new colour for BG colour 0 (usually white) for 4 frames
|
; b = new color for BG color 0 (usually white) for 4 frames
|
||||||
ChangeBGPalColor0_4Frames:
|
ChangeBGPalColor0_4Frames:
|
||||||
call GetPredefRegisters
|
call GetPredefRegisters
|
||||||
ldh a, [rBGP]
|
ldh a, [rBGP]
|
||||||
|
|
|
@ -27,7 +27,7 @@ AddItemToInventory_::
|
||||||
ld a, [hli]
|
ld a, [hli]
|
||||||
and a
|
and a
|
||||||
jr z, .addNewItem
|
jr z, .addNewItem
|
||||||
.loop
|
.notAtEndOfInventory
|
||||||
ld a, [hli]
|
ld a, [hli]
|
||||||
ld b, a ; b = ID of current item in table
|
ld b, a ; b = ID of current item in table
|
||||||
ld a, [wcf91] ; a = ID of item being added
|
ld a, [wcf91] ; a = ID of item being added
|
||||||
|
@ -36,7 +36,7 @@ AddItemToInventory_::
|
||||||
inc hl
|
inc hl
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
cp $ff ; is it the end of the table?
|
cp $ff ; is it the end of the table?
|
||||||
jr nz, .loop
|
jr nz, .notAtEndOfInventory
|
||||||
.addNewItem ; add an item not yet in the inventory
|
.addNewItem ; add an item not yet in the inventory
|
||||||
pop hl
|
pop hl
|
||||||
ld a, d
|
ld a, d
|
||||||
|
@ -73,7 +73,7 @@ AddItemToInventory_::
|
||||||
; if so, store 99 in the current slot and store the rest in a new slot
|
; if so, store 99 in the current slot and store the rest in a new slot
|
||||||
ld a, 99
|
ld a, 99
|
||||||
ld [hli], a
|
ld [hli], a
|
||||||
jp .loop
|
jp .notAtEndOfInventory
|
||||||
.increaseItemQuantityFailed
|
.increaseItemQuantityFailed
|
||||||
pop hl
|
pop hl
|
||||||
and a
|
and a
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
PrintWaitingText::
|
PrintWaitingText::
|
||||||
hlcoord 3, 10
|
hlcoord 3, 10
|
||||||
ld b, $1
|
ld b, 1
|
||||||
ld c, $b
|
ld c, 11
|
||||||
ld a, [wIsInBattle]
|
ld a, [wIsInBattle]
|
||||||
and a
|
and a
|
||||||
jr z, .asm_4c17
|
jr z, .trade
|
||||||
|
; battle
|
||||||
call TextBoxBorder
|
call TextBoxBorder
|
||||||
jr .asm_4c1a
|
jr .border_done
|
||||||
.asm_4c17
|
.trade
|
||||||
call CableClub_TextBoxBorder
|
call CableClub_TextBoxBorder
|
||||||
.asm_4c1a
|
.border_done
|
||||||
hlcoord 4, 11
|
hlcoord 4, 11
|
||||||
ld de, WaitingText
|
ld de, WaitingText
|
||||||
call PlaceString
|
call PlaceString
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
|
; divide hMoney by hDivideBCDDivisor
|
||||||
|
; return output in hDivideBCDQuotient (same as hDivideBCDDivisor)
|
||||||
|
; used only to halve player money upon losing a fight
|
||||||
DivideBCDPredef::
|
DivideBCDPredef::
|
||||||
DivideBCDPredef2::
|
DivideBCDPredef2::
|
||||||
DivideBCDPredef3::
|
DivideBCDPredef3:: ; only used function
|
||||||
DivideBCDPredef4::
|
DivideBCDPredef4::
|
||||||
call GetPredefRegisters
|
call GetPredefRegisters
|
||||||
|
|
||||||
|
@ -10,7 +13,7 @@ DivideBCD::
|
||||||
ldh [hDivideBCDBuffer+1], a
|
ldh [hDivideBCDBuffer+1], a
|
||||||
ldh [hDivideBCDBuffer+2], a
|
ldh [hDivideBCDBuffer+2], a
|
||||||
ld d, $1
|
ld d, $1
|
||||||
.mulBy10Loop
|
.mulBy10Loop
|
||||||
; multiply the divisor by 10 until the leading digit is nonzero
|
; multiply the divisor by 10 until the leading digit is nonzero
|
||||||
; to set up the standard long division algorithm
|
; to set up the standard long division algorithm
|
||||||
ldh a, [hDivideBCDDivisor]
|
ldh a, [hDivideBCDDivisor]
|
||||||
|
@ -40,6 +43,7 @@ DivideBCD::
|
||||||
and $f0
|
and $f0
|
||||||
ldh [hDivideBCDDivisor+2], a
|
ldh [hDivideBCDDivisor+2], a
|
||||||
jr .mulBy10Loop
|
jr .mulBy10Loop
|
||||||
|
|
||||||
.next
|
.next
|
||||||
push de
|
push de
|
||||||
push de
|
push de
|
||||||
|
@ -104,7 +108,7 @@ DivideBCD::
|
||||||
ldh a, [hDivideBCDBuffer+2]
|
ldh a, [hDivideBCDBuffer+2]
|
||||||
ldh [hDivideBCDQuotient+2], a
|
ldh [hDivideBCDQuotient+2], a
|
||||||
pop de
|
pop de
|
||||||
ld a, $6
|
ld a, $6
|
||||||
sub d
|
sub d
|
||||||
and a
|
and a
|
||||||
ret z
|
ret z
|
||||||
|
@ -151,8 +155,8 @@ DivideBCD_getNextDigit:
|
||||||
pop bc
|
pop bc
|
||||||
ret c
|
ret c
|
||||||
inc b
|
inc b
|
||||||
ld de, hMoney+2 ; since SubBCD works starting from the least significant digit
|
ld de, hMoney + 2 ; since SubBCD works starting from the least significant digit
|
||||||
ld hl, hDivideBCDDivisor+2
|
ld hl, hDivideBCDDivisor + 2
|
||||||
push bc
|
push bc
|
||||||
call SubBCD
|
call SubBCD
|
||||||
pop bc
|
pop bc
|
||||||
|
|
|
@ -23,7 +23,7 @@ PlayIntro:
|
||||||
PlayIntroScene:
|
PlayIntroScene:
|
||||||
ld b, SET_PAL_NIDORINO_INTRO
|
ld b, SET_PAL_NIDORINO_INTRO
|
||||||
call RunPaletteCommand
|
call RunPaletteCommand
|
||||||
ldPal a, BLACK, DARK_GRAY, LIGHT_GRAY, WHITE
|
ldpal a, SHADE_BLACK, SHADE_DARK, SHADE_LIGHT, SHADE_WHITE
|
||||||
ldh [rBGP], a
|
ldh [rBGP], a
|
||||||
ldh [rOBP0], a
|
ldh [rOBP0], a
|
||||||
ldh [rOBP1], a
|
ldh [rOBP1], a
|
||||||
|
@ -307,7 +307,7 @@ PlayShootingStar:
|
||||||
ld b, SET_PAL_GAME_FREAK_INTRO
|
ld b, SET_PAL_GAME_FREAK_INTRO
|
||||||
call RunPaletteCommand
|
call RunPaletteCommand
|
||||||
farcall LoadCopyrightAndTextBoxTiles
|
farcall LoadCopyrightAndTextBoxTiles
|
||||||
ldPal a, BLACK, DARK_GRAY, LIGHT_GRAY, WHITE
|
ldpal a, SHADE_BLACK, SHADE_DARK, SHADE_LIGHT, SHADE_WHITE
|
||||||
ldh [rBGP], a
|
ldh [rBGP], a
|
||||||
ld c, 180
|
ld c, 180
|
||||||
call DelayFrames
|
call DelayFrames
|
||||||
|
|
|
@ -430,7 +430,7 @@ _MoveMon::
|
||||||
cp PARTY_TO_DAYCARE
|
cp PARTY_TO_DAYCARE
|
||||||
ld de, wDayCareMonOT
|
ld de, wDayCareMonOT
|
||||||
jr z, .findOTsrc
|
jr z, .findOTsrc
|
||||||
dec a
|
dec a
|
||||||
ld hl, wPartyMonOT
|
ld hl, wPartyMonOT
|
||||||
ld a, [wPartyCount]
|
ld a, [wPartyCount]
|
||||||
jr nz, .addOToffset
|
jr nz, .addOToffset
|
||||||
|
|
Before Width: | Height: | Size: 259 B After Width: | Height: | Size: 259 B |
|
@ -264,7 +264,7 @@ StarmiePicFront:: INCBIN "gfx/pokemon/front/starmie.pic"
|
||||||
StarmiePicBack:: INCBIN "gfx/pokemon/back/starmieb.pic"
|
StarmiePicBack:: INCBIN "gfx/pokemon/back/starmieb.pic"
|
||||||
|
|
||||||
RedPicBack:: INCBIN "gfx/player/redb.pic"
|
RedPicBack:: INCBIN "gfx/player/redb.pic"
|
||||||
OldManPic:: INCBIN "gfx/battle/oldman.pic"
|
OldManPicBack:: INCBIN "gfx/battle/oldmanb.pic"
|
||||||
|
|
||||||
|
|
||||||
SECTION "Pics 5", ROMX
|
SECTION "Pics 5", ROMX
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
ClearSprites::
|
ClearSprites::
|
||||||
xor a
|
xor a
|
||||||
ld hl, wOAMBuffer
|
ld hl, wOAMBuffer
|
||||||
ld b, 40 * 4
|
ld b, wOAMBufferEnd - wOAMBuffer
|
||||||
.loop
|
.loop
|
||||||
ld [hli], a
|
ld [hli], a
|
||||||
dec b
|
dec b
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
; These routines manage gradual fading
|
; These routines manage gradual fading
|
||||||
; (e.g., entering a doorway)
|
; (e.g., entering a doorway)
|
||||||
LoadGBPal::
|
LoadGBPal::
|
||||||
ld a, [wMapPalOffset] ;tells if wCurMap is dark (requires HM5_FLASH?)
|
ld a, [wMapPalOffset] ; tells if wCurMap is dark (requires HM5_FLASH?)
|
||||||
ld b, a
|
ld b, a
|
||||||
ld hl, FadePal4
|
ld hl, FadePal4
|
||||||
ld a, l
|
ld a, l
|
||||||
|
|
|
@ -126,7 +126,7 @@ ClearVram::
|
||||||
|
|
||||||
|
|
||||||
StopAllSounds::
|
StopAllSounds::
|
||||||
ld a, BANK(Audio1_UpdateMusic)
|
ld a, BANK("Audio Engine 1")
|
||||||
ld [wAudioROMBank], a
|
ld [wAudioROMBank], a
|
||||||
ld [wAudioSavedROMBank], a
|
ld [wAudioSavedROMBank], a
|
||||||
xor a
|
xor a
|
||||||
|
|
|
@ -22,15 +22,7 @@ AddAmountSoldToMoney::
|
||||||
; [wWhichPokemon] = index (within the inventory) of the item to remove
|
; [wWhichPokemon] = index (within the inventory) of the item to remove
|
||||||
; [wItemQuantity] = quantity to remove
|
; [wItemQuantity] = quantity to remove
|
||||||
RemoveItemFromInventory::
|
RemoveItemFromInventory::
|
||||||
ldh a, [hLoadedROMBank]
|
homecall RemoveItemFromInventory_
|
||||||
push af
|
|
||||||
ld a, BANK(RemoveItemFromInventory_)
|
|
||||||
ldh [hLoadedROMBank], a
|
|
||||||
ld [MBC1RomBank], a
|
|
||||||
call RemoveItemFromInventory_
|
|
||||||
pop af
|
|
||||||
ldh [hLoadedROMBank], a
|
|
||||||
ld [MBC1RomBank], a
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
; function to add an item (in varying quantities) to the player's bag or PC box
|
; function to add an item (in varying quantities) to the player's bag or PC box
|
||||||
|
@ -41,15 +33,6 @@ RemoveItemFromInventory::
|
||||||
; sets carry flag if successful, unsets carry flag if unsuccessful
|
; sets carry flag if successful, unsets carry flag if unsuccessful
|
||||||
AddItemToInventory::
|
AddItemToInventory::
|
||||||
push bc
|
push bc
|
||||||
ldh a, [hLoadedROMBank]
|
homecall_sf AddItemToInventory_
|
||||||
push af
|
|
||||||
ld a, BANK(AddItemToInventory_)
|
|
||||||
ldh [hLoadedROMBank], a
|
|
||||||
ld [MBC1RomBank], a
|
|
||||||
call AddItemToInventory_
|
|
||||||
pop bc
|
|
||||||
ld a, b
|
|
||||||
ldh [hLoadedROMBank], a
|
|
||||||
ld [MBC1RomBank], a
|
|
||||||
pop bc
|
pop bc
|
||||||
ret
|
ret
|
||||||
|
|
|
@ -7,9 +7,9 @@ ReadJoypad::
|
||||||
ld c, 0
|
ld c, 0
|
||||||
|
|
||||||
ldh [rJOYP], a
|
ldh [rJOYP], a
|
||||||
REPT 6
|
REPT 6
|
||||||
ldh a, [rJOYP]
|
ldh a, [rJOYP]
|
||||||
ENDR
|
ENDR
|
||||||
cpl
|
cpl
|
||||||
and %1111
|
and %1111
|
||||||
swap a
|
swap a
|
||||||
|
@ -17,9 +17,9 @@ ReadJoypad::
|
||||||
|
|
||||||
ld a, 1 << 4 ; select button keys
|
ld a, 1 << 4 ; select button keys
|
||||||
ldh [rJOYP], a
|
ldh [rJOYP], a
|
||||||
REPT 10
|
REPT 10
|
||||||
ldh a, [rJOYP]
|
ldh a, [rJOYP]
|
||||||
ENDR
|
ENDR
|
||||||
cpl
|
cpl
|
||||||
and %1111
|
and %1111
|
||||||
or b
|
or b
|
||||||
|
|
|
@ -26,15 +26,7 @@ Divide::
|
||||||
push hl
|
push hl
|
||||||
push de
|
push de
|
||||||
push bc
|
push bc
|
||||||
ldh a, [hLoadedROMBank]
|
homecall _Divide
|
||||||
push af
|
|
||||||
ld a, BANK(_Divide)
|
|
||||||
ldh [hLoadedROMBank], a
|
|
||||||
ld [MBC1RomBank], a
|
|
||||||
call _Divide
|
|
||||||
pop af
|
|
||||||
ldh [hLoadedROMBank], a
|
|
||||||
ld [MBC1RomBank], a
|
|
||||||
pop bc
|
pop bc
|
||||||
pop de
|
pop de
|
||||||
pop hl
|
pop hl
|
||||||
|
|
|
@ -231,27 +231,9 @@ CalcStat::
|
||||||
ret
|
ret
|
||||||
|
|
||||||
AddEnemyMonToPlayerParty::
|
AddEnemyMonToPlayerParty::
|
||||||
ldh a, [hLoadedROMBank]
|
homecall_sf _AddEnemyMonToPlayerParty
|
||||||
push af
|
|
||||||
ld a, BANK(_AddEnemyMonToPlayerParty)
|
|
||||||
ldh [hLoadedROMBank], a
|
|
||||||
ld [MBC1RomBank], a
|
|
||||||
call _AddEnemyMonToPlayerParty
|
|
||||||
pop bc
|
|
||||||
ld a, b
|
|
||||||
ldh [hLoadedROMBank], a
|
|
||||||
ld [MBC1RomBank], a
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
MoveMon::
|
MoveMon::
|
||||||
ldh a, [hLoadedROMBank]
|
homecall_sf _MoveMon
|
||||||
push af
|
|
||||||
ld a, BANK(_MoveMon)
|
|
||||||
ldh [hLoadedROMBank], a
|
|
||||||
ld [MBC1RomBank], a
|
|
||||||
call _MoveMon
|
|
||||||
pop bc
|
|
||||||
ld a, b
|
|
||||||
ldh [hLoadedROMBank], a
|
|
||||||
ld [MBC1RomBank], a
|
|
||||||
ret
|
ret
|
||||||
|
|
|
@ -2321,16 +2321,16 @@ LoadMapData::
|
||||||
; copy current map view to VRAM
|
; copy current map view to VRAM
|
||||||
hlcoord 0, 0
|
hlcoord 0, 0
|
||||||
ld de, vBGMap0
|
ld de, vBGMap0
|
||||||
ld b, 18
|
ld b, SCREEN_HEIGHT
|
||||||
.vramCopyLoop
|
.vramCopyLoop
|
||||||
ld c, 20
|
ld c, SCREEN_WIDTH
|
||||||
.vramCopyInnerLoop
|
.vramCopyInnerLoop
|
||||||
ld a, [hli]
|
ld a, [hli]
|
||||||
ld [de], a
|
ld [de], a
|
||||||
inc e
|
inc e
|
||||||
dec c
|
dec c
|
||||||
jr nz, .vramCopyInnerLoop
|
jr nz, .vramCopyInnerLoop
|
||||||
ld a, 32 - 20
|
ld a, BG_MAP_WIDTH - SCREEN_WIDTH
|
||||||
add e
|
add e
|
||||||
ld e, a
|
ld e, a
|
||||||
jr nc, .noCarry
|
jr nc, .noCarry
|
||||||
|
@ -2366,15 +2366,15 @@ SwitchToMapRomBank::
|
||||||
ld c, a
|
ld c, a
|
||||||
ld b, $00
|
ld b, $00
|
||||||
ld a, BANK(MapHeaderBanks)
|
ld a, BANK(MapHeaderBanks)
|
||||||
call BankswitchHome ; switch to ROM bank 3
|
call BankswitchHome
|
||||||
ld hl, MapHeaderBanks
|
ld hl, MapHeaderBanks
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
ldh [hMapROMBank], a ; save map ROM bank
|
ldh [hMapROMBank], a
|
||||||
call BankswitchBack
|
call BankswitchBack
|
||||||
ldh a, [hMapROMBank]
|
ldh a, [hMapROMBank]
|
||||||
ldh [hLoadedROMBank], a
|
ldh [hLoadedROMBank], a
|
||||||
ld [MBC1RomBank], a ; switch to map ROM bank
|
ld [MBC1RomBank], a
|
||||||
pop bc
|
pop bc
|
||||||
pop hl
|
pop hl
|
||||||
ret
|
ret
|
||||||
|
@ -2395,7 +2395,7 @@ ResetUsingStrengthOutOfBattleBit:
|
||||||
|
|
||||||
ForceBikeOrSurf::
|
ForceBikeOrSurf::
|
||||||
ld b, BANK(RedSprite)
|
ld b, BANK(RedSprite)
|
||||||
ld hl, LoadPlayerSpriteGraphics
|
ld hl, LoadPlayerSpriteGraphics ; in bank 0
|
||||||
call Bankswitch
|
call Bankswitch
|
||||||
jp PlayDefaultMusic ; update map/player state?
|
jp PlayDefaultMusic ; update map/player state?
|
||||||
|
|
||||||
|
|
|
@ -325,16 +325,7 @@ PrintStatusCondition::
|
||||||
ret
|
ret
|
||||||
|
|
||||||
PrintStatusConditionNotFainted::
|
PrintStatusConditionNotFainted::
|
||||||
ldh a, [hLoadedROMBank]
|
homecall_sf PrintStatusAilment
|
||||||
push af
|
|
||||||
ld a, BANK(PrintStatusAilment)
|
|
||||||
ldh [hLoadedROMBank], a
|
|
||||||
ld [MBC1RomBank], a
|
|
||||||
call PrintStatusAilment ; print status condition
|
|
||||||
pop bc
|
|
||||||
ld a, b
|
|
||||||
ldh [hLoadedROMBank], a
|
|
||||||
ld [MBC1RomBank], a
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
; function to print pokemon level, leaving off the ":L" if the level is at least 100
|
; function to print pokemon level, leaving off the ":L" if the level is at least 100
|
||||||
|
|
|
@ -4,7 +4,7 @@ _Start::
|
||||||
xor a
|
xor a
|
||||||
jr .ok
|
jr .ok
|
||||||
.gbc
|
.gbc
|
||||||
ld a, 0
|
ld a, FALSE
|
||||||
.ok
|
.ok
|
||||||
ld [wGBC], a
|
ld [wGBC], a
|
||||||
jp Init
|
jp Init
|
||||||
|
|
|
@ -146,15 +146,7 @@ DisplayPokemartDialogue::
|
||||||
call LoadItemList
|
call LoadItemList
|
||||||
ld a, PRICEDITEMLISTMENU
|
ld a, PRICEDITEMLISTMENU
|
||||||
ld [wListMenuID], a
|
ld [wListMenuID], a
|
||||||
ldh a, [hLoadedROMBank]
|
homecall DisplayPokemartDialogue_
|
||||||
push af
|
|
||||||
ld a, BANK(DisplayPokemartDialogue_)
|
|
||||||
ldh [hLoadedROMBank], a
|
|
||||||
ld [MBC1RomBank], a
|
|
||||||
call DisplayPokemartDialogue_
|
|
||||||
pop af
|
|
||||||
ldh [hLoadedROMBank], a
|
|
||||||
ld [MBC1RomBank], a
|
|
||||||
jp AfterDisplayingTextID
|
jp AfterDisplayingTextID
|
||||||
|
|
||||||
PokemartGreetingText::
|
PokemartGreetingText::
|
||||||
|
@ -185,15 +177,7 @@ DisplayPokemonCenterDialogue::
|
||||||
ldh [hItemPrice + 2], a
|
ldh [hItemPrice + 2], a
|
||||||
|
|
||||||
inc hl
|
inc hl
|
||||||
ldh a, [hLoadedROMBank]
|
homecall DisplayPokemonCenterDialogue_
|
||||||
push af
|
|
||||||
ld a, BANK(DisplayPokemonCenterDialogue_)
|
|
||||||
ldh [hLoadedROMBank], a
|
|
||||||
ld [MBC1RomBank], a
|
|
||||||
call DisplayPokemonCenterDialogue_
|
|
||||||
pop af
|
|
||||||
ldh [hLoadedROMBank], a
|
|
||||||
ld [MBC1RomBank], a
|
|
||||||
jp AfterDisplayingTextID
|
jp AfterDisplayingTextID
|
||||||
|
|
||||||
DisplaySafariGameOverText::
|
DisplaySafariGameOverText::
|
||||||
|
|
|
@ -3,14 +3,5 @@
|
||||||
; [wTextBoxID] = text box ID
|
; [wTextBoxID] = text box ID
|
||||||
; b, c = y, x cursor position (TWO_OPTION_MENU only)
|
; b, c = y, x cursor position (TWO_OPTION_MENU only)
|
||||||
DisplayTextBoxID::
|
DisplayTextBoxID::
|
||||||
ldh a, [hLoadedROMBank]
|
homecall_sf DisplayTextBoxID_
|
||||||
push af
|
|
||||||
ld a, BANK(DisplayTextBoxID_)
|
|
||||||
ldh [hLoadedROMBank], a
|
|
||||||
ld [MBC1RomBank], a
|
|
||||||
call DisplayTextBoxID_
|
|
||||||
pop bc
|
|
||||||
ld a, b
|
|
||||||
ldh [hLoadedROMBank], a
|
|
||||||
ld [MBC1RomBank], a
|
|
||||||
ret
|
ret
|
||||||
|
|
|
@ -561,7 +561,7 @@ ResetSpriteBufferPointers::
|
||||||
|
|
||||||
; maps each nybble to its reverse
|
; maps each nybble to its reverse
|
||||||
NybbleReverseTable::
|
NybbleReverseTable::
|
||||||
db $0, $8, $4, $c, $2, $a, $6 ,$e, $1, $9, $5, $d, $3, $b, $7 ,$f
|
db $0, $8, $4, $c, $2, $a, $6, $e, $1, $9, $5, $d, $3, $b, $7, $f
|
||||||
|
|
||||||
; combines the two loaded chunks with xor (the chunk loaded second is the destination). Both chunks are differeintial decoded beforehand.
|
; combines the two loaded chunks with xor (the chunk loaded second is the destination). Both chunks are differeintial decoded beforehand.
|
||||||
UnpackSpriteMode2::
|
UnpackSpriteMode2::
|
||||||
|
|
|
@ -2,13 +2,5 @@ UpdateSprites::
|
||||||
ld a, [wUpdateSpritesEnabled]
|
ld a, [wUpdateSpritesEnabled]
|
||||||
dec a
|
dec a
|
||||||
ret nz
|
ret nz
|
||||||
ldh a, [hLoadedROMBank]
|
homecall _UpdateSprites
|
||||||
push af
|
|
||||||
ld a, BANK(_UpdateSprites)
|
|
||||||
ldh [hLoadedROMBank], a
|
|
||||||
ld [MBC1RomBank], a
|
|
||||||
call _UpdateSprites
|
|
||||||
pop af
|
|
||||||
ldh [hLoadedROMBank], a
|
|
||||||
ld [MBC1RomBank], a
|
|
||||||
ret
|
ret
|
||||||
|
|
4
hram.asm
4
hram.asm
|
@ -96,8 +96,8 @@ hTilePlayerStandingOn:: db
|
||||||
hSpritePriority:: db
|
hSpritePriority:: db
|
||||||
|
|
||||||
UNION
|
UNION
|
||||||
;; Multiplication and division variables are meant
|
; Multiplication and division variables are meant
|
||||||
;; to overlap for back-to-back usage. Big endian.
|
; to overlap for back-to-back usage. Big endian.
|
||||||
UNION
|
UNION
|
||||||
ds 1
|
ds 1
|
||||||
hMultiplicand:: ds 3
|
hMultiplicand:: ds 3
|
||||||
|
|
|
@ -4,7 +4,7 @@ lb: MACRO ; r, hi, lo
|
||||||
ld \1, ((\2) & $ff) << 8 + ((\3) & $ff)
|
ld \1, ((\2) & $ff) << 8 + ((\3) & $ff)
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
ldPal: MACRO
|
ldpal: MACRO
|
||||||
ld \1, \2 << 6 | \3 << 4 | \4 << 2 | \5
|
ld \1, \2 << 6 | \3 << 4 | \4 << 2 | \5
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
|
|
|
@ -33,3 +33,16 @@ homecall: MACRO
|
||||||
ldh [hLoadedROMBank], a
|
ldh [hLoadedROMBank], a
|
||||||
ld [MBC1RomBank], a
|
ld [MBC1RomBank], a
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
|
homecall_sf: MACRO ; homecall but save flags by popping into bc instead of af
|
||||||
|
ldh a, [hLoadedROMBank]
|
||||||
|
push af
|
||||||
|
ld a, BANK(\1)
|
||||||
|
ldh [hLoadedROMBank], a
|
||||||
|
ld [MBC1RomBank], a
|
||||||
|
call \1
|
||||||
|
pop bc
|
||||||
|
ld a, b
|
||||||
|
ldh [hLoadedROMBank], a
|
||||||
|
ld [MBC1RomBank], a
|
||||||
|
ENDM
|
||||||
|
|
58
wram.asm
58
wram.asm
|
@ -239,32 +239,40 @@ SECTION "OAM Buffer", WRAM0
|
||||||
wOAMBuffer::
|
wOAMBuffer::
|
||||||
; buffer for OAM data. Copied to OAM by DMA
|
; buffer for OAM data. Copied to OAM by DMA
|
||||||
ds 4 * 40
|
ds 4 * 40
|
||||||
|
wOAMBufferEnd::
|
||||||
|
|
||||||
wTileMap::
|
wTileMap::
|
||||||
; buffer for tiles that are visible on screen (20 columns by 18 rows)
|
; buffer for tiles that are visible on screen (20 columns by 18 rows)
|
||||||
ds 20 * 18
|
ds SCREEN_WIDTH * SCREEN_HEIGHT
|
||||||
|
|
||||||
wSerialPartyMonsPatchList::
|
|
||||||
; list of indexes to patch with SERIAL_NO_DATA_BYTE after transfer
|
|
||||||
|
|
||||||
|
UNION
|
||||||
wTileMapBackup::
|
wTileMapBackup::
|
||||||
; buffer for temporarily saving and restoring current screen's tiles
|
; buffer for temporarily saving and restoring current screen's tiles
|
||||||
; (e.g. if menus are drawn on top)
|
; (e.g. if menus are drawn on top)
|
||||||
; ds 20 * 18
|
ds SCREEN_WIDTH * SCREEN_HEIGHT
|
||||||
|
|
||||||
|
NEXTU
|
||||||
|
wSerialPartyMonsPatchList::
|
||||||
|
; list of indexes to patch with SERIAL_NO_DATA_BYTE after transfer
|
||||||
ds 200
|
ds 200
|
||||||
|
|
||||||
wSerialEnemyMonsPatchList::
|
wSerialEnemyMonsPatchList::
|
||||||
; list of indexes to patch with SERIAL_NO_DATA_BYTE after transfer
|
; list of indexes to patch with SERIAL_NO_DATA_BYTE after transfer
|
||||||
ds 200
|
ds 200
|
||||||
|
ENDU
|
||||||
|
|
||||||
ds 80
|
ds 80
|
||||||
|
|
||||||
wTempPic::
|
UNION
|
||||||
wOverworldMap::
|
wOverworldMap::
|
||||||
ds 1300
|
ds 1300
|
||||||
wOverworldMapEnd::
|
wOverworldMapEnd::
|
||||||
|
|
||||||
|
NEXTU
|
||||||
|
wTempPic::
|
||||||
|
ds 7 * 7 tiles
|
||||||
|
ENDU
|
||||||
|
|
||||||
wRedrawRowOrColumnSrcTiles::
|
wRedrawRowOrColumnSrcTiles::
|
||||||
; the tiles of the row or column to be redrawn by RedrawRowOrColumn
|
; the tiles of the row or column to be redrawn by RedrawRowOrColumn
|
||||||
ds SCREEN_WIDTH * 2
|
ds SCREEN_WIDTH * 2
|
||||||
|
@ -399,9 +407,8 @@ wUnknownSerialCounter::
|
||||||
; 2 bytes
|
; 2 bytes
|
||||||
|
|
||||||
wEnteringCableClub::
|
wEnteringCableClub::
|
||||||
ds 1
|
; 1 byte
|
||||||
|
ds 2
|
||||||
ds 1
|
|
||||||
|
|
||||||
wWhichTradeMonSelectionMenu::
|
wWhichTradeMonSelectionMenu::
|
||||||
; $00 = player mons
|
; $00 = player mons
|
||||||
|
@ -509,15 +516,24 @@ wAnimPalette::
|
||||||
|
|
||||||
ds 29
|
ds 29
|
||||||
|
|
||||||
|
UNION
|
||||||
wNPCMovementDirections2::
|
wNPCMovementDirections2::
|
||||||
|
ds 10
|
||||||
|
|
||||||
|
NEXTU
|
||||||
wSwitchPartyMonTempBuffer::
|
wSwitchPartyMonTempBuffer::
|
||||||
; temporary buffer when swapping party mon data
|
; temporary buffer when swapping party mon data
|
||||||
|
ds 49
|
||||||
|
|
||||||
|
NEXTU
|
||||||
ds 10
|
ds 10
|
||||||
|
|
||||||
wNumStepsToTake::
|
wNumStepsToTake::
|
||||||
; used in Pallet Town scripted movement
|
; used in Pallet Town scripted movement
|
||||||
ds 49
|
ds 1
|
||||||
|
ENDU
|
||||||
|
|
||||||
|
ds 10
|
||||||
|
|
||||||
wRLEByteCount::
|
wRLEByteCount::
|
||||||
ds 1
|
ds 1
|
||||||
|
@ -595,7 +611,7 @@ wTotalPayDayMoney::
|
||||||
wSafariEscapeFactor::
|
wSafariEscapeFactor::
|
||||||
ds 1
|
ds 1
|
||||||
wSafariBaitFactor::
|
wSafariBaitFactor::
|
||||||
ds 1;
|
ds 1
|
||||||
|
|
||||||
ds 1
|
ds 1
|
||||||
|
|
||||||
|
@ -823,8 +839,6 @@ wCoordIndex::
|
||||||
|
|
||||||
wOptionsTextSpeedCursorX::
|
wOptionsTextSpeedCursorX::
|
||||||
|
|
||||||
wBoxNumString::
|
|
||||||
|
|
||||||
wTrainerInfoTextBoxWidthPlus1::
|
wTrainerInfoTextBoxWidthPlus1::
|
||||||
|
|
||||||
wSwappedMenuItem::
|
wSwappedMenuItem::
|
||||||
|
@ -861,6 +875,8 @@ wPlayerSpinInPlaceAnimFrameDelay::
|
||||||
|
|
||||||
wPlayerSpinWhileMovingUpOrDownAnimDeltaY::
|
wPlayerSpinWhileMovingUpOrDownAnimDeltaY::
|
||||||
|
|
||||||
|
wBoxNumString::
|
||||||
|
|
||||||
wHiddenObjectFunctionArgument::
|
wHiddenObjectFunctionArgument::
|
||||||
|
|
||||||
wWhichTrade::
|
wWhichTrade::
|
||||||
|
@ -1350,7 +1366,9 @@ wExpAmountGained::
|
||||||
; 2-byte big-endian number
|
; 2-byte big-endian number
|
||||||
; the total amount of exp a mon gained
|
; the total amount of exp a mon gained
|
||||||
|
|
||||||
wcf4b:: ds 2 ; storage buffer for various strings
|
wcf4b::
|
||||||
|
; storage buffer for various strings
|
||||||
|
ds 2
|
||||||
|
|
||||||
wGainBoostedExp::
|
wGainBoostedExp::
|
||||||
ds 1
|
ds 1
|
||||||
|
@ -1987,7 +2005,6 @@ wSavedTilesetType::
|
||||||
|
|
||||||
ds 2
|
ds 2
|
||||||
|
|
||||||
|
|
||||||
wDamage::
|
wDamage::
|
||||||
ds 2
|
ds 2
|
||||||
|
|
||||||
|
@ -2725,7 +2742,8 @@ wPokemonMansionB1FCurScript::
|
||||||
wVictoryRoad2FCurScript::
|
wVictoryRoad2FCurScript::
|
||||||
ds 1
|
ds 1
|
||||||
wVictoryRoad3FCurScript::
|
wVictoryRoad3FCurScript::
|
||||||
ds 2
|
ds 1
|
||||||
|
ds 1
|
||||||
wFightingDojoCurScript::
|
wFightingDojoCurScript::
|
||||||
ds 1
|
ds 1
|
||||||
wSilphCo2FCurScript::
|
wSilphCo2FCurScript::
|
||||||
|
@ -2972,7 +2990,9 @@ wFlags_D733::
|
||||||
wBeatLorelei::
|
wBeatLorelei::
|
||||||
; bit 1: set when you beat Lorelei and reset in Indigo Plateau lobby
|
; bit 1: set when you beat Lorelei and reset in Indigo Plateau lobby
|
||||||
; the game uses this to tell when Elite 4 events need to be reset
|
; the game uses this to tell when Elite 4 events need to be reset
|
||||||
ds 2
|
ds 1
|
||||||
|
|
||||||
|
ds 1
|
||||||
|
|
||||||
wd736::
|
wd736::
|
||||||
; bit 0: check if the player is standing on a door and make him walk down a step if so
|
; bit 0: check if the player is standing on a door and make him walk down a step if so
|
||||||
|
@ -3010,6 +3030,7 @@ wSecondLockTrashCanIndex::
|
||||||
ds 1
|
ds 1
|
||||||
|
|
||||||
ds 2
|
ds 2
|
||||||
|
|
||||||
wEventFlags::
|
wEventFlags::
|
||||||
flag_array NUM_EVENTS
|
flag_array NUM_EVENTS
|
||||||
|
|
||||||
|
@ -3020,7 +3041,7 @@ wGrassRate::
|
||||||
ds 1
|
ds 1
|
||||||
|
|
||||||
wGrassMons::
|
wGrassMons::
|
||||||
;ds 20
|
; ds 20
|
||||||
|
|
||||||
ds 11
|
ds 11
|
||||||
; Overload wGrassMons
|
; Overload wGrassMons
|
||||||
|
@ -3119,6 +3140,7 @@ wBoxDataEnd::
|
||||||
|
|
||||||
|
|
||||||
SECTION "Stack", WRAM0
|
SECTION "Stack", WRAM0
|
||||||
|
|
||||||
wStack::
|
wStack::
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue