diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/main.c | 22 | ||||
-rw-r--r-- | source/map.c | 21 |
2 files changed, 42 insertions, 1 deletions
diff --git a/source/main.c b/source/main.c index d0a60b1..eca5ea2 100644 --- a/source/main.c +++ b/source/main.c @@ -4,11 +4,13 @@ #include "../include/memmap.h" #include "../include/types.h" #include "../include/memdef.h" - #include "../include/point.h" #include "../include/velocity.h" #include "../include/playerObject.h" +#include "../include/map.h" + #include "../sprites/player.h" +#include "../sprites/block.h" OBJ_ATTR obj_buffer[128]; OBJ_AFFINE *obj_aff_buffer= (OBJ_AFFINE*)obj_buffer; // Object affine-buffer @@ -16,6 +18,7 @@ OBJ_AFFINE *obj_aff_buffer= (OBJ_AFFINE*)obj_buffer; // Object affine-buffer int main() { memcpy(&tile_mem[4][0], playerTiles, playerTilesLen); memcpy(pal_obj_mem, playerPal, playerPalLen); + memcpy(&tile_mem[4][4], blockTiles, blockTilesLen); oam_init(obj_buffer, 128); @@ -31,9 +34,26 @@ int main() { player.vel.dy -= 9 << FIX_SHIFT; } + updatePlayer(&player, 120); obj_affine_copy(obj_aff_mem, player.affine, 1); obj_copy(obj_mem, player.obj, 1); + + OBJ_ATTR tileObject; + for (int i = 0; i < 7; i++) { + for (int j = 0; j < 12; j++){ + obj_set_attr(&tileObject, + ATTR0_SQUARE, + ATTR1_SIZE_16, + ATTR2_PALBANK(0) | 4 + ); + obj_set_pos(&tileObject, (j * 16), (i * 16)); + if (map1[i][j]) { + obj_copy(obj_mem + (17 * i + j) + 1, &tileObject, 1); + } + } + } + } return 0; diff --git a/source/map.c b/source/map.c new file mode 100644 index 0000000..41048d0 --- /dev/null +++ b/source/map.c @@ -0,0 +1,21 @@ +#include "../include/map.h" +/* +const int map1[7][20] = { + {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, 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}, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, +}; +*/ +const int map1[7][20] = { + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, +}; |