shithub: pokecrystal

Download patch

ref: c76a3c6ecd36d650a1715c0f5520c2336bd27f9c
parent: d6a4dada406f8ee010f08a16d24907bde50e1d6c
author: JimB16 <f1@jimb.de>
date: Fri Sep 4 18:30:40 EDT 2015

changed more labels

--- a/battle/ai/items.asm
+++ b/battle/ai/items.asm
@@ -21,7 +21,7 @@
 	jr nz, DontSwitch
 
 	ld hl, TrainerClassAttributes + 5
-	ld a, [wcfc0]
+	ld a, [InBattleTowerBattle] ; Load always the first TrainerClass for BattleTower-Trainers
 	and a
 	jr nz, .ok
 	ld a, [TrainerClass]
@@ -157,7 +157,8 @@
 
 
 AI_TryItem: ; 38105
-	ld a, [wcfc0]
+	; items are not allowed in the BattleTower
+	ld a, [InBattleTowerBattle]
 	and a
 	ret nz
 
--- a/battle/core.asm
+++ b/battle/core.asm
@@ -2462,7 +2462,7 @@
 	ld a, [InLinkBattle]
 	and a
 	ret nz
-	ld a, [wcfc0]
+	ld a, [InBattleTowerBattle]
 	bit 0, a
 	jr nz, .asm_3d006
 	call Function3ebd8
@@ -3068,7 +3068,7 @@
 	ld a, 1
 	ld [BattleEnded], a
 
-	ld a, [wcfc0]
+	ld a, [InBattleTowerBattle]
 	bit 0, a
 	jr nz, .asm_3d3bd
 
@@ -5175,7 +5175,7 @@
 	and a
 	jp nz, ItemsCantBeUsed
 
-	ld a, [wcfc0]
+	ld a, [InBattleTowerBattle]
 	and a
 	jp nz, ItemsCantBeUsed
 
@@ -6214,7 +6214,8 @@
 	and a
 	jp nz, Function3dabd
 
-	ld a, [wcfc0] ; ????
+; and also not in a BattleTower-Battle
+	ld a, [InBattleTowerBattle] ; ????
 	bit 0, a
 	jp nz, Function3dabd
 
@@ -7107,7 +7108,7 @@
 	and a
 	ret nz
 
-	ld a, [wcfc0]
+	ld a, [InBattleTowerBattle]
 	and a
 	ret nz
 
@@ -7329,7 +7330,7 @@
 	and a
 	ret nz
 
-	ld a, [wcfc0]
+	ld a, [InBattleTowerBattle]
 	bit 0, a
 	ret nz
 
@@ -8716,7 +8717,7 @@
 	call Function3d0be
 	ld hl, BattleText_0x80730
 	call StdBattleTextBox
-	ld a, [wcfc0]
+	ld a, [InBattleTowerBattle]
 	bit 0, a
 	ret z
 	call ClearTileMap
--- a/battle/effect_commands.asm
+++ b/battle/effect_commands.asm
@@ -700,7 +700,7 @@
 	and a
 	ret nz
 
-	ld a, [wcfc0]
+	ld a, [InBattleTowerBattle]
 	and a
 	ret nz
 
@@ -3841,7 +3841,7 @@
 	and a
 	jr nz, .asm_35532
 
-	ld a, [wcfc0]
+	ld a, [InBattleTowerBattle]
 	and a
 	jr nz, .asm_35532
 
@@ -5544,7 +5544,7 @@
 
 	call AnimateCurrentMove
 	ld b, $7
-	ld a, [wcfc0]
+	ld a, [InBattleTowerBattle]
 	and a
 	jr z, .asm_35ea4
 	ld b, $3
@@ -5587,7 +5587,7 @@
 	and a
 	jr nz, .asm_35eec
 
-	ld a, [wcfc0]
+	ld a, [InBattleTowerBattle]
 	and a
 	jr nz, .asm_35eec
 
@@ -5676,18 +5676,23 @@
 	call GetBattleVar
 	and a
 	jr nz, .asm_35fb8
+
 	ld a, [hBattleTurn]
 	and a
 	jr z, .asm_35f89
+
 	ld a, [InLinkBattle]
 	and a
 	jr nz, .asm_35f89
-	ld a, [wcfc0]
+
+	ld a, [InBattleTowerBattle]
 	and a
 	jr nz, .asm_35f89
+
 	ld a, [PlayerSubStatus5]
 	bit SUBSTATUS_LOCK_ON, a
 	jr nz, .asm_35f89
+
 	call BattleRandom
 	cp $40
 	jr c, .asm_35fb8
@@ -6323,11 +6328,12 @@
 	ld a, [hBattleTurn]
 	and a
 	jr z, .DidntMiss
+
 	ld a, [InLinkBattle]
 	and a
 	jr nz, .DidntMiss
 
