|
|
|
@ -3,11 +3,11 @@
@@ -3,11 +3,11 @@
|
|
|
|
|
#include <stdbool.h> |
|
|
|
|
#include <stdint.h> |
|
|
|
|
#include <math.h> |
|
|
|
|
#include "vect.h" |
|
|
|
|
|
|
|
|
|
#ifndef _DEFGAME |
|
|
|
|
#define _DEFGAME |
|
|
|
|
|
|
|
|
|
#include "vect.h" |
|
|
|
|
#include "garbo.h" |
|
|
|
|
#include "draw.h" |
|
|
|
|
|
|
|
|
@ -21,7 +21,8 @@ enum world_thing_kind {
@@ -21,7 +21,8 @@ enum world_thing_kind {
|
|
|
|
|
PLAYER_W, |
|
|
|
|
STATIC_WALL_W,
|
|
|
|
|
FLOOR, |
|
|
|
|
CEILING |
|
|
|
|
CEILING, |
|
|
|
|
PROJECTILE |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
// used to exert a force on an object
|
|
|
|
@ -143,6 +144,12 @@ typedef struct {
@@ -143,6 +144,12 @@ typedef struct {
|
|
|
|
|
int numPolys; |
|
|
|
|
} Floor; |
|
|
|
|
|
|
|
|
|
typedef struct Projectile { |
|
|
|
|
Body *physics; |
|
|
|
|
void*(*on_collision)(struct Projectile*); |
|
|
|
|
void*(*on_step)(struct Projectile*); |
|
|
|
|
} Projectile; |
|
|
|
|
|
|
|
|
|
typedef struct { |
|
|
|
|
enum world_thing_kind kind; |
|
|
|
|
int nid; |
|
|
|
@ -152,24 +159,23 @@ typedef struct {
@@ -152,24 +159,23 @@ typedef struct {
|
|
|
|
|
player_st *player; |
|
|
|
|
Wall *wall; |
|
|
|
|
Floor *floor; |
|
|
|
|
Projectile *projectile; |
|
|
|
|
}; |
|
|
|
|
} world_thing; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* array of all the things in the world and their kinds */ |
|
|
|
|
world_thing *world; |
|
|
|
|
|
|
|
|
|
int things_in_world; |
|
|
|
|
int world_size; |
|
|
|
|
|
|
|
|
|
void startgame(SDL_Renderer * ren) ; |
|
|
|
|
|
|
|
|
|
void process_keydown(SDL_Keysym key); |
|
|
|
|
void process_keyup(SDL_Keysym key); |
|
|
|
|
// add a motor to the world
|
|
|
|
|
void add_motor(Body *thing, double x, double y);
|
|
|
|
|
|
|
|
|
|
void step(int interval); |
|
|
|
|
/* array of all the things in the world and their kinds */ |
|
|
|
|
extern world_thing *world; |
|
|
|
|
|
|
|
|
|
player_st player; |
|
|
|
|
extern int things_in_world; |
|
|
|
|
extern int world_size; |
|
|
|
|
extern void startgame(SDL_Renderer * ren) ; |
|
|
|
|
extern void process_keydown(SDL_Keysym key); |
|
|
|
|
extern void process_keyup(SDL_Keysym key); |
|
|
|
|
extern void step(int interval); |
|
|
|
|
extern player_st player; |
|
|
|
|
|
|
|
|
|
void add_motor(Body *thing, double x, double y);
|
|
|
|
|
#endif |
|
|
|
|