shithub: pokecrystal

Download patch

ref: 706f289c709b8dddd0c196e9d8a6900da34167ea
parent: 4cd118b149439919e3c99a6fbd4c02a713123089
author: JimB16 <[email protected]>
date: Mon Aug 24 21:56:30 EDT 2015

change more labelss

--- a/battle/ai/items.asm
+++ b/battle/ai/items.asm
@@ -1,4 +1,4 @@
-Function38000: ; 38000
+AI_SwitchOrTryItem: ; 38000
 	and a
 
 	ld a, [IsInBattle]
@@ -73,6 +73,7 @@
 	ld a, [wc717]
 	and $f
 	inc a
+	; In register 'a' is the number (1-6) of the Pkmn to switch to
 	ld [wc718], a
 	jp AI_TrySwitch
 ; 38083
@@ -148,7 +149,7 @@
 ; 380ff
 
 
-Function380ff: ; 380ff
+CheckSubstatusCantRun: ; 380ff
 	ld a, [EnemySubStatus5]
 	bit SUBSTATUS_CANT_RUN, a
 	ret
@@ -565,7 +566,7 @@
 	call AIUsedItemSound
 	call AI_HealStatus
 	ld a, FULL_HEAL
-	jp Function38568
+	jp PrintText_UsedItemOn_AND_AIUpdateHUD
 
 Function383ae: ; 383ae (e:43ae)
 	ld a, MAX_POTION
@@ -658,7 +659,7 @@
 .asm_38436
 
 Function38436: ; 38436
-	call Function38571
+	call PrintText_UsedItemOn
 	hlcoord 2, 2
 	xor a
 	ld [wd10a], a
@@ -715,7 +716,7 @@
 	call CopyBytes
 	pop af
 	jr c, .asm_384a3
-	ld hl, UnknownText_0x384d0
+	ld hl, TextJump_EnemyWithdrew
 	call PrintText
 .asm_384a3
 	ld a, $1
@@ -735,8 +736,8 @@
 	ret
 ; 384d0
 
-UnknownText_0x384d0: ; 384d0
-	text_jump UnknownText_0x1bcf9c
+TextJump_EnemyWithdrew: ; 384d0
+	text_jump Text_EnemyWithdrew
 	db "@"
 ; 384d5
 
@@ -744,7 +745,7 @@
 	call AIUsedItemSound
 	call AI_HealStatus
 	ld a, FULL_HEAL_RED
-	jp Function38568
+	jp PrintText_UsedItemOn_AND_AIUpdateHUD
 ; 384e0
 
 AI_HealStatus: ; 384e0
@@ -765,7 +766,7 @@
 	ld hl, EnemySubStatus4
 	set SUBSTATUS_X_ACCURACY, [hl]
 	ld a, X_ACCURACY
-	jp Function38568
+	jp PrintText_UsedItemOn_AND_AIUpdateHUD
 ; 38504
 
 Function38504: ; 38504
@@ -773,7 +774,7 @@
 	ld hl, EnemySubStatus4
 	set SUBSTATUS_MIST, [hl]
 	ld a, GUARD_SPEC
-	jp Function38568
+	jp PrintText_UsedItemOn_AND_AIUpdateHUD
 ; 38511
 
 Function38511: ; 38511
@@ -781,7 +782,7 @@
 	ld hl, EnemySubStatus4
 	set SUBSTATUS_FOCUS_ENERGY, [hl]
 	ld a, DIRE_HIT
-	jp Function38568
+	jp PrintText_UsedItemOn_AND_AIUpdateHUD
 ; 3851e
 
 Function3851e: ; 3851e
@@ -832,10 +833,14 @@
 	ld b, SP_ATTACK
 	ld a, X_SPECIAL
 
+
+; Parameter
+; a = ITEM_CONSTANT
+; b = BATTLE_CONSTANT (ATTACK, DEFENSE, SPEED, SP_ATTACK, SP_DEFENSE, ACCURACY, EVASION)
 Function38557:
 	ld [wd1f1], a
 	push bc
