UFO: Alien Invasion
Loading...
Searching...
No Matches
entitiesdef.h
Go to the documentation of this file.
1
5
6/*
7All original material Copyright (C) 2002-2025 UFO: Alien Invasion.
8
9Copyright (C) 1997-2001 Id Software, Inc.
10
11This program is free software; you can redistribute it and/or
12modify it under the terms of the GNU General Public License
13as published by the Free Software Foundation; either version 2
14of the License, or (at your option) any later version.
15
16This program is distributed in the hope that it will be useful,
17but WITHOUT ANY WARRANTY; without even the implied warranty of
18MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19
20See the GNU General Public License for more details.
21
22You should have received a copy of the GNU General Public License
23along with this program; if not, write to the Free Software
24Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25
26*/
27
28#pragma once
29
30# define ED_MAX_DEFS 64
31
32# define ED_ERROR -1
33# define ED_OK 1
34
35# define ED_OPTIONAL (1<<0)
36# define ED_MANDATORY (1<<1)
37# define ED_ABSTRACT (1<<2)
38# define ED_TYPE_FLOAT (1<<3)
39# define ED_TYPE_INT (1<<4)
40# define ED_TYPE_STRING (1<<5)
41# define ED_DEFAULT (1<<6)
42# define ED_MODE_TYPE (1<<7)
43# define ED_RANGE (1<<8)
44# define ED_INSIST_POSITIVE (1<<9)
45# define ED_TYPE_BOOL (1<<10)
46
47# define ED_CONCRETE (ED_OPTIONAL | ED_MANDATORY)
48# define ED_KEY_TYPE (ED_TYPE_FLOAT | ED_TYPE_INT | ED_TYPE_STRING | ED_TYPE_BOOL)
49
50typedef union int_float_u {
51 int i;
52 float f;
54
55typedef struct entityKeyRange_s {
56 char* str;
57 int* iArr;
58 float* fArr;
62
63typedef struct entityKeyDef_s {
64 char* name;
65 char* desc;
67 int flags;
68 int vLen;
72
73typedef struct entityDef_s {
74 char* classname;
78
79int ED_GetIntVector(const entityKeyDef_t* kd, int v[], const int n);
80int ED_Check(const char* classname, const char* key, const char* value);
81int ED_CheckKey(const entityKeyDef_t* kd, const char* value);
82const entityDef_t* ED_GetEntityDef(const char* classname);
83const entityKeyDef_t* ED_GetKeyDef(const char* classname, const char* keyname, const int abstract);
84const entityKeyDef_t* ED_GetKeyDefEntity(const entityDef_t* ed, const char* keyname, const int abstract);
85int ED_Parse(const char* data_p);
86const char* ED_GetLastError(void);
87void ED_Free(void);
88
89extern int numEntityDefs;
unsigned int key
Definition cl_input.cpp:64
int numEntityDefs
entityDef_t entityDefs[ED_MAX_DEFS+1]
int ED_Check(const char *classname, const char *key, const char *value)
tests if a value string matches the type for this key. Also checks the value against the range,...
int ED_Parse(const char *data_p)
int ED_CheckKey(const entityKeyDef_t *kd, const char *value)
as ED_Check, but where the entity and key are known, so takes different arguments.
const entityKeyDef_t * ED_GetKeyDefEntity(const entityDef_t *ed, const char *keyname, const int abstract)
searches for the parsed key def, when the entity def is known
const entityKeyDef_t * ED_GetKeyDef(const char *classname, const char *keyname, const int abstract)
searches for the parsed key def
#define ED_MAX_DEFS
Definition entitiesdef.h:30
int ED_GetIntVector(const entityKeyDef_t *kd, int v[], const int n)
parses a value from the definition
const char * ED_GetLastError(void)
void ED_Free(void)
const entityDef_t * ED_GetEntityDef(const char *classname)
searches for the parsed entity def by classname
QGL_EXTERN int GLboolean GLfloat * v
Definition r_gl.h:120
char * classname
Definition entitiesdef.h:74
entityKeyDef_t * keyDefs
Definition entitiesdef.h:75
char * defaultVal
Definition entitiesdef.h:66
entityKeyRange_t ** ranges
Definition entitiesdef.h:69