Skip to content

Commit

Permalink
ScriptPointers TextPointers
Browse files Browse the repository at this point in the history
  • Loading branch information
vulcandth committed Jul 3, 2022
1 parent 610ec0f commit b05cbf2
Show file tree
Hide file tree
Showing 10 changed files with 153 additions and 138 deletions.
2 changes: 1 addition & 1 deletion data/maps/objects/AgathasRoom.asm
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ AgathasRoom_Object:
def_bg_events

def_object_events
object_event 5, 2, SPRITE_AGATHA, STAY, DOWN, 1, OPP_AGATHA, 1
object_event 5, 2, SPRITE_AGATHA, STAY, DOWN, TEXT_AGATHASROOM_AGATHA, OPP_AGATHA, 1

def_warps_to AGATHAS_ROOM
6 changes: 3 additions & 3 deletions data/maps/objects/BikeShop.asm
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ BikeShop_Object:
def_bg_events

def_object_events
object_event 6, 2, SPRITE_BIKE_SHOP_CLERK, STAY, NONE, 1 ; person
object_event 5, 6, SPRITE_MIDDLE_AGED_WOMAN, WALK, UP_DOWN, 2 ; person
object_event 1, 3, SPRITE_YOUNGSTER, STAY, UP, 3 ; person
object_event 6, 2, SPRITE_BIKE_SHOP_CLERK, STAY, NONE, TEXT_BIKESHOP_CLERK ; person
object_event 5, 6, SPRITE_MIDDLE_AGED_WOMAN, WALK, UP_DOWN, TEXT_BIKESHOP_MIDDLE_AGED_WOMAN ; person
object_event 1, 3, SPRITE_YOUNGSTER, STAY, UP, TEXT_BIKESHOP_YOUNGSTER ; person

def_warps_to BIKE_SHOP
4 changes: 2 additions & 2 deletions data/maps/objects/ChampionsRoom.asm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ChampionsRoom_Object:
def_bg_events

def_object_events
object_event 4, 2, SPRITE_BLUE, STAY, DOWN, 1 ; person
object_event 3, 7, SPRITE_OAK, STAY, UP, 2 ; person
object_event 4, 2, SPRITE_BLUE, STAY, DOWN, TEXT_CHAMPIONSROOM_GARY_INTRO_AND_AFTER_BATTLE ; person
object_event 3, 7, SPRITE_OAK, STAY, UP, TEXT_CHAMPIONSROOM_OAK_SAYS_PLAYERS_NAME ; person

def_warps_to CHAMPIONS_ROOM
5 changes: 5 additions & 0 deletions macros/const.asm
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ MACRO const_next
endc
ENDM

MACRO dw_const
dw \1
const \2
ENDM

MACRO rb_skip
IF _NARG == 1
rsset _RS + \1
Expand Down
10 changes: 10 additions & 0 deletions macros/scripts/maps.asm
Original file line number Diff line number Diff line change
Expand Up @@ -208,3 +208,13 @@ MACRO connection
db _y, _x
dw wOverworldMap + _win
ENDM

MACRO def_script_pointers
\1_ScriptPointers:
const_def
ENDM

MACRO def_text_pointers
\1_TextPointers:
const_def 1
ENDM
44 changes: 22 additions & 22 deletions scripts/AgathasRoom.asm
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@ AgathaShowOrHideExitBlock:
predef_jump ReplaceTileBlock

ResetAgathaScript:
xor a
xor a ; SCRIPT_AGATHASROOM_DEFAULT
ld [wAgathasRoomCurScript], a
ret

AgathasRoom_ScriptPointers:
dw AgathaScript0
dw DisplayEnemyTrainerTextAndStartBattle
dw AgathaScript2
dw AgathaScript3
dw AgathaScript4
def_script_pointers AgathasRoom
dw_const AgathasRoomDefaultScript, SCRIPT_AGATHASROOM_DEFAULT
dw_const DisplayEnemyTrainerTextAndStartBattle, SCRIPT_AGATHASROOM_AGATHA_START_BATTLE
dw_const AgathasRoomAgathaEndBattleScript, SCRIPT_AGATHASROOM_AGATHA_END_BATTLE
dw_const AgathasRoomPlayerIsMovingScript, SCRIPT_AGATHASROOM_PLAYER_IS_MOVING
dw_const AgathasRoomStubScript, SCRIPT_AGATHASROOM_STUB

