stable floor cones
authorJohn Tsiombikas <nuclear@member.fsf.org>
Sun, 2 Oct 2022 11:38:38 +0000 (14:38 +0300)
committerJohn Tsiombikas <nuclear@member.fsf.org>
Sun, 2 Oct 2022 11:38:38 +0000 (14:38 +0300)
src/gamescr.c
src/level.c

index 6449914..2bbe408 100644 (file)
@@ -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 =
-       "########\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},
@@ -113,7 +121,7 @@ static void draw(void)
        struct cell *cell;
 
        xgl_load_identity();
-       xgl_translate(0, 0, 0x100000);
+       /*xgl_translate(0, 0, 0x100000);*/
        xgl_rotate_x(player.phi);
        xgl_rotate_y(player.theta);
        xgl_translate(player.x, 0, player.y);
index b62c737..f7c54a1 100644 (file)
@@ -125,10 +125,9 @@ void upd_vis(struct level *lvl, struct player *p)
 
        lvl->numvis = 0;
        idx = -1;
-       theta = p->theta + X_2PI / 16;
+       theta = X_2PI - p->theta + X_2PI / 16;
        if(theta >= X_2PI) theta -= X_2PI;
-       dir = 7 - (theta << 3) / X_2PI; /* p->theta is always [0, 2pi) */
-       dbg_drawstr(0, 0, "dir: %d", dir);
+       dir = (theta << 3) / X_2PI;     /* p->theta is always [0, 2pi) */
        if(dir < 0 || dir >= 8) {
                panic(get_pc(), "dir: %d\ntheta: %d.%d (%d)\n", dir, p->theta >> 16,
                                p->theta & 0xffff, p->theta);