shithub: pokecrystal

Download patch

ref: c50b49bd6257ab6aba27210dc0e241414b723d87
parent: ebfa8e26394d9076971eff2cac5468a97fa83205
author: PikalaxALT <PikalaxALT@gmail.com>
date: Thu Oct 1 12:55:24 EDT 2015

Renamed some unused specials

--- a/engine/events.asm
+++ b/engine/events.asm
@@ -382,7 +382,7 @@
 	call CheckBit4_ScriptFlags3
 	jr z, .ok
 
-	call Function97cc0
+	call RockSmashEncounter
 	ret c
 	jr .ok
 
@@ -582,7 +582,7 @@
 	ret c
 	call TryReadSign
 	ret c
-	call Function97c5f
+	call CheckFacingTileEvent
 	ret c
 	xor a
 	ret
--- a/engine/events_2.asm
+++ b/engine/events_2.asm
@@ -44,7 +44,7 @@
 	ret
 ; 97c5f
 
-Function97c5f:: ; 97c5f
+CheckFacingTileEvent:: ; 97c5f
 	call GetFacingTileCoord
 	ld [EngineBuffer1], a
 	ld c, a
@@ -95,41 +95,41 @@
 ; 97cc0
 
 
-Function97cc0:: ; 97cc0
+RockSmashEncounter:: ; 97cc0
 ; Rock Smash encounter
 
 	call Function968c7
-	jr c, .asm_97ce2
-	call Function97cfd
-	jr nc, .asm_97ce2
+	jr c, .nope
+	call CanUseSweetScent
+	jr nc, .nope
 	ld hl, StatusFlags2
 	bit 2, [hl]
-	jr nz, .asm_97cdb
+	jr nz, .bug_contest
 	callba TryWildEncounter
-	jr nz, .asm_97ce2
-	jr .asm_97ce6
+	jr nz, .nope
+	jr .ok
 
-.asm_97cdb
-	call Function97d23
-	jr nc, .asm_97ce2
-	jr .asm_97ced
+.bug_contest
+	call _TryWildEncounter_BugContest
+	jr nc, .nope
+	jr .ok_bug_contest
 
-.asm_97ce2
+.nope
 	ld a, 1
 	and a
 	ret
 
-.asm_97ce6
+.ok
 	ld a, BANK(RockSmashBattleScript)
 	ld hl, RockSmashBattleScript
-	jr .asm_97cf4
+	jr .done
 
-.asm_97ced
+.ok_bug_contest
 	ld a, BANK(BugCatchingContestBattleScript)
 	ld hl, BugCatchingContestBattleScript
-	jr .asm_97cf4
+	jr .done
 
-.asm_97cf4
+.done
 	call CallScript
 	scf
 	ret
@@ -142,45 +142,45 @@
 	end
 ; 97cfd
 
-Function97cfd:: ; 97cfd
+CanUseSweetScent:: ; 97cfd
 	ld hl, StatusFlags
 	bit 5, [hl]
-	jr nz, .asm_97d21
+	jr nz, .no
 	ld a, [wPermission]
 	cp $4
-	jr z, .asm_97d17
+	jr z, .ice_check
 	cp $7
-	jr z, .asm_97d17
+	jr z, .ice_check
 	callba Function149dd
-	jr nc, .asm_97d21
+	jr nc, .no
 
-.asm_97d17
+.ice_check
 	ld a, [StandingTile]
 	call CheckIceTile
-	jr z, .asm_97d21
+	jr z, .no
 	scf
 	ret
 
-.asm_97d21
+.no
 	and a
 	ret
 ; 97d23
 
-Function97d23: ; 97d23
+_TryWildEncounter_BugContest: ; 97d23
 	call TryWildEncounter_BugContest
 	ret nc
-	call Function97d31
+	call ChooseWildEncounter_BugContest
 	callba CheckRepelEffect
 	ret
 ; 97d31
 
-Function97d31:: ; 97d31
+ChooseWildEncounter_BugContest:: ; 97d31
 ; Pick a random mon out of ContestMons.
 
-.asm_97d31
+.loop
 	call Random
 	cp 100 << 1
-	jr nc, .asm_97d31
+	jr nc, .loop
 	srl a
 
 	ld hl, ContestMons
@@ -232,10 +232,10 @@
 	ld a, [StandingTile]
 	call CheckSuperTallGrassTile
 	ld b, $66
-	jr z, .asm_97d70
+	jr z, .ok
 	ld b, $33
 
-.asm_97d70
+.ok
 	callba ApplyMusicEffectOnEncounterRate
 	callba ApplyCleanseTagEffectOnEncounterRate
 	call Random
--- a/engine/specials.asm
+++ b/engine/specials.asm
@@ -83,11 +83,11 @@
 	add_special PlayMapMusic
 	add_special RestartMapMusic
 	add_special HealMachineAnim
