shithub: pokecrystal

Download patch

ref: 8c2766e1b955b6b23a78d014340f51a281b2a114
parent: 0c39f6e273910be3b0ed9317e73c40615d789ae3
author: PikalaxALT <PikalaxALT@gmail.com>
date: Tue Oct 13 07:37:10 EDT 2015

ldtile and dwtile macros added and globally implemented

--- a/macros.asm
+++ b/macros.asm
@@ -161,3 +161,18 @@
 	endc
 	endc
 ENDM
+
+dwtile: MACRO
+	dw (\1 << 4) + \2
+	if _NARG > 2
+	rept _NARG + -2
+	dw \3
+	shift
+	endr
+	endc
+ENDM
+
+ldtile: MACRO
+	ld \1, (\2 << 4) + \3
+ENDM
+
--- a/main.asm
+++ b/main.asm
@@ -178,7 +178,7 @@
 	call ByteFill
 
 	ld hl, PlayerID
-	ld bc, wdff5 - PlayerID
+	ld bc, wPokemonDataEnd - PlayerID
 	xor a
 	call ByteFill
 
@@ -2781,23 +2781,23 @@
 
 .Actions
 	db  +5,  +3,  +2 ; Gained a level
-	db  +5,  +3,  +2 ; Used a stat-boosting item (vitamin or X-item)
-	db  +1,  +1,  +0
+	db  +5,  +3,  +2 ; Vitamin
+	db  +1,  +1,  +0 ; X Item
 	db  +3,  +2,  +1 ; Battled a Gym Leader
 	db  +1,  +1,  +0 ; Learned a move
 	db  -1,  -1,  -1 ; Lost to an enemy
 	db  -5,  -5, -10 ; Fainted due to poison
-	db  -5,  -5, -10 ; Lost to a much weaker enemy
-	db  +1,  +1,  +1 ; Haircut?
-	db  +3,  +3,  +1 ; Haircut?
-	db  +5,  +5,  +2 ; Haircut?
-	db  +1,  +1,  +1 ; Haircut?
-	db  +3,  +3,  +1 ; Haircut?
-	db +10, +10,  +4 ; Haircut?
+	db  -5,  -5, -10 ; Lost to a much stronger enemy
+	db  +1,  +1,  +1 ; Haircut (Y1)
+	db  +3,  +3,  +1 ; Haircut (Y2)
+	db  +5,  +5,  +2 ; Haircut (Y3)
+	db  +1,  +1,  +1 ; Haircut (O1)
+	db  +3,  +3,  +1 ; Haircut (O2)
+	db +10, +10,  +4 ; Haircut (O3)
 	db  -5,  -5, -10 ; Used Heal Powder or Energypowder (bitter)
 	db -10, -10, -15 ; Used Energy Root (bitter)
 	db -15, -15, -20 ; Used Revival Herb (bitter)
-	db  +3,  +3,  +1 ; Massage?
+	db  +3,  +3,  +1 ; Grooming
 	db +10,  +6,  +4 ; Gained a level in the place where it was caught
 ; 725a
 
@@ -16846,51 +16846,51 @@
 
 	dw ShockEmote
 	db $40, BANK(ShockEmote)
-	dw $8f80
+	dwtile $78, VTiles1
 
 	dw QuestionEmote
 	db $40, BANK(QuestionEmote)
-	dw $8f80
+	dwtile $78, VTiles1
 
 	dw HappyEmote
 	db $40, BANK(HappyEmote)
-	dw $8f80
+	dwtile $78, VTiles1
 
 	dw SadEmote
 	db $40, BANK(SadEmote)
-	dw $8f80
+	dwtile $78, VTiles1
 
 	dw HeartEmote
 	db $40, BANK(HeartEmote)
-	dw $8f80
+	dwtile $78, VTiles1
 
 	dw BoltEmote
 	db $40, BANK(BoltEmote)
-	dw $8f80
+	dwtile $78, VTiles1
 
 	dw SleepEmote
 	db $40, BANK(SleepEmote)
-	dw $8f80
+	dwtile $78, VTiles1
 
 	dw FishEmote
 	db $40, BANK(FishEmote)
-	dw $8f80
+	dwtile $78, VTiles1
 
 	dw FishingRodGFX + $00
 	db $10, BANK(FishingRodGFX)
-	dw $8fc0
+	dwtile $7c, VTiles1
 
 	dw FishingRodGFX + $10
 	db $20, BANK(FishingRodGFX)
-	dw $8fc0
+	dwtile $7c, VTiles1
 
 	dw FishingRodGFX + $30
 	db $20, BANK(FishingRodGFX)
-	dw $8fe0
+	dwtile $7e, VTiles1
 
 	dw FishingRodGFX + $50
 	db $10, BANK(FishingRodGFX)
-	dw $8fe0
+	dwtile $7e, VTiles1
 
 ; 14495
 
@@ -66216,15 +66216,18 @@
 
 
 Unknown_8e706: ; 8e706
-	dbbw $80, $01, Function8e72a
-	dbbw $80, $01, Function8e72a
-	dbbw $80, $01, Function8e72a
-	dbbw $80, $01, Function8e72a
-	dbbw $10, $37, Function8e72a
-	dbbw $10, $11, Function8e72a
-	dbbw $10, $39, Function8e72a
-	dbbw $10, $24, Function8e72a
-	dbbw $10, $21, Function8e72a
+	dbbw $80, $01, Unknown_8e72a
+	dbbw $80, $01, Unknown_8e72a
+	dbbw $80, $01, Unknown_8e72a
+	dbbw $80, $01, Unknown_8e72a
+	dbbw $10, $37, Unknown_8e72a
+	dbbw $10, $11, Unknown_8e72a
+	dbbw $10, $39, Unknown_8e72a
+	dbbw $10, $24, Unknown_8e72a
+	dbbw $10, $21, Unknown_8e72a
+
+Unknown_8e72a:
+	; nothing to see here
 
 Function8e72a: ; 8e72a
 	add $10
--- a/misc/mobile_45.asm
+++ b/misc/mobile_45.asm
@@ -8345,7 +8345,7 @@
 	ld a, [wd001]
 	cp $f
 	jr nz, .asm_117c16 ; 0x117c01 $13
-	ld hl, wdfec
+	ld hl, wMagikarpRecordHoldersName + 2
 	ld de, wcd69
 	ld c, $10
 .asm_117c0b
--- a/text/common_3.asm
+++ b/text/common_3.asm
@@ -1222,7 +1222,7 @@
 	text_from_ram StringBuffer1
 	text " caught by"
 	line "@"
-	text_from_ram wBestMagikarpLengthInches + 1
+	text_from_ram wMagikarpRecordHoldersName
 	text_waitbutton
 	db "@"
 ; 1c1260
--- a/tilesets/animations.asm
+++ b/tilesets/animations.asm
@@ -41,7 +41,7 @@
 Tileset02Anim: ; 0xfc01b
 Tileset03Anim: ; 0xfc01b
 ;	   param, function
-	dw $9140, AnimateWaterTile
+	dwtile $14, VTiles2, AnimateWaterTile
 	dw NULL,  WaitTileAnimation
 	dw NULL,  WaitTileAnimation
 	dw NULL,  WaitTileAnimation
@@ -56,9 +56,9 @@
 
 Tileset25Anim: ; 0xfc047
 ;	   param, function
-	dw $9140, AnimateWaterTile
+	dwtile $14, VTiles2, AnimateWaterTile
 	dw NULL,  WaitTileAnimation
-	dw $95f0, AnimateFountain
+	dwtile $5f, VTiles2, AnimateFountain
 	dw NULL,  WaitTileAnimation
 	dw NULL,  TileAnimationPalette
 	dw NULL,  WaitTileAnimation
@@ -79,7 +79,7 @@
 	dw NULL,  ForestTreeLeftAnimation2
 	dw NULL,  ForestTreeRightAnimation2
 	dw NULL,  AnimateFlowerTile
-	dw $9140, AnimateWaterTile
+	dwtile $14, VTiles2, AnimateWaterTile
 	dw NULL,  TileAnimationPalette
 	dw NULL,  NextTileFrame8
 	dw NULL,  DoneTileAnimation
@@ -87,7 +87,7 @@
 
 Tileset01Anim: ; 0xfc0a3
 ;	   param, function
-	dw $9140, AnimateWaterTile
+	dwtile $14, VTiles2, AnimateWaterTile
 	dw NULL,  WaitTileAnimation
 	dw NULL,  WaitTileAnimation
 	dw NULL,  TileAnimationPalette
@@ -104,9 +104,9 @@
 
 TilesetAnimfc0d7: ; 0xfc0d7
 ;	   param, function
-	dw $9030, WriteTileToBuffer
+	dwtile $03, VTiles2, WriteTileToBuffer
 	dw wcf41, ScrollTileRightLeft
-	dw $9030, WriteTileFromBuffer
+	dwtile $03, VTiles2, WriteTileFromBuffer
 	dw NULL,  WaitTileAnimation
 	dw NULL,  WaitTileAnimation
 	dw NULL,  WaitTileAnimation
@@ -119,9 +119,9 @@
 
 TilesetAnimfc103: ; 0xfc103
 ;	   param, function
-	dw $9140, WriteTileToBuffer
+	dwtile $14, VTiles2, WriteTileToBuffer
 	dw wcf41, ScrollTileRightLeft
