summaryrefslogtreecommitdiff
path: root/de/scripts
diff options
context:
space:
mode:
authorIIMarckus <iimarckus@gmail.com>2018-06-02 04:27:31 -0600
committerIIMarckus <iimarckus@gmail.com>2018-06-02 04:27:31 -0600
commit5d2473f767b431910da023a6e37ad3239dcdd575 (patch)
tree6200e65d9bd7e8fa8429c62d3907f21587ab74df /de/scripts
parentf31a2ed69f7368d88a0a1aed5c35aa8cb34af6b3 (diff)
Start of German translation. Needs work.multilang
Diffstat (limited to 'de/scripts')
-rwxr-xr-xde/scripts/bikeshop.asm147
-rwxr-xr-xde/scripts/celadongamecorner.asm527
-rwxr-xr-xde/scripts/celadongym.asm335
-rwxr-xr-xde/scripts/ceruleangym.asm219
-rwxr-xr-xde/scripts/cinnabargym.asm472
-rwxr-xr-xde/scripts/fuchsiagym.asm329
-rwxr-xr-xde/scripts/pewtercity.asm324
-rwxr-xr-xde/scripts/pewtergym.asm228
-rwxr-xr-xde/scripts/route23.asm236
-rwxr-xr-xde/scripts/saffrongym.asm358
-rwxr-xr-xde/scripts/vermiliongym.asm267
-rwxr-xr-xde/scripts/viridiangym.asm496
12 files changed, 3938 insertions, 0 deletions
diff --git a/de/scripts/bikeshop.asm b/de/scripts/bikeshop.asm
new file mode 100755
index 00000000..ab6b8df9
--- /dev/null
+++ b/de/scripts/bikeshop.asm
@@ -0,0 +1,147 @@
+BikeShopScript:
+ jp EnableAutoTextBoxDrawing
+
+BikeShopTextPointers:
+ dw BikeShopText1
+ dw BikeShopText2
+ dw BikeShopText3
+
+BikeShopText1:
+ TX_ASM
+ CheckEvent EVENT_GOT_BICYCLE
+ jr z, .asm_260d4
+ ld hl, BikeShopText_1d82f
+ call PrintText
+ jp .Done
+.asm_260d4
+ ld b, BIKE_VOUCHER
+ call IsItemInBag
+ jr z, .asm_41190
+ ld hl, BikeShopText_1d81f
+ call PrintText
+ lb bc, BICYCLE, 1
+ call GiveItem
+ jr nc, .BagFull
+ ld a, BIKE_VOUCHER
+ ld [$ffdb], a
+ callba RemoveItemByID
+ SetEvent EVENT_GOT_BICYCLE
+ ld hl, BikeShopText_1d824
+ call PrintText
+ jr .Done
+.BagFull
+ ld hl, BikeShopText_1d834
+ call PrintText
+ jr .Done
+.asm_41190
+ ld hl, BikeShopText_1d810
+ call PrintText
+ xor a
+ ld [wCurrentMenuItem], a
+ ld [wLastMenuItem], a
+ ld a, A_BUTTON | B_BUTTON
+ ld [wMenuWatchedKeys], a
+ ld a, $1
+ ld [wMaxMenuItem], a
+ ld a, $2
+ ld [wTopMenuItemY], a
+ ld a, $1
+ ld [wTopMenuItemX], a
+ ld hl, wd730
+ set 6, [hl]
+ coord hl, 0, 0
+ ld b, $4
+ ld c, $f
+ call TextBoxBorder
+ call UpdateSprites
+ coord hl, 2, 2
+ ld de, BikeShopMenuText
+ call PlaceString
+ coord hl, 8, 3
+ ld de, BikeShopMenuPrice
+ call PlaceString
+ ld hl, BikeShopText_1d815
+ call PrintText
+ call HandleMenuInput
+ bit 1, a
+ jr nz, .cancel
+ ld hl, wd730
+ res 6, [hl]
+ ld a, [wCurrentMenuItem]
+ and a
+ jr nz, .cancel
+ ld hl, BikeShopCantAffordText
+ call PrintText
+.cancel
+ ld hl, BikeShopComeAgainText
+ call PrintText
+.Done
+ jp TextScriptEnd
+
+BikeShopMenuText:
+ db "FAHRRAD"
+ next "ZURÜCK@"
+
+BikeShopMenuPrice:
+ db "¥1000000@"
+
+BikeShopText_1d810:
+ TX_FAR _BikeShopText_1d810
+ db "@"
+
+BikeShopText_1d815:
+ TX_FAR _BikeShopText_1d815
+ db "@"
+
+BikeShopCantAffordText:
+ TX_FAR _BikeShopCantAffordText
+ db "@"
+
+BikeShopText_1d81f:
+ TX_FAR _BikeShopText_1d81f
+ db "@"
+
+BikeShopText_1d824:
+ TX_FAR _BikeShopText_1d824
+ TX_SFX_KEY_ITEM
+ db "@"
+
+BikeShopComeAgainText:
+ TX_FAR _BikeShopComeAgainText
+ db "@"
+
+BikeShopText_1d82f:
+ TX_FAR _BikeShopText_1d82f
+ db "@"
+
+BikeShopText_1d834:
+ TX_FAR _BikeShopText_1d834
+ db "@"
+
+BikeShopText2:
+ TX_ASM
+ ld hl, BikeShopText_1d843
+ call PrintText
+ jp TextScriptEnd
+
+BikeShopText_1d843:
+ TX_FAR _BikeShopText_1d843
+ db "@"
+
+BikeShopText3:
+ TX_ASM
+ CheckEvent EVENT_GOT_BICYCLE
+ ld hl, BikeShopText_1d861
+ jr nz, .asm_34d2d
+ ld hl, BikeShopText_1d85c
+.asm_34d2d
+ call PrintText
+ jp TextScriptEnd
+
+BikeShopText_1d85c:
+ TX_FAR _BikeShopText_1d85c
+ db "@"
+
+BikeShopText_1d861:
+ TX_FAR _BikeShopText_1d861
+ db "@"
diff --git a/de/scripts/celadongamecorner.asm b/de/scripts/celadongamecorner.asm
new file mode 100755
index 00000000..00acd169
--- /dev/null
+++ b/de/scripts/celadongamecorner.asm
@@ -0,0 +1,527 @@
+CeladonGameCornerScript:
+ call CeladonGameCornerScript_48bcf
+ call CeladonGameCornerScript_48bec
+ call EnableAutoTextBoxDrawing
+ ld hl, CeladonGameCornerScriptPointers
+ ld a, [wCeladonGameCornerCurScript]
+ jp CallFunctionInTable
+
+CeladonGameCornerScript_48bcf:
+ ld hl, wCurrentMapScriptFlags
+ bit 6, [hl]
+ res 6, [hl]
+ ret z
+ call Random
+ ld a, [hRandomAdd]
+ cp $7
+ jr nc, .asm_48be2
+ ld a, $8
+.asm_48be2
+ srl a
+ srl a
+ srl a
+ ld [wLuckySlotHiddenObjectIndex], a
+ ret
+
+CeladonGameCornerScript_48bec:
+ ld hl, wCurrentMapScriptFlags
+ bit 5, [hl]
+ res 5, [hl]
+ ret z
+ CheckEvent EVENT_FOUND_ROCKET_HIDEOUT
+ ret nz
+ ld a, $2a
+ ld [wNewTileBlockID], a
+ lb bc, 2, 8
+ predef_jump ReplaceTileBlock
+
+CeladonGameCornerScript_48c07:
+ xor a
+ ld [wJoyIgnore], a
+ ld [wCeladonGameCornerCurScript], a
+ ld [wCurMapScript], a
+ ret
+
+CeladonGameCornerScriptPointers:
+ dw CeladonGameCornerScript0
+ dw CeladonGameCornerScript1
+ dw CeladonGameCornerScript2
+
+CeladonGameCornerScript0:
+ ret
+
+CeladonGameCornerScript1:
+ ld a, [wIsInBattle]
+ cp $ff
+ jp z, CeladonGameCornerScript_48c07
+ ld a, $f0
+ ld [wJoyIgnore], a
+ ld a, $d
+ ld [hSpriteIndexOrTextID], a
+ call DisplayTextID
+ ld a, $b
+ ld [H_SPRITEINDEX], a
+ call SetSpriteMovementBytesToFF
+ ld de, MovementData_48c5a
+ ld a, [wYCoord]
+ cp $6
+ jr nz, .asm_48c43
+ ld de, MovementData_48c63
+ jr .asm_48c4d
+.asm_48c43
+ ld a, [wXCoord]
+ cp $8
+ jr nz, .asm_48c4d
+ ld de, MovementData_48c63
+.asm_48c4d
+ ld a, $b
+ ld [H_SPRITEINDEX], a
+ call MoveSprite
+ ld a, $2
+ ld [wCeladonGameCornerCurScript], a
+ ret
+
+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 $FF
+
+MovementData_48c63:
+ db NPC_MOVEMENT_RIGHT
+ db NPC_MOVEMENT_RIGHT
+ db NPC_MOVEMENT_RIGHT
+ db NPC_MOVEMENT_RIGHT
+ db NPC_MOVEMENT_RIGHT
+ db $FF
+
+CeladonGameCornerScript2:
+ ld a, [wd730]
+ bit 0, a
+ ret nz
+ xor a
+ ld [wJoyIgnore], a
+ ld a, HS_GAME_CORNER_ROCKET
+ ld [wMissableObjectIndex], a
+ predef HideObject
+ ld hl, wCurrentMapScriptFlags
+ set 5, [hl]
+ set 6, [hl]
+ ld a, $0
+ ld [wCeladonGameCornerCurScript], a
+ ret
+
+CeladonGameCornerTextPointers:
+ 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
+
+CeladonGameCornerText1:
+ TX_FAR _CeladonGameCornerText1
+ db "@"
+
+CeladonGameCornerText2:
+ TX_ASM
+ call CeladonGameCornerScript_48f1e
+ ld hl, CeladonGameCornerText_48d22
+ call PrintText
+ call YesNoChoice
+ ld a, [wCurrentMenuItem]
+ and a
+ jr nz, .asm_48d0f
+ ld b,COIN_CASE
+ call IsItemInBag
+ jr z, .asm_48d19
+ call Has9990Coins
+ jr nc, .asm_48d14
+ xor a
+ ld [hMoney], a
+ ld [hMoney + 2], a
+ ld a, $10
+ ld [hMoney + 1], a
+ call HasEnoughMoney
+ jr nc, .asm_48cdb
+ ld hl, CeladonGameCornerText_48d31
+ jr .asm_48d1c
+.asm_48cdb
+ xor a
+ ld [hMoney], a
+ ld [hMoney + 2], a
+ ld a, $10
+ ld [hMoney + 1], a
+ ld hl, hMoney + 2
+ ld de, wPlayerMoney + 2
+ ld c, $3
+ predef SubBCDPredef
+ xor a
+ ld [hUnusedCoinsByte], a
+ ld [hCoins], a
+ ld a, $50
+ ld [hCoins + 1], a
+ ld de, wPlayerCoins + 1
+ ld hl, hCoins + 1
+ ld c, $2
+ predef AddBCDPredef
+ call CeladonGameCornerScript_48f1e
+ ld hl, CeladonGameCornerText_48d27
+ jr .asm_48d1c
+.asm_48d0f
+ ld hl, CeladonGameCornerText_48d2c
+ jr .asm_48d1c
+.asm_48d14
+ ld hl, CeladonGameCornerText_48d36
+ jr .asm_48d1c
+.asm_48d19
+ ld hl, CeladonGameCornerText_48d3b
+.asm_48d1c
+ call PrintText
+ jp TextScriptEnd
+
+CeladonGameCornerText_48d22:
+ TX_FAR _CeladonGameCornerText_48d22
+ db "@"
+
+CeladonGameCornerText_48d27:
+ TX_FAR _CeladonGameCornerText_48d27
+ db "@"
+
+CeladonGameCornerText_48d2c:
+ TX_FAR _CeladonGameCornerText_48d2c
+ db "@"
+
+CeladonGameCornerText_48d31:
+ TX_FAR _CeladonGameCornerText_48d31
+ db "@"
+
+CeladonGameCornerText_48d36:
+ TX_FAR _CeladonGameCornerText_48d36
+ db "@"
+
+CeladonGameCornerText_48d3b:
+ TX_FAR _CeladonGameCornerText_48d3b
+ db "@"
+
+CeladonGameCornerText3:
+ TX_FAR _CeladonGameCornerText3
+ db "@"
+
+CeladonGameCornerText4:
+ TX_FAR _CeladonGameCornerText4
+ db "@"
+
+CeladonGameCornerText5:
+ TX_ASM
+ CheckEvent EVENT_GOT_10_COINS
+ jr nz, .asm_48d89
+ ld hl, CeladonGameCornerText_48d9c
+ call PrintText
+ ld b, COIN_CASE
+ call IsItemInBag
+ jr z, .asm_48d93
+ call Has9990Coins
+ jr nc, .asm_48d8e
+ xor a
+ ld [hUnusedCoinsByte], a
+ ld [hCoins], a
+ ld a, $10
+ ld [hCoins + 1], a
+ ld de, wPlayerCoins + 1
+ ld hl, hCoins + 1
+ ld c, $2
+ predef AddBCDPredef
+ SetEvent EVENT_GOT_10_COINS
+ ld a, $1
+ ld [wDoNotWaitForButtonPressAfterDisplayingText], a
+ ld hl, Received10CoinsText
+ jr .asm_48d96
+.asm_48d89
+ ld hl, CeladonGameCornerText_48dac
+ jr .asm_48d96
+.asm_48d8e
+ ld hl, CeladonGameCornerText_48da7
+ jr .asm_48d96
+.asm_48d93
+ ld hl, CeladonGameCornerText_48f19
+.asm_48d96
+ call PrintText
+ jp TextScriptEnd
+
+CeladonGameCornerText_48d9c:
+ TX_FAR _CeladonGameCornerText_48d9c
+ db "@"
+
+Received10CoinsText:
+ TX_FAR _Received10CoinsText
+ TX_SFX_ITEM_1
+ db "@"
+
+CeladonGameCornerText_48da7:
+ TX_FAR _CeladonGameCornerText_48da7
+ db "@"
+
+CeladonGameCornerText_48dac:
+ TX_FAR _CeladonGameCornerText_48dac
+ db "@"
+
+CeladonGameCornerText6:
+ TX_FAR _CeladonGameCornerText6
+ db "@"
+
+CeladonGameCornerText7:
+ TX_ASM
+ CheckEvent EVENT_BEAT_ERIKA
+ ld hl, CeladonGameCornerText_48dca
+ jr z, .asm_48dc4
+ ld hl, CeladonGameCornerText_48dcf
+.asm_48dc4
+ call PrintText
+ jp TextScriptEnd
+
+CeladonGameCornerText_48dca:
+ TX_FAR _CeladonGameCornerText_48dca
+ db "@"
+
+CeladonGameCornerText_48dcf:
+ TX_FAR _CeladonGameCornerText_48dcf
+ db "@"
+
+CeladonGameCornerText8:
+ TX_FAR _CeladonGameCornerText8
+ db "@"
+
+CeladonGameCornerText9:
+ TX_ASM
+ CheckEvent EVENT_GOT_20_COINS_2
+ jr nz, .asm_48e13
+ ld hl, CeladonGameCornerText_48e26
+ call PrintText
+ ld b, COIN_CASE
+ call IsItemInBag
+ jr z, .asm_48e1d
+ call Has9990Coins
+ jr nc, .asm_48e18
+ xor a
+ ld [hUnusedCoinsByte], a
+ ld [hCoins], a
+ ld a, $20
+ ld [hCoins + 1], a
+ ld de, wPlayerCoins + 1
+ ld hl, hCoins + 1
+ ld c, $2
+ predef AddBCDPredef
+ SetEvent EVENT_GOT_20_COINS_2
+ ld hl, Received20CoinsText
+ jr .asm_48e20
+.asm_48e13
+ ld hl, CeladonGameCornerText_48e36
+ jr .asm_48e20
+.asm_48e18
+ ld hl, CeladonGameCornerText_48e31
+ jr .asm_48e20
+.asm_48e1d
+ ld hl, CeladonGameCornerText_48f19
+.asm_48e20
+ call PrintText
+ jp TextScriptEnd
+
+CeladonGameCornerText_48e26:
+ TX_FAR _CeladonGameCornerText_48e26
+ db "@"
+
+Received20CoinsText:
+ TX_FAR _Received20CoinsText
+ TX_SFX_ITEM_1
+ db "@"
+
+CeladonGameCornerText_48e31:
+ TX_FAR _CeladonGameCornerText_48e31
+ db "@"
+
+CeladonGameCornerText_48e36:
+ TX_FAR _CeladonGameCornerText_48e36
+ db "@"
+
+CeladonGameCornerText10:
+ TX_ASM
+ CheckEvent EVENT_GOT_20_COINS
+ jr nz, .asm_48e75
+ ld hl, CeladonGameCornerText_48e88
+ call PrintText
+ ld b,COIN_CASE
+ call IsItemInBag
+ jr z, .asm_48e7f
+ call Has9990Coins
+ jr z, .asm_48e7a
+ xor a
+ ld [hUnusedCoinsByte], a
+ ld [hCoins], a
+ ld a, $20
+ ld [hCoins + 1], a
+ ld de, wPlayerCoins + 1
+ ld hl, hCoins + 1
+ ld c, $2
+ predef AddBCDPredef
+ SetEvent EVENT_GOT_20_COINS
+ ld hl, CeladonGameCornerText_48e8d
+ jr .asm_48e82
+.asm_48e75
+ ld hl, CeladonGameCornerText_48e98
+ jr .asm_48e82
+.asm_48e7a
+ ld hl, CeladonGameCornerText_48e93
+ jr .asm_48e82
+.asm_48e7f
+ ld hl, CeladonGameCornerText_48f19
+.asm_48e82
+ call PrintText
+ jp TextScriptEnd
+
+CeladonGameCornerText_48e88:
+ TX_FAR _CeladonGameCornerText_48e88
+ db "@"
+
+CeladonGameCornerText_48e8d:
+ TX_FAR _CeladonGameCornerText_48e8d
+ TX_SFX_ITEM_1
+ db "@"
+
+CeladonGameCornerText_48e93:
+ TX_FAR _CeladonGameCornerText_48e93
+ db "@"
+
+CeladonGameCornerText_48e98:
+ TX_FAR _CeladonGameCornerText_48e98
+ db "@"
+
+CeladonGameCornerText11:
+ TX_ASM
+ ld hl, CeladonGameCornerText_48ece
+ call PrintText
+ ld hl, wd72d
+ set 6, [hl]
+ set 7, [hl]
+ ld hl, CeladonGameCornerText_48ed3
+ ld de, CeladonGameCornerText_48ed3
+ call SaveEndBattleTextPointers
+ ld a, [H_SPRITEINDEX]
+ ld [wSpriteIndex], a
+ call EngageMapTrainer
+ call InitBattleEnemyParameters
+ xor a
+ ld [hJoyHeld], a
+ ld [hJoyPressed], a
+ ld [hJoyReleased], a
+ ld a, $1
+ ld [wCeladonGameCornerCurScript], a
+ jp TextScriptEnd
+
+CeladonGameCornerText_48ece:
+ TX_FAR _CeladonGameCornerText_48ece
+ db "@"
+
+CeladonGameCornerText_48ed3:
+ TX_FAR _CeladonGameCornerText_48ed3
+ db "@"
+
+CeladonGameCornerText13:
+ TX_FAR _CeladonGameCornerText_48ed8
+ db "@"
+
+CeladonGameCornerText12:
+ TX_ASM
+ ld a, $1
+ ld [wDoNotWaitForButtonPressAfterDisplayingText], a
+ ld hl, CeladonGameCornerText_48f09
+ call PrintText
+ call WaitForSoundToFinish
+ ld a, SFX_GO_INSIDE
+ call PlaySound
+ call WaitForSoundToFinish
+ SetEvent EVENT_FOUND_ROCKET_HIDEOUT
+ ld a, $43
+ ld [wNewTileBlockID], a
+ lb bc, 2, 8
+ predef ReplaceTileBlock
+ jp TextScriptEnd
+
+CeladonGameCornerText_48f09:
+ TX_FAR _CeladonGameCornerText_48f09
+ TX_ASM
+ ld a, SFX_SWITCH
+ call PlaySound
+ call WaitForSoundToFinish
+ jp TextScriptEnd
+
+CeladonGameCornerText_48f19:
+ TX_FAR _CeladonGameCornerText_48f19
+ db "@"
+
+CeladonGameCornerScript_48f1e:
+ ld hl, wd730
+ set 6, [hl]
+ coord hl, 11, 0
+ ld b, $5
+ ld c, $7
+ call TextBoxBorder
+ call UpdateSprites
+ coord hl, 12, 1
+ ld b, 4
+ ld c, 7
+ call ClearScreenArea
+ coord hl, 12, 2
+ ld de, GameCornerMoneyText
+ call PlaceString
+ coord hl, 12, 3
+ ld de, GameCornerBlankText1
+ call PlaceString
+ coord hl, 12, 3
+ ld de, wPlayerMoney
+ ld c, "d"
+ call PrintBCDNumber
+ coord hl, 12, 4
+ ld de, GameCornerCoinText
+ call PlaceString
+ coord hl, 12, 5
+ ld de, GameCornerBlankText2
+ call PlaceString
+ coord hl, 15, 5
+ ld de, wPlayerCoins
+ ld c, "C"
+ call PrintBCDNumber
+ ld hl, wd730
+ res 6, [hl]
+ ret
+
+GameCornerMoneyText:
+ db "GELD@"
+
+GameCornerCoinText:
+ db "MÜNZEN@"
+
+GameCornerBlankText1:
+ db " @"
+
+GameCornerBlankText2:
+ db " @"
+
+Has9990Coins:
+ ld a, $99
+ ld [hCoins], a
+ ld a, $90
+ ld [hCoins + 1], a
+ jp HasEnoughCoins
diff --git a/de/scripts/celadongym.asm b/de/scripts/celadongym.asm
new file mode 100755
index 00000000..78506396
--- /dev/null
+++ b/de/scripts/celadongym.asm
@@ -0,0 +1,335 @@
+CeladonGymScript:
+ ld hl, wCurrentMapScriptFlags
+ bit 6, [hl]
+ res 6, [hl]
+ call nz, CeladonGymScript_48927
+ call EnableAutoTextBoxDrawing
+ ld hl, CeladonGymTrainerHeader0
+ ld de, CeladonGymScriptPointers
+ ld a, [wCeladonGymCurScript]
+ call ExecuteCurMapScriptInTable
+ ld [wCeladonGymCurScript], a
+ ret
+
+CeladonGymScript_48927:
+ ld hl, Gym4CityName
+ ld de, Gym4LeaderName
+ jp LoadGymLeaderAndCityName
+
+Gym4CityName:
+ db "PRISMANIA CITY@"
+
+Gym4LeaderName:
+ db "ERIKA@"
+
+CeladonGymText_48943:
+ xor a
+ ld [wJoyIgnore], a
+ ld [wCeladonGymCurScript], a
+ ld [wCurMapScript], a
+ ret
+
+CeladonGymScriptPointers:
+ dw CheckFightingMapTrainers
+ dw DisplayEnemyTrainerTextAndStartBattle
+ dw EndTrainerBattle
+ dw CeladonGymScript3
+
+CeladonGymScript3:
+ ld a, [wIsInBattle]
+ cp $ff
+ jp z, CeladonGymText_48943
+ ld a, $f0
+ ld [wJoyIgnore], a
+
+CeladonGymText_48963:
+ ld a, $9
+ ld [hSpriteIndexOrTextID], a
+ call DisplayTextID
+ SetEvent EVENT_BEAT_ERIKA
+ lb bc, TM_21, 1
+ call GiveItem
+ jr nc, .BagFull
+ ld a, $a
+ ld [hSpriteIndexOrTextID], a
+ call DisplayTextID
+ SetEvent EVENT_GOT_TM21
+ jr .asm_4898c
+.BagFull
+ ld a, $b
+ ld [hSpriteIndexOrTextID], a
+ call DisplayTextID
+.asm_4898c
+ ld hl, wObtainedBadges
+ set 3, [hl]
+ ld hl, wBeatGymFlags
+ set 3, [hl]
+
+ ; deactivate gym trainers
+ SetEventRange EVENT_BEAT_CELADON_GYM_TRAINER_0, EVENT_BEAT_CELADON_GYM_TRAINER_6
+
+ jp CeladonGymText_48943
+
+CeladonGymTextPointers:
+ dw CeladonGymText1
+ dw CeladonGymText2
+ dw CeladonGymText3
+ dw CeladonGymText4
+ dw CeladonGymText5
+ dw CeladonGymText6
+ dw CeladonGymText7
+ dw CeladonGymText8
+ dw CeladonGymText9
+ dw TM21Text
+ dw TM21NoRoomText
+
+CeladonGymTrainerHeader0:
+ dbEventFlagBit EVENT_BEAT_CELADON_GYM_TRAINER_0
+ db ($2 << 4) ; trainer's view range
+ dwEventFlagAddress EVENT_BEAT_CELADON_GYM_TRAINER_0
+ dw CeladonGymBattleText2 ; TextBeforeBattle
+ dw CeladonGymAfterBattleText2 ; TextAfterBattle
+ dw CeladonGymEndBattleText2 ; TextEndBattle
+ dw CeladonGymEndBattleText2 ; TextEndBattle
+
+CeladonGymTrainerHeader1:
+ dbEventFlagBit EVENT_BEAT_CELADON_GYM_TRAINER_1
+ db ($2 << 4) ; trainer's view range
+ dwEventFlagAddress EVENT_BEAT_CELADON_GYM_TRAINER_1
+ dw CeladonGymBattleText3 ; TextBeforeBattle
+ dw CeladonGymAfterBattleText3 ; TextAfterBattle
+ dw CeladonGymEndBattleText3 ; TextEndBattle
+ dw CeladonGymEndBattleText3 ; TextEndBattle
+
+CeladonGymTrainerHeader2:
+ dbEventFlagBit EVENT_BEAT_CELADON_GYM_TRAINER_2
+ db ($4 << 4) ; trainer's view range
+ dwEventFlagAddress EVENT_BEAT_CELADON_GYM_TRAINER_2
+ dw CeladonGymBattleText4 ; TextBeforeBattle
+ dw CeladonGymAfterBattleText4 ; TextAfterBattle
+ dw CeladonGymEndBattleText4 ; TextEndBattle
+ dw CeladonGymEndBattleText4 ; TextEndBattle
+
+CeladonGymTrainerHeader3:
+ dbEventFlagBit EVENT_BEAT_CELADON_GYM_TRAINER_3
+ db ($4 << 4) ; trainer's view range
+ dwEventFlagAddress EVENT_BEAT_CELADON_GYM_TRAINER_3
+ dw CeladonGymBattleText5 ; TextBeforeBattle
+ dw CeladonGymAfterBattleText5 ; TextAfterBattle
+ dw CeladonGymEndBattleText5 ; TextEndBattle
+ dw CeladonGymEndBattleText5 ; TextEndBattle
+
+CeladonGymTrainerHeader4:
+ dbEventFlagBit EVENT_BEAT_CELADON_GYM_TRAINER_4
+ db ($2 << 4) ; trainer's view range
+ dwEventFlagAddress EVENT_BEAT_CELADON_GYM_TRAINER_4
+ dw CeladonGymBattleText6 ; TextBeforeBattle
+ dw CeladonGymAfterBattleText6 ; TextAfterBattle
+ dw CeladonGymEndBattleText6 ; TextEndBattle
+ dw CeladonGymEndBattleText6 ; TextEndBattle
+
+CeladonGymTrainerHeader5:
+ dbEventFlagBit EVENT_BEAT_CELADON_GYM_TRAINER_5
+ db ($2 << 4) ; trainer's view range
+ dwEventFlagAddress EVENT_BEAT_CELADON_GYM_TRAINER_5
+ dw CeladonGymBattleText7 ; TextBeforeBattle
+ dw CeladonGymAfterBattleText7 ; TextAfterBattle
+ dw CeladonGymEndBattleText7 ; TextEndBattle
+ dw CeladonGymEndBattleText7 ; TextEndBattle
+
+CeladonGymTrainerHeader6:
+ dbEventFlagBit EVENT_BEAT_CELADON_GYM_TRAINER_6, 1
+ db ($3 << 4) ; trainer's view range
+ dwEventFlagAddress EVENT_BEAT_CELADON_GYM_TRAINER_6, 1
+ dw CeladonGymBattleText8 ; TextBeforeBattle
+ dw CeladonGymAfterBattleText8 ; TextAfterBattle
+ dw CeladonGymEndBattleText8 ; TextEndBattle
+ dw CeladonGymEndBattleText8 ; TextEndBattle
+
+ db $ff
+
+CeladonGymText1:
+ TX_ASM
+ CheckEvent EVENT_BEAT_ERIKA
+ jr z, .asm_48a2d
+ CheckEventReuseA EVENT_GOT_TM21
+ jr nz, .asm_48a25
+ call z, CeladonGymText_48963
+ call DisableWaitingAfterTextDisplay
+ jr .asm_48a5b
+.asm_48a25
+ ld hl, CeladonGymText_48a68
+ call PrintText
+ jr .asm_48a5b
+.asm_48a2d
+ ld hl, CeladonGymText_48a5e
+ call PrintText
+ ld hl, wd72d
+ set 6, [hl]
+ set 7, [hl]
+ ld hl, CeladonGymText_48a63
+ ld de, CeladonGymText_48a63
+ call SaveEndBattleTextPointers
+ ld a, [H_SPRITEINDEX]
+ ld [wSpriteIndex], a
+ call EngageMapTrainer
+ call InitBattleEnemyParameters
+ ld a, $4
+ ld [wGymLeaderNo], a
+ ld a, $3
+ ld [wCeladonGymCurScript], a
+ ld [wCurMapScript], a
+.asm_48a5b
+ jp TextScriptEnd
+
+CeladonGymText_48a5e:
+ TX_FAR _CeladonGymText_48a5e
+ db "@"
+
+CeladonGymText_48a63:
+ TX_FAR _CeladonGymText_48a63
+ db "@"
+
+CeladonGymText_48a68:
+ TX_FAR _CeladonGymText_48a68
+ db "@"
+
+CeladonGymText9:
+ TX_FAR _CeladonGymText9
+ db "@"
+
+TM21Text:
+ TX_FAR _ReceivedTM21Text
+ TX_SFX_ITEM_1
+ TX_FAR _TM21ExplanationText
+ db "@"
+
+TM21NoRoomText:
+ TX_FAR _TM21NoRoomText
+ db "@"
+
+CeladonGymText2:
+ TX_ASM
+ ld hl, CeladonGymTrainerHeader0
+ call TalkToTrainer
+ jp TextScriptEnd
+
+CeladonGymBattleText2:
+ TX_FAR _CeladonGymBattleText2
+ db "@"
+
+CeladonGymEndBattleText2:
+ TX_FAR _CeladonGymEndBattleText2
+ db "@"
+
+CeladonGymAfterBattleText2:
+ TX_FAR _CeladonGymAfterBattleText2
+ db "@"
+
+CeladonGymText3:
+ TX_ASM
+ ld hl, CeladonGymTrainerHeader1
+ call TalkToTrainer
+ jp TextScriptEnd
+
+CeladonGymBattleText3:
+ TX_FAR _CeladonGymBattleText3
+ db "@"
+
+CeladonGymEndBattleText3:
+ TX_FAR _CeladonGymEndBattleText3
+ db "@"
+
+CeladonGymAfterBattleText3:
+ TX_FAR _CeladonGymAfterBattleText3
+ db "@"
+
+CeladonGymText4:
+ TX_ASM
+ ld hl, CeladonGymTrainerHeader2
+ call TalkToTrainer
+ jp TextScriptEnd
+
+CeladonGymBattleText4:
+ TX_FAR _CeladonGymBattleText4
+ db "@"
+
+CeladonGymEndBattleText4:
+ TX_FAR _CeladonGymEndBattleText4
+ db "@"
+
+CeladonGymAfterBattleText4:
+ TX_FAR _CeladonGymAfterBattleText4
+ db "@"
+
+CeladonGymText5:
+ TX_ASM
+ ld hl, CeladonGymTrainerHeader3
+ call TalkToTrainer
+ jp TextScriptEnd
+
+CeladonGymBattleText5:
+ TX_FAR _CeladonGymBattleText5
+ db "@"
+
+CeladonGymEndBattleText5:
+ TX_FAR _CeladonGymEndBattleText5
+ db "@"
+
+CeladonGymAfterBattleText5:
+ TX_FAR _CeladonGymAfterBattleText5
+ db "@"
+
+CeladonGymText6:
+ TX_ASM
+ ld hl, CeladonGymTrainerHeader4
+ call TalkToTrainer
+ jp TextScriptEnd
+
+CeladonGymBattleText6:
+ TX_FAR _CeladonGymBattleText6
+ db "@"
+
+CeladonGymEndBattleText6:
+ TX_FAR _CeladonGymEndBattleText6
+ db "@"
+
+CeladonGymAfterBattleText6:
+ TX_FAR _CeladonGymAfterBattleText6
+ db "@"
+
+CeladonGymText7:
+ TX_ASM
+ ld hl, CeladonGymTrainerHeader5
+ call TalkToTrainer
+ jp TextScriptEnd
+
+CeladonGymBattleText7:
+ TX_FAR _CeladonGymBattleText7
+ db "@"
+
+CeladonGymEndBattleText7:
+ TX_FAR _CeladonGymEndBattleText7
+ db "@"
+
+CeladonGymAfterBattleText7:
+ TX_FAR _CeladonGymAfterBattleText7
+ db "@"
+
+CeladonGymText8:
+ TX_ASM
+ ld hl, CeladonGymTrainerHeader6
+ call TalkToTrainer
+ jp TextScriptEnd
+
+CeladonGymBattleText8:
+ TX_FAR _CeladonGymBattleText8
+ db "@"
+
+CeladonGymEndBattleText8:
+ TX_FAR _CeladonGymEndBattleText8
+ db "@"
+
+CeladonGymAfterBattleText8:
+ TX_FAR _CeladonGymAfterBattleText8
+ db "@"
diff --git a/de/scripts/ceruleangym.asm b/de/scripts/ceruleangym.asm
new file mode 100755
index 00000000..a1e772ef
--- /dev/null
+++ b/de/scripts/ceruleangym.asm
@@ -0,0 +1,219 @@
+CeruleanGymScript:
+ ld hl, wCurrentMapScriptFlags
+ bit 6, [hl]
+ res 6, [hl]
+ call nz, CeruleanGymScript_5c6d0
+ call EnableAutoTextBoxDrawing
+ ld hl, CeruleanGymTrainerHeader0
+ ld de, CeruleanGymScriptPointers
+ ld a, [wCeruleanGymCurScript]
+ call ExecuteCurMapScriptInTable
+ ld [wCeruleanGymCurScript], a
+ ret
+
+CeruleanGymScript_5c6d0:
+ ld hl, Gym2CityName
+ ld de, Gym2LeaderName
+ jp LoadGymLeaderAndCityName
+
+Gym2CityName:
+ db "AZURIA CITY@"
+
+Gym2LeaderName:
+ db "MISTY@"
+
+CeruleanGymScript_5c6ed:
+ xor a
+ ld [wJoyIgnore], a
+ ld [wCeruleanGymCurScript], a
+ ld [wCurMapScript], a
+ ret
+
+CeruleanGymScriptPointers:
+ dw CheckFightingMapTrainers
+ dw DisplayEnemyTrainerTextAndStartBattle
+ dw EndTrainerBattle
+ dw CeruleanGymScript3
+
+CeruleanGymScript3:
+ ld a, [wIsInBattle]
+ cp $ff
+ jp z, CeruleanGymScript_5c6ed
+ ld a, $f0
+ ld [wJoyIgnore], a
+
+CeruleanGymScript_5c70d:
+ ld a, $5
+ ld [hSpriteIndexOrTextID], a
+ call DisplayTextID
+ SetEvent EVENT_BEAT_MISTY
+ lb bc, TM_11, 1
+ call GiveItem
+ jr nc, .BagFull
+ ld a, $6
+ ld [hSpriteIndexOrTextID], a
+ call DisplayTextID
+ SetEvent EVENT_GOT_TM11
+ jr .asm_5c736
+.BagFull
+ ld a, $7
+ ld [hSpriteIndexOrTextID], a
+ call DisplayTextID
+.asm_5c736
+ ld hl, wObtainedBadges
+ set 1, [hl]
+ ld hl, wBeatGymFlags
+ set 1, [hl]
+
+ ; deactivate gym trainers
+ SetEvents EVENT_BEAT_CERULEAN_GYM_TRAINER_0, EVENT_BEAT_CERULEAN_GYM_TRAINER_1
+
+ jp CeruleanGymScript_5c6ed
+
+CeruleanGymTextPointers:
+ dw CeruleanGymText1
+ dw CeruleanGymText2
+ dw CeruleanGymText3
+ dw CeruleanGymText4
+ dw CeruleanGymText5
+ dw CeruleanGymText6
+ dw CeruleanGymText7
+
+CeruleanGymTrainerHeader0:
+ dbEventFlagBit EVENT_BEAT_CERULEAN_GYM_TRAINER_0
+ db ($3 << 4) ; trainer's view range
+ dwEventFlagAddress EVENT_BEAT_CERULEAN_GYM_TRAINER_0
+ dw CeruleanGymBattleText1 ; TextBeforeBattle
+ dw CeruleanGymAfterBattleText1 ; TextAfterBattle
+ dw CeruleanGymEndBattleText1 ; TextEndBattle
+ dw CeruleanGymEndBattleText1 ; TextEndBattle
+
+CeruleanGymTrainerHeader1:
+ dbEventFlagBit EVENT_BEAT_CERULEAN_GYM_TRAINER_1
+ db ($3 << 4) ; trainer's view range
+ dwEventFlagAddress EVENT_BEAT_CERULEAN_GYM_TRAINER_1
+ dw CeruleanGymBattleText2 ; TextBeforeBattle
+ dw CeruleanGymAfterBattleText2 ; TextAfterBattle
+ dw CeruleanGymEndBattleText2 ; TextEndBattle
+ dw CeruleanGymEndBattleText2 ; TextEndBattle
+
+ db $ff
+
+CeruleanGymText1:
+ TX_ASM
+ CheckEvent EVENT_BEAT_MISTY
+ jr z, .asm_5c78d
+ CheckEventReuseA EVENT_GOT_TM11
+ jr nz, .asm_5c785
+ call z, CeruleanGymScript_5c70d
+ call DisableWaitingAfterTextDisplay
+ jr .asm_5c7bb
+.asm_5c785
+ ld hl, CeruleanGymText_5c7c3
+ call PrintText
+ jr .asm_5c7bb
+.asm_5c78d
+ ld hl, CeruleanGymText_5c7be
+ call PrintText
+ ld hl, wd72d
+ set 6, [hl]
+ set 7, [hl]
+ ld hl, CeruleanGymText_5c7d8
+ ld de, CeruleanGymText_5c7d8
+ call SaveEndBattleTextPointers
+ ld a, [H_SPRITEINDEX]
+ ld [wSpriteIndex], a
+ call EngageMapTrainer
+ call InitBattleEnemyParameters
+ ld a, $2
+ ld [wGymLeaderNo], a
+ xor a
+ ld [hJoyHeld], a
+ ld a, $3
+ ld [wCeruleanGymCurScript], a
+.asm_5c7bb
+ jp TextScriptEnd
+
+CeruleanGymText_5c7be:
+ TX_FAR _CeruleanGymText_5c7be
+ db "@"
+
+CeruleanGymText_5c7c3:
+ TX_FAR _CeruleanGymText_5c7c3
+ db "@"
+
+CeruleanGymText5:
+ TX_FAR _CeruleanGymText_5c7c8
+ db "@"
+
+CeruleanGymText6:
+ TX_FAR _ReceivedTM11Text
+ TX_SFX_ITEM_1
+ db "@"
+
+CeruleanGymText7:
+ TX_FAR _CeruleanGymText_5c7d3
+ db "@"
+
+CeruleanGymText_5c7d8:
+ TX_FAR _CeruleanGymText_5c7d8
+ TX_SFX_KEY_ITEM ; actually plays the second channel of SFX_BALL_POOF due to the wrong music bank being loaded
+ TX_BLINK
+ db "@"
+
+CeruleanGymText2:
+ TX_ASM
+ ld hl, CeruleanGymTrainerHeader0
+ call TalkToTrainer
+ jp TextScriptEnd
+
+CeruleanGymBattleText1:
+ TX_FAR _CeruleanGymBattleText1
+ db "@"
+
+CeruleanGymEndBattleText1:
+ TX_FAR _CeruleanGymEndBattleText1
+ db "@"
+
+CeruleanGymAfterBattleText1:
+ TX_FAR _CeruleanGymAfterBattleText1
+ db "@"
+
+CeruleanGymText3:
+ TX_ASM
+ ld hl, CeruleanGymTrainerHeader1
+ call TalkToTrainer
+ jp TextScriptEnd
+
+CeruleanGymBattleText2:
+ TX_FAR _CeruleanGymBattleText2
+ db "@"
+
+CeruleanGymEndBattleText2:
+ TX_FAR _CeruleanGymEndBattleText2
+ db "@"
+
+CeruleanGymAfterBattleText2:
+ TX_FAR _CeruleanGymAfterBattleText2
+ db "@"
+
+CeruleanGymText4:
+ TX_ASM
+ CheckEvent EVENT_BEAT_MISTY
+ jr nz, .asm_5c821
+ ld hl, CeruleanGymText_5c82a
+ call PrintText
+ jr .asm_5c827
+.asm_5c821
+ ld hl, CeruleanGymText_5c82f
+ call PrintText
+.asm_5c827
+ jp TextScriptEnd
+
+CeruleanGymText_5c82a:
+ TX_FAR _CeruleanGymText_5c82a
+ db "@"
+
+CeruleanGymText_5c82f:
+ TX_FAR _CeruleanGymText_5c82f
+ db "@"
diff --git a/de/scripts/cinnabargym.asm b/de/scripts/cinnabargym.asm
new file mode 100755
index 00000000..f1b8d31b
--- /dev/null
+++ b/de/scripts/cinnabargym.asm
@@ -0,0 +1,472 @@
+CinnabarGymScript:
+ call CinnabarGymScript_75759
+ call EnableAutoTextBoxDrawing
+ ld hl, CinnabarGymScriptPointers
+ ld a, [wCinnabarGymCurScript]
+ jp CallFunctionInTable
+
+CinnabarGymScript_75759:
+ ld hl, wCurrentMapScriptFlags
+ bit 6, [hl]
+ res 6, [hl]
+ push hl
+ call nz, CinnabarGymScript_75772
+ pop hl
+ bit 5, [hl]
+ res 5, [hl]
+ call nz, UpdateCinnabarGymGateTileBlocks
+ ResetEvent EVENT_2A7
+ ret
+CinnabarGymScript_75772:
+ ld hl, Gym7CityName
+ ld de, Gym7LeaderName
+ jp LoadGymLeaderAndCityName
+
+Gym7CityName:
+ db "ZINNOBERINSEL@"
+Gym7LeaderName:
+ db "PYRO@"
+
+CinnabarGymScript_75792:
+ xor a
+ ld [wJoyIgnore], a
+ ld [wCinnabarGymCurScript], a
+ ld [wCurMapScript], a
+ ld [wOpponentAfterWrongAnswer], a
+ ret
+
+CinnabarGymScript_757a0:
+ ld a, [hSpriteIndexOrTextID]
+ ld [wTrainerHeaderFlagBit], a
+ ret
+
+CinnabarGymScriptPointers:
+ dw CinnabarGymScript0
+ dw CinnabarGymScript1
+ dw CinnabarGymScript2
+ dw CinnabarGymScript3
+
+CinnabarGymScript0:
+ ld a, [wOpponentAfterWrongAnswer]
+ and a
+ ret z
+ ld [H_SPRITEINDEX], a
+ cp $4
+ jr nz, .asm_757c3
+ ld a, PLAYER_DIR_DOWN
+ ld [wPlayerMovingDirection], a
+ ld de, MovementData_757d7
+ jr .asm_757cb
+.asm_757c3
+ ld de, MovementData_757da
+ ld a, PLAYER_DIR_RIGHT
+ ld [wPlayerMovingDirection], a
+.asm_757cb
+ call MoveSprite
+ ld a, $1
+ ld [wCinnabarGymCurScript], a
+ ld [wCurMapScript], a
+ ret
+
+MovementData_757d7:
+ db NPC_MOVEMENT_LEFT
+ db NPC_MOVEMENT_UP
+ db $FF
+
+MovementData_757da:
+ db NPC_MOVEMENT_LEFT
+ db $FF
+
+CinnabarGymScript1:
+ ld a, [wd730]
+ bit 0, a
+ ret nz
+ xor a
+ ld [wJoyIgnore], a
+ ld a, [wOpponentAfterWrongAnswer]
+ ld [wTrainerHeaderFlagBit], a
+ ld [hSpriteIndexOrTextID], a
+ jp DisplayTextID
+
+CinnabarGymFlagAction:
+ predef_jump FlagActionPredef
+
+CinnabarGymScript2:
+ ld a, [wIsInBattle]
+ cp $ff
+ jp z, CinnabarGymScript_75792
+ ld a, [wTrainerHeaderFlagBit]
+ ld [$ffdb], a
+ AdjustEventBit EVENT_BEAT_CINNABAR_GYM_TRAINER_0, 2
+ ld c, a
+ ld b, FLAG_TEST
+ EventFlagAddress hl, EVENT_BEAT_CINNABAR_GYM_TRAINER_0
+ call CinnabarGymFlagAction
+ ld a, c
+ and a
+ jr nz, .asm_7581b
+ call WaitForSoundToFinish
+ ld a, SFX_GO_INSIDE
+ call PlaySound
+ call WaitForSoundToFinish
+.asm_7581b
+ ld a, [wTrainerHeaderFlagBit]
+ ld [$ffdb], a
+ AdjustEventBit EVENT_BEAT_CINNABAR_GYM_TRAINER_0, 2
+ ld c, a
+ ld b, FLAG_SET
+ EventFlagAddress hl, EVENT_BEAT_CINNABAR_GYM_TRAINER_0
+ call CinnabarGymFlagAction
+ ld a, [wTrainerHeaderFlagBit]
+ sub $2
+ AdjustEventBit EVENT_CINNABAR_GYM_GATE0_UNLOCKED, 0
+ ld c, a
+ ld b, FLAG_SET
+ EventFlagAddress hl, EVENT_CINNABAR_GYM_GATE0_UNLOCKED
+ call CinnabarGymFlagAction
+ call UpdateCinnabarGymGateTileBlocks
+ xor a
+ ld [wJoyIgnore], a
+ ld [wOpponentAfterWrongAnswer], a
+ ld a, $0
+ ld [wCinnabarGymCurScript], a
+ ld [wCurMapScript], a
+ ret
+
+CinnabarGymScript3:
+ ld a, [wIsInBattle]
+ cp $ff
+ jp z, CinnabarGymScript_75792
+ ld a, $f0
+ ld [wJoyIgnore], a
+CinnabarGymScript3_75857:
+ ld a, $a
+ ld [hSpriteIndexOrTextID], a
+ call DisplayTextID
+ SetEvent EVENT_BEAT_BLAINE
+ lb bc, TM_38, 1
+ call GiveItem
+ jr nc, .BagFull
+ ld a, $b
+ ld [hSpriteIndexOrTextID], a
+ call DisplayTextID
+ SetEvent EVENT_GOT_TM38
+ jr .asm_75880
+.BagFull
+ ld a, $c
+ ld [hSpriteIndexOrTextID], a
+ call DisplayTextID
+.asm_75880
+ ld hl, wObtainedBadges
+ set 6, [hl]
+ ld hl, wBeatGymFlags
+ set 6, [hl]
+
+ ; deactivate gym trainers
+ SetEventRange EVENT_BEAT_CINNABAR_GYM_TRAINER_0, EVENT_BEAT_CINNABAR_GYM_TRAINER_6
+
+ ld hl, wCurrentMapScriptFlags
+ set 5, [hl]
+
+ jp CinnabarGymScript_75792
+
+CinnabarGymTextPointers:
+ dw CinnabarGymText1
+ dw CinnabarGymText2
+ dw CinnabarGymText3
+ dw CinnabarGymText4
+ dw CinnabarGymText5
+ dw CinnabarGymText6
+ dw CinnabarGymText7
+ dw CinnabarGymText8
+ dw CinnabarGymText9
+ dw BlaineBadgeText
+ dw ReceivedTM38Text
+ dw TM38NoRoomText
+
+CinnabarGymScript_758b7:
+ ld a, [hSpriteIndexOrTextID]
+ ld [wSpriteIndex], a
+ call EngageMapTrainer
+ call InitBattleEnemyParameters
+ ld hl, wd72d
+ set 6, [hl]
+ set 7, [hl]
+ ld a, [wSpriteIndex]
+ cp $1
+ jr z, .asm_758d4
+ ld a, $2
+ jr .asm_758d6
+.asm_758d4
+ ld a, $3
+.asm_758d6
+ ld [wCinnabarGymCurScript], a
+ ld [wCurMapScript], a
+ jp TextScriptEnd
+
+CinnabarGymText1:
+ TX_ASM
+ CheckEvent EVENT_BEAT_BLAINE
+ jr z, .asm_d9332
+ CheckEventReuseA EVENT_GOT_TM38
+ jr nz, .asm_3012f
+ call z, CinnabarGymScript3_75857
+ call DisableWaitingAfterTextDisplay
+ jp TextScriptEnd
+.asm_3012f
+ ld hl, BlaineFireBlastText
+ call PrintText
+ jp TextScriptEnd
+.asm_d9332
+ ld hl, BlaineBattleText
+ call PrintText
+ ld hl, BlaineEndBattleText
+ ld de, BlaineEndBattleText
+ call SaveEndBattleTextPointers
+ ld a, $7
+ ld [wGymLeaderNo], a
+ jp CinnabarGymScript_758b7
+
+BlaineBattleText:
+ TX_FAR _BlaineBattleText
+ db "@"
+
+BlaineEndBattleText:
+ TX_FAR _BlaineEndBattleText
+ TX_SFX_KEY_ITEM ; actually plays the second channel of SFX_BALL_POOF due to the wrong music bank being loaded
+ TX_WAIT
+ db "@"
+
+BlaineFireBlastText:
+ TX_FAR _BlaineFireBlastText
+ db "@"
+
+BlaineBadgeText:
+ TX_FAR _BlaineBadgeText
+ db "@"
+
+ReceivedTM38Text:
+ TX_FAR _ReceivedTM38Text
+ TX_SFX_ITEM_1
+ TX_FAR _TM38ExplanationText
+ db "@"
+
+TM38NoRoomText:
+ TX_FAR _TM38NoRoomText
+ db "@"
+
+CinnabarGymText2:
+ TX_ASM
+ call CinnabarGymScript_757a0
+ CheckEvent EVENT_BEAT_CINNABAR_GYM_TRAINER_0
+ jr nz, .asm_46bb4
+ ld hl, CinnabarGymText_7595f
+ call PrintText
+ ld hl, CinnabarGymText_75964
+ ld de, CinnabarGymText_75964
+ call SaveEndBattleTextPointers
+ jp CinnabarGymScript_758b7
+.asm_46bb4
+ ld hl, CinnabarGymText_75969
+ call PrintText
+ jp TextScriptEnd
+
+CinnabarGymText_7595f:
+ TX_FAR _CinnabarGymText_7595f
+ db "@"
+
+CinnabarGymText_75964:
+ TX_FAR _CinnabarGymText_75964
+ db "@"
+
+CinnabarGymText_75969:
+ TX_FAR _CinnabarGymText_75969
+ db "@"
+
+CinnabarGymText3:
+ TX_ASM
+ call CinnabarGymScript_757a0
+ CheckEvent EVENT_BEAT_CINNABAR_GYM_TRAINER_1
+ jr nz, .asm_4b406
+ ld hl, CinnabarGymText_75994
+ call PrintText
+ ld hl, CinnabarGymText_75999
+ ld de, CinnabarGymText_75999
+ call SaveEndBattleTextPointers
+ jp CinnabarGymScript_758b7
+.asm_4b406
+ ld hl, CinnabarGymText_7599e
+ call PrintText
+ jp TextScriptEnd
+
+CinnabarGymText_75994:
+ TX_FAR _CinnabarGymText_75994
+ db "@"
+
+CinnabarGymText_75999:
+ TX_FAR _CinnabarGymText_75999
+ db "@"
+
+CinnabarGymText_7599e:
+ TX_FAR _CinnabarGymText_7599e
+ db "@"
+
+CinnabarGymText4:
+ TX_ASM
+ call CinnabarGymScript_757a0
+ CheckEvent EVENT_BEAT_CINNABAR_GYM_TRAINER_2
+ jr nz, .asm_c0673
+ ld hl, CinnabarGymText_759c9
+ call PrintText
+ ld hl, CinnabarGymText_759ce
+ ld de, CinnabarGymText_759ce
+ call SaveEndBattleTextPointers
+ jp CinnabarGymScript_758b7
+.asm_c0673
+ ld hl, CinnabarGymText_759d3
+ call PrintText
+ jp TextScriptEnd
+
+CinnabarGymText_759c9:
+ TX_FAR _CinnabarGymText_759c9
+ db "@"
+
+CinnabarGymText_759ce:
+ TX_FAR _CinnabarGymText_759ce
+ db "@"
+
+CinnabarGymText_759d3:
+ TX_FAR _CinnabarGymText_759d3
+ db "@"
+
+CinnabarGymText5:
+ TX_ASM
+ call CinnabarGymScript_757a0
+ CheckEvent EVENT_BEAT_CINNABAR_GYM_TRAINER_3
+ jr nz, .asm_5cfd7
+ ld hl, CinnabarGymText_759fe
+ call PrintText
+ ld hl, CinnabarGymText_75a03
+ ld de, CinnabarGymText_75a03
+ call SaveEndBattleTextPointers
+ jp CinnabarGymScript_758b7
+.asm_5cfd7
+ ld hl, CinnabarGymText_75a08
+ call PrintText
+ jp TextScriptEnd
+
+CinnabarGymText_759fe:
+ TX_FAR _CinnabarGymText_759fe
+ db "@"
+
+CinnabarGymText_75a03:
+ TX_FAR _CinnabarGymText_75a03
+ db "@"
+
+CinnabarGymText_75a08:
+ TX_FAR _CinnabarGymText_75a08
+ db "@"
+
+CinnabarGymText6:
+ TX_ASM
+ call CinnabarGymScript_757a0
+ CheckEvent EVENT_BEAT_CINNABAR_GYM_TRAINER_4
+ jr nz, .asm_776b4
+ ld hl, CinnabarGymText_75a33
+ call PrintText
+ ld hl, CinnabarGymText_75a38
+ ld de, CinnabarGymText_75a38
+ call SaveEndBattleTextPointers
+ jp CinnabarGymScript_758b7
+.asm_776b4
+ ld hl, CinnabarGymText_75a3d
+ call PrintText
+ jp TextScriptEnd
+
+CinnabarGymText_75a33:
+ TX_FAR _CinnabarGymText_75a33
+ db "@"
+
+CinnabarGymText_75a38:
+ TX_FAR _CinnabarGymText_75a38
+ db "@"
+
+CinnabarGymText_75a3d:
+ TX_FAR _CinnabarGymText_75a3d
+ db "@"
+
+CinnabarGymText7:
+ TX_ASM
+ call CinnabarGymScript_757a0
+ CheckEvent EVENT_BEAT_CINNABAR_GYM_TRAINER_5
+ jr nz, .asm_2f755
+ ld hl, CinnabarGymText_75a68
+ call PrintText
+ ld hl, CinnabarGymText_75a6d
+ ld de, CinnabarGymText_75a6d
+ call SaveEndBattleTextPointers
+ jp CinnabarGymScript_758b7
+.asm_2f755
+ ld hl, CinnabarGymText_75a72
+ call PrintText
+ jp TextScriptEnd
+
+CinnabarGymText_75a68:
+ TX_FAR _CinnabarGymText_75a68
+ db "@"
+
+CinnabarGymText_75a6d:
+ TX_FAR _CinnabarGymText_75a6d
+ db "@"
+
+CinnabarGymText_75a72:
+ TX_FAR _CinnabarGymText_75a72
+ db "@"
+
+CinnabarGymText8:
+ TX_ASM
+ call CinnabarGymScript_757a0
+ CheckEvent EVENT_BEAT_CINNABAR_GYM_TRAINER_6
+ jr nz, .asm_d87be
+ ld hl, CinnabarGymText_75a9d
+ call PrintText
+ ld hl, CinnabarGymText_75aa2
+ ld de, CinnabarGymText_75aa2
+ call SaveEndBattleTextPointers
+ jp CinnabarGymScript_758b7
+.asm_d87be
+ ld hl, CinnabarGymText_75aa7
+ call PrintText
+ jp TextScriptEnd
+
+CinnabarGymText_75a9d:
+ TX_FAR _CinnabarGymText_75a9d
+ db "@"
+
+CinnabarGymText_75aa2:
+ TX_FAR _CinnabarGymText_75aa2
+ db "@"
+
+CinnabarGymText_75aa7:
+ TX_FAR _CinnabarGymText_75aa7
+ db "@"
+
+CinnabarGymText9:
+ TX_ASM
+ CheckEvent EVENT_BEAT_BLAINE
+ jr nz, .asm_627d9
+ ld hl, CinnabarGymText_75ac2
+ jr .asm_0b11d
+.asm_627d9
+ ld hl, CinnabarGymText_75ac7
+.asm_0b11d
+ call PrintText
+ jp TextScriptEnd
+
+CinnabarGymText_75ac2:
+ TX_FAR _CinnabarGymText_75ac2
+ db "@"
+
+CinnabarGymText_75ac7:
+ TX_FAR _CinnabarGymText_75ac7
+ db "@"
diff --git a/de/scripts/fuchsiagym.asm b/de/scripts/fuchsiagym.asm
new file mode 100755
index 00000000..77760a02
--- /dev/null
+++ b/de/scripts/fuchsiagym.asm
@@ -0,0 +1,329 @@
+FuchsiaGymScript:
+ call FuchsiaGymScript_75453
+ call EnableAutoTextBoxDrawing
+ ld hl, FuchsiaGymTrainerHeader0
+ ld de, FuchsiaGymScriptPointers
+ ld a, [wFuchsiaGymCurScript]
+ call ExecuteCurMapScriptInTable
+ ld [wFuchsiaGymCurScript], a
+ ret
+
+FuchsiaGymScript_75453:
+ ld hl, wCurrentMapScriptFlags
+ bit 6, [hl]
+ res 6, [hl]
+ ret z
+ ld hl, Gym5CityName
+ ld de, Gym5LeaderName
+ call LoadGymLeaderAndCityName
+ ret
+
+Gym5CityName:
+ db "FUCHSANIA CITY@"
+Gym5LeaderName:
+ db "KOGA@"
+
+FuchsiaGymScript_75477:
+ xor a
+ ld [wJoyIgnore], a
+ ld [wFuchsiaGymCurScript], a
+ ld [wCurMapScript], a
+ ret
+
+FuchsiaGymScriptPointers:
+ dw CheckFightingMapTrainers
+ dw DisplayEnemyTrainerTextAndStartBattle
+ dw EndTrainerBattle
+ dw FuchsiaGymScript3
+
+FuchsiaGymScript3:
+ ld a, [wIsInBattle]
+ cp $ff
+ jp z, FuchsiaGymScript_75477
+ ld a, $f0
+ ld [wJoyIgnore], a
+FuchsiaGymScript3_75497:
+ ld a, $9
+ ld [hSpriteIndexOrTextID], a
+ call DisplayTextID
+ SetEvent EVENT_BEAT_KOGA
+ lb bc, TM_06, 1
+ call GiveItem
+ jr nc, .BagFull
+ ld a, $a
+ ld [hSpriteIndexOrTextID], a
+ call DisplayTextID
+ SetEvent EVENT_GOT_TM06
+ jr .asm_754c0
+.BagFull
+ ld a, $b
+ ld [hSpriteIndexOrTextID], a
+ call DisplayTextID
+.asm_754c0
+ ld hl, wObtainedBadges
+ set 4, [hl]
+ ld hl, wBeatGymFlags
+ set 4, [hl]
+
+ ; deactivate gym trainers
+ SetEventRange EVENT_BEAT_FUCHSIA_GYM_TRAINER_0, EVENT_BEAT_FUCHSIA_GYM_TRAINER_5
+
+ jp FuchsiaGymScript_75477
+
+FuchsiaGymTextPointers:
+ dw FuchsiaGymText1
+ dw FuchsiaGymText2
+ dw FuchsiaGymText3
+ dw FuchsiaGymText4
+ dw FuchsiaGymText5
+ dw FuchsiaGymText6
+ dw FuchsiaGymText7
+ dw FuchsiaGymText8
+ dw FuchsiaGymText9
+ dw FuchsiaGymText10
+ dw FuchsiaGymText11
+
+FuchsiaGymTrainerHeader0:
+ dbEventFlagBit EVENT_BEAT_FUCHSIA_GYM_TRAINER_0
+ db ($2 << 4) ; trainer's view range
+ dwEventFlagAddress EVENT_BEAT_FUCHSIA_GYM_TRAINER_0
+ dw FuchsiaGymBattleText1 ; TextBeforeBattle
+ dw FuchsiaGymAfterBattleText1 ; TextAfterBattle
+ dw FuchsiaGymEndBattleText1 ; TextEndBattle
+ dw FuchsiaGymEndBattleText1 ; TextEndBattle
+
+FuchsiaGymTrainerHeader1:
+ dbEventFlagBit EVENT_BEAT_FUCHSIA_GYM_TRAINER_1
+ db ($2 << 4) ; trainer's view range
+ dwEventFlagAddress EVENT_BEAT_FUCHSIA_GYM_TRAINER_1
+ dw FuchsiaGymBattleText2 ; TextBeforeBattle
+ dw FuchsiaGymAfterBattleText2 ; TextAfterBattle
+ dw FuchsiaGymEndBattleText2 ; TextEndBattle
+ dw FuchsiaGymEndBattleText2 ; TextEndBattle
+
+FuchsiaGymTrainerHeader2:
+ dbEventFlagBit EVENT_BEAT_FUCHSIA_GYM_TRAINER_2
+ db ($4 << 4) ; trainer's view range
+ dwEventFlagAddress EVENT_BEAT_FUCHSIA_GYM_TRAINER_2
+ dw FuchsiaGymBattleText3 ; TextBeforeBattle
+ dw FuchsiaGymAfterBattleText3 ; TextAfterBattle
+ dw FuchsiaGymEndBattleText3 ; TextEndBattle
+ dw FuchsiaGymEndBattleText3 ; TextEndBattle
+
+FuchsiaGymTrainerHeader3:
+ dbEventFlagBit EVENT_BEAT_FUCHSIA_GYM_TRAINER_3
+ db ($2 << 4) ; trainer's view range
+ dwEventFlagAddress EVENT_BEAT_FUCHSIA_GYM_TRAINER_3
+ dw FuchsiaGymBattleText4 ; TextBeforeBattle
+ dw FuchsiaGymAfterBattleText4 ; TextAfterBattle
+ dw FuchsiaGymEndBattleText4 ; TextEndBattle
+ dw FuchsiaGymEndBattleText4 ; TextEndBattle
+
+FuchsiaGymTrainerHeader4:
+ dbEventFlagBit EVENT_BEAT_FUCHSIA_GYM_TRAINER_4
+ db ($2 << 4) ; trainer's view range
+ dwEventFlagAddress EVENT_BEAT_FUCHSIA_GYM_TRAINER_4
+ dw FuchsiaGymBattleText5 ; TextBeforeBattle
+ dw FuchsiaGymAfterBattleText5 ; TextAfterBattle
+ dw FuchsiaGymEndBattleText5 ; TextEndBattle
+ dw FuchsiaGymEndBattleText5 ; TextEndBattle
+
+FuchsiaGymTrainerHeader5:
+ dbEventFlagBit EVENT_BEAT_FUCHSIA_GYM_TRAINER_5
+ db ($2 << 4) ; trainer's view range
+ dwEventFlagAddress EVENT_BEAT_FUCHSIA_GYM_TRAINER_5
+ dw FuchsiaGymBattleText6 ; TextBeforeBattle
+ dw FuchsiaGymAfterBattleText6 ; TextAfterBattle
+ dw FuchsiaGymEndBattleText6 ; TextEndBattle
+ dw FuchsiaGymEndBattleText6 ; TextEndBattle
+
+ db $ff
+
+FuchsiaGymText1:
+ TX_ASM
+ CheckEvent EVENT_BEAT_KOGA
+ jr z, .asm_181b6
+ CheckEventReuseA EVENT_GOT_TM06
+ jr nz, .asm_adc3b
+ call z, FuchsiaGymScript3_75497
+ call DisableWaitingAfterTextDisplay
+ jr .asm_e84c6
+.asm_adc3b
+ ld hl, KogaExplainToxicText
+ call PrintText
+ jr .asm_e84c6
+.asm_181b6
+ ld hl, KogaBeforeBattleText
+ call PrintText
+ ld hl, wd72d
+ set 6, [hl]
+ set 7, [hl]
+ ld hl, KogaAfterBattleText
+ ld de, KogaAfterBattleText
+ call SaveEndBattleTextPointers
+ ld a, [H_SPRITEINDEX]
+ ld [wSpriteIndex], a
+ call EngageMapTrainer
+ call InitBattleEnemyParameters
+ ld a, $5
+ ld [wGymLeaderNo], a
+ xor a
+ ld [hJoyHeld], a
+ ld a, $3
+ ld [wFuchsiaGymCurScript], a
+.asm_e84c6
+ jp TextScriptEnd
+
+KogaBeforeBattleText:
+ TX_FAR _KogaBeforeBattleText
+ db "@"
+
+KogaAfterBattleText:
+ TX_FAR _KogaAfterBattleText
+ db "@"
+
+KogaExplainToxicText:
+ TX_FAR _KogaExplainToxicText
+ db "@"
+
+FuchsiaGymText9:
+ TX_FAR _FuchsiaGymText9
+ db "@"
+
+FuchsiaGymText10:
+ TX_FAR _ReceivedTM06Text
+ TX_SFX_KEY_ITEM
+
+TM06ExplanationText:
+ TX_FAR _TM06ExplanationText
+ db "@"
+
+FuchsiaGymText11:
+ TX_FAR _TM06NoRoomText
+ db "@"
+
+FuchsiaGymText2:
+ TX_ASM
+ ld hl, FuchsiaGymTrainerHeader0
+ call TalkToTrainer
+ jp TextScriptEnd
+
+FuchsiaGymBattleText1:
+ TX_FAR _FuchsiaGymBattleText1
+ db "@"
+
+FuchsiaGymEndBattleText1:
+ TX_FAR _FuchsiaGymEndBattleText1
+ db "@"
+
+FuchsiaGymAfterBattleText1:
+ TX_FAR _FuchsiaGymAfterBattleText1
+ db "@"
+
+FuchsiaGymText3:
+ TX_ASM
+ ld hl, FuchsiaGymTrainerHeader1
+ call TalkToTrainer
+ jp TextScriptEnd
+
+FuchsiaGymBattleText2:
+ TX_FAR _FuchsiaGymBattleText2
+ db "@"
+
+FuchsiaGymEndBattleText2:
+ TX_FAR _FuchsiaGymEndBattleText2
+ db "@"
+
+FuchsiaGymAfterBattleText2:
+ TX_FAR _FuchsiaGymAfterBattleText2
+ db "@"
+
+FuchsiaGymText4:
+ TX_ASM
+ ld hl, FuchsiaGymTrainerHeader2
+ call TalkToTrainer
+ jp TextScriptEnd
+
+FuchsiaGymBattleText3:
+ TX_FAR _FuchsiaGymBattleText3
+ db "@"
+
+FuchsiaGymEndBattleText3:
+ TX_FAR _FuchsiaGymEndBattleText3
+ db "@"
+
+FuchsiaGymAfterBattleText3:
+ TX_FAR _FuchsiaGymAfterBattleText3
+ db "@"
+
+FuchsiaGymText5:
+ TX_ASM
+ ld hl, FuchsiaGymTrainerHeader3
+ call TalkToTrainer
+ jp TextScriptEnd
+
+FuchsiaGymBattleText4:
+ TX_FAR _FuchsiaGymBattleText4
+ db "@"
+
+FuchsiaGymEndBattleText4:
+ TX_FAR _FuchsiaGymEndBattleText4
+ db "@"
+
+FuchsiaGymAfterBattleText4:
+ TX_FAR _FuchsiaGymAfterBattleText4
+ db "@"
+
+FuchsiaGymText6:
+ TX_ASM
+ ld hl, FuchsiaGymTrainerHeader4
+ call TalkToTrainer
+ jp TextScriptEnd
+
+FuchsiaGymBattleText5:
+ TX_FAR _FuchsiaGymBattleText5
+ db "@"
+
+FuchsiaGymEndBattleText5:
+ TX_FAR _FuchsiaGymEndBattleText5
+ db "@"
+
+FuchsiaGymAfterBattleText5:
+ TX_FAR _FuchsiaGymAfterBattleText5
+ db "@"
+
+FuchsiaGymText7:
+ TX_ASM
+ ld hl, FuchsiaGymTrainerHeader5
+ call TalkToTrainer
+ jp TextScriptEnd
+
+FuchsiaGymBattleText6:
+ TX_FAR _FuchsiaGymBattleText6
+ db "@"
+
+FuchsiaGymEndBattleText6:
+ TX_FAR _FuchsiaGymEndBattleText6
+ db "@"
+
+FuchsiaGymAfterBattleText6:
+ TX_FAR _FuchsiaGymAfterBattleText6
+ db "@"
+
+FuchsiaGymText8:
+ TX_ASM
+ CheckEvent EVENT_BEAT_KOGA
+ ld hl, FuchsiaGymText_75653
+ jr nz, .asm_50671
+ ld hl, FuchsiaGymText_7564e
+.asm_50671
+ call PrintText
+ jp TextScriptEnd
+
+FuchsiaGymText_7564e:
+ TX_FAR _FuchsiaGymText_7564e
+ db "@"
+
+FuchsiaGymText_75653:
+ TX_FAR _FuchsiaGymText_75653
+ db "@"
diff --git a/de/scripts/pewtercity.asm b/de/scripts/pewtercity.asm
new file mode 100755
index 00000000..494298b8
--- /dev/null
+++ b/de/scripts/pewtercity.asm
@@ -0,0 +1,324 @@
+PewterCityScript:
+ call EnableAutoTextBoxDrawing
+ ld hl, PewterCityScriptPointers
+ ld a, [wPewterCityCurScript]
+ jp CallFunctionInTable
+
+PewterCityScriptPointers:
+ dw PewterCityScript0
+ dw PewterCityScript1
+ dw PewterCityScript2
+ dw PewterCityScript3
+ dw PewterCityScript4
+ dw PewterCityScript5
+ dw PewterCityScript6
+
+PewterCityScript0:
+ xor a
+ ld [wMuseum1fCurScript], a
+ ResetEvent EVENT_BOUGHT_MUSEUM_TICKET
+ call PewterCityScript_1925e
+ ret
+
+PewterCityScript_1925e:
+ CheckEvent EVENT_BEAT_BROCK
+ ret nz
+ ld hl, CoordsData_19277
+ call ArePlayerCoordsInArray
+ ret nc
+ ld a, $f0
+ ld [wJoyIgnore], a
+ ld a, $5
+ ld [hSpriteIndexOrTextID], a
+ jp DisplayTextID
+
+CoordsData_19277:
+ db $11,$23
+ db $11,$24
+ db $12,$25
+ db $13,$25
+ db $ff
+
+PewterCityScript1:
+ ld a, [wNPCMovementScriptPointerTableNum]
+ and a
+ ret nz
+ ld a, $3
+ ld [H_SPRITEINDEX], a
+ ld a, SPRITE_FACING_UP
+ ld [hSpriteFacingDirection], a
+ call SetSpriteFacingDirectionAndDelay
+ ld a, ($3 << 4) | SPRITE_FACING_UP
+ ld [hSpriteImageIndex], a
+ call SetSpriteImageIndexAfterSettingFacingDirection
+ call PlayDefaultMusic
+ ld hl, wFlags_0xcd60
+ set 4, [hl]
+ ld a, $d
+ ld [hSpriteIndexOrTextID], a
+ call DisplayTextID
+ ld a, $3c
+ ld [$ffeb], a
+ ld a, $30
+ ld [$ffec], a
+ ld a, $c
+ ld [$ffed], a
+ ld a, $11
+ ld [$ffee], a
+ ld a, $3
+ ld [wSpriteIndex], a
+ call SetSpritePosition1
+ ld a, $3
+ ld [H_SPRITEINDEX], a
+ ld de, MovementData_PewterMuseumGuyExit
+ call MoveSprite
+ ld a, $2
+ ld [wPewterCityCurScript], a
+ ret
+
+MovementData_PewterMuseumGuyExit:
+ db NPC_MOVEMENT_DOWN
+ db NPC_MOVEMENT_DOWN
+ db NPC_MOVEMENT_DOWN
+ db NPC_MOVEMENT_DOWN
+ db $FF
+
+PewterCityScript2:
+ ld a, [wd730]
+ bit 0, a
+ ret nz
+ ld a, HS_MUSEUM_GUY
+ ld [wMissableObjectIndex], a
+ predef HideObject
+ ld a, $3
+ ld [wPewterCityCurScript], a
+ ret
+
+PewterCityScript3:
+ ld a, $3
+ ld [wSpriteIndex], a
+ call SetSpritePosition2
+ ld a, HS_MUSEUM_GUY
+ ld [wMissableObjectIndex], a
+ predef ShowObject
+ xor a
+ ld [wJoyIgnore], a
+ ld a, $0
+ ld [wPewterCityCurScript], a
+ ret
+
+PewterCityScript4:
+ ld a, [wNPCMovementScriptPointerTableNum]
+ and a
+ ret nz
+ ld a, $5
+ ld [H_SPRITEINDEX], a
+ ld a, SPRITE_FACING_LEFT
+ ld [hSpriteFacingDirection], a
+ call SetSpriteFacingDirectionAndDelay
+ ld a, ($1 << 4) | SPRITE_FACING_LEFT
+ ld [hSpriteImageIndex], a
+ call SetSpriteImageIndexAfterSettingFacingDirection
+ call PlayDefaultMusic
+ ld hl, wFlags_0xcd60
+ set 4, [hl]
+ ld a, $e
+ ld [hSpriteIndexOrTextID], a
+ call DisplayTextID
+ ld a, $3c
+ ld [$ffeb], a
+ ld a, $40
+ ld [$ffec], a
+ ld a, $16
+ ld [$ffed], a
+ ld a, $10
+ ld [$ffee], a
+ ld a, $5
+ ld [wSpriteIndex], a
+ call SetSpritePosition1
+ ld a, $5
+ ld [H_SPRITEINDEX], a
+ ld de, MovementData_PewterGymGuyExit
+ call MoveSprite
+ ld a, $5
+ ld [wPewterCityCurScript], a
+ ret
+
+MovementData_PewterGymGuyExit:
+ db NPC_MOVEMENT_RIGHT
+ db NPC_MOVEMENT_RIGHT
+ db NPC_MOVEMENT_RIGHT
+ db NPC_MOVEMENT_RIGHT
+ db NPC_MOVEMENT_RIGHT
+ db $FF
+
+PewterCityScript5:
+ ld a, [wd730]
+ bit 0, a
+ ret nz
+ ld a, HS_GYM_GUY
+ ld [wMissableObjectIndex], a
+ predef HideObject
+ ld a, $6
+ ld [wPewterCityCurScript], a
+ ret
+
+PewterCityScript6:
+ ld a, $5
+ ld [wSpriteIndex], a
+ call SetSpritePosition2
+ ld a, HS_GYM_GUY
+ ld [wMissableObjectIndex], a
+ predef ShowObject
+ xor a
+ ld [wJoyIgnore], a
+ ld a, $0
+ ld [wPewterCityCurScript], a
+ ret
+
+PewterCityTextPointers:
+ dw PewterCityText1
+ dw PewterCityText2
+ dw PewterCityText3
+ dw PewterCityText4
+ dw PewterCityText5
+ dw PewterCityText6
+ dw PewterCityText7
+ dw MartSignText
+ dw PokeCenterSignText
+ dw PewterCityText10
+ dw PewterCityText11
+ dw PewterCityText12
+ dw PewterCityText13
+ dw PewterCityText14
+
+PewterCityText1:
+ TX_FAR _PewterCityText1
+ db "@"
+
+PewterCityText2:
+ TX_FAR _PewterCityText2
+ db "@"
+
+PewterCityText3:
+ TX_ASM
+ ld hl, PewterCityText_193f1
+ call PrintText
+ call YesNoChoice
+ ld a, [wCurrentMenuItem]
+ and a
+ jr nz, .asm_193c9
+ ld hl, PewterCityText_193f6
+ call PrintText
+ jr .asm_193ee
+.asm_193c9
+ ld hl, PewterCityText_193fb
+ call PrintText
+ xor a
+ ld [hJoyPressed], a
+ ld [hJoyHeld], a
+ ld [wNPCMovementScriptFunctionNum], a
+ ld a, $2
+ ld [wNPCMovementScriptPointerTableNum], a
+ ld a, [H_LOADEDROMBANK]
+ ld [wNPCMovementScriptBank], a
+ ld a, $3
+ ld [wSpriteIndex], a
+ call GetSpritePosition2
+ ld a, $1
+ ld [wPewterCityCurScript], a
+.asm_193ee
+ jp TextScriptEnd
+
+PewterCityText_193f1:
+ TX_FAR _PewterCityText_193f1
+ db "@"
+
+PewterCityText_193f6:
+ TX_FAR _PewterCityText_193f6
+ db "@"
+
+PewterCityText_193fb:
+ TX_FAR _PewterCityText_193fb
+ db "@"
+
+PewterCityText13:
+ TX_FAR _PewterCityText13
+ db "@"
+
+PewterCityText4:
+ TX_ASM
+ ld hl, PewterCityText_19427
+ call PrintText
+ call YesNoChoice
+ ld a, [wCurrentMenuItem]
+ cp $0
+ jr nz, .asm_1941e
+ ld hl, PewterCityText_1942c
+ call PrintText
+ jr .asm_19424
+.asm_1941e
+ ld hl, PewterCityText_19431
+ call PrintText
+.asm_19424
+ jp TextScriptEnd
+
+PewterCityText_19427:
+ TX_FAR _PewterCityText_19427
+ db "@"
+
+PewterCityText_1942c:
+ TX_FAR _PewterCityText_1942c
+ db "@"
+
+PewterCityText_19431:
+ TX_FAR _PewterCityText_19431
+ db "@"
+
+PewterCityText5:
+ TX_ASM
+ ld a,$FC
+ ld [$CD6B],a
+ ld hl, PewterCityText_1945d
+ call PrintText
+ xor a
+ ld [hJoyHeld], a
+ ld [wNPCMovementScriptFunctionNum], a
+ ld a, $3
+ ld [wNPCMovementScriptPointerTableNum], a
+ ld a, [H_LOADEDROMBANK]
+ ld [wNPCMovementScriptBank], a
+ ld a, $5
+ ld [wSpriteIndex], a
+ call GetSpritePosition2
+ ld a, $4
+ ld [wPewterCityCurScript], a
+ jp TextScriptEnd
+
+PewterCityText_1945d:
+ TX_FAR _PewterCityText_1945d
+ db "@"
+
+PewterCityText14:
+ TX_FAR _PewterCityText14
+ db "@"
+
+PewterCityText6:
+ TX_FAR _PewterCityText6
+ db "@"
+
+PewterCityText7:
+ TX_FAR _PewterCityText7
+ db "@"
+
+PewterCityText10:
+ TX_FAR _PewterCityText10
+ db "@"
+
+PewterCityText11:
+ TX_FAR _PewterCityText11
+ db "@"
+
+PewterCityText12:
+ TX_FAR _PewterCityText12
+ db "@"
diff --git a/de/scripts/pewtergym.asm b/de/scripts/pewtergym.asm
new file mode 100755
index 00000000..5376ee37
--- /dev/null
+++ b/de/scripts/pewtergym.asm
@@ -0,0 +1,228 @@
+PewterGymScript:
+ ld hl, wCurrentMapScriptFlags
+ bit 6, [hl]
+ res 6, [hl]
+ call nz, PewterGymScript_5c3a4
+ call EnableAutoTextBoxDrawing
+ ld hl, PewterGymTrainerHeader0
+ ld de, PewterGymScriptPointers
+ ld a, [wPewterGymCurScript]
+ call ExecuteCurMapScriptInTable
+ ld [wPewterGymCurScript], a
+ ret
+
+PewterGymScript_5c3a4:
+ ld hl, Gym1CityName
+ ld de, Gym1LeaderName
+ jp LoadGymLeaderAndCityName
+
+Gym1CityName:
+ db "MARMORIA CITY@"
+
+Gym1LeaderName:
+ db "ROCKO@"
+
+PewterGymScript_5c3bf:
+ xor a
+ ld [wJoyIgnore], a
+ ld [wPewterGymCurScript], a
+ ld [wCurMapScript], a
+ ret
+
+PewterGymScriptPointers:
+ dw CheckFightingMapTrainers
+ dw DisplayEnemyTrainerTextAndStartBattle
+ dw EndTrainerBattle
+ dw PewterGymScript3
+
+PewterGymScript3:
+ ld a, [wIsInBattle]
+ cp $ff
+ jp z, PewterGymScript_5c3bf
+ ld a, $f0
+ ld [wJoyIgnore], a
+
+PewterGymScript_5c3df:
+ ld a, $4
+ ld [hSpriteIndexOrTextID], a
+ call DisplayTextID
+ SetEvent EVENT_BEAT_BROCK
+ lb bc, TM_34, 1
+ call GiveItem
+ jr nc, .BagFull
+ ld a, $5
+ ld [hSpriteIndexOrTextID], a
+ call DisplayTextID
+ SetEvent EVENT_GOT_TM34
+ jr .asm_5c408
+.BagFull
+ ld a, $6
+ ld [hSpriteIndexOrTextID], a
+ call DisplayTextID
+.asm_5c408
+ ld hl, wObtainedBadges
+ set 0, [hl]
+ ld hl, wBeatGymFlags
+ set 0, [hl]
+
+ ld a, HS_GYM_GUY
+ ld [wMissableObjectIndex], a
+ predef HideObject
+ ld a, HS_ROUTE_22_RIVAL_1
+ ld [wMissableObjectIndex], a
+ predef HideObject
+
+ ResetEvents EVENT_1ST_ROUTE22_RIVAL_BATTLE, EVENT_ROUTE22_RIVAL_WANTS_BATTLE
+
+ ; deactivate gym trainers
+ SetEvent EVENT_BEAT_PEWTER_GYM_TRAINER_0
+
+ jp PewterGymScript_5c3bf
+
+PewterGymTextPointers:
+ dw PewterGymText1
+ dw PewterGymText2
+ dw PewterGymText3
+ dw PewterGymText4
+ dw PewterGymText5
+ dw PewterGymText6
+
+PewterGymTrainerHeader0:
+ dbEventFlagBit EVENT_BEAT_PEWTER_GYM_TRAINER_0
+ db ($5 << 4) ; trainer's view range
+ dwEventFlagAddress EVENT_BEAT_PEWTER_GYM_TRAINER_0
+ dw PewterGymBattleText1 ; TextBeforeBattle
+ dw PewterGymAfterBattleText1 ; TextAfterBattle
+ dw PewterGymEndBattleText1 ; TextEndBattle
+ dw PewterGymEndBattleText1 ; TextEndBattle
+
+ db $ff
+
+PewterGymText1:
+ TX_ASM
+ CheckEvent EVENT_BEAT_BROCK
+ jr z, .asm_5c46a
+ CheckEventReuseA EVENT_GOT_TM34
+ jr nz, .asm_5c462
+ call z, PewterGymScript_5c3df
+ call DisableWaitingAfterTextDisplay
+ jr .asm_5c49b
+.asm_5c462
+ ld hl, PewterGymText_5c4a3
+ call PrintText
+ jr .asm_5c49b
+.asm_5c46a
+ ld hl, PewterGymText_5c49e
+ call PrintText
+ ld hl, wd72d
+ set 6, [hl]
+ set 7, [hl]
+ ld hl, PewterGymText_5c4bc
+ ld de, PewterGymText_5c4bc
+ call SaveEndBattleTextPointers
+ ld a, [H_SPRITEINDEX]
+ ld [wSpriteIndex], a
+ call EngageMapTrainer
+ call InitBattleEnemyParameters
+ ld a, $1
+ ld [wGymLeaderNo], a
+ xor a
+ ld [hJoyHeld], a
+ ld a, $3
+ ld [wPewterGymCurScript], a
+ ld [wCurMapScript], a
+.asm_5c49b
+ jp TextScriptEnd
+
+PewterGymText_5c49e:
+ TX_FAR _PewterGymText_5c49e
+ db "@"
+
+PewterGymText_5c4a3:
+ TX_FAR _PewterGymText_5c4a3
+ db "@"
+
+PewterGymText4:
+ TX_FAR _TM34PreReceiveText
+ db "@"
+
+PewterGymText5:
+ TX_FAR _ReceivedTM34Text
+ TX_SFX_ITEM_1
+ TX_FAR _TM34ExplanationText
+ db "@"
+
+PewterGymText6:
+ TX_FAR _TM34NoRoomText
+ db "@"
+
+PewterGymText_5c4bc:
+ TX_FAR _PewterGymText_5c4bc
+ TX_SFX_LEVEL_UP ; probably supposed to play SFX_GET_ITEM_1 but the wrong music bank is loaded
+ TX_FAR _PewterGymText_5c4c1
+ db "@"
+
+PewterGymText2:
+ TX_ASM
+ ld hl, PewterGymTrainerHeader0
+ call TalkToTrainer
+ jp TextScriptEnd
+
+PewterGymBattleText1:
+ TX_FAR _PewterGymBattleText1
+ db "@"
+
+PewterGymEndBattleText1:
+ TX_FAR _PewterGymEndBattleText1
+ db "@"
+
+PewterGymAfterBattleText1:
+ TX_FAR _PewterGymAfterBattleText1
+ db "@"
+
+PewterGymText3:
+ TX_ASM
+ ld a, [wBeatGymFlags]
+ bit 0, a
+ jr nz, .asm_5c50c
+ ld hl, PewterGymText_5c515
+ call PrintText
+ call YesNoChoice
+ ld a, [wCurrentMenuItem]
+ and a
+ jr nz, .asm_5c4fe
+ ld hl, PewterGymText_5c51a
+ call PrintText
+ jr .asm_5c504
+.asm_5c4fe
+ ld hl, PewterGymText_5c524
+ call PrintText
+.asm_5c504
+ ld hl, PewterGymText_5c51f
+ call PrintText
+ jr .asm_5c512
+.asm_5c50c
+ ld hl, PewterGymText_5c529
+ call PrintText
+.asm_5c512
+ jp TextScriptEnd
+
+PewterGymText_5c515:
+ TX_FAR _PewterGymText_5c515
+ db "@"
+
+PewterGymText_5c51a:
+ TX_FAR _PewterGymText_5c51a
+ db "@"
+
+PewterGymText_5c51f:
+ TX_FAR _PewterGymText_5c51f
+ db "@"
+
+PewterGymText_5c524:
+ TX_FAR _PewterGymText_5c524
+ db "@"
+
+PewterGymText_5c529:
+ TX_FAR _PewterGymText_5c529
+ db "@"
diff --git a/de/scripts/route23.asm b/de/scripts/route23.asm
new file mode 100755
index 00000000..6fd70051
--- /dev/null
+++ b/de/scripts/route23.asm
@@ -0,0 +1,236 @@
+Route23Script:
+ call Route23Script_511e9
+ call EnableAutoTextBoxDrawing
+ ld hl, Route23ScriptPointers
+ ld a, [wRoute23CurScript]
+ jp CallFunctionInTable
+
+Route23Script_511e9:
+ ld hl, wCurrentMapScriptFlags
+ bit 6, [hl]
+ res 6, [hl]
+ ret z
+ ResetEvents EVENT_VICTORY_ROAD_2_BOULDER_ON_SWITCH1, EVENT_VICTORY_ROAD_2_BOULDER_ON_SWITCH2
+ ResetEvents EVENT_VICTORY_ROAD_3_BOULDER_ON_SWITCH1, EVENT_VICTORY_ROAD_3_BOULDER_ON_SWITCH2
+ ld a, HS_VICTORY_ROAD_3_BOULDER
+ ld [wMissableObjectIndex], a
+ predef ShowObject
+ ld a, HS_VICTORY_ROAD_2_BOULDER
+ ld [wMissableObjectIndex], a
+ predef_jump HideObject
+
+Route23ScriptPointers:
+ dw Route23Script0
+ dw Route23Script1
+ dw Route23Script2
+
+Route23Script0:
+ ld hl, YCoordsData_51255
+ ld a, [wYCoord]
+ ld b, a
+ ld e, $0
+ EventFlagBit c, EVENT_PASSED_EARTHBADGE_CHECK + 1, EVENT_PASSED_CASCADEBADGE_CHECK
+.asm_51224
+ ld a, [hli]
+ cp $ff
+ ret z
+ inc e
+ dec c
+ cp b
+ jr nz, .asm_51224
+ cp $23
+ jr nz, .asm_51237
+ ld a, [wXCoord]
+ cp $e
+ ret nc
+.asm_51237
+ ld a, e
+ ld [hSpriteIndexOrTextID], a
+ ld a, c
+ ld [wWhichBadge], a
+ ld b, FLAG_TEST
+ EventFlagAddress hl, EVENT_PASSED_CASCADEBADGE_CHECK
+ predef FlagActionPredef
+ ld a, c
+ and a
+ ret nz
+ call Route23Script_5125d
+ call DisplayTextID
+ xor a
+ ld [hJoyHeld], a
+ ret
+
+YCoordsData_51255:
+ db $23,$38,$55,$60,$69,$77,$88,$FF
+
+Route23Script_5125d:
+ ld hl, BadgeTextPointers
+ ld a, [wWhichBadge]
+ ld c, a
+ ld b, 0
+ add hl, bc
+ add hl, bc
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ ld de, wcd6d
+.copyTextLoop
+ ld a, [hli]
+ ld [de], a
+ inc de
+ cp "@"
+ jr nz, .copyTextLoop
+ ret
+
+BadgeTextPointers:
+ dw CascadeBadgeText
+ dw ThunderBadgeText
+ dw RainbowBadgeText
+ dw SoulBadgeText
+ dw MarshBadgeText
+ dw VolcanoBadgeText
+ dw EarthBadgeText
+
+EarthBadgeText:
+ db "ERDORDEN@"
+
+VolcanoBadgeText:
+ db "VULKANORDEN@"
+
+MarshBadgeText:
+ db "SUMPFORDEN@"
+
+SoulBadgeText:
+ db "SEELENORDEN@"
+
+RainbowBadgeText:
+ db "FARBORDEN@"
+
+ThunderBadgeText:
+ db "DONNERORDEN@"
+
+CascadeBadgeText:
+ db "QUELLORDEN@"
+
+Route23Script_512d8:
+ ld a, $1
+ ld [wSimulatedJoypadStatesIndex], a
+ ld a, D_DOWN
+ ld [wSimulatedJoypadStatesEnd], a
+ xor a
+ ld [wSpriteStateData1 + 9], a
+ ld [wJoyIgnore], a
+ jp StartSimulatingJoypadStates
+
+Route23Script1:
+ ld a, [wSimulatedJoypadStatesIndex]
+ and a
+ ret nz
+Route23Script2:
+ ld a, $0
+ ld [wRoute23CurScript], a
+ ret
+
+Route23TextPointers:
+ dw Route23Text1
+ dw Route23Text2
+ dw Route23Text3
+ dw Route23Text4
+ dw Route23Text5
+ dw Route23Text6
+ dw Route23Text7
+ dw Route23Text8
+
+Route23Text1:
+ TX_ASM
+ EventFlagBit a, EVENT_PASSED_EARTHBADGE_CHECK, EVENT_PASSED_CASCADEBADGE_CHECK
+ call Route23Script_51346
+ jp TextScriptEnd
+
+Route23Text2:
+ TX_ASM
+ EventFlagBit a, EVENT_PASSED_VOLCANOBADGE_CHECK, EVENT_PASSED_CASCADEBADGE_CHECK
+ call Route23Script_51346
+ jp TextScriptEnd
+
+Route23Text3:
+ TX_ASM
+ EventFlagBit a, EVENT_PASSED_MARSHBADGE_CHECK, EVENT_PASSED_CASCADEBADGE_CHECK
+ call Route23Script_51346
+ jp TextScriptEnd
+
+Route23Text4:
+ TX_ASM
+ EventFlagBit a, EVENT_PASSED_SOULBADGE_CHECK, EVENT_PASSED_CASCADEBADGE_CHECK
+ call Route23Script_51346
+ jp TextScriptEnd
+
+Route23Text5:
+ TX_ASM
+ EventFlagBit a, EVENT_PASSED_RAINBOWBADGE_CHECK, EVENT_PASSED_CASCADEBADGE_CHECK
+ call Route23Script_51346
+ jp TextScriptEnd
+
+Route23Text6:
+ TX_ASM
+ EventFlagBit a, EVENT_PASSED_THUNDERBADGE_CHECK, EVENT_PASSED_CASCADEBADGE_CHECK
+ call Route23Script_51346
+ jp TextScriptEnd
+
+Route23Text7:
+ TX_ASM
+ EventFlagBit a, EVENT_PASSED_CASCADEBADGE_CHECK
+ call Route23Script_51346
+ jp TextScriptEnd
+
+Route23Script_51346:
+ ld [wWhichBadge], a
+ call Route23Script_5125d
+ ld a, [wWhichBadge]
+ inc a
+ ld c, a
+ ld b, FLAG_TEST
+ ld hl, wObtainedBadges
+ predef FlagActionPredef
+ ld a, c
+ and a
+ jr nz, .asm_5136e
+ ld hl, VictoryRoadGuardText1
+ call PrintText
+ call Route23Script_512d8
+ ld a, $1
+ ld [wRoute23CurScript], a
+ ret
+.asm_5136e
+ ld hl, VictoryRoadGuardText2
+ call PrintText
+ ld a, [wWhichBadge]
+ ld c, a
+ ld b, FLAG_SET
+ EventFlagAddress hl, EVENT_PASSED_CASCADEBADGE_CHECK
+ predef FlagActionPredef
+ ld a, $2
+ ld [wRoute23CurScript], a
+ ret
+
+Route23Script_51388:
+ ld hl, VictoryRoadGuardText2
+ jp PrintText
+
+VictoryRoadGuardText1:
+ TX_FAR _VictoryRoadGuardText1
+ TX_ASM
+ ld a, SFX_DENIED
+ call PlaySoundWaitForCurrent
+ call WaitForSoundToFinish
+ jp TextScriptEnd
+
+VictoryRoadGuardText2:
+ TX_FAR _VictoryRoadGuardText2
+ TX_SFX_ITEM_1
+ TX_FAR _VictoryRoadGuardText_513a3
+ db "@"
+
+Route23Text8:
+ TX_FAR _Route23Text8
+ db "@"
diff --git a/de/scripts/saffrongym.asm b/de/scripts/saffrongym.asm
new file mode 100755
index 00000000..fa22f190
--- /dev/null
+++ b/de/scripts/saffrongym.asm
@@ -0,0 +1,358 @@
+SaffronGymScript:
+ ld hl, wCurrentMapScriptFlags
+ bit 6, [hl]
+ res 6, [hl]
+ call nz, .extra
+ call EnableAutoTextBoxDrawing
+ ld hl, SaffronGymTrainerHeader0
+ ld de, SaffronGymScriptPointers
+ ld a, [wSaffronGymCurScript]
+ call ExecuteCurMapScriptInTable
+ ld [wSaffronGymCurScript], a
+ ret
+
+.extra
+ ld hl, Gym6CityName
+ ld de, Gym6LeaderName
+ jp LoadGymLeaderAndCityName
+
+Gym6CityName:
+ db "SAFFRONIA CITY@"
+
+Gym6LeaderName:
+ db "SABRINA@"
+
+SaffronGymText_5d048:
+ xor a
+ ld [wJoyIgnore], a
+ ld [wSaffronGymCurScript], a
+ ld [wCurMapScript], a
+ ret
+
+SaffronGymScriptPointers:
+ dw CheckFightingMapTrainers
+ dw DisplayEnemyTrainerTextAndStartBattle
+ dw EndTrainerBattle
+ dw SaffronGymScript3
+
+SaffronGymScript3:
+ ld a, [wIsInBattle]
+ cp $ff
+ jp z, SaffronGymText_5d048
+ ld a, $f0
+ ld [wJoyIgnore], a
+
+SaffronGymText_5d068:
+ ld a, $a
+ ld [hSpriteIndexOrTextID], a
+ call DisplayTextID
+ SetEvent EVENT_BEAT_SABRINA
+ lb bc, TM_46, 1
+ call GiveItem
+ jr nc, .BagFull
+ ld a, $b
+ ld [hSpriteIndexOrTextID], a
+ call DisplayTextID
+ SetEvent EVENT_GOT_TM46
+ jr .asm_5d091
+.BagFull
+ ld a, $c
+ ld [hSpriteIndexOrTextID], a
+ call DisplayTextID
+.asm_5d091
+ ld hl, wObtainedBadges
+ set 5, [hl]
+ ld hl, wBeatGymFlags
+ set 5, [hl]
+
+ ; deactivate gym trainers
+ SetEventRange EVENT_BEAT_SAFFRON_GYM_TRAINER_0, EVENT_BEAT_SAFFRON_GYM_TRAINER_6
+
+ jp SaffronGymText_5d048
+
+SaffronGymTextPointers:
+ dw SaffronGymText1
+ dw SaffronGymText2
+ dw SaffronGymText3
+ dw SaffronGymText4
+ dw SaffronGymText5
+ dw SaffronGymText6
+ dw SaffronGymText7
+ dw SaffronGymText8
+ dw SaffronGymText9
+ dw SaffronGymText10
+ dw SaffronGymText11
+ dw SaffronGymText12
+
+SaffronGymTrainerHeader0:
+ dbEventFlagBit EVENT_BEAT_SAFFRON_GYM_TRAINER_0
+ db ($3 << 4) ; trainer's view range
+ dwEventFlagAddress EVENT_BEAT_SAFFRON_GYM_TRAINER_0
+ dw SaffronGymBattleText1 ; TextBeforeBattle
+ dw SaffronGymAfterBattleText1 ; TextAfterBattle
+ dw SaffronGymEndBattleText1 ; TextEndBattle
+ dw SaffronGymEndBattleText1 ; TextEndBattle
+
+SaffronGymTrainerHeader1:
+ dbEventFlagBit EVENT_BEAT_SAFFRON_GYM_TRAINER_1
+ db ($3 << 4) ; trainer's view range
+ dwEventFlagAddress EVENT_BEAT_SAFFRON_GYM_TRAINER_1
+ dw SaffronGymBattleText2 ; TextBeforeBattle
+ dw SaffronGymAfterBattleText2 ; TextAfterBattle
+ dw SaffronGymEndBattleText2 ; TextEndBattle
+ dw SaffronGymEndBattleText2 ; TextEndBattle
+
+SaffronGymTrainerHeader2:
+ dbEventFlagBit EVENT_BEAT_SAFFRON_GYM_TRAINER_2
+ db ($3 << 4) ; trainer's view range
+ dwEventFlagAddress EVENT_BEAT_SAFFRON_GYM_TRAINER_2
+ dw SaffronGymBattleText3 ; TextBeforeBattle
+ dw SaffronGymAfterBattleText3 ; TextAfterBattle
+ dw SaffronGymEndBattleText3 ; TextEndBattle
+ dw SaffronGymEndBattleText3 ; TextEndBattle
+
+SaffronGymTrainerHeader3:
+ dbEventFlagBit EVENT_BEAT_SAFFRON_GYM_TRAINER_3
+ db ($3 << 4) ; trainer's view range
+ dwEventFlagAddress EVENT_BEAT_SAFFRON_GYM_TRAINER_3
+ dw SaffronGymBattleText4 ; TextBeforeBattle
+ dw SaffronGymAfterBattleText4 ; TextAfterBattle
+ dw SaffronGymEndBattleText4 ; TextEndBattle
+ dw SaffronGymEndBattleText4 ; TextEndBattle
+
+SaffronGymTrainerHeader4:
+ dbEventFlagBit EVENT_BEAT_SAFFRON_GYM_TRAINER_4
+ db ($3 << 4) ; trainer's view range
+ dwEventFlagAddress EVENT_BEAT_SAFFRON_GYM_TRAINER_4
+ dw SaffronGymBattleText5 ; TextBeforeBattle
+ dw SaffronGymAfterBattleText5 ; TextAfterBattle
+ dw SaffronGymEndBattleText5 ; TextEndBattle
+ dw SaffronGymEndBattleText5 ; TextEndBattle
+
+SaffronGymTrainerHeader5:
+ dbEventFlagBit EVENT_BEAT_SAFFRON_GYM_TRAINER_5
+ db ($3 << 4) ; trainer's view range
+ dwEventFlagAddress EVENT_BEAT_SAFFRON_GYM_TRAINER_5
+ dw SaffronGymBattleText6 ; TextBeforeBattle
+ dw SaffronGymAfterBattleText6 ; TextAfterBattle
+ dw SaffronGymEndBattleText6 ; TextEndBattle
+ dw SaffronGymEndBattleText6 ; TextEndBattle
+
+SaffronGymTrainerHeader6:
+ dbEventFlagBit EVENT_BEAT_SAFFRON_GYM_TRAINER_6, 1
+ db ($3 << 4) ; trainer's view range
+ dwEventFlagAddress EVENT_BEAT_SAFFRON_GYM_TRAINER_6, 1
+ dw SaffronGymBattleText7 ; TextBeforeBattle
+ dw SaffronGymAfterBattleText7 ; TextAfterBattle
+ dw SaffronGymEndBattleText7 ; TextEndBattle
+ dw SaffronGymEndBattleText7 ; TextEndBattle
+
+ db $ff
+
+SaffronGymText1:
+ TX_ASM
+ CheckEvent EVENT_BEAT_SABRINA
+ jr z, .asm_5d134
+ CheckEventReuseA EVENT_GOT_TM46
+ jr nz, .asm_5d12c
+ call z, SaffronGymText_5d068
+ call DisableWaitingAfterTextDisplay
+ jr .asm_5d15f
+.asm_5d12c
+ ld hl, SaffronGymText_5d16e
+ call PrintText
+ jr .asm_5d15f
+.asm_5d134
+ ld hl, SaffronGymText_5d162
+ call PrintText
+ ld hl, wd72d
+ set 6, [hl]
+ set 7, [hl]
+ ld hl, SaffronGymText_5d167
+ ld de, SaffronGymText_5d167
+ call SaveEndBattleTextPointers
+ ld a, [H_SPRITEINDEX]
+ ld [wSpriteIndex], a
+ call EngageMapTrainer
+ call InitBattleEnemyParameters
+ ld a, $6
+ ld [wGymLeaderNo], a
+ ld a, $3
+ ld [wSaffronGymCurScript], a
+.asm_5d15f
+ jp TextScriptEnd
+
+SaffronGymText_5d162:
+ TX_FAR _SaffronGymText_5d162
+ db "@"
+
+SaffronGymText_5d167:
+ TX_FAR _SaffronGymText_5d167
+ TX_SFX_KEY_ITEM ; actually plays the second channel of SFX_BALL_POOF due to the wrong music bank being loaded
+ TX_BLINK
+ db "@"
+
+SaffronGymText_5d16e:
+ TX_FAR _SaffronGymText_5d16e
+ db "@"
+
+SaffronGymText10:
+ TX_FAR _SaffronGymText_5d173
+ db "@"
+
+SaffronGymText11:
+ TX_FAR ReceivedTM46Text
+ TX_SFX_ITEM_1
+ TX_FAR _TM46ExplanationText
+ db "@"
+
+SaffronGymText12:
+ TX_FAR _TM46NoRoomText
+ db "@"
+
+SaffronGymText2:
+ TX_ASM
+ ld hl, SaffronGymTrainerHeader0
+ call TalkToTrainer
+ jp TextScriptEnd
+
+SaffronGymText3:
+ TX_ASM
+ ld hl, SaffronGymTrainerHeader1
+ call TalkToTrainer
+ jp TextScriptEnd
+
+SaffronGymText4:
+ TX_ASM
+ ld hl, SaffronGymTrainerHeader2
+ call TalkToTrainer
+ jp TextScriptEnd
+
+SaffronGymText5:
+ TX_ASM
+ ld hl, SaffronGymTrainerHeader3
+ call TalkToTrainer
+ jp TextScriptEnd
+
+SaffronGymText6:
+ TX_ASM
+ ld hl, SaffronGymTrainerHeader4
+ call TalkToTrainer
+ jp TextScriptEnd
+
+SaffronGymText7:
+ TX_ASM
+ ld hl, SaffronGymTrainerHeader5
+ call TalkToTrainer
+ jp TextScriptEnd
+
+SaffronGymText8:
+ TX_ASM
+ ld hl, SaffronGymTrainerHeader6
+ call TalkToTrainer
+ jp TextScriptEnd
+
+SaffronGymText9:
+ TX_ASM
+ CheckEvent EVENT_BEAT_SABRINA
+ jr nz, .asm_5d1dd
+ ld hl, SaffronGymText_5d1e6
+ call PrintText
+ jr .asm_5d1e3
+.asm_5d1dd
+ ld hl, SaffronGymText_5d1eb
+ call PrintText
+.asm_5d1e3
+ jp TextScriptEnd
+
+SaffronGymText_5d1e6:
+ TX_FAR _SaffronGymText_5d1e6
+ db "@"
+
+SaffronGymText_5d1eb:
+ TX_FAR _SaffronGymText_5d1eb
+ db "@"
+
+SaffronGymBattleText1:
+ TX_FAR _SaffronGymBattleText1
+ db "@"
+
+SaffronGymEndBattleText1:
+ TX_FAR _SaffronGymEndBattleText1
+ db "@"
+
+SaffronGymAfterBattleText1:
+ TX_FAR _SaffronGymAfterBattleText1
+ db "@"
+
+SaffronGymBattleText2:
+ TX_FAR _SaffronGymBattleText2
+ db "@"
+
+SaffronGymEndBattleText2:
+ TX_FAR _SaffronGymEndBattleText2
+ db "@"
+
+SaffronGymAfterBattleText2:
+ TX_FAR _SaffronGymAfterBattleText2
+ db "@"
+
+SaffronGymBattleText3:
+ TX_FAR _SaffronGymBattleText3
+ db "@"
+
+SaffronGymEndBattleText3:
+ TX_FAR _SaffronGymEndBattleText3
+ db "@"
+
+SaffronGymAfterBattleText3:
+ TX_FAR _SaffronGymAfterBattleText3
+ db "@"
+
+SaffronGymBattleText4:
+ TX_FAR _SaffronGymBattleText4
+ db "@"
+
+SaffronGymEndBattleText4:
+ TX_FAR _SaffronGymEndBattleText4
+ db "@"
+
+SaffronGymAfterBattleText4:
+ TX_FAR _SaffronGymAfterBattleText4
+ db "@"
+
+SaffronGymBattleText5:
+ TX_FAR _SaffronGymBattleText5
+ db "@"
+
+SaffronGymEndBattleText5:
+ TX_FAR _SaffronGymEndBattleText5
+ db "@"
+
+SaffronGymAfterBattleText5:
+ TX_FAR _SaffronGymAfterBattleText5
+ db "@"
+
+SaffronGymBattleText6:
+ TX_FAR _SaffronGymBattleText6
+ db "@"
+
+SaffronGymEndBattleText6:
+ TX_FAR _SaffronGymEndBattleText6
+ db "@"
+
+SaffronGymAfterBattleText6:
+ TX_FAR _SaffronGymAfterBattleText6
+ db "@"
+
+SaffronGymBattleText7:
+ TX_FAR _SaffronGymBattleText7
+ db "@"
+
+SaffronGymEndBattleText7:
+ TX_FAR _SaffronGymEndBattleText7
+ db "@"
+
+SaffronGymAfterBattleText7:
+ TX_FAR _SaffronGymAfterBattleText7
+ db "@"
diff --git a/de/scripts/vermiliongym.asm b/de/scripts/vermiliongym.asm
new file mode 100755
index 00000000..350372f9
--- /dev/null
+++ b/de/scripts/vermiliongym.asm
@@ -0,0 +1,267 @@
+VermilionGymScript:
+ ld hl, wCurrentMapScriptFlags
+ bit 5, [hl]
+ res 5, [hl]
+ push hl
+ call nz, VermilionGymScript_5ca4c
+ pop hl
+ bit 6, [hl]
+ res 6, [hl]
+ call nz, VermilionGymScript_5ca6d
+ call EnableAutoTextBoxDrawing
+ ld hl, VermilionGymTrainerHeader0
+ ld de, VermilionGymScriptPointers
+ ld a, [wVermilionGymCurScript]
+ call ExecuteCurMapScriptInTable
+ ld [wVermilionGymCurScript], a
+ ret
+
+VermilionGymScript_5ca4c:
+ ld hl, Gym3CityName
+ ld de, Gym3LeaderName
+ jp LoadGymLeaderAndCityName
+
+Gym3CityName:
+ db "ORANIA CITY@"
+
+Gym3LeaderName:
+ db "MAJOR BOB@"
+
+VermilionGymScript_5ca6d:
+ CheckEvent EVENT_2ND_LOCK_OPENED
+ jr nz, .asm_5ca78
+ ld a, $24
+ jr .asm_5ca7f
+.asm_5ca78
+ ld a, SFX_GO_INSIDE
+ call PlaySound
+ ld a, $5
+.asm_5ca7f
+ ld [wNewTileBlockID], a
+ lb bc, 2, 2
+ predef_jump ReplaceTileBlock
+
+VermilionGymScript_5ca8a:
+ xor a
+ ld [wJoyIgnore], a
+ ld [wVermilionGymCurScript], a
+ ld [wCurMapScript], a
+ ret
+
+VermilionGymScriptPointers:
+ dw CheckFightingMapTrainers
+ dw DisplayEnemyTrainerTextAndStartBattle
+ dw EndTrainerBattle
+ dw VermilionGymScript3
+
+VermilionGymScript3:
+ ld a, [wIsInBattle]
+ cp $ff
+ jp z, VermilionGymScript_5ca8a
+ ld a, $f0
+ ld [wJoyIgnore], a
+
+VermilionGymScript_5caaa:
+ ld a, $6
+ ld [hSpriteIndexOrTextID], a
+ call DisplayTextID
+ SetEvent EVENT_BEAT_LT_SURGE
+ lb bc, TM_24, 1
+ call GiveItem
+ jr nc, .BagFull
+ ld a, $7
+ ld [hSpriteIndexOrTextID], a
+ call DisplayTextID
+ SetEvent EVENT_GOT_TM24
+ jr .asm_5cad3
+.BagFull
+ ld a, $8
+ ld [hSpriteIndexOrTextID], a
+ call DisplayTextID
+.asm_5cad3
+ ld hl, wObtainedBadges
+ set 2, [hl]
+ ld hl, wBeatGymFlags
+ set 2, [hl]
+
+ ; deactivate gym trainers
+ SetEventRange EVENT_BEAT_VERMILION_GYM_TRAINER_0, EVENT_BEAT_VERMILION_GYM_TRAINER_2
+
+ jp VermilionGymScript_5ca8a
+
+VermilionGymTextPointers:
+ dw VermilionGymText1
+ dw VermilionGymText2
+ dw VermilionGymText3
+ dw VermilionGymText4
+ dw VermilionGymText5
+ dw VermilionGymText6
+ dw VermilionGymText7
+ dw VermilionGymText8
+
+VermilionGymTrainerHeader0:
+ dbEventFlagBit EVENT_BEAT_VERMILION_GYM_TRAINER_0
+ db ($3 << 4) ; trainer's view range
+ dwEventFlagAddress EVENT_BEAT_VERMILION_GYM_TRAINER_0
+ dw VermilionGymBattleText1 ; TextBeforeBattle
+ dw VermilionGymAfterBattleText1 ; TextAfterBattle
+ dw VermilionGymEndBattleText1 ; TextEndBattle
+ dw VermilionGymEndBattleText1 ; TextEndBattle
+
+VermilionGymTrainerHeader1:
+ dbEventFlagBit EVENT_BEAT_VERMILION_GYM_TRAINER_1
+ db ($2 << 4) ; trainer's view range
+ dwEventFlagAddress EVENT_BEAT_VERMILION_GYM_TRAINER_1
+ dw VermilionGymBattleText2 ; TextBeforeBattle
+ dw VermilionGymAfterBattleText2 ; TextAfterBattle
+ dw VermilionGymEndBattleText2 ; TextEndBattle
+ dw VermilionGymEndBattleText2 ; TextEndBattle
+
+VermilionGymTrainerHeader2:
+ dbEventFlagBit EVENT_BEAT_VERMILION_GYM_TRAINER_2
+ db ($3 << 4) ; trainer's view range
+ dwEventFlagAddress EVENT_BEAT_VERMILION_GYM_TRAINER_2
+ dw VermilionGymBattleText3 ; TextBeforeBattle
+ dw VermilionGymAfterBattleText3 ; TextAfterBattle
+ dw VermilionGymEndBattleText3 ; TextEndBattle
+ dw VermilionGymEndBattleText3 ; TextEndBattle
+
+ db $ff
+
+VermilionGymText1:
+ TX_ASM
+ CheckEvent EVENT_BEAT_LT_SURGE
+ jr z, .asm_5cb39
+ CheckEventReuseA EVENT_GOT_TM24
+ jr nz, .asm_5cb31
+ call z, VermilionGymScript_5caaa
+ call DisableWaitingAfterTextDisplay
+ jr .asm_5cb6a
+.asm_5cb31
+ ld hl, VermilionGymText_5cb72
+ call PrintText
+ jr .asm_5cb6a
+.asm_5cb39
+ ld hl, VermilionGymText_5cb6d
+ call PrintText
+ ld hl, wd72d
+ set 6, [hl]
+ set 7, [hl]
+ ld hl, ReceivedThunderbadgeText
+ ld de, ReceivedThunderbadgeText
+ call SaveEndBattleTextPointers
+ ld a, [H_SPRITEINDEX]
+ ld [wSpriteIndex], a
+ call EngageMapTrainer
+ call InitBattleEnemyParameters
+ ld a, $3
+ ld [wGymLeaderNo], a
+ xor a
+ ld [hJoyHeld], a
+ ld a, $3
+ ld [wVermilionGymCurScript], a
+ ld [wCurMapScript], a
+.asm_5cb6a
+ jp TextScriptEnd
+
+VermilionGymText_5cb6d:
+ TX_FAR _VermilionGymText_5cb6d
+ db "@"
+
+VermilionGymText_5cb72:
+ TX_FAR _VermilionGymText_5cb72
+ db "@"
+
+VermilionGymText6:
+ TX_FAR _VermilionGymText_5cb77
+ db "@"
+
+VermilionGymText7:
+ TX_FAR _ReceivedTM24Text
+ TX_SFX_KEY_ITEM
+ TX_FAR _TM24ExplanationText
+ db "@"
+
+VermilionGymText8:
+ TX_FAR _TM24NoRoomText
+ db "@"
+
+ReceivedThunderbadgeText:
+ TX_FAR _ReceivedThunderbadgeText
+ db "@"
+
+VermilionGymText2:
+ TX_ASM
+ ld hl, VermilionGymTrainerHeader0
+ call TalkToTrainer
+ jp TextScriptEnd
+
+VermilionGymBattleText1:
+ TX_FAR _VermilionGymBattleText1
+ db "@"
+
+VermilionGymEndBattleText1:
+ TX_FAR _VermilionGymEndBattleText1
+ db "@"
+
+VermilionGymAfterBattleText1:
+ TX_FAR _VermilionGymAfterBattleText1
+ db "@"
+
+VermilionGymText3:
+ TX_ASM
+ ld hl, VermilionGymTrainerHeader1
+ call TalkToTrainer
+ jp TextScriptEnd
+
+VermilionGymBattleText2:
+ TX_FAR _VermilionGymBattleText2
+ db "@"
+
+VermilionGymEndBattleText2:
+ TX_FAR _VermilionGymEndBattleText2
+ db "@"
+
+VermilionGymAfterBattleText2:
+ TX_FAR _VermilionGymAfterBattleText2
+ db "@"
+
+VermilionGymText4:
+ TX_ASM
+ ld hl, VermilionGymTrainerHeader2
+ call TalkToTrainer
+ jp TextScriptEnd
+
+VermilionGymBattleText3:
+ TX_FAR _VermilionGymBattleText3
+ db "@"
+
+VermilionGymEndBattleText3:
+ TX_FAR _VermilionGymEndBattleText3
+ db "@"
+
+VermilionGymAfterBattleText3:
+ TX_FAR _VermilionGymAfterBattleText3
+ db "@"
+
+VermilionGymText5:
+ TX_ASM
+ ld a, [wBeatGymFlags]
+ bit 2, a
+ jr nz, .asm_5cbeb
+ ld hl, VermilionGymText_5cbf4
+ call PrintText
+ jr .asm_5cbf1
+.asm_5cbeb
+ ld hl, VermilionGymText_5cbf9
+ call PrintText
+.asm_5cbf1
+ jp TextScriptEnd
+
+VermilionGymText_5cbf4:
+ TX_FAR _VermilionGymText_5cbf4
+ db "@"
+
+VermilionGymText_5cbf9:
+ TX_FAR _VermilionGymText_5cbf9
+ db "@"
diff --git a/de/scripts/viridiangym.asm b/de/scripts/viridiangym.asm
new file mode 100755
index 00000000..059a180d
--- /dev/null
+++ b/de/scripts/viridiangym.asm
@@ -0,0 +1,496 @@
+ViridianGymScript:
+ ld hl, Gym8CityName
+ ld de, Gym8LeaderName
+ call LoadGymLeaderAndCityName
+ call EnableAutoTextBoxDrawing
+ ld hl, ViridianGymTrainerHeader0
+ ld de, ViridianGymScriptPointers
+ ld a, [wViridianGymCurScript]
+ call ExecuteCurMapScriptInTable
+ ld [wViridianGymCurScript], a
+ ret
+
+Gym8CityName:
+ db "VERTANIA CITY@"
+Gym8LeaderName:
+ db "GIOVANNI@"
+
+ViridianGymScript_748d6:
+ xor a
+ ld [wJoyIgnore], a
+ ld [wViridianGymCurScript], a
+ ld [wCurMapScript], a
+ ret
+
+ViridianGymScriptPointers:
+ dw ViridianGymScript0
+ dw DisplayEnemyTrainerTextAndStartBattle
+ dw EndTrainerBattle
+ dw ViridianGymScript3
+ dw ViridianGymScript4
+
+ViridianGymScript0:
+ ld a, [wYCoord]
+ ld b, a
+ ld a, [wXCoord]
+ ld c, a
+ ld hl, ViridianGymArrowTilePlayerMovement
+ call DecodeArrowMovementRLE
+ cp $ff
+ jp z, CheckFightingMapTrainers
+ call StartSimulatingJoypadStates
+ ld hl, wd736
+ set 7, [hl]
+ ld a, SFX_ARROW_TILES
+ call PlaySound
+ ld a, $ff
+ ld [wJoyIgnore], a
+ ld a, $4
+ ld [wCurMapScript], a
+ ret
+
+;format:
+;db y,x
+;dw pointer to movement
+ViridianGymArrowTilePlayerMovement:
+ db $b,$13
+ dw ViridianGymArrowMovement1
+ db $1,$13
+ dw ViridianGymArrowMovement2
+ db $2,$12
+ dw ViridianGymArrowMovement3
+ db $2,$b
+ dw ViridianGymArrowMovement4
+ db $a,$10
+ dw ViridianGymArrowMovement5
+ db $6,$4
+ dw ViridianGymArrowMovement6
+ db $d,$5
+ dw ViridianGymArrowMovement7
+ db $e,$4
+ dw ViridianGymArrowMovement8
+ db $f,$0
+ dw ViridianGymArrowMovement9
+ db $f,$1
+ dw ViridianGymArrowMovement10
+ db $10,$d
+ dw ViridianGymArrowMovement11
+ db $11,$d
+ dw ViridianGymArrowMovement12
+ db $FF
+
+;format: direction, count
+ViridianGymArrowMovement1:
+ db D_UP,$09,$FF
+
+ViridianGymArrowMovement2:
+ db D_LEFT,$08,$FF
+
+ViridianGymArrowMovement3:
+ db D_DOWN,$09,$FF
+
+ViridianGymArrowMovement4:
+ db D_RIGHT,$06,$FF
+
+ViridianGymArrowMovement5:
+ db D_DOWN,$02,$FF
+
+ViridianGymArrowMovement6:
+ db D_DOWN,$07,$FF
+
+ViridianGymArrowMovement7:
+ db D_RIGHT,$08,$FF
+
+ViridianGymArrowMovement8:
+ db D_RIGHT,$09,$FF
+
+ViridianGymArrowMovement9:
+ db D_UP,$08,$FF
+
+ViridianGymArrowMovement10:
+ db D_UP,$06,$FF
+
+ViridianGymArrowMovement11:
+ db D_LEFT,$06,$FF
+
+ViridianGymArrowMovement12:
+ db D_LEFT,$0C,$FF
+
+ViridianGymScript4:
+ ld a, [wSimulatedJoypadStatesIndex]
+ and a
+ jr nz, .asm_74980
+ xor a
+ ld [wJoyIgnore], a
+ ld hl, wd736
+ res 7, [hl]
+ ld a, $0
+ ld [wCurMapScript], a
+ ret
+.asm_74980
+ jpba LoadSpinnerArrowTiles
+
+ViridianGymScript3:
+ ld a, [wIsInBattle]
+ cp $ff
+ jp z, ViridianGymScript_748d6
+ ld a, $f0
+ ld [wJoyIgnore], a
+ViridianGymScript3_74995:
+ ld a, $c
+ ld [hSpriteIndexOrTextID], a
+ call DisplayTextID
+ SetEvent EVENT_BEAT_VIRIDIAN_GYM_GIOVANNI
+ lb bc, TM_27, 1
+ call GiveItem
+ jr nc, .BagFull
+ ld a, $d
+ ld [hSpriteIndexOrTextID], a
+ call DisplayTextID
+ SetEvent EVENT_GOT_TM27
+ jr .asm_749be
+.BagFull
+ ld a, $e
+ ld [hSpriteIndexOrTextID], a
+ call DisplayTextID
+.asm_749be
+ ld hl, wObtainedBadges
+ set 7, [hl]
+ ld hl, wBeatGymFlags
+ set 7, [hl]
+
+ ; deactivate gym trainers
+ SetEventRange EVENT_BEAT_VIRIDIAN_GYM_TRAINER_0, EVENT_BEAT_VIRIDIAN_GYM_TRAINER_7
+
+ ld a, HS_ROUTE_22_RIVAL_2
+ ld [wMissableObjectIndex], a
+ predef ShowObject
+ SetEvents EVENT_2ND_ROUTE22_RIVAL_BATTLE, EVENT_ROUTE22_RIVAL_WANTS_BATTLE
+ jp ViridianGymScript_748d6
+
+ViridianGymTextPointers:
+ dw ViridianGymText1
+ dw ViridianGymText2
+ dw ViridianGymText3
+ dw ViridianGymText4
+ dw ViridianGymText5
+ dw ViridianGymText6
+ dw ViridianGymText7
+ dw ViridianGymText8
+ dw ViridianGymText9
+ dw ViridianGymText10
+ dw PickUpItemText
+ dw ViridianGymText12
+ dw ViridianGymText13
+ dw ViridianGymText14
+
+ViridianGymTrainerHeader0:
+ dbEventFlagBit EVENT_BEAT_VIRIDIAN_GYM_TRAINER_0
+ db ($4 << 4) ; trainer's view range
+ dwEventFlagAddress EVENT_BEAT_VIRIDIAN_GYM_TRAINER_0
+ dw ViridianGymBattleText1 ; TextBeforeBattle
+ dw ViridianGymAfterBattleText1 ; TextAfterBattle
+ dw ViridianGymEndBattleText1 ; TextEndBattle
+ dw ViridianGymEndBattleText1 ; TextEndBattle
+
+ViridianGymTrainerHeader1:
+ dbEventFlagBit EVENT_BEAT_VIRIDIAN_GYM_TRAINER_1
+ db ($4 << 4) ; trainer's view range
+ dwEventFlagAddress EVENT_BEAT_VIRIDIAN_GYM_TRAINER_1
+ dw ViridianGymBattleText2 ; TextBeforeBattle
+ dw ViridianGymAfterBattleText2 ; TextAfterBattle
+ dw ViridianGymEndBattleText2 ; TextEndBattle
+ dw ViridianGymEndBattleText2 ; TextEndBattle
+
+ViridianGymTrainerHeader2:
+ dbEventFlagBit EVENT_BEAT_VIRIDIAN_GYM_TRAINER_2
+ db ($4 << 4) ; trainer's view range
+ dwEventFlagAddress EVENT_BEAT_VIRIDIAN_GYM_TRAINER_2
+ dw ViridianGymBattleText3 ; TextBeforeBattle
+ dw ViridianGymAfterBattleText3 ; TextAfterBattle
+ dw ViridianGymEndBattleText3 ; TextEndBattle
+ dw ViridianGymEndBattleText3 ; TextEndBattle
+
+ViridianGymTrainerHeader3:
+ dbEventFlagBit EVENT_BEAT_VIRIDIAN_GYM_TRAINER_3
+ db ($2 << 4) ; trainer's view range
+ dwEventFlagAddress EVENT_BEAT_VIRIDIAN_GYM_TRAINER_3
+ dw ViridianGymBattleText4 ; TextBeforeBattle
+ dw ViridianGymAfterBattleText4 ; TextAfterBattle
+ dw ViridianGymEndBattleText4 ; TextEndBattle
+ dw ViridianGymEndBattleText4 ; TextEndBattle
+
+ViridianGymTrainerHeader4:
+ dbEventFlagBit EVENT_BEAT_VIRIDIAN_GYM_TRAINER_4
+ db ($3 << 4) ; trainer's view range
+ dwEventFlagAddress EVENT_BEAT_VIRIDIAN_GYM_TRAINER_4
+ dw ViridianGymBattleText5 ; TextBeforeBattle
+ dw ViridianGymAfterBattleText5 ; TextAfterBattle
+ dw ViridianGymEndBattleText5 ; TextEndBattle
+ dw ViridianGymEndBattleText5 ; TextEndBattle
+
+ViridianGymTrainerHeader5:
+ dbEventFlagBit EVENT_BEAT_VIRIDIAN_GYM_TRAINER_5
+ db ($4 << 4) ; trainer's view range
+ dwEventFlagAddress EVENT_BEAT_VIRIDIAN_GYM_TRAINER_5
+ dw ViridianGymBattleText6 ; TextBeforeBattle
+ dw ViridianGymAfterBattleText6 ; TextAfterBattle
+ dw ViridianGymEndBattleText6 ; TextEndBattle
+ dw ViridianGymEndBattleText6 ; TextEndBattle
+
+ViridianGymTrainerHeader6:
+ dbEventFlagBit EVENT_BEAT_VIRIDIAN_GYM_TRAINER_6, 1
+ db ($3 << 4) ; trainer's view range
+ dwEventFlagAddress EVENT_BEAT_VIRIDIAN_GYM_TRAINER_6, 1
+ dw ViridianGymBattleText7 ; TextBeforeBattle
+ dw ViridianGymAfterBattleText7 ; TextAfterBattle
+ dw ViridianGymEndBattleText7 ; TextEndBattle
+ dw ViridianGymEndBattleText7 ; TextEndBattle
+
+ViridianGymTrainerHeader7:
+ dbEventFlagBit EVENT_BEAT_VIRIDIAN_GYM_TRAINER_7, 1
+ db ($4 << 4) ; trainer's view range
+ dwEventFlagAddress EVENT_BEAT_VIRIDIAN_GYM_TRAINER_7, 1
+ dw ViridianGymBattleText8 ; TextBeforeBattle
+ dw ViridianGymAfterBattleText8 ; TextAfterBattle
+ dw ViridianGymEndBattleText8 ; TextEndBattle
+ dw ViridianGymEndBattleText8 ; TextEndBattle
+
+ db $ff
+
+ViridianGymText1:
+ TX_ASM
+ CheckEvent EVENT_BEAT_VIRIDIAN_GYM_GIOVANNI
+ jr z, .asm_6de66
+ CheckEventReuseA EVENT_GOT_TM27
+ jr nz, .asm_9fc95
+ call z, ViridianGymScript3_74995
+ call DisableWaitingAfterTextDisplay
+ jr .asm_6dff7
+.asm_9fc95
+ ld a, $1
+ ld [wDoNotWaitForButtonPressAfterDisplayingText], a
+ ld hl, ViridianGymText_74ad9
+ call PrintText
+ call GBFadeOutToBlack
+ ld a, HS_VIRIDIAN_GYM_GIOVANNI
+ ld [wMissableObjectIndex], a
+ predef HideObject
+ call UpdateSprites
+ call Delay3
+ call GBFadeInFromBlack
+ jr .asm_6dff7
+.asm_6de66
+ ld hl, ViridianGymText_74ace
+ call PrintText
+ ld hl, wd72d
+ set 6, [hl]
+ set 7, [hl]
+ ld hl, ViridianGymText_74ad3
+ ld de, ViridianGymText_74ad3
+ call SaveEndBattleTextPointers
+ ld a, [H_SPRITEINDEX]
+ ld [wSpriteIndex], a
+ call EngageMapTrainer
+ call InitBattleEnemyParameters
+ ld a, $8
+ ld [wGymLeaderNo], a
+ ld a, $3
+ ld [wViridianGymCurScript], a
+.asm_6dff7
+ jp TextScriptEnd
+
+ViridianGymText_74ace:
+ TX_FAR _ViridianGymText_74ace
+ db "@"
+
+ViridianGymText_74ad3:
+ TX_FAR _ViridianGymText_74ad3
+ TX_SFX_LEVEL_UP ; probably supposed to play SFX_GET_ITEM_1 but the wrong music bank is loaded
+ db "@"
+
+ViridianGymText_74ad9:
+ TX_FAR _ViridianGymText_74ad9
+ TX_WAIT
+ db "@"
+
+ViridianGymText12:
+ TX_FAR _ViridianGymText12
+ db "@"
+
+ViridianGymText13:
+ TX_FAR _ReceivedTM27Text
+ TX_SFX_ITEM_1
+
+TM27ExplanationText:
+ TX_FAR _TM27ExplanationText
+ db "@"
+
+ViridianGymText14:
+ TX_FAR _TM27NoRoomText
+ db "@"
+
+ViridianGymText2:
+ TX_ASM
+ ld hl, ViridianGymTrainerHeader0
+ call TalkToTrainer
+ jp TextScriptEnd
+
+ViridianGymBattleText1:
+ TX_FAR _ViridianGymBattleText1
+ db "@"
+
+ViridianGymEndBattleText1:
+ TX_FAR _ViridianGymEndBattleText1
+ db "@"
+
+ViridianGymAfterBattleText1:
+ TX_FAR _ViridianGymAfterBattleText1
+ db "@"
+
+ViridianGymText3:
+ TX_ASM
+ ld hl, ViridianGymTrainerHeader1
+ call TalkToTrainer
+ jp TextScriptEnd
+
+ViridianGymBattleText2:
+ TX_FAR _ViridianGymBattleText2
+ db "@"
+
+ViridianGymEndBattleText2:
+ TX_FAR _ViridianGymEndBattleText2
+ db "@"
+
+ViridianGymAfterBattleText2:
+ TX_FAR _ViridianGymAfterBattleText2
+ db "@"
+
+ViridianGymText4:
+ TX_ASM
+ ld hl, ViridianGymTrainerHeader2
+ call TalkToTrainer
+ jp TextScriptEnd
+
+ViridianGymBattleText3:
+ TX_FAR _ViridianGymBattleText3
+ db "@"
+
+ViridianGymEndBattleText3:
+ TX_FAR _ViridianGymEndBattleText3
+ db "@"
+
+ViridianGymAfterBattleText3:
+ TX_FAR _ViridianGymAfterBattleText3
+ db "@"
+
+ViridianGymText5:
+ TX_ASM
+ ld hl, ViridianGymTrainerHeader3
+ call TalkToTrainer
+ jp TextScriptEnd
+
+ViridianGymBattleText4:
+ TX_FAR _ViridianGymBattleText4
+ db "@"
+
+ViridianGymEndBattleText4:
+ TX_FAR _ViridianGymEndBattleText4
+ db "@"
+
+ViridianGymAfterBattleText4:
+ TX_FAR _ViridianGymAfterBattleText4
+ db "@"
+
+ViridianGymText6:
+ TX_ASM
+ ld hl, ViridianGymTrainerHeader4
+ call TalkToTrainer
+ jp TextScriptEnd
+
+ViridianGymBattleText5:
+ TX_FAR _ViridianGymBattleText5
+ db "@"
+
+ViridianGymEndBattleText5:
+ TX_FAR _ViridianGymEndBattleText5
+ db "@"
+
+ViridianGymAfterBattleText5:
+ TX_FAR _ViridianGymAfterBattleText5
+ db "@"
+
+ViridianGymText7:
+ TX_ASM
+ ld hl, ViridianGymTrainerHeader5
+ call TalkToTrainer
+ jp TextScriptEnd
+
+ViridianGymBattleText6:
+ TX_FAR _ViridianGymBattleText6
+ db "@"
+
+ViridianGymEndBattleText6:
+ TX_FAR _ViridianGymEndBattleText6
+ db "@"
+
+ViridianGymAfterBattleText6:
+ TX_FAR _ViridianGymAfterBattleText6
+ db "@"
+
+ViridianGymText8:
+ TX_ASM
+ ld hl, ViridianGymTrainerHeader6
+ call TalkToTrainer
+ jp TextScriptEnd
+
+ViridianGymBattleText7:
+ TX_FAR _ViridianGymBattleText7
+ db "@"
+
+ViridianGymEndBattleText7:
+ TX_FAR _ViridianGymEndBattleText7
+ db "@"
+
+ViridianGymAfterBattleText7:
+ TX_FAR _ViridianGymAfterBattleText7
+ db "@"
+
+ViridianGymText9:
+ TX_ASM
+ ld hl, ViridianGymTrainerHeader7
+ call TalkToTrainer
+ jp TextScriptEnd
+
+ViridianGymBattleText8:
+ TX_FAR _ViridianGymBattleText8
+ db "@"
+
+ViridianGymEndBattleText8:
+ TX_FAR _ViridianGymEndBattleText8
+ db "@"
+
+ViridianGymAfterBattleText8:
+ TX_FAR _ViridianGymAfterBattleText8
+ db "@"
+
+ViridianGymText10:
+ TX_ASM
+ CheckEvent EVENT_BEAT_VIRIDIAN_GYM_GIOVANNI
+ jr nz, .asm_1abd1
+ ld hl, ViridianGymText_74bd4
+ call PrintText
+ jr .asm_6064d
+.asm_1abd1
+ ld hl, ViridianGymText_74bd9
+ call PrintText
+.asm_6064d
+ jp TextScriptEnd
+
+ViridianGymText_74bd4:
+ TX_FAR _ViridianGymText_74bd4
+ db "@"
+
+ViridianGymText_74bd9:
+ TX_FAR _ViridianGymText_74bd9
+ db "@"