Add weapon cycling bindings for mouse and joystick buttons. Add weapon cycling bindi...
[chocolate-doom.git] / src / deh_mapping.h
blob4862dec911957952a2a00437d427bf1e480964e7
1 // Emacs style mode select -*- C++ -*-
2 //-----------------------------------------------------------------------------
3 //
4 // Copyright(C) 2005 Simon Howard
5 //
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19 // 02111-1307, USA.
21 //-----------------------------------------------------------------------------
23 // Dehacked "mapping" code
24 // Allows the fields in structures to be mapped out and accessed by
25 // name
27 //-----------------------------------------------------------------------------
29 #ifndef DEH_MAPPING_H
30 #define DEH_MAPPING_H
32 #include "doomtype.h"
33 #include "deh_io.h"
34 #include "md5.h"
36 #define DEH_BEGIN_MAPPING(mapping_name, structname) \
37 static structname deh_mapping_base; \
38 static deh_mapping_t mapping_name = \
39 { \
40 &deh_mapping_base, \
43 #define DEH_MAPPING(deh_name, fieldname) \
44 {deh_name, &deh_mapping_base.fieldname, \
45 sizeof(deh_mapping_base.fieldname)},
47 #define DEH_UNSUPPORTED_MAPPING(deh_name) \
48 {deh_name, NULL, -1},
50 #define DEH_END_MAPPING \
51 {NULL, NULL, -1} \
52 } \
57 #define MAX_MAPPING_ENTRIES 32
59 typedef struct deh_mapping_s deh_mapping_t;
60 typedef struct deh_mapping_entry_s deh_mapping_entry_t;
62 struct deh_mapping_entry_s
64 // field name
66 char *name;
68 // location relative to the base in the deh_mapping_t struct
69 // If this is NULL, it is an unsupported mapping
71 void *location;
73 // field size
75 int size;
78 struct deh_mapping_s
80 void *base;
81 deh_mapping_entry_t entries[MAX_MAPPING_ENTRIES];
84 boolean DEH_SetMapping(deh_context_t *context, deh_mapping_t *mapping,
85 void *structptr, char *name, int value);
86 void DEH_StructMD5Sum(md5_context_t *context, deh_mapping_t *mapping,
87 void *structptr);
89 #endif /* #ifndef DEH_MAPPING_H */