-	dw $9140, WriteTileFromBuffer
+	dwtile $14, VTiles2, WriteTileFromBuffer
 	dw NULL,  WaitTileAnimation
 	dw NULL,  WaitTileAnimation
 	dw NULL,  WaitTileAnimation
@@ -134,7 +134,7 @@
 
 Tileset09Anim: ; 0xfc12f
 ;	   param, function
-	dw $9140, AnimateWaterTile
+	dwtile $14, VTiles2, AnimateWaterTile
 	dw NULL,  WaitTileAnimation
 	dw NULL,  WaitTileAnimation
 	dw NULL,  WaitTileAnimation
@@ -162,35 +162,35 @@
 
 TilesetAnimfc17f: ; 0xfc17f
 ;	   param, function
-	dw $9530, WriteTileToBuffer
+	dwtile $53, VTiles2, WriteTileToBuffer
 	dw wcf41, ScrollTileDown
 	dw wcf41, ScrollTileDown
-	dw $9530, WriteTileFromBuffer
-	dw $9030, WriteTileToBuffer
+	dwtile $53, VTiles2, WriteTileFromBuffer
+	dwtile $03, VTiles2, WriteTileToBuffer
 	dw wcf41, ScrollTileRightLeft
-	dw $9030, WriteTileFromBuffer
-	dw $9530, WriteTileToBuffer
+	dwtile $03, VTiles2, WriteTileFromBuffer
+	dwtile $53, VTiles2, WriteTileToBuffer
 	dw wcf41, ScrollTileDown
 	dw wcf41, ScrollTileDown
-	dw $9530, WriteTileFromBuffer
+	dwtile $53, VTiles2, WriteTileFromBuffer
 	dw NULL,  DoneTileAnimation
 ; 0xfc1af
 
 TilesetAnimfc1af: ; 0xfc1af
 ;	   param, function
-	dw $9540, WriteTileToBuffer
+	dwtile $54, VTiles2, WriteTileToBuffer
 	dw wcf41, ScrollTileDown
 	dw wcf41, ScrollTileDown
-	dw $9540, WriteTileFromBuffer
+	dwtile $54, VTiles2, WriteTileFromBuffer
 	dw NULL,  WaitTileAnimation
-	dw $9030, WriteTileToBuffer
+	dwtile $03, VTiles2, WriteTileToBuffer
 	dw wcf41, ScrollTileRightLeft
-	dw $9030, WriteTileFromBuffer
+	dwtile $03, VTiles2, WriteTileFromBuffer
 	dw NULL,  WaitTileAnimation
-	dw $9540, WriteTileToBuffer
+	dwtile $54, VTiles2, WriteTileToBuffer
 	dw wcf41, ScrollTileDown
 	dw wcf41, ScrollTileDown
-	dw $9540, WriteTileFromBuffer
+	dwtile $54, VTiles2, WriteTileFromBuffer
 	dw NULL,  DoneTileAnimation
 ; 0xfc1e7
 
@@ -197,15 +197,15 @@
 Tileset24Anim: ; 0xfc1e7
 Tileset30Anim: ; 0xfc1e7
 ;	   param, function
-	dw $9140, WriteTileToBuffer
+	dwtile $14, VTiles2, WriteTileToBuffer
 	dw NULL,  Functionfc71e
 	dw wcf41, ScrollTileRightLeft
 	dw NULL,  Functionfc71e
-	dw $9140, WriteTileFromBuffer
+	dwtile $14, VTiles2, WriteTileFromBuffer
 	dw NULL,  Functionfc71e
 	dw NULL,  TileAnimationPalette
 	dw NULL,  Functionfc71e
-	dw $9400, WriteTileToBuffer
+	dwtile $40, VTiles2, WriteTileToBuffer
 	dw NULL,  Functionfc71e
 	dw wcf41, ScrollTileDown
 	dw NULL,  Functionfc71e
@@ -213,7 +213,7 @@
 	dw NULL,  Functionfc71e
 	dw wcf41, ScrollTileDown
 	dw NULL,  Functionfc71e
-	dw $9400, WriteTileFromBuffer
+	dwtile $40, VTiles2, WriteTileFromBuffer
 	dw NULL,  Functionfc71e
 	dw NULL,  DoneTileAnimation
 ; 0xfc233
@@ -220,15 +220,15 @@
 
 Tileset29Anim: ; 0xfc233
 ;	   param, function
-	dw $9350, WriteTileToBuffer
+	dwtile $35, VTiles2, WriteTileToBuffer
 	dw NULL,  Functionfc71e
 	dw wcf41, ScrollTileRightLeft
 	dw NULL,  Functionfc71e
-	dw $9350, WriteTileFromBuffer
+	dwtile $35, VTiles2, WriteTileFromBuffer
 	dw NULL,  Functionfc71e
 	dw NULL,  TileAnimationPalette
 	dw NULL,  Functionfc71e
