X-Git-Url: https://jasonwoof.com/gitweb/?p=vor.git;a=blobdiff_plain;f=main.c;h=d57aa3bf7aa90b75caaa02ed27fe127aff2ff233;hp=3f66ce03d1f399bb55e7dcea34461bb751410372;hb=f8a464d8eed8cf611c0c3f80166d2a650efb1485;hpb=c633a2e26924f5210aa8094593f5f003cee70a48 diff --git a/main.c b/main.c index 3f66ce0..d57aa3b 100644 --- a/main.c +++ b/main.c @@ -21,8 +21,8 @@ #include #include -#include -#include +#include +#include #include #include #include @@ -39,7 +39,7 @@ #include "mt.h" #include "rocks.h" #include "score.h" -#include "shape.h" +#include "sprite.h" #include "sound.h" // ************************************* VARS @@ -368,13 +368,7 @@ init(void) { NULLERROR(surf_b_over = load_image("banners/over.png")); // Load the spaceship graphic. - ship.shape = malloc(sizeof(struct shape)); - if(!ship.shape) { - fprintf(stderr, "can't allocate ship shape.\n"); - exit(1); - } - NULLERROR(ship.image = load_image("sprites/ship.png")); - get_shape(ship.image, ship.shape); + load_sprite(SPRITE(&ship), "sprites/ship.png"); // Load the life indicator (small ship) graphic. NULLERROR(surf_life = load_image("indicators/life.png")); @@ -517,7 +511,7 @@ draw() { } if(state == GAMEPLAY) { - bang = hit_rocks(ship.x, ship.y, ship.shape); + bang = hit_rocks(SPRITE(&ship)); } ms_frame = SDL_GetTicks() - ms_end;