Remove SDL_mixer from base config (I doubt mapc needs that) and update
[neverball] / share / geom.c
index baf97c8..d8ee649 100644 (file)
@@ -1,4 +1,4 @@
-/*   
+/*
  * Copyright (C) 2003 Robert Kooima
  *
  * NEVERBALL is  free software; you can redistribute  it and/or modify
@@ -40,7 +40,7 @@ void ball_init(int b)
 
     config_get_s(CONFIG_BALL, name, MAXSTR);
     ball_text[0] = make_image_from_file(NULL, NULL, NULL, NULL, name);
-    
+
     config_get_s(CONFIG_BALL_BONUS, name, MAXSTR);
     ball_text[1] = make_image_from_file(NULL, NULL, NULL, NULL, name);
 
@@ -48,7 +48,7 @@ void ball_init(int b)
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
 
     ball_list = glGenLists(1);
-    
+
     glNewList(ball_list, GL_COMPILE);
     {
         for (i = 0; i < stacks; i++)
@@ -155,7 +155,7 @@ void mark_init(int b)
     int i, slices = b ? 32 : 16;
 
     mark_list = glGenLists(1);
-    
+
     glNewList(mark_list, GL_COMPILE);
     {
         glBegin(GL_TRIANGLE_FAN);
@@ -203,6 +203,8 @@ void mark_free(void)
 /*---------------------------------------------------------------------------*/
 
 static GLuint coin_text;
+static GLuint coin_grup;
+static GLuint coin_grdn;
 static GLuint coin_list;
 
 static void coin_head(int n, float radius, float thick)
@@ -284,6 +286,18 @@ void coin_color(float *c, int n)
         c[1] = 0.2f;
         c[2] = 1.0f;
     }
+    if (n == 50) /*white's kind of boring, but you can do a colored png that way.*/
+    {
+        c[0] = 1.0f;
+        c[1] = 1.0f;
+        c[2] = 1.0f;
+    }
+    if (n == 150)
+    {
+        c[0] = 1.0f;
+        c[1] = 1.0f;
+        c[2] = 1.0f;
+    }
 }
 
 void coin_init(int b)
@@ -291,6 +305,8 @@ void coin_init(int b)
     int n = b ? 32 : 8;
 
     coin_text = make_image_from_file(NULL, NULL, NULL, NULL, IMG_COIN);
+    coin_grup = make_image_from_file(NULL, NULL, NULL, NULL, IMG_COIN_GRUP);
+    coin_grdn = make_image_from_file(NULL, NULL, NULL, NULL, IMG_COIN_GRDN);
     coin_list = glGenLists(1);
 
     glNewList(coin_list, GL_COMPILE);
@@ -310,8 +326,16 @@ void coin_free(void)
     if (glIsTexture(coin_text))
         glDeleteTextures(1, &coin_text);
 
+    if (glIsTexture(coin_grup))
+        glDeleteTextures(1, &coin_grup);
+
+    if (glIsTexture(coin_grdn))
+        glDeleteTextures(1, &coin_grdn);
+
     coin_list = 0;
     coin_text = 0;
+    coin_grup = 0;
+    coin_grdn = 0;
 }
 
 void coin_push(void)
@@ -327,9 +351,17 @@ void coin_push(void)
     glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR,  s);
     glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION,  e);
     glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, h);
+}
 
+void coin_push_text(int n)
+{
     glEnable(GL_COLOR_MATERIAL);
-    glBindTexture(GL_TEXTURE_2D, coin_text);
+    if (n == 50)
+        glBindTexture(GL_TEXTURE_2D, coin_grdn);
+    else if (n == 150)
+        glBindTexture(GL_TEXTURE_2D, coin_grup);
+    else
+        glBindTexture(GL_TEXTURE_2D, coin_text);
 }
 
 void coin_draw(int n, float r)
@@ -374,7 +406,7 @@ void goal_init(int b)
                 {
                     float x = fcosf(2.f * PI * i / n);
                     float y = fsinf(2.f * PI * i / n);
-            
+
                     glColor4f(1.0f, 1.0f, 0.0f, 0.5f);
                     glVertex3f(x, 0.0f, y);
 
@@ -550,7 +582,7 @@ void flag_init(int b)
                 {
                     float x = fcosf(2.f * PI * i / n) * 0.01f;
                     float y = fsinf(2.f * PI * i / n) * 0.01f;
-            
+
                     glColor3f(1.0f, 1.0f, 1.0f);
                     glVertex3f(x, 0.0f,        y);
                     glVertex3f(x, GOAL_HEIGHT, y);
@@ -667,7 +699,7 @@ void fade_draw(float k)
             glDisable(GL_LIGHTING);
             glDisable(GL_DEPTH_TEST);
             glDisable(GL_TEXTURE_2D);
-            
+
             glColor4f(0.0f, 0.0f, 0.0f, k);
 
             glBegin(GL_QUADS);