rasterized clamp top/bottom
authorJohn Tsiombikas <nuclear@member.fsf.org>
Fri, 9 Sep 2022 07:44:20 +0000 (10:44 +0300)
committerJohn Tsiombikas <nuclear@member.fsf.org>
Fri, 9 Sep 2022 07:44:20 +0000 (10:44 +0300)
src/player.c
src/polyfill.c

index 62c9813..1264857 100644 (file)
@@ -5,19 +5,19 @@
 void player_input(struct player *p, uint16_t bnstate)
 {
        if(bnstate & KEY_UP) {
-               p->phi += 0x2000;
+               p->phi += 0x800;
                if(p->phi > X_HPI) p->phi = X_HPI;
        }
        if(bnstate & KEY_DOWN) {
-               p->phi -= 0x2000;
+               p->phi -= 0x800;
                if(p->phi < -X_HPI) p->phi = -X_HPI;
        }
        if(bnstate & KEY_LEFT) {
-               p->theta += 0x2000;
+               p->theta += 0x800;
                if(p->theta > X_2PI) p->theta -= X_2PI;
        }
        if(bnstate & KEY_RIGHT) {
-               p->theta -= 0x2000;
+               p->theta -= 0x800;
                if(p->theta < X_2PI) p->theta += X_2PI;
        }
        if(bnstate & KEY_A) {
index 5b70987..8b01ea1 100644 (file)
@@ -87,6 +87,9 @@ void polyfill_flat(struct pvertex *varr, int vnum, unsigned char col)
                }
        }
 
+       if(top < 0) top = 0;
+       if(bot >= fbheight) bot = fbheight - 1;
+
        fbptr = fb + top * fbwidth;
        for(i=top; i<=bot; i++) {
                start = scantab[0][i];