Added license info to rng. Modified some includes.
[cantaveria.git] / game.h
blobd09467fd41bd8d7cbc0de8a849d3073742728ba9
1 /*
2 Cantaveria - action adventure platform game
3 Copyright (C) 2009 2010 Evan Rinehart
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to
18 The Free Software Foundation, Inc.
19 51 Franklin Street, Fifth Floor
20 Boston, MA 02110-1301, USA
23 #define PIXUP 1024
25 struct screen {
26 unsigned char tiles[20][15];
27 int flags;
28 int exits[4];
31 typedef struct {
32 char* name;
33 struct screen** screens;
34 int tileset_gfx;
35 char tileset_shapes[256];
36 /*background*/
37 int x,y,w,h;
39 int bg_gfx;
40 } zone;
42 #define ZONE_LOOKUP(Z,I,J) (I >= Z->w || J >= Z->h || I < 0 || J < 0 ? NULL : *(Z->screens + (I) + (J)*Z->w))
44 struct box{int x,y,w,h;};
46 typedef struct {
47 struct box box; /*absolute coords*/
48 int x, y; /*absolute coords*/
49 int vx, vy; /* pixels per ms / 256 */
50 int xoff, yoff; /* pixel coords*/
51 int bxoff, byoff; /* absolute coords */
52 enum {LEFT, RIGHT} facing;
53 sprite* spr; /*pixel coords*/
54 zone* z;
55 int si, sj;
56 int flags;
57 } mobile;
59 typedef struct {
60 struct box box;
61 int type;
62 } bullet;
64 typedef struct {
65 struct box box;
66 /*sprite* spr;*/
67 int params[6];
68 int t;
69 } moveplat;
72 struct player_motion {
73 int state;
74 int timer;
79 struct game {
80 zone* zones[32];
81 int zone_count;
83 /*these track the location of the player*/
84 int player_x;
85 int player_y;
86 zone* current_zone;
87 int si, sj;
90 /* entities */
94 extern struct game game;
96 enum {
97 SPRITE_ONE,
98 SPRITE_TWO,
99 SPRITE_THREE,
100 SPRITE_FOUR,
101 SPR_BOX
105 /* what is the stuff below doing here */
108 void load_zone(char* filename);
111 int stage_collision(mobile* m, zone* z, int si, int sj);
112 int box_collision(struct box* B1, struct box* B2);
114 void update_mobile_motion(mobile* m);
117 void game_setup();