summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpikalaxalt <PikalaxALT@gmail.com>2016-06-21 13:08:20 -0400
committerpikalaxalt <PikalaxALT@gmail.com>2016-06-21 13:08:20 -0400
commitdef16f56d0212de6dc99f7b733fb190e3784aad9 (patch)
tree8c31f10206477422c6b53148ddf3c20160abdbda
parentdc48fd153a0ed7a9236da657f72a7b7fde4034fd (diff)
engine/health.asm; overworld move/item fns pt 1
-rw-r--r--constants/item_constants.asm4
-rw-r--r--constants/sfx_constants.asm18
-rw-r--r--constants/tilemap_constants.asm59
-rwxr-xr-xengine/health.asm99
-rwxr-xr-xengine/overworld.asm525
-rwxr-xr-xengine/specials.asm104
-rw-r--r--home/copy.asm2
-rw-r--r--home/window.asm2
-rw-r--r--macros/event.asm9
-rw-r--r--main.asm82
10 files changed, 725 insertions, 179 deletions
diff --git a/constants/item_constants.asm b/constants/item_constants.asm
index efb4211d..1c69ba57 100644
--- a/constants/item_constants.asm
+++ b/constants/item_constants.asm
@@ -255,10 +255,6 @@ NUM_TMS = const_value - TM01 - 2
NUM_HMS = const_value - HM01
const HM_08 ; $FA
- add_mt FLAMETHROWER
- add_mt THUNDERBOLT
- add_mt ICE_BEAM
-
ITEM_FROM_MEM EQU $ff
diff --git a/constants/sfx_constants.asm b/constants/sfx_constants.asm
index 65abfc3c..3b88e820 100644
--- a/constants/sfx_constants.asm
+++ b/constants/sfx_constants.asm
@@ -190,21 +190,3 @@
const SFX_2_BOOPS ; bb
const SFX_GLASS_TING ; bc
const SFX_GLASS_TING_2 ; bd
-
- const SFX_INTRO_UNOWN_1 ; be
- const SFX_INTRO_UNOWN_2 ; bf
- const SFX_INTRO_UNOWN_3 ; c0
- const SFX_DITTO_POP_UP ; c1
- const SFX_DITTO_TRANSFORM ; c2
- const SFX_INTRO_SUICUNE_1 ; c3
- const SFX_INTRO_PICHU ; c4
- const SFX_INTRO_SUICUNE_2 ; c5
- const SFX_INTRO_SUICUNE_3 ; c6
- const SFX_DITTO_BOUNCE ; c7
- const SFX_INTRO_SUICUNE_4 ; c8
- const SFX_GAME_FREAK_PRESENTS ; c9
- const SFX_TINGLE ; ca
- const SFX_UNKNOWN_CB ; cb
- const SFX_TWO_PC_BEEPS ; cc
- const SFX_4_NOTE_DITTY ; cd
- const SFX_TWINKLE ; ce
diff --git a/constants/tilemap_constants.asm b/constants/tilemap_constants.asm
index 9307a22a..b1185bf2 100644
--- a/constants/tilemap_constants.asm
+++ b/constants/tilemap_constants.asm
@@ -8,39 +8,32 @@ const_value SET 1
const TILESET_JOHTO_1 ; 01
const TILESET_JOHTO_2 ; 02
const TILESET_KANTO ; 03
- const TILESET_BATTLE_TOWER_OUTSIDE ; 04
- const TILESET_HOUSE_1 ; 05
- const TILESET_KRISS_HOUSE ; 06
- const TILESET_POKECENTER ; 07
- const TILESET_GATE ; 08
- const TILESET_PORT ; 09
- const TILESET_LAB ; 0a
- const TILESET_POWER_PLANT ; 0b
- const TILESET_MART ; 0c
- const TILESET_CELADON_MANSION ; 0d
- const TILESET_GAME_CORNER ; 0e
- const TILESET_GYM_1 ; 0f
- const TILESET_KURT_HOUSE ; 10
- const TILESET_TRAIN_STATION ; 11
- const TILESET_OLIVINE_GYM ; 12
- const TILESET_LIGHTHOUSE ; 13
- const TILESET_KRISS_HOUSE_2F ; 14
- const TILESET_POKECOM_CENTER ; 15
- const TILESET_BATTLE_TOWER ; 16
- const TILESET_SPROUT_TOWER ; 17
- const TILESET_CAVE ; 18
- const TILESET_PARK ; 19
- const TILESET_RUINS_OF_ALPH ; 1a
- const TILESET_RADIO_TOWER ; 1b
- const TILESET_UNDERGROUND ; 1c
- const TILESET_ICE_PATH ; 1d
- const TILESET_WHIRL_ISLANDS ; 1e
- const TILESET_ILEX_FOREST ; 1f
- const TILESET_32 ; 20
- const TILESET_HO_OH_WORD_ROOM ; 21
- const TILESET_KABUTO_WORD_ROOM ; 22
- const TILESET_OMANYTE_WORD_ROOM ; 23
- const TILESET_AERODACTYL_WORD_ROOM ; 24
+ const TILESET_HOUSE_1 ; 04
+ const TILESET_KRISS_HOUSE ; 05
+ const TILESET_POKECENTER ; 06
+ const TILESET_GATE ; 07
+ const TILESET_PORT ; 08
+ const TILESET_LAB ; 09
+ const TILESET_POWER_PLANT ; 0a
+ const TILESET_MART ; 0b
+ const TILESET_CELADON_MANSION ; 0c
+ const TILESET_GAME_CORNER ; 0d
+ const TILESET_GYM_1 ; 0e
+ const TILESET_KURT_HOUSE ; 0f
+ const TILESET_TRAIN_STATION ; 10
+ const TILESET_OLIVINE_GYM ; 11
+ const TILESET_LIGHTHOUSE ; 12
+ const TILESET_KRISS_HOUSE_2F ; 13
+ const TILESET_SPROUT_TOWER ; 14
+ const TILESET_CAVE ; 15
+ const TILESET_PARK ; 16
+ const TILESET_RUINS_OF_ALPH ; 17
+ const TILESET_RADIO_TOWER ; 18
+ const TILESET_UNDERGROUND ; 19
+ const TILESET_ICE_PATH ; 1a
+ const TILESET_WHIRL_ISLANDS ; 1b
+ const TILESET_ILEX_FOREST ; 1c
+ const TILESET_29 ; 1d
const_def
const PAL_BG_GRAY
diff --git a/engine/health.asm b/engine/health.asm
new file mode 100755
index 00000000..2ef116e6
--- /dev/null
+++ b/engine/health.asm
@@ -0,0 +1,99 @@
+HealParty: ; c69d (3:469d)
+ xor a
+ ld [wd005], a
+ ld hl, wPartySpecies
+.asm_c6a4
+ ld a, [hli]
+ cp $ff
+ jr z, .asm_c6bb
+ cp $fd
+ jr z, .asm_c6b2
+ push hl
+ call Functionc6bc
+ pop hl
+.asm_c6b2
+ ld a, [wd005]
+ inc a
+ ld [wd005], a
+ jr .asm_c6a4
+
+.asm_c6bb
+ ret
+
+Functionc6bc: ; c6bc (3:46bc)
+ ld a, $0
+ call GetPartyParamLocation
+ ld d, h
+ ld e, l
+ ld hl, $20
+ add hl, de
+ xor a
+ ld [hli], a
+ ld [hl], a
+ ld hl, $24
+ add hl, de
+ ld b, h
+ ld c, l
+ dec bc
+ dec bc
+ ld a, [hli]
+ ld [bc], a
+ inc bc
+ ld a, [hl]
+ ld [bc], a
+ callba Functionf900
+ ret
+
+ComputeHPBarPixels: ; c6de (3:46de)
+ ld a, b
+ or c
+ jr z, .asm_c722
+ push hl
+ xor a
+ ld [hPrintNum2], a
+ ld a, b
+ ld [hPrintNum3], a
+ ld a, c
+ ld [hPrintNum4], a
+ ld a, $30
+ ld [hPrintNum5], a
+ call Multiply
+ ld a, d
+ and a
+ jr z, .asm_c711
+ srl d
+ rr e
+ srl d
+ rr e
+ ld a, [hStringCmpString2]
+ ld b, a
+ ld a, [hPrintNum4]
+ srl b
+ rr a
+ srl b
+ rr a
+ ld [hPrintNum4], a
+ ld a, b
+ ld [hPrintNum3], a
+.asm_c711
+ ld a, e
+ ld [hPrintNum5], a
+ ld b, $4
+ call Divide
+ ld a, [hPrintNum4]
+ ld e, a
+ pop hl
+ and a
+ ret nz
+ ld e, $1
+ ret
+
+.asm_c722
+ ld e, $0
+ ret
+
+AnimateHPBar: ; c725 (3:4725)
+ call WaitBGMap
+ call AnimateHPBar_
+ call WaitBGMap
+ ret
diff --git a/engine/overworld.asm b/engine/overworld.asm
new file mode 100755
index 00000000..f564a120
--- /dev/null
+++ b/engine/overworld.asm
@@ -0,0 +1,525 @@
+FieldMoveBufferReset: ; c72f (3:472f)
+ xor a
+ ld hl, wBuffer1
+ ld bc, $7
+ call ByteFill
+ ret
+
+DoFieldMoveAction: ; c73a (3:473a)
+ ld a, [wBuffer1]
+ rst JumpTable
+ ld [wBuffer1], a
+ bit 7, a
+ jr nz, .asm_c747
+ and a
+ ret
+
+.asm_c747
+ and $7f
+ scf
+ ret
+
+FieldMoveGetPartyNick: ; c74b (3:474b)
+ ld hl, wPartyMon1Nickname
+ ld a, $2
+ ld [wce5f], a
+ ld a, [wd005]
+ call GetNick
+ call Function317b
+ ld de, wStringBuffer2
+ ld hl, wStringBuffer3
+ call CopyName2
+ ret
+
+FieldMoveEngineFlagCheck: ; c766 (3:4766)
+ ld b, CHECK_FLAG
+ callba EngineFlagAction ; same bank
+ ld a, c
+ and a
+ jr nz, .asm_c774
+ scf
+ ret
+
+.asm_c774
+ xor a
+ ret
+
+FieldMoveBadgeCheck: ; c776 (3:4776)
+ call FieldMoveEngineFlagCheck
+ ret nc
+ ld hl, .BadgeRequiredText
+ call MenuTextBoxBackup
+ scf
+ ret
+
+.BadgeRequiredText:
+ text_jump BadgeRequiredText_
+ db "@"
+
+FieldMovePartyCheck: ; c787 (3:4787)
+ ld e, $0
+ xor a
+ ld [wd005], a
+.asm_c78d
+ ld c, e
+ ld b, $0
+ ld hl, wPartySpecies
+ add hl, bc
+ ld a, [hl]
+ and a
+ jr z, .asm_c7bc
+ cp -1
+ jr z, .asm_c7bc
+ cp EGG
+ jr z, .asm_c7b3
+ ld bc, PARTYMON_STRUCT_LENGTH
+ ld hl, wPartyMon1Moves
+ ld a, e
+ call AddNTimes
+ ld b, NUM_MOVES
+.asm_c7ac
+ ld a, [hli]
+ cp d
+ jr z, .asm_c7b6
+ dec b
+ jr nz, .asm_c7ac
+.asm_c7b3
+ inc e
+ jr .asm_c78d
+
+.asm_c7b6
+ ld a, e
+ ld [wd005], a
+ xor a
+ ret
+
+.asm_c7bc
+ scf
+ ret
+
+FieldMoveFailed: ; c7be (3:47be)
+ ld hl, .CantUseHereText
+ call MenuTextBoxBackup
+ ret
+
+.CantUseHereText:
+ text_jump CantUseFieldMoveHereText_
+ db "@"
+
+CutFunction::
+ call FieldMoveBufferReset
+.asm_c7cd
+ ld hl, .Jumptable
+ call DoFieldMoveAction
+ jr nc, .asm_c7cd
+ and $7f
+ ld [wFieldMoveSucceeded], a
+ ret
+
+.Jumptable:
+ dw CheckAbleToCut
+ dw CutTreeOrGrass
+ dw FailToCut
+
+CheckAbleToCut:
+ ld de, ENGINE_HIVEBADGE
+ call FieldMoveBadgeCheck
+ jr c, .asm_c7f1
+ call CheckMapForSomethingToCut
+ jr c, .asm_c7f4
+ ld a, $1
+ ret
+
+.asm_c7f1
+ ld a, $80
+ ret
+
+.asm_c7f4
+ ld a, $2
+ ret
+
+CutTreeOrGrass:
+ ld hl, Script_CutFromMenu
+ call QueueScript
+ ld a, $81
+ ret
+
+FailToCut:
+ ld hl, Text_NothingToCut
+ call MenuTextBoxBackup
+ ld a, $80
+ ret
+
+Text_UsedCut:
+ text_jump Text_UsedCut_
+ db "@"
+
+Text_NothingToCut:
+ text_jump Text_NothingToCut_
+ db "@"
+
+CheckMapForSomethingToCut: ; c813 (3:4813)
+ call GetFacingTileCoord
+ ld c, a
+ push de
+ callba CheckCutCollision
+ pop de
+ jr nc, .asm_c841
+ call GetBlockLocation
+ ld c, [hl]
+ push hl
+ ld hl, CutTreeBlockPointers
+ call CheckOverworldTileArrays
+ pop hl
+ jr nc, .asm_c841
+ ld a, l
+ ld [wBuffer3], a
+ ld a, h
+ ld [wBuffer4], a
+ ld a, b
+ ld [wBuffer5], a
+ ld a, c
+ ld [wBuffer6], a
+ xor a
+ ret
+
+.asm_c841
+ scf
+ ret
+
+Script_CutFromMenu:
+ reloadmappart
+ special UpdateTimePals
+Script_Cut:
+ callasm FieldMoveGetPartyNick
+ writetext Text_UsedCut
+ reloadmappart
+ callasm CutDownTreeOrGrass
+ closetext
+ end
+
+CutDownTreeOrGrass:
+ ld hl, wBuffer3
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ ld a, [wBuffer5]
+ ld [hl], a
+ xor a
+ ld [hBGMapMode], a
+ call OverworldTextModeSwitch
+ call UpdateSprites
+ call DelayFrame
+ ld a, [wBuffer6]
+ ld e, a
+ callba OWCutAnimation
+ call BufferScreen
+ call GetMovementPermissions
+ ret
+
+CheckOverworldTileArrays: ; c87c (3:487c)
+ push bc
+ ld a, [wd082]
+ ld de, $3
+ call IsInArray
+ pop bc
+ jr nc, .asm_c89c
+ inc hl
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ ld de, $3
+ ld a, c
+ call IsInArray
+ jr nc, .asm_c89c
+ inc hl
+ ld b, [hl]
+ inc hl
+ ld c, [hl]
+ scf
+ ret
+
+.asm_c89c
+ xor a
+ ret
+
+CutTreeBlockPointers:
+ dbw TILESET_JOHTO_1, .johto1
+ dbw TILESET_JOHTO_2, .johto2
+ dbw TILESET_KANTO, .kanto
+ dbw TILESET_PARK, .park
+ dbw TILESET_ILEX_FOREST, .ilex
+ db -1
+
+.johto1
+ db $03, $02, $01 ; grass
+ db $5b, $3c, $00 ; tree
+ db $5f, $3d, $00 ; tree
+ db $63, $3f, $00 ; tree
+ db $67, $3e, $00 ; tree
+ db -1
+
+.johto2
+ db $03, $02, $01 ; grass
+ db -1
+
+.kanto
+ db $0b, $0a, $01 ; grass
+ db $32, $6d, $00 ; tree
+ db $33, $6c, $00 ; tree
+ db $34, $6f, $00 ; tree
+ db $35, $4c, $00 ; tree
+ db $60, $6e, $00 ; tree
+ db -1
+
+.park
+ db $13, $03, $01 ; grass
+ db $03, $04, $01 ; grass
+ db -1
+
+.ilex
+ db $0f, $17, $00
+ db -1
+
+WhirlpoolBlockPointers:
+ dbw TILESET_JOHTO_1, .johto
+ db -1
+
+.johto
+ db $07, $36, $00
+ db -1
+
+FlashFunction:
+ call CheckUseFlash
+ and $7f
+ ld [wFieldMoveSucceeded], a
+ ret
+
+CheckUseFlash: ; c8f1 (3:48f1)
+ ld de, ENGINE_ZEPHYRBADGE
+ callba FieldMoveBadgeCheck ; same bank
+ jr c, .asm_c90f
+ ld a, [wd56e]
+ cp $ff
+ jr nz, .asm_c909
+ call UseFlash
+ ld a, $81
+ ret
+
+.asm_c909
+ call FieldMoveFailed
+ ld a, $80
+ ret
+
+.asm_c90f
+ ld a, $80
+ ret
+
+UseFlash: ; c912 (3:4912)
+ ld hl, Script_UseFlash
+ jp QueueScript
+
+Script_UseFlash:
+ reloadmappart
+ special UpdateTimePals
+ writetext Text_UsedFlash
+ callasm BlindingFlash
+ closetext
+ end
+
+Text_UsedFlash:
+ text_jump Text_UsedFlash_
+ start_asm
+ call WaitSFX
+ ld de, SFX_FLASH
+ call PlaySFX
+ call WaitSFX
+ ld hl, .end
+ ret
+.end db "@"
+
+SurfFunction:
+ call FieldMoveBufferReset
+.asm_c93e
+ ld hl, .Jumptable
+ call DoFieldMoveAction
+ jr nc, .asm_c93e
+ and $7f
+ ld [wFieldMoveSucceeded], a
+ ret
+
+.Jumptable:
+ dw CheckAbleToSurf
+ dw StartSurfing
+ dw CantSurf
+ dw AlreadySurfing
+
+CheckAbleToSurf:
+ ld de, ENGINE_FOGBADGE
+ call FieldMoveBadgeCheck
+ jr c, .asm_c980
+ CheckFlagHL ENGINE_ALWAYS_ON_BIKE
+ jr nz, .asm_c986
+ ld a, [wPlayerBikeSurfState]
+ cp PLAYER_SURF
+ jr z, .asm_c983
+ cp PLAYER_SURF_PIKA
+ jr z, .asm_c983
+ call GetFacingTileCoord
+ call GetTileCollision
+ cp $1
+ jr nz, .asm_c986
+ call GetSurfDirection
+ jr c, .asm_c986
+ ld a, $1
+ ret
+
+.asm_c980
+ ld a, $80
+ ret
+
+.asm_c983
+ ld a, $3
+ ret
+
+.asm_c986
+ ld a, $2
+ ret
+
+StartSurfing:
+ call GetSurfType
+ ld [wBuffer2], a
+ call FieldMoveGetPartyNick
+ ld hl, SurfFromMenuScript
+ call QueueScript
+ ld a, $81
+ ret
+
+CantSurf:
+ ld hl, CantSurfText
+ call MenuTextBoxBackup
+ ld a, $80
+ ret
+
+AlreadySurfing:
+ ld hl, AlreadySurfingText
+ call MenuTextBoxBackup
+ ld a, $80
+ ret
+
+SurfFromMenuScript:
+ special UpdateTimePals
+UsedSurfScript:
+ writetext UsedSurfText
+ waitbutton
+ closetext
+ copybytetovar wBuffer2
+ writevarcode VAR_MOVEMENT
+ special ReplacePlayerSprite
+ special PlayMapMusic
+ special Special_SurfStartStep
+ applymovement 0, wMovementBuffer
+ end
+
+UsedSurfText:
+ text_jump UsedSurfText_
+ db "@"
+
+CantSurfText:
+ text_jump CantSurfText_
+ db "@"
+
+AlreadySurfingText:
+ text_jump AlreadySurfingText_
+ db "@"
+
+GetSurfType: ; c9d7 (3:49d7)
+ ld a, [wd005]
+ ld e, a
+ ld d, $0
+ ld hl, wPartySpecies
+ add hl, de
+ ld a, [hl]
+ cp PIKACHU
+ ld a, PLAYER_SURF_PIKA
+ ret z
+ ld a, PLAYER_SURF
+ ret
+
+GetSurfDirection: ; c9ea (3:49ea)
+ ld a, [wPlayerDirection]
+ and $c
+ rrca
+ rrca
+ ld e, a
+ ld d, $0
+ ld hl, .Directions
+ add hl, de
+ ld a, [wTilePermissions]
+ and [hl]
+ jr nz, .asm_ca00
+ xor a
+ ret
+
+.asm_ca00
+ scf
+ ret
+
+.Directions:
+ db FACE_DOWN
+ db FACE_UP
+ db FACE_LEFT
+ db FACE_RIGHT
+
+TrySurfOW::
+ ld a, [wPlayerBikeSurfState]
+ cp PLAYER_SURF_PIKA
+ jr z, .quit
+ cp PLAYER_SURF
+ jr z, .quit
+ ld a, [wcf29]
+ call GetTileCollision
+ cp $1
+ jr nz, .quit
+ call GetSurfDirection
+ jr c, .quit
+ ld de, ENGINE_FOGBADGE
+ call FieldMoveEngineFlagCheck
+ jr c, .quit
+ ld d, SURF
+ call FieldMovePartyCheck
+ jr c, .quit
+ CheckFlagHL ENGINE_ALWAYS_ON_BIKE
+ jr nz, .quit
+ call GetSurfType
+ ld [wBuffer2], a
+ call FieldMoveGetPartyNick
+ ld a, BANK(AskSurfScript)
+ ld hl, AskSurfScript
+ call CallScript
+ scf
+ ret
+
+.quit
+ xor a
+ ret
+;ca4b
+AskSurfScript:
+ opentext
+ writetext AskSurfText
+ yesorno
+ iftrue UsedSurfScript
+ closetext
+ end
+
+AskSurfText:
+ text_jump AskSurfText_
+ db "@"
+
+FlyFunction:
+IF DEF(GOLD)
+ dr $ca5a, $d1e2
+ENDC
+IF DEF(SILVER)
+ dr $ca58, $d1e0
+ENDC
diff --git a/engine/specials.asm b/engine/specials.asm
index 668b971c..22ea35f7 100755
--- a/engine/specials.asm
+++ b/engine/specials.asm
@@ -68,7 +68,7 @@ SpecialsPointers:
add_special UpdateTimePals
add_special ClearTileMap
add_special UpdateSprites
- add_special Functiond97
+ add_special ReplacePlayerSprite
add_special Special_GameCornerPrizeMonCheckDex
add_special SpecialSeenMon
add_special WaitSFX, $03
@@ -553,105 +553,3 @@ Functionc652: ; c652 (3:4652)
ld a, [$abfd]
ld [wScriptVar], a
jp CloseSRAM
-
-Functionc660:
- nop
-FlagPredef:
- push hl
- push bc
- push bc
- srl c
- srl c
- srl c
- ld b, $0
- add hl, bc
- pop bc
- ld a, c
- and $7
- ld c, a
- ld a, $1
- jr z, .asm_c67a
-.asm_c676
- add a
- dec c
- jr nz, .asm_c676
-.asm_c67a
- ld c, a
- dec b
- jr z, .asm_c687
- dec b
- jr z, .asm_c68c
- ld a, c
- cpl
- and [hl]
- ld [hl], a
- jr .asm_c699
-
-.asm_c687
- ld a, [hl]
- or c
- ld [hl], a
- jr .asm_c699
-
-.asm_c68c
- ld a, d
- cp $0
- jr nz, .asm_c695
- ld a, [hl]
- and c
- jr .asm_c699
-
-.asm_c695
- call GetFarByte
- and c
-.asm_c699
- pop bc
- pop hl
- ld c, a
- ret
-
-HealParty: ; c69d (3:469d)
- xor a
- ld [wd005], a
- ld hl, wPartySpecies
-.asm_c6a4
- ld a, [hli]
- cp $ff
- jr z, .asm_c6bb
- cp $fd
- jr z, .asm_c6b2
- push hl
- call Functionc6bc
- pop hl
-.asm_c6b2
- ld a, [wd005]
- inc a
- ld [wd005], a
- jr .asm_c6a4
-
-.asm_c6bb
- ret
-
-Functionc6bc: ; c6bc (3:46bc)
- ld a, $0
- call GetPartyParamLocation
- ld d, h
- ld e, l
- ld hl, $20
- add hl, de
- xor a
- ld [hli], a
- ld [hl], a
- ld hl, $24
- add hl, de
- ld b, h
- ld c, l
- dec bc
- dec bc
- ld a, [hli]
- ld [bc], a
- inc bc
- ld a, [hl]
- ld [bc], a
- callba Functionf900
- ret
diff --git a/home/copy.asm b/home/copy.asm
index cb1e718d..a3017fd4 100644
--- a/home/copy.asm
+++ b/home/copy.asm
@@ -24,7 +24,7 @@ Functiond70:: ; d70 (0:0d70)
rst Bankswitch
ret
-Functiond97::
+ReplacePlayerSprite::
callba Function1413c
ret
diff --git a/home/window.asm b/home/window.asm
index 9bafebe5..d7f1d9df 100644
--- a/home/window.asm
+++ b/home/window.asm
@@ -33,7 +33,7 @@ CloseText
ld a, $90
ld [hWY], a
callba Function1415c
- call Functiond97
+ call ReplacePlayerSprite
ld hl, wd565
res 7, [hl]
call ResetBGWindow
diff --git a/macros/event.asm b/macros/event.asm
index 7f5228f4..e3d20b48 100644
--- a/macros/event.asm
+++ b/macros/event.asm
@@ -771,8 +771,7 @@ earthquake: macro
enum changemap_command
changemap: macro
db changemap_command
- db \1 ; map_bank
- dw \2 ; map_data_pointer
+ dba \1 ; blockdata
endm
enum changeblock_command
@@ -1025,12 +1024,6 @@ warpfacing: macro
db \4 ; y
endm
- enum battletowertext_command
-battletowertext: macro
- db battletowertext_command
- db \1 ; memory
- endm
-
enum landmarktotext_command
landmarktotext: macro
db landmarktotext_command
diff --git a/main.asm b/main.asm
index 5694b0ef..3224b389 100644
--- a/main.asm
+++ b/main.asm
@@ -347,12 +347,67 @@ INCLUDE "engine/engine_flags.asm"
INCLUDE "engine/variables.asm"
INCLUDE "engine/specials.asm"
-ComputeHPBarPixels:
-IF DEF(GOLD)
- dr $c6de, $c725
-AnimateHPBar:
- dr $c725, $d1e2
+Functionc660:
+ nop
+FlagPredef:
+ push hl
+ push bc
+ push bc
+ srl c
+ srl c
+ srl c
+ ld b, $0
+ add hl, bc
+ pop bc
+ ld a, c
+ and $7
+ ld c, a
+ ld a, $1
+ jr z, .asm_c67a
+.asm_c676
+ add a
+ dec c
+ jr nz, .asm_c676
+.asm_c67a
+ ld c, a
+ dec b
+ jr z, .asm_c687
+ dec b
+ jr z, .asm_c68c
+ ld a, c
+ cpl
+ and [hl]
+ ld [hl], a
+ jr .asm_c699
+
+.asm_c687
+ ld a, [hl]
+ or c
+ ld [hl], a
+ jr .asm_c699
+
+.asm_c68c
+ ld a, d
+ cp $0
+ jr nz, .asm_c695
+ ld a, [hl]
+ and c
+ jr .asm_c699
+
+.asm_c695
+ call GetFarByte
+ and c
+.asm_c699
+ pop bc
+ pop hl
+ ld c, a
+ ret
+
+INCLUDE "engine/health.asm"
+INCLUDE "engine/overworld.asm"
+
ReceiveItem_::
+IF DEF(GOLD)
dr $d1e2, $d21a
TossItem_::
dr $d21a, $d251
@@ -408,10 +463,6 @@ Functionf900:
ENDC
IF DEF(SILVER)
- dr $c6dc, $c723
-AnimateHPBar:
- dr $c723, $d1e0
-ReceiveItem_::
dr $d1e0, $d218
TossItem_::
dr $d218, $d24f
@@ -1303,10 +1354,19 @@ Text_UsedCut_::
Text_NothingToCut_::
dr $1920f2, $19210f
Text_UsedFlash_::
- dr $19210f, $194000
+ dr $19210f, $192135
+UsedSurfText_::
+ dr $192135, $194000
SECTION "bank65", ROMX, BANK[$65]
- dr $194000, $195610
+CantSurfText_::
+ dr $194000, $194015
+
+AlreadySurfingText_::
+ dr $194015, $19402d
+
+AskSurfText_::
+ dr $19402d, $195610
ClockTimeUnknownText_:: ; 195610
dr $195610, $195624