-	dw $9310, WriteTileToBuffer
+	dwtile $31, VTiles2, WriteTileToBuffer
 	dw NULL,  Functionfc71e
 	dw wcf41, ScrollTileDown
 	dw NULL,  Functionfc71e
@@ -236,7 +236,7 @@
 	dw NULL,  Functionfc71e
 	dw wcf41, ScrollTileDown
 	dw NULL,  Functionfc71e
-	dw $9310, WriteTileFromBuffer
+	dwtile $31, VTiles2, WriteTileFromBuffer
 	dw NULL,  Functionfc71e
 	dw NULL,  DoneTileAnimation
 ; 0xfc27f
@@ -262,9 +262,9 @@
 ; 0xfc2bf
 
 TilesetAnimfc2bf: ; 0xfc2bf
-	dw $94f0, WriteTileToBuffer
+	dwtile $4f, VTiles2, WriteTileToBuffer
 	dw wcf41, ScrollTileRightLeft
-	dw $94f0, WriteTileFromBuffer
+	dwtile $4f, VTiles2, WriteTileFromBuffer
 	dw NULL,  WaitTileAnimation
 	dw NULL,  WaitTileAnimation
 	dw NULL,  WaitTileAnimation
@@ -1043,16 +1043,16 @@
 ; fc750
 
 
-SproutPillarTilePointer1:  dw $92d0, SproutPillarTile1
-SproutPillarTilePointer2:  dw $92f0, SproutPillarTile2
-SproutPillarTilePointer3:  dw $93d0, SproutPillarTile3
-SproutPillarTilePointer4:  dw $93f0, SproutPillarTile4
-SproutPillarTilePointer5:  dw $93c0, SproutPillarTile5
-SproutPillarTilePointer6:  dw $92c0, SproutPillarTile6
-SproutPillarTilePointer7:  dw $94d0, SproutPillarTile7
-SproutPillarTilePointer8:  dw $94f0, SproutPillarTile8
-SproutPillarTilePointer9:  dw $95d0, SproutPillarTile9
-SproutPillarTilePointer10: dw $95f0, SproutPillarTile10
+SproutPillarTilePointer1:  dwtile $2d, VTiles2, SproutPillarTile1
+SproutPillarTilePointer2:  dwtile $2f, VTiles2, SproutPillarTile2
+SproutPillarTilePointer3:  dwtile $3d, VTiles2, SproutPillarTile3
+SproutPillarTilePointer4:  dwtile $3f, VTiles2, SproutPillarTile4
+SproutPillarTilePointer5:  dwtile $3c, VTiles2, SproutPillarTile5
+SproutPillarTilePointer6:  dwtile $2c, VTiles2, SproutPillarTile6
+SproutPillarTilePointer7:  dwtile $4d, VTiles2, SproutPillarTile7
+SproutPillarTilePointer8:  dwtile $4f, VTiles2, SproutPillarTile8
+SproutPillarTilePointer9:  dwtile $5d, VTiles2, SproutPillarTile9
+SproutPillarTilePointer10: dwtile $5f, VTiles2, SproutPillarTile10
 
 SproutPillarTile1:  INCBIN "gfx/tilesets/sprout-pillar/1.2bpp"
 SproutPillarTile2:  INCBIN "gfx/tilesets/sprout-pillar/2.2bpp"
@@ -1067,10 +1067,10 @@
 ; fca98
 
 
-WhirlpoolFrames1: dw $9320, WhirlpoolTiles1
-WhirlpoolFrames2: dw $9330, WhirlpoolTiles2
-WhirlpoolFrames3: dw $9420, WhirlpoolTiles3
-WhirlpoolFrames4: dw $9430, WhirlpoolTiles4
+WhirlpoolFrames1: dwtile $32, VTiles2, WhirlpoolTiles1
+WhirlpoolFrames2: dwtile $33, VTiles2, WhirlpoolTiles2
+WhirlpoolFrames3: dwtile $42, VTiles2, WhirlpoolTiles3
+WhirlpoolFrames4: dwtile $43, VTiles2, WhirlpoolTiles4
 ; fcaa8
 
 WhirlpoolTiles1: INCBIN "gfx/tilesets/whirlpool/1.2bpp"
--- a/wram.asm
+++ b/wram.asm
@@ -2583,16 +2583,10 @@
 wdfe7:: ds 1
 wBestMagikarpLengthFeet:: ds 1
 wBestMagikarpLengthInches:: ds 1
-wMagikarpRecordHoldersName:: ds 1
-	ds 1
-wdfec:: ds 1
-	ds 3
-
-	ds 5
+wMagikarpRecordHoldersName:: ds NAME_LENGTH
 wdff5::
 
 wPokemonDataEnd::
-
 
 SECTION "Pic Animations", WRAMX, BANK [2]
 
--