diff options
Diffstat (limited to 'apps/plugins/sdl/progs/quake/common.h')
-rw-r--r-- | apps/plugins/sdl/progs/quake/common.h | 184 |
1 files changed, 184 insertions, 0 deletions
diff --git a/apps/plugins/sdl/progs/quake/common.h b/apps/plugins/sdl/progs/quake/common.h new file mode 100644 index 0000000000..a1ac227aff --- /dev/null +++ b/apps/plugins/sdl/progs/quake/common.h | |||
@@ -0,0 +1,184 @@ | |||
1 | /* | ||
2 | Copyright (C) 1996-1997 Id Software, Inc. | ||
3 | |||
4 | This program is free software; you can redistribute it and/or | ||
5 | modify it under the terms of the GNU General Public License | ||
6 | as published by the Free Software Foundation; either version 2 | ||
7 | of the License, or (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
12 | |||
13 | See the 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, write to the Free Software | ||
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
18 | |||
19 | */ | ||
20 | // comndef.h -- general definitions | ||
21 | |||
22 | #if !defined BYTE_DEFINED | ||
23 | typedef unsigned char byte; | ||
24 | #define BYTE_DEFINED 1 | ||
25 | #endif | ||
26 | |||
27 | #undef true | ||
28 | #undef false | ||
29 | |||
30 | typedef int qboolean; | ||
31 | enum {false, true}; | ||
32 | |||
33 | //============================================================================ | ||
34 | |||
35 | typedef struct sizebuf_s | ||
36 | { | ||
37 | qboolean allowoverflow; // if false, do a Sys_Error | ||
38 | qboolean overflowed; // set to true if the buffer size failed | ||
39 | byte *data; | ||
40 | int maxsize; | ||
41 | int cursize; | ||
42 | } sizebuf_t; | ||
43 | |||
44 | void SZ_Alloc (sizebuf_t *buf, int startsize); | ||
45 | void SZ_Free (sizebuf_t *buf); | ||
46 | void SZ_Clear (sizebuf_t *buf); | ||
47 | void *SZ_GetSpace (sizebuf_t *buf, int length); | ||
48 | void SZ_Write (sizebuf_t *buf, void *data, int length); | ||
49 | void SZ_Print (sizebuf_t *buf, char *data); // strcats onto the sizebuf | ||
50 | |||
51 | //============================================================================ | ||
52 | |||
53 | typedef struct link_s | ||
54 | { | ||
55 | struct link_s *prev, *next; | ||
56 | } link_t; | ||
57 | |||
58 | |||
59 | void ClearLink (link_t *l); | ||
60 | void RemoveLink (link_t *l); | ||
61 | void InsertLinkBefore (link_t *l, link_t *before); | ||
62 | void InsertLinkAfter (link_t *l, link_t *after); | ||
63 | |||
64 | // (type *)STRUCT_FROM_LINK(link_t *link, type, member) | ||
65 | // ent = STRUCT_FROM_LINK(link,entity_t,order) | ||
66 | // FIXME: remove this mess! | ||
67 | #define STRUCT_FROM_LINK(l,t,m) ((t *)((byte *)l - (int)&(((t *)0)->m))) | ||
68 | |||
69 | //============================================================================ | ||
70 | |||
71 | #ifndef NULL | ||
72 | #define NULL ((void *)0) | ||
73 | #endif | ||
74 | |||
75 | #define Q_MAXCHAR ((char)0x7f) | ||
76 | #define Q_MAXSHORT ((short)0x7fff) | ||
77 | #define Q_MAXINT ((int)0x7fffffff) | ||
78 | #define Q_MAXLONG ((int)0x7fffffff) | ||
79 | #define Q_MAXFLOAT ((int)0x7fffffff) | ||
80 | |||
81 | #define Q_MINCHAR ((char)0x80) | ||
82 | #define Q_MINSHORT ((short)0x8000) | ||
83 | #define Q_MININT ((int)0x80000000) | ||
84 | #define Q_MINLONG ((int)0x80000000) | ||
85 | #define Q_MINFLOAT ((int)0x7fffffff) | ||
86 | |||
87 | //============================================================================ | ||
88 | |||
89 | extern qboolean bigendien; | ||
90 | |||
91 | extern short (*BigShort) (short l); | ||
92 | extern short (*LittleShort) (short l); | ||
93 | extern int (*BigLong) (int l); | ||
94 | extern int (*LittleLong) (int l); | ||
95 | extern float (*BigFloat) (float l); | ||
96 | extern float (*LittleFloat) (float l); | ||
97 | |||
98 | //============================================================================ | ||
99 | |||
100 | void MSG_WriteChar (sizebuf_t *sb, int c); | ||
101 | void MSG_WriteByte (sizebuf_t *sb, int c); | ||
102 | void MSG_WriteShort (sizebuf_t *sb, int c); | ||
103 | void MSG_WriteLong (sizebuf_t *sb, int c); | ||
104 | void MSG_WriteFloat (sizebuf_t *sb, float f); | ||
105 | void MSG_WriteString (sizebuf_t *sb, char *s); | ||
106 | void MSG_WriteCoord (sizebuf_t *sb, float f); | ||
107 | void MSG_WriteAngle (sizebuf_t *sb, float f); | ||
108 | |||
109 | extern int msg_readcount; | ||
110 | extern qboolean msg_badread; // set if a read goes beyond end of message | ||
111 | |||
112 | void MSG_BeginReading (void); | ||
113 | int MSG_ReadChar (void); | ||
114 | int MSG_ReadByte (void); | ||
115 | int MSG_ReadShort (void); | ||
116 | int MSG_ReadLong (void); | ||
117 | float MSG_ReadFloat (void); | ||
118 | char *MSG_ReadString (void); | ||
119 | |||
120 | float MSG_ReadCoord (void); | ||
121 | float MSG_ReadAngle (void); | ||
122 | |||
123 | //============================================================================ | ||
124 | |||
125 | void Q_memset (void *dest, int fill, int count); | ||
126 | void Q_memcpy (void *dest, void *src, int count); | ||
127 | int Q_memcmp (void *m1, void *m2, int count); | ||
128 | void Q_strcpy (char *dest, char *src); | ||
129 | void Q_strncpy (char *dest, char *src, int count); | ||
130 | int Q_strlen (char *str); | ||
131 | char *Q_strrchr (char *s, char c); | ||
132 | void Q_strcat (char *dest, char *src); | ||
133 | int Q_strcmp (char *s1, char *s2); | ||
134 | int Q_strncmp (char *s1, char *s2, int count); | ||
135 | int Q_strcasecmp (char *s1, char *s2); | ||
136 | int Q_strncasecmp (char *s1, char *s2, int n); | ||
137 | int Q_atoi (char *str); | ||
138 | float Q_atof (char *str); | ||
139 | |||
140 | //============================================================================ | ||
141 | |||
142 | extern char com_token[1024]; | ||
143 | extern qboolean com_eof; | ||
144 | |||
145 | char *COM_Parse (char *data); | ||
146 | |||
147 | |||
148 | extern int com_argc; | ||
149 | extern char **com_argv; | ||
150 | |||
151 | int COM_CheckParm (char *parm); | ||
152 | void COM_Init (char *path); | ||
153 | void COM_InitArgv (int argc, char **argv); | ||
154 | |||
155 | char *COM_SkipPath (char *pathname); | ||
156 | void COM_StripExtension (char *in, char *out); | ||
157 | void COM_FileBase (char *in, char *out); | ||
158 | void COM_DefaultExtension (char *path, char *extension); | ||
159 | |||
160 | char *va(char *format, ...); | ||
161 | // does a varargs printf into a temp buffer | ||
162 | |||
163 | |||
164 | //============================================================================ | ||
165 | |||
166 | extern int com_filesize; | ||
167 | struct cache_user_s; | ||
168 | |||
169 | extern char com_gamedir[MAX_OSPATH]; | ||
170 | |||
171 | void COM_WriteFile (char *filename, void *data, int len); | ||
172 | int COM_OpenFile (char *filename, int *hndl); | ||
173 | int COM_FOpenFile (char *filename, FILE **file); | ||
174 | void COM_CloseFile (int h); | ||
175 | |||
176 | byte *COM_LoadStackFile (char *path, void *buffer, int bufsize); | ||
177 | byte *COM_LoadTempFile (char *path); | ||
178 | byte *COM_LoadHunkFile (char *path); | ||
179 | void COM_LoadCacheFile (char *path, struct cache_user_s *cu); | ||
180 | |||
181 | |||
182 | extern struct cvar_s registered; | ||
183 | |||
184 | extern qboolean standard_quake, rogue, hipnotic; | ||