Added entities. Rewrote stage, half 'working'.
[cantaveria.git] / entity.h
blobf7489bc5787ac69791ec31c351f81d19be883bcc
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
22 evanrinehart@gmail.com
25 typedef struct entity Y;
26 typedef struct {int x,y,w,h;} rect;
27 typedef struct {int a,b,c,d,e,f;} memory;
29 struct entity {
30 int x; int y; /* spatial */
31 int z; /* z order */
32 int flbits; /* flag bits */
33 int gfx; /* image */
34 memory r; /* general registers */
35 rect box; /* used to detect collision */
36 int (*update)(Y*);
37 int (*stage)(Y*,struct stghit);
38 int (*overlap)(Y*,Y*);
39 int (*diverge)(Y*,Y*);
42 void draw_entities(void);
43 void setup_test_entities(void);
44 void entity_master_simulate(void);
46 void player_press(int player, enum input_button button);
47 void player_release(int player, enum input_button button);
49 Y* mk_dummy_ent(int x, int y);
50 int mini_rand(int g);