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 jr nz, .copyLoop
ret 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. ;bytes to write to sound channel 1 registers for health alarm.
;starting at FF11 (FF10 is always zeroed), so these bytes are: ;starting at FF11 (FF10 is always zeroed).
;length, envelope, freq lo, freq hi
.toneDataHi .toneDataHi
db $A0,$E2,$50,$87 alarm_tone $A0, $E2, $8750
.toneDataLo .toneDataLo
db $B0,$E2,$EE,$86 alarm_tone $B0, $E2, $86EE
;written to stop the alarm ;written to stop the alarm
.toneDataSilence .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_PRIORITY EQU 7 ; 0: OBJ above BG, 1: OBJ behind BG (colors 1-3)
; OAM attribute masks ; OAM attribute masks
OAM_HFLIP EQU 1 << OAM_X_FLIP ; horizontal flip OAM_OBP1 EQU 1 << OAM_OBP_NUM ; OBJ palette 1
OAM_VFLIP EQU 1 << OAM_Y_FLIP ; vertical flip 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) 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_24
db $02 ; ROUTE_25 db $02 ; ROUTE_25
EAST_WEST EQU 1
NORTH_SOUTH EQU 2
; Format: ; Format:
; 00: determines whether the map is split East/West or North/South ; 00: determines whether the map is split EAST_WEST or NORTH_SOUTH
; $01 = East/West divide
; $02 = North/South divide
; 01: coordinate of dividing line ; 01: coordinate of dividing line
; 02: sprite set ID if in the West or North side ; 02: sprite set ID if in the West or North side
; 03: sprite set ID if in the East or South side ; 03: sprite set ID if in the East or South side
SplitMapSpriteSets: SplitMapSpriteSets:
db $02, $25, $02, $01 ; $f1 db NORTH_SOUTH, 37, $02, $01 ; $f1
db $02, $32, $02, $03 ; $f2 db NORTH_SOUTH, 50, $02, $03 ; $f2
db $01, $39, $04, $08 ; $f3 db EAST_WEST, 57, $04, $08 ; $f3
db $02, $15, $03, $08 ; $f4 db NORTH_SOUTH, 21, $03, $08 ; $f4
db $01, $08, $0A, $08 ; $f5 db EAST_WEST, 8, $0A, $08 ; $f5
db $01, $18, $09, $05 ; $f6 db EAST_WEST, 24, $09, $05 ; $f6
db $01, $22, $09, $0A ; $f7 db EAST_WEST, 34, $09, $0A ; $f7
db $01, $35, $01, $0A ; $f8 db EAST_WEST, 53, $01, $0A ; $f8
db $02, $21, $02, $07 ; $f9 db NORTH_SOUTH, 33, $02, $07 ; $f9
db $02, $02, $07, $04 ; $fa db NORTH_SOUTH, 2, $07, $04 ; $fa
db $01, $11, $05, $07 ; $fb db EAST_WEST, 17, $05, $07 ; $fb
db $01, $03, $07, $03 ; $fc db EAST_WEST, 3, $07, $03 ; $fc
SpriteSets: SpriteSets:
; sprite set $01 ; sprite set $01

View file

@ -79,7 +79,19 @@ ScalePixelsByTwo:
; repeats each input bit twice ; repeats each input bit twice
DuplicateBitsTable: DuplicateBitsTable:
db $00, $03, $0c, $0f db %00000000
db $30, $33, $3c, $3f db %00000011
db $c0, $c3, $cc, $cf db %00001100
db $f0, $f3, $fc, $ff 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 jr nz, .loop
ret ret
gym_gate_coord: MACRO
db \1, \2, \3, 0
ENDM
HORIZONTAL_GATE_BLOCK EQU $54
VERTICAL_GATE_BLOCK EQU $5f
CinnabarGymGateCoords: CinnabarGymGateCoords:
; format: x-coord, y-coord, direction, padding ; x coord, y coord, block id
; direction: $54 = horizontal gate, $5f = vertical gate gym_gate_coord 9, 3, HORIZONTAL_GATE_BLOCK
db $09,$03,$54,$00 gym_gate_coord 6, 3, HORIZONTAL_GATE_BLOCK
db $06,$03,$54,$00 gym_gate_coord 6, 6, HORIZONTAL_GATE_BLOCK
db $06,$06,$54,$00 gym_gate_coord 3, 8, VERTICAL_GATE_BLOCK
db $03,$08,$5f,$00 gym_gate_coord 2, 6, HORIZONTAL_GATE_BLOCK
db $02,$06,$54,$00 gym_gate_coord 2, 3, HORIZONTAL_GATE_BLOCK
db $02,$03,$54,$00

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -470,14 +470,10 @@ ItsABiteText:
FishingRodOAM: FishingRodOAM:
; specifies how the fishing rod should be drawn on the screen ; specifies how the fishing rod should be drawn on the screen
; first byte = screen y coordinate dbsprite 9, 11, 4, 3, $fd, 0 ; down
; second byte = screen x coordinate dbsprite 9, 8, 4, 4, $fd, 0 ; up
; third byte = tile number dbsprite 8, 10, 0, 0, $fe, 0 ; left
; fourth byte = sprite properties dbsprite 11, 10, 0, 0, $fe, OAM_HFLIP ; right
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")
fishing_gfx: MACRO fishing_gfx: MACRO
dw \1 dw \1

View file

@ -15,3 +15,8 @@ color EQUS "+ PAL_COLOR_SIZE *"
tiles EQUS "* LEN_2BPP_TILE" tiles EQUS "* LEN_2BPP_TILE"
tile 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