Created
July 26, 2015 21:13
-
-
Save fl4shk/93cb486dc5331386b0d9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
u32 next_free_sprite_vram_slot; | |
u32 sprite_gfx_category_first_vram_slot_list [sgc_count]; | |
void upload_default_sprite_palettes () | |
{ | |
//memcpy32 ( obj_pal_ram, the_spritesPal, | |
// the_spritesPalLen / sizeof (u32) ); | |
memcpy32 ( &( obj_pal_ram [sgc_player * 16] ), the_player_spritesPal, | |
the_player_spritesPalLen / sizeof (u32) ); | |
memcpy32 ( &( obj_pal_ram [sgc_powerup * 16] ), the_powerup_spritesPal, | |
the_powerup_spritesPalLen / sizeof (u32) ); | |
} | |
void allocate_sprite_vram_and_copy_sprite_tiles ( const u16* tiles, | |
u32 tiles_len, sprite_gfx_category the_gfx_category ) | |
{ | |
// Copy the sprite graphics to VRAM | |
memcpy32 ( &( obj_tile_vram [next_free_sprite_vram_slot] ), | |
tiles, tiles_len / sizeof (u32) ); | |
sprite_gfx_category_first_vram_slot_list [the_gfx_category] | |
= next_free_sprite_vram_slot; | |
// Allocate VRAM for the sprite graphics | |
next_free_sprite_vram_slot += tiles_len / sizeof (u16); | |
} | |
void upload_default_sprite_graphics () | |
{ | |
//memcpy32 ( obj_tile_vram, the_spritesTiles, | |
// the_spritesTilesLen / sizeof (u32) ); | |
// Initialize the global sprite VRAM allocation variables. | |
next_free_sprite_vram_slot = 0; | |
memfill32 ( sprite_gfx_category_first_vram_slot_list, 0, sgc_count ); | |
// Copy the player's graphics to VRAM | |
allocate_sprite_vram_and_copy_sprite_tiles ( the_player_spritesTiles, | |
the_player_spritesTilesLen, sgc_player ); | |
// Copy the powerups' tiles to VRAM | |
allocate_sprite_vram_and_copy_sprite_tiles | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment