shithub: pokecrystal

Download patch

ref: 0e311ad709ec65ce65dea962666d014f825da869
parent: ef48ae98b5cc7a3e09633b03fa13534f65247ed6
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Sat Nov 23 15:56:22 EST 2019

Fix miscellaneous points made in #658

--- a/docs/bugs_and_glitches.md
+++ b/docs/bugs_and_glitches.md
@@ -811,10 +811,10 @@
 
 ([Video](https://www.youtube.com/watch?v=o54VjpAEoO8))
 
-**Fix:** Edit `_ABoostedStringBuffer2ExpPointsText` and `_StringBuffer2ExpPointsText` in [data/text/common_2.asm](https://github.com/pret/pokecrystal/blob/master/data/text/common_2.asm):
+**Fix:** Edit `_BoostedExpPointsText` and `_ExpPointsText` in [data/text/common_2.asm](https://github.com/pret/pokecrystal/blob/master/data/text/common_2.asm):
 
 ```diff
- _ABoostedStringBuffer2ExpPointsText::
+ _BoostedExpPointsText::
  	text_start
  	line "a boosted"
  	cont "@"
@@ -823,7 +823,7 @@
  	text " EXP. Points!"
  	prompt
 
- _StringBuffer2ExpPointsText::
+ _ExpPointsText::
  	text_start
  	line "@"
 -	text_decimal wStringBuffer2, 2, 4
@@ -1264,7 +1264,7 @@
 
 ([Video](https://www.youtube.com/watch?v=ojq3xqfRF6I))
 
-**Fix:** Edit `Slots_PayoutAnim` in [engine/games/slot_machine.asm](https://github.com/pret/pokecrystal/blob/master/engine/games/slot_machine.asm):
+**Fix:** Edit `SlotsAction_PayoutAnim` in [engine/games/slot_machine.asm](https://github.com/pret/pokecrystal/blob/master/engine/games/slot_machine.asm):
 
 ```diff
  .okay
--- a/engine/events/halloffame.asm
+++ b/engine/events/halloffame.asm
@@ -449,7 +449,7 @@
 	ld bc, MON_NAME_LENGTH - 1
 	call CopyBytes
 	ld a, "@"
-	ld [wStringBuffer2 + 10], a
+	ld [wStringBuffer2 + MON_NAME_LENGTH - 1], a
 	hlcoord 0, 0
 	ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
 	ld a, " "
--- a/engine/events/lucky_number.asm
+++ b/engine/events/lucky_number.asm
@@ -148,7 +148,7 @@
 .done
 	pop hl
 	push hl
-	ld de, -6
+	ld de, MON_SPECIES - MON_ID
 	add hl, de
 	ld a, [hl]
 	pop hl
--- a/engine/pokemon/bills_pc_top.asm
+++ b/engine/pokemon/bills_pc_top.asm
@@ -261,7 +261,7 @@
 	call CloseSRAM
 	ret
 
-Unreferenced_Functione5d9:
+Unreferenced_LoadBoxMonListing:
 	ld a, [wCurBox]
 	cp b
 	jr z, .same_box
@@ -284,11 +284,11 @@
 .okay
 	call GetSRAMBank
 	ld a, [hl]
-	ld bc, 1 + MONS_PER_BOX + 1
+	ld bc, sBoxMons - sBox
 	add hl, bc
 	ld b, a
 	ld c, $0
-	ld de, wc608
+	ld de, wBoxPartialData
 	ld a, b
 	and a
 	jr z, .empty_box
@@ -296,7 +296,7 @@
 	push hl
 	push bc
 	ld a, c
-	ld bc, 0
+	ld bc, sBoxMon1Species - sBoxMons
 	add hl, bc
 	ld bc, BOXMON_STRUCT_LENGTH
 	call AddNTimes
@@ -311,7 +311,7 @@
 	push hl
 	push bc
 	ld a, c
-	ld bc, MONS_PER_BOX * (BOXMON_STRUCT_LENGTH + NAME_LENGTH)
+	ld bc, sBoxMonNicknames - sBoxMons
 	add hl, bc
 	call SkipNames
 	call CopyBytes
--- a/engine/pokemon/search.asm
+++ b/engine/pokemon/search.asm
@@ -113,7 +113,7 @@
 	jr z, .loopbox
 
 	; Load the box.
-	ld hl, BoxAddressTable1
+	ld hl, BoxAddressTable
 	ld b, 0
 	add hl, bc
 	add hl, bc
@@ -244,7 +244,7 @@
 	scf
 	ret
 
-BoxAddressTable1:
+BoxAddressTable:
 	dba sBox1
 	dba sBox2
 	dba sBox3
--- a/engine/pokemon/search2.asm
+++ b/engine/pokemon/search2.asm
@@ -117,7 +117,7 @@
 	ret
 
 RetroactivelyIgnoreEggs:
-	ld e, -2
+	ld e, %11111110
 	ld hl, wPartySpecies
 .loop
 	ld a, [hli]
--- a/home/farcall.asm
+++ b/home/farcall.asm
@@ -23,7 +23,7 @@
 	push af
 	ldh a, [hBuffer]
 	rst Bankswitch
-	call FarJump_hl
+	call FarCall_JumpToHL
 
 ReturnFarCall::
 ; We want to retain the contents of f.
@@ -45,5 +45,5 @@
 	ld c, a
 	ret
 
-FarJump_hl::
+FarCall_JumpToHL::
 	jp hl
--- a/hram.asm
+++ b/hram.asm
@@ -4,7 +4,7 @@
 
 hROMBankBackup:: db ; ff8a
 hBuffer:: db ; ff8b
-hFF8C:: db ; ff8c
+hSRAMBank:: db ; ff8c
 
 hRTCDayHi::   db ; ff8d
 hRTCDayLo::   db ; ff8e
--- a/mobile/mobile_12_2.asm
+++ b/mobile/mobile_12_2.asm
@@ -17,7 +17,7 @@
 	ld bc, PARTYMON_STRUCT_LENGTH
 	add hl, bc
 	pop bc
-	call .CopyName
+	call .AdvanceOTName
 	dec d
 	jr nz, .asm_4a851
 	ld a, BANK(sBoxCount)
@@ -39,7 +39,7 @@
 	ld bc, BOXMON_STRUCT_LENGTH
 	add hl, bc
 	pop bc
-	call .CopyName
+	call .AdvanceOTName
 	dec d
 	jr nz, .asm_4a873
 
@@ -90,7 +90,7 @@
 	ld bc, BOXMON_STRUCT_LENGTH
 	add hl, bc
 	pop bc
-	call .CopyName
+	call .AdvanceOTName
 	dec d
 	jr nz, .asm_4a8ba
 	pop bc
@@ -146,7 +146,7 @@
 	dba sBox13
 	dba sBox14
 
-.CopyName:
+.AdvanceOTName:
 	push hl
 	ld hl, NAME_LENGTH
 	add hl, bc
--- a/mobile/mobile_45.asm
+++ b/mobile/mobile_45.asm
@@ -129,7 +129,7 @@
 Function114243::
 	ld a, SRAM_ENABLE
 	ld [MBC3SRamEnable], a
-	ldh a, [hFF8C]
+	ldh a, [hSRAMBank]
 	push af ; if [$dc02] == 0, this is popped to pc.
 	push de
 	ld a, [$dc02]
@@ -147,8 +147,8 @@
 Function11425c:
 	ld [$dc02], a
 	pop af
-	ldh [hFF8C], a
-	ldh [hFF8C], a
+	ldh [hSRAMBank], a
+	ldh [hSRAMBank], a
 	ld [MBC3SRamBank], a
 	ret
 
@@ -163,7 +163,7 @@
 	ld [$dc03], a
 	ld a, [hli]
 	ld [$dc00], a
-	ldh [hFF8C], a
+	ldh [hSRAMBank], a
 	ld [MBC3SRamBank], a
 	ld e, [hl]
 	inc hl
@@ -360,7 +360,7 @@
 	pop bc
 	ld a, [$dc03]
 	ld [$dc00], a
-	ldh [hFF8C], a
+	ldh [hSRAMBank], a
 	ld [MBC3SRamBank], a
 	call Function114c0b
 	ld hl, String_114004
@@ -418,7 +418,7 @@
 	push af
 	ld a, [hli]
 	ld [wCurMapBGEventCount], a
-	ldh [hFF8C], a
+	ldh [hSRAMBank], a
 	ld [MBC3SRamBank], a
 	ld a, [hli]
 	ld h, [hl]
@@ -473,7 +473,7 @@
 Function114412:
 	ld a, c
 	ld [$dc00], a
-	ldh [hFF8C], a
+	ldh [hSRAMBank], a
 	ld [MBC3SRamBank], a
 	ld hl, Unknown_11417f
 	ld a, b
@@ -660,7 +660,7 @@
 	pop hl
 	ld a, [hli]
 	ld [wCurMapBGEventCount], a
-	ldh [hFF8C], a
+	ldh [hSRAMBank], a
 	ld [MBC3SRamBank], a
 	ld e, [hl]
 	inc hl
@@ -677,7 +677,7 @@
 	ld hl, $dc06
 	ld a, [hl]
 	ld [wCurMapBGEventCount], a
-	ldh [hFF8C], a
+	ldh [hSRAMBank], a
 	ld [MBC3SRamBank], a
 	ld hl, $dc09
 	ld e, [hl]
@@ -735,7 +735,7 @@
 	jr nz, .asm_1145b4
 	ld a, h
 	ld [$dc00], a
-	ldh [hFF8C], a
+	ldh [hSRAMBank], a
 	ld [MBC3SRamBank], a
 	push hl
 	push de
@@ -753,7 +753,7 @@
 	jr nz, .asm_1145ba
 	ld a, h
 	ld [$dc00], a
-	ldh [hFF8C], a
+	ldh [hSRAMBank], a
 	ld [MBC3SRamBank], a
 	ld hl, String_114218
 	call Function114acf
@@ -925,7 +925,7 @@
 	pop de
 	pop af
 	ld [$dc00], a
-	ldh [hFF8C], a
+	ldh [hSRAMBank], a
 	ld [MBC3SRamBank], a
 	xor a
 	ld [wDecoCarpet], a
@@ -946,7 +946,7 @@
 	ld hl, $dc03
 	ld a, [hli]
 	ld [$dc00], a
-	ldh [hFF8C], a
+	ldh [hSRAMBank], a
 	ld [MBC3SRamBank], a
 	ld e, [hl]
 	inc hl
@@ -960,7 +960,7 @@
 	ld hl, $dc03
 	ld a, [hli]
 	ld [$dc00], a
-	ldh [hFF8C], a
+	ldh [hSRAMBank], a
 	ld [MBC3SRamBank], a
 	ld e, [hl]
 	inc hl
@@ -1003,7 +1003,7 @@
 	ld hl, $dc03
 	ld a, [hli]
 	ld [$dc00], a
-	ldh [hFF8C], a
+	ldh [hSRAMBank], a
 	ld [MBC3SRamBank], a
 	ld e, [hl]
 	inc hl
@@ -1017,7 +1017,7 @@
 	ld a, $1
 	ld [$dc0e], a
 	ld a, [$dc00]
-	ldh [hFF8C], a
+	ldh [hSRAMBank], a
 	ld [MBC3SRamBank], a
 	ld a, $1
 	ld [wDecoRightOrnament], a
@@ -1044,7 +1044,7 @@
 	ld hl, $dc03
 	ld a, [hli]
 	ld [$dc00], a
-	ldh [hFF8C], a
+	ldh [hSRAMBank], a
 	ld [MBC3SRamBank], a
 	ld e, [hl]
 	inc hl
@@ -1098,7 +1098,7 @@
 	ld hl, $dc03
 	ld a, [hli]
 	ld [$dc00], a
-	ldh [hFF8C], a
+	ldh [hSRAMBank], a
 	ld [MBC3SRamBank], a
 	call Function114a7a
 	and a
@@ -1208,7 +1208,7 @@
 	ld a, [$dc00]
 	push af
 	push de
-	ldh [hFF8C], a
+	ldh [hSRAMBank], a
 	ld [MBC3SRamBank], a
 	call Function114a18
 	and a
@@ -1231,7 +1231,7 @@
 	ld hl, $dc06
 	ld a, [hli]
 	ld [wCurMapBGEventCount], a
-	ldh [hFF8C], a
+	ldh [hSRAMBank], a
 	ld [MBC3SRamBank], a
 	ld e, [hl]
 	inc hl
@@ -1296,7 +1296,7 @@
 	ld hl, $dc06
 	ld a, [hli]
 	ld [wCurMapBGEventCount], a
-	ldh [hFF8C], a
+	ldh [hSRAMBank], a
 	ld [MBC3SRamBank], a
 	ld e, [hl]
 	inc hl
@@ -1394,7 +1394,7 @@
 	ld hl, $dc06
 	ld a, [hli]
 	ld [wCurMapBGEventCount], a
-	ldh [hFF8C], a
+	ldh [hSRAMBank], a
 	ld [MBC3SRamBank], a
 	ld e, [hl]
 	inc hl
@@ -1484,7 +1484,7 @@
 	ld hl, $dc06
 	ld a, [hl]
 	ld [wCurMapBGEventCount], a
-	ldh [hFF8C], a
+	ldh [hSRAMBank], a
 	ld [MBC3SRamBank], a
 	push de
 	ld hl, $dc09
@@ -1831,7 +1831,7 @@
 	ld hl, $dc06
 	ld a, [hli]
 	ld [wCurMapBGEventCount], a
-	ldh [hFF8C], a
+	ldh [hSRAMBank], a
 	ld [MBC3SRamBank], a
 	ld e, [hl]
 	inc hl
@@ -1869,7 +1869,7 @@
 	jr nz, .asm_114bff
 	ld a, h
 	ld [$dc00], a
-	ldh [hFF8C], a
+	ldh [hSRAMBank], a
 	ld [MBC3SRamBank], a
 	call Function114c0b
 	ld hl, $dc24
@@ -1880,7 +1880,7 @@
 	pop hl
 	ld a, [hli]
 	ld [wCurMapBGEventCount], a
-	ldh [hFF8C], a
+	ldh [hSRAMBank], a
 	ld [MBC3SRamBank], a
 	ld a, [hli]
 	ld e, a
@@ -2086,7 +2086,7 @@
 	ld [$dc04], a
 	ld a, h
 	ld [$dc00], a
-	ldh [hFF8C], a
+	ldh [hSRAMBank], a
 	ld [MBC3SRamBank], a
 	ld hl, $dc24
 	call Function114d39
@@ -2105,7 +2105,7 @@
 	pop hl
 	ld a, [hli]
 	ld [wCurMapBGEventCount], a
-	ldh [hFF8C], a
+	ldh [hSRAMBank], a
 	ld [MBC3SRamBank], a
 	ld a, [hli]
 	ld e, a
@@ -2403,7 +2403,7 @@
 	ld hl, $dc06
 	ld a, [hli]
 	ld [wCurMapBGEventCount], a
-	ldh [hFF8C], a
+	ldh [hSRAMBank], a
 	ld [MBC3SRamBank], a
 	ld a, [hli]
 	ld e, a
@@ -2603,7 +2603,7 @@
 	inc hl
 	ld a, [hli]
 	ld [$dc00], a
-	ldh [hFF8C], a
+	ldh [hSRAMBank], a
 	ld [MBC3SRamBank], a
 	ld e, [hl]
 	inc hl
@@ -2681,7 +2681,7 @@
 	ld hl, $dc06
 	ld a, [hli]
 	ld [wCurMapBGEventCount], a
-	ldh [hFF8C], a
+	ldh [hSRAMBank], a
 	ld [MBC3SRamBank], a
 	ld a, [hli]
 	ld e, a
@@ -2738,7 +2738,7 @@
 	ld c, a
 	ld a, [hli]
 	ld [$dc00], a
-	ldh [hFF8C], a
+	ldh [hSRAMBank], a
 	ld [MBC3SRamBank], a
 	ld e, [hl]
 	inc hl
@@ -2889,7 +2889,7 @@
 	ld hl, $dc06
 	ld a, [hli]
 	ld [wCurMapBGEventCount], a
-	ldh [hFF8C], a
+	ldh [hSRAMBank], a
 	ld [MBC3SRamBank], a
 	ld a, [hli]
 	ld e, a
@@ -2942,7 +2942,7 @@
 	ld hl, $dc06
 	ld a, [hli]
 	ld [wCurMapBGEventCount], a
-	ldh [hFF8C], a
+	ldh [hSRAMBank], a
 	ld [MBC3SRamBank], a
 	ld a, [hli]
 	ld e, a
@@ -3060,7 +3060,7 @@
 	ld hl, $dc06
 	ld a, [hli]
 	ld [wCurMapBGEventCount], a
-	ldh [hFF8C], a
+	ldh [hSRAMBank], a
 	ld [MBC3SRamBank], a
 	ld a, [hli]
 	ld e, a
@@ -3153,7 +3153,7 @@
 	inc hl
 	ld a, [hli]
 	ld [$dc00], a
-	ldh [hFF8C], a
+	ldh [hSRAMBank], a
 	ld [MBC3SRamBank], a
 	ld a, [hli]
 	ld e, a
@@ -3402,7 +3402,7 @@
 .asm_1153f5
 	ld a, [hli]
 	ld [$dc00], a
-	ldh [hFF8C], a
+	ldh [hSRAMBank], a
 	ld [MBC3SRamBank], a
 	ld e, [hl]
 	inc hl
@@ -3536,7 +3536,7 @@
 	ld hl, wDecoRightOrnament
 	ld a, [hli]
 	ld [wCurMapBGEventCount], a
-	ldh [hFF8C], a
+	ldh [hSRAMBank], a
 	ld [MBC3SRamBank], a
 	ld e, [hl]
 	inc hl
@@ -3769,7 +3769,7 @@
 	ld [wCurMapBGEventCount], a
 	ld a, [$dc17]
 	ld [$dc00], a
-	ldh [hFF8C], a
+	ldh [hSRAMBank], a
 	ld [MBC3SRamBank], a
 	ld hl, $dc1a
 	ld c, [hl]
@@ -3842,7 +3842,7 @@
 	ld [hl], d
 	pop bc
 	ld a, [wCurMapBGEventCount]
-	ldh [hFF8C], a
+	ldh [hSRAMBank], a
 	ld [MBC3SRamBank], a
 	ld hl, wCurMapSceneScriptCount
 	ld e, [hl]
@@ -4148,7 +4148,7 @@
 	ld hl, $dc02
 	ld a, [hli]
 	ld [$dc00], a
-	ldh [hFF8C], a
+	ldh [hSRAMBank], a
 	ld [MBC3SRamBank], a
 	ld e, [hl]
 	inc hl
@@ -4202,7 +4202,7 @@
 	ld hl, wCurMapSceneScriptCount
 	ld a, [hli]
 	ld [wCurMapBGEventCount], a
-	ldh [hFF8C], a
+	ldh [hSRAMBank], a
 	ld [MBC3SRamBank], a
 	ld e, [hl]
 	inc hl
@@ -4669,7 +4669,7 @@
 	ld hl, $dc02
 	ld a, [hli]
 	ld [$dc00], a
-	ldh [hFF8C], a
+	ldh [hSRAMBank], a
 	ld [MBC3SRamBank], a
 	ld e, [hl]
 	inc hl
@@ -4757,7 +4757,7 @@
 	ld hl, wCurMapSceneScriptCount
 	ld a, [hli]
 	ld [wCurMapBGEventCount], a
-	ldh [hFF8C], a
+	ldh [hSRAMBank], a
 	ld [MBC3SRamBank], a
 	ld e, [hl]
 	inc hl
@@ -5150,7 +5150,7 @@
 	ld a, [bc]
 	inc a
 	ld [bc], a
-	ldh [hFF8C], a
+	ldh [hSRAMBank], a
 	ld [MBC3SRamBank], a
 	ld a, e
 	ld d, $a0
--- a/sram.asm
+++ b/sram.asm
@@ -218,7 +218,7 @@
 sBTMonPrevPrevTrainer3:: db
 
 
-SECTION "Boxes 1-7",  SRAM, BANK [2]
+SECTION "Boxes 1-7", SRAM
 
 sBox1::  box sBox1
 sBox2::  box sBox2