AgathaScript4:
AgathasRoomStubScript: ; stub
ret

AgathaScriptWalkIntoRoom:
Expand All @@ -53,12 +53,12 @@ AgathaScriptWalkIntoRoom:
ld a, $6
ld [wSimulatedJoypadStatesIndex], a
call StartSimulatingJoypadStates
ld a, $3
ld a, SCRIPT_AGATHASROOM_PLAYER_IS_MOVING
ld [wAgathasRoomCurScript], a
ld [wCurMapScript], a
ret

AgathaScript0:
AgathasRoomDefaultScript:
ld hl, AgathaEntranceCoords
call ArePlayerCoordsInArray
jp nc, CheckFightingMapTrainers
Expand All @@ -73,15 +73,15 @@ AgathaScript0:
CheckAndSetEvent EVENT_AUTOWALKED_INTO_AGATHAS_ROOM
jr z, AgathaScriptWalkIntoRoom
.stopPlayerFromLeaving
ld a, $2
ld a, TEXT_AGATHASROOM_DONT_RUN_AWAY
ldh [hSpriteIndexOrTextID], a
call DisplayTextID ; "Don't run away!"
call DisplayTextID
ld a, D_UP
ld [wSimulatedJoypadStatesEnd], a
ld a, $1
ld [wSimulatedJoypadStatesIndex], a
call StartSimulatingJoypadStates
ld a, $3
ld a, SCRIPT_AGATHASROOM_PLAYER_IS_MOVING
ld [wAgathasRoomCurScript], a
ld [wCurMapScript], a
ret
Expand All @@ -93,7 +93,7 @@ AgathaEntranceCoords:
dbmapcoord 5, 11
db -1 ; end

AgathaScript3:
AgathasRoomPlayerIsMovingScript:
ld a, [wSimulatedJoypadStatesIndex]
and a
ret nz
Expand All @@ -104,29 +104,29 @@ AgathaScript3:
ld [wCurMapScript], a
ret

AgathaScript2:
AgathasRoomAgathaEndBattleScript:
call EndTrainerBattle
ld a, [wIsInBattle]
cp $ff
jp z, ResetAgathaScript
ld a, $1
ld a, TEXT_AGATHASROOM_AGATHA
ldh [hSpriteIndexOrTextID], a
call DisplayTextID
ld a, $1
ld a, SCRIPT_CHAMPIONSROOM_PLAYER_ENTERS
ld [wChampionsRoomCurScript], a
ret

AgathasRoom_TextPointers:
dw AgathaText1
dw AgathaDontRunAwayText
def_text_pointers AgathasRoom
dw_const AgathasRoomAgathaTextScript, TEXT_AGATHASROOM_AGATHA
dw_const AgathasRoomDontRunAwayText, TEXT_AGATHASROOM_DONT_RUN_AWAY

AgathasRoomTrainerHeaders:
def_trainers
AgathasRoomTrainerHeader0:
trainer EVENT_BEAT_AGATHAS_ROOM_TRAINER_0, 0, AgathaBeforeBattleText, AgathaEndBattleText, AgathaAfterBattleText
db -1 ; end

AgathaText1:
AgathasRoomAgathaTextScript:
text_asm
ld hl, AgathasRoomTrainerHeader0
call TalkToTrainer
Expand All @@ -144,6 +144,6 @@ AgathaAfterBattleText:
text_far _AgathaAfterBattleText
text_end

AgathaDontRunAwayText:
AgathasRoomDontRunAwayText:
text_far _AgathaDontRunAwayText
text_end
68 changes: 34 additions & 34 deletions scripts/BikeShop.asm
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
BikeShop_Script:
jp EnableAutoTextBoxDrawing

BikeShop_TextPointers:
dw BikeShopText1
dw BikeShopText2
dw BikeShopText3
def_text_pointers BikeShop
dw_const BikeShopClerkTextScript, TEXT_BIKESHOP_CLERK
dw_const BikeShopMiddleAgedWomanTextScript, TEXT_BIKESHOP_MIDDLE_AGED_WOMAN
dw_const BikeShopYoungsterTextScript, TEXT_BIKESHOP_YOUNGSTER

BikeShopText1:
BikeShopClerkTextScript:
text_asm
CheckEvent EVENT_GOT_BICYCLE
jr z, .asm_260d4
ld hl, BikeShopText_1d82f
ld hl, BikeShopClerkHowDoYouLikeYourBicycleText
call PrintText
jp .Done
.asm_260d4
ld b, BIKE_VOUCHER
call IsItemInBag
jr z, .asm_41190
ld hl, BikeShopText_1d81f
ld hl, BikeShopClerkOhThatsAVoucherText
call PrintText
lb bc, BICYCLE, 1
call GiveItem
Expand All @@ -26,15 +26,15 @@ BikeShopText1:
ldh [hItemToRemoveID], a
farcall RemoveItemByID
SetEvent EVENT_GOT_BICYCLE
ld hl, BikeShopText_1d824
ld hl, BikeShopExchangedVoucherText
call PrintText
jr .Done
.BagFull
ld hl, BikeShopText_1d834
ld hl, BikeShopBagFullText
call PrintText
jr .Done
.asm_41190
ld hl, BikeShopText_1d810
ld hl, BikeShopClerkWelcomeText
call PrintText
xor a
ld [wCurrentMenuItem], a
Expand All @@ -60,7 +60,7 @@ BikeShopText1:
hlcoord 8, 3
ld de, BikeShopMenuPrice
call PlaceString
ld hl, BikeShopText_1d815
ld hl, BikeShopClerkDoYouLikeItText
call PrintText
call HandleMenuInput
bit BIT_B_BUTTON, a
Expand All @@ -85,63 +85,63 @@ BikeShopMenuText:
BikeShopMenuPrice:
db "¥1000000@"

BikeShopText_1d810:
text_far _BikeShopText_1d810
BikeShopClerkWelcomeText:
text_far _BikeShopClerkWelcomeText
text_end

BikeShopText_1d815:
text_far _BikeShopText_1d815
BikeShopClerkDoYouLikeItText:
text_far _BikeShopClerkDoYouLikeItText
text_end

BikeShopCantAffordText:
text_far _BikeShopCantAffordText
text_end

BikeShopText_1d81f:
text_far _BikeShopText_1d81f
BikeShopClerkOhThatsAVoucherText:
text_far _BikeShopClerkOhThatsAVoucherText
text_end

BikeShopText_1d824:
text_far _BikeShopText_1d824
BikeShopExchangedVoucherText:
text_far _BikeShopExchangedVoucherText
sound_get_key_item
text_end

BikeShopComeAgainText:
text_far _BikeShopComeAgainText
text_end

BikeShopText_1d82f:
text_far _BikeShopText_1d82f
BikeShopClerkHowDoYouLikeYourBicycleText:
text_far _BikeShopClerkHowDoYouLikeYourBicycleText
text_end

BikeShopText_1d834:
text_far _BikeShopText_1d834
BikeShopBagFullText:
text_far _BikeShopBagFullText
text_end

BikeShopText2:
BikeShopMiddleAgedWomanTextScript:
text_asm
ld hl, BikeShopText_1d843
ld hl, BikeShopMiddleAgedWomanText
call PrintText
jp TextScriptEnd

BikeShopText_1d843:
text_far _BikeShopText_1d843
BikeShopMiddleAgedWomanText:
text_far _BikeShopMiddleAgedWomanText
text_end

BikeShopText3:
BikeShopYoungsterTextScript:
text_asm
CheckEvent EVENT_GOT_BICYCLE
ld hl, BikeShopText_1d861
ld hl, BikeShopYoungsterCoolBikeText
jr nz, .asm_34d2d
ld hl, BikeShopText_1d85c
ld hl, BikeShopYoungsterTheseBikesAreExpensiveText
.asm_34d2d
call PrintText
jp TextScriptEnd

BikeShopText_1d85c:
text_far _BikeShopText_1d85c
BikeShopYoungsterTheseBikesAreExpensiveText:
text_far _BikeShopYoungsterTheseBikesAreExpensiveText
text_end

BikeShopText_1d861:
text_far _BikeShopText_1d861
BikeShopYoungsterCoolBikeText:
text_far _BikeShopYoungsterCoolBikeText
text_end
Loading

0 comments on commit b05cbf2

Please sign in to comment.