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 #include "hudobj.h"
20 #include "objects.h"
21 #include "objapp.h"
22 
23 // -------
24 // GLOBALS
25 // -------
26 
27 ushort hudobj_classes[NUM_CLASSES];
28 
29 struct _hudobj_data hudobj_vec[NUM_HUDOBJS];
30 
31 ubyte current_num_hudobjs = 0;
32 
33 // -------------
34 // API FUNCTIONS
35 // -------------
36 
hudobj_set_subclass(ubyte obclass,ubyte subclass,uchar val)37 void hudobj_set_subclass(ubyte obclass, ubyte subclass, uchar val) {
38     ushort mask = (subclass == HUDOBJ_ALL_SUBCLASSES) ? 0xFFFF : (1 << subclass);
39     if (val)
40         hudobj_classes[obclass] |= mask;
41     else
42         hudobj_classes[obclass] &= ~mask;
43 }
44 
hudobj_set_id(short id,uchar val)45 void hudobj_set_id(short id, uchar val) {
46     if (id == OBJ_NULL)
47         return;
48     if (val)
49         objs[id].info.inst_flags |= HUDOBJ_INST_FLAG;
50     else
51         objs[id].info.inst_flags &= ~HUDOBJ_INST_FLAG;
52 }
53