2019-01-01 20:06:23 +00:00
|
|
|
PokemonMansion3F_Script:
|
2023-11-19 21:09:33 +00:00
|
|
|
call Mansion3CheckReplaceSwitchDoorBlocks
|
2014-05-18 18:19:10 +00:00
|
|
|
call EnableAutoTextBoxDrawing
|
2021-04-13 22:24:37 +00:00
|
|
|
ld hl, Mansion3TrainerHeaders
|
2019-01-01 20:06:23 +00:00
|
|
|
ld de, PokemonMansion3F_ScriptPointers
|
|
|
|
ld a, [wPokemonMansion3FCurScript]
|
2014-05-18 18:19:10 +00:00
|
|
|
call ExecuteCurMapScriptInTable
|
2019-01-01 20:06:23 +00:00
|
|
|
ld [wPokemonMansion3FCurScript], a
|
2014-05-18 18:19:10 +00:00
|
|
|
ret
|
|
|
|
|
2023-11-19 21:09:33 +00:00
|
|
|
Mansion3CheckReplaceSwitchDoorBlocks:
|
2016-01-03 19:17:10 +00:00
|
|
|
ld hl, wCurrentMapScriptFlags
|
2024-09-24 15:39:44 +00:00
|
|
|
bit BIT_CUR_MAP_LOADED_1, [hl]
|
|
|
|
res BIT_CUR_MAP_LOADED_1, [hl]
|
2014-05-18 18:19:10 +00:00
|
|
|
ret z
|
2015-07-21 17:36:03 +00:00
|
|
|
CheckEvent EVENT_MANSION_SWITCH_ON
|
2023-11-19 21:09:33 +00:00
|
|
|
jr nz, .switchTurnedOn
|
2014-05-18 18:19:10 +00:00
|
|
|
ld a, $e
|
2019-07-07 04:44:21 +00:00
|
|
|
lb bc, 2, 7
|
2023-11-19 21:09:33 +00:00
|
|
|
call Mansion2ReplaceBlock
|
2014-05-18 18:19:10 +00:00
|
|
|
ld a, $5f
|
2019-07-07 04:44:21 +00:00
|
|
|
lb bc, 5, 7
|
2023-11-19 21:09:33 +00:00
|
|
|
call Mansion2ReplaceBlock
|
2014-05-18 18:19:10 +00:00
|
|
|
ret
|
2023-11-19 21:09:33 +00:00
|
|
|
.switchTurnedOn
|
2014-05-18 18:19:10 +00:00
|
|
|
ld a, $5f
|
2019-07-07 04:44:21 +00:00
|
|
|
lb bc, 2, 7
|
2023-11-19 21:09:33 +00:00
|
|
|
call Mansion2ReplaceBlock
|
2014-05-18 18:19:10 +00:00
|
|
|
ld a, $e
|
2019-07-07 04:44:21 +00:00
|
|
|
lb bc, 5, 7
|
2023-11-19 21:09:33 +00:00
|
|
|
call Mansion2ReplaceBlock
|
2014-05-18 18:19:10 +00:00
|
|
|
ret
|
|
|
|
|
2019-01-01 20:06:23 +00:00
|
|
|
PokemonMansion3F_ScriptPointers:
|
2023-07-14 01:27:56 +00:00
|
|
|
def_script_pointers
|
|
|
|
dw_const PokemonMansion3FDefaultScript, SCRIPT_POKEMONMANSION3F_DEFAULT
|
|
|
|
dw_const DisplayEnemyTrainerTextAndStartBattle, SCRIPT_POKEMONMANSION3F_START_BATTLE
|
|
|
|
dw_const EndTrainerBattle, SCRIPT_POKEMONMANSION3F_END_BATTLE
|
2014-05-18 18:19:10 +00:00
|
|
|
|
2023-07-14 01:27:56 +00:00
|
|
|
PokemonMansion3FDefaultScript:
|
2023-11-19 21:09:33 +00:00
|
|
|
ld hl, .holeCoords
|
|
|
|
call .isPlayerFallingDownHole
|
2014-09-13 07:50:56 +00:00
|
|
|
ld a, [wWhichDungeonWarp]
|
2014-05-18 18:19:10 +00:00
|
|
|
and a
|
|
|
|
jp z, CheckFightingMapTrainers
|
|
|
|
cp $3
|
2019-07-07 04:44:21 +00:00
|
|
|
ld a, POKEMON_MANSION_1F
|
2023-11-19 23:37:59 +00:00
|
|
|
jr nz, .fellDownHoleTo1F
|
2019-07-07 04:44:21 +00:00
|
|
|
ld a, POKEMON_MANSION_2F
|
2023-11-19 23:37:59 +00:00
|
|
|
.fellDownHoleTo1F
|
2014-09-13 07:50:56 +00:00
|
|
|
ld [wDungeonWarpDestinationMap], a
|
2014-05-18 18:19:10 +00:00
|
|
|
ret
|
|
|
|
|
2023-11-19 21:09:33 +00:00
|
|
|
.holeCoords:
|
2020-07-16 16:32:19 +00:00
|
|
|
dbmapcoord 16, 14
|
|
|
|
dbmapcoord 17, 14
|
|
|
|
dbmapcoord 19, 14
|
|
|
|
db -1 ; end
|
2014-05-18 18:19:10 +00:00
|
|
|
|
2023-11-19 21:09:33 +00:00
|
|
|
.isPlayerFallingDownHole:
|
2014-05-18 18:19:10 +00:00
|
|
|
xor a
|
2014-09-13 07:50:56 +00:00
|
|
|
ld [wWhichDungeonWarp], a
|
2024-07-16 17:02:54 +00:00
|
|
|
ld a, [wStatusFlags3]
|
|
|
|
bit BIT_ON_DUNGEON_WARP, a
|
2014-05-18 18:19:10 +00:00
|
|
|
ret nz
|
|
|
|
call ArePlayerCoordsInArray
|
|
|
|
ret nc
|
2015-07-19 03:49:52 +00:00
|
|
|
ld a, [wCoordIndex]
|
2014-09-13 07:50:56 +00:00
|
|
|
ld [wWhichDungeonWarp], a
|
2024-07-16 17:02:54 +00:00
|
|
|
ld hl, wStatusFlags3
|
|
|
|
set BIT_ON_DUNGEON_WARP, [hl]
|
|
|
|
ld hl, wStatusFlags6
|
|
|
|
set BIT_DUNGEON_WARP, [hl]
|
2014-05-18 18:19:10 +00:00
|
|
|
ret
|
|
|
|
|
2020-06-27 19:32:24 +00:00
|
|
|
Mansion3Script_Switches::
|
2020-07-05 21:29:11 +00:00
|
|
|
ld a, [wSpritePlayerStateData1FacingDirection]
|
2015-07-04 05:44:12 +00:00
|
|
|
cp SPRITE_FACING_UP
|
2014-05-18 18:19:10 +00:00
|
|
|
ret nz
|
|
|
|
xor a
|
2020-07-06 23:03:05 +00:00
|
|
|
ldh [hJoyHeld], a
|
2023-07-14 01:27:56 +00:00
|
|
|
ld a, TEXT_POKEMONMANSION3F_SWITCH
|
2024-09-19 01:01:18 +00:00
|
|
|
ldh [hTextID], a
|
2014-05-18 18:19:10 +00:00
|
|
|
jp DisplayTextID
|
|
|
|
|
2019-01-01 20:06:23 +00:00
|
|
|
PokemonMansion3F_TextPointers:
|
2023-07-14 01:27:56 +00:00
|
|
|
def_text_pointers
|
|
|
|
dw_const PokemonMansion3FSuperNerdText, TEXT_POKEMONMANSION3F_SUPER_NERD
|
|
|
|
dw_const PokemonMansion3FScientistText, TEXT_POKEMONMANSION3F_SCIENTIST
|
|
|
|
dw_const PickUpItemText, TEXT_POKEMONMANSION3F_MAX_POTION
|
|
|
|
dw_const PickUpItemText, TEXT_POKEMONMANSION3F_IRON
|
|
|
|
dw_const PokemonMansion3FDiaryText, TEXT_POKEMONMANSION3F_DIARY
|
|
|
|
dw_const PokemonMansion2FSwitchText, TEXT_POKEMONMANSION3F_SWITCH ; This switch uses the text script from the 2F.
|
2014-05-18 18:19:10 +00:00
|
|
|
|
2021-04-13 22:24:37 +00:00
|
|
|
Mansion3TrainerHeaders:
|
|
|
|
def_trainers
|
2016-06-12 00:24:04 +00:00
|
|
|
Mansion3TrainerHeader0:
|
2023-07-14 01:27:56 +00:00
|
|
|
trainer EVENT_BEAT_MANSION_3_TRAINER_0, 0, PokemonMansion3FSuperNerdBattleText, PokemonMansion3FSuperNerdEndBattleText, PokemonMansion3FSuperNerdAfterBattleText
|
2016-07-20 05:40:04 +00:00
|
|
|
Mansion3TrainerHeader1:
|
2023-07-14 01:27:56 +00:00
|
|
|
trainer EVENT_BEAT_MANSION_3_TRAINER_1, 2, PokemonMansion3FScientistBattleText, PokemonMansion3FScientistEndBattleText, PokemonMansion3FScientistAfterBattleText
|
2020-07-14 19:45:36 +00:00
|
|
|
db -1 ; end
|
2014-05-18 18:19:10 +00:00
|
|
|
|
2023-07-14 01:27:56 +00:00
|
|
|
PokemonMansion3FSuperNerdText:
|
2020-07-04 21:09:35 +00:00
|
|
|
text_asm
|
2014-05-18 18:19:10 +00:00
|
|
|
ld hl, Mansion3TrainerHeader0
|
|
|
|
call TalkToTrainer
|
|
|
|
jp TextScriptEnd
|
|
|
|
|
2023-07-14 01:27:56 +00:00
|
|
|
PokemonMansion3FScientistText:
|
2020-07-04 21:09:35 +00:00
|
|
|
text_asm
|
2016-07-20 05:40:04 +00:00
|
|
|
ld hl, Mansion3TrainerHeader1
|
2014-05-18 18:19:10 +00:00
|
|
|
call TalkToTrainer
|
|
|
|
jp TextScriptEnd
|
|
|
|
|
2023-07-14 01:27:56 +00:00
|
|
|
PokemonMansion3FSuperNerdBattleText:
|
|
|
|
text_far _PokemonMansion3FSuperNerdBattleText
|
2020-07-04 21:09:35 +00:00
|
|
|
text_end
|
2014-05-18 18:19:10 +00:00
|
|
|
|
2023-07-14 01:27:56 +00:00
|
|
|
PokemonMansion3FSuperNerdEndBattleText:
|
|
|
|
text_far _PokemonMansion3FSuperNerdEndBattleText
|
2020-07-04 21:09:35 +00:00
|
|
|
text_end
|
2014-05-18 18:19:10 +00:00
|
|
|
|
2023-07-14 01:27:56 +00:00
|
|
|
PokemonMansion3FSuperNerdAfterBattleText:
|
|
|
|
text_far _PokemonMansion3FSuperNerdAfterBattleText
|
2020-07-04 21:09:35 +00:00
|
|
|
text_end
|
2014-05-18 18:19:10 +00:00
|
|
|
|
2023-07-14 01:27:56 +00:00
|
|
|
PokemonMansion3FScientistBattleText:
|
|
|
|
text_far _PokemonMansion3FScientistBattleText
|
2020-07-04 21:09:35 +00:00
|
|
|
text_end
|
2014-05-18 18:19:10 +00:00
|
|
|
|
2023-07-14 01:27:56 +00:00
|
|
|
PokemonMansion3FScientistEndBattleText:
|
|
|
|
text_far _PokemonMansion3FScientistEndBattleText
|
2020-07-04 21:09:35 +00:00
|
|
|
text_end
|
2014-05-18 18:19:10 +00:00
|
|
|
|
2023-07-14 01:27:56 +00:00
|
|
|
PokemonMansion3FScientistAfterBattleText:
|
|
|
|
text_far _PokemonMansion3FScientistAfterBattleText
|
2020-07-04 21:09:35 +00:00
|
|
|
text_end
|
2014-05-18 18:19:10 +00:00
|
|
|
|
2023-07-14 01:27:56 +00:00
|
|
|
PokemonMansion3FDiaryText:
|
|
|
|
text_far _PokemonMansion3FDiaryText
|
2020-07-04 21:09:35 +00:00
|
|
|
text_end
|