1 /*
2  * xrick/include/ents.h
3  *
4  * Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net). All rights reserved.
5  *
6  * The use and distribution terms for this software are contained in the file
7  * named README, which can be found in the root of this distribution. By
8  * using this software in any fashion, you are agreeing to be bound by the
9  * terms of this license.
10  *
11  * You must not remove this notice, or any other, from this software.
12  */
13 
14 #ifndef _ENTS_H
15 #define _ENTS_H
16 
17 #include "system.h"
18 #include "rects.h"
19 
20 #define ENT_XRICK ent_ents[1]
21 
22 #define ENT_NBR_ENTDATA 0x4a
23 #define ENT_NBR_SPRSEQ 0x88
24 #define ENT_NBR_MVSTEP 0x310
25 
26 #define ENT_ENTSNUM 0x0c
27 
28 /*
29  * flags for ent_ents[e].n  ("yes" when set)
30  *
31  * ENT_LETHAL: is entity lethal?
32  */
33 #define ENT_LETHAL 0x80
34 
35 /*
36  * flags for ent_ents[e].flag  ("yes" when set)
37  *
38  * ENT_FLG_ONCE: should the entity run once only?
39  * ENT_FLG_STOPRICK: does the entity stops rick (and goes to slot zero)?
40  * ENT_FLG_LETHALR: is entity lethal when restarting?
41  * ENT_FLG_LETHALI: is entity initially lethal?
42  * ENT_FLG_TRIGBOMB: can entity be triggered by a bomb?
43  * ENT_FLG_TRIGBULLET: can entity be triggered by a bullet?
44  * ENT_FLG_TRIGSTOP: can entity be triggered by rick stop?
45  * ENT_FLG_TRIGRICK: can entity be triggered by rick?
46  */
47 #define ENT_FLG_ONCE 0x01
48 #define ENT_FLG_STOPRICK 0x02
49 #define ENT_FLG_LETHALR 0x04
50 #define ENT_FLG_LETHALI 0x08
51 #define ENT_FLG_TRIGBOMB 0x10
52 #define ENT_FLG_TRIGBULLET 0x20
53 #define ENT_FLG_TRIGSTOP 0x40
54 #define ENT_FLG_TRIGRICK 0x80
55 
56 typedef struct {
57   U8 n;          /* b00 */
58   /*U8 b01;*/    /* b01 in ASM code but never used */
59   S16 x;         /* b02 - position */
60   S16 y;         /* w04 - position */
61   U8 sprite;     /* b08 - sprite number */
62   /*U16 w0C;*/   /* w0C in ASM code but never used */
63   U8 w;          /* b0E - width */
64   U8 h;          /* b10 - height */
65   U16 mark;      /* w12 - number of the mark that created the entity */
66   U8 flags;      /* b14 */
67   S16 trig_x;    /* b16 - position of trigger box */
68   S16 trig_y;    /* w18 - position of trigger box */
69   S16 xsave;     /* b1C */
70   S16 ysave;     /* w1E */
71   U16 sprbase;   /* w20 */
72   U16 step_no_i; /* w22 */
73   U16 step_no;   /* w24 */
74   S16 c1;        /* b26 */
75   S16 c2;        /* b28 */
76   U8 ylow;       /* b2A */
77   S16 offsy;     /* w2C */
78   U8 latency;    /* b2E */
79   U8 prev_n;     /* new */
80   S16 prev_x;    /* new */
81   S16 prev_y;    /* new */
82   U8 prev_s;     /* new */
83   U8 front;      /* new */
84   U8 trigsnd;    /* new */
85 } ent_t;
86 
87 typedef struct {
88   U8 w, h;
89   U16 spr, sni;
90   U8 trig_w, trig_h;
91   U8 snd;
92 } entdata_t;
93 
94 typedef struct {
95   U8 count;
96   S8 dx, dy;
97 } mvstep_t;
98 
99 extern ent_t ent_ents[ENT_ENTSNUM + 1];
100 extern entdata_t ent_entdata[ENT_NBR_ENTDATA];
101 extern rect_t *ent_rects;
102 extern U8 ent_sprseq[ENT_NBR_SPRSEQ];
103 extern mvstep_t ent_mvstep[ENT_NBR_MVSTEP];
104 
105 extern void ent_reset(void);
106 extern void ent_actvis(U8, U8);
107 extern void ent_draw(void);
108 extern void ent_clprev(void);
109 extern void ent_action(void);
110 
111 #endif
112 
113 /* eof */
114