This file contains 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
`define WIDTH_TO_MSB_POS(width) ((width) - 1) | |
// Unsigned (or signed!) integer division | |
// Don't try to do larger than a 128-bit division with this without | |
// increasing counter_msb_pos. | |
// Depending on the FPGA being used and the clock rate, it may be doable to | |
// perform more than one iterate() per cycle, obtaining faster divisions. |
This file contains 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
#include <iostream> | |
using std::cout; | |
using std::cin; | |
using std::cerr; | |
using std::endl; | |
// Pass the name of some other macro to list_of_sprite_classes() | |
#define list_of_sprite_classes(other_macro) \ |
This file contains 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
void sprite::copy_the_oam_entry_to_oam_mirror ( u32 slot_for_oam_mirror ) | |
{ | |
//oam_mirror [slot_for_oam_mirror].attr0 = the_oam_entry.attr0; | |
//oam_mirror [slot_for_oam_mirror].attr1 = the_oam_entry.attr1; | |
//oam_mirror [slot_for_oam_mirror].attr2 = the_oam_entry.attr2; | |
//u32 output; | |
//asm __volatile__ | |
//( | |
// "mov r0, %1\n\t" |
This file contains 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
void player_sprite_stuff::handle_jumping_stuff ( sprite& the_player, | |
u32 is_jump_key_hit, u32 is_jump_key_held ) | |
{ | |
if ( the_player.on_ground && is_jump_key_hit ) | |
{ | |
the_player.vel.y = jump_vel; | |
the_player.jump_hold_timer = max_jump_hold_timer; | |
} | |
else if ( !the_player.on_ground ) | |
{ |
This file contains 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) ); |
This file contains 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, |
This file contains 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
// There are a total of 16 sprite palettes, each with 15 colors (and one | |
// transparent "color"). I have decided to combine the identification of | |
// sprite tilesets and the sprite palette slots into a single enum. This | |
// should work fine for now. | |
enum sprite_gfx_category | |
{ | |
// The player uses sprite palette slot 0 | |
sgc_player, | |
// Powerup sprites use sprite palette slot 1 |
This file contains 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
enum sprite_type | |
{ | |
// The Default Sprite | |
st_default, | |
// The Player | |
st_player, | |
// Powerup Sprites | |
st_waffle, |
This file contains 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
#include "test_level.hpp" | |
const u32 test_level_block_ids [test_level_size] | |
= { | |
5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, | |
5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5, | |
5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5, | |
5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5, | |
5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5, |
This file contains 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
void generate_coll_point_group_16x16 ( const coll_box& the_coll_box, | |
coll_point_group& the_pt_group ) | |
{ | |
the_pt_group.correct_num_used_points_16x16 (); | |
// The collision points | |
vec2_f24p8 & pt_lt = the_pt_group.get_pt_lt_16x16 (), | |
& pt_lb = the_pt_group.get_pt_lb_16x16 (), | |
& pt_tl = the_pt_group.get_pt_tl_16x16 (), | |
& pt_tr = the_pt_group.get_pt_tr_16x16 (), |