-	add_special Function8379
-	add_special Functionc25a
-	add_special Functionc268
-	add_special Functionc276
-	add_special Functionc284
+	add_special Special_SurfStartStep
+	add_special Special_FindGreaterThanThatLevel
+	add_special Special_FindAtLeastThatHappy
+	add_special Special_FindThatSpecies
+	add_special Special_FindThatSpeciesYourTrainerID
 	add_special Functionc3ef
 	add_special Function17421
 	add_special Function17440
@@ -163,7 +163,7 @@
 	add_special Function103612
 	add_special SpecialHoOhChamber
 	add_special Function102142
-	add_special Function4989a
+	add_special Special_CelebiShrineEvent
 	add_special Function49bf9
 	add_special SpecialPokeSeer
 	add_special SpecialBuenasPassword
@@ -225,40 +225,40 @@
 	ret
 ; c25a
 
-Functionc25a: ; c25a
+Special_FindGreaterThanThatLevel: ; c25a
 	ld a, [ScriptVar]
 	ld b, a
-	callba Function4dbd2
-	jr z, Functionc298
-	jr Functionc292
+	callba _FindGreaterThanThatLevel
+	jr z, FoundNone
+	jr FoundOne
 
-Functionc268: ; c268
+Special_FindAtLeastThatHappy: ; c268
 	ld a, [ScriptVar]
 	ld b, a
-	callba Function4dbd9
-	jr z, Functionc298
-	jr Functionc292
+	callba _FindAtLeastThatHappy
+	jr z, FoundNone
+	jr FoundOne
 
-Functionc276: ; c276
+Special_FindThatSpecies: ; c276
 	ld a, [ScriptVar]
 	ld b, a
-	callba Function4dbe0
-	jr z, Functionc298
-	jr Functionc292
+	callba _FindThatSpecies
+	jr z, FoundNone
+	jr FoundOne
 
-Functionc284: ; c284
+Special_FindThatSpeciesYourTrainerID: ; c284
 	ld a, [ScriptVar]
 	ld b, a
-	callba Function4dbe6
-	jr z, Functionc298
-	jr Functionc292
+	callba _FindThatSpeciesYourTrainerID
+	jr z, FoundNone
+	jr FoundOne
 
-Functionc292: ; c292
+FoundOne: ; c292
 	ld a, $1
 	ld [ScriptVar], a
 	ret
 
-Functionc298: ; c298
+FoundNone: ; c298
 	xor a
 	ld [ScriptVar], a
 	ret
--- a/main.asm
+++ b/main.asm
@@ -3728,7 +3728,7 @@
 	ret
 ; 8379
 
-Function8379: ; 8379
+Special_SurfStartStep: ; 8379
 	call Function1b1e
 	call Function8388
 	call Function1b3f
@@ -5008,7 +5008,7 @@
 	special Special_ReplaceKrisSprite
 	special PlayMapMusic
 ; step into the water
-	special Function8379 ; (slow_step_x, step_end)
+	special Special_SurfStartStep ; (slow_step_x, step_end)
 	applymovement PLAYER, MovementBuffer ; PLAYER, MovementBuffer
 	end
 ; c9a2
@@ -40555,13 +40555,13 @@
 	db $a8, $00, $b5, $b0, $de, $e8, $fc, $1c
 	db $ba, $66, $f7, $0e, $ba, $5e, $43, $bd
 
-Function4989a: ; 4989a
+Special_CelebiShrineEvent: ; 4989a
 	call DelayFrame
 	ld a, [VramState]
 	push af
 	xor a
 	ld [VramState], a
-	call Function49912
+	call LoadCelebiGFX
 	ld de, $0750
 	ld a, $2c
 	call Function3b2a
@@ -40623,7 +40623,7 @@
 	ret
 ; 49912
 
-Function49912: ; 49912
+LoadCelebiGFX: ; 49912
 	callba Function8cf53
 	ld de, SpecialCelebiLeafGFX
 	ld hl, VTiles1
@@ -45031,26 +45031,26 @@
 	ld [CurPartyLevel], a
 	ret
 
-Function4dbd2: ; 4dbd2
+_FindGreaterThanThatLevel: ; 4dbd2
 	ld hl, PartyMon1Level
-	call Function4dc31
+	call FindGreaterThanThatLevel
 	ret
 ; 4dbd9
 
-Function4dbd9: ; 4dbd9
+_FindAtLeastThatHappy: ; 4dbd9
 	ld hl, PartyMon1Happiness
-	call Function4dc0a
+	call FindAtLeastThatHappy
 	ret
 ; 4dbe0
 
-Function4dbe0: ; 4dbe0
+_FindThatSpecies: ; 4dbe0
 	ld hl, PartyMon1Species
-	jp Function4dc56
+	jp FindThatSpecies
 ; 4dbe6
 
-Function4dbe6: ; 4dbe6
+_FindThatSpeciesYourTrainerID: ; 4dbe6
 	ld hl, PartyMon1Species
-	call Function4dc56
+	call FindThatSpecies
 	ret z
 	ld a, c
 	ld hl, PartyMon1ID
@@ -45058,25 +45058,27 @@
 	call AddNTimes
 	ld a, [PlayerID]
 	cp [hl]
-	jr nz, .asm_4dc08
+	jr nz, .nope
 	inc hl
 	ld a, [PlayerID + 1]
 	cp [hl]
-	jr nz, .asm_4dc08
+	jr nz, .nope
 	ld a, $1
 	and a
 	ret
 
-.asm_4dc08
+.nope
 	xor a
 	ret
 ; 4dc0a
 
-Function4dc0a: ; 4dc0a
+FindAtLeastThatHappy: ; 4dc0a
+; Sets the bits for the Pokemon that have a happiness greater than or equal to b.
+; The lowest bits are used.  Sets z if no Pokemon in your party is at least that happy.
 	ld c, $0
 	ld a, [PartyCount]
 	ld d, a
-.asm_4dc10
+.loop
 	ld a, d
 	dec a
 	push hl
@@ -45087,29 +45089,29 @@
 	ld a, b
 	cp [hl]
 	pop hl
-	jr z, .asm_4dc22
-	jr nc, .asm_4dc26
+	jr z, .greater_equal
+	jr nc, .lower
 
-.asm_4dc22
+.greater_equal
 	ld a, c
 	or $1
 	ld c, a
 
-.asm_4dc26
+.lower
 	sla c
 	dec d
-	jr nz, .asm_4dc10
-	call Function4dc67
+	jr nz, .loop
+	call RetroactivelyIgnoreEggs
 	ld a, c
 	and a
 	ret
 ; 4dc31
 
-Function4dc31: ; 4dc31
+FindGreaterThanThatLevel: ; 4dc31
 	ld c, $0
 	ld a, [PartyCount]
 	ld d, a
-.asm_4dc37
+.loop
 	ld a, d
 	dec a
 	push hl
@@ -45120,52 +45122,52 @@
 	ld a, b
 	cp [hl]
 	pop hl
-	jr c, .asm_4dc4b
+	jr c, .greater
 	ld a, c
 	or $1
 	ld c, a
 
-.asm_4dc4b
+.greater
 	sla c
 	dec d
-	jr nz, .asm_4dc37
-	call Function4dc67
+	jr nz, .loop
+	call RetroactivelyIgnoreEggs
 	ld a, c
 	and a
 	ret
 ; 4dc56
 
-Function4dc56: ; 4dc56
-	ld c, $ff
+FindThatSpecies: ; 4dc56
+	ld c, -1
 	ld hl, PartySpecies
-.asm_4dc5b
+.loop
 	ld a, [hli]
-	cp $ff
+	cp -1
 	ret z
 	inc c
 	cp b
-	jr nz, .asm_4dc5b
+	jr nz, .loop
 	ld a, $1
 	and a
 	ret
 ; 4dc67
 
-Function4dc67: ; 4dc67
-	ld e, $fe
+RetroactivelyIgnoreEggs: ; 4dc67
+	ld e, -2
 	ld hl, PartySpecies
-.asm_4dc6c
+.loop
 	ld a, [hli]
-	cp $ff
+	cp -1
 	ret z
 	cp EGG
-	jr nz, .asm_4dc77
+	jr nz, .skip_notegg
 	ld a, c
 	and e
 	ld c, a
 
-.asm_4dc77
+.skip_notegg
 	rlc e
-	jr .asm_4dc6c
+	jr .loop
 ; 4dc7b
 
 
@@ -48282,7 +48284,7 @@
 ; 0x506ef
 
 SweetScentEncounter: ; 506ef
-	callba Function97cfd
+	callba CanUseSweetScent
 	jr nc, .no_battle
 	ld hl, StatusFlags2
 	bit 2, [hl]
@@ -48296,7 +48298,7 @@
 	jr .start_battle
 
 .not_in_bug_contest
-	callba Function97d31
+	callba ChooseWildEncounter_BugContest
 
 .start_battle
 	ld a, $1
--- a/maps/IlexForest.asm
+++ b/maps/IlexForest.asm
@@ -455,7 +455,7 @@
 	spriteface PLAYER, DOWN
 	pause 20
 	clearflag ENGINE_HAVE_EXAMINED_GS_BALL
-	special Function4989a
+	special Special_CelebiShrineEvent
 	loadpokedata CELEBI, 30
 	startbattle
 	returnafterbattle