Port dbsprite macro for OAM y,x,tile,attr data from pokecrystal

This commit is contained in:
Rangi 2020-07-17 15:58:06 -04:00
parent f53341efa1
commit 76289dfda0
15 changed files with 893 additions and 872 deletions

View file

@ -61,15 +61,20 @@ Music_DoLowHealthAlarm::
jr nz, .copyLoop
ret
alarm_tone: MACRO
db \1 ; length
db \2 ; envelope
dw \3 ; frequency
ENDM
;bytes to write to sound channel 1 registers for health alarm.
;starting at FF11 (FF10 is always zeroed), so these bytes are:
;length, envelope, freq lo, freq hi
;starting at FF11 (FF10 is always zeroed).
.toneDataHi
db $A0,$E2,$50,$87
alarm_tone $A0, $E2, $8750
.toneDataLo
db $B0,$E2,$EE,$86
alarm_tone $B0, $E2, $86EE
;written to stop the alarm
.toneDataSilence
db $00,$00,$00,$80
alarm_tone $00, $00, $8000

View file

@ -13,6 +13,7 @@ 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_OBP1 EQU 1 << OAM_OBP_NUM ; OBJ palette 1
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)

File diff suppressed because it is too large Load diff

View file

@ -37,26 +37,27 @@ MapSpriteSets:
db $02 ; ROUTE_24
db $02 ; ROUTE_25
EAST_WEST EQU 1
NORTH_SOUTH EQU 2
; Format:
; 00: determines whether the map is split East/West or North/South
; $01 = East/West divide
; $02 = North/South divide
; 00: determines whether the map is split EAST_WEST or NORTH_SOUTH
; 01: coordinate of dividing line
; 02: sprite set ID if in the West or North side
; 03: sprite set ID if in the East or South side
SplitMapSpriteSets:
db $02, $25, $02, $01 ; $f1
db $02, $32, $02, $03 ; $f2
db $01, $39, $04, $08 ; $f3
db $02, $15, $03, $08 ; $f4
db $01, $08, $0A, $08 ; $f5
db $01, $18, $09, $05 ; $f6
db $01, $22, $09, $0A ; $f7
db $01, $35, $01, $0A ; $f8
db $02, $21, $02, $07 ; $f9
db $02, $02, $07, $04 ; $fa
db $01, $11, $05, $07 ; $fb
db $01, $03, $07, $03 ; $fc
db NORTH_SOUTH, 37, $02, $01 ; $f1
db NORTH_SOUTH, 50, $02, $03 ; $f2
db EAST_WEST, 57, $04, $08 ; $f3
db NORTH_SOUTH, 21, $03, $08 ; $f4
db EAST_WEST, 8, $0A, $08 ; $f5
db EAST_WEST, 24, $09, $05 ; $f6
db EAST_WEST, 34, $09, $0A ; $f7
db EAST_WEST, 53, $01, $0A ; $f8
db NORTH_SOUTH, 33, $02, $07 ; $f9
db NORTH_SOUTH, 2, $07, $04 ; $fa
db EAST_WEST, 17, $05, $07 ; $fb
db EAST_WEST, 3, $07, $03 ; $fc
SpriteSets:
; sprite set $01

View file

@ -79,7 +79,19 @@ ScalePixelsByTwo:
; repeats each input bit twice
DuplicateBitsTable:
db $00, $03, $0c, $0f
db $30, $33, $3c, $3f
db $c0, $c3, $cc, $cf
db $f0, $f3, $fc, $ff
db %00000000
db %00000011
db %00001100
db %00001111
db %00110000
db %00110011
db %00111100
db %00111111
db %11000000
db %11000011
db %11001100
db %11001111
db %11110000
db %11110011
db %11111100
db %11111111

View file

@ -183,12 +183,18 @@ UpdateCinnabarGymGateTileBlocks_::
jr nz, .loop
ret
gym_gate_coord: MACRO
db \1, \2, \3, 0
ENDM
HORIZONTAL_GATE_BLOCK EQU $54
VERTICAL_GATE_BLOCK EQU $5f
CinnabarGymGateCoords:
; format: x-coord, y-coord, direction, padding
; direction: $54 = horizontal gate, $5f = vertical gate
db $09,$03,$54,$00
db $06,$03,$54,$00
db $06,$06,$54,$00
db $03,$08,$5f,$00
db $02,$06,$54,$00
db $02,$03,$54,$00
; x coord, y coord, block id
gym_gate_coord 9, 3, HORIZONTAL_GATE_BLOCK
gym_gate_coord 6, 3, HORIZONTAL_GATE_BLOCK
gym_gate_coord 6, 6, HORIZONTAL_GATE_BLOCK
gym_gate_coord 3, 8, VERTICAL_GATE_BLOCK
gym_gate_coord 2, 6, HORIZONTAL_GATE_BLOCK
gym_gate_coord 2, 3, HORIZONTAL_GATE_BLOCK

View file

@ -599,10 +599,8 @@ PokeText:
; horizontal line that divides the pokedex text description from the rest of the data
PokedexDataDividerLine:
db $68,$69,$6B,$69,$6B
db $69,$6B,$69,$6B,$6B
db $6B,$6B,$69,$6B,$69
db $6B,$69,$6B,$69,$6A
db $68, $69, $6B, $69, $6B, $69, $6B, $69, $6B, $6B
db $6B, $6B, $69, $6B, $69, $6B, $69, $6B, $69, $6A
db "@"
; draws a line of tiles

View file

@ -146,7 +146,7 @@ AnimateShootingStar:
ret
SmallStarsOAM:
db $00,$00,$A2,$90
dbsprite 0, 0, 0, 0, $A2, OAM_BEHIND_BG | OAM_OBP1
SmallStarsOAMEnd:
SmallStarsWaveCoordsPointerTable:
@ -161,28 +161,28 @@ SmallStarsWaveCoordsPointerTable:
; These arrays contain the Y and X coordinates of each OAM entry.
SmallStarsWave1Coords:
db $68,$30
db $68,$40
db $68,$58
db $68,$78
db $68, $30
db $68, $40
db $68, $58
db $68, $78
SmallStarsWave2Coords:
db $68,$38
db $68,$48
db $68,$60
db $68,$70
db $68, $38
db $68, $48
db $68, $60
db $68, $70
SmallStarsWave3Coords:
db $68,$34
db $68,$4C
db $68,$54
db $68,$64
db $68, $34
db $68, $4C
db $68, $54
db $68, $64
SmallStarsWave4Coords:
db $68,$3C
db $68,$5C
db $68,$6C
db $68,$74
db $68, $3C
db $68, $5C
db $68, $6C
db $68, $74
SmallStarsEmptyWave:
db $FF
@ -213,29 +213,29 @@ MoveDownSmallStars:
ret
GameFreakLogoOAMData:
db $48,$50,$8D,$00
db $48,$58,$8E,$00
db $50,$50,$8F,$00
db $50,$58,$90,$00
db $58,$50,$91,$00
db $58,$58,$92,$00
db $60,$30,$80,$00
db $60,$38,$81,$00
db $60,$40,$82,$00
db $60,$48,$83,$00
db $60,$50,$93,$00
db $60,$58,$84,$00
db $60,$60,$85,$00
db $60,$68,$83,$00
db $60,$70,$81,$00
db $60,$78,$86,$00
dbsprite 10, 9, 0, 0, $8d, 0
dbsprite 11, 9, 0, 0, $8e, 0
dbsprite 10, 10, 0, 0, $8f, 0
dbsprite 11, 10, 0, 0, $90, 0
dbsprite 10, 11, 0, 0, $91, 0
dbsprite 11, 11, 0, 0, $92, 0
dbsprite 6, 12, 0, 0, $80, 0
dbsprite 7, 12, 0, 0, $81, 0
dbsprite 8, 12, 0, 0, $82, 0
dbsprite 9, 12, 0, 0, $83, 0
dbsprite 10, 12, 0, 0, $93, 0
dbsprite 11, 12, 0, 0, $84, 0
dbsprite 12, 12, 0, 0, $85, 0
dbsprite 13, 12, 0, 0, $83, 0
dbsprite 14, 12, 0, 0, $81, 0
dbsprite 15, 12, 0, 0, $86, 0
GameFreakLogoOAMDataEnd:
GameFreakShootingStarOAMData:
db $00,$A0,$A0,$10
db $00,$A8,$A0,$30
db $08,$A0,$A1,$10
db $08,$A8,$A1,$30
dbsprite 20, 0, 0, 0, $a0, OAM_OBP1
dbsprite 21, 0, 0, 0, $a0, OAM_OBP1 | OAM_HFLIP
dbsprite 20, 1, 0, 0, $a1, OAM_OBP1
dbsprite 21, 1, 0, 0, $a1, OAM_OBP1 | OAM_HFLIP
GameFreakShootingStarOAMDataEnd:
FallingStar:

