X-Git-Url: https://jasonwoof.com/gitweb/?p=vor.git;a=blobdiff_plain;f=main.c;h=d57aa3bf7aa90b75caaa02ed27fe127aff2ff233;hp=ae52bd77a828fa22db4b6fd30a17728f67fe90fb;hb=3f9238432d3b902a7744ad5a61f61995d67267a5;hpb=f33f1a05297ce0156030f0f78ecf5b84e00d424c diff --git a/main.c b/main.c index ae52bd7..d57aa3b 100644 --- a/main.c +++ b/main.c @@ -21,8 +21,8 @@ #include #include -#include -#include +#include +#include #include #include #include @@ -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;