-	ld a, [wcfc0]
+	ld a, [InBattleTowerBattle]
 	and a
 	jr nz, .DidntMiss
 
@@ -8168,18 +8174,23 @@
 	ld a, [hBattleTurn]
 	and a
 	jr z, .asm_36e0e
+
 	ld a, [InLinkBattle]
 	and a
 	jr nz, .asm_36e0e
-	ld a, [wcfc0]
+
+	ld a, [InBattleTowerBattle]
 	and a
 	jr nz, .asm_36e0e
+
 	ld a, [PlayerSubStatus5]
 	bit SUBSTATUS_LOCK_ON, a
 	jr nz, .asm_36e0e
+
 	call BattleRandom
 	cp $40
 	jr c, .asm_36e52
+
 .asm_36e0e
 	ld a, BATTLE_VARS_STATUS_OPP
 	call GetBattleVarAddr
--- a/main.asm
+++ b/main.asm
@@ -35575,7 +35575,7 @@
 
 
 ReadTrainerParty: ; 39771
-	ld a, [wcfc0]
+	ld a, [InBattleTowerBattle]
 	bit 0, a
 	ret nz
 
@@ -35906,7 +35906,7 @@
 
 
 Battle_GetTrainerName:: ; 39939
-	ld a, [wcfc0]
+	ld a, [InBattleTowerBattle]
 	bit 0, a
 	ld hl, wd26b
 	jp nz, CopyTrainerName
@@ -36818,7 +36818,9 @@
 .ApplyLayers
 	ld hl, TrainerClassAttributes + 3
 
-	ld a, [wcfc0]
+	; If we have a battle in BattleTower just load the Attributes of the first TrainerClass (Falkner)
+	; so we have always the same AI, regardless of the loaded cass of trainer
+	ld a, [InBattleTowerBattle]
 	bit 0, a
 	jr nz, .asm_4412f
 
@@ -87453,7 +87455,7 @@
 	and a
 	ret nz
 
-	ld a, [wcfc0]
+	ld a, [InBattleTowerBattle]
 	and a
 	ret nz
 
--- a/misc/mobile_45.asm
+++ b/misc/mobile_45.asm
@@ -16530,7 +16530,7 @@
 	sub $19
 
 .asm_11c021
-	ld hl, Unknown_11f332
+	ld hl, BTTrainerTexts
 	jr .asm_11c033
 
 .asm_11c026
@@ -20672,14 +20672,14 @@
 	db $01, $01, $00, $00, $00, $01
 
 
-Unknown_11f332:
-	dw Unknown_11f338
-	dw Unknown_11f36a
-	dw Unknown_11f39c
+BTTrainerTexts: ; 11f332
+	dw BTTrainerGreetings
+	dw BTTrainerPlayerLostTexts
+	dw BTTrainerPlayerWonTexts
 
-Unknown_11f338: ; 11f338
-	dw UnknownText_0x11f42e
-	dw UnknownText_0x11f43d
+BTTrainerGreetings: ; 11f338
+	dw BattleTowerTextJump_0x11f42e
+	dw BattleTowerTextJump_0x11f43d
 	dw UnknownText_0x11f44c
 	dw UnknownText_0x11f45b
 	dw UnknownText_0x11f46a
@@ -20704,8 +20704,8 @@
 	dw UnknownText_0x11f587
 	dw UnknownText_0x11f596
 
-Unknown_11f36a: ; 11f36a
-	dw UnknownText_0x11f433
+BTTrainerPlayerLostTexts: ; 11f36a
+	dw BattleTowerTextJump_0x11f433
 	dw UnknownText_0x11f442
 	dw UnknownText_0x11f451
 	dw UnknownText_0x11f460
@@ -20731,7 +20731,7 @@
 	dw UnknownText_0x11f58c
 	dw UnknownText_0x11f59b
 
-Unknown_11f39c: ; 11f39c
+BTTrainerPlayerWonTexts: ; 11f39c
 	dw UnknownText_0x11f438
 	dw UnknownText_0x11f447
 	dw UnknownText_0x11f456
@@ -20816,12 +20816,12 @@
 	dw UnknownText_0x11f681
 
 
-UnknownText_0x11f42e: ; 0x11f42e
-	text_jump UnknownText_0x1ec000
+BattleTowerTextJump_0x11f42e: ; 0x11f42e
+	text_jump BattleTowerText_0x1ec000
 	db "@"
 
-UnknownText_0x11f433: ; 0x11f433
-	text_jump UnknownText_0x1ec03b
+BattleTowerTextJump_0x11f433: ; 0x11f433
+	text_jump BattleTowerText_0x1ec03b
 	db "@"
 
 UnknownText_0x11f438: ; 0x11f438
