|
1 | 1 | BluesHouse_Script: |
2 | | - call EnableAutoTextBoxDrawing |
3 | | - ld hl, BluesHouse_ScriptPointers |
4 | | - ld a, [wBluesHouseCurScript] |
5 | | - jp CallFunctionInTable |
| 2 | + call EnableAutoTextBoxDrawing |
| 3 | + ld hl, BluesHouseTrainerHeaders |
| 4 | + ld de, BluesHouse_ScriptPointers |
| 5 | + ld a, [wBluesHouseCurScript] |
| 6 | + call ExecuteCurMapScriptInTable |
| 7 | + ld [wBluesHouseCurScript], a |
| 8 | + ret |
6 | 9 |
|
7 | 10 | BluesHouse_ScriptPointers: |
8 | | - def_script_pointers |
9 | | - dw_const BluesHouseDefaultScript, SCRIPT_BLUESHOUSE_DEFAULT |
10 | | - dw_const BluesHouseNoopScript, SCRIPT_BLUESHOUSE_NOOP |
| 11 | + def_script_pointers |
| 12 | + dw_const BluesHouseDefaultScript, SCRIPT_BLUESHOUSE_DEFAULT |
| 13 | + dw_const DisplayEnemyTrainerTextAndStartBattle, SCRIPT_BLUESHOUSE_START_BATTLE |
| 14 | + dw_const EndTrainerBattle, SCRIPT_BLUESHOUSE_END_BATTLE |
| 15 | + dw_const BluesHouseNoopScript, SCRIPT_BLUESHOUSE_NOOP |
11 | 16 |
|
12 | 17 | BluesHouseDefaultScript: |
13 | | - SetEvent EVENT_ENTERED_BLUES_HOUSE |
14 | | - ld a, SCRIPT_BLUESHOUSE_NOOP |
15 | | - ld [wBluesHouseCurScript], a |
16 | | - ret |
| 18 | + ld hl, wCurrentMapScriptFlags |
| 19 | + bit BIT_CUR_MAP_LOADED_1, [hl] |
| 20 | + jr z, .skip_init |
| 21 | + res BIT_CUR_MAP_LOADED_1, [hl] |
| 22 | + SetEvent EVENT_ENTERED_BLUES_HOUSE |
| 23 | + call BluesHouseUpdateOak |
| 24 | +.skip_init |
| 25 | + jp CheckFightingMapTrainers |
| 26 | + |
| 27 | +BluesHouseUpdateOak: |
| 28 | + ld a, HS_BLUES_HOUSE_OAK |
| 29 | + ld [wMissableObjectIndex], a |
| 30 | + CheckEvent EVENT_BEAT_CHAMPION_RIVAL |
| 31 | + jr z, .hide_oak |
| 32 | + CheckEvent EVENT_BEAT_MEWTWO |
| 33 | + jr z, .hide_oak |
| 34 | + call BluesHouseSetOakTrainerSet |
| 35 | + predef ShowObject |
| 36 | + CheckEvent EVENT_OAK_BATTLE_COOLDOWN |
| 37 | + jr nz, .clear_cooldown |
| 38 | + ResetEvent EVENT_BEAT_PROF_OAK |
| 39 | + ret |
| 40 | + |
| 41 | +.hide_oak |
| 42 | + ResetEvent EVENT_OAK_BATTLE_COOLDOWN |
| 43 | + ResetEvent EVENT_BEAT_PROF_OAK |
| 44 | + predef HideObject |
| 45 | + ret |
| 46 | + |
| 47 | +.clear_cooldown |
| 48 | + ResetEvent EVENT_OAK_BATTLE_COOLDOWN |
| 49 | + ret |
| 50 | + |
| 51 | +BluesHouseSetOakTrainerSet: |
| 52 | + ld a, [wPlayerStarter] |
| 53 | + cp STARTER1 |
| 54 | + jr nz, .not_starter1 |
| 55 | + ld b, $1 |
| 56 | + jr .store_set |
| 57 | + |
| 58 | +.not_starter1 |
| 59 | + cp STARTER2 |
| 60 | + jr nz, .not_starter2 |
| 61 | + ld b, $2 |
| 62 | + jr .store_set |
| 63 | + |
| 64 | +.not_starter2 |
| 65 | + ld b, $0 |
| 66 | + |
| 67 | +.store_set |
| 68 | + ld hl, wMapSpriteExtraData |
| 69 | + ld a, BLUESHOUSE_OAK |
| 70 | + dec a |
| 71 | + add a |
| 72 | + ld e, a |
| 73 | + ld d, 0 |
| 74 | + add hl, de |
| 75 | + inc hl |
| 76 | + ld [hl], b |
| 77 | + ret |
17 | 78 |
|
18 | 79 | BluesHouseNoopScript: |
19 | | - ret |
| 80 | + ret |
20 | 81 |
|
21 | 82 | BluesHouse_TextPointers: |
22 | | - def_text_pointers |
23 | | - dw_const BluesHouseDaisySittingText, TEXT_BLUESHOUSE_DAISY_SITTING |
24 | | - dw_const BluesHouseDaisyWalkingText, TEXT_BLUESHOUSE_DAISY_WALKING |
25 | | - dw_const BluesHouseTownMapText, TEXT_BLUESHOUSE_TOWN_MAP |
| 83 | + def_text_pointers |
| 84 | + dw_const BluesHouseDaisySittingText, TEXT_BLUESHOUSE_DAISY_SITTING |
| 85 | + dw_const BluesHouseDaisyWalkingText, TEXT_BLUESHOUSE_DAISY_WALKING |
| 86 | + dw_const BluesHouseTownMapText, TEXT_BLUESHOUSE_TOWN_MAP |
| 87 | + dw_const BluesHouseOakText, TEXT_BLUESHOUSE_OAK |
26 | 88 |
|
27 | 89 | BluesHouseDaisySittingText: |
28 | 90 | text_asm |
@@ -81,9 +143,37 @@ BluesHouseDaisyUseMapText: |
81 | 143 | text_end |
82 | 144 |
|
83 | 145 | BluesHouseDaisyWalkingText: |
84 | | - text_far _BluesHouseDaisyWalkingText |
85 | | - text_end |
| 146 | + text_far _BluesHouseDaisyWalkingText |
| 147 | + text_end |
86 | 148 |
|
87 | 149 | BluesHouseTownMapText: |
88 | | - text_far _BluesHouseTownMapText |
89 | | - text_end |
| 150 | + text_far _BluesHouseTownMapText |
| 151 | + text_end |
| 152 | + |
| 153 | +BluesHouseOakText: |
| 154 | + text_asm |
| 155 | + CheckEvent EVENT_BEAT_PROF_OAK |
| 156 | + jr nz, .already_defeated |
| 157 | + SetEvent EVENT_OAK_BATTLE_COOLDOWN |
| 158 | +.already_defeated |
| 159 | + ld hl, ProfOakTrainerHeader |
| 160 | + call TalkToTrainer |
| 161 | + jp TextScriptEnd |
| 162 | + |
| 163 | +BluesHouseTrainerHeaders: |
| 164 | + def_trainers |
| 165 | +ProfOakTrainerHeader: |
| 166 | + trainer EVENT_BEAT_PROF_OAK, 0, BluesHouseOakBattleText, BluesHouseOakDefeatedText, BluesHouseOakAfterBattleText |
| 167 | + db -1 ; end |
| 168 | + |
| 169 | +BluesHouseOakBattleText: |
| 170 | + text_far _BluesHouseOakBattleText |
| 171 | + text_end |
| 172 | + |
| 173 | +BluesHouseOakDefeatedText: |
| 174 | + text_far _BluesHouseOakDefeatedText |
| 175 | + text_end |
| 176 | + |
| 177 | +BluesHouseOakAfterBattleText: |
| 178 | + text_far _BluesHouseOakAfterBattleText |
| 179 | + text_end |
0 commit comments