-	call Function38571
+	call PrintText_UsedItemOn
 	pop bc
 	callba Function361ef
 	jp AIUpdateHUD
@@ -842,13 +847,15 @@
 ; 38568
 
 
-Function38568: ; 38568
+; Parameter
+; a = ITEM_CONSTANT
+PrintText_UsedItemOn_AND_AIUpdateHUD: ; 38568
 	ld [wd1f1], a
-	call Function38571
+	call PrintText_UsedItemOn
 	jp AIUpdateHUD
 ; 38571
 
-Function38571: ; 38571
+PrintText_UsedItemOn: ; 38571
 	ld a, [wd1f1]
 	ld [wd265], a
 	call GetItemName
@@ -856,11 +863,11 @@
 	ld de, wd050
 	ld bc, ITEM_NAME_LENGTH
 	call CopyBytes
-	ld hl, UnknownText_0x3858c
+	ld hl, TextJump_EnemyUsedOn
 	jp PrintText
 ; 3858c
 
-UnknownText_0x3858c: ; 3858c
-	text_jump UnknownText_0x1bcfaf
+TextJump_EnemyUsedOn: ; 3858c
+	text_jump Text_EnemyUsedOn
 	db "@"
 ; 38591
--- a/battle/core.asm
+++ b/battle/core.asm
@@ -129,18 +129,18 @@
 	ld [wd0ee], a
 	ld a, [InLinkBattle]
 	and a
-	ld hl, BattleText_0x807bd
+	ld hl, BattleText_WildFled
 	jr z, .asm_3c115
 	ld a, [wd0ee]
 	and $c0
 	ld [wd0ee], a
-	ld hl, BattleText_0x807cf
+	ld hl, BattleText_EnemyFled
 	call Function3d2e0
 	jr nc, .asm_3c115
 	ld hl, wcd2a
 	bit 4, [hl]
 	jr nz, .asm_3c118
-	ld hl, BattleText_0x81863
+	ld hl, BattleText_LinkErrorBattleCanceled
 
 .asm_3c115
 	call StdBattleTextBox
@@ -160,6 +160,7 @@
 	ret
 ; 3c12f
 
+
 Function3c12f: ; 3c12f
 .loop
 	call Function3c1bf
@@ -939,7 +940,7 @@
 	call SetEnemyTurn
 	ld a, $1
 	ld [wc70f], a
-	callab Function38000
+	callab AI_SwitchOrTryItem
 	jr c, .asm_3c62f
 	call Function3c6de
 	call Function3d2e0
@@ -980,7 +981,7 @@
 	xor a
 	ld [wc70f], a
 	call SetEnemyTurn
-	callab Function38000
+	callab AI_SwitchOrTryItem
 	push af
 	call Function3c6cf
 	pop bc
@@ -4013,7 +4014,7 @@
 	ld hl, wcd2a
 	bit 4, [hl]
 	jr nz, .asm_3da05
-	ld hl, BattleText_0x81863
+	ld hl, BattleText_LinkErrorBattleCanceled
 	call StdBattleTextBox
 
 .asm_3da05
@@ -5160,7 +5161,7 @@
 	ld hl, wcd2a
 	bit 4, [hl]
 	jr nz, .error
-	ld hl, BattleText_0x81863
+	ld hl, BattleText_LinkErrorBattleCanceled
 	call StdBattleTextBox
 	ld c, 60
 	call DelayFrames
@@ -7327,9 +7328,11 @@
 	ld a, [InLinkBattle]
 	and a
 	ret nz
+
 	ld a, [wcfc0]
 	bit 0, a
 	ret nz
+
 	call Function3f0d4
 	xor a
 	ld [CurPartyMon], a
--- a/engine/specials.asm
+++ b/engine/specials.asm
@@ -142,7 +142,7 @@
 	add_special Function170215
 	add_special Function1704e1
 	add_special Function17021d
-	add_special Function170b44
+	add_special Function_LoadOpponentTrainerAndPokemons170b44
 	add_special Function11ba38
 	add_special SpecialCheckForBattleTowerRules
 	add_special Function117656
