pokered/scripts/GameCorner.asm

528 lines
9.7 KiB
NASM
Raw Normal View History

GameCorner_Script:
2014-05-18 18:19:10 +00:00
call CeladonGameCornerScript_48bcf
call CeladonGameCornerScript_48bec
call EnableAutoTextBoxDrawing
ld hl, GameCorner_ScriptPointers
ld a, [wGameCornerCurScript]
2014-05-18 18:19:10 +00:00
jp CallFunctionInTable
2016-06-12 00:24:04 +00:00
CeladonGameCornerScript_48bcf:
2016-01-03 19:17:10 +00:00
ld hl, wCurrentMapScriptFlags
2014-05-18 18:19:10 +00:00
bit 6, [hl]
res 6, [hl]
ret z
call Random
ldh a, [hRandomAdd]
2014-05-18 18:19:10 +00:00
cp $7
jr nc, .asm_48be2
ld a, $8
.asm_48be2
srl a
srl a
srl a
2015-07-13 20:35:35 +00:00
ld [wLuckySlotHiddenObjectIndex], a
2014-05-18 18:19:10 +00:00
ret
2016-06-12 00:24:04 +00:00
CeladonGameCornerScript_48bec:
2016-01-03 19:17:10 +00:00
ld hl, wCurrentMapScriptFlags
2014-05-18 18:19:10 +00:00
bit 5, [hl]
res 5, [hl]
ret z
2015-07-21 17:36:03 +00:00
CheckEvent EVENT_FOUND_ROCKET_HIDEOUT
2014-05-18 18:19:10 +00:00
ret nz
ld a, $2a
2015-07-24 21:39:45 +00:00
ld [wNewTileBlockID], a
2015-08-05 21:20:29 +00:00
lb bc, 2, 8
2014-09-14 18:29:18 +00:00
predef_jump ReplaceTileBlock
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGameCornerScript_48c07:
2014-05-18 18:19:10 +00:00
xor a
2014-05-25 17:51:53 +00:00
ld [wJoyIgnore], a
ld [wGameCornerCurScript], a
2015-08-31 02:38:41 +00:00
ld [wCurMapScript], a
2014-05-18 18:19:10 +00:00
ret
GameCorner_ScriptPointers:
2014-05-18 18:19:10 +00:00
dw CeladonGameCornerScript0
dw CeladonGameCornerScript1
dw CeladonGameCornerScript2
2016-06-12 00:24:04 +00:00
CeladonGameCornerScript0:
2014-05-18 18:19:10 +00:00
ret
2016-06-12 00:24:04 +00:00
CeladonGameCornerScript1:
2015-08-31 02:38:41 +00:00
ld a, [wIsInBattle]
2014-05-18 18:19:10 +00:00
cp $ff
jp z, CeladonGameCornerScript_48c07
ld a, $f0
2014-05-25 17:51:53 +00:00
ld [wJoyIgnore], a
2014-05-18 18:19:10 +00:00
ld a, $d
ldh [hSpriteIndexOrTextID], a
2014-05-18 18:19:10 +00:00
call DisplayTextID
ld a, $b
ldh [hSpriteIndex], a
2014-05-18 18:19:10 +00:00
call SetSpriteMovementBytesToFF
ld de, MovementData_48c5a
2015-08-31 02:38:41 +00:00
ld a, [wYCoord]
cp 6
2014-05-18 18:19:10 +00:00
jr nz, .asm_48c43
ld de, MovementData_48c63
jr .asm_48c4d
.asm_48c43
2015-08-31 02:38:41 +00:00
ld a, [wXCoord]
cp 8
2014-05-18 18:19:10 +00:00
jr nz, .asm_48c4d
ld de, MovementData_48c63
.asm_48c4d
ld a, $b
ldh [hSpriteIndex], a
2014-05-18 18:19:10 +00:00
call MoveSprite
ld a, $2
ld [wGameCornerCurScript], a
2014-05-18 18:19:10 +00:00
ret
2016-06-12 00:24:04 +00:00
MovementData_48c5a:
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_RIGHT
db NPC_MOVEMENT_RIGHT
db NPC_MOVEMENT_UP
db NPC_MOVEMENT_RIGHT
db NPC_MOVEMENT_RIGHT
db NPC_MOVEMENT_RIGHT
db NPC_MOVEMENT_RIGHT
db -1 ; end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
MovementData_48c63:
db NPC_MOVEMENT_RIGHT
db NPC_MOVEMENT_RIGHT
db NPC_MOVEMENT_RIGHT
db NPC_MOVEMENT_RIGHT
db NPC_MOVEMENT_RIGHT
db -1 ; end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGameCornerScript2:
ld a, [wd730]
2014-05-18 18:19:10 +00:00
bit 0, a
ret nz
xor a
2014-05-25 17:51:53 +00:00
ld [wJoyIgnore], a
ld a, HS_GAME_CORNER_ROCKET
2015-07-25 03:27:59 +00:00
ld [wMissableObjectIndex], a
predef HideObject
2016-01-03 19:17:10 +00:00
ld hl, wCurrentMapScriptFlags
2014-05-18 18:19:10 +00:00
set 5, [hl]
set 6, [hl]
ld a, $0
ld [wGameCornerCurScript], a
2014-05-18 18:19:10 +00:00
ret
GameCorner_TextPointers:
2014-05-18 18:19:10 +00:00
dw CeladonGameCornerText1
dw CeladonGameCornerText2
dw CeladonGameCornerText3
dw CeladonGameCornerText4
dw CeladonGameCornerText5
dw CeladonGameCornerText6
dw CeladonGameCornerText7
dw CeladonGameCornerText8
dw CeladonGameCornerText9
dw CeladonGameCornerText10
dw CeladonGameCornerText11
dw CeladonGameCornerText12
dw CeladonGameCornerText13
2016-06-12 00:24:04 +00:00
CeladonGameCornerText1:
text_far _CeladonGameCornerText1
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGameCornerText2:
text_asm
2014-05-18 18:19:10 +00:00
call CeladonGameCornerScript_48f1e
ld hl, CeladonGameCornerText_48d22
call PrintText
call YesNoChoice
ld a, [wCurrentMenuItem]
2014-05-18 18:19:10 +00:00
and a
jr nz, .asm_48d0f
ld b, COIN_CASE
2014-05-18 18:19:10 +00:00
call IsItemInBag
jr z, .asm_48d19
2014-05-18 18:19:10 +00:00
call Has9990Coins
jr nc, .asm_48d14
2014-05-18 18:19:10 +00:00
xor a
ldh [hMoney], a
ldh [hMoney + 2], a
2014-05-18 18:19:10 +00:00
ld a, $10
ldh [hMoney + 1], a
2014-05-18 18:19:10 +00:00
call HasEnoughMoney
jr nc, .asm_48cdb
ld hl, CeladonGameCornerText_48d31
jr .asm_48d1c
.asm_48cdb
2014-05-18 18:19:10 +00:00
xor a
ldh [hMoney], a
ldh [hMoney + 2], a
2014-05-18 18:19:10 +00:00
ld a, $10
ldh [hMoney + 1], a
2015-07-17 08:21:40 +00:00
ld hl, hMoney + 2
ld de, wPlayerMoney + 2
2014-05-18 18:19:10 +00:00
ld c, $3
predef SubBCDPredef
2014-05-18 18:19:10 +00:00
xor a
ldh [hUnusedCoinsByte], a
ldh [hCoins], a
2014-05-18 18:19:10 +00:00
ld a, $50
ldh [hCoins + 1], a
ld de, wPlayerCoins + 1
2015-07-17 08:21:40 +00:00
ld hl, hCoins + 1
2014-05-18 18:19:10 +00:00
ld c, $2
predef AddBCDPredef
2014-05-18 18:19:10 +00:00
call CeladonGameCornerScript_48f1e
ld hl, CeladonGameCornerText_48d27
jr .asm_48d1c
.asm_48d0f
2014-05-18 18:19:10 +00:00
ld hl, CeladonGameCornerText_48d2c
jr .asm_48d1c
.asm_48d14
2014-05-18 18:19:10 +00:00
ld hl, CeladonGameCornerText_48d36
jr .asm_48d1c
.asm_48d19
2014-05-18 18:19:10 +00:00
ld hl, CeladonGameCornerText_48d3b
.asm_48d1c
2014-05-18 18:19:10 +00:00
call PrintText
jp TextScriptEnd
2016-06-12 00:24:04 +00:00
CeladonGameCornerText_48d22:
text_far _CeladonGameCornerText_48d22
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGameCornerText_48d27:
text_far _CeladonGameCornerText_48d27
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGameCornerText_48d2c:
text_far _CeladonGameCornerText_48d2c
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGameCornerText_48d31:
text_far _CeladonGameCornerText_48d31
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGameCornerText_48d36:
text_far _CeladonGameCornerText_48d36
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGameCornerText_48d3b:
text_far _CeladonGameCornerText_48d3b
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGameCornerText3:
text_far _CeladonGameCornerText3
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGameCornerText4:
text_far _CeladonGameCornerText4
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGameCornerText5:
text_asm
2015-07-21 17:36:03 +00:00
CheckEvent EVENT_GOT_10_COINS
jr nz, .asm_48d89
2014-05-18 18:19:10 +00:00
ld hl, CeladonGameCornerText_48d9c
call PrintText
ld b, COIN_CASE
call IsItemInBag
jr z, .asm_48d93
2014-05-18 18:19:10 +00:00
call Has9990Coins
jr nc, .asm_48d8e
2014-05-18 18:19:10 +00:00
xor a
ldh [hUnusedCoinsByte], a
ldh [hCoins], a
2014-05-18 18:19:10 +00:00
ld a, $10
ldh [hCoins + 1], a
ld de, wPlayerCoins + 1
2015-07-17 08:21:40 +00:00
ld hl, hCoins + 1
2014-05-18 18:19:10 +00:00
ld c, $2
predef AddBCDPredef
2015-07-21 17:36:03 +00:00
SetEvent EVENT_GOT_10_COINS
2014-05-18 18:19:10 +00:00
ld a, $1
2014-09-13 07:50:56 +00:00
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
2014-05-18 18:19:10 +00:00
ld hl, Received10CoinsText
jr .asm_48d96
.asm_48d89
2014-05-18 18:19:10 +00:00
ld hl, CeladonGameCornerText_48dac
jr .asm_48d96
.asm_48d8e
2014-05-18 18:19:10 +00:00
ld hl, CeladonGameCornerText_48da7
jr .asm_48d96
.asm_48d93
2014-05-18 18:19:10 +00:00
ld hl, CeladonGameCornerText_48f19
.asm_48d96
2014-05-18 18:19:10 +00:00
call PrintText
jp TextScriptEnd
2016-06-12 00:24:04 +00:00
CeladonGameCornerText_48d9c:
text_far _CeladonGameCornerText_48d9c
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
Received10CoinsText:
text_far _Received10CoinsText
sound_get_item_1
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGameCornerText_48da7:
text_far _CeladonGameCornerText_48da7
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGameCornerText_48dac:
text_far _CeladonGameCornerText_48dac
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGameCornerText6:
text_far _CeladonGameCornerText6
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGameCornerText7:
text_asm
2015-07-21 02:41:23 +00:00
CheckEvent EVENT_BEAT_ERIKA
ld hl, CeladonGameCornerText_48dca
jr z, .asm_48dc4
ld hl, CeladonGameCornerText_48dcf
.asm_48dc4
2014-05-18 18:19:10 +00:00
call PrintText
jp TextScriptEnd
2016-06-12 00:24:04 +00:00
CeladonGameCornerText_48dca:
text_far _CeladonGameCornerText_48dca
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGameCornerText_48dcf:
text_far _CeladonGameCornerText_48dcf
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGameCornerText8:
text_far _CeladonGameCornerText8
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGameCornerText9:
text_asm
2015-07-21 17:36:03 +00:00
CheckEvent EVENT_GOT_20_COINS_2
jr nz, .asm_48e13
2014-05-18 18:19:10 +00:00
ld hl, CeladonGameCornerText_48e26
call PrintText
ld b, COIN_CASE
call IsItemInBag
jr z, .asm_48e1d
2014-05-18 18:19:10 +00:00
call Has9990Coins
jr nc, .asm_48e18
2014-05-18 18:19:10 +00:00
xor a
ldh [hUnusedCoinsByte], a
ldh [hCoins], a
2014-05-18 18:19:10 +00:00
ld a, $20
ldh [hCoins + 1], a
ld de, wPlayerCoins + 1
2015-07-17 08:21:40 +00:00
ld hl, hCoins + 1
2014-05-18 18:19:10 +00:00
ld c, $2
predef AddBCDPredef
2015-07-21 17:36:03 +00:00
SetEvent EVENT_GOT_20_COINS_2
2014-05-18 18:19:10 +00:00
ld hl, Received20CoinsText
jr .asm_48e20
.asm_48e13
2014-05-18 18:19:10 +00:00
ld hl, CeladonGameCornerText_48e36
jr .asm_48e20
.asm_48e18
2014-05-18 18:19:10 +00:00
ld hl, CeladonGameCornerText_48e31
jr .asm_48e20
.asm_48e1d
2014-05-18 18:19:10 +00:00
ld hl, CeladonGameCornerText_48f19
.asm_48e20
2014-05-18 18:19:10 +00:00
call PrintText
jp TextScriptEnd
2016-06-12 00:24:04 +00:00
CeladonGameCornerText_48e26:
text_far _CeladonGameCornerText_48e26
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
Received20CoinsText:
text_far _Received20CoinsText
sound_get_item_1
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGameCornerText_48e31:
text_far _CeladonGameCornerText_48e31
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGameCornerText_48e36:
text_far _CeladonGameCornerText_48e36
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGameCornerText10:
text_asm
2015-07-21 17:36:03 +00:00
CheckEvent EVENT_GOT_20_COINS
jr nz, .asm_48e75
ld hl, CeladonGameCornerText_48e88
2014-05-18 18:19:10 +00:00
call PrintText
ld b, COIN_CASE
2014-05-18 18:19:10 +00:00
call IsItemInBag
jr z, .asm_48e7f
2014-05-18 18:19:10 +00:00
call Has9990Coins
jr z, .asm_48e7a
2014-05-18 18:19:10 +00:00
xor a
ldh [hUnusedCoinsByte], a
ldh [hCoins], a
2014-05-18 18:19:10 +00:00
ld a, $20
ldh [hCoins + 1], a
ld de, wPlayerCoins + 1
2015-07-17 08:21:40 +00:00
ld hl, hCoins + 1
2014-05-18 18:19:10 +00:00
ld c, $2
predef AddBCDPredef
2015-07-21 17:36:03 +00:00
SetEvent EVENT_GOT_20_COINS
2014-05-18 18:19:10 +00:00
ld hl, CeladonGameCornerText_48e8d
jr .asm_48e82
.asm_48e75
2014-05-18 18:19:10 +00:00
ld hl, CeladonGameCornerText_48e98
jr .asm_48e82
.asm_48e7a
2014-05-18 18:19:10 +00:00
ld hl, CeladonGameCornerText_48e93
jr .asm_48e82
.asm_48e7f
2014-05-18 18:19:10 +00:00
ld hl, CeladonGameCornerText_48f19
.asm_48e82
2014-05-18 18:19:10 +00:00
call PrintText
jp TextScriptEnd
2016-06-12 00:24:04 +00:00
CeladonGameCornerText_48e88:
text_far _CeladonGameCornerText_48e88
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGameCornerText_48e8d:
text_far _CeladonGameCornerText_48e8d
sound_get_item_1
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGameCornerText_48e93:
text_far _CeladonGameCornerText_48e93
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGameCornerText_48e98:
text_far _CeladonGameCornerText_48e98
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGameCornerText11:
text_asm
2014-05-18 18:19:10 +00:00
ld hl, CeladonGameCornerText_48ece
call PrintText
ld hl, wd72d
2014-05-18 18:19:10 +00:00
set 6, [hl]
set 7, [hl]
ld hl, CeladonGameCornerText_48ed3
ld de, CeladonGameCornerText_48ed3
2014-09-14 18:29:18 +00:00
call SaveEndBattleTextPointers
ldh a, [hSpriteIndex]
2014-09-13 07:50:56 +00:00
ld [wSpriteIndex], a
2014-05-18 18:19:10 +00:00
call EngageMapTrainer
call InitBattleEnemyParameters
xor a
ldh [hJoyHeld], a
ldh [hJoyPressed], a
ldh [hJoyReleased], a
2014-05-18 18:19:10 +00:00
ld a, $1
ld [wGameCornerCurScript], a
2014-05-18 18:19:10 +00:00
jp TextScriptEnd
2016-06-12 00:24:04 +00:00
CeladonGameCornerText_48ece:
text_far _CeladonGameCornerText_48ece
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGameCornerText_48ed3:
text_far _CeladonGameCornerText_48ed3
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGameCornerText13:
text_far _CeladonGameCornerText_48ed8
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGameCornerText12:
text_asm
2014-05-18 18:19:10 +00:00
ld a, $1
2014-09-13 07:50:56 +00:00
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
2014-05-18 18:19:10 +00:00
ld hl, CeladonGameCornerText_48f09
call PrintText
call WaitForSoundToFinish
2015-07-19 08:46:12 +00:00
ld a, SFX_GO_INSIDE
2014-05-18 18:19:10 +00:00
call PlaySound
call WaitForSoundToFinish
2015-07-21 17:36:03 +00:00
SetEvent EVENT_FOUND_ROCKET_HIDEOUT
2014-05-18 18:19:10 +00:00
ld a, $43
2015-07-24 21:39:45 +00:00
ld [wNewTileBlockID], a
2015-08-05 21:20:29 +00:00
lb bc, 2, 8
2014-09-14 18:29:18 +00:00
predef ReplaceTileBlock
2014-05-18 18:19:10 +00:00
jp TextScriptEnd
2016-06-12 00:24:04 +00:00
CeladonGameCornerText_48f09:
text_far _CeladonGameCornerText_48f09
text_asm
2015-07-19 08:46:12 +00:00
ld a, SFX_SWITCH
2014-05-18 18:19:10 +00:00
call PlaySound
call WaitForSoundToFinish
jp TextScriptEnd
2016-06-12 00:24:04 +00:00
CeladonGameCornerText_48f19:
text_far _CeladonGameCornerText_48f19
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGameCornerScript_48f1e:
ld hl, wd730
2014-05-18 18:19:10 +00:00
set 6, [hl]
hlcoord 11, 0
2020-11-06 15:33:58 +00:00
ld b, 5
ld c, 7
2014-05-18 18:19:10 +00:00
call TextBoxBorder
call UpdateSprites
hlcoord 12, 1
2015-08-05 21:20:29 +00:00
ld b, 4
ld c, 7
2014-05-18 18:19:10 +00:00
call ClearScreenArea
hlcoord 12, 2
2014-05-18 18:19:10 +00:00
ld de, GameCornerMoneyText
call PlaceString
hlcoord 12, 3
2014-05-18 18:19:10 +00:00
ld de, GameCornerBlankText1
call PlaceString
hlcoord 12, 3
ld de, wPlayerMoney
2020-11-06 15:33:58 +00:00
ld c, 3 | MONEY_SIGN | LEADING_ZEROES
2014-05-18 18:19:10 +00:00
call PrintBCDNumber
hlcoord 12, 4
2014-05-18 18:19:10 +00:00
ld de, GameCornerCoinText
call PlaceString
hlcoord 12, 5
2014-05-18 18:19:10 +00:00
ld de, GameCornerBlankText2
call PlaceString
hlcoord 15, 5
ld de, wPlayerCoins
2014-05-18 18:19:10 +00:00
ld c, $82
call PrintBCDNumber
ld hl, wd730
2014-05-18 18:19:10 +00:00
res 6, [hl]
ret
2016-06-12 00:24:04 +00:00
GameCornerMoneyText:
2014-05-18 18:19:10 +00:00
db "MONEY@"
2016-06-12 00:24:04 +00:00
GameCornerCoinText:
2014-05-18 18:19:10 +00:00
db "COIN@"
2016-06-12 00:24:04 +00:00
GameCornerBlankText1:
2014-05-18 18:19:10 +00:00
db " @"
2016-06-12 00:24:04 +00:00
GameCornerBlankText2:
2014-05-18 18:19:10 +00:00
db " @"
2016-06-12 00:24:04 +00:00
Has9990Coins:
2014-05-18 18:19:10 +00:00
ld a, $99
ldh [hCoins], a
2014-05-18 18:19:10 +00:00
ld a, $90
ldh [hCoins + 1], a
2014-05-18 18:19:10 +00:00
jp HasEnoughCoins