mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08:00
This commit is contained in:
parent
2d5bd722cd
commit
15f452ff26
@ -82,5 +82,3 @@ DEF SPAWN_N_A EQU -1
|
||||
const_def
|
||||
const FLY_1
|
||||
DEF NUM_FLYPOINTS EQU const_value
|
||||
|
||||
DEF MAX_OUTDOOR_SPRITES EQU 23 ; see engine/overworld/overworld.asm
|
||||
|
@ -10,26 +10,17 @@ OutdoorSprites:
|
||||
|
||||
Level1GroupSprites:
|
||||
; Level2GroupSprites:
|
||||
db SPRITE_SUICUNE
|
||||
db SPRITE_SILVER_TROPHY
|
||||
db SPRITE_FAMICOM
|
||||
db SPRITE_POKEDEX
|
||||
db SPRITE_WILL
|
||||
db SPRITE_KAREN
|
||||
db SPRITE_NURSE
|
||||
db SPRITE_OLD_LINK_RECEPTIONIST
|
||||
db SPRITE_BIG_LAPRAS
|
||||
db SPRITE_BIG_ONIX
|
||||
db SPRITE_SUDOWOODO
|
||||
db SPRITE_BIG_SNORLAX
|
||||
db SPRITE_TEACHER
|
||||
db SPRITE_FISHER
|
||||
db SPRITE_YOUNGSTER
|
||||
db SPRITE_BLUE
|
||||
db SPRITE_GRAMPS
|
||||
db SPRITE_BUG_CATCHER
|
||||
db SPRITE_FISHER
|
||||
db SPRITE_COOLTRAINER_M
|
||||
db SPRITE_COOLTRAINER_F
|
||||
db SPRITE_SWIMMER_GIRL
|
||||
db SPRITE_SWIMMER_GUY
|
||||
db SPRITE_SUPER_NERD
|
||||
db SPRITE_GRAMPS
|
||||
db SPRITE_TEACHER
|
||||
db SPRITE_LASS
|
||||
; max 9 of 9 walking sprites
|
||||
db SPRITE_POKE_BALL
|
||||
db SPRITE_FRUIT_TREE
|
||||
db SPRITE_ROCK
|
||||
db 0 ; end
|
||||
|
@ -92,32 +92,6 @@ GetPlayerSprite:
|
||||
INCLUDE "data/sprites/player_sprites.asm"
|
||||
|
||||
AddMapSprites:
|
||||
call GetMapEnvironment
|
||||
call CheckOutdoorMap
|
||||
jr z, .outdoor
|
||||
call AddIndoorSprites
|
||||
ret
|
||||
|
||||
.outdoor
|
||||
call AddOutdoorSprites
|
||||
ret
|
||||
|
||||
AddIndoorSprites:
|
||||
ld hl, wMap1ObjectSprite
|
||||
ld a, 1
|
||||
.loop
|
||||
push af
|
||||
ld a, [hl]
|
||||
call AddSpriteGFX
|
||||
ld de, MAPOBJECT_LENGTH
|
||||
add hl, de
|
||||
pop af
|
||||
inc a
|
||||
cp NUM_OBJECTS
|
||||
jr nz, .loop
|
||||
ret
|
||||
|
||||
AddOutdoorSprites:
|
||||
ld a, [wMapGroup]
|
||||
dec a
|
||||
ld c, a
|
||||
@ -128,15 +102,12 @@ AddOutdoorSprites:
|
||||
ld a, [hli]
|
||||
ld h, [hl]
|
||||
ld l, a
|
||||
ld c, MAX_OUTDOOR_SPRITES
|
||||
.loop
|
||||
push bc
|
||||
ld a, [hli]
|
||||
and a
|
||||
ret z
|
||||
call AddSpriteGFX
|
||||
pop bc
|
||||
dec c
|
||||
jr nz, .loop
|
||||
ret
|
||||
jr .loop
|
||||
|
||||
LoadUsedSpritesGFX:
|
||||
ld a, MAPCALLBACK_SPRITES
|
||||
@ -303,7 +274,6 @@ _GetSpritePalette::
|
||||
|
||||
LoadAndSortSprites:
|
||||
call LoadSpriteGFX
|
||||
call SortUsedSprites
|
||||
call ArrangeUsedSprites
|
||||
ret
|
||||
|
||||
@ -369,76 +339,6 @@ LoadSpriteGFX:
|
||||
ld a, l
|
||||
ret
|
||||
|
||||
SortUsedSprites:
|
||||
; Bubble-sort sprites by type.
|
||||
|
||||
; Run backwards through wUsedSprites to find the last one.
|
||||
|
||||
ld c, SPRITE_GFX_LIST_CAPACITY
|
||||
ld de, wUsedSprites + (SPRITE_GFX_LIST_CAPACITY - 1) * 2
|
||||
.FindLastSprite:
|
||||
ld a, [de]
|
||||
and a
|
||||
jr nz, .FoundLastSprite
|
||||
dec de
|
||||
dec de
|
||||
dec c
|
||||
jr nz, .FindLastSprite
|
||||
.FoundLastSprite:
|
||||
dec c
|
||||
jr z, .quit
|
||||
|
||||
; If the length of the current sprite is
|
||||
; higher than a later one, swap them.
|
||||
|
||||
inc de
|
||||
ld hl, wUsedSprites + 1
|
||||
|
||||
.CheckSprite:
|
||||
push bc
|
||||
push de
|
||||
push hl
|
||||
|
||||
.CheckFollowing:
|
||||
ld a, [de]
|
||||
cp [hl]
|
||||
jr nc, .loop
|
||||
|
||||
; Swap the two sprites.
|
||||
|
||||
ld b, a
|
||||
ld a, [hl]
|
||||
ld [hl], b
|
||||
ld [de], a
|
||||
dec de
|
||||
dec hl
|
||||
ld a, [de]
|
||||
ld b, a
|
||||
ld a, [hl]
|
||||
ld [hl], b
|
||||
ld [de], a
|
||||
inc de
|
||||
inc hl
|
||||
|
||||
; Keep doing this until everything's in order.
|
||||
|
||||
.loop
|
||||
dec de
|
||||
dec de
|
||||
dec c
|
||||
jr nz, .CheckFollowing
|
||||
|
||||
pop hl
|
||||
inc hl
|
||||
inc hl
|
||||
pop de
|
||||
pop bc
|
||||
dec c
|
||||
jr nz, .CheckSprite
|
||||
|
||||
.quit
|
||||
ret
|
||||
|
||||
ArrangeUsedSprites:
|
||||
; Get the length of each sprite and space them out in VRAM.
|
||||
; Crystal introduces a second table in VRAM bank 0.
|
||||
|
Loading…
Reference in New Issue
Block a user