gba-x3dtest

diff src/game.c @ 14:c398d834d64a

fixed the rendering bugs
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 23 Jun 2014 10:33:24 +0300
parents 2070a81127f2
children 0a7f402892b3
line diff
     1.1 --- a/src/game.c	Mon Jun 23 08:28:28 2014 +0300
     1.2 +++ b/src/game.c	Mon Jun 23 10:33:24 2014 +0300
     1.3 @@ -7,6 +7,8 @@
     1.4  #include "palman.h"
     1.5  #include "ggen.h"
     1.6  
     1.7 +extern int dbg_fill_dump;
     1.8 +
     1.9  static void draw_rect(int x, int y, int w, int h, uint16_t color);
    1.10  
    1.11  #define X16INT(x)	((x) << 16)
    1.12 @@ -65,9 +67,13 @@
    1.13  	}
    1.14  	x3d_translate(itox16(WIDTH / 2), itox16(HEIGHT / 2), 0);*/
    1.15  
    1.16 +	x3d_translate(0, 0, X16INT(6));
    1.17  	x3d_rotate(cam_phi, 65536, 0, 0);
    1.18 -	x3d_rotate(keyrot << 16, 0, 65536, 0);
    1.19 -	x3d_translate(0, 0, X16INT(6));
    1.20 +	if(autorot) {
    1.21 +		x3d_rotate((msec / 64) << 16, 0, 65536, 0);
    1.22 +	} else {
    1.23 +		x3d_rotate(cam_theta, 0, 65536, 0);
    1.24 +	}
    1.25  
    1.26  #ifdef PALMODE
    1.27  	x3d_color_index(255);
    1.28 @@ -102,17 +108,29 @@
    1.29  
    1.30  	switch(key) {
    1.31  	case KEY_LEFT:
    1.32 -		keyrot--;
    1.33 +		cam_theta += 65536;
    1.34  		break;
    1.35  
    1.36  	case KEY_RIGHT:
    1.37 -		keyrot++;
    1.38 +		cam_theta -= 65536;
    1.39 +		break;
    1.40 +
    1.41 +	case KEY_UP:
    1.42 +		cam_phi += 65536;
    1.43 +		break;
    1.44 +
    1.45 +	case KEY_DOWN:
    1.46 +		cam_phi -= 65536;
    1.47  		break;
    1.48  
    1.49  	case KEY_A:
    1.50  		autorot = !autorot;
    1.51  		break;
    1.52  
    1.53 +	case KEY_SELECT:
    1.54 +		dbg_fill_dump = 1;
    1.55 +		break;
    1.56 +
    1.57  	default:
    1.58  		break;
    1.59  	}