shithub: pokecrystal

Download patch

ref: ab7025a144605de609fed4ca67a281fb4cde8705
parent: 32ea595c47d84cf6759f15c0d82fcad35ac4dcbd
author: Remy Oukaour <remy.oukaour@gmail.com>
date: Sat Dec 9 19:06:20 EST 2017

Consistent code formatting: no redundant `a`s and spaces after commas

--- a/audio/engine.asm
+++ b/audio/engine.asm
@@ -744,7 +744,7 @@
 	sub [hl]
 	ld e, a
 	ld a, d
-	sbc a, 0
+	sbc 0
 	ld d, a
 	ld hl, Channel1PitchWheelTarget + 1 - Channel1
 	add hl, bc
@@ -766,7 +766,7 @@
 	sub e
 	ld e, a
 	ld a, d
-	sbc a, 0
+	sbc 0
 	ld d, a
 	; ????
 	ld hl, Channel1PitchWheelTarget + 1 - Channel1
@@ -793,7 +793,7 @@
 	sub [hl]
 	ld e, a
 	ld a, d
-	sbc a, 0
+	sbc 0
 	ld d, a
 	ld hl, Channel1PitchWheelTarget + 1 - Channel1
 	add hl, bc
@@ -1021,7 +1021,7 @@
 	sub e
 	ld e, a
 	ld a, d
-	sbc a, 0
+	sbc 0
 	ld d, a
 	; [Channel*Field0x25] *= 2
 	; if rollover: Frequency -= 1
@@ -1031,10 +1031,10 @@
 	add a
 	ld [hl], a
 	ld a, e
-	sbc a, 0
+	sbc 0
 	ld e, a
 	ld a, d
-	sbc a, 0
+	sbc 0
 	ld d, a
 	; Compare the dw at [Channel*PitchWheelTarget] to de.
 	; If frequency is lower, we're finished.
@@ -1378,7 +1378,7 @@
 	; reload command
 	ld a, [CurMusicByte]
 	; get command #
-	sub a, $d0 ; first command
+	sub $d0 ; first command
 	ld e, a
 	ld d, 0
 	; seek command pointer
--- a/battle/bg_effects.asm
+++ b/battle/bg_effects.asm
@@ -868,7 +868,7 @@
 
 .BGSquares:
 bgsquare: MACRO
-	dn \1,\2
+	dn \1, \2
 	dw \3
 endm
 
--- a/battle/core.asm
+++ b/battle/core.asm
@@ -6267,13 +6267,13 @@
 
 ; 25% chance of getting an item
 	call BattleRandom
-	cp a, 1 + (75 percent)
+	cp 1 + (75 percent)
 	ld a, NO_ITEM
 	jr c, .UpdateItem
 
 ; From there, an 8% chance for Item2
 	call BattleRandom
-	cp a, 8 percent ; 8% of 25% = 2% Item2
+	cp 8 percent ; 8% of 25% = 2% Item2
 	ld a, [BaseItems]
 	jr nc, .UpdateItem
 	ld a, [BaseItems+1]
@@ -6320,7 +6320,7 @@
 ; Roaming monsters (Entei, Raikou) work differently
 ; They have their own structs, which are shorter than normal
 	ld a, [BattleType]
-	cp a, BATTLETYPE_ROAMING
+	cp BATTLETYPE_ROAMING
 	jr nz, .NotRoaming
 
 ; Grab HP
@@ -6361,7 +6361,7 @@
 
 ; Forced shiny battle type
 ; Used by Red Gyarados at Lake of Rage
-	cp a, BATTLETYPE_SHINY
+	cp BATTLETYPE_SHINY
 	jr nz, .GenerateDVs
 
 	ld b, ATKDEFDV_SHINY ; $ea
@@ -6391,7 +6391,7 @@
 
 ; Unown
 	ld a, [TempEnemyMonSpecies]
-	cp a, UNOWN
+	cp UNOWN
 	jr nz, .Magikarp
 
 ; Get letter based on DVs
@@ -6406,7 +6406,7 @@
 ; Skimming this part recommended
 
 	ld a, [TempEnemyMonSpecies]
-	cp a, MAGIKARP
+	cp MAGIKARP
 	jr nz, .Happiness
 
 ; Get Magikarp's length
@@ -6416,25 +6416,25 @@
 
 ; We're clear if the length is < 1536
 	ld a, [wMagikarpLength]
-	cp a, $06 ; $600 = 1536
+	cp $06 ; $600 = 1536
 	jr nz, .CheckMagikarpArea
 
 ; 5% chance of skipping size checks
 	call Random
-	cp a, $0c ; / $100
+	cp $0c ; / $100
 	jr c, .CheckMagikarpArea
 ; Try again if > 1614
 	ld a, [wMagikarpLength + 1]
-	cp a, $50
+	cp $50
 	jr nc, .GenerateDVs
 
 ; 20% chance of skipping this check
 	call Random
-	cp a, $32 ; / $100
+	cp $32 ; / $100
 	jr c, .CheckMagikarpArea
 ; Try again if > 1598
 	ld a, [wMagikarpLength + 1]
-	cp a, $40
+	cp $40
 	jr nc, .GenerateDVs
 
 .CheckMagikarpArea:
@@ -6448,18 +6448,18 @@
 ; Intended behavior enforces a minimum size at Lake of Rage
 ; The real behavior prevents size flooring in the Lake of Rage area
 	ld a, [MapGroup]
-	cp a, GROUP_LAKE_OF_RAGE
+	cp GROUP_LAKE_OF_RAGE
 	jr z, .Happiness
 	ld a, [MapNumber]
-	cp a, MAP_LAKE_OF_RAGE
+	cp MAP_LAKE_OF_RAGE
 	jr z, .Happiness
 ; 40% chance of not flooring
 	call Random
-	cp a, $64 ; / $100
+	cp $64 ; / $100
 	jr c, .Happiness
 ; Floor at length 1024
 	ld a, [wMagikarpLength]
-	cp a, 1024 >> 8
+	cp 1024 >> 8
 	jr c, .GenerateDVs ; try again
 
 ; Finally done with DVs
@@ -6480,7 +6480,7 @@
 ; If we're in a trainer battle,
 ; get the rest of the parameters from the party struct
 	ld a, [wBattleMode]
-	cp a, TRAINER_BATTLE
+	cp TRAINER_BATTLE
 	jr z, .OpponentParty
 
 ; If we're in a wild battle, check wild-specific stuff
@@ -6515,7 +6515,7 @@
 
 ; ..unless it's a RoamMon
 	ld a, [BattleType]
-	cp a, BATTLETYPE_ROAMING
+	cp BATTLETYPE_ROAMING
 	jr nz, .Moves
 
 ; Grab HP
@@ -6568,7 +6568,7 @@
 	ld de, EnemyMonMoves
 ; Are we in a trainer battle?
 	ld a, [wBattleMode]
-	cp a, TRAINER_BATTLE
+	cp TRAINER_BATTLE
 	jr nz, .WildMoves
 ; Then copy moves from the party struct
 	ld hl, OTPartyMon1Moves
@@ -6595,7 +6595,7 @@
 .PP:
 ; Trainer battle?
 	ld a, [wBattleMode]
-	cp a, TRAINER_BATTLE
+	cp TRAINER_BATTLE
 	jr z, .TrainerPP
 
 ; Fill wild PP
@@ -6670,13 +6670,13 @@
 
 ; Don't do anything if this isn't a tree encounter
 	ld a, [BattleType]
-	cp a, BATTLETYPE_TREE
+	cp BATTLETYPE_TREE
 	jr nz, .NotSleeping
 
 ; Get list for the time of day
 	ld hl, .Morn
 	ld a, [TimeOfDay]
-	cp a, DAY
+	cp DAY
 	jr c, .Check
 	ld hl, .Day
 	jr z, .Check
