1 /*
2 
3 Copyright (C) 2015-2018 Night Dive Studios, LLC.
4 
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9 
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.
14 
15 You should have received a copy of the GNU General Public License
16 along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 
18 */
19 #ifndef __HUDOBJ_H
20 #define __HUDOBJ_H
21 
22 /*
23  * $Source: n:/project/cit/src/inc/RCS/hudobj.h $
24  * $Revision: 1.3 $
25  * $Author: mahk $
26  * $Date: 1994/06/29 00:47:25 $
27  *
28  * $Log: hudobj.h $
29  * Revision 1.3  1994/06/29  00:47:25  mahk
30  * Added hudobj_rect_capable.
31  *
32  * Revision 1.2  1993/12/18  00:32:33  xemu
33  * made flag definition in line with objbit.h
34  *
35  * Revision 1.1  1993/10/13  21:47:24  mahk
36  * Initial revision
37  *
38  *
39  */
40 
41 // Includes
42 
43 // ---------
44 // INTERNALS
45 // ---------
46 
47 extern ushort hudobj_classes[];
48 
49 #define HUDOBJ_INST_FLAG 0x01
50 #define NUM_HUDOBJS 16
51 
52 extern struct _hudobj_data {
53     short id;
54     short xl, yl, xh, yh;
55 } hudobj_vec[NUM_HUDOBJS];
56 
57 extern ubyte current_num_hudobjs;
58 
59 // ------------
60 // RENDERER API
61 // ------------
62 
63 // given an objid, determin whether this is an object the renderer
64 // should store in the u
65 #define IS_HUDOBJ(id) \
66     ((objs[id].info.inst_flags & HUDOBJ_INST_FLAG) || ((1 << objs[id].subclass) & hudobj_classes[objs[id].obclass]))
67 
68 #define SET_HUDOBJ_RECT(oid, oxl, oyl, oxh, oyh)                      \
69     if (current_num_hudobjs < NUM_HUDOBJS) {                          \
70         struct _hudobj_data *hd = &hudobj_vec[current_num_hudobjs++]; \
71         hd->id = (oid);                                               \
72         hd->xl = (oxl);                                               \
73         hd->xh = (oxh);                                               \
74         hd->yl = (oyl);                                               \
75         hd->yh = (oyh);                                               \
76     }
77 // ---------------
78 // GAME SYSTEM API
79 // ---------------
80 
81 #define HUDOBJ_ALL_SUBCLASSES 0xFF
82 void hudobj_set_subclass(ubyte l_class, ubyte subclass, uchar val);
83 // Sets the value of IS_HUDOBJ for all objects of a particular class & subclass.
84 // if subclass is HUDOBJ_ALL_SUBCLASSES then all subclasses will be set accordingly.
85 
86 void hudobj_set_id(short id, uchar val);
87 // Sets the value of IS_HUDOBJ for the specified object.
88 
89 #define hudobj_rect_capable(triple) (ObjProps[OPTRIP(triple)].render_type == FAUBJ_BITMAP)
90 
91 // Globals
92 
93 #endif // __HUDOBJ_H
94