Widespread minor changes to eliminate the use of SDL_GetTicks to
authorrlk <rlk@78b8d119-cf0a-0410-b17c-f493084dd1d7>
Mon, 28 Jan 2008 15:27:51 +0000 (15:27 +0000)
committerrlk <rlk@78b8d119-cf0a-0410-b17c-f493084dd1d7>
Mon, 28 Jan 2008 15:27:51 +0000 (15:27 +0000)
determine the current time.  Pass it as paint argument instead to allow
billboards and coins to spin correctly in uniform mode.
Also, eliminated obsolete stereo separation paint argument.

git-svn-id: https://s.snth.net/svn/neverball/trunk@1618 78b8d119-cf0a-0410-b17c-f493084dd1d7

25 files changed:
ball/game.c
ball/main.c
ball/st_conf.c
ball/st_demo.c
ball/st_help.c
ball/st_help.h
ball/st_level.c
ball/st_name.c
ball/st_pause.c
ball/st_play.c
ball/st_shared.c
putt/game.c
putt/game.h
putt/main.c
putt/st_all.c
share/ball.c
share/ball.h
share/common.c
share/image.c
share/part.c
share/part.h
share/solid_gl.c
share/solid_gl.h
share/state.c
share/state.h

index 1c0c1e3..bef5cd0 100644 (file)
@@ -391,7 +391,8 @@ int curr_goal(void)
 
 /*---------------------------------------------------------------------------*/
 
-static void game_draw_balls(const struct s_file *fp, const float *bill_M)
+static void game_draw_balls(const struct s_file *fp,
+                            const float *bill_M, float t)
 {
     float c[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
 
@@ -412,15 +413,15 @@ static void game_draw_balls(const struct s_file *fp, const float *bill_M)
                  fp->uv[0].r);
 
         glColor4fv(c);
-        ball_draw(ball_M, pend_M, bill_M);
+        ball_draw(ball_M, pend_M, bill_M, t);
     }
     glPopMatrix();
     glPopAttrib();
 }
 
-static void game_draw_items(const struct s_file *fp)
+static void game_draw_items(const struct s_file *fp, float t)
 {
-    float r = 360.f * SDL_GetTicks() / 1000.f;
+    float r = 360.f * t;
     int hi;
 
     glPushAttrib(GL_LIGHTING_BIT);
@@ -485,7 +486,7 @@ static void game_draw_items(const struct s_file *fp)
     glPopAttrib();
 }
 
-static void game_draw_goals(const struct s_file *fp, const float *M)
+static void game_draw_goals(const struct s_file *fp, const float *M, float t)
 {
     if (goal_c == 0)
     {
@@ -503,7 +504,7 @@ static void game_draw_goals(const struct s_file *fp, const float *M)
                                  fp->zv[zi].p[1],
                                  fp->zv[zi].p[2]);
                     
-                    part_draw_goal(M, fp->zv[zi].r, goal_k);
+                    part_draw_goal(M, fp->zv[zi].r, goal_k, t);
                 }
                 glPopMatrix();
             }
@@ -629,10 +630,8 @@ static void game_draw_light(void)
     glLightfv(GL_LIGHT1, GL_SPECULAR, light_c[1]);
 }
 
-static void game_draw_back(int pose, int d)
+static void game_draw_back(int pose, int d, float t)
 {
-    float t = SDL_GetTicks() / 1000.f + 120.0f;
-
     glPushMatrix();
     {
         if (d < 0)
@@ -709,7 +708,7 @@ static void game_clip_ball(int d, const float *p)
     glClipPlane(GL_CLIP_PLANE2, pz);
 }
 
-static void game_draw_fore(int pose, const float *M, int d)
+static void game_draw_fore(int pose, const float *M, int d, float t)
 {
     const float *ball_p = file.uv->p;
     const float  ball_r = file.uv->r;
@@ -734,7 +733,7 @@ static void game_draw_fore(int pose, const float *M, int d)
         {
             /* Draw the coins. */
 
-            game_draw_items(&file);
+            game_draw_items(&file, t);
 
             /* Draw the floor. */
 
@@ -751,7 +750,7 @@ static void game_draw_fore(int pose, const float *M, int d)
 
             /* Draw the ball. */
 
-            game_draw_balls(&file, M);
+            game_draw_balls(&file, M, t);
         }
 
         /* Draw the particles and light columns. */
@@ -762,12 +761,12 @@ static void game_draw_fore(int pose, const float *M, int d)
         {
             glColor3f(1.0f, 1.0f, 1.0f);
 
-            sol_bill(&file, M);
-            part_draw_coin(M);
+            sol_bill(&file, M, t);
+            part_draw_coin(M, t);
 
             glDisable(GL_TEXTURE_2D);
             {
-                game_draw_goals(&file, M);
+                game_draw_goals(&file, M, t);
                 game_draw_jumps(&file);
                 game_draw_swchs(&file);
             }
@@ -785,7 +784,7 @@ static void game_draw_fore(int pose, const float *M, int d)
     glPopMatrix();
 }
 
-void game_draw(int pose, float st)
+void game_draw(int pose, float t)
 {
     float fov = view_fov;
 
@@ -843,8 +842,8 @@ void game_draw(int pose, float st)
                         glScalef(+1.0f, -1.0f, +1.0f);
 
                         game_draw_light();
-                        game_draw_back(pose,    -1);
-                        game_draw_fore(pose, U, -1);
+                        game_draw_back(pose,    -1, t);
+                        game_draw_fore(pose, U, -1, t);
                     }
                     glPopMatrix();
                     glFrontFace(GL_CCW);
@@ -856,8 +855,8 @@ void game_draw(int pose, float st)
 
             game_draw_light();
             game_refl_all();
-            game_draw_back(pose,    +1);
-            game_draw_fore(pose, T, +1);
+            game_draw_back(pose,    +1, t);
+            game_draw_fore(pose, T, +1, t);
         }
         glPopMatrix();
         config_pop_matrix();
index 9ef2ac3..e3df088 100644 (file)
@@ -461,6 +461,8 @@ int main(int argc, char *argv[])
 
             for (u = 0; u < abs(uniform); ++u)
                 st_timer(DT);
+
+            t0 = t1;
         }
         else
         {
@@ -475,7 +477,7 @@ int main(int argc, char *argv[])
 
         /* Render. */
 
-        st_paint();
+        st_paint(0.001f * t0);
         config_swap();
 
         if (uniform < 0)
index 7106f13..20176eb 100644 (file)
@@ -342,7 +342,7 @@ static void conf_leave(int id)
     gui_delete(id);
 }
 
-static void conf_paint(int id, float st)
+static void conf_paint(int id, float t)
 {
     config_push_persp((float) config_get_d(CONFIG_VIEW_FOV), 0.1f, FAR_DIST);
     {
index 5c3b3fa..d215f9f 100644 (file)
@@ -343,9 +343,9 @@ static int demo_play_enter(void)
     return id;
 }
 
-static void demo_play_paint(int id, float st)
+static void demo_play_paint(int id, float t)
 {
-    game_draw(0, st);
+    game_draw(0, t);
 
     if (show_hud)
         hud_paint();
@@ -478,9 +478,9 @@ static int demo_end_enter(void)
     return id;
 }
 
-static void demo_end_paint(int id, float st)
+static void demo_end_paint(int id, float t)
 {
-    game_draw(0, st);
+    game_draw(0, t);
     gui_paint(id);
 
     if (demo_paused)
index c5d5dc4..a158e79 100644 (file)
 
 /*---------------------------------------------------------------------------*/
 
-struct state st_help_demo;
-
-/*---------------------------------------------------------------------------*/
-
 #define HELP_BACK   0
 #define HELP_RULE   1
 #define HELP_CONT   2
@@ -386,9 +382,9 @@ static void help_demo_leave(int id)
     demo_replay_stop(0);
 }
 
-static void help_demo_paint(int id, float st)
+static void help_demo_paint(int id, float t)
 {
-    game_draw(0, st);
+    game_draw(0, t);
 }
 
 static void help_demo_timer(int id, float dt)
index c904ec6..d1c76cc 100644 (file)
@@ -4,5 +4,6 @@
 #include "state.h"
 
 extern struct state st_help;
+extern struct state st_help_demo;
 
 #endif
index 8881ab3..f408dbd 100644 (file)
@@ -130,9 +130,9 @@ static int level_buttn(int b, int d)
 
 /*---------------------------------------------------------------------------*/
 
-static void poser_paint(int id, float st)
+static void poser_paint(int id, float t)
 {
-    game_draw(1, st);
+    game_draw(1, t);
 }
 
 static int poser_buttn(int c, int d)
index 4debe4b..259748b 100644 (file)
@@ -134,7 +134,7 @@ static void name_leave(int id)
     gui_delete(id);
 }
 
-static void name_paint(int id, float st)
+static void name_paint(int id, float t)
 {
     if (draw_back)
     {
@@ -145,7 +145,7 @@ static void name_paint(int id, float st)
         config_pop_matrix();
     }
     else
-        game_draw(0, st);
+        game_draw(0, t);
 
     gui_paint(id);
 }
index e46333b..51b5b2a 100644 (file)
@@ -124,9 +124,9 @@ static int pause_enter(void)
     return id;
 }
 
-static void pause_paint(int id, float st)
+static void pause_paint(int id, float t)
 {
-    shared_paint(id, st);
+    shared_paint(id, t);
     hud_paint();
 }
 
index af4aead..5eb59ce 100644 (file)
@@ -198,9 +198,9 @@ static int play_loop_enter(void)
     return id;
 }
 
-static void play_loop_paint(int id, float st)
+static void play_loop_paint(int id, float t)
 {
-    game_draw(0, st);
+    game_draw(0, t);
 
     if (show_hud)
         hud_paint();
@@ -378,9 +378,9 @@ static void look_leave(int id)
 {
 }
 
-static void look_paint(int id, float st)
+static void look_paint(int id, float t)
 {
-    game_draw(0, st);
+    game_draw(0, t);
 }
 
 static void look_point(int id, int x, int y, int dx, int dy)
index 2870101..44695c1 100644 (file)
@@ -26,9 +26,9 @@ void shared_leave(int id)
     gui_delete(id);
 }
 
-void shared_paint(int id, float st)
+void shared_paint(int id, float t)
 {
-    game_draw(0, st);
+    game_draw(0, t);
     gui_paint(id);
 }
 
index 47d1178..a7f88c1 100644 (file)
@@ -155,7 +155,8 @@ static void game_draw_vect(const struct s_file *fp)
     }
 }
 
-static void game_draw_balls(const struct s_file *fp, const float *bill_M)
+static void game_draw_balls(const struct s_file *fp,
+                            const float *bill_M, float t)
 {
     static const GLfloat color[5][4] = {
         { 1.0f, 1.0f, 1.0f, 0.7f },
@@ -187,7 +188,7 @@ static void game_draw_balls(const struct s_file *fp, const float *bill_M)
                          fp->uv[ui].r);
 
                 glColor4fv(color[ui]);
-                ball_draw(ball_M, pend_M, bill_M);
+                ball_draw(ball_M, pend_M, bill_M, t);
             }
             glPopMatrix();
         }
@@ -271,7 +272,7 @@ static void game_draw_swchs(const struct s_file *fp)
 
 /*---------------------------------------------------------------------------*/
 
-void game_draw(int pose)
+void game_draw(int pose, float t)
 {
     static const float a[4] = { 0.2f, 0.2f, 0.2f, 1.0f };
     static const float s[4] = { 0.0f, 0.0f, 0.0f, 1.0f };
@@ -334,7 +335,7 @@ void game_draw(int pose)
 
         if (pose == 0)
         {
-            game_draw_balls(fp, T);
+            game_draw_balls(fp, T, t);
             game_draw_vect(fp);
         }
 
index 240c5d5..47bc793 100644 (file)
@@ -37,7 +37,7 @@
 void  game_init(const char *);
 void  game_free(void);
 
-void  game_draw(int);
+void  game_draw(int, float);
 void  game_putt(void);
 int   game_step(const float[3], float);
 
index 7852d99..aa033e3 100644 (file)
@@ -269,7 +269,7 @@ int main(int argc, char *argv[])
                         if ((t1 = SDL_GetTicks()) > t0)
                         {
                             st_timer((t1 - t0) / 1000.f);
-                            st_paint();
+                            st_paint(0.001f * t1);
                             SDL_GL_SwapBuffers();
 
                             t0 = t1;
index 41835eb..6898d56 100644 (file)
@@ -231,9 +231,9 @@ static void title_leave(int id)
     gui_delete(id);
 }
 
-static void title_paint(int id, float st)
+static void title_paint(int id, float t)
 {
-    game_draw(0);
+    game_draw(0, t);
     gui_paint(id);
 }
 
@@ -356,9 +356,9 @@ static void course_leave(int id)
     gui_delete(id);
 }
 
-static void course_paint(int id, float st)
+static void course_paint(int id, float t)
 {
-    game_draw(0);
+    game_draw(0, t);
     gui_paint(id);
 }
 
@@ -502,9 +502,9 @@ static void party_leave(int id)
     gui_delete(id);
 }
 
-static void party_paint(int id, float st)
+static void party_paint(int id, float t)
 {
-    game_draw(0);
+    game_draw(0, t);
     gui_paint(id);
 }
 
@@ -607,9 +607,9 @@ static void pause_leave(int id)
     audio_music_fade_in(0.5f);
 }
 
-static void pause_paint(int id, float st)
+static void pause_paint(int id, float t)
 {
-    game_draw(0);
+    game_draw(0, t);
     gui_paint(id);
     hud_paint();
 }
@@ -717,9 +717,9 @@ static void next_leave(int id)
     gui_delete(id);
 }
 
-static void next_paint(int id, float st)
+static void next_paint(int id, float t)
 {
-    game_draw(0);
+    game_draw(0, t);
     hud_paint();
     gui_paint(id);
 }
@@ -781,9 +781,9 @@ static int poser_enter(void)
     return 0;
 }
 
-static void poser_paint(int id, float st)
+static void poser_paint(int id, float t)
 {
-    game_draw(1);
+    game_draw(1, t);
 }
 
 static int poser_buttn(int b, int d)
@@ -815,9 +815,9 @@ static void flyby_leave(int id)
     hud_free();
 }
 
-static void flyby_paint(int id, float st)
+static void flyby_paint(int id, float t)
 {
-    game_draw(0);
+    game_draw(0, t);
     hud_paint();
 }
 
@@ -883,9 +883,9 @@ static void stroke_leave(int id)
     config_set_d(CONFIG_CAMERA, 0);
 }
 
-static void stroke_paint(int id, float st)
+static void stroke_paint(int id, float t)
 {
-    game_draw(0);
+    game_draw(0, t);
     hud_paint();
 }
 
@@ -962,9 +962,9 @@ static void roll_leave(int id)
     hud_free();
 }
 
-static void roll_paint(int id, float st)
+static void roll_paint(int id, float t)
 {
-    game_draw(0);
+    game_draw(0, t);
     hud_paint();
 }
 
@@ -1015,9 +1015,9 @@ static void goal_leave(int id)
     hud_free();
 }
 
-static void goal_paint(int id, float st)
+static void goal_paint(int id, float t)
 {
-    game_draw(0);
+    game_draw(0, t);
     gui_paint(id);
     hud_paint();
 }
@@ -1081,9 +1081,9 @@ static void stop_leave(int id)
     hud_free();
 }
 
-static void stop_paint(int id, float st)
+static void stop_paint(int id, float t)
 {
-    game_draw(0);
+    game_draw(0, t);
     hud_paint();
 }
 
@@ -1146,7 +1146,7 @@ static int fall_enter(void)
     else
     {
         hole_fall();
-        game_draw(0); /*TODO: is this call ok? */
+/*        game_draw(0);*/ /*TODO: is this call ok? */  /* No, it's not. */
     }
 
     hud_init();
@@ -1160,9 +1160,9 @@ static void fall_leave(int id)
     hud_free();
 }
 
-static void fall_paint(int id, float st)
+static void fall_paint(int id, float t)
 {
-    game_draw(0);
+    game_draw(0, t);
     gui_paint(id);
     hud_paint();
 }
@@ -1224,9 +1224,9 @@ static void score_leave(int id)
     gui_delete(id);
 }
 
-static void score_paint(int id, float st)
+static void score_paint(int id, float t)
 {
-    game_draw(0);
+    game_draw(0, t);
     gui_paint(id);
 }
 
@@ -1277,9 +1277,9 @@ static void over_leave(int id)
     gui_delete(id);
 }
 
-static void over_paint(int id, float st)
+static void over_paint(int id, float t)
 {
-    game_draw(0);
+    game_draw(0, t);
     gui_paint(id);
 }
 
index ee811b9..5010500 100644 (file)
@@ -121,7 +121,7 @@ void ball_free(void)
 /*---------------------------------------------------------------------------*/
 
 static void ball_draw_solid(const float *ball_M,
-                            const float *ball_bill_M)
+                            const float *ball_bill_M, float t)
 {
     if (has_solid)
     {
@@ -148,7 +148,7 @@ static void ball_draw_solid(const float *ball_M,
                 if (mask == 0) glDepthMask(GL_FALSE);
                 glDisable(GL_LIGHTING);
                 {
-                    sol_bill(&solid, ball_bill_M);
+                    sol_bill(&solid, ball_bill_M, t);
                 }
                 glEnable(GL_LIGHTING);
                 if (mask == 0) glDepthMask(GL_TRUE);
@@ -168,7 +168,7 @@ static void ball_draw_solid(const float *ball_M,
 
 static void ball_draw_inner(const float *pend_M,
                             const float *bill_M,
-                            const float *pend_bill_M)
+                            const float *pend_bill_M, float t)
 {
     if (has_inner)
     {
@@ -203,9 +203,9 @@ static void ball_draw_inner(const float *pend_M,
             glDisable(GL_LIGHTING);
             {
                 if (pend)
-                    sol_bill(&inner, pend_bill_M);
+                    sol_bill(&inner, pend_bill_M, t);
                 else
-                    sol_bill(&inner, bill_M);
+                    sol_bill(&inner, bill_M,      t);
             }
 
             glEnable(GL_LIGHTING);
@@ -223,7 +223,7 @@ static void ball_draw_inner(const float *pend_M,
 
 static void ball_draw_outer(const float *pend_M,
                             const float *bill_M,
-                            const float *pend_bill_M)
+                            const float *pend_bill_M, float t)
 {
     if (has_outer)
     {
@@ -258,9 +258,9 @@ static void ball_draw_outer(const float *pend_M,
             glDisable(GL_LIGHTING);
             {
                 if (pend)
-                    sol_bill(&outer, pend_bill_M);
+                    sol_bill(&outer, pend_bill_M, t);
                 else
-                    sol_bill(&outer, bill_M);
+                    sol_bill(&outer, bill_M,      t);
             }
             glEnable(GL_LIGHTING);
             if (mask == 0) glDepthMask(GL_TRUE);
@@ -281,18 +281,18 @@ static void ball_pass_inner(const float *ball_M,
                             const float *pend_M,
                             const float *bill_M,
                             const float *ball_bill_M,
-                            const float *pend_bill_M)
+                            const float *pend_bill_M, float t)
 {
     /* Sort the inner ball using clip planes. */
 
     if      (inner_flags & F_DRAWCLIP)
     {
         glEnable(GL_CLIP_PLANE1);
-        ball_draw_inner(        pend_M, bill_M,              pend_bill_M);
+        ball_draw_inner(        pend_M, bill_M,              pend_bill_M, t);
         glDisable(GL_CLIP_PLANE1);
         
         glEnable(GL_CLIP_PLANE2);
-        ball_draw_inner(        pend_M, bill_M,              pend_bill_M);
+        ball_draw_inner(        pend_M, bill_M,              pend_bill_M, t);
         glDisable(GL_CLIP_PLANE2);
     }
 
@@ -301,16 +301,16 @@ static void ball_pass_inner(const float *ball_M,
     else if (inner_flags & F_DRAWBACK)
     {
         glCullFace(GL_FRONT);
-        ball_draw_inner(        pend_M, bill_M,              pend_bill_M);
+        ball_draw_inner(        pend_M, bill_M,              pend_bill_M, t);
         glCullFace(GL_BACK);
-        ball_draw_inner(        pend_M, bill_M,              pend_bill_M);
+        ball_draw_inner(        pend_M, bill_M,              pend_bill_M, t);
     }
 
     /* Draw the inner ball normally. */
 
     else
     {
-        ball_draw_inner(        pend_M, bill_M,              pend_bill_M);
+        ball_draw_inner(        pend_M, bill_M,              pend_bill_M, t);
     }
 }
 
@@ -318,20 +318,20 @@ static void ball_pass_solid(const float *ball_M,
                             const float *pend_M,
                             const float *bill_M,
                             const float *ball_bill_M,
-                            const float *pend_bill_M)
+                            const float *pend_bill_M, float t)
 {
     /* Sort the solid ball with the inner ball using clip planes. */
 
     if      (solid_flags & F_DRAWCLIP)
     {
         glEnable(GL_CLIP_PLANE1);
-        ball_draw_solid(ball_M,                 ball_bill_M);
+        ball_draw_solid(ball_M,                 ball_bill_M, t);
         glDisable(GL_CLIP_PLANE1);
         
-        ball_pass_inner(ball_M, pend_M, bill_M, ball_bill_M, pend_bill_M);
+        ball_pass_inner(ball_M, pend_M, bill_M, ball_bill_M, pend_bill_M, t);
 
         glEnable(GL_CLIP_PLANE2);
-        ball_draw_solid(ball_M,                 ball_bill_M);
+        ball_draw_solid(ball_M,                 ball_bill_M, t);
         glDisable(GL_CLIP_PLANE2);
     }
 
@@ -340,19 +340,19 @@ static void ball_pass_solid(const float *ball_M,
     else if (solid_flags & F_DRAWBACK)
     {
         glCullFace(GL_FRONT);
-        ball_draw_solid(ball_M,                 ball_bill_M);
+        ball_draw_solid(ball_M,                 ball_bill_M, t);
         glCullFace(GL_BACK);
         
-        ball_pass_inner(ball_M, pend_M, bill_M, ball_bill_M, pend_bill_M);
-        ball_draw_solid(ball_M,                 ball_bill_M);
+        ball_pass_inner(ball_M, pend_M, bill_M, ball_bill_M, pend_bill_M, t);
+        ball_draw_solid(ball_M,                 ball_bill_M, t);
     }
 
     /* Draw the solid ball after the inner ball. */
 
     else
     {
-        ball_pass_inner(ball_M, pend_M, bill_M, ball_bill_M, pend_bill_M);
-        ball_draw_solid(ball_M,                 ball_bill_M);
+        ball_pass_inner(ball_M, pend_M, bill_M, ball_bill_M, pend_bill_M, t);
+        ball_draw_solid(ball_M,                 ball_bill_M, t);
     }
 }
 
@@ -360,20 +360,20 @@ static void ball_pass_outer(const float *ball_M,
                             const float *pend_M,
                             const float *bill_M,
                             const float *ball_bill_M,
-                            const float *pend_bill_M)
+                            const float *pend_bill_M, float t)
 {
     /* Sort the outer ball with the solid ball using clip planes. */
 
     if      (outer_flags & F_DRAWCLIP)
     {
         glEnable(GL_CLIP_PLANE1);
-        ball_draw_outer(        pend_M, bill_M,              pend_bill_M);
+        ball_draw_outer(        pend_M, bill_M,              pend_bill_M, t);
         glDisable(GL_CLIP_PLANE1);
         
-        ball_pass_solid(ball_M, pend_M, bill_M, ball_bill_M, pend_bill_M);
+        ball_pass_solid(ball_M, pend_M, bill_M, ball_bill_M, pend_bill_M, t);
 
         glEnable(GL_CLIP_PLANE2);
-        ball_draw_outer(        pend_M, bill_M,              pend_bill_M);
+        ball_draw_outer(        pend_M, bill_M,              pend_bill_M, t);
         glDisable(GL_CLIP_PLANE2);
     }
 
@@ -382,19 +382,19 @@ static void ball_pass_outer(const float *ball_M,
     else if (outer_flags & F_DRAWBACK)
     {
         glCullFace(GL_FRONT);
-        ball_draw_outer(        pend_M, bill_M,              pend_bill_M);
+        ball_draw_outer(        pend_M, bill_M,              pend_bill_M, t);
         glCullFace(GL_BACK);
         
-        ball_pass_solid(ball_M, pend_M, bill_M, ball_bill_M, pend_bill_M);
-        ball_draw_outer(        pend_M, bill_M,              pend_bill_M);
+        ball_pass_solid(ball_M, pend_M, bill_M, ball_bill_M, pend_bill_M, t);
+        ball_draw_outer(        pend_M, bill_M,              pend_bill_M, t);
     }
 
     /* Draw the outer ball after the solid ball. */
 
     else
     {
-        ball_pass_solid(ball_M, pend_M, bill_M, ball_bill_M, pend_bill_M);
-        ball_draw_outer(        pend_M, bill_M,              pend_bill_M);
+        ball_pass_solid(ball_M, pend_M, bill_M, ball_bill_M, pend_bill_M, t);
+        ball_draw_outer(        pend_M, bill_M,              pend_bill_M, t);
     }
 }
 
@@ -402,7 +402,7 @@ static void ball_pass_outer(const float *ball_M,
 
 void ball_draw(const float *ball_M,
                const float *pend_M,
-               const float *bill_M)
+               const float *bill_M, float t)
 {
     /* Compute transforms for ball and pendulum billboards. */
 
@@ -418,7 +418,7 @@ void ball_draw(const float *ball_M,
 
     /* Go to GREAT pains to ensure all layers are drawn back-to-front. */
 
-    ball_pass_outer(ball_M, pend_M, bill_M, ball_bill_M, pend_bill_M);
+    ball_pass_outer(ball_M, pend_M, bill_M, ball_bill_M, pend_bill_M, t);
 }
 
 /*---------------------------------------------------------------------------*/
index 405ec5d..d3a51cc 100644 (file)
@@ -23,7 +23,7 @@ void ball_init(void);
 void ball_free(void);
 void ball_draw(const float *,
                const float *,
-               const float *);
+               const float *, float);
 
 /*---------------------------------------------------------------------------*/
 
index de5d267..9425cd0 100644 (file)
@@ -66,7 +66,7 @@ int read_line(char **dst, FILE *fin)
 
         /* Allocate or reallocate space for the buffer. */
 
-        if ((store_new = realloc(store, store_size + buffer_size)))
+        if ((store_new = (char *) realloc(store, store_size + buffer_size)))
         {
             /* Avoid passing garbage to string functions. */
 
index 3293ec3..e8d713d 100644 (file)
@@ -69,7 +69,7 @@ void image_snap(char *filename)
 
             /* Allocate and initialize the row pointers. */
 
-            if ((bytep = png_malloc(writep, h * sizeof (png_bytep))))
+            if ((bytep = (png_bytep *) png_malloc(writep, h * sizeof (png_bytep))))
             {
                 for (i = 0; i < h; ++i)
                     bytep[h - i - 1] = (png_bytep) (p + i * w * 3);
index 61af184..93262ac 100644 (file)
@@ -214,9 +214,8 @@ static void part_draw(const float *M,
     glPopMatrix();
 }
 
-void part_draw_coin(const float *M)
+void part_draw_coin(const float *M, float t)
 {
-    float r = (float) SDL_GetTicks() / 1000.0f;
     int i;
 
     glBindTexture(GL_TEXTURE_2D, part_text);
@@ -229,13 +228,12 @@ void part_draw_coin(const float *M)
                       part_coin[i].c[2],
                       part_coin[i].t);
 
-            part_draw(M, part_coin[i].p, 1.0f, r * part_coin[i].w);
+            part_draw(M, part_coin[i].p, 1.0f, t * part_coin[i].w);
         }
 }
 
-void part_draw_goal(const float *M, float radius, float a)
+void part_draw_goal(const float *M, float radius, float a, float t)
 {
-    float r = (float) SDL_GetTicks() / 1000.0f;
     int i;
 
     glBindTexture(GL_TEXTURE_2D, part_text);
@@ -244,7 +242,7 @@ void part_draw_goal(const float *M, float radius, float a)
 
     for (i = 0; i < PART_MAX_GOAL; i++)
         if (part_goal[i].t > 0.0f)
-            part_draw(M, part_goal[i].p, radius - 0.05f, r * part_goal[i].w);
+            part_draw(M, part_goal[i].p, radius - 0.05f, t * part_goal[i].w);
 }
 
 /*---------------------------------------------------------------------------*/
index de330d9..6123006 100644 (file)
@@ -18,8 +18,8 @@ void part_free(void);
 void part_burst(const float *, const float *);
 void part_step(const float *, float);
 
-void part_draw_coin(const float *);
-void part_draw_goal(const float *, float, float);
+void part_draw_coin(const float *, float);
+void part_draw_goal(const float *, float, float, float);
 
 /*---------------------------------------------------------------------------*/
 
index 720b05f..9fbdd83 100644 (file)
@@ -373,9 +373,8 @@ void sol_draw(const struct s_file *fp, int depthmask, int depthtest)
     if (depthtest == 0) glEnable(GL_DEPTH_TEST);
 }
 
-void sol_bill(const struct s_file *fp, const float *M)
+void sol_bill(const struct s_file *fp, const float *M, float t)
 {
-    float t = SDL_GetTicks() / 1000.f + 120.0f;
     const struct s_mtrl *mp = &default_mtrl;
 
     int ri;
index 4ccf699..c9126dd 100644 (file)
@@ -25,7 +25,7 @@ void  sol_free_gl(struct s_file *);
 void  sol_back(const struct s_file *, float, float, float);
 void  sol_refl(const struct s_file *);
 void  sol_draw(const struct s_file *, int, int);
-void  sol_bill(const struct s_file *, const float *);
+void  sol_bill(const struct s_file *, const float *, float);
 void  sol_shad(const struct s_file *);
 
 /*---------------------------------------------------------------------------*/
index f7a8f65..a4073af 100644 (file)
@@ -52,9 +52,9 @@ int goto_state(struct state *st)
 
 /*---------------------------------------------------------------------------*/
 
-void st_paint(void)
+void st_paint(float t)
 {
-    int stereo  = config_get_d(CONFIG_STEREO);
+    int stereo = config_get_d(CONFIG_STEREO);
 
     if (state && state->paint)
     {
@@ -62,16 +62,16 @@ void st_paint(void)
         {
             glDrawBuffer(GL_BACK_LEFT);
             config_clear();
-            state->paint(state->gui_id, (float) (+stereo));
+            state->paint(state->gui_id, t);
 
             glDrawBuffer(GL_BACK_RIGHT);
             config_clear();
-            state->paint(state->gui_id, (float) (-stereo));
+            state->paint(state->gui_id, t);
         }
         else
         {
             config_clear();
-            state->paint(state->gui_id, 0.0f);
+            state->paint(state->gui_id, t);
         }
     }
 }
index 0d7ebf0..7a9dcd8 100644 (file)
@@ -10,7 +10,7 @@ struct state
 {
     int  (*enter)(void);
     void (*leave)(int dt);
-    void (*paint)(int id, float st);
+    void (*paint)(int id, float t);
     void (*timer)(int id, float dt);
     void (*point)(int id, int x, int y, int dx, int dy);
     void (*stick)(int id, int a, int v);
@@ -28,7 +28,7 @@ float time_state(void);
 void  init_state(struct state *);
 int   goto_state(struct state *);
 
-void st_paint(void);
+void st_paint(float);
 void st_timer(float);
 void st_point(int, int, int, int);
 void st_stick(int, int);