From: Michael Georgoulopoulos Date: Tue, 4 Oct 2016 23:40:47 +0000 (+0300) Subject: Merge branch 'master' of mutantstargoat.com:/home/nuclear/git/dosdemo X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=dosdemo;a=commitdiff_plain;h=49e46b704795e24b89238ddab3eea89636844844;hp=4eabd99a0c9a1de4c1e6bccdeec2d4b9a66e227a Merge branch 'master' of mutantstargoat.com:/home/nuclear/git/dosdemo --- diff --git a/src/bump.c b/src/bump.c index dc53337..104b127 100644 --- a/src/bump.c +++ b/src/bump.c @@ -12,7 +12,6 @@ static int init(void); static void destroy(void); static void start(long trans_time); -static void stop(long trans_time); static void draw(void); static struct screen scr = { @@ -20,11 +19,11 @@ static struct screen scr = { init, destroy, start, - stop, + 0, draw }; -static struct point { +struct point { int x, y; }; @@ -143,10 +142,6 @@ static void start(long trans_time) startingTime = time_msec; } -static void stop(long trans_time) -{ -} - static void eraseArea(struct point *p, int width, int height) { int x, y, dx; diff --git a/src/plasma.c b/src/plasma.c index 05f68e4..132cff3 100644 --- a/src/plasma.c +++ b/src/plasma.c @@ -10,7 +10,6 @@ static int init(void); static void destroy(void); static void start(long trans_time); -static void stop(long trans_time); static void draw(void); static struct screen scr = { @@ -18,7 +17,7 @@ static struct screen scr = { init, destroy, start, - stop, + 0, draw }; @@ -84,10 +83,6 @@ static void start(long trans_time) startingTime = time_msec; } -static void stop(long trans_time) -{ -} - static void draw(void) { int x, y; diff --git a/src/polytest.c b/src/polytest.c index 0d5187d..cc64a0d 100644 --- a/src/polytest.c +++ b/src/polytest.c @@ -34,7 +34,8 @@ static struct screen scr = { draw }; -static float theta, phi = 25; +static float cam_theta, cam_phi = 25; +static float cam_dist = 3; static struct mesh cube, torus; static struct pimage tex; @@ -104,11 +105,18 @@ static void update(void) int dy = mouse_y - prev_my; if(dx || dy) { - theta += dx * 1.0; - phi += dy * 1.0; - - if(phi < -90) phi = -90; - if(phi > 90) phi = 90; + if(mouse_bmask & 1) { + cam_theta += dx * 1.0; + cam_phi += dy * 1.0; + + if(cam_phi < -90) cam_phi = -90; + if(cam_phi > 90) cam_phi = 90; + } + if(mouse_bmask & 4) { + cam_dist += dy * 0.5; + + if(cam_dist < 0) cam_dist = 0; + } } } } @@ -126,9 +134,9 @@ static void draw(void) g3d_matrix_mode(G3D_MODELVIEW); g3d_load_identity(); - g3d_translate(0, 0, -3); - g3d_rotate(phi, 1, 0, 0); - g3d_rotate(theta, 0, 1, 0); + g3d_translate(0, 0, -cam_dist); + g3d_rotate(cam_phi, 1, 0, 0); + g3d_rotate(cam_theta, 0, 1, 0); g3d_light_pos(0, -10, 10, 20); @@ -151,9 +159,9 @@ static void draw_debug(void) g3d_matrix_mode(G3D_MODELVIEW); g3d_load_identity(); - g3d_translate(0, 0, -3); - g3d_rotate(phi, 1, 0, 0); - g3d_rotate(theta, 0, 1, 0); + g3d_translate(0, 0, -cam_dist); + g3d_rotate(cam_phi, 1, 0, 0); + g3d_rotate(cam_theta, 0, 1, 0); g3d_framebuffer(lowres_width, lowres_height, lowres_pixels); /*zsort(&torus);*/ diff --git a/src/sdl/main.c b/src/sdl/main.c index 6b65796..48852f5 100644 --- a/src/sdl/main.c +++ b/src/sdl/main.c @@ -129,10 +129,10 @@ static void handle_event(SDL_Event *ev) break; case SDL_MOUSEBUTTONDOWN: - mouse_bmask |= 1 << ev->button.button; + mouse_bmask |= 1 << (ev->button.button - SDL_BUTTON_LEFT); if(0) { case SDL_MOUSEBUTTONUP: - mouse_bmask &= ~(1 << ev->button.button); + mouse_bmask &= ~(1 << (ev->button.button - SDL_BUTTON_LEFT)); } mouse_x = ev->button.x / fbscale; mouse_y = ev->button.y / fbscale; diff --git a/src/tunnel.c b/src/tunnel.c index d10c691..56d0793 100644 --- a/src/tunnel.c +++ b/src/tunnel.c @@ -220,7 +220,7 @@ static void draw_tunnel_range(unsigned short *pix, int xoffs, int yoffs, int sta unsigned int *tmap = tunnel_map + (starty + yoffs) * vxsz + xoffs; unsigned char *fog = tunnel_fog + (starty + yoffs) * vxsz + xoffs; - long toffs = tm / 4; + long toffs = tm / 8; unsigned int *pixels = (unsigned int*)pix + starty * (fb_width >> 1); for(i=0; i