shithub: pokered

Download patch

ref: 6ba3765c5932996f5da6417ae703794ff10bb1cb
parent: 98f09b6d26b1f83bdf1779cfe63a73b8a4265aef
parent: 808c2509b00903478dfdad1830bef6358d93b7dd
author: Daniel Harding <33dannye@gmail.com>
date: Tue Jun 26 18:09:09 EDT 2018

Merge pull request #184 from Pokeglitch/intro-updates

Updated the intro

--- a/constants/hardware_constants.asm
+++ b/constants/hardware_constants.asm
@@ -22,14 +22,6 @@
 
 LY_VBLANK EQU 145
 
-; OAM attribute flags
-OAM_PALETTE   EQU %111
-OAM_TILE_BANK EQU 3
-OAM_OBP_NUM   EQU 4 ; Non CGB Mode Only
-OAM_X_FLIP    EQU 5
-OAM_Y_FLIP    EQU 6
-OAM_PRIORITY  EQU 7 ; 0: OBJ above BG, 1: OBJ behind BG (colors 1-3)
-
 ; serial
 START_TRANSFER_EXTERNAL_CLOCK EQU $80
 START_TRANSFER_INTERNAL_CLOCK EQU $81
--- a/constants/misc_constants.asm
+++ b/constants/misc_constants.asm
@@ -45,6 +45,8 @@
 SCREEN_WIDTH_PIXELS  EQU SCREEN_WIDTH * 8
 SCREEN_HEIGHT_PIXELS EQU SCREEN_HEIGHT * 8
 
+BYTES_PER_TILE EQU 16
+
 BG_MAP_WIDTH  EQU 32
 BG_MAP_HEIGHT EQU 32
 
--- a/constants/oam_constants.asm
+++ b/constants/oam_constants.asm
@@ -5,5 +5,14 @@
 ; Used for making left facing sprites face right and to alternate between left and right foot animation when walking up or down
 
 ; OAM attribute flags
-OAM_HFLIP EQU %00100000 ; horizontal flip
-OAM_VFLIP EQU %01000000 ; vertical flip
+OAM_PALETTE   EQU %111
+OAM_TILE_BANK EQU 3
+OAM_OBP_NUM   EQU 4 ; Non CGB Mode Only
+OAM_X_FLIP    EQU 5
+OAM_Y_FLIP    EQU 6
+OAM_PRIORITY  EQU 7 ; 0: OBJ above BG, 1: OBJ behind BG (colors 1-3)
+
+; OAM attribute masks
+OAM_HFLIP     EQU 1 << OAM_X_FLIP ; horizontal flip
+OAM_VFLIP     EQU 1 << OAM_Y_FLIP ; vertical flip
+OAM_BEHIND_BG EQU 1 << OAM_PRIORITY ; behind bg (except color 0)
--- a/constants/palette_constants.asm
+++ b/constants/palette_constants.asm
@@ -1,3 +1,10 @@
+; monochrome palette color ids
+	const_def
+	const WHITE
+	const LIGHT_GRAY
+	const DARK_GRAY
+	const BLACK
+
 SET_PAL_BATTLE_BLACK         EQU $00
 SET_PAL_BATTLE               EQU $01
 SET_PAL_TOWN_MAP             EQU $02
--- a/engine/battle/animations.asm
+++ b/engine/battle/animations.asm
@@ -2588,21 +2588,21 @@
 
 TileIDListPointerTable:
 	dw Unknown_79b24
-	db $77
+	dn 7, 7
 	dw Unknown_79b55
-	db $57
+	dn 5, 7
 	dw Unknown_79b78
-	db $37
-	dw Unknown_79b8d
-	db $77
-	dw Unknown_79bbe
-	db $77
-	dw Unknown_79bef
-	db $77
+	dn 3, 7
+	dw GengarIntroTiles1
+	dn 7, 7
+	dw GengarIntroTiles2
+	dn 7, 7
+	dw GengarIntroTiles3
+	dn 7, 7
 	dw Unknown_79c20
-	db $86
+	dn 8, 6
 	dw Unknown_79c50
-	db $3C
+	dn 3, 12
 
 DownscaledMonTiles_5x5:
 	db $31,$38,$46,$54,$5B
@@ -2637,7 +2637,7 @@
 	db $02,$09,$10,$17,$1E,$25,$2C
 	db $04,$0B,$12,$19,$20,$27,$2E
 
-Unknown_79b8d:
+GengarIntroTiles1:
 	db $00,$00,$00,$00,$00,$00,$00
 	db $00,$00,$00,$00,$00,$19,$00
 	db $02,$06,$0B,$10,$14,$1A,$00
@@ -2646,7 +2646,7 @@
 	db $04,$09,$0E,$13,$17,$1D,$1F
 	db $05,$0A,$0F,$01,$18,$1E,$20
 
-Unknown_79bbe:
+GengarIntroTiles2:
 	db $00,$00,$00,$30,$00,$37,$00
 	db $00,$00,$2B,$31,$34,$38,$3D
 	db $21,$26,$2C,$01,$35,$39,$3E
@@ -2655,7 +2655,7 @@
 	db $24,$29,$2F,$01,$01,$3B,$00
 	db $25,$2A,$01,$01,$01,$3C,$00
 
-Unknown_79bef:
+GengarIntroTiles3:
 	db $00,$00,$00,$00,$00,$00,$00
 	db $00,$00,$47,$4D,$00,$00,$00
 	db $00,$00,$48,$4E,$52,$56,$5B
--- a/engine/intro.asm
+++ b/engine/intro.asm
@@ -1,7 +1,15 @@
-MOVE_GENGAR_RIGHT   EQU $00
-MOVE_GENGAR_LEFT    EQU $01
-MOVE_NIDORINO_RIGHT EQU $ff
+const_value = -1
+	const MOVE_NIDORINO_RIGHT
+	const MOVE_GENGAR_RIGHT
+	const MOVE_GENGAR_LEFT
 
+ANIMATION_END EQU 80
+
+const_value = 3
+	const GENGAR_INTRO_TILES1
+	const GENGAR_INTRO_TILES2
+	const GENGAR_INTRO_TILES3
+
 PlayIntro:
 	xor a
 	ld [hJoyHeld], a
@@ -20,13 +28,13 @@
 PlayIntroScene:
 	ld b, SET_PAL_NIDORINO_INTRO
 	call RunPaletteCommand
-	ld a, %11100100
+	ldPal a, BLACK, DARK_GRAY, LIGHT_GRAY, WHITE
 	ld [rBGP], a
 	ld [rOBP0], a
 	ld [rOBP1], a
 	xor a
 	ld [hSCX], a
-	ld b, $3 ; Gengar tiles
+	ld b, GENGAR_INTRO_TILES1
 	call IntroCopyTiles
 	ld a, 0
 	ld [wBaseCoordX], a
@@ -50,7 +58,7 @@
 	call PlaySound
 	ld de, IntroNidorinoAnimation2
 	call AnimateIntroNidorino
-	ld c, $a
+	ld c, 10
 	call CheckForUserInterruption
 	ret c
 
@@ -64,23 +72,23 @@
 	call PlaySound
 	ld de, IntroNidorinoAnimation2
 	call AnimateIntroNidorino
-	ld c, $1e
+	ld c, 30
 	call CheckForUserInterruption
 	ret c
 
 ; raise
-	ld b, $4
+	ld b, GENGAR_INTRO_TILES2
 	call IntroCopyTiles
 	ld a, SFX_INTRO_RAISE
 	call PlaySound
 	lb de, 8 / 2, MOVE_GENGAR_LEFT
 	call IntroMoveMon
-	ld c, $1e
+	ld c, 30
 	call CheckForUserInterruption
 	ret c
 
 ; slash
-	ld b, $5
+	ld b, GENGAR_INTRO_TILES3
 	call IntroCopyTiles
 	ld a, SFX_INTRO_CRASH
 	call PlaySound
@@ -89,19 +97,19 @@
 ; hip
 	ld a, SFX_INTRO_HIP
 	call PlaySound
-	ld a, $24
+	ld a, (FightIntroFrontMon2 - FightIntroFrontMon) / BYTES_PER_TILE
 	ld [wIntroNidorinoBaseTile], a
 	ld de, IntroNidorinoAnimation3
 	call AnimateIntroNidorino
-	ld c, $1e
+	ld c, 30
 	call CheckForUserInterruption
 	ret c
 
 	lb de, 8 / 2, MOVE_GENGAR_LEFT
 	call IntroMoveMon
-	ld b, $3
+	ld b, GENGAR_INTRO_TILES1
 	call IntroCopyTiles
-	ld c, $3c
+	ld c, 60
 	call CheckForUserInterruption
 	ret c
 
@@ -117,15 +125,15 @@
 	call PlaySound
 	ld de, IntroNidorinoAnimation5
 	call AnimateIntroNidorino
-	ld c, $14
+	ld c, 20
 	call CheckForUserInterruption
 	ret c
 
-	ld a, $24
+	ld a, (FightIntroFrontMon2 - FightIntroFrontMon) / BYTES_PER_TILE
 	ld [wIntroNidorinoBaseTile], a
 	ld de, IntroNidorinoAnimation6
 	call AnimateIntroNidorino
-	ld c, $1e
+	ld c, 30
 	call CheckForUserInterruption
 	ret c
 
@@ -132,7 +140,7 @@
 ; lunge
 	ld a, SFX_INTRO_LUNGE
 	call PlaySound
-	ld a, $48
+	ld a, (FightIntroFrontMon3 - FightIntroFrontMon) / BYTES_PER_TILE
 	ld [wIntroNidorinoBaseTile], a
 	ld de, IntroNidorinoAnimation7
 	jp AnimateIntroNidorino
@@ -139,7 +147,7 @@
 
 AnimateIntroNidorino:
 	ld a, [de]
-	cp $50
+	cp ANIMATION_END
 	ret z
 	ld [wBaseCoordY], a
 	inc de
@@ -189,7 +197,7 @@
 	ld [hli], a ; X
 	ld a, d
 	ld [hli], a ; tile
-	ld a, $80
+	ld a, OAM_BEHIND_BG
 	ld [hli], a ; attributes
 	inc d
 	dec c
@@ -204,7 +212,7 @@
 
 IntroClearScreen:
 	ld hl, vBGMap1
-	ld bc, $240
+	ld bc, BG_MAP_WIDTH * SCREEN_HEIGHT
 	jr IntroClearCommon
 
 IntroClearMiddleOfScreen:
@@ -213,7 +221,7 @@
 	ld bc, SCREEN_WIDTH * 10
 
 IntroClearCommon:
-	ld [hl], $0
+	ld [hl], 0
 	inc hl
 	dec bc
 	ld a, b
@@ -222,7 +230,7 @@
 	ret
 
 IntroPlaceBlackTiles:
-	ld a, $1
+	ld a, 1
 .loop
 	ld [hli], a
 	dec c
@@ -231,11 +239,10 @@
 
 IntroMoveMon:
 ; d = number of times to move the mon (2 pixels each time)
-; e: $00 = move Gengar right, $01 = move Gengar left, $ff = move Nidorino right
 	ld a, e
-	cp $ff
+	cp MOVE_NIDORINO_RIGHT
 	jr z, .moveNidorinoRight
-	cp $1
+	cp MOVE_GENGAR_LEFT
 	jr z, .moveGengarLeft
 ; move Gengar right
 	ld a, [hSCX]
@@ -286,7 +293,7 @@
 	ld a, BANK(FightIntroBackMon)
 	call FarCopyData2
 	ld hl, GameFreakIntro
-	ld de, vChars2 + $600
+	ld de, vChars2 + (FightIntroBackMonEnd - FightIntroBackMon)
 	ld bc, GameFreakIntroEnd - GameFreakIntro
 	ld a, BANK(GameFreakIntro)
 	call FarCopyData2
@@ -305,7 +312,7 @@
 	ld b, SET_PAL_GAME_FREAK_INTRO
 	call RunPaletteCommand
 	callba LoadCopyrightAndTextBoxTiles
-	ld a, %11100100
+	ldPal a, BLACK, DARK_GRAY, LIGHT_GRAY, WHITE
 	ld [rBGP], a
 	ld c, 180
 	call DelayFrames
@@ -348,10 +355,10 @@
 	ld c, SCREEN_WIDTH * 4
 	call IntroPlaceBlackTiles
 	ld hl, vBGMap1
-	ld c, $80
+	ld c,  BG_MAP_WIDTH * 4
 	call IntroPlaceBlackTiles
-	ld hl, vBGMap1 + $1c0
-	ld c, $80
+	ld hl, vBGMap1 + BG_MAP_WIDTH * 14
+	ld c,  BG_MAP_WIDTH * 4
 	jp IntroPlaceBlackTiles
 
 EmptyFunc4:
@@ -359,7 +366,7 @@
 
 IntroNidorinoAnimation0:
 	db 0, 0
-	db $50
+	db ANIMATION_END
 
 IntroNidorinoAnimation1:
 ; This is a sequence of pixel movements for part of the Nidorino animation. This
@@ -370,7 +377,7 @@
 	db -1, 2
 	db  1, 2
 	db  2, 2
-	db $50 ; list terminator
+	db ANIMATION_END
 
 IntroNidorinoAnimation2:
 ; This is a sequence of pixel movements for part of the Nidorino animation.
@@ -380,7 +387,7 @@
 	db -1, -2
 	db  1, -2
 	db  2, -2
-	db $50 ; list terminator
+	db ANIMATION_END
 
 IntroNidorinoAnimation3:
 ; This is a sequence of pixel movements for part of the Nidorino animation.
@@ -390,7 +397,7 @@
 	db  -8, 6
 	db   8, 6
 	db  12, 6
-	db $50 ; list terminator
+	db ANIMATION_END
 
 IntroNidorinoAnimation4:
 ; This is a sequence of pixel movements for part of the Nidorino animation.
@@ -400,7 +407,7 @@
 	db -4, -4
 	db  4, -4
 	db  8, -4
-	db $50 ; list terminator
+	db ANIMATION_END
 
 IntroNidorinoAnimation5:
 ; This is a sequence of pixel movements for part of the Nidorino animation.
@@ -410,7 +417,7 @@
 	db -4, 4
 	db  4, 4
 	db  8, 4
-	db $50 ; list terminator
+	db ANIMATION_END
 
 IntroNidorinoAnimation6:
 ; This is a sequence of pixel movements for part of the Nidorino animation.
@@ -419,7 +426,7 @@
 	db 2, 0
 	db 2, 0
 	db 0, 0
-	db $50 ; list terminator
+	db ANIMATION_END
 
 IntroNidorinoAnimation7:
 ; This is a sequence of pixel movements for part of the Nidorino animation.
@@ -428,7 +435,7 @@
 	db -7, -14
 	db -6, -12
 	db -4, -10
-	db $50 ; list terminator
+	db ANIMATION_END
 
 GameFreakIntro:
 	INCBIN "gfx/gamefreak_intro.2bpp"
@@ -444,12 +451,17 @@
 
 IF DEF(_RED)
 	INCBIN "gfx/red/intro_nido_1.2bpp"
+FightIntroFrontMon2:
 	INCBIN "gfx/red/intro_nido_2.2bpp"
+FightIntroFrontMon3:
 	INCBIN "gfx/red/intro_nido_3.2bpp"
 ENDC
+
 IF DEF(_BLUE)
 	INCBIN "gfx/blue/intro_purin_1.2bpp"
+FightIntroFrontMon2:
 	INCBIN "gfx/blue/intro_purin_2.2bpp"
+FightIntroFrontMon3:
 	INCBIN "gfx/blue/intro_purin_3.2bpp"
 ENDC
 
--- a/macros/asm_macros.asm
+++ b/macros/asm_macros.asm
@@ -186,3 +186,7 @@
 	tx_pre_id \1
 	jp PrintPredefTextID
 ENDM
+
+ldPal: MACRO
+	ld \1, \2 << 6 | \3 << 4 | \4 << 2 | \5
+ENDM