@@ -20828,8 +20828,8 @@
 	text_jump UnknownText_0x1ec060
 	db "@"
 
-UnknownText_0x11f43d: ; 0x11f43d
-	text_jump UnknownText_0x1ec080
+BattleTowerTextJump_0x11f43d: ; 0x11f43d
+	text_jump BattleTowerText_0x1ec080
 	db "@"
 
 UnknownText_0x11f442: ; 0x11f442
@@ -22804,7 +22804,7 @@
 
 Function17022c: ; 17022c
 .asm_17022c
-	call Function17023a
+	call Jumpto_BattleTowerBattleFunction
 	call DelayFrame
 	ld a, [wcf63]
 	cp $1
@@ -22812,11 +22812,11 @@
 	ret
 ; 17023a
 
-Function17023a: ; 17023a
+Jumpto_BattleTowerBattleFunction: ; 17023a
 	ld a, [wcf63]
 	ld e, a
 	ld d, 0
-	ld hl, Jumptable_170249
+	ld hl, Jumptable_BattleTowerBattleFunctions
 rept 2
 	add hl, de
 endr
@@ -22826,20 +22826,20 @@
 	jp [hl]
 ; 170249
 
-Jumptable_170249: ; 170249
-	dw Function17024d
-	dw Function1704c9
+Jumptable_BattleTowerBattleFunctions: ; 170249
+	dw RunBattleTowerBattle
+	dw SkipBattleTowerBattle
 ; 17024d
 
-Function17024d: ; 17024d
+RunBattleTowerBattle: ; 17024d
 	ld a, [Options]
 	push af
 	ld hl, Options
 	set 6, [hl]
-	ld a, [wcfc0]
+	ld a, [InBattleTowerBattle]
 	push af
 	or $1
-	ld [wcfc0], a
+	ld [InBattleTowerBattle], a
 	xor a
 	ld [InLinkBattle], a
 	callba Mobile_HealParty
@@ -22867,7 +22867,7 @@
 
 .asm_1702a9
 	pop af
-	ld [wcfc0], a
+	ld [InBattleTowerBattle], a
 	pop af
 	ld [Options], a
 	ld a, $1
@@ -22875,8 +22875,8 @@
 	ret
 
 
-; Initialise the BattleTower-Trainer and his Pkmn
 Function1702b7: ; 1702b7
+; Initialise the BattleTower-Trainer and his Pkmn
 	call CopyBTTrainer_FromBT_OTrainer_TowBT_OTTempCopy
 	ld de, wBT_OTTempCopy + wBT_OTTempCopy_Pkmn1Name ; $c643
 	ld c, PKMN_NAME_LENGTH
@@ -23190,7 +23190,7 @@
 	ld hl, sNrOfBeatenBattleTowerTrainers
 	inc [hl]
 	call CloseSRAM
-Function1704c9:
+SkipBattleTowerBattle: ; 1704c9
 	ret
 ; 1704ca
 
--- a/text/battle_tower.asm
+++ b/text/battle_tower.asm
@@ -1,5 +1,5 @@
 
-UnknownText_0x1ec000: ; 0x1ec000
+BattleTowerText_0x1ec000: ; 0x1ec000
 	text "Hello, glad to"
 	line "meet you!"
 
@@ -8,7 +8,7 @@
 	done
 ; 0x1ec03b
 
-UnknownText_0x1ec03b: ; 0x1ec03b
+BattleTowerText_0x1ec03b: ; 0x1ec03b
 	text "Thank you! A most"
 	line "enjoyable battle!"
 	done
@@ -20,7 +20,7 @@
 	done
 ; 0x1ec080
 
-UnknownText_0x1ec080: ; 0x1ec080
+BattleTowerText_0x1ec080: ; 0x1ec080
 	text "Work, work, work…"
 	line "I'm always busy!"
 	done
--- a/wram.asm
+++ b/wram.asm
@@ -1279,8 +1279,14 @@
 	ds 1
 
 wcfbe:: ds 2
-wcfc0:: ds 2
 
+InBattleTowerBattle:: ; cfc0
+; 0 not in BattleTower-Battle
+; 1 BattleTower-Battle
+	ds 1
+
+	ds 1
+
 FXAnimID::
 FXAnimIDLo:: ; cfc2
 	ds 1
@@ -2618,6 +2624,7 @@
 
 SECTION "WRAM 3", WRAMX, BANK [3]
 
+w3_d000:: ; d000
 	ds $100
 
 BT_OTrainer::
@@ -2640,9 +2647,11 @@
 	ds $3b-1
 	
 	ds $24
-BT_OTrainerEnd::
+BT_OTrainerEnd:: ; we_d1e0
 	
-	ds $620
+	ds $20
+	
+	ds $600
 
 wBTChoiceOfLvlGroup::
 w3_d800:: ds 1