summaryrefslogtreecommitdiff
path: root/engine/events
diff options
context:
space:
mode:
Diffstat (limited to 'engine/events')
-rwxr-xr-xengine/events/celebi.asm4
-rw-r--r--engine/events/crystal_unown.asm2
-rwxr-xr-xengine/events/field_moves.asm14
-rw-r--r--engine/events/fish.asm2
-rw-r--r--engine/events/fruit_trees.asm4
-rwxr-xr-xengine/events/halloffame.asm10
-rwxr-xr-xengine/events/heal_machine_anim.asm2
-rw-r--r--engine/events/magikarp.asm19
-rwxr-xr-xengine/events/magnet_train.asm6
-rwxr-xr-xengine/events/overworld.asm10
-rwxr-xr-xengine/events/pokepic.asm2
-rw-r--r--engine/events/pokerus/pokerus.asm4
-rw-r--r--engine/events/print_unown.asm10
-rw-r--r--engine/events/print_unown_2.asm2
-rwxr-xr-xengine/events/special.asm2
-rwxr-xr-xengine/events/sweet_scent.asm2
16 files changed, 51 insertions, 44 deletions
diff --git a/engine/events/celebi.asm b/engine/events/celebi.asm
index b7bf95145..1139ad3d5 100755
--- a/engine/events/celebi.asm
+++ b/engine/events/celebi.asm
@@ -72,11 +72,11 @@ Special_CelebiShrineEvent: ; 4989a
LoadCelebiGFX: ; 49912
farcall ClearSpriteAnims
ld de, SpecialCelebiLeafGFX
- ld hl, VTiles1
+ ld hl, vTiles1
lb bc, BANK(SpecialCelebiLeafGFX), 4
call Request2bpp
ld de, SpecialCelebiGFX
- ld hl, VTiles0 tile $84
+ ld hl, vTiles0 tile $84
lb bc, BANK(SpecialCelebiGFX), $10
call Request2bpp
xor a
diff --git a/engine/events/crystal_unown.asm b/engine/events/crystal_unown.asm
index 6c0e972f8..352306055 100644
--- a/engine/events/crystal_unown.asm
+++ b/engine/events/crystal_unown.asm
@@ -178,7 +178,7 @@ endc
shift
endr
db $ff
-endm
+ENDM
.UnownText_Escape:
; db $08, $44, $04, $00, $2e, $08, $ff
diff --git a/engine/events/field_moves.asm b/engine/events/field_moves.asm
index 1c21f4995..a1a2e2e79 100755
--- a/engine/events/field_moves.asm
+++ b/engine/events/field_moves.asm
@@ -8,7 +8,7 @@ PlayWhirlpoolSound: ; 8c7d4
BlindingFlash: ; 8c7e1
farcall FadeOutPalettes
- ld hl, StatusFlags
+ ld hl, wStatusFlags
set 2, [hl] ; Flash
farcall ReplaceTimeOfDayPals
farcall UpdateTimeOfDayPal
@@ -22,11 +22,11 @@ BlindingFlash: ; 8c7e1
ShakeHeadbuttTree: ; 8c80a
farcall ClearSpriteAnims
ld de, CutGrassGFX
- ld hl, VTiles1
+ ld hl, vTiles1
lb bc, BANK(CutGrassGFX), 4
call Request2bpp
ld de, HeadbuttTreeGFX
- ld hl, VTiles1 tile $04
+ ld hl, vTiles1 tile $04
lb bc, BANK(HeadbuttTreeGFX), 8
call Request2bpp
call Cut_Headbutt_GetPixelFacing
@@ -67,7 +67,7 @@ ShakeHeadbuttTree: ; 8c80a
xor a
call ByteFill
ld de, Font
- ld hl, VTiles1
+ ld hl, vTiles1
lb bc, BANK(Font), 12
call Get1bpp
call ReplaceKrisSprite
@@ -141,11 +141,11 @@ OWCutAnimation: ; 8c940
.LoadCutGFX: ; 8c96d
callfar ClearSpriteAnims ; pointless to farcall
ld de, CutGrassGFX
- ld hl, VTiles1
+ ld hl, vTiles1
lb bc, BANK(CutGrassGFX), 4
call Request2bpp
ld de, CutTreeGFX
- ld hl, VTiles1 tile $4
+ ld hl, vTiles1 tile $4
lb bc, BANK(CutTreeGFX), 4
call Request2bpp
ret
@@ -413,7 +413,7 @@ FlyToAnim: ; 8cb33
FlyFunction_InitGFX: ; 8cb9b (23:4b9b)
callfar ClearSpriteAnims
ld de, CutGrassGFX
- ld hl, VTiles1 tile $00
+ ld hl, vTiles1 tile $00
lb bc, BANK(CutGrassGFX), 4
call Request2bpp
ld a, [CurPartyMon]
diff --git a/engine/events/fish.asm b/engine/events/fish.asm
index c571bba56..9d1ea63ae 100644
--- a/engine/events/fish.asm
+++ b/engine/events/fish.asm
@@ -97,7 +97,7 @@ GetFishGroupIndex: ; 9245b
; Return the index of fishgroup d in de.
push hl
- ld hl, DailyFlags
+ ld hl, wDailyFlags
bit 2, [hl]
pop hl
jr z, .done
diff --git a/engine/events/fruit_trees.asm b/engine/events/fruit_trees.asm
index 595e41824..d0b0bac15 100644
--- a/engine/events/fruit_trees.asm
+++ b/engine/events/fruit_trees.asm
@@ -43,7 +43,7 @@ GetCurTreeFruit: ; 44041
; 4404c
TryResetFruitTrees: ; 4404c
- ld hl, DailyFlags
+ ld hl, wDailyFlags
bit 4, [hl]
ret nz
jp ResetFruitTrees
@@ -70,7 +70,7 @@ ResetFruitTrees: ; 4406a
ld [hli], a
ld [hli], a
ld [hl], a
- ld hl, DailyFlags
+ ld hl, wDailyFlags
set 4, [hl]
ret
; 44078
diff --git a/engine/events/halloffame.asm b/engine/events/halloffame.asm
index 5fa1dc270..f1981c2fd 100755
--- a/engine/events/halloffame.asm
+++ b/engine/events/halloffame.asm
@@ -2,7 +2,7 @@ HALLOFFAME_COLON EQU $63
HallOfFame:: ; 0x8640e
call HallOfFame_FadeOutMusic
- ld a, [StatusFlags]
+ ld a, [wStatusFlags]
push af
ld a, 1
ld [wGameLogicPaused], a
@@ -11,7 +11,7 @@ HallOfFame:: ; 0x8640e
ld [wSpawnAfterChampion], a
; Enable the Pokégear map to cycle through all of Kanto
- ld hl, StatusFlags
+ ld hl, wStatusFlags
set 6, [hl] ; hall of fame
farcall HallOfFame_InitSaveIfNeeded
@@ -52,7 +52,7 @@ RedCredits:: ; 86455
call DisableSpriteUpdates
ld a, SPAWN_RED
ld [wSpawnAfterChampion], a
- ld a, [StatusFlags]
+ ld a, [wStatusFlags]
ld b, a
farcall Credits
ret
@@ -249,7 +249,7 @@ AnimateHOFMonEntrance: ; 865b5
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
ld a, " "
call ByteFill
- ld de, VTiles2 tile $31
+ ld de, vTiles2 tile $31
predef GetMonBackpic
ld a, $31
ld [hGraphicStartTile], a
@@ -533,7 +533,7 @@ DisplayHOFMon: ; 86748
HOF_AnimatePlayerPic: ; 86810
call ClearBGPalettes
- ld hl, VTiles2 tile HALLOFFAME_COLON
+ ld hl, vTiles2 tile HALLOFFAME_COLON
ld de, FontExtra + 13 tiles ; "<COLON>"
lb bc, BANK(FontExtra), 1
call Request2bpp
diff --git a/engine/events/heal_machine_anim.asm b/engine/events/heal_machine_anim.asm
index c7789a28d..b51976d22 100755
--- a/engine/events/heal_machine_anim.asm
+++ b/engine/events/heal_machine_anim.asm
@@ -72,7 +72,7 @@ HealMachineAnim: ; 12324
.LoadGFX: ; 12383
call .LoadPalettes
ld de, .HealMachineGFX
- ld hl, VTiles0 tile $7c
+ ld hl, vTiles0 tile $7c
lb bc, BANK(.HealMachineGFX), $2
call Request2bpp
ret
diff --git a/engine/events/magikarp.asm b/engine/events/magikarp.asm
index 02c4b10cd..68e8baad7 100644
--- a/engine/events/magikarp.asm
+++ b/engine/events/magikarp.asm
@@ -79,7 +79,7 @@ Special_CheckMagikarpLength: ; fbb32
; 0xfbbae
Magikarp_LoadFeetInchesChars: ; fbbae
- ld hl, VTiles2 tile "′" ; $6e
+ ld hl, vTiles2 tile "′" ; $6e
ld de, .feetinchchars
lb bc, BANK(.feetinchchars), 2
call Request2bpp
@@ -108,7 +108,7 @@ PrintMagikarpLength: ; fbbdb
; fbbfc
CalcMagikarpLength: ; fbbfc
-; Return Magikarp's length (in mm) at wMagikarpLength (big endian).
+; Return Magikarp's length (in feet and inches) at wMagikarpLength (big endian).
;
; input:
; de: EnemyMonDVs
@@ -247,6 +247,10 @@ CalcMagikarpLength: ; fbbfc
ld e, l
.done
+ ; convert from mm to feet and inches
+ ; in = mm / 25.4
+ ; ft = in / 12
+
; hl = de × 10
ld h, d
ld l, e
@@ -275,9 +279,9 @@ CalcMagikarpLength: ; fbbfc
ld e, a
ld hl, wMagikarpLength
- ld [hl], d
+ ld [hl], d ; ft
inc hl
- ld [hl], e
+ ld [hl], e ; in
ret
; fbc9a
@@ -305,8 +309,11 @@ CalcMagikarpLength: ; fbbfc
; fbca8
.Lengths: ; fbca8
-; ????, divisor
- dwb 110, 1
+; [wMagikarpLength] = z * 100 + (bc - x) / y
+; First argument is the bc threshold as well as x.
+; Second argument is y.
+; In reality, due to the bug at .BCLessThanDE, the threshold is determined by only register b.
+ dwb 110, 1 ; not used unless the bug is fixed
dwb 310, 2
dwb 710, 4
dwb 2710, 20
diff --git a/engine/events/magnet_train.asm b/engine/events/magnet_train.asm
index 3a2f902c2..585912391 100755
--- a/engine/events/magnet_train.asm
+++ b/engine/events/magnet_train.asm
@@ -134,14 +134,14 @@ MagntTrain_LoadGFX_PlayMusic: ; 8ccc9
farcall GetPlayerIcon
pop af
ld [rSVBK], a
- ld hl, VTiles0
+ ld hl, vTiles0
ld c, 4
call Request2bpp
ld hl, 12 tiles
add hl, de
ld d, h
ld e, l
- ld hl, VTiles0 tile $04
+ ld hl, vTiles0 tile $04
ld c, 4
call Request2bpp
call MagnetTrain_InitLYOverrides
@@ -328,7 +328,7 @@ MagnetTrain_Jumptable: ; 8cdf7
push af
ld a, $1
ld [rSVBK], a
- ld a, [PlayerGender]
+ ld a, [wPlayerGender]
bit 0, a
jr z, .got_gender
ld b, SPRITE_ANIM_INDEX_MAGNET_TRAIN_BLUE
diff --git a/engine/events/overworld.asm b/engine/events/overworld.asm
index 370162fa9..8c238cb9c 100755
--- a/engine/events/overworld.asm
+++ b/engine/events/overworld.asm
@@ -358,7 +358,7 @@ SurfFunction: ; c909
ld de, ENGINE_FOGBADGE
call CheckBadge
jr c, .asm_c956
- ld hl, BikeFlags
+ ld hl, wBikeFlags
bit 1, [hl] ; always on bike
jr nz, .cannotsurf
ld a, [PlayerState]
@@ -520,7 +520,7 @@ TrySurfOW:: ; c9e7
call CheckPartyMove
jr c, .quit
- ld hl, BikeFlags
+ ld hl, wBikeFlags
bit 1, [hl] ; always on bike (can't surf)
jr nz, .quit
@@ -1008,7 +1008,7 @@ StrengthFunction: ; cce5
ret
SetStrengthFlag: ; cd12
- ld hl, BikeFlags
+ ld hl, wBikeFlags
set 0, [hl]
ld a, [CurPartyMon]
ld e, a
@@ -1086,7 +1086,7 @@ TryStrengthOW: ; cd78
call CheckEngineFlag
jr c, .nope
- ld hl, BikeFlags
+ ld hl, wBikeFlags
bit 0, [hl]
jr z, .already_using
@@ -1683,7 +1683,7 @@ BikeFunction: ; d0b3
ret
.GetOffBike:
- ld hl, BikeFlags
+ ld hl, wBikeFlags
bit 1, [hl]
jr nz, .CantGetOffBike
ld hl, Script_GetOffBike
diff --git a/engine/events/pokepic.asm b/engine/events/pokepic.asm
index ea5b3c300..82016403b 100755
--- a/engine/events/pokepic.asm
+++ b/engine/events/pokepic.asm
@@ -11,7 +11,7 @@ Pokepic:: ; 244e3
ld a, [CurPartySpecies]
ld [CurSpecies], a
call GetBaseData
- ld de, VTiles1
+ ld de, vTiles1
predef GetMonFrontpic
ld a, [wMenuBorderTopCoord]
inc a
diff --git a/engine/events/pokerus/pokerus.asm b/engine/events/pokerus/pokerus.asm
index 3e5e094e4..d47bcb6c1 100644
--- a/engine/events/pokerus/pokerus.asm
+++ b/engine/events/pokerus/pokerus.asm
@@ -18,7 +18,7 @@ GivePokerusAndConvertBerries: ; 2ed44
; If we haven't been to Goldenrod City at least once,
; prevent the contraction of Pokerus.
- ld hl, StatusFlags2
+ ld hl, wStatusFlags2
bit 6, [hl]
ret z
call Random
@@ -123,7 +123,7 @@ GivePokerusAndConvertBerries: ; 2ed44
; any berry held by a Shuckle may be converted to berry juice
ConvertBerriesToBerryJuice: ; 2ede6
- ld hl, StatusFlags2
+ ld hl, wStatusFlags2
bit 6, [hl]
ret z
call Random
diff --git a/engine/events/print_unown.asm b/engine/events/print_unown.asm
index 7841a688b..72248a67b 100644
--- a/engine/events/print_unown.asm
+++ b/engine/events/print_unown.asm
@@ -15,12 +15,12 @@ UnownPrinter: ; 16be4
call ClearTileMap
ld de, UnownDexATile
- ld hl, VTiles1 tile $6f
+ ld hl, vTiles1 tile $6f
lb bc, BANK(UnownDexBTile), 1
call Request1bpp
ld de, UnownDexBTile
- ld hl, VTiles1 tile $75
+ ld hl, vTiles1 tile $75
lb bc, BANK(UnownDexBTile), 1
call Request1bpp
@@ -139,7 +139,7 @@ UnownPrinter: ; 16be4
ld [CurPartySpecies], a
xor a
ld [wBoxAlignment], a
- ld de, VTiles2
+ ld de, vTiles2
predef GetMonFrontpic
call .Load2bppToSRAM
hlcoord 1, 6
@@ -147,7 +147,7 @@ UnownPrinter: ; 16be4
ld [hGraphicStartTile], a
lb bc, 7, 7
predef PlaceGraphic
- ld de, VTiles2 tile $31
+ ld de, vTiles2 tile $31
farcall RotateUnownFrontpic
ret
@@ -184,7 +184,7 @@ UnownPrinter: ; 16be4
ld bc, $31 tiles
xor a
call ByteFill
- ld hl, VTiles2 tile $31
+ ld hl, vTiles2 tile $31
ld de, sScratch
ld c, $31
ld a, [hROMBank]
diff --git a/engine/events/print_unown_2.asm b/engine/events/print_unown_2.asm
index 057db5176..c932ded38 100644
--- a/engine/events/print_unown_2.asm
+++ b/engine/events/print_unown_2.asm
@@ -105,7 +105,7 @@ x = x +- \2
endr
y = y + 1
endr
-endm
+ENDM
UnownPrinter_OverworldMapRectangle: ; e008b
overworldmaprect 7, 7
diff --git a/engine/events/special.asm b/engine/events/special.asm
index d28d0de64..939db4a25 100755
--- a/engine/events/special.asm
+++ b/engine/events/special.asm
@@ -53,7 +53,7 @@ SpecialGiveShuckle: ; 7305
call CopyName2
; Engine flag for this event.
- ld hl, DailyFlags
+ ld hl, wDailyFlags
set 5, [hl]
; setflag ENGINE_SHUCKLE_GIVEN
ld a, 1
diff --git a/engine/events/sweet_scent.asm b/engine/events/sweet_scent.asm
index 77567488c..9b75eb9b8 100755
--- a/engine/events/sweet_scent.asm
+++ b/engine/events/sweet_scent.asm
@@ -36,7 +36,7 @@ SweetScentNothing: ; 0x506e9
SweetScentEncounter: ; 506ef
farcall CanUseSweetScent
jr nc, .no_battle
- ld hl, StatusFlags2
+ ld hl, wStatusFlags2
bit 2, [hl]
jr nz, .not_in_bug_contest
farcall GetMapEncounterRate