View file

@ -59,11 +59,11 @@ TradeAnimCommon:
addtradefunc: MACRO
\1TradeFunc::
dw \1
ENDM
ENDM
tradefunc: MACRO
db (\1TradeFunc - TradeFuncPointerTable) / 2
ENDM
ENDM
; The functions in the sequences below are executed in order by TradeFuncCommon.
; They are from opposite perspectives. The external clock one makes use of
@ -86,7 +86,7 @@ InternalClockTradeFuncSequence:
tradefunc Trade_ShowEnemyMon
tradefunc Trade_Delay100
tradefunc Trade_Cleanup
db $FF
db -1 ; end
ExternalClockTradeFuncSequence:
tradefunc LoadTradingGFXAndMonNames
@ -110,7 +110,7 @@ ExternalClockTradeFuncSequence:
tradefunc Trade_ShowClearedWindow
tradefunc PrintTradeWentToText
tradefunc Trade_Cleanup
db $FF
db -1 ; end
TradeFuncPointerTable:
addtradefunc LoadTradingGFXAndMonNames
@ -346,8 +346,8 @@ Trade_AnimateBallEnteringLinkCable:
ret
Trade_BallInsideLinkCableOAM:
db $7E,$00,$7E,$20
db $7E,$40,$7E,$60
dbsprite 0, 15, 0, 6, $7e, OAM_HFLIP
dbsprite 8, 15, 0, 6, $7e, OAM_HFLIP | OAM_VFLIP
Trade_ShowEnemyMon:
ld a, TRADE_BALL_TILT_ANIM
@ -697,31 +697,33 @@ Trade_WriteCircleOAM:
jr nz, .loop
ret
trade_circle_oam: MACRO
dw \1
db \2, \3
ENDM
Trade_CircleOAMPointers:
dw Trade_CircleOAM0
db $08,$08
dw Trade_CircleOAM1
db $18,$08
dw Trade_CircleOAM2
db $08,$18
dw Trade_CircleOAM3
db $18,$18
; oam pointer, upper-left x coord, upper-left y coord
trade_circle_oam Trade_CircleOAM0, $08, $08
trade_circle_oam Trade_CircleOAM1, $18, $08
trade_circle_oam Trade_CircleOAM2, $08, $18
trade_circle_oam Trade_CircleOAM3, $18, $18
Trade_CircleOAM0:
db $38,$10,$39,$10
db $3A,$10,$3B,$10
dbsprite 2, 7, 0, 0, $39, OAM_OBP1
dbsprite 2, 7, 0, 2, $3b, OAM_OBP1
Trade_CircleOAM1:
db $39,$30,$38,$30
db $3B,$30,$3A,$30
dbsprite 6, 7, 0, 1, $38, OAM_OBP1 | OAM_HFLIP
dbsprite 6, 7, 0, 3, $3a, OAM_OBP1 | OAM_HFLIP
Trade_CircleOAM2:
db $3A,$50,$3B,$50
db $38,$50,$39,$50
dbsprite 10, 7, 0, 2, $3b, OAM_OBP1 | OAM_VFLIP
dbsprite 10, 7, 0, 0, $39, OAM_OBP1 | OAM_VFLIP
Trade_CircleOAM3:
db $3B,$70,$3A,$70
db $39,$70,$38,$70
dbsprite 14, 7, 0, 3, $3a, OAM_OBP1 | OAM_HFLIP | OAM_VFLIP
dbsprite 14, 7, 0, 1, $38, OAM_OBP1 | OAM_HFLIP | OAM_VFLIP
; a = species
Trade_LoadMonSprite:

View file

@ -123,8 +123,8 @@ WriteCutOrBoulderDustAnimationOAMBlock:
jp WriteOAMBlock
CutOrBoulderDustAnimationTilesAndAttributes:
db $FC,$10,$FD,$10
db $FE,$10,$FF,$10
dbsprite 2, -1, 0, 4, $fd, OAM_OBP1
dbsprite 2, -1, 0, 6, $ff, OAM_OBP1
GetCutOrBoulderDustAnimationOffsets:
ld hl, wSpritePlayerStateData1YPixels

View file

@ -67,8 +67,8 @@ EmotionBubblesPointerTable:
dw HappyEmote
EmotionBubblesOAM:
db $F8,$00,$F9,$00
db $FA,$00,$FB,$00
dbsprite 0, -1, 0, 0, $f9, 0
dbsprite 0, -1, 0, 2, $fb, 0
EmotionBubbles:
ShockEmote: INCBIN "gfx/emotes/shock.2bpp"

View file

@ -66,13 +66,15 @@ PokeCenterFlashingMonitorAndHealBall:
INCBIN "gfx/overworld/heal_machine.2bpp"
PokeCenterOAMData:
db $24,$34,$7C,$10 ; heal machine monitor
db $2B,$30,$7D,$10 ; pokeballs 1-6
db $2B,$38,$7D,$30
db $30,$30,$7D,$10
db $30,$38,$7D,$30
db $35,$30,$7D,$10
db $35,$38,$7D,$30
; heal machine monitor
dbsprite 6, 4, 4, 4, $7c, OAM_OBP1
; poke balls 1-6
dbsprite 6, 5, 0, 3, $7d, OAM_OBP1
dbsprite 7, 5, 0, 3, $7d, OAM_OBP1 | OAM_HFLIP
dbsprite 6, 6, 0, 0, $7d, OAM_OBP1
dbsprite 7, 6, 0, 0, $7d, OAM_OBP1 | OAM_HFLIP
dbsprite 6, 6, 0, 5, $7d, OAM_OBP1
dbsprite 7, 6, 0, 5, $7d, OAM_OBP1 | OAM_HFLIP
; d = value to xor with palette
FlashSprite8Times:

View file

@ -72,5 +72,5 @@ LedgeHoppingShadow:
LedgeHoppingShadowEnd:
LedgeHoppingShadowOAM:
db $FF,$10,$FF,$20
db $FF,$40,$FF,$60
dbsprite 2, -1, 0, 7, $ff, OAM_HFLIP
dbsprite 8, -1, 0, 7, $ff, OAM_HFLIP | OAM_VFLIP

View file

@ -470,14 +470,10 @@ ItsABiteText:
FishingRodOAM:
; specifies how the fishing rod should be drawn on the screen
; first byte = screen y coordinate
; second byte = screen x coordinate
; third byte = tile number
; fourth byte = sprite properties
db $5B, $4C, $FD, $00 ; player facing down
db $44, $4C, $FD, $00 ; player facing up
db $50, $40, $FE, $00 ; player facing left
db $50, $58, $FE, $20 ; player facing right ($20 means "horizontally flip the tile")
dbsprite 9, 11, 4, 3, $fd, 0 ; down
dbsprite 9, 8, 4, 4, $fd, 0 ; up
dbsprite 8, 10, 0, 0, $fe, 0 ; left
dbsprite 11, 10, 0, 0, $fe, OAM_HFLIP ; right
fishing_gfx: MACRO
dw \1

View file

@ -15,3 +15,8 @@ color EQUS "+ PAL_COLOR_SIZE *"
tiles EQUS "* LEN_2BPP_TILE"
tile EQUS "+ LEN_2BPP_TILE *"
dbsprite: MACRO
; x tile, y tile, x pixel, y pixel, vtile offset, attributes
db (\2 * TILE_WIDTH) % $100 + \4, (\1 * TILE_WIDTH) % $100 + \3, \5, \6
ENDM