--- a/maps/BattleTower1F.asm
+++ b/maps/BattleTower1F.asm
@@ -67,7 +67,7 @@
 	writebyte $1
 	special Special_Menu_ChallengeExplanationCancel
 	if_equal $1, Script_ChoseChallenge
-	if_equal $2, UnknownScript_0x9e4a5
+	if_equal $2, Script_BattleTowerExplanation
 	jump UnknownScript_0x9e4b0
 
 Script_ChoseChallenge: ; 0x9e40f
@@ -116,7 +116,7 @@
 	warpcheck
 	end
 
-UnknownScript_0x9e47a:
+Script_GivePlayerHisPrize: ; 0x9e47a
 	writebyte $1c
 	special Function170687
 	writebyte $1b
@@ -124,7 +124,7 @@
 	if_equal $12, Script_YourPackIsStuffedFull
 	itemtotext $0, $1
 	giveitem $ff, $5
-	writetext UnknownText_0x9eb7e
+	writetext Text_PlayerGotFive
 	writebyte $1d
 	special Function170687
 	loadmovesprites
@@ -140,7 +140,7 @@
 	writetext Text_WouldYouLikeToHearAboutTheBattleTower
 	yesorno
 	iffalse UnknownScript_0x9e4a8
-UnknownScript_0x9e4a5:
+Script_BattleTowerExplanation: ; 0x9e4a5
 	writetext Text_BattleTowerIntroduction_2
 UnknownScript_0x9e4a8:
 	writebyte $1
@@ -479,7 +479,7 @@
 	para ""
 	done
 
-UnknownText_0x9ea49:
+Text_ThanksForVisiting: ; 0x9ea49
 	text "Thanks for"
 	line "visiting!"
 	done
@@ -502,7 +502,7 @@
 	para ""
 	done
 
-UnknownText_0x9eaef:
+Text_CongratulationsYouveBeatenAllTheTrainers: ; 0x9eaef
 	text "Congratulations!"
 
 	para "You've beaten all"
@@ -522,7 +522,7 @@
 	line "CENTER?"
 	done
 
-UnknownText_0x9eb7e:
+Text_PlayerGotFive: ; 0x9eb7e
 	text "<PLAYER> got five"
 	line "@"
 	text_from_ram StringBuffer4
@@ -699,7 +699,7 @@
 	line "tomorrow."
 	done
 
-UnknownText_0x9f0c1:
+Text_TooMuchTimeElapsedNoRegister: ; 0x9f0c1
 	text "Sorry, but it's"
 	line "not possible to"
 
--- a/maps/BattleTowerBattleRoom.asm
+++ b/maps/BattleTowerBattleRoom.asm
@@ -3,25 +3,25 @@
 	db 2
 
 	; triggers
-	dw UnknownScript_0x9f419, $0000
+	dw Script_EnterBattleRoom, $0000
 	dw UnknownScript_0x9f420, $0000
 
 .MapCallbacks:
 	db 0
 
-UnknownScript_0x9f419:
+Script_EnterBattleRoom: ; 0x9f419
 	disappear $2
-	priorityjump UnknownScript_0x9f421
+	priorityjump Script_BattleRoom
 	dotrigger $1
-
 UnknownScript_0x9f420:
 	end
 
-UnknownScript_0x9f421:
+Script_BattleRoom: ; 0x9f421
 	applymovement PLAYER, MovementData_0x9e58c
-UnknownScript_0x9f425:
+; beat all 7 opponents in a row
+Script_BattleRoomLoop: ; 0x9f425
 	writebyte $2
-	special Function170b44
+	special Function_LoadOpponentTrainerAndPokemons170b44
 	appear $2
 	warpsound
 	waitbutton
@@ -30,12 +30,12 @@
 	storetext 1
 	keeptextopen
 	loadmovesprites
-	special Function170215
+	special Function170215 ; calls predef startbattle
 	special FadeBlackBGMap
 	reloadmap
 	if_not_equal $0, UnknownScript_0x9f4c2
 	copybytetovar wcf64
-	if_equal $7, UnknownScript_0x9f4d9
+	if_equal $7, Script_BeatenAllTrainers
 	applymovement $2, MovementData_0x9e597
 	warpsound
 	disappear $2