@@ -6759,7 +6759,7 @@
 	inc e
 	inc e
 	ld a, e
-	cp a, .Set1 - .LetterSets
+	cp .Set1 - .LetterSets
 	jr c, .loop
 
 ; Hasn't been unlocked, or the letter is invalid
--- a/engine/billspctop.asm
+++ b/engine/billspctop.asm
@@ -245,10 +245,10 @@
 	ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
 	ld a, " "
 	call ByteFill
-	hlcoord 0,0
+	hlcoord 0, 0
 	lb bc, 10, 18
 	call TextBox
-	hlcoord 0,12
+	hlcoord 0, 12
 	lb bc, 4, 18
 	call TextBox
 	call WaitBGMap2
--- a/engine/card_flip.asm
+++ b/engine/card_flip.asm
@@ -499,12 +499,12 @@
 
 .Deck: ; e0459
 	; level, pic anchor (3x3)
-	db "1",$4e, "1",$57, "1",$69, "1",$60
-	db "2",$4e, "2",$57, "2",$69, "2",$60
-	db "3",$4e, "3",$57, "3",$69, "3",$60
-	db "4",$4e, "4",$57, "4",$69, "4",$60
-	db "5",$4e, "5",$57, "5",$69, "5",$60
-	db "6",$4e, "6",$57, "6",$69, "6",$60
+	db "1", $4e, "1", $57, "1", $69, "1", $60
+	db "2", $4e, "2", $57, "2", $69, "2", $60
+	db "3", $4e, "3", $57, "3", $69, "3", $60
+	db "4", $4e, "4", $57, "4", $69, "4", $60
+	db "5", $4e, "5", $57, "5", $69, "5", $60
+	db "6", $4e, "6", $57, "6", $69, "6", $60
 ; e0489
 
 CardFlip_UpdateCoinBalanceDisplay: ; e0489
--- a/engine/credits.asm
+++ b/engine/credits.asm
@@ -1303,9 +1303,9 @@
 
 .Copyright:
 	;    (C) 1  9  9  5 - 2  0  0  1     N  i  n  t  e  n  d  o
-	db   $60,$61,$62,$63,$64,$65,$66, $67, $68, $69, $6a, $6b, $6c
-	;    (C) 1  9  9  5 - 2  0  0  1    C  r  e  a  t  u  r  e  s      i  n  c .
-	next $60,$61,$62,$63,$64,$65,$66, $6d, $6e, $6f, $70, $71, $72,  $7a, $7b, $7c
-	;    (C) 1  9  9  5 - 2  0  0  1  G   A   M   E   F   R   E   A   K     i  n  c .
-	next $60,$61,$62,$63,$64,$65,$66, $73, $74, $75, $76, $77, $78, $79,  $7a, $7b, $7c
+	db   $60,$61,$62,$63,$64,$65,$66,$67,$68,$69,$6a,$6b,$6c
+	;    (C) 1  9  9  5 - 2  0  0  1    C  r  e  a  t  u  r  e  s     i  n  c .
+	next $60,$61,$62,$63,$64,$65,$66,$6d,$6e,$6f,$70,$71,$72,  $7a,$7b,$7c
+	;    (C) 1  9  9  5 - 2  0  0  1  G  A  M  E  F  R  E  A  K     i  n  c .
+	next $60,$61,$62,$63,$64,$65,$66,$73,$74,$75,$76,$77,$78,$79,  $7a,$7b,$7c
 	db "@"
--- a/engine/crystal_intro.asm
+++ b/engine/crystal_intro.asm
@@ -183,7 +183,7 @@
 .place_presents
 	ld [hl], 0
 	ld hl, .presents
-	decoord 7,11
+	decoord 7, 11
 	ld bc, .end - .presents
 	call CopyBytes
 	call PlaceGameFreakPresents_AdvanceIndex
--- a/event/overworld.asm
+++ b/event/overworld.asm
@@ -77,9 +77,9 @@
 	ld a, [hl]
 	and a
 	jr z, .no
-	cp a, -1
+	cp -1
 	jr z, .no
-	cp a, EGG
+	cp EGG
 	jr z, .next
 
 	ld bc, PARTYMON_STRUCT_LENGTH
@@ -510,7 +510,7 @@
 
 ; Get player direction
 	ld a, [PlayerDirection]
-	and a, %00001100 ; bits 2 and 3 contain direction
+	and %00001100 ; bits 2 and 3 contain direction
 	rrca
 	rrca
 	ld e, a
--- a/home.asm
+++ b/home.asm
@@ -1830,7 +1830,7 @@
 ; 0x38f2
 
 PrintBCDDigit:: ; 38f2
-	and a, %00001111
+	and %00001111
 	and a
 	jr z, .zeroDigit
 .nonzeroDigit
@@ -1845,7 +1845,7 @@
 .skipCurrencySymbol
 	res 7, b ; unset 7 to indicate that a nonzero digit has been reached
 .outputDigit
-	add a, "0"
+	add "0"
 	ld [hli], a
 	jp PrintLetterDelay
 
--- a/home/joypad.asm
+++ b/home/joypad.asm
@@ -130,7 +130,7 @@
 ; The player input can be automated using an input stream.
 ; See more below.
 	ld a, [InputType]
-	cp a, AUTO_INPUT
+	cp AUTO_INPUT
 	jr z, .auto
 
 ; To get deltas, take this and last frame's input.
@@ -197,7 +197,7 @@
 .updateauto
 ; An input of $ff will end the stream.
 	ld a, [hli]
-	cp a, -1
+	cp -1
 	jr z, .stopauto
 	ld b, a
 
@@ -204,7 +204,7 @@
 ; A duration of $ff will end the stream indefinitely.
 	ld a, [hli]
 	ld [AutoInputLength], a
-	cp a, -1
+	cp -1
 	jr nz, .next
 
 ; The current input is overwritten.
--- a/interrupts.asm
+++ b/interrupts.asm
@@ -1,16 +1,16 @@
 ; Game Boy hardware interrupts
 
-SECTION "vblank",ROM0
+SECTION "vblank", ROM0
 	jp VBlank
 
-SECTION "lcd",ROM0
+SECTION "lcd", ROM0
 	jp LCD
 
-SECTION "timer",ROM0
+SECTION "timer", ROM0
 	jp Timer
 
-SECTION "serial",ROM0
+SECTION "serial", ROM0
 	jp Serial
 
-SECTION "joypad",ROM0
+SECTION "joypad", ROM0
 	jp JoypadInt
--- a/lib/mobile/main.asm
+++ b/lib/mobile/main.asm
@@ -9073,8 +9073,8 @@
 	dw $cbef
 
 Unknown_113b7e: ; 113b7e
-	db $01,$23,$45,$67,$89,$ab,$cd,$ef
-	db $fe,$dc,$ba,$98,$76,$54,$32,$10
+	db $01, $23, $45, $67, $89, $ab, $cd, $ef
+	db $fe, $dc, $ba, $98, $76, $54, $32, $10
 
 Unknown_113b8e:
 	db $78, $a4, $6a, $d7, $56, $b7, $c7, $e8, $db, $70, $20, $24, $ee, $ce, $bd, $c1
--- a/main.asm
+++ b/main.asm
@@ -183,7 +183,7 @@
 	inc hl
 ; reached end of commands table?
 	ld a, [hl]
-	cp a, -1
+	cp -1
 	jr z, .done
 
 ; is the current char between this value (inclusive)...
--- a/tilesets/animations.asm
+++ b/tilesets/animations.asm
@@ -304,7 +304,7 @@
 StandingTileFrame8: ; fc2ff
 	ld a, [TileAnimationTimer]
 	inc a
-	and a, 7
+	and 7
 	ld [TileAnimationTimer], a
 	ret
 ; fc309