Split SOL data structures into base, varying and rendering parts
[neverball] / share / item.c
index ce272d1..8af06db 100644 (file)
 #include "item.h"
 #include "glext.h"
 #include "vec3.h"
-#include "solid_gl.h"
 #include "image.h"
 #include "config.h"
 
+#include "solid_draw.h"
+
 /*---------------------------------------------------------------------------*/
 
-static struct s_file item_coin_file;
-static struct s_file item_grow_file;
-static struct s_file item_shrink_file;
+static struct s_full item_coin_file;
+static struct s_full item_grow_file;
+static struct s_full item_shrink_file;
 
-void item_color(const struct s_item *hp, float *c)
+void item_color(const struct v_item *hp, float *c)
 {
     switch (hp->t)
     {
@@ -80,16 +81,16 @@ void item_color(const struct s_item *hp, float *c)
 
 void item_init(void)
 {
-    sol_load_gl(&item_coin_file,   "item/coin/coin.sol",     0);
-    sol_load_gl(&item_grow_file,   "item/grow/grow.sol",     0);
-    sol_load_gl(&item_shrink_file, "item/shrink/shrink.sol", 0);
+    sol_load_full(&item_coin_file,   "item/coin/coin.sol",     0);
+    sol_load_full(&item_grow_file,   "item/grow/grow.sol",     0);
+    sol_load_full(&item_shrink_file, "item/shrink/shrink.sol", 0);
 }
 
 void item_free(void)
 {
-    sol_free_gl(&item_coin_file);
-    sol_free_gl(&item_grow_file);
-    sol_free_gl(&item_shrink_file);
+    sol_free_full(&item_coin_file);
+    sol_free_full(&item_grow_file);
+    sol_free_full(&item_shrink_file);
 }
 
 void item_push(int type)
@@ -97,22 +98,22 @@ void item_push(int type)
     glEnable(GL_COLOR_MATERIAL);
 }
 
-void item_draw(const struct s_item *hp, float r)
+void item_draw(const struct v_item *hp, float r)
 {
+    struct s_draw *draw = NULL;
     float c[3];
-    struct s_file *fp = NULL;
 
     switch (hp->t)
     {
-    case ITEM_COIN:   fp = &item_coin_file;   break;
-    case ITEM_GROW:   fp = &item_grow_file;   break;
-    case ITEM_SHRINK: fp = &item_shrink_file; break;
+    case ITEM_COIN:   draw = &item_coin_file.draw;   break;
+    case ITEM_GROW:   draw = &item_grow_file.draw;   break;
+    case ITEM_SHRINK: draw = &item_shrink_file.draw; break;
     }
 
     item_color(hp, c);
 
     glColor3fv(c);
-    sol_draw(fp, 0, 1);
+    sol_draw(draw, 0, 1);
 }
 
 void item_pull(void)