projects
/
gbajam22
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
starting to separate platform-specific code to facilitate a PC build
[gbajam22]
/
src
/
gamescr.c
diff --git
a/src/gamescr.c
b/src/gamescr.c
index
73566c3
..
96620f3
100644
(file)
--- a/
src/gamescr.c
+++ b/
src/gamescr.c
@@
-21,18
+21,26
@@
static int nframes, num_vbl, backbuf;
static uint16_t *vram[] = { (uint16_t*)VRAM_LFB_FB0_ADDR, (uint16_t*)VRAM_LFB_FB1_ADDR };
static const char *testlvl =
static uint16_t *vram[] = { (uint16_t*)VRAM_LFB_FB0_ADDR, (uint16_t*)VRAM_LFB_FB1_ADDR };
static const char *testlvl =
- "########\n"
- "### s#\n"
- "### ####\n"
- "### #\n"
- "## #\n"
- "## #\n"
- "## #\n"
- "## ### #\n"
- "## ### #\n"
- "## #\n"
- "#### ###\n"
- "########\n";
+ "################\n"
+ "################\n"
+ "################\n"
+ "################\n"
+ "################\n"
+ "####### s#####\n"
+ "####### ########\n"
+ "####### #####\n"
+ "###### #####\n"
+ "###### #####\n"
+ "###### #####\n"
+ "###### ### #####\n"
+ "###### ### #####\n"
+ "###### #####\n"
+ "######## #######\n"
+ "################\n"
+ "################\n"
+ "################\n"
+ "################\n"
+ "################\n";
static struct xvertex tm_floor[] __attribute__((section(".rodata"))) = {
{0x10000, -0x10000, 0x10000, 0, 0x10000, 0, 210},
static struct xvertex tm_floor[] __attribute__((section(".rodata"))) = {
{0x10000, -0x10000, 0x10000, 0, 0x10000, 0, 210},
@@
-49,7
+57,9
@@
static struct player player;
void gamescr(void)
{
void gamescr(void)
{
+ int i;
unsigned char *fb;
unsigned char *fb;
+ uint16_t *cmap;
REG_DISPCNT = 4 | DISPCNT_BG2 | DISPCNT_OBJ | DISPCNT_FB1;
REG_DISPCNT = 4 | DISPCNT_BG2 | DISPCNT_OBJ | DISPCNT_FB1;
@@
-59,9
+69,17
@@
void gamescr(void)
xgl_init();
xgl_init();
- memset(&player, 0, sizeof player);
+ init_player(&player, lvl);
player.phi = 0x100;
player.phi = 0x100;
+ cmap = (uint16_t*)CRAM_BG_ADDR;
+ *cmap++ = 0;
+ for(i=1; i<255; i++) {
+ *cmap++ = rand();
+ }
+ *cmap = 0xffff;
+
+
select_input(BN_DPAD | BN_A | BN_B);
mask(INTR_VBLANK);
select_input(BN_DPAD | BN_A | BN_B);
mask(INTR_VBLANK);
@@
-103,6
+121,7
@@
static void draw(void)
struct cell *cell;
xgl_load_identity();
struct cell *cell;
xgl_load_identity();
+ /*xgl_translate(0, 0, 0x100000);*/
xgl_rotate_x(player.phi);
xgl_rotate_y(player.theta);
xgl_translate(player.x, 0, player.y);
xgl_rotate_x(player.phi);
xgl_rotate_y(player.theta);
xgl_translate(player.x, 0, player.y);
@@
-115,6
+134,7
@@
static void draw(void)
xgl_push_matrix();
xgl_translate(x, 0, y);
xgl_push_matrix();
xgl_translate(x, 0, y);
+ xgl_index(i + 1);
xgl_draw(XGL_QUADS, tm_floor, sizeof tm_floor / sizeof *tm_floor);
xgl_pop_matrix();
}
xgl_draw(XGL_QUADS, tm_floor, sizeof tm_floor / sizeof *tm_floor);
xgl_pop_matrix();
}