@@ -54,17 +54,17 @@
 	loadfont
 	writetext Text_NextUpOpponentNo
 	yesorno
-	iffalse UnknownScript_0x9f483
-UnknownScript_0x9f477:
+	iffalse Script_DontBattleNextOpponent
+Script_ContinueAndBattleNextOpponent: ; 0x9f477
 	loadmovesprites
 	applymovement PLAYER, MovementData_0x9e5a9
 	applymovement $3, MovementData_0x9e5a1
-	jump UnknownScript_0x9f425
+	jump Script_BattleRoomLoop
 
-UnknownScript_0x9f483:
+Script_DontBattleNextOpponent: ; 0x9f483
 	writetext Text_SaveAndEndTheSession
 	yesorno
-	iffalse UnknownScript_0x9f4a3
+	iffalse Script_DontSaveAndEndTheSession
 	writebyte $7
 	special Function170687
 	writebyte $1f
@@ -75,10 +75,10 @@
 	waitbutton
 	special FadeBlackBGMap
 	special Reset
-UnknownScript_0x9f4a3:
+Script_DontSaveAndEndTheSession: ; 0x9f4a3
 	writetext Text_CancelYourBattleRoomChallenge
 	yesorno
-	iffalse UnknownScript_0x9f477
+	iffalse Script_ContinueAndBattleNextOpponent
 	writebyte $4
 	special Function170687
 	writebyte $6
@@ -96,25 +96,25 @@
 	writebyte $4
 	special Function170687
 	loadfont
-	writetext UnknownText_0x9ea49
+	writetext Text_ThanksForVisiting
 	closetext
 	loadmovesprites
 	end
 
-UnknownScript_0x9f4d9:
+Script_BeatenAllTrainers: ; 0x9f4d9
 	pause 60
 	special Special_BattleTowerFade
 	warpfacing $1, BATTLE_TOWER_1F, $7, $7
 BattleTowerBattleRoomScript_0x9f4e4:
 	loadfont
-	writetext UnknownText_0x9eaef
-	jump UnknownScript_0x9e47a
+	writetext Text_CongratulationsYouveBeatenAllTheTrainers
+	jump Script_GivePlayerHisPrize
 
 UnknownScript_0x9f4eb:
 	writebyte $4
 	special Function170687
 	loadfont
-	writetext UnknownText_0x9f0c1
+	writetext Text_TooMuchTimeElapsedNoRegister
 	closetext
 	loadmovesprites
 	end
@@ -125,7 +125,7 @@
 	writebyte $6
 	special Function170687
 	loadfont
-	writetext UnknownText_0x9ea49
+	writetext Text_ThanksForVisiting
 	writetext Text_WeHopeToServeYouAgain
 	closetext
 	loadmovesprites
--- a/maps/BattleTowerHallway.asm
+++ b/maps/BattleTowerHallway.asm
@@ -12,7 +12,6 @@
 UnknownScript_0x9f5bb:
 	priorityjump UnknownScript_0x9f5c1
 	dotrigger $1
-
 UnknownScript_0x9f5c0:
 	end
 
@@ -19,7 +18,7 @@
 UnknownScript_0x9f5c1:
 	follow $2, PLAYER
 	callasm Function_0x9f5cb
-	jump UnknownScript_0x9f5dc
+	jump Script_WalkToChosenBattleRoom
 
 
 Function_0x9f5cb:
@@ -36,35 +35,38 @@
 	ret
 
 
-UnknownScript_0x9f5dc:
-	if_equal $3, UnknownScript_0x9f603
-	if_equal $4, UnknownScript_0x9f603
-	if_equal $5, UnknownScript_0x9f60a
-	if_equal $6, UnknownScript_0x9f60a
-	if_equal $7, UnknownScript_0x9f611
-	if_equal $8, UnknownScript_0x9f611
-	if_equal $9, UnknownScript_0x9f618
-	if_equal $a, UnknownScript_0x9f618
+; enter different rooms for different levels to battle against
+; at least it should look like that
+; because all warps lead to the same room
+Script_WalkToChosenBattleRoom: ; 0x9f5dc
+	if_equal 3, Script_WalkToBattleRoomL30L40
+	if_equal 4, Script_WalkToBattleRoomL30L40
+	if_equal 5, Script_WalkToBattleRoomL50L60
+	if_equal 6, Script_WalkToBattleRoomL50L60
+	if_equal 7, Script_WalkToBattleRoomL70L80
+	if_equal 8, Script_WalkToBattleRoomL70L80
+	if_equal 9, Script_WalkToBattleRoomL90L100
+	if_equal 10, Script_WalkToBattleRoomL90L100
 	applymovement $2, MovementData_0x9e57a
-	jump UnknownScript_0x9f61f
+	jump Script_PlayerEntersBattleRoom
 
-UnknownScript_0x9f603:
+Script_WalkToBattleRoomL30L40: ; 0x9f603
 	applymovement $2, MovementData_0x9e57c
-	jump UnknownScript_0x9f61f
+	jump Script_PlayerEntersBattleRoom
 
-UnknownScript_0x9f60a:
+Script_WalkToBattleRoomL50L60: ; 0x9f60a
 	applymovement $2, MovementData_0x9e586
-	jump UnknownScript_0x9f61f
+	jump Script_PlayerEntersBattleRoom
 
-UnknownScript_0x9f611:
+Script_WalkToBattleRoomL70L80: ; 0x9f611
 	applymovement $2, MovementData_0x9e584
-	jump UnknownScript_0x9f61f
+	jump Script_PlayerEntersBattleRoom
 
-UnknownScript_0x9f618:
+Script_WalkToBattleRoomL90L100: ; 0x9f618
 	applymovement $2, MovementData_0x9e582
-	jump UnknownScript_0x9f61f
+	jump Script_PlayerEntersBattleRoom
 
-UnknownScript_0x9f61f:
+Script_PlayerEntersBattleRoom: ; 0x9f61f
 	faceperson PLAYER, $2
 	loadfont
 	writetext Text_PleaseStepThisWay
--- a/misc/mobile_45.asm
+++ b/misc/mobile_45.asm
@@ -9739,11 +9739,11 @@
 	ld a, [wcd38]
 	and a
 	jr nz, .asm_11892d
-	ld hl, UnknownText_0x11aba5
+	ld hl, Text_WhatLevelDoYouWantToChallenge
 	jr .asm_118930
 
 .asm_11892d
-	ld hl, UnknownText_0x11abcb
+	ld hl, Text_CheckBattleRoomListByMaxLevel
 
 .asm_118930
 	call Function11a9c0
@@ -9770,13 +9770,13 @@
 	ld a, [StatusFlags]
 	bit 6, a
 	jr nz, .asm_11896b
-	ld hl, Strings_119d64
-	ld a, $5
+	ld hl, Strings_Ll0ToL40 ; Address to list of strings with the choosable levels
+	ld a, 5 ; 4 levels to choose from, including 'Cancel'-option
 	jr .asm_118970
 
 .asm_11896b
-	ld hl, Strings_119d0c
-	ld a, $b
+	ld hl, Strings_L10ToL100 ; Address to list of strings with the choosable levels
+	ld a, 11 ; 10 levels to choose from, including 'Cancel'-option
 
 .asm_118970
 	ld [wcd4a], a
@@ -12537,7 +12537,7 @@
 String_119d07:
 	db "   ▼@"
 
-Strings_119d0c:
+Strings_L10ToL100: ; 119d0c
 	db " L:10 @@"
 	db " L:20 @@"
 	db " L:30 @@"
@@ -12550,7 +12550,7 @@
 	db " L:100@@"
 	db "CANCEL@@"
 
-Strings_119d64:
+Strings_Ll0ToL40: ; 119d64
 	db " L:10 @@"
 	db " L:20 @@"
 	db " L:30 @@"
@@ -14274,13 +14274,13 @@
 	done
 ; 0x11aba5
 
-UnknownText_0x11aba5: ; 0x11aba5
+Text_WhatLevelDoYouWantToChallenge: ; 0x11aba5
 	text "What level do you"
 	line "want to challenge?"
 	done
 ; 0x11abcb
 
-UnknownText_0x11abcb: ; 0x11abcb
+Text_CheckBattleRoomListByMaxLevel: ; 0x11abcb
 	text "Check BATTLE ROOM"
 	line "list by max level?"
 	done
@@ -24178,7 +24178,7 @@
 	ld [ScriptVar], a
 	ret
 
-Function170b44: ; 170b44
+Function_LoadOpponentTrainerAndPokemons170b44: ; 0x170b44
 	callba Function_LoadOpponentTrainerAndPokemons
 	ld a, [rSVBK]
 	push af
--- a/text/battle.asm
+++ b/text/battle.asm
@@ -44,7 +44,7 @@
 	prompt
 ; 0x807bd
 
-BattleText_0x807bd: ; 0x807bd
+BattleText_WildFled: ; 0x807bd
 	text "Wild @"
 	text_from_ram EnemyMonNick
 	text ""
@@ -52,7 +52,7 @@
 	prompt
 ; 0x807cf
 
-BattleText_0x807cf: ; 0x807cf
+BattleText_EnemyFled: ; 0x807cf
 	text "Enemy @"
 	text_from_ram EnemyMonNick
 	text ""
@@ -1282,7 +1282,7 @@
 	prompt
 ; 0x81863
 
-BattleText_0x81863: ; 0x81863
+BattleText_LinkErrorBattleCanceled: ; 0x81863
 	text "Link error…"
 
 	para "The battle has"
--- a/text/common_2.asm
+++ b/text/common_2.asm
@@ -1295,7 +1295,7 @@
 	done
 ; 0x1bcf9c
 
-UnknownText_0x1bcf9c: ; 0x1bcf9c
+Text_EnemyWithdrew: ; 0x1bcf9c
 	text "<ENEMY>"
 	line "withdrew"
 	cont "@"
@@ -1304,7 +1304,7 @@
 	prompt
 ; 0x1bcfaf
 
-UnknownText_0x1bcfaf: ; 0x1bcfaf
+Text_EnemyUsedOn: ; 0x1bcfaf
 	text "<ENEMY>"
 	line "used @"
 	text_from_ram wd050
@@ -1315,19 +1315,19 @@
 	prompt
 ; 0x1bcfc7
 
-UnknownText_0x1bcfc7: ; 0x1bcfc7
+Text_ThatCantBeUsedRightNow: ; 0x1bcfc7
 	text "That can't be used"
 	line "right now."
 	prompt
 ; 0x1bcfe5
 
-UnknownText_0x1bcfe5: ; 0x1bcfe5
+Text_ThatItemCantBePutInThePack: ; 0x1bcfe5
 	text "That item can't be"
 	line "put in the PACK."
 	done
 ; 0x1bd009
 
-UnknownText_0x1bd009: ; 0x1bd009
+Text_TheItemWasPutInThePack: ; 0x1bd009
 	text "The @"
 	text_from_ram StringBuffer1
 	text ""
@@ -1336,18 +1336,18 @@
 	done
 ; 0x1bd029
 
-UnknownText_0x1bd029: ; 0x1bd029
+Text_RemainingTime: ; 0x1bd029
 	text "Remaining Time"
 	done
 ; 0x1bd039
 
-UnknownText_0x1bd039: ; 0x1bd039
+Text_YourPkmnsHPWasHealed: ; 0x1bd039
 	text "Your #MON's HP"
 	line "was healed."
 	prompt
 ; 0x1bd054
 
-UnknownText_0x1bd054: ; 0x1bd054
+Text_Warping: ; 0x1bd054
 	text "Warping…"
 	done
 ; 0x1bd05e
@@ -1372,7 +1372,7 @@
 	prompt
 ; 0x1bd0bd
 
-UnknownText_0x1bd0bd: ; 0x1bd0bd
+Text_BreedingIsNotPossible: ; 0x1bd0bd
 	text "Breeding is not"
 	line "possible."
 	prompt