summaryrefslogtreecommitdiff
path: root/apps/plugins/sdl/progs/quake/common.h
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/sdl/progs/quake/common.h')
-rw-r--r--apps/plugins/sdl/progs/quake/common.h184
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/*
2Copyright (C) 1996-1997 Id Software, Inc.
3
4This program is free software; you can redistribute it and/or
5modify it under the terms of the GNU General Public License
6as published by the Free Software Foundation; either version 2
7of the License, or (at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
13See the GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this program; if not, write to the Free Software
17Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19*/
20// comndef.h -- general definitions
21
22#if !defined BYTE_DEFINED
23typedef unsigned char byte;
24#define BYTE_DEFINED 1
25#endif
26
27#undef true
28#undef false
29
30typedef int qboolean;
31enum {false, true};
32
33//============================================================================
34
35typedef 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
44void SZ_Alloc (sizebuf_t *buf, int startsize);
45void SZ_Free (sizebuf_t *buf);
46void SZ_Clear (sizebuf_t *buf);
47void *SZ_GetSpace (sizebuf_t *buf, int length);
48void SZ_Write (sizebuf_t *buf, void *data, int length);
49void SZ_Print (sizebuf_t *buf, char *data); // strcats onto the sizebuf
50
51//============================================================================
52
53typedef struct link_s
54{
55 struct link_s *prev, *next;
56} link_t;
57
58
59void ClearLink (link_t *l);
60void RemoveLink (link_t *l);
61void InsertLinkBefore (link_t *l, link_t *before);
62void 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
89extern qboolean bigendien;
90
91extern short (*BigShort) (short l);
92extern short (*LittleShort) (short l);
93extern int (*BigLong) (int l);
94extern int (*LittleLong) (int l);
95extern float (*BigFloat) (float l);
96extern float (*LittleFloat) (float l);
97
98//============================================================================
99
100void MSG_WriteChar (sizebuf_t *sb, int c);
101void MSG_WriteByte (sizebuf_t *sb, int c);
102void MSG_WriteShort (sizebuf_t *sb, int c);
103void MSG_WriteLong (sizebuf_t *sb, int c);
104void MSG_WriteFloat (sizebuf_t *sb, float f);
105void MSG_WriteString (sizebuf_t *sb, char *s);
106void MSG_WriteCoord (sizebuf_t *sb, float f);
107void MSG_WriteAngle (sizebuf_t *sb, float f);
108
109extern int msg_readcount;
110extern qboolean msg_badread; // set if a read goes beyond end of message
111
112void MSG_BeginReading (void);
113int MSG_ReadChar (void);
114int MSG_ReadByte (void);
115int MSG_ReadShort (void);
116int MSG_ReadLong (void);
117float MSG_ReadFloat (void);
118char *MSG_ReadString (void);
119
120float MSG_ReadCoord (void);
121float MSG_ReadAngle (void);
122
123//============================================================================
124
125void Q_memset (void *dest, int fill, int count);
126void Q_memcpy (void *dest, void *src, int count);
127int Q_memcmp (void *m1, void *m2, int count);
128void Q_strcpy (char *dest, char *src);
129void Q_strncpy (char *dest, char *src, int count);
130int Q_strlen (char *str);
131char *Q_strrchr (char *s, char c);
132void Q_strcat (char *dest, char *src);
133int Q_strcmp (char *s1, char *s2);
134int Q_strncmp (char *s1, char *s2, int count);
135int Q_strcasecmp (char *s1, char *s2);
136int Q_strncasecmp (char *s1, char *s2, int n);
137int Q_atoi (char *str);
138float Q_atof (char *str);
139
140//============================================================================
141
142extern char com_token[1024];
143extern qboolean com_eof;
144
145char *COM_Parse (char *data);
146
147
148extern int com_argc;
149extern char **com_argv;
150
151int COM_CheckParm (char *parm);
152void COM_Init (char *path);
153void COM_InitArgv (int argc, char **argv);
154
155char *COM_SkipPath (char *pathname);
156void COM_StripExtension (char *in, char *out);
157void COM_FileBase (char *in, char *out);
158void COM_DefaultExtension (char *path, char *extension);
159
160char *va(char *format, ...);
161// does a varargs printf into a temp buffer
162
163
164//============================================================================
165
166extern int com_filesize;
167struct cache_user_s;
168
169extern char com_gamedir[MAX_OSPATH];
170
171void COM_WriteFile (char *filename, void *data, int len);
172int COM_OpenFile (char *filename, int *hndl);
173int COM_FOpenFile (char *filename, FILE **file);
174void COM_CloseFile (int h);
175
176byte *COM_LoadStackFile (char *path, void *buffer, int bufsize);
177byte *COM_LoadTempFile (char *path);
178byte *COM_LoadHunkFile (char *path);
179void COM_LoadCacheFile (char *path, struct cache_user_s *cu);
180
181
182extern struct cvar_s registered;
183
184extern qboolean standard_quake, rogue, hipnotic;