s/TRANSLATORS/Translators/ in xgettext comments
[neverball] / share / part.c
index fc50a07..93262ac 100644 (file)
@@ -85,7 +85,7 @@ void part_init(float h)
     memset(part_coin, 0, PART_MAX_COIN * sizeof (struct part));
     memset(part_goal, 0, PART_MAX_GOAL * sizeof (struct part));
 
-    part_text = make_image_from_file(NULL, NULL, NULL, NULL, IMG_PART);
+    part_text = make_image_from_file(IMG_PART);
     part_list = glGenLists(1);
 
     glNewList(part_list, GL_COMPILE);
@@ -200,67 +200,49 @@ void part_step(const float *g, float dt)
 
 /*---------------------------------------------------------------------------*/
 
-static void part_draw(const float p[3], const float c[3],
-                      float a, float r, float rx, float ry, float rz)
+static void part_draw(const float *M,
+                      const float *p, float r, float rz)
 {
     glPushMatrix();
     {
         glTranslatef(r * p[0], p[1], r * p[2]);
-        glRotatef(ry, 0.f, 1.f, 0.f);
-        glRotatef(rx, 1.f, 0.f, 0.f);
+        glMultMatrixf(M);
         glRotatef(rz, 0.f, 0.f, 1.f);
 
-        glColor4f(c[0], c[1], c[2], a);
-
         glCallList(part_list);
     }
     glPopMatrix();
 }
 
-void part_draw_coin(float rx, float ry)
+void part_draw_coin(const float *M, float t)
 {
-    float r = (float) SDL_GetTicks() / 1000.f;
     int i;
 
-    glPushAttrib(GL_LIGHTING_BIT | GL_DEPTH_BUFFER_BIT);
-    {
-        glDisable(GL_LIGHTING);
-        glEnable(GL_COLOR_MATERIAL);
-
-        glDepthMask(GL_FALSE);
-        glBindTexture(GL_TEXTURE_2D, part_text);
-
-        for (i = 0; i < PART_MAX_COIN; i++)
-            if (part_coin[i].t > 0.f)
-                part_draw(part_coin[i].p,
-                          part_coin[i].c,
-                          part_coin[i].t,
-                          1.f, rx, ry, r * part_coin[i].w);
-    }
-    glPopAttrib();
+    glBindTexture(GL_TEXTURE_2D, part_text);
+
+    for (i = 0; i < PART_MAX_COIN; i++)
+        if (part_coin[i].t > 0.f)
+        {
+            glColor4f(part_coin[i].c[0],
+                      part_coin[i].c[1],
+                      part_coin[i].c[2],
+                      part_coin[i].t);
+
+            part_draw(M, part_coin[i].p, 1.0f, t * part_coin[i].w);
+        }
 }
 
-void part_draw_goal(float rx, float ry, float radius, float a)
+void part_draw_goal(const float *M, float radius, float a, float t)
 {
-    float r = (float) SDL_GetTicks() / 1000.f;
     int i;
 
-    glPushAttrib(GL_LIGHTING_BIT | GL_DEPTH_BUFFER_BIT);
-    {
-        glDisable(GL_LIGHTING);
-
-        glEnable(GL_COLOR_MATERIAL);
+    glBindTexture(GL_TEXTURE_2D, part_text);
 
-        glDepthMask(GL_FALSE);
-        glBindTexture(GL_TEXTURE_2D, part_text);
+    glColor4f(1.0f, 1.0f, 0.0f, a);
 
-        for (i = 0; i < PART_MAX_GOAL; i++)
-            if (part_goal[i].t > 0.f)
-                part_draw(part_goal[i].p,
-                          part_goal[i].c, a,
-                          radius - 0.05f, rx, ry, r * part_goal[i].w);
-    }
-    glPopAttrib();
+    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, t * part_goal[i].w);
 }
 
 /*---------------------------------------------------------------------------*/