JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
we now return you to your regularly scheduled exploding ship.
[vor.git] / sprite.h
index 953d303..f9070b4 100644 (file)
--- a/sprite.h
+++ b/sprite.h
@@ -8,9 +8,9 @@ typedef struct sprite Sprite;
 
 #define SPRITE(x) ((Sprite *) (x))
 
-#define BASE_SPRITE 0
-#define SHIP_SPRITE 1
-#define ROCK_SPRITE 2
+#define BASE 0
+#define SHIP 1
+#define ROCK 2
 #define N_TYPES 3
 
 struct sprite {
@@ -22,11 +22,16 @@ struct sprite {
        int w, h;
        int mask_w;
        uint32_t *mask;
+       uint32_t area;
 };
 
 Sprite *free_sprites[N_TYPES];  // lists of free sprites, by type.
 
+void do_collision(Sprite *a, Sprite *b);
+void collisions(void);
+
 void init_sprites(void);
+void reset_sprites(void);
 void add_sprite(Sprite *s);
 void move_sprite(Sprite *s);
 void move_sprites(void);
@@ -50,6 +55,7 @@ struct ship {
        int w, h;
        int mask_w;
        uint32_t *mask;
+       uint32_t area;
        // SHIP extras
        int lives;
        int jets;
@@ -65,6 +71,7 @@ struct rock {
        int w, h;
        int mask_w;
        uint32_t *mask;
+       uint32_t area;
        // ROCK extras
        int type;
 };
@@ -92,7 +99,7 @@ static inline void
 draw_sprite(Sprite *s)
 {
        SDL_Rect dest;
-       if(s->type == NONE) return;
+       if(s->type < 0) return;
        dest.x = s->x; dest.y = s->y;
        SDL_BlitSurface(s->image, NULL, surf_screen, &dest);
 }