diff --git a/Makefile b/Makefile index 987c6689..ab82a69e 100644 --- a/Makefile +++ b/Makefile @@ -478,28 +478,21 @@ CLIENT_OBJS_ := \ src/client/sound/snd_mix.o \ src/client/sound/snd_vorbis.o \ src/client/sound/snd_wav.o \ + src/common/argproc.o \ + src/common/clientserver.o \ + src/common/collision.o \ src/common/crc.o \ + src/common/cmdparser.o \ src/common/cvar.o \ src/common/filesystem.o \ src/common/glob.o \ src/common/md4.o \ + src/common/movemsg.o \ src/common/misc.o \ src/common/netchan.o \ src/common/pmove.o \ src/common/szone.o \ src/common/zone.o \ - src/common/command/cmd_execution.o \ - src/common/command/cmd_parser.o \ - src/common/command/cmd_script.o \ - src/common/common/com_arg.o \ - src/common/common/com_clientserver.o \ - src/common/message/msg_io.o \ - src/common/message/msg_read.o \ - src/common/model/cm_areaportals.o \ - src/common/model/cm_box.o \ - src/common/model/cm_boxtracing.o \ - src/common/model/cm_bsp.o \ - src/common/model/cm_vis.o \ src/common/shared/flash.o \ src/common/shared/rand.o \ src/common/shared/shared.o \ @@ -540,28 +533,21 @@ endif # Used by the server SERVER_OBJS_ := \ + src/common/argproc.o \ + src/common/clientserver.o \ + src/common/collision.o \ src/common/crc.o \ + src/common/cmdparser.o \ src/common/cvar.o \ src/common/filesystem.o \ src/common/glob.o \ src/common/md4.o \ src/common/misc.o \ + src/common/movemsg.o \ src/common/netchan.o \ src/common/pmove.o \ src/common/szone.o \ src/common/zone.o \ - src/common/command/cmd_execution.o \ - src/common/command/cmd_parser.o \ - src/common/command/cmd_script.o \ - src/common/common/com_arg.o \ - src/common/common/com_clientserver.o \ - src/common/message/msg_io.o \ - src/common/message/msg_read.o \ - src/common/model/cm_areaportals.o \ - src/common/model/cm_box.o \ - src/common/model/cm_boxtracing.o \ - src/common/model/cm_bsp.o \ - src/common/model/cm_vis.o \ src/common/shared/rand.o \ src/common/shared/shared.o \ src/common/unzip/ioapi.o \ diff --git a/src/common/common/com_arg.c b/src/common/argproc.c similarity index 62% rename from src/common/common/com_arg.c rename to src/common/argproc.c index 7857dab5..e23ead3e 100644 --- a/src/common/common/com_arg.c +++ b/src/common/argproc.c @@ -24,134 +24,167 @@ * ======================================================================= */ -#include "../header/common.h" +#include "header/common.h" -#define MAX_NUM_ARGVS 50 +#define MAX_NUM_ARGVS 50 -int com_argc; -char *com_argv[MAX_NUM_ARGVS+1]; +int com_argc; +char *com_argv[MAX_NUM_ARGVS + 1]; /* * Returns the position (1 to argc-1) in the program's argument list * where the given parameter apears, or 0 if not present */ -int COM_CheckParm (char *parm) +int +COM_CheckParm(char *parm) { - int i; + int i; - for (i=1 ; i= com_argc || !com_argv[arg]) + if ((arg < 0) || (arg >= com_argc) || !com_argv[arg]) + { return ""; + } return com_argv[arg]; } -void COM_ClearArgv (int arg) +void +COM_ClearArgv(int arg) { - if (arg < 0 || arg >= com_argc || !com_argv[arg]) + if ((arg < 0) || (arg >= com_argc) || !com_argv[arg]) + { return; + } com_argv[arg] = ""; } -void COM_InitArgv (int argc, char **argv) +void +COM_InitArgv(int argc, char **argv) { - int i; + int i; if (argc > MAX_NUM_ARGVS) - Com_Error (ERR_FATAL, "argc > MAX_NUM_ARGVS"); + { + Com_Error(ERR_FATAL, "argc > MAX_NUM_ARGVS"); + } com_argc = argc; - for (i=0 ; i= MAX_TOKEN_CHARS ) + if (!argv[i] || (strlen(argv[i]) >= MAX_TOKEN_CHARS)) + { com_argv[i] = ""; + } else + { com_argv[i] = argv[i]; + } } } /* * Adds the given string at the end of the current argument list */ -void COM_AddParm (char *parm) +void +COM_AddParm(char *parm) { if (com_argc == MAX_NUM_ARGVS) - Com_Error (ERR_FATAL, "COM_AddParm: MAX_NUM)ARGS"); + { + Com_Error(ERR_FATAL, "COM_AddParm: MAX_NUM)ARGS"); + } com_argv[com_argc++] = parm; } -int memsearch (byte *start, int count, int search) +int +memsearch(byte *start, int count, int search) { - int i; + int i; - for (i=0 ; i #include -#define MAXPRINTMSG 4096 +#define MAXPRINTMSG 4096 -FILE *logfile; -cvar_t *logfile_active; /* 1 = buffer log, 2 = flush after each print */ +FILE *logfile; +cvar_t *logfile_active; /* 1 = buffer log, 2 = flush after each print */ jmp_buf abortframe; /* an ERR_DROP occured, exit the entire frame */ -int server_state; +int server_state; -static int rd_target; -static char *rd_buffer; -static int rd_buffersize; -static void (*rd_flush)(int target, char *buffer); +static int rd_target; +static char *rd_buffer; +static int rd_buffersize; +static void (*rd_flush)(int target, char *buffer); -void Com_BeginRedirect (int target, char *buffer, int buffersize, void (*flush)) +void +Com_BeginRedirect(int target, char *buffer, int buffersize, void (*flush)) { if (!target || !buffer || !buffersize || !flush) + { return; + } rd_target = target; rd_buffer = buffer; @@ -53,7 +56,8 @@ void Com_BeginRedirect (int target, char *buffer, int buffersize, void (*flush)) *rd_buffer = 0; } -void Com_EndRedirect (void) +void +Com_EndRedirect(void) { rd_flush(rd_target, rd_buffer); @@ -67,91 +71,106 @@ void Com_EndRedirect (void) * Both client and server can use this, and it will output * to the apropriate place. */ -void Com_Printf (char *fmt, ...) +void +Com_Printf(char *fmt, ...) { - va_list argptr; - char msg[MAXPRINTMSG]; + va_list argptr; + char msg[MAXPRINTMSG]; - va_start (argptr,fmt); - vsnprintf (msg,MAXPRINTMSG,fmt,argptr); - va_end (argptr); + va_start(argptr, fmt); + vsnprintf(msg, MAXPRINTMSG, fmt, argptr); + va_end(argptr); if (rd_target) { - if ((strlen (msg) + strlen(rd_buffer)) > (rd_buffersize - 1)) + if ((strlen(msg) + strlen(rd_buffer)) > (rd_buffersize - 1)) { rd_flush(rd_target, rd_buffer); *rd_buffer = 0; } - strcat (rd_buffer, msg); + strcat(rd_buffer, msg); return; } #ifndef DEDICATED_ONLY - Con_Print (msg); + Con_Print(msg); #endif /* also echo to debugging console */ - Sys_ConsoleOutput (msg); + Sys_ConsoleOutput(msg); /* logfile */ if (logfile_active && logfile_active->value) { - char name[MAX_QPATH]; + char name[MAX_QPATH]; if (!logfile) { - Com_sprintf (name, sizeof(name), "%s/qconsole.log", FS_Gamedir ()); + Com_sprintf(name, sizeof(name), "%s/qconsole.log", FS_Gamedir()); if (logfile_active->value > 2) - logfile = fopen (name, "a"); + { + logfile = fopen(name, "a"); + } else - logfile = fopen (name, "w"); + { + logfile = fopen(name, "w"); + } } if (logfile) - fprintf (logfile, "%s", msg); + { + fprintf(logfile, "%s", msg); + } if (logfile_active->value > 1) - fflush (logfile); /* force it to save every time */ + { + fflush(logfile); /* force it to save every time */ + } } } /* * A Com_Printf that only shows up if the "developer" cvar is set */ -void Com_DPrintf (char *fmt, ...) +void +Com_DPrintf(char *fmt, ...) { - va_list argptr; - char msg[MAXPRINTMSG]; + va_list argptr; + char msg[MAXPRINTMSG]; if (!developer || !developer->value) - return; /* don't confuse non-developers with techie stuff... */ + { + return; /* don't confuse non-developers with techie stuff... */ + } - va_start (argptr,fmt); - vsnprintf (msg,MAXPRINTMSG,fmt,argptr); - va_end (argptr); + va_start(argptr, fmt); + vsnprintf(msg, MAXPRINTMSG, fmt, argptr); + va_end(argptr); - Com_Printf ("%s", msg); + Com_Printf("%s", msg); } /* * A Com_Printf that only shows up when either the "modder" or "developer" * cvars is set */ -void Com_MDPrintf (char *fmt, ...) +void +Com_MDPrintf(char *fmt, ...) { va_list argptr; char msg[MAXPRINTMSG]; - if((!modder || !modder->value) && (!developer || !developer->value)) + if ((!modder || !modder->value) && (!developer || !developer->value)) + { return; + } - va_start (argptr,fmt); - vsnprintf (msg,MAXPRINTMSG,fmt,argptr); - va_end (argptr); + va_start(argptr, fmt); + vsnprintf(msg, MAXPRINTMSG, fmt, argptr); + va_end(argptr); Com_Printf("%s", msg); } @@ -160,56 +179,60 @@ void Com_MDPrintf (char *fmt, ...) * Both client and server can use this, and it will * do the apropriate things. */ -void Com_Error (int code, char *fmt, ...) +void +Com_Error(int code, char *fmt, ...) { - va_list argptr; - static char msg[MAXPRINTMSG]; - static qboolean recursive; + va_list argptr; + static char msg[MAXPRINTMSG]; + static qboolean recursive; if (recursive) - Sys_Error ("recursive error after: %s", msg); + { + Sys_Error("recursive error after: %s", msg); + } recursive = true; - va_start (argptr,fmt); - vsnprintf (msg,MAXPRINTMSG,fmt,argptr); - va_end (argptr); + va_start(argptr, fmt); + vsnprintf(msg, MAXPRINTMSG, fmt, argptr); + va_end(argptr); if (code == ERR_DISCONNECT) { #ifndef DEDICATED_ONLY - CL_Drop (); + CL_Drop(); #endif recursive = false; - longjmp (abortframe, -1); + longjmp(abortframe, -1); } else if (code == ERR_DROP) { - Com_Printf ("********************\nERROR: %s\n********************\n", msg); - SV_Shutdown (va("Server crashed: %s\n", msg), false); + Com_Printf("********************\nERROR: %s\n********************\n", + msg); + SV_Shutdown(va("Server crashed: %s\n", msg), false); #ifndef DEDICATED_ONLY - CL_Drop (); + CL_Drop(); #endif recursive = false; - longjmp (abortframe, -1); + longjmp(abortframe, -1); } else { - SV_Shutdown (va("Server fatal crashed: %s\n", msg), false); + SV_Shutdown(va("Server fatal crashed: %s\n", msg), false); #ifndef DEDICATED_ONLY - CL_Shutdown (); + CL_Shutdown(); #endif } if (logfile) { - fclose (logfile); + fclose(logfile); logfile = NULL; } - Sys_Error ("%s", msg); + Sys_Error("%s", msg); recursive = false; } @@ -217,19 +240,23 @@ void Com_Error (int code, char *fmt, ...) * Both client and server can use this, and it will * do the apropriate things. */ -void Com_Quit (void) +void +Com_Quit(void) { Com_Printf("\n----------- shutting down ----------\n"); - SV_Shutdown ("Server quit\n", false); - Sys_Quit (); + SV_Shutdown("Server quit\n", false); + Sys_Quit(); } -int Com_ServerState (void) +int +Com_ServerState(void) { return server_state; } -void Com_SetServerState (int state) +void +Com_SetServerState(int state) { server_state = state; } + diff --git a/src/common/cmdparser.c b/src/common/cmdparser.c new file mode 100644 index 00000000..00e057b3 --- /dev/null +++ b/src/common/cmdparser.c @@ -0,0 +1,1004 @@ +/* + * Copyright (C) 1997-2001 Id Software, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + * USA. + * + * ======================================================================= + * + * This file implements the Quake II command processor. Every command + * which is send via the command line at startup, via the console and + * via rcon is processed here and send to the apropriate subsystem. + * + * ======================================================================= + */ + +#include "header/common.h" + +#define MAX_ALIAS_NAME 32 +#define ALIAS_LOOP_COUNT 16 + +typedef struct cmd_function_s +{ + struct cmd_function_s *next; + char *name; + xcommand_t function; +} cmd_function_t; + +static cmd_function_t *cmd_functions; /* possible commands to execute */ + +typedef struct cmdalias_s +{ + struct cmdalias_s *next; + char name[MAX_ALIAS_NAME]; + char *value; +} cmdalias_t; + +char retval[256]; +int alias_count; /* for detecting runaway loops */ +cmdalias_t *cmd_alias; +qboolean cmd_wait; +static int cmd_argc; +static int cmd_argc; +static char *cmd_argv[MAX_STRING_TOKENS]; +static char *cmd_null_string = ""; +static char cmd_args[MAX_STRING_CHARS]; +sizebuf_t cmd_text; +byte cmd_text_buf[8192]; +char defer_text_buf[8192]; + +/* + * Causes execution of the remainder of the command buffer to be delayed + * until next frame. This allows commands like: bind g "impulse 5 ; + * +attack ; wait ; -attack ; impulse 2" + */ +void +Cmd_Wait_f(void) +{ + cmd_wait = true; +} + +void +Cbuf_Init(void) +{ + SZ_Init(&cmd_text, cmd_text_buf, sizeof(cmd_text_buf)); +} + +/* + * Adds command text at the end of the buffer + */ +void +Cbuf_AddText(char *text) +{ + int l; + + l = strlen(text); + + if (cmd_text.cursize + l >= cmd_text.maxsize) + { + Com_Printf("Cbuf_AddText: overflow\n"); + return; + } + + SZ_Write(&cmd_text, text, strlen(text)); +} + +/* + * Adds command text immediately after the current command + * Adds a \n to the text + */ +void +Cbuf_InsertText(char *text) +{ + char *temp; + int templen; + + /* copy off any commands still remaining in the exec buffer */ + templen = cmd_text.cursize; + + if (templen) + { + temp = Z_Malloc(templen); + memcpy(temp, cmd_text.data, templen); + SZ_Clear(&cmd_text); + } + else + { + temp = NULL; + } + + /* add the entire text of the file */ + Cbuf_AddText(text); + + /* add the copied off data */ + if (templen) + { + SZ_Write(&cmd_text, temp, templen); + Z_Free(temp); + } +} + +void +Cbuf_CopyToDefer(void) +{ + memcpy(defer_text_buf, cmd_text_buf, cmd_text.cursize); + defer_text_buf[cmd_text.cursize] = 0; + cmd_text.cursize = 0; +} + +void +Cbuf_InsertFromDefer(void) +{ + Cbuf_InsertText(defer_text_buf); + defer_text_buf[0] = 0; +} + +void +Cbuf_ExecuteText(int exec_when, char *text) +{ + switch (exec_when) + { + case EXEC_NOW: + Cmd_ExecuteString(text); + break; + case EXEC_INSERT: + Cbuf_InsertText(text); + break; + case EXEC_APPEND: + Cbuf_AddText(text); + break; + default: + Com_Error(ERR_FATAL, "Cbuf_ExecuteText: bad exec_when"); + } +} + +void +Cbuf_Execute(void) +{ + int i; + char *text; + char line[1024]; + int quotes; + + alias_count = 0; /* don't allow infinite alias loops */ + + while (cmd_text.cursize) + { + /* find a \n or ; line break */ + text = (char *)cmd_text.data; + + quotes = 0; + + for (i = 0; i < cmd_text.cursize; i++) + { + if (text[i] == '"') + { + quotes++; + } + + if (!(quotes & 1) && (text[i] == ';')) + { + break; /* don't break if inside a quoted string */ + } + + if (text[i] == '\n') + { + break; + } + } + + if (i > sizeof(line) - 1) + { + i = sizeof(line) - 1; + } + + memcpy(line, text, i); + line[i] = 0; + + /* delete the text from the command buffer and move remaining + commands down this is necessary because commands (exec, + alias) can insert data at the beginning of the text buffer */ + if (i == cmd_text.cursize) + { + cmd_text.cursize = 0; + } + + else + { + i++; + cmd_text.cursize -= i; + memmove(text, text + i, cmd_text.cursize); + } + + /* execute the command line */ + Cmd_ExecuteString(line); + + if (cmd_wait) + { + /* skip out while text still remains in buffer, + leaving it for next frame */ + cmd_wait = false; + break; + } + } +} + +/* + * Adds command line parameters as script statements Commands lead with + * a +, and continue until another + + * + * Set commands are added early, so they are guaranteed to be set before + * the client and server initialize for the first time. + * + * Other commands are added late, after all initialization is complete. + */ +void +Cbuf_AddEarlyCommands(qboolean clear) +{ + int i; + char *s; + + for (i = 0; i < COM_Argc(); i++) + { + s = COM_Argv(i); + + if (strcmp(s, "+set")) + { + continue; + } + + Cbuf_AddText(va("set %s %s\n", COM_Argv(i + 1), COM_Argv(i + 2))); + + if (clear) + { + COM_ClearArgv(i); + COM_ClearArgv(i + 1); + COM_ClearArgv(i + 2); + } + + i += 2; + } +} + +/* + * Adds command line parameters as script statements + * Commands lead with a + and continue until another + or - + * quake +vid_ref gl +map amlev1 + * + * Returns true if any late commands were added, which + * will keep the demoloop from immediately starting + */ +qboolean +Cbuf_AddLateCommands(void) +{ + int i, j; + int s; + char *text, *build, c; + int argc; + qboolean ret; + + /* build the combined string to parse from */ + s = 0; + argc = COM_Argc(); + + for (i = 1; i < argc; i++) + { + s += strlen(COM_Argv(i)) + 1; + } + + if (!s) + { + return false; + } + + text = Z_Malloc(s + 1); + text[0] = 0; + + for (i = 1; i < argc; i++) + { + strcat(text, COM_Argv(i)); + + if (i != argc - 1) + { + strcat(text, " "); + } + } + + /* pull out the commands */ + build = Z_Malloc(s + 1); + build[0] = 0; + + for (i = 0; i < s - 1; i++) + { + if (text[i] == '+') + { + i++; + + for (j = i; (text[j] != '+') && (text[j] != '-') && (text[j] != 0); j++) + { + } + + c = text[j]; + text[j] = 0; + + strcat(build, text + i); + strcat(build, "\n"); + text[j] = c; + i = j - 1; + } + } + + ret = (build[0] != 0); + + if (ret) + { + Cbuf_AddText(build); + } + + Z_Free(text); + Z_Free(build); + + return ret; +} + +void +Cmd_Exec_f(void) +{ + char *f, *f2; + int len; + + if (Cmd_Argc() != 2) + { + Com_Printf("exec : execute a script file\n"); + return; + } + + len = FS_LoadFile(Cmd_Argv(1), (void **)&f); + + if (!f) + { + Com_Printf("couldn't exec %s\n", Cmd_Argv(1)); + return; + } + + Com_Printf("execing %s\n", Cmd_Argv(1)); + + /* the file doesn't have a trailing 0, so we need to copy it off */ + f2 = Z_Malloc(len + 1); + memcpy(f2, f, len); + f2[len] = 0; + + Cbuf_InsertText(f2); + + Z_Free(f2); + FS_FreeFile(f); +} + +/* + * Just prints the rest of the line to the console + */ +void +Cmd_Echo_f(void) +{ + int i; + + for (i = 1; i < Cmd_Argc(); i++) + { + Com_Printf("%s ", Cmd_Argv(i)); + } + + Com_Printf("\n"); +} + +/* + * Creates a new command that executes + * a command string (possibly ; seperated) + */ +void +Cmd_Alias_f(void) +{ + cmdalias_t *a; + char cmd[1024]; + int i, c; + char *s; + + if (Cmd_Argc() == 1) + { + Com_Printf("Current alias commands:\n"); + + for (a = cmd_alias; a; a = a->next) + { + Com_Printf("%s : %s\n", a->name, a->value); + } + + return; + } + + s = Cmd_Argv(1); + + if (strlen(s) >= MAX_ALIAS_NAME) + { + Com_Printf("Alias name is too long\n"); + return; + } + + /* if the alias already exists, reuse it */ + for (a = cmd_alias; a; a = a->next) + { + if (!strcmp(s, a->name)) + { + Z_Free(a->value); + break; + } + } + + if (!a) + { + a = Z_Malloc(sizeof(cmdalias_t)); + a->next = cmd_alias; + cmd_alias = a; + } + + strcpy(a->name, s); + + /* copy the rest of the command line */ + cmd[0] = 0; /* start out with a null string */ + c = Cmd_Argc(); + + for (i = 2; i < c; i++) + { + strcat(cmd, Cmd_Argv(i)); + + if (i != (c - 1)) + { + strcat(cmd, " "); + } + } + + strcat(cmd, "\n"); + + a->value = CopyString(cmd); +} + +int +Cmd_Argc(void) +{ + return cmd_argc; +} + +char * +Cmd_Argv(int arg) +{ + if ((unsigned)arg >= cmd_argc) + { + return cmd_null_string; + } + + return cmd_argv[arg]; +} + +/* + * Returns a single string containing argv(1) to argv(argc()-1) + */ +char * +Cmd_Args(void) +{ + return cmd_args; +} + +char * +Cmd_MacroExpandString(char *text) +{ + int i, j, count, len; + qboolean inquote; + char *scan; + static char expanded[MAX_STRING_CHARS]; + char temporary[MAX_STRING_CHARS]; + char *token, *start; + + inquote = false; + scan = text; + + len = strlen(scan); + + if (len >= MAX_STRING_CHARS) + { + Com_Printf("Line exceeded %i chars, discarded.\n", MAX_STRING_CHARS); + return NULL; + } + + count = 0; + + for (i = 0; i < len; i++) + { + if (scan[i] == '"') + { + inquote ^= 1; + } + + if (inquote) + { + continue; /* don't expand inside quotes */ + } + + if (scan[i] != '$') + { + continue; + } + + /* scan out the complete macro */ + start = scan + i + 1; + token = COM_Parse(&start); + + if (!start) + { + continue; + } + + token = (char *)Cvar_VariableString(token); + + j = strlen(token); + len += j; + + if (len >= MAX_STRING_CHARS) + { + Com_Printf("Expanded line exceeded %i chars, discarded.\n", + MAX_STRING_CHARS); + return NULL; + } + + strncpy(temporary, scan, i); + strcpy(temporary + i, token); + strcpy(temporary + i + j, start); + + strcpy(expanded, temporary); + scan = expanded; + i--; + + if (++count == 100) + { + Com_Printf("Macro expansion loop, discarded.\n"); + return NULL; + } + } + + if (inquote) + { + Com_Printf("Line has unmatched quote, discarded.\n"); + return NULL; + } + + return scan; +} + +/* + * Parses the given string into command line tokens. + * $Cvars will be expanded unless they are in a quoted token + */ +void +Cmd_TokenizeString(char *text, qboolean macroExpand) +{ + int i; + const char *com_token; + + /* clear the args from the last string */ + for (i = 0; i < cmd_argc; i++) + { + Z_Free(cmd_argv[i]); + } + + cmd_argc = 0; + cmd_args[0] = 0; + + /* macro expand the text */ + if (macroExpand) + { + text = Cmd_MacroExpandString(text); + } + + if (!text) + { + return; + } + + while (1) + { + /* skip whitespace up to a /n */ + while (*text && *text <= ' ' && *text != '\n') + { + text++; + } + + if (*text == '\n') + { + /* a newline seperates commands in the buffer */ + text++; + break; + } + + if (!*text) + { + return; + } + + /* set cmd_args to everything after the first arg */ + if (cmd_argc == 1) + { + int l; + + strcpy(cmd_args, text); + + /* strip off any trailing whitespace */ + l = strlen(cmd_args) - 1; + + for ( ; l >= 0; l--) + { + if (cmd_args[l] <= ' ') + { + cmd_args[l] = 0; + } + + else + { + break; + } + } + } + + com_token = COM_Parse(&text); + + if (!text) + { + return; + } + + if (cmd_argc < MAX_STRING_TOKENS) + { + cmd_argv[cmd_argc] = Z_Malloc(strlen(com_token) + 1); + strcpy(cmd_argv[cmd_argc], com_token); + cmd_argc++; + } + } +} + +void +Cmd_AddCommand(char *cmd_name, xcommand_t function) +{ + cmd_function_t *cmd; + + /* fail if the command is a variable name */ + if (Cvar_VariableString(cmd_name)[0]) + { + Cmd_RemoveCommand(cmd_name); + } + + /* fail if the command already exists */ + for (cmd = cmd_functions; cmd; cmd = cmd->next) + { + if (!strcmp(cmd_name, cmd->name)) + { + Com_Printf("Cmd_AddCommand: %s already defined\n", cmd_name); + return; + } + } + + cmd = Z_Malloc(sizeof(cmd_function_t)); + cmd->name = cmd_name; + cmd->function = function; + cmd->next = cmd_functions; + cmd_functions = cmd; +} + +void +Cmd_RemoveCommand(char *cmd_name) +{ + cmd_function_t *cmd, **back; + + back = &cmd_functions; + + while (1) + { + cmd = *back; + + if (!cmd) + { + Com_Printf("Cmd_RemoveCommand: %s not added\n", cmd_name); + return; + } + + if (!strcmp(cmd_name, cmd->name)) + { + *back = cmd->next; + Z_Free(cmd); + return; + } + + back = &cmd->next; + } +} + +qboolean +Cmd_Exists(char *cmd_name) +{ + cmd_function_t *cmd; + + for (cmd = cmd_functions; cmd; cmd = cmd->next) + { + if (!strcmp(cmd_name, cmd->name)) + { + return true; + } + } + + return false; +} + +int +qsort_strcomp(const void *s1, const void *s2) +{ + return strcmp(*(char **)s1, *(char **)s2); +} + +char * +Cmd_CompleteCommand(char *partial) +{ + cmd_function_t *cmd; + int len, i, o, p; + cmdalias_t *a; + cvar_t *cvar; + char *pmatch[1024]; + qboolean diff = false; + + len = strlen(partial); + + if (!len) + { + return NULL; + } + + /* check for exact match */ + for (cmd = cmd_functions; cmd; cmd = cmd->next) + { + if (!strcmp(partial, cmd->name)) + { + return cmd->name; + } + } + + for (a = cmd_alias; a; a = a->next) + { + if (!strcmp(partial, a->name)) + { + return a->name; + } + } + + for (cvar = cvar_vars; cvar; cvar = cvar->next) + { + if (!strcmp(partial, cvar->name)) + { + return cvar->name; + } + } + + for (i = 0; i < 1024; i++) + { + pmatch[i] = NULL; + } + + i = 0; + + /* check for partial match */ + for (cmd = cmd_functions; cmd; cmd = cmd->next) + { + if (!strncmp(partial, cmd->name, len)) + { + pmatch[i] = cmd->name; + i++; + } + } + + for (a = cmd_alias; a; a = a->next) + { + if (!strncmp(partial, a->name, len)) + { + pmatch[i] = a->name; + i++; + } + } + + for (cvar = cvar_vars; cvar; cvar = cvar->next) + { + if (!strncmp(partial, cvar->name, len)) + { + pmatch[i] = cvar->name; + i++; + } + } + + if (i) + { + if (i == 1) + { + return pmatch[0]; + } + + /* Sort it */ + qsort(pmatch, i, sizeof(pmatch[0]), qsort_strcomp); + + Com_Printf("\n\n", partial); + + for (o = 0; o < i; o++) + { + Com_Printf(" %s\n", pmatch[o]); + } + + strcpy(retval, ""); + p = 0; + + while (!diff && p < 256) + { + retval[p] = pmatch[0][p]; + + for (o = 0; o < i; o++) + { + if (p > strlen(pmatch[o])) + { + continue; + } + + if (retval[p] != pmatch[o][p]) + { + retval[p] = 0; + diff = true; + } + } + + p++; + } + + return retval; + } + + return NULL; +} + +qboolean +Cmd_IsComplete(char *command) +{ + cmd_function_t *cmd; + cmdalias_t *a; + cvar_t *cvar; + + /* check for exact match */ + for (cmd = cmd_functions; cmd; cmd = cmd->next) + { + if (!strcmp(command, cmd->name)) + { + return true; + } + } + + for (a = cmd_alias; a; a = a->next) + { + if (!strcmp(command, a->name)) + { + return true; + } + } + + for (cvar = cvar_vars; cvar; cvar = cvar->next) + { + if (!strcmp(command, cvar->name)) + { + return true; + } + } + + return false; +} + +/* + * A complete command line has been parsed, so try to execute it + */ +void +Cmd_ExecuteString(char *text) +{ + cmd_function_t *cmd; + cmdalias_t *a; + + Cmd_TokenizeString(text, true); + + /* execute the command line */ + if (!Cmd_Argc()) + { + return; /* no tokens */ + } + + /* check functions */ + for (cmd = cmd_functions; cmd; cmd = cmd->next) + { + if (!Q_strcasecmp(cmd_argv[0], cmd->name)) + { + if (!cmd->function) + { + /* forward to server command */ + Cmd_ExecuteString(va("cmd %s", text)); + } + else + { + cmd->function(); + } + + return; + } + } + + /* check alias */ + for (a = cmd_alias; a; a = a->next) + { + if (!Q_strcasecmp(cmd_argv[0], a->name)) + { + if (++alias_count == ALIAS_LOOP_COUNT) + { + Com_Printf("ALIAS_LOOP_COUNT\n"); + return; + } + + Cbuf_InsertText(a->value); + return; + } + } + + /* check cvars */ + if (Cvar_Command()) + { + return; + } + +#ifndef DEDICATED_ONLY + /* send it as a server command if we are connected */ + Cmd_ForwardToServer(); +#endif +} + +void +Cmd_List_f(void) +{ + cmd_function_t *cmd; + int i; + + i = 0; + + for (cmd = cmd_functions; cmd; cmd = cmd->next, i++) + { + Com_Printf("%s\n", cmd->name); + } + + Com_Printf("%i commands\n", i); +} + +void +Cmd_Init(void) +{ + /* register our commands */ + Cmd_AddCommand("cmdlist", Cmd_List_f); + Cmd_AddCommand("exec", Cmd_Exec_f); + Cmd_AddCommand("echo", Cmd_Echo_f); + Cmd_AddCommand("alias", Cmd_Alias_f); + Cmd_AddCommand("wait", Cmd_Wait_f); +} + diff --git a/src/common/collision.c b/src/common/collision.c new file mode 100644 index 00000000..ab6d5dc3 --- /dev/null +++ b/src/common/collision.c @@ -0,0 +1,1876 @@ +/* + * Copyright (C) 1997-2001 Id Software, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + * ======================================================================= + * + * The collision model. Slaps "boxes" through the world and checks if + * they collide with the world model, entities or other boxes. + * + * ======================================================================= + */ + +#include "header/common.h" + +typedef struct +{ + cplane_t *plane; + int children[2]; /* negative numbers are leafs */ +} cnode_t; + +typedef struct +{ + cplane_t *plane; + mapsurface_t *surface; +} cbrushside_t; + +typedef struct +{ + int contents; + int cluster; + int area; + unsigned short firstleafbrush; + unsigned short numleafbrushes; +} cleaf_t; + +typedef struct +{ + int contents; + int numsides; + int firstbrushside; + int checkcount; /* to avoid repeated testings */ +} cbrush_t; + +typedef struct +{ + int numareaportals; + int firstareaportal; + int floodnum; /* if two areas have equal floodnums, they are connected */ + int floodvalid; +} carea_t; + +byte *cmod_base; +byte map_visibility[MAX_MAP_VISIBILITY]; +byte pvsrow[MAX_MAP_LEAFS / 8]; +byte phsrow[MAX_MAP_LEAFS / 8]; +carea_t map_areas[MAX_MAP_AREAS]; +cbrush_t map_brushes[MAX_MAP_BRUSHES]; +cbrushside_t map_brushsides[MAX_MAP_BRUSHSIDES]; +char map_name[MAX_QPATH]; +char map_entitystring[MAX_MAP_ENTSTRING]; +cbrush_t *box_brush; +cleaf_t *box_leaf; +cleaf_t map_leafs[MAX_MAP_LEAFS]; +cmodel_t map_cmodels[MAX_MAP_MODELS]; +cnode_t map_nodes[MAX_MAP_NODES+6]; /* extra for box hull */ +cplane_t *box_planes; +cplane_t map_planes[MAX_MAP_PLANES+6]; /* extra for box hull */ +cvar_t *map_noareas; +dareaportal_t map_areaportals[MAX_MAP_AREAPORTALS]; +dvis_t *map_vis = (dvis_t *)map_visibility; +int box_headnode; +int checkcount; +int emptyleaf, solidleaf; +int floodvalid; +float *leaf_mins, *leaf_maxs; +int leaf_count, leaf_maxcount; +int *leaf_list; +int leaf_topnode; +int numareaportals; +int numareas = 1; +int numbrushes; +int numbrushsides; +int numclusters = 1; +int numcmodels; +int numentitychars; +int numleafbrushes; +int numleafs = 1; /* allow leaf funcs to be called without a map */ +int numnodes; +int numplanes; +int numtexinfo; +int numvisibility; +int trace_contents; +mapsurface_t map_surfaces[MAX_MAP_TEXINFO]; +mapsurface_t nullsurface; +qboolean portalopen[MAX_MAP_AREAPORTALS]; +qboolean trace_ispoint; /* optimized case */ +trace_t trace_trace; +unsigned short map_leafbrushes[MAX_MAP_LEAFBRUSHES]; +vec3_t trace_start, trace_end; +vec3_t trace_mins, trace_maxs; +vec3_t trace_extents; + +#ifndef DEDICATED_ONLY +int c_pointcontents; +int c_traces, c_brush_traces; +#endif + +/* 1/32 epsilon to keep floating point happy */ +#define DIST_EPSILON (0.03125f) + +void +FloodArea_r(carea_t *area, int floodnum) +{ + int i; + dareaportal_t *p; + + if (area->floodvalid == floodvalid) + { + if (area->floodnum == floodnum) + { + return; + } + + Com_Error(ERR_DROP, "FloodArea_r: reflooded"); + } + + area->floodnum = floodnum; + area->floodvalid = floodvalid; + p = &map_areaportals[area->firstareaportal]; + + for (i = 0; i < area->numareaportals; i++, p++) + { + if (portalopen[LittleLong(p->portalnum)]) + { + FloodArea_r(&map_areas[LittleLong(p->otherarea)], floodnum); + } + } +} + +void +FloodAreaConnections(void) +{ + int i; + carea_t *area; + int floodnum; + + /* all current floods are now invalid */ + floodvalid++; + floodnum = 0; + + /* area 0 is not used */ + for (i = 1; i < numareas; i++) + { + area = &map_areas[i]; + + if (area->floodvalid == floodvalid) + { + continue; /* already flooded into */ + } + + floodnum++; + FloodArea_r(area, floodnum); + } +} + +void +CM_SetAreaPortalState(int portalnum, qboolean open) +{ + if (portalnum > numareaportals) + { + Com_Error(ERR_DROP, "areaportal > numareaportals"); + } + + portalopen[portalnum] = open; + FloodAreaConnections(); +} + +qboolean +CM_AreasConnected(int area1, int area2) +{ + if (map_noareas->value) + { + return true; + } + + if ((area1 > numareas) || (area2 > numareas)) + { + Com_Error(ERR_DROP, "area > numareas"); + } + + if (map_areas[area1].floodnum == map_areas[area2].floodnum) + { + return true; + } + + return false; +} + +/* + * Writes a length byte followed by a bit vector of all the areas + * that area in the same flood as the area parameter + * + * This is used by the client refreshes to cull visibility + */ +int +CM_WriteAreaBits(byte *buffer, int area) +{ + int i; + int floodnum; + int bytes; + + bytes = (numareas + 7) >> 3; + + if (map_noareas->value) + { + /* for debugging, send everything */ + memset(buffer, 255, bytes); + } + + else + { + memset(buffer, 0, bytes); + + floodnum = map_areas[area].floodnum; + + for (i = 0; i < numareas; i++) + { + if ((map_areas[i].floodnum == floodnum) || !area) + { + buffer[i >> 3] |= 1 << (i & 7); + } + } + } + + return bytes; +} + +/* + * Writes the portal state to a savegame file + */ +void +CM_WritePortalState(FILE *f) +{ + fwrite(portalopen, sizeof(portalopen), 1, f); +} + +/* + * Reads the portal state from a savegame file + * and recalculates the area connections + */ +void +CM_ReadPortalState(fileHandle_t f) +{ + FS_Read(portalopen, sizeof(portalopen), f); + FloodAreaConnections(); +} + +/* + * Returns true if any leaf under headnode has a cluster that + * is potentially visible + */ +qboolean +CM_HeadnodeVisible(int nodenum, byte *visbits) +{ + int leafnum1; + int cluster; + cnode_t *node; + + if (nodenum < 0) + { + leafnum1 = -1 - nodenum; + cluster = map_leafs[leafnum1].cluster; + + if (cluster == -1) + { + return false; + } + + if (visbits[cluster >> 3] & (1 << (cluster & 7))) + { + return true; + } + + return false; + } + + node = &map_nodes[nodenum]; + + if (CM_HeadnodeVisible(node->children[0], visbits)) + { + return true; + } + + return CM_HeadnodeVisible(node->children[1], visbits); +} + +/* + * Set up the planes and nodes so that the six floats of a bounding box + * can just be stored out and get a proper clipping hull structure. + */ +void +CM_InitBoxHull(void) +{ + int i; + int side; + cnode_t *c; + cplane_t *p; + cbrushside_t *s; + + box_headnode = numnodes; + box_planes = &map_planes[numplanes]; + + if ((numnodes + 6 > MAX_MAP_NODES) || + (numbrushes + 1 > MAX_MAP_BRUSHES) || + (numleafbrushes + 1 > MAX_MAP_LEAFBRUSHES) || + (numbrushsides + 6 > MAX_MAP_BRUSHSIDES) || + (numplanes + 12 > MAX_MAP_PLANES)) + { + Com_Error(ERR_DROP, "Not enough room for box tree"); + } + + box_brush = &map_brushes[numbrushes]; + box_brush->numsides = 6; + box_brush->firstbrushside = numbrushsides; + box_brush->contents = CONTENTS_MONSTER; + + box_leaf = &map_leafs[numleafs]; + box_leaf->contents = CONTENTS_MONSTER; + box_leaf->firstleafbrush = numleafbrushes; + box_leaf->numleafbrushes = 1; + + map_leafbrushes[numleafbrushes] = numbrushes; + + for (i = 0; i < 6; i++) + { + side = i & 1; + + /* brush sides */ + s = &map_brushsides[numbrushsides + i]; + s->plane = map_planes + (numplanes + i * 2 + side); + s->surface = &nullsurface; + + /* nodes */ + c = &map_nodes[box_headnode + i]; + c->plane = map_planes + (numplanes + i * 2); + c->children[side] = -1 - emptyleaf; + + if (i != 5) + { + c->children[side ^ 1] = box_headnode + i + 1; + } + + else + { + c->children[side ^ 1] = -1 - numleafs; + } + + /* planes */ + p = &box_planes[i * 2]; + p->type = i >> 1; + p->signbits = 0; + VectorClear(p->normal); + p->normal[i >> 1] = 1; + + p = &box_planes[i * 2 + 1]; + p->type = 3 + (i >> 1); + p->signbits = 0; + VectorClear(p->normal); + p->normal[i >> 1] = -1; + } +} + +/* + * To keep everything totally uniform, bounding boxes are turned into + * small BSP trees instead of being compared directly. + */ +int +CM_HeadnodeForBox(vec3_t mins, vec3_t maxs) +{ + box_planes[0].dist = maxs[0]; + box_planes[1].dist = -maxs[0]; + box_planes[2].dist = mins[0]; + box_planes[3].dist = -mins[0]; + box_planes[4].dist = maxs[1]; + box_planes[5].dist = -maxs[1]; + box_planes[6].dist = mins[1]; + box_planes[7].dist = -mins[1]; + box_planes[8].dist = maxs[2]; + box_planes[9].dist = -maxs[2]; + box_planes[10].dist = mins[2]; + box_planes[11].dist = -mins[2]; + + return box_headnode; +} + +int +CM_PointLeafnum_r(vec3_t p, int num) +{ + float d; + cnode_t *node; + cplane_t *plane; + + while (num >= 0) + { + node = map_nodes + num; + plane = node->plane; + + if (plane->type < 3) + { + d = p[plane->type] - plane->dist; + } + + else + { + d = DotProduct(plane->normal, p) - plane->dist; + } + + if (d < 0) + { + num = node->children[1]; + } + + else + { + num = node->children[0]; + } + } + +#ifndef DEDICATED_ONLY + c_pointcontents++; /* optimize counter */ +#endif + + return -1 - num; +} + +int +CM_PointLeafnum(vec3_t p) +{ + if (!numplanes) + { + return 0; /* sound may call this without map loaded */ + } + + return CM_PointLeafnum_r(p, 0); +} + +/* + * Fills in a list of all the leafs touched + */ + +void +CM_BoxLeafnums_r(int nodenum) +{ + cplane_t *plane; + cnode_t *node; + int s; + + while (1) + { + if (nodenum < 0) + { + if (leaf_count >= leaf_maxcount) + { + return; + } + + leaf_list[leaf_count++] = -1 - nodenum; + return; + } + + node = &map_nodes[nodenum]; + plane = node->plane; + s = BOX_ON_PLANE_SIDE(leaf_mins, leaf_maxs, plane); + + if (s == 1) + { + nodenum = node->children[0]; + } + + else if (s == 2) + { + nodenum = node->children[1]; + } + + else + { + /* go down both */ + if (leaf_topnode == -1) + { + leaf_topnode = nodenum; + } + + CM_BoxLeafnums_r(node->children[0]); + nodenum = node->children[1]; + } + } +} + +int +CM_BoxLeafnums_headnode(vec3_t mins, vec3_t maxs, int *list, + int listsize, int headnode, int *topnode) +{ + leaf_list = list; + leaf_count = 0; + leaf_maxcount = listsize; + leaf_mins = mins; + leaf_maxs = maxs; + + leaf_topnode = -1; + + CM_BoxLeafnums_r(headnode); + + if (topnode) + { + *topnode = leaf_topnode; + } + + return leaf_count; +} + +int +CM_BoxLeafnums(vec3_t mins, vec3_t maxs, int *list, int listsize, int *topnode) +{ + return CM_BoxLeafnums_headnode(mins, maxs, list, + listsize, map_cmodels[0].headnode, topnode); +} + +int +CM_PointContents(vec3_t p, int headnode) +{ + int l; + + if (!numnodes) /* map not loaded */ + { + return 0; + } + + l = CM_PointLeafnum_r(p, headnode); + + return map_leafs[l].contents; +} + +/* + * Handles offseting and rotation of the end points for moving and + * rotating entities + */ +int +CM_TransformedPointContents(vec3_t p, int headnode, + vec3_t origin, vec3_t angles) +{ + vec3_t p_l; + vec3_t temp; + vec3_t forward, right, up; + int l; + + /* subtract origin offset */ + VectorSubtract(p, origin, p_l); + + /* rotate start and end into the models frame of reference */ + if ((headnode != box_headnode) && + (angles[0] || angles[1] || angles[2])) + { + AngleVectors(angles, forward, right, up); + + VectorCopy(p_l, temp); + p_l[0] = DotProduct(temp, forward); + p_l[1] = -DotProduct(temp, right); + p_l[2] = DotProduct(temp, up); + } + + l = CM_PointLeafnum_r(p_l, headnode); + + return map_leafs[l].contents; +} + +void +CM_ClipBoxToBrush(vec3_t mins, vec3_t maxs, vec3_t p1, + vec3_t p2, trace_t *trace, cbrush_t *brush) +{ + int i, j; + cplane_t *plane, *clipplane; + float dist; + float enterfrac, leavefrac; + vec3_t ofs; + float d1, d2; + qboolean getout, startout; + float f; + cbrushside_t *side, *leadside; + + enterfrac = -1; + leavefrac = 1; + clipplane = NULL; + + if (!brush->numsides) + { + return; + } + +#ifndef DEDICATED_ONLY + c_brush_traces++; +#endif + + getout = false; + startout = false; + leadside = NULL; + + for (i = 0; i < brush->numsides; i++) + { + side = &map_brushsides[brush->firstbrushside + i]; + plane = side->plane; + + if (!trace_ispoint) + { + /* general box case + push the plane out + apropriately for mins/maxs */ + for (j = 0; j < 3; j++) + { + if (plane->normal[j] < 0) + { + ofs[j] = maxs[j]; + } + + else + { + ofs[j] = mins[j]; + } + } + + dist = DotProduct(ofs, plane->normal); + dist = plane->dist - dist; + } + + else + { + /* special point case */ + dist = plane->dist; + } + + d1 = DotProduct(p1, plane->normal) - dist; + d2 = DotProduct(p2, plane->normal) - dist; + + if (d2 > 0) + { + getout = true; /* endpoint is not in solid */ + } + + if (d1 > 0) + { + startout = true; + } + + /* if completely in front of face, no intersection */ + if ((d1 > 0) && (d2 >= d1)) + { + return; + } + + if ((d1 <= 0) && (d2 <= 0)) + { + continue; + } + + /* crosses face */ + if (d1 > d2) + { + /* enter */ + f = (d1 - DIST_EPSILON) / (d1 - d2); + + if (f > enterfrac) + { + enterfrac = f; + clipplane = plane; + leadside = side; + } + } + + else + { + /* leave */ + f = (d1 + DIST_EPSILON) / (d1 - d2); + + if (f < leavefrac) + { + leavefrac = f; + } + } + } + + if (!startout) + { + /* original point was inside brush */ + trace->startsolid = true; + + if (!getout) + { + trace->allsolid = true; + } + + return; + } + + if (enterfrac < leavefrac) + { + if ((enterfrac > -1) && (enterfrac < trace->fraction)) + { + if (enterfrac < 0) + { + enterfrac = 0; + } + + if (clipplane == NULL) + { + Com_Error(ERR_FATAL, "clipplane was NULL!\n"); + } + + trace->fraction = enterfrac; + trace->plane = *clipplane; + trace->surface = &(leadside->surface->c); + trace->contents = brush->contents; + } + } +} + +void +CM_TestBoxInBrush(vec3_t mins, vec3_t maxs, vec3_t p1, + trace_t *trace, cbrush_t *brush) +{ + int i, j; + cplane_t *plane; + float dist; + vec3_t ofs; + float d1; + cbrushside_t *side; + + if (!brush->numsides) + { + return; + } + + for (i = 0; i < brush->numsides; i++) + { + side = &map_brushsides[brush->firstbrushside + i]; + plane = side->plane; + + /* general box case + push the plane out + apropriately for mins/maxs */ + for (j = 0; j < 3; j++) + { + if (plane->normal[j] < 0) + { + ofs[j] = maxs[j]; + } + + else + { + ofs[j] = mins[j]; + } + } + + dist = DotProduct(ofs, plane->normal); + dist = plane->dist - dist; + + d1 = DotProduct(p1, plane->normal) - dist; + + /* if completely in front of face, no intersection */ + if (d1 > 0) + { + return; + } + } + + /* inside this brush */ + trace->startsolid = trace->allsolid = true; + trace->fraction = 0; + trace->contents = brush->contents; +} + +void +CM_TraceToLeaf(int leafnum) +{ + int k; + int brushnum; + cleaf_t *leaf; + cbrush_t *b; + + leaf = &map_leafs[leafnum]; + + if (!(leaf->contents & trace_contents)) + { + return; + } + + /* trace line against all brushes in the leaf */ + for (k = 0; k < leaf->numleafbrushes; k++) + { + brushnum = map_leafbrushes[leaf->firstleafbrush + k]; + b = &map_brushes[brushnum]; + + if (b->checkcount == checkcount) + { + continue; /* already checked this brush in another leaf */ + } + + b->checkcount = checkcount; + + if (!(b->contents & trace_contents)) + { + continue; + } + + CM_ClipBoxToBrush(trace_mins, trace_maxs, trace_start, + trace_end, &trace_trace, b); + + if (!trace_trace.fraction) + { + return; + } + } +} + +void +CM_TestInLeaf(int leafnum) +{ + int k; + int brushnum; + cleaf_t *leaf; + cbrush_t *b; + + leaf = &map_leafs[leafnum]; + + if (!(leaf->contents & trace_contents)) + { + return; + } + + /* trace line against all brushes in the leaf */ + for (k = 0; k < leaf->numleafbrushes; k++) + { + brushnum = map_leafbrushes[leaf->firstleafbrush + k]; + b = &map_brushes[brushnum]; + + if (b->checkcount == checkcount) + { + continue; /* already checked this brush in another leaf */ + } + + b->checkcount = checkcount; + + if (!(b->contents & trace_contents)) + { + continue; + } + + CM_TestBoxInBrush(trace_mins, trace_maxs, trace_start, &trace_trace, b); + + if (!trace_trace.fraction) + { + return; + } + } +} + +void +CM_RecursiveHullCheck(int num, float p1f, float p2f, vec3_t p1, vec3_t p2) +{ + cnode_t *node; + cplane_t *plane; + float t1, t2, offset; + float frac, frac2; + float idist; + int i; + vec3_t mid; + int side; + float midf; + + if (trace_trace.fraction <= p1f) + { + return; /* already hit something nearer */ + } + + /* if < 0, we are in a leaf node */ + if (num < 0) + { + CM_TraceToLeaf(-1 - num); + return; + } + + /* find the point distances to the seperating plane + and the offset for the size of the box */ + node = map_nodes + num; + plane = node->plane; + + if (plane->type < 3) + { + t1 = p1[plane->type] - plane->dist; + t2 = p2[plane->type] - plane->dist; + offset = trace_extents[plane->type]; + } + + else + { + t1 = DotProduct(plane->normal, p1) - plane->dist; + t2 = DotProduct(plane->normal, p2) - plane->dist; + + if (trace_ispoint) + { + offset = 0; + } + + else + { + offset = (float)fabs(trace_extents[0] * plane->normal[0]) + + (float)fabs(trace_extents[1] * plane->normal[1]) + + (float)fabs(trace_extents[2] * plane->normal[2]); + } + } + + /* see which sides we need to consider */ + if ((t1 >= offset) && (t2 >= offset)) + { + CM_RecursiveHullCheck(node->children[0], p1f, p2f, p1, p2); + return; + } + + if ((t1 < -offset) && (t2 < -offset)) + { + CM_RecursiveHullCheck(node->children[1], p1f, p2f, p1, p2); + return; + } + + /* put the crosspoint DIST_EPSILON pixels on the near side */ + if (t1 < t2) + { + idist = 1.0f / (t1 - t2); + side = 1; + frac2 = (t1 + offset + DIST_EPSILON) * idist; + frac = (t1 - offset + DIST_EPSILON) * idist; + } + + else if (t1 > t2) + { + idist = 1.0 / (t1 - t2); + side = 0; + frac2 = (t1 - offset - DIST_EPSILON) * idist; + frac = (t1 + offset + DIST_EPSILON) * idist; + } + + else + { + side = 0; + frac = 1; + frac2 = 0; + } + + /* move up to the node */ + if (frac < 0) + { + frac = 0; + } + + if (frac > 1) + { + frac = 1; + } + + midf = p1f + (p2f - p1f) * frac; + + for (i = 0; i < 3; i++) + { + mid[i] = p1[i] + frac * (p2[i] - p1[i]); + } + + CM_RecursiveHullCheck(node->children[side], p1f, midf, p1, mid); + + /* go past the node */ + if (frac2 < 0) + { + frac2 = 0; + } + + if (frac2 > 1) + { + frac2 = 1; + } + + midf = p1f + (p2f - p1f) * frac2; + + for (i = 0; i < 3; i++) + { + mid[i] = p1[i] + frac2 * (p2[i] - p1[i]); + } + + CM_RecursiveHullCheck(node->children[side ^ 1], midf, p2f, mid, p2); +} + +trace_t +CM_BoxTrace(vec3_t start, vec3_t end, vec3_t mins, vec3_t maxs, + int headnode, int brushmask) +{ + int i; + + checkcount++; /* for multi-check avoidance */ + +#ifndef DEDICATED_ONLY + c_traces++; /* for statistics, may be zeroed */ +#endif + + /* fill in a default trace */ + memset(&trace_trace, 0, sizeof(trace_trace)); + trace_trace.fraction = 1; + trace_trace.surface = &(nullsurface.c); + + if (!numnodes) /* map not loaded */ + { + return trace_trace; + } + + trace_contents = brushmask; + VectorCopy(start, trace_start); + VectorCopy(end, trace_end); + VectorCopy(mins, trace_mins); + VectorCopy(maxs, trace_maxs); + + /* check for position test special case */ + if ((start[0] == end[0]) && (start[1] == end[1]) && (start[2] == end[2])) + { + int leafs[1024]; + int i, numleafs; + vec3_t c1, c2; + int topnode; + + VectorAdd(start, mins, c1); + VectorAdd(start, maxs, c2); + + for (i = 0; i < 3; i++) + { + c1[i] -= 1; + c2[i] += 1; + } + + numleafs = CM_BoxLeafnums_headnode(c1, c2, leafs, 1024, + headnode, &topnode); + + for (i = 0; i < numleafs; i++) + { + CM_TestInLeaf(leafs[i]); + + if (trace_trace.allsolid) + { + break; + } + } + + VectorCopy(start, trace_trace.endpos); + return trace_trace; + } + + /* check for point special case */ + if ((mins[0] == 0) && (mins[1] == 0) && (mins[2] == 0) && + (maxs[0] == 0) && (maxs[1] == 0) && (maxs[2] == 0)) + { + trace_ispoint = true; + VectorClear(trace_extents); + } + + else + { + trace_ispoint = false; + trace_extents[0] = -mins[0] > maxs[0] ? -mins[0] : maxs[0]; + trace_extents[1] = -mins[1] > maxs[1] ? -mins[1] : maxs[1]; + trace_extents[2] = -mins[2] > maxs[2] ? -mins[2] : maxs[2]; + } + + /* general sweeping through world */ + CM_RecursiveHullCheck(headnode, 0, 1, start, end); + + if (trace_trace.fraction == 1) + { + VectorCopy(end, trace_trace.endpos); + } + + else + { + for (i = 0; i < 3; i++) + { + trace_trace.endpos[i] = start[i] + trace_trace.fraction * + (end[i] - start[i]); + } + } + + return trace_trace; +} + +/* + * Handles offseting and rotation of the end points for moving and + * rotating entities + */ +trace_t +CM_TransformedBoxTrace(vec3_t start, vec3_t end, vec3_t mins, vec3_t maxs, + int headnode, int brushmask, vec3_t origin, vec3_t angles) +{ + trace_t trace; + vec3_t start_l, end_l; + vec3_t a; + vec3_t forward, right, up; + vec3_t temp; + qboolean rotated; + + /* subtract origin offset */ + VectorSubtract(start, origin, start_l); + VectorSubtract(end, origin, end_l); + + /* rotate start and end into the models frame of reference */ + if ((headnode != box_headnode) && + (angles[0] || angles[1] || angles[2])) + { + rotated = true; + } + + else + { + rotated = false; + } + + if (rotated) + { + AngleVectors(angles, forward, right, up); + + VectorCopy(start_l, temp); + start_l[0] = DotProduct(temp, forward); + start_l[1] = -DotProduct(temp, right); + start_l[2] = DotProduct(temp, up); + + VectorCopy(end_l, temp); + end_l[0] = DotProduct(temp, forward); + end_l[1] = -DotProduct(temp, right); + end_l[2] = DotProduct(temp, up); + } + + /* sweep the box through the model */ + trace = CM_BoxTrace(start_l, end_l, mins, maxs, headnode, brushmask); + + if (rotated && (trace.fraction != 1.0)) + { + VectorNegate(angles, a); + AngleVectors(a, forward, right, up); + + VectorCopy(trace.plane.normal, temp); + trace.plane.normal[0] = DotProduct(temp, forward); + trace.plane.normal[1] = -DotProduct(temp, right); + trace.plane.normal[2] = DotProduct(temp, up); + } + + trace.endpos[0] = start[0] + trace.fraction * (end[0] - start[0]); + trace.endpos[1] = start[1] + trace.fraction * (end[1] - start[1]); + trace.endpos[2] = start[2] + trace.fraction * (end[2] - start[2]); + + return trace; +} + +void +CMod_LoadSubmodels(lump_t *l) +{ + dmodel_t *in; + cmodel_t *out; + int i, j, count; + + in = (void *)(cmod_base + l->fileofs); + + if (l->filelen % sizeof(*in)) + { + Com_Error(ERR_DROP, "MOD_LoadBmodel: funny lump size"); + } + + count = l->filelen / sizeof(*in); + + if (count < 1) + { + Com_Error(ERR_DROP, "Map with no models"); + } + + if (count > MAX_MAP_MODELS) + { + Com_Error(ERR_DROP, "Map has too many models"); + } + + numcmodels = count; + + for (i = 0; i < count; i++, in++, out++) + { + out = &map_cmodels[i]; + + for (j = 0; j < 3; j++) + { + /* spread the mins / maxs by a pixel */ + out->mins[j] = LittleFloat(in->mins[j]) - 1; + out->maxs[j] = LittleFloat(in->maxs[j]) + 1; + out->origin[j] = LittleFloat(in->origin[j]); + } + + out->headnode = LittleLong(in->headnode); + } +} + +void +CMod_LoadSurfaces(lump_t *l) +{ + texinfo_t *in; + mapsurface_t *out; + int i, count; + + in = (void *)(cmod_base + l->fileofs); + + if (l->filelen % sizeof(*in)) + { + Com_Error(ERR_DROP, "MOD_LoadBmodel: funny lump size"); + } + + count = l->filelen / sizeof(*in); + + if (count < 1) + { + Com_Error(ERR_DROP, "Map with no surfaces"); + } + + if (count > MAX_MAP_TEXINFO) + { + Com_Error(ERR_DROP, "Map has too many surfaces"); + } + + numtexinfo = count; + out = map_surfaces; + + for (i = 0; i < count; i++, in++, out++) + { + strncpy(out->c.name, in->texture, sizeof(out->c.name) - 1); + strncpy(out->rname, in->texture, sizeof(out->rname) - 1); + out->c.flags = LittleLong(in->flags); + out->c.value = LittleLong(in->value); + } +} + +void +CMod_LoadNodes(lump_t *l) +{ + dnode_t *in; + int child; + cnode_t *out; + int i, j, count; + + in = (void *)(cmod_base + l->fileofs); + + if (l->filelen % sizeof(*in)) + { + Com_Error(ERR_DROP, "MOD_LoadBmodel: funny lump size"); + } + + count = l->filelen / sizeof(*in); + + if (count < 1) + { + Com_Error(ERR_DROP, "Map has no nodes"); + } + + if (count > MAX_MAP_NODES) + { + Com_Error(ERR_DROP, "Map has too many nodes"); + } + + out = map_nodes; + + numnodes = count; + + for (i = 0; i < count; i++, out++, in++) + { + out->plane = map_planes + LittleLong(in->planenum); + + for (j = 0; j < 2; j++) + { + child = LittleLong(in->children[j]); + out->children[j] = child; + } + } +} + +void +CMod_LoadBrushes(lump_t *l) +{ + dbrush_t *in; + cbrush_t *out; + int i, count; + + in = (void *)(cmod_base + l->fileofs); + + if (l->filelen % sizeof(*in)) + { + Com_Error(ERR_DROP, "MOD_LoadBmodel: funny lump size"); + } + + count = l->filelen / sizeof(*in); + + if (count > MAX_MAP_BRUSHES) + { + Com_Error(ERR_DROP, "Map has too many brushes"); + } + + out = map_brushes; + + numbrushes = count; + + for (i = 0; i < count; i++, out++, in++) + { + out->firstbrushside = LittleLong(in->firstside); + out->numsides = LittleLong(in->numsides); + out->contents = LittleLong(in->contents); + } +} + +void +CMod_LoadLeafs(lump_t *l) +{ + int i; + cleaf_t *out; + dleaf_t *in; + int count; + + in = (void *)(cmod_base + l->fileofs); + + if (l->filelen % sizeof(*in)) + { + Com_Error(ERR_DROP, "MOD_LoadBmodel: funny lump size"); + } + + count = l->filelen / sizeof(*in); + + if (count < 1) + { + Com_Error(ERR_DROP, "Map with no leafs"); + } + + /* need to save space for box planes */ + if (count > MAX_MAP_PLANES) + { + Com_Error(ERR_DROP, "Map has too many planes"); + } + + out = map_leafs; + numleafs = count; + numclusters = 0; + + for (i = 0; i < count; i++, in++, out++) + { + out->contents = LittleLong(in->contents); + out->cluster = LittleShort(in->cluster); + out->area = LittleShort(in->area); + out->firstleafbrush = LittleShort(in->firstleafbrush); + out->numleafbrushes = LittleShort(in->numleafbrushes); + + if (out->cluster >= numclusters) + { + numclusters = out->cluster + 1; + } + } + + if (map_leafs[0].contents != CONTENTS_SOLID) + { + Com_Error(ERR_DROP, "Map leaf 0 is not CONTENTS_SOLID"); + } + + solidleaf = 0; + emptyleaf = -1; + + for (i = 1; i < numleafs; i++) + { + if (!map_leafs[i].contents) + { + emptyleaf = i; + break; + } + } + + if (emptyleaf == -1) + { + Com_Error(ERR_DROP, "Map does not have an empty leaf"); + } +} + +void +CMod_LoadPlanes(lump_t *l) +{ + int i, j; + cplane_t *out; + dplane_t *in; + int count; + int bits; + + in = (void *)(cmod_base + l->fileofs); + + if (l->filelen % sizeof(*in)) + { + Com_Error(ERR_DROP, "MOD_LoadBmodel: funny lump size"); + } + + count = l->filelen / sizeof(*in); + + if (count < 1) + { + Com_Error(ERR_DROP, "Map with no planes"); + } + + /* need to save space for box planes */ + if (count > MAX_MAP_PLANES) + { + Com_Error(ERR_DROP, "Map has too many planes"); + } + + out = map_planes; + numplanes = count; + + for (i = 0; i < count; i++, in++, out++) + { + bits = 0; + + for (j = 0; j < 3; j++) + { + out->normal[j] = LittleFloat(in->normal[j]); + + if (out->normal[j] < 0) + { + bits |= 1 << j; + } + } + + out->dist = LittleFloat(in->dist); + out->type = LittleLong(in->type); + out->signbits = bits; + } +} + +void +CMod_LoadLeafBrushes(lump_t *l) +{ + int i; + unsigned short *out; + unsigned short *in; + int count; + + in = (void *)(cmod_base + l->fileofs); + + if (l->filelen % sizeof(*in)) + { + Com_Error(ERR_DROP, "MOD_LoadBmodel: funny lump size"); + } + + count = l->filelen / sizeof(*in); + + if (count < 1) + { + Com_Error(ERR_DROP, "Map with no planes"); + } + + /* need to save space for box planes */ + if (count > MAX_MAP_LEAFBRUSHES) + { + Com_Error(ERR_DROP, "Map has too many leafbrushes"); + } + + out = map_leafbrushes; + numleafbrushes = count; + + for (i = 0; i < count; i++, in++, out++) + { + *out = LittleShort(*in); + } +} + +void +CMod_LoadBrushSides(lump_t *l) +{ + int i, j; + cbrushside_t *out; + dbrushside_t *in; + int count; + int num; + + in = (void *)(cmod_base + l->fileofs); + + if (l->filelen % sizeof(*in)) + { + Com_Error(ERR_DROP, "MOD_LoadBmodel: funny lump size"); + } + + count = l->filelen / sizeof(*in); + + /* need to save space for box planes */ + if (count > MAX_MAP_BRUSHSIDES) + { + Com_Error(ERR_DROP, "Map has too many planes"); + } + + out = map_brushsides; + numbrushsides = count; + + for (i = 0; i < count; i++, in++, out++) + { + num = LittleShort(in->planenum); + out->plane = &map_planes[num]; + j = LittleShort(in->texinfo); + + if (j >= numtexinfo) + { + Com_Error(ERR_DROP, "Bad brushside texinfo"); + } + + out->surface = &map_surfaces[j]; + } +} + +void +CMod_LoadAreas(lump_t *l) +{ + int i; + carea_t *out; + darea_t *in; + int count; + + in = (void *)(cmod_base + l->fileofs); + + if (l->filelen % sizeof(*in)) + { + Com_Error(ERR_DROP, "MOD_LoadBmodel: funny lump size"); + } + + count = l->filelen / sizeof(*in); + + if (count > MAX_MAP_AREAS) + { + Com_Error(ERR_DROP, "Map has too many areas"); + } + + out = map_areas; + numareas = count; + + for (i = 0; i < count; i++, in++, out++) + { + out->numareaportals = LittleLong(in->numareaportals); + out->firstareaportal = LittleLong(in->firstareaportal); + out->floodvalid = 0; + out->floodnum = 0; + } +} + +void +CMod_LoadAreaPortals(lump_t *l) +{ + dareaportal_t *out; + dareaportal_t *in; + int count; + + in = (void *)(cmod_base + l->fileofs); + + if (l->filelen % sizeof(*in)) + { + Com_Error(ERR_DROP, "MOD_LoadBmodel: funny lump size"); + } + + count = l->filelen / sizeof(*in); + + if (count > MAX_MAP_AREAS) + { + Com_Error(ERR_DROP, "Map has too many areas"); + } + + out = map_areaportals; + numareaportals = count; + + memcpy(out, in, sizeof(dareaportal_t) * count); +} + +void +CMod_LoadVisibility(lump_t *l) +{ + numvisibility = l->filelen; + + if (l->filelen > MAX_MAP_VISIBILITY) + { + Com_Error(ERR_DROP, "Map has too large visibility lump"); + } + + memcpy(map_visibility, cmod_base + l->fileofs, l->filelen); + + map_vis->numclusters = LittleLong(map_vis->numclusters); +} + +void +CMod_LoadEntityString(lump_t *l) +{ + numentitychars = l->filelen; + + if (l->filelen > MAX_MAP_ENTSTRING) + { + Com_Error(ERR_DROP, "Map has too large entity lump"); + } + + memcpy(map_entitystring, cmod_base + l->fileofs, l->filelen); +} + +/* + * Loads in the map and all submodels + */ +cmodel_t * +CM_LoadMap(char *name, qboolean clientload, unsigned *checksum) +{ + unsigned *buf; + int i; + dheader_t header; + int length; + static unsigned last_checksum; + + map_noareas = Cvar_Get("map_noareas", "0", 0); + + if (!strcmp(map_name, + name) && (clientload || !Cvar_VariableValue("flushmap"))) + { + *checksum = last_checksum; + + if (!clientload) + { + memset(portalopen, 0, sizeof(portalopen)); + FloodAreaConnections(); + } + + return &map_cmodels[0]; /* still have the right version */ + } + + /* free old stuff */ + numplanes = 0; + numnodes = 0; + numleafs = 0; + numcmodels = 0; + numvisibility = 0; + numentitychars = 0; + map_entitystring[0] = 0; + map_name[0] = 0; + + if (!name || !name[0]) + { + numleafs = 1; + numclusters = 1; + numareas = 1; + *checksum = 0; + return &map_cmodels[0]; /* cinematic servers won't have anything at all */ + } + + length = FS_LoadFile(name, (void **)&buf); + + if (!buf) + { + Com_Error(ERR_DROP, "Couldn't load %s", name); + } + + last_checksum = LittleLong(Com_BlockChecksum(buf, length)); + *checksum = last_checksum; + + header = *(dheader_t *)buf; + + for (i = 0; i < sizeof(dheader_t) / 4; i++) + { + ((int *)&header)[i] = LittleLong(((int *)&header)[i]); + } + + if (header.version != BSPVERSION) + { + Com_Error(ERR_DROP, + "CMod_LoadBrushModel: %s has wrong version number (%i should be %i)", + name, header.version, BSPVERSION); + } + + cmod_base = (byte *)buf; + + /* load into heap */ + CMod_LoadSurfaces(&header.lumps[LUMP_TEXINFO]); + CMod_LoadLeafs(&header.lumps[LUMP_LEAFS]); + CMod_LoadLeafBrushes(&header.lumps[LUMP_LEAFBRUSHES]); + CMod_LoadPlanes(&header.lumps[LUMP_PLANES]); + CMod_LoadBrushes(&header.lumps[LUMP_BRUSHES]); + CMod_LoadBrushSides(&header.lumps[LUMP_BRUSHSIDES]); + CMod_LoadSubmodels(&header.lumps[LUMP_MODELS]); + CMod_LoadNodes(&header.lumps[LUMP_NODES]); + CMod_LoadAreas(&header.lumps[LUMP_AREAS]); + CMod_LoadAreaPortals(&header.lumps[LUMP_AREAPORTALS]); + CMod_LoadVisibility(&header.lumps[LUMP_VISIBILITY]); + CMod_LoadEntityString(&header.lumps[LUMP_ENTITIES]); + + FS_FreeFile(buf); + + CM_InitBoxHull(); + + memset(portalopen, 0, sizeof(portalopen)); + FloodAreaConnections(); + + strcpy(map_name, name); + + return &map_cmodels[0]; +} + +cmodel_t * +CM_InlineModel(char *name) +{ + int num; + + if (!name || (name[0] != '*')) + { + Com_Error(ERR_DROP, "CM_InlineModel: bad name"); + } + + num = (int)strtol(name + 1, (char **)NULL, 10); + + if ((num < 1) || (num >= numcmodels)) + { + Com_Error(ERR_DROP, "CM_InlineModel: bad number"); + } + + return &map_cmodels[num]; +} + +int +CM_NumClusters(void) +{ + return numclusters; +} + +int +CM_NumInlineModels(void) +{ + return numcmodels; +} + +char * +CM_EntityString(void) +{ + return map_entitystring; +} + +int +CM_LeafContents(int leafnum) +{ + if ((leafnum < 0) || (leafnum >= numleafs)) + { + Com_Error(ERR_DROP, "CM_LeafContents: bad number"); + } + + return map_leafs[leafnum].contents; +} + +int +CM_LeafCluster(int leafnum) +{ + if ((leafnum < 0) || (leafnum >= numleafs)) + { + Com_Error(ERR_DROP, "CM_LeafCluster: bad number"); + } + + return map_leafs[leafnum].cluster; +} + +int +CM_LeafArea(int leafnum) +{ + if ((leafnum < 0) || (leafnum >= numleafs)) + { + Com_Error(ERR_DROP, "CM_LeafArea: bad number"); + } + + return map_leafs[leafnum].area; +} + +void +CM_DecompressVis(byte *in, byte *out) +{ + int c; + byte *out_p; + int row; + + row = (numclusters + 7) >> 3; + out_p = out; + + if (!in || !numvisibility) + { + /* no vis info, so make all visible */ + while (row) + { + *out_p++ = 0xff; + row--; + } + + return; + } + + do + { + if (*in) + { + *out_p++ = *in++; + continue; + } + + c = in[1]; + in += 2; + + if ((out_p - out) + c > row) + { + c = row - (out_p - out); + Com_DPrintf("warning: Vis decompression overrun\n"); + } + + while (c) + { + *out_p++ = 0; + c--; + } + } + while (out_p - out < row); +} + +byte * +CM_ClusterPVS(int cluster) +{ + if (cluster == -1) + { + memset(pvsrow, 0, (numclusters + 7) >> 3); + } + + else + { + CM_DecompressVis(map_visibility + + LittleLong(map_vis->bitofs[cluster][DVIS_PVS]), pvsrow); + } + + return pvsrow; +} + +byte * +CM_ClusterPHS(int cluster) +{ + if (cluster == -1) + { + memset(phsrow, 0, (numclusters + 7) >> 3); + } + + else + { + CM_DecompressVis(map_visibility + + LittleLong(map_vis->bitofs[cluster][DVIS_PHS]), phsrow); + } + + return phsrow; +} + diff --git a/src/common/command/cmd_execution.c b/src/common/command/cmd_execution.c deleted file mode 100644 index 46f54b79..00000000 --- a/src/common/command/cmd_execution.c +++ /dev/null @@ -1,571 +0,0 @@ -/* - * Copyright (C) 1997-2001 Id Software, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - * - * ======================================================================= - * - * This file implements the command execution, e.g. directs the commands - * to the appropriate subsystems. - * - * ======================================================================= - */ - -#include "../header/common.h" -#include "../header/cmd.h" - -typedef struct cmd_function_s -{ - struct cmd_function_s *next; - char *name; - xcommand_t function; -} cmd_function_t; - -static int cmd_argc; -static char *cmd_argv [ MAX_STRING_TOKENS ]; -static char *cmd_null_string = ""; -static char cmd_args [ MAX_STRING_CHARS ]; -char retval [ 256 ]; - -static cmd_function_t *cmd_functions; /* possible commands to execute */ - -int -Cmd_Argc ( void ) -{ - return ( cmd_argc ); -} - -char * -Cmd_Argv ( int arg ) -{ - if ( (unsigned) arg >= cmd_argc ) - { - return ( cmd_null_string ); - } - - return ( cmd_argv [ arg ] ); -} - -/* - * Returns a single string containing argv(1) to argv(argc()-1) - */ -char * -Cmd_Args ( void ) -{ - return ( cmd_args ); -} - -char * -Cmd_MacroExpandString ( char *text ) -{ - int i, j, count, len; - qboolean inquote; - char *scan; - static char expanded [ MAX_STRING_CHARS ]; - char temporary [ MAX_STRING_CHARS ]; - char *token, *start; - - inquote = false; - scan = text; - - len = strlen( scan ); - - if ( len >= MAX_STRING_CHARS ) - { - Com_Printf( "Line exceeded %i chars, discarded.\n", MAX_STRING_CHARS ); - return ( NULL ); - } - - count = 0; - - for ( i = 0; i < len; i++ ) - { - if ( scan [ i ] == '"' ) - { - inquote ^= 1; - } - - if ( inquote ) - { - continue; /* don't expand inside quotes */ - } - - if ( scan [ i ] != '$' ) - { - continue; - } - - /* scan out the complete macro */ - start = scan + i + 1; - token = COM_Parse( &start ); - - if ( !start ) - { - continue; - } - - token = (char *) Cvar_VariableString( token ); - - j = strlen( token ); - len += j; - - if ( len >= MAX_STRING_CHARS ) - { - Com_Printf( "Expanded line exceeded %i chars, discarded.\n", MAX_STRING_CHARS ); - return ( NULL ); - } - - strncpy( temporary, scan, i ); - strcpy( temporary + i, token ); - strcpy( temporary + i + j, start ); - - strcpy( expanded, temporary ); - scan = expanded; - i--; - - if ( ++count == 100 ) - { - Com_Printf( "Macro expansion loop, discarded.\n" ); - return ( NULL ); - } - } - - if ( inquote ) - { - Com_Printf( "Line has unmatched quote, discarded.\n" ); - return ( NULL ); - } - - return ( scan ); -} - -/* - * Parses the given string into command line tokens. - * $Cvars will be expanded unless they are in a quoted token - */ -void -Cmd_TokenizeString ( char *text, qboolean macroExpand ) -{ - int i; - const char *com_token; - - /* clear the args from the last string */ - for ( i = 0; i < cmd_argc; i++ ) - { - Z_Free( cmd_argv [ i ] ); - } - - cmd_argc = 0; - cmd_args [ 0 ] = 0; - - /* macro expand the text */ - if ( macroExpand ) - { - text = Cmd_MacroExpandString( text ); - } - - if ( !text ) - { - return; - } - - while ( 1 ) - { - /* skip whitespace up to a /n */ - while ( *text && *text <= ' ' && *text != '\n' ) - { - text++; - } - - if ( *text == '\n' ) - { - /* a newline seperates commands in the buffer */ - text++; - break; - } - - if ( !*text ) - { - return; - } - - /* set cmd_args to everything after the first arg */ - if ( cmd_argc == 1 ) - { - int l; - - strcpy( cmd_args, text ); - - /* strip off any trailing whitespace */ - l = strlen( cmd_args ) - 1; - - for ( ; l >= 0; l-- ) - { - if ( cmd_args [ l ] <= ' ' ) - { - cmd_args [ l ] = 0; - } - - else - { - break; - } - } - } - - com_token = COM_Parse( &text ); - - if ( !text ) - { - return; - } - - if ( cmd_argc < MAX_STRING_TOKENS ) - { - cmd_argv [ cmd_argc ] = Z_Malloc( strlen( com_token ) + 1 ); - strcpy( cmd_argv [ cmd_argc ], com_token ); - cmd_argc++; - } - } -} - -void -Cmd_AddCommand ( char *cmd_name, xcommand_t function ) -{ - cmd_function_t *cmd; - - /* fail if the command is a variable name */ - if ( Cvar_VariableString( cmd_name ) [ 0 ] ) - { - Cmd_RemoveCommand( cmd_name ); - } - - /* fail if the command already exists */ - for ( cmd = cmd_functions; cmd; cmd = cmd->next ) - { - if ( !strcmp( cmd_name, cmd->name ) ) - { - Com_Printf( "Cmd_AddCommand: %s already defined\n", cmd_name ); - return; - } - } - - cmd = Z_Malloc( sizeof ( cmd_function_t ) ); - cmd->name = cmd_name; - cmd->function = function; - cmd->next = cmd_functions; - cmd_functions = cmd; -} - -void -Cmd_RemoveCommand ( char *cmd_name ) -{ - cmd_function_t *cmd, **back; - - back = &cmd_functions; - - while ( 1 ) - { - cmd = *back; - - if ( !cmd ) - { - Com_Printf( "Cmd_RemoveCommand: %s not added\n", cmd_name ); - return; - } - - if ( !strcmp( cmd_name, cmd->name ) ) - { - *back = cmd->next; - Z_Free( cmd ); - return; - } - - back = &cmd->next; - } -} - -qboolean -Cmd_Exists ( char *cmd_name ) -{ - cmd_function_t *cmd; - - for ( cmd = cmd_functions; cmd; cmd = cmd->next ) - { - if ( !strcmp( cmd_name, cmd->name ) ) - { - return ( true ); - } - } - - return ( false ); -} - -int qsort_strcomp ( const void *s1, const void *s2 ) -{ - return (strcmp(*(char **)s1, *(char **)s2)); -} - -char * -Cmd_CompleteCommand ( char *partial ) -{ - cmd_function_t *cmd; - int len, i, o, p; - cmdalias_t *a; - cvar_t *cvar; - char *pmatch [ 1024 ]; - qboolean diff = false; - - len = strlen( partial ); - - if ( !len ) - { - return ( NULL ); - } - - /* check for exact match */ - for ( cmd = cmd_functions; cmd; cmd = cmd->next ) - { - if ( !strcmp( partial, cmd->name ) ) - { - return ( cmd->name ); - } - } - - for ( a = cmd_alias; a; a = a->next ) - { - if ( !strcmp( partial, a->name ) ) - { - return ( a->name ); - } - } - - for ( cvar = cvar_vars; cvar; cvar = cvar->next ) - { - if ( !strcmp( partial, cvar->name ) ) - { - return ( cvar->name ); - } - } - - for ( i = 0; i < 1024; i++ ) - { - pmatch [ i ] = NULL; - } - - i = 0; - - /* check for partial match */ - for ( cmd = cmd_functions; cmd; cmd = cmd->next ) - { - if ( !strncmp( partial, cmd->name, len ) ) - { - pmatch [ i ] = cmd->name; - i++; - } - } - - for ( a = cmd_alias; a; a = a->next ) - { - if ( !strncmp( partial, a->name, len ) ) - { - pmatch [ i ] = a->name; - i++; - } - } - - for ( cvar = cvar_vars; cvar; cvar = cvar->next ) - { - if ( !strncmp( partial, cvar->name, len ) ) - { - pmatch [ i ] = cvar->name; - i++; - } - } - - if ( i ) - { - if ( i == 1 ) - { - return ( pmatch [ 0 ] ); - } - - /* Sort it */ - qsort(pmatch, i, sizeof(pmatch[0]), qsort_strcomp); - - Com_Printf( "\n\n", partial ); - - for ( o = 0; o < i; o++ ) - { - Com_Printf( " %s\n", pmatch [ o ] ); - } - - strcpy( retval, "" ); - p = 0; - - while ( !diff && p < 256 ) - { - retval [ p ] = pmatch [ 0 ] [ p ]; - - for ( o = 0; o < i; o++ ) - { - if ( p > strlen( pmatch [ o ] ) ) - { - continue; - } - - if ( retval [ p ] != pmatch [ o ] [ p ] ) - { - retval [ p ] = 0; - diff = true; - } - } - - p++; - } - - return ( retval ); - } - - return ( NULL ); -} - -qboolean -Cmd_IsComplete ( char *command ) -{ - cmd_function_t *cmd; - cmdalias_t *a; - cvar_t *cvar; - - /* check for exact match */ - for ( cmd = cmd_functions; cmd; cmd = cmd->next ) - { - if ( !strcmp( command, cmd->name ) ) - { - return ( true ); - } - } - - for ( a = cmd_alias; a; a = a->next ) - { - if ( !strcmp( command, a->name ) ) - { - return ( true ); - } - } - - for ( cvar = cvar_vars; cvar; cvar = cvar->next ) - { - if ( !strcmp( command, cvar->name ) ) - { - return ( true ); - } - } - - return ( false ); -} - -/* - * A complete command line has been parsed, so try to execute it - */ -void -Cmd_ExecuteString ( char *text ) -{ - cmd_function_t *cmd; - cmdalias_t *a; - - Cmd_TokenizeString( text, true ); - - /* execute the command line */ - if ( !Cmd_Argc() ) - { - return; /* no tokens */ - } - - /* check functions */ - for ( cmd = cmd_functions; cmd; cmd = cmd->next ) - { - if ( !Q_strcasecmp( cmd_argv [ 0 ], cmd->name ) ) - { - if ( !cmd->function ) - { - /* forward to server command */ - Cmd_ExecuteString( va( "cmd %s", text ) ); - } - else - { - cmd->function(); - } - - return; - } - } - - /* check alias */ - for ( a = cmd_alias; a; a = a->next ) - { - if ( !Q_strcasecmp( cmd_argv [ 0 ], a->name ) ) - { - if ( ++alias_count == ALIAS_LOOP_COUNT ) - { - Com_Printf( "ALIAS_LOOP_COUNT\n" ); - return; - } - - Cbuf_InsertText( a->value ); - return; - } - } - - /* check cvars */ - if ( Cvar_Command() ) - { - return; - } - -#ifndef DEDICATED_ONLY - /* send it as a server command if we are connected */ - Cmd_ForwardToServer(); -#endif -} - -void -Cmd_List_f ( void ) -{ - cmd_function_t *cmd; - int i; - - i = 0; - - for ( cmd = cmd_functions; cmd; cmd = cmd->next, i++ ) - { - Com_Printf( "%s\n", cmd->name ); - } - - Com_Printf( "%i commands\n", i ); -} - -void -Cmd_Init ( void ) -{ - /* register our commands */ - Cmd_AddCommand( "cmdlist", Cmd_List_f ); - Cmd_AddCommand( "exec", Cmd_Exec_f ); - Cmd_AddCommand( "echo", Cmd_Echo_f ); - Cmd_AddCommand( "alias", Cmd_Alias_f ); - Cmd_AddCommand( "wait", Cmd_Wait_f ); -} diff --git a/src/common/command/cmd_parser.c b/src/common/command/cmd_parser.c deleted file mode 100644 index 7a5e15b5..00000000 --- a/src/common/command/cmd_parser.c +++ /dev/null @@ -1,278 +0,0 @@ -/* - * Copyright (C) 1997-2001 Id Software, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, - * USA. - * - * ======================================================================= - * - * This file implements the main part of the command processor. Every - * command which is send vie the command line at startup, via the - * console and via rcon is processed here and send to the apropriate - * subsystem. - * - * ======================================================================= - */ - -#include "../header/common.h" -#include "../header/cmd.h" - -/* - * Causes execution of the remainder of the command buffer to be delayed - * until next frame. This allows commands like: bind g "impulse 5 ; - * +attack ; wait ; -attack ; impulse 2" - */ -void Cmd_Wait_f (void) { - cmd_wait = true; -} - -/* COMMAND BUFFER */ - -sizebuf_t cmd_text; -byte cmd_text_buf[8192]; - -char defer_text_buf[8192]; - -void Cbuf_Init (void) { - SZ_Init (&cmd_text, cmd_text_buf, sizeof(cmd_text_buf)); -} - -/* - * Adds command text at the end of the buffer - */ -void Cbuf_AddText (char *text) { - int l; - - l = strlen (text); - - if (cmd_text.cursize + l >= cmd_text.maxsize) { - Com_Printf ("Cbuf_AddText: overflow\n"); - return; - } - - SZ_Write (&cmd_text, text, strlen (text)); -} - -/* - * Adds command text immediately after the current command - * Adds a \n to the text - */ -void Cbuf_InsertText (char *text) { - char *temp; - int templen; - - /* copy off any commands still remaining in the exec buffer */ - templen = cmd_text.cursize; - - if (templen) { - temp = Z_Malloc (templen); - memcpy (temp, cmd_text.data, templen); - SZ_Clear (&cmd_text); - - } else - temp = NULL; - - /* add the entire text of the file */ - Cbuf_AddText (text); - - /* add the copied off data */ - if (templen) { - SZ_Write (&cmd_text, temp, templen); - Z_Free (temp); - } -} - -void Cbuf_CopyToDefer (void) { - memcpy(defer_text_buf, cmd_text_buf, cmd_text.cursize); - defer_text_buf[cmd_text.cursize] = 0; - cmd_text.cursize = 0; -} - -void Cbuf_InsertFromDefer (void) { - Cbuf_InsertText (defer_text_buf); - defer_text_buf[0] = 0; -} - -void Cbuf_ExecuteText (int exec_when, char *text) { - switch (exec_when) { - case EXEC_NOW: - Cmd_ExecuteString (text); - break; - case EXEC_INSERT: - Cbuf_InsertText (text); - break; - case EXEC_APPEND: - Cbuf_AddText (text); - break; - default: - Com_Error (ERR_FATAL, "Cbuf_ExecuteText: bad exec_when"); - } -} - -void Cbuf_Execute (void) { - int i; - char *text; - char line[1024]; - int quotes; - - alias_count = 0; /* don't allow infinite alias loops */ - - while (cmd_text.cursize) { - /* find a \n or ; line break */ - text = (char *)cmd_text.data; - - quotes = 0; - - for (i=0 ; i< cmd_text.cursize ; i++) { - if (text[i] == '"') - quotes++; - - if ( !(quotes&1) && text[i] == ';') - break; /* don't break if inside a quoted string */ - - if (text[i] == '\n') - break; - } - - if( i > sizeof( line ) - 1 ) { - i = sizeof( line ) - 1; - } - - memcpy (line, text, i); - line[i] = 0; - - /* delete the text from the command buffer and move remaining - commands down this is necessary because commands (exec, - alias) can insert data at the beginning of the text buffer */ - if (i == cmd_text.cursize) - cmd_text.cursize = 0; - - else { - i++; - cmd_text.cursize -= i; - memmove (text, text+i, cmd_text.cursize); - } - - /* execute the command line */ - Cmd_ExecuteString (line); - - if (cmd_wait) { - /* skip out while text still remains in buffer, - leaving it for next frame */ - cmd_wait = false; - break; - } - } -} - -/* - * Adds command line parameters as script statements Commands lead with - * a +, and continue until another + - * - * Set commands are added early, so they are guaranteed to be set before - * the client and server initialize for the first time. - * - * Other commands are added late, after all initialization is complete. - */ -void Cbuf_AddEarlyCommands (qboolean clear) { - int i; - char *s; - - for (i=0 ; i : execute a script file\n"); - return; - } - - len = FS_LoadFile (Cmd_Argv(1), (void **)&f); - - if (!f) { - Com_Printf ("couldn't exec %s\n",Cmd_Argv(1)); - return; - } - - Com_Printf ("execing %s\n",Cmd_Argv(1)); - - /* the file doesn't have a trailing 0, so we need to copy it off */ - f2 = Z_Malloc(len+1); - memcpy (f2, f, len); - f2[len] = 0; - - Cbuf_InsertText (f2); - - Z_Free (f2); - FS_FreeFile (f); -} - -/* - * Just prints the rest of the line to the console - */ -void Cmd_Echo_f (void) { - int i; - - for (i=1 ; inext) - Com_Printf ("%s : %s\n", a->name, a->value); - - return; - } - - s = Cmd_Argv(1); - - if (strlen(s) >= MAX_ALIAS_NAME) { - Com_Printf ("Alias name is too long\n"); - return; - } - - /* if the alias already exists, reuse it */ - for (a = cmd_alias ; a ; a=a->next) { - if (!strcmp(s, a->name)) { - Z_Free (a->value); - break; - } - } - - if (!a) { - a = Z_Malloc (sizeof(cmdalias_t)); - a->next = cmd_alias; - cmd_alias = a; - } - - strcpy (a->name, s); - - /* copy the rest of the command line */ - cmd[0] = 0; /* start out with a null string */ - c = Cmd_Argc(); - - for (i=2 ; i< c ; i++) { - strcat (cmd, Cmd_Argv(i)); - - if (i != (c - 1)) - strcat (cmd, " "); - } - - strcat (cmd, "\n"); - - a->value = CopyString (cmd); -} diff --git a/src/common/crc.c b/src/common/crc.c index 27572a14..09800a4a 100644 --- a/src/common/crc.c +++ b/src/common/crc.c @@ -28,68 +28,74 @@ #include "header/common.h" -#define CRC_INIT_VALUE 0xffff -#define CRC_XOR_VALUE 0x0000 +#define CRC_INIT_VALUE 0xffff +#define CRC_XOR_VALUE 0x0000 -static unsigned short crctable[256] = -{ - 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, - 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, - 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, - 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de, - 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485, - 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, - 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4, - 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, - 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823, - 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b, - 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12, - 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a, - 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41, - 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49, - 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, - 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, - 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f, - 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067, - 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e, - 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256, - 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d, - 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, - 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c, - 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, - 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, - 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3, - 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, - 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92, - 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9, - 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, - 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8, - 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0 +static unsigned short crctable[256] = { + 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, + 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, + 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, + 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de, + 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485, + 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, + 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4, + 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, + 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823, + 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b, + 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12, + 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a, + 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41, + 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49, + 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, + 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, + 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f, + 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067, + 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e, + 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256, + 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d, + 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, + 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c, + 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, + 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, + 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3, + 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, + 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92, + 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9, + 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, + 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8, + 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0 }; -void CRC_Init(unsigned short *crcvalue) +void +CRC_Init(unsigned short *crcvalue) { *crcvalue = CRC_INIT_VALUE; } -void CRC_ProcessByte(unsigned short *crcvalue, byte data) +void +CRC_ProcessByte(unsigned short *crcvalue, byte data) { *crcvalue = (*crcvalue << 8) ^ crctable[(*crcvalue >> 8) ^ data]; } -unsigned short CRC_Value(unsigned short crcvalue) +unsigned short +CRC_Value(unsigned short crcvalue) { return crcvalue ^ CRC_XOR_VALUE; } -unsigned short CRC_Block (byte *start, int count) +unsigned short +CRC_Block(byte *start, int count) { - unsigned short crc; + unsigned short crc; - CRC_Init (&crc); + CRC_Init(&crc); while (count--) + { crc = (crc << 8) ^ crctable[(crc >> 8) ^ *start++]; + } return crc; } + diff --git a/src/common/cvar.c b/src/common/cvar.c index 874ce843..cef412b8 100644 --- a/src/common/cvar.c +++ b/src/common/cvar.c @@ -19,83 +19,112 @@ * * ======================================================================= * - * The Quake II CVAR subsystem. Implements dynamic variable tracking. + * The Quake II CVAR subsystem. Implements dynamic variable handling. * * ======================================================================= */ #include "header/common.h" -cvar_t *cvar_vars; +cvar_t *cvar_vars; -static qboolean Cvar_InfoValidate (char *s) +static qboolean +Cvar_InfoValidate(char *s) { - if (strstr (s, "\\")) + if (strstr(s, "\\")) + { return false; + } - if (strstr (s, "\"")) + if (strstr(s, "\"")) + { return false; + } - if (strstr (s, ";")) + if (strstr(s, ";")) + { return false; + } return true; } -static cvar_t *Cvar_FindVar (const char *var_name) +static cvar_t * +Cvar_FindVar(const char *var_name) { - cvar_t *var; + cvar_t *var; - for (var=cvar_vars ; var ; var=var->next) - if (!strcmp (var_name, var->name)) + for (var = cvar_vars; var; var = var->next) + { + if (!strcmp(var_name, var->name)) + { return var; + } + } return NULL; } -float Cvar_VariableValue (char *var_name) +float +Cvar_VariableValue(char *var_name) { - cvar_t *var; + cvar_t *var; - var = Cvar_FindVar (var_name); + var = Cvar_FindVar(var_name); if (!var) + { return 0; + } return strtod(var->string, (char **)NULL); } -const char *Cvar_VariableString (const char *var_name) +const char * +Cvar_VariableString(const char *var_name) { cvar_t *var; - var = Cvar_FindVar (var_name); + var = Cvar_FindVar(var_name); if (!var) + { return ""; + } return var->string; } -char *Cvar_CompleteVariable (char *partial) +char * +Cvar_CompleteVariable(char *partial) { - cvar_t *cvar; - int len; + cvar_t *cvar; + int len; len = (int)strlen(partial); if (!len) + { return NULL; + } /* check exact match */ - for (cvar=cvar_vars ; cvar ; cvar=cvar->next) - if (!strcmp (partial,cvar->name)) + for (cvar = cvar_vars; cvar; cvar = cvar->next) + { + if (!strcmp(partial, cvar->name)) + { return cvar->name; + } + } /* check partial match */ - for (cvar=cvar_vars ; cvar ; cvar=cvar->next) - if (!strncmp (partial,cvar->name, len)) + for (cvar = cvar_vars; cvar; cvar = cvar->next) + { + if (!strncmp(partial, cvar->name, len)) + { return cvar->name; + } + } return NULL; } @@ -104,20 +133,21 @@ char *Cvar_CompleteVariable (char *partial) * If the variable already exists, the value will not be set * The flags will be or'ed in if the variable exists. */ -cvar_t *Cvar_Get (char *var_name, char *var_value, int flags) +cvar_t * +Cvar_Get(char *var_name, char *var_value, int flags) { - cvar_t *var; + cvar_t *var; if (flags & (CVAR_USERINFO | CVAR_SERVERINFO)) { - if (!Cvar_InfoValidate (var_name)) + if (!Cvar_InfoValidate(var_name)) { Com_Printf("invalid info cvar name\n"); return NULL; } } - var = Cvar_FindVar (var_name); + var = Cvar_FindVar(var_name); if (var) { @@ -126,20 +156,22 @@ cvar_t *Cvar_Get (char *var_name, char *var_value, int flags) } if (!var_value) + { return NULL; + } if (flags & (CVAR_USERINFO | CVAR_SERVERINFO)) { - if (!Cvar_InfoValidate (var_value)) + if (!Cvar_InfoValidate(var_value)) { Com_Printf("invalid info cvar value\n"); return NULL; } } - var = Z_Malloc (sizeof(*var)); - var->name = CopyString (var_name); - var->string = CopyString (var_value); + var = Z_Malloc(sizeof(*var)); + var->name = CopyString(var_name); + var->string = CopyString(var_value); var->modified = true; var->value = strtod(var->string, (char **)NULL); @@ -152,20 +184,21 @@ cvar_t *Cvar_Get (char *var_name, char *var_value, int flags) return var; } -cvar_t *Cvar_Set2 (char *var_name, char *value, qboolean force) +cvar_t * +Cvar_Set2(char *var_name, char *value, qboolean force) { - cvar_t *var; + cvar_t *var; - var = Cvar_FindVar (var_name); + var = Cvar_FindVar(var_name); if (!var) { - return Cvar_Get (var_name, value, 0); + return Cvar_Get(var_name, value, 0); } if (var->flags & (CVAR_USERINFO | CVAR_SERVERINFO)) { - if (!Cvar_InfoValidate (value)) + if (!Cvar_InfoValidate(value)) { Com_Printf("invalid info cvar value\n"); return var; @@ -176,7 +209,7 @@ cvar_t *Cvar_Set2 (char *var_name, char *value, qboolean force) { if (var->flags & CVAR_NOSET) { - Com_Printf ("%s is write protected.\n", var_name); + Com_Printf("%s is write protected.\n", var_name); return var; } @@ -185,20 +218,24 @@ cvar_t *Cvar_Set2 (char *var_name, char *value, qboolean force) if (var->latched_string) { if (strcmp(value, var->latched_string) == 0) + { return var; + } - Z_Free (var->latched_string); + Z_Free(var->latched_string); } else { if (strcmp(value, var->string) == 0) + { return var; + } } if (Com_ServerState()) { - Com_Printf ("%s will be changed for next game.\n", var_name); + Com_Printf("%s will be changed for next game.\n", var_name); var->latched_string = CopyString(value); } @@ -209,8 +246,8 @@ cvar_t *Cvar_Set2 (char *var_name, char *value, qboolean force) if (!strcmp(var->name, "game")) { - FS_SetGamedir (var->string); - FS_ExecAutoexec (); + FS_SetGamedir(var->string); + FS_ExecAutoexec(); } } @@ -222,20 +259,24 @@ cvar_t *Cvar_Set2 (char *var_name, char *value, qboolean force) { if (var->latched_string) { - Z_Free (var->latched_string); + Z_Free(var->latched_string); var->latched_string = NULL; } } if (!strcmp(value, var->string)) + { return var; + } var->modified = true; if (var->flags & CVAR_USERINFO) + { userinfo_modified = true; + } - Z_Free (var->string); + Z_Free(var->string); var->string = CopyString(value); var->value = strtod(var->string, (char **)NULL); @@ -243,33 +284,38 @@ cvar_t *Cvar_Set2 (char *var_name, char *value, qboolean force) return var; } -cvar_t *Cvar_ForceSet (char *var_name, char *value) +cvar_t * +Cvar_ForceSet(char *var_name, char *value) { - return Cvar_Set2 (var_name, value, true); + return Cvar_Set2(var_name, value, true); } -cvar_t *Cvar_Set (char *var_name, char *value) +cvar_t * +Cvar_Set(char *var_name, char *value) { - return Cvar_Set2 (var_name, value, false); + return Cvar_Set2(var_name, value, false); } -cvar_t *Cvar_FullSet (char *var_name, char *value, int flags) +cvar_t * +Cvar_FullSet(char *var_name, char *value, int flags) { - cvar_t *var; + cvar_t *var; - var = Cvar_FindVar (var_name); + var = Cvar_FindVar(var_name); if (!var) { - return Cvar_Get (var_name, value, flags); + return Cvar_Get(var_name, value, flags); } var->modified = true; if (var->flags & CVAR_USERINFO) + { userinfo_modified = true; + } - Z_Free (var->string); + Z_Free(var->string); var->string = CopyString(value); var->value = (float)strtod(var->string, (char **)NULL); @@ -279,40 +325,48 @@ cvar_t *Cvar_FullSet (char *var_name, char *value, int flags) return var; } -void Cvar_SetValue (char *var_name, float value) +void +Cvar_SetValue(char *var_name, float value) { - char val[32]; + char val[32]; if (value == (int)value) - Com_sprintf (val, sizeof(val), "%i",(int)value); + { + Com_sprintf(val, sizeof(val), "%i", (int)value); + } else - Com_sprintf (val, sizeof(val), "%f",value); + { + Com_sprintf(val, sizeof(val), "%f", value); + } - Cvar_Set (var_name, val); + Cvar_Set(var_name, val); } /* * Any variables with latched values will now be updated */ -void Cvar_GetLatchedVars (void) +void +Cvar_GetLatchedVars(void) { - cvar_t *var; + cvar_t *var; - for (var = cvar_vars ; var ; var = var->next) + for (var = cvar_vars; var; var = var->next) { if (!var->latched_string) + { continue; + } - Z_Free (var->string); + Z_Free(var->string); var->string = var->latched_string; var->latched_string = NULL; var->value = strtod(var->string, (char **)NULL); if (!strcmp(var->name, "game")) { - FS_SetGamedir (var->string); - FS_ExecAutoexec (); + FS_SetGamedir(var->string); + FS_ExecAutoexec(); } } } @@ -320,143 +374,177 @@ void Cvar_GetLatchedVars (void) /* * Handles variable inspection and changing from the console */ -qboolean Cvar_Command (void) +qboolean +Cvar_Command(void) { - cvar_t *v; + cvar_t *v; /* check variables */ - v = Cvar_FindVar (Cmd_Argv(0)); + v = Cvar_FindVar(Cmd_Argv(0)); if (!v) + { return false; + } /* perform a variable print or set */ if (Cmd_Argc() == 1) { - Com_Printf ("\"%s\" is \"%s\"\n", v->name, v->string); + Com_Printf("\"%s\" is \"%s\"\n", v->name, v->string); return true; } - Cvar_Set (v->name, Cmd_Argv(1)); + Cvar_Set(v->name, Cmd_Argv(1)); return true; } /* * Allows setting and defining of arbitrary cvars from console */ -void Cvar_Set_f (void) +void +Cvar_Set_f(void) { - int c; - int flags; + int c; + int flags; c = Cmd_Argc(); - if (c != 3 && c != 4) + if ((c != 3) && (c != 4)) { - Com_Printf ("usage: set [u / s]\n"); + Com_Printf("usage: set [u / s]\n"); return; } if (c == 4) { if (!strcmp(Cmd_Argv(3), "u")) + { flags = CVAR_USERINFO; + } else if (!strcmp(Cmd_Argv(3), "s")) + { flags = CVAR_SERVERINFO; + } else { - Com_Printf ("flags can only be 'u' or 's'\n"); + Com_Printf("flags can only be 'u' or 's'\n"); return; } - Cvar_FullSet (Cmd_Argv(1), Cmd_Argv(2), flags); + Cvar_FullSet(Cmd_Argv(1), Cmd_Argv(2), flags); } else - Cvar_Set (Cmd_Argv(1), Cmd_Argv(2)); + { + Cvar_Set(Cmd_Argv(1), Cmd_Argv(2)); + } } /* * Appends lines containing "set variable value" for all variables * with the archive flag set to true. */ -void Cvar_WriteVariables (char *path) +void +Cvar_WriteVariables(char *path) { - cvar_t *var; - char buffer[1024]; - FILE *f; + cvar_t *var; + char buffer[1024]; + FILE *f; - f = fopen (path, "a"); + f = fopen(path, "a"); - for (var = cvar_vars ; var ; var = var->next) + for (var = cvar_vars; var; var = var->next) { if (var->flags & CVAR_ARCHIVE) { - Com_sprintf (buffer, sizeof(buffer), "set %s \"%s\"\n", var->name, var->string); - fprintf (f, "%s", buffer); + Com_sprintf(buffer, sizeof(buffer), "set %s \"%s\"\n", + var->name, var->string); + fprintf(f, "%s", buffer); } } - fclose (f); + fclose(f); } -void Cvar_List_f (void) +void +Cvar_List_f(void) { - cvar_t *var; - int i; + cvar_t *var; + int i; i = 0; - for (var = cvar_vars ; var ; var = var->next, i++) + for (var = cvar_vars; var; var = var->next, i++) { if (var->flags & CVAR_ARCHIVE) - Com_Printf ("*"); + { + Com_Printf("*"); + } else - Com_Printf (" "); + { + Com_Printf(" "); + } if (var->flags & CVAR_USERINFO) - Com_Printf ("U"); + { + Com_Printf("U"); + } else - Com_Printf (" "); + { + Com_Printf(" "); + } if (var->flags & CVAR_SERVERINFO) - Com_Printf ("S"); + { + Com_Printf("S"); + } else - Com_Printf (" "); + { + Com_Printf(" "); + } if (var->flags & CVAR_NOSET) - Com_Printf ("-"); + { + Com_Printf("-"); + } else if (var->flags & CVAR_LATCH) - Com_Printf ("L"); + { + Com_Printf("L"); + } else - Com_Printf (" "); + { + Com_Printf(" "); + } - Com_Printf (" %s \"%s\"\n", var->name, var->string); + Com_Printf(" %s \"%s\"\n", var->name, var->string); } - Com_Printf ("%i cvars\n", i); + Com_Printf("%i cvars\n", i); } qboolean userinfo_modified; -char *Cvar_BitInfo (int bit) +char * +Cvar_BitInfo(int bit) { - static char info[MAX_INFO_STRING]; - cvar_t *var; + static char info[MAX_INFO_STRING]; + cvar_t *var; info[0] = 0; - for (var = cvar_vars ; var ; var = var->next) + for (var = cvar_vars; var; var = var->next) { if (var->flags & bit) - Info_SetValueForKey (info, var->name, var->string); + { + Info_SetValueForKey(info, var->name, var->string); + } } return info; @@ -466,26 +554,29 @@ char *Cvar_BitInfo (int bit) * returns an info string containing * all the CVAR_USERINFO cvars */ -char *Cvar_Userinfo (void) +char * +Cvar_Userinfo(void) { - return Cvar_BitInfo (CVAR_USERINFO); + return Cvar_BitInfo(CVAR_USERINFO); } /* * returns an info string containing * all the CVAR_SERVERINFO cvars */ -char *Cvar_Serverinfo (void) +char * +Cvar_Serverinfo(void) { - return Cvar_BitInfo (CVAR_SERVERINFO); + return Cvar_BitInfo(CVAR_SERVERINFO); } /* * Reads in all archived cvars */ -void Cvar_Init (void) +void +Cvar_Init(void) { - Cmd_AddCommand ("set", Cvar_Set_f); - Cmd_AddCommand ("cvarlist", Cvar_List_f); - + Cmd_AddCommand("set", Cvar_Set_f); + Cmd_AddCommand("cvarlist", Cvar_List_f); } + diff --git a/src/common/filesystem.c b/src/common/filesystem.c index 8cc52464..ecbe884b 100644 --- a/src/common/filesystem.c +++ b/src/common/filesystem.c @@ -29,14 +29,14 @@ #include "../common/header/glob.h" #ifdef ZIP -#include "unzip/unzip.h" + #include "unzip/unzip.h" #endif -#define MAX_HANDLES 512 -#define MAX_READ 0x10000 -#define MAX_WRITE 0x10000 -#define MAX_FIND_FILES 0x04000 -#define MAX_PAKS 100 +#define MAX_HANDLES 512 +#define MAX_READ 0x10000 +#define MAX_WRITE 0x10000 +#define MAX_FIND_FILES 0x04000 +#define MAX_PAKS 100 #ifdef SYSTEMWIDE #ifndef SYSTEMDIR @@ -46,38 +46,38 @@ typedef struct { - char name[MAX_QPATH]; - fsMode_t mode; - FILE *file; /* Only one will be used. */ + char name[MAX_QPATH]; + fsMode_t mode; + FILE *file; /* Only one will be used. */ #ifdef ZIP - unzFile *zip; /* (file or zip) */ + unzFile *zip; /* (file or zip) */ #endif } fsHandle_t; typedef struct fsLink_s { - char *from; - char *to; - int length; + char *from; + char *to; + int length; struct fsLink_s *next; } fsLink_t; typedef struct { - char name[MAX_QPATH]; - int size; - int offset; /* Ignored in PK3 files. */ + char name[MAX_QPATH]; + int size; + int offset; /* Ignored in PK3 files. */ } fsPackFile_t; typedef struct { - char name[MAX_OSPATH]; - int numFiles; - FILE *pak; + char name[MAX_OSPATH]; + int numFiles; + FILE *pak; #ifdef ZIP - unzFile *pk3; + unzFile *pk3; #endif - fsPackFile_t *files; + fsPackFile_t *files; } fsPack_t; typedef struct fsSearchPath_s @@ -97,18 +97,17 @@ typedef enum typedef struct { - char *suffix; - fsPackFormat_t format; + char *suffix; + fsPackFormat_t format; } fsPackTypes_t; -fsHandle_t fs_handles[MAX_HANDLES]; -fsLink_t *fs_links; +fsHandle_t fs_handles[MAX_HANDLES]; +fsLink_t *fs_links; fsSearchPath_t *fs_searchPaths; fsSearchPath_t *fs_baseSearchPaths; /* Pack formats / suffixes. */ -fsPackTypes_t fs_packtypes[] = -{ +fsPackTypes_t fs_packtypes[] = { {"pak", PAK}, #ifdef ZIP {"pk2", PK3}, @@ -117,27 +116,27 @@ fsPackTypes_t fs_packtypes[] = #endif }; -char fs_gamedir[MAX_OSPATH]; -static char fs_currentGame[MAX_QPATH]; +char fs_gamedir[MAX_OSPATH]; +static char fs_currentGame[MAX_QPATH]; -static char fs_fileInPath[MAX_OSPATH]; -static qboolean fs_fileInPack; +static char fs_fileInPath[MAX_OSPATH]; +static qboolean fs_fileInPack; /* Set by FS_FOpenFile. */ -int file_from_pak = 0; +int file_from_pak = 0; #ifdef ZIP -int file_from_pk3 = 0; -char file_from_pk3_name[MAX_QPATH]; +int file_from_pk3 = 0; +char file_from_pk3_name[MAX_QPATH]; #endif -cvar_t *fs_homepath; -cvar_t *fs_basedir; -cvar_t *fs_cddir; -cvar_t *fs_gamedirvar; -cvar_t *fs_debug; +cvar_t *fs_homepath; +cvar_t *fs_basedir; +cvar_t *fs_cddir; +cvar_t *fs_gamedirvar; +cvar_t *fs_debug; -fsHandle_t *FS_GetFileByHandle(fileHandle_t f); -char *Sys_GetCurrentDirectory(void); +fsHandle_t *FS_GetFileByHandle(fileHandle_t f); +char *Sys_GetCurrentDirectory(void); /* * All of Quake's data access is through a hierchal file system, but the @@ -176,30 +175,30 @@ Com_FilePath(const char *path, char *dst, int dstSize) memcpy(dst, path, pos - path); dst[pos - path] = '\0'; } - else { Com_Printf("Com_FilePath: not enough space.\n"); return; } } - else + { strncpy(dst, path, dstSize); + } } int -FS_FileLength(FILE * f) +FS_FileLength(FILE *f) { - int pos; /* Current position. */ - int end; /* End of file. */ + int pos; /* Current position. */ + int end; /* End of file. */ pos = ftell(f); fseek(f, 0, SEEK_END); end = ftell(f); fseek(f, pos, SEEK_SET); - return (end); + return end; } /* @@ -208,8 +207,8 @@ FS_FileLength(FILE * f) void FS_CreatePath(char *path) { - char *cur; /* Current '/'. */ - char *old; /* Old '/'. */ + char *cur; /* Current '/'. */ + char *old; /* Old '/'. */ FS_DPrintf("FS_CreatePath(%s)\n", path); @@ -232,17 +231,19 @@ FS_CreatePath(char *path) old = cur; cur = strchr(old + 1, '/'); - } + } } void -FS_DPrintf(const char *format,...) +FS_DPrintf(const char *format, ...) { - char msg[1024]; - va_list argPtr; + char msg[1024]; + va_list argPtr; if (fs_debug->value != 1) + { return; + } va_start(argPtr, format); vsnprintf(msg, sizeof(msg), format, argPtr); @@ -254,59 +255,63 @@ FS_DPrintf(const char *format,...) char * FS_Gamedir(void) { - return (fs_gamedir); + return fs_gamedir; } /* * Returns a FILE * for a fileHandle_t. */ -FILE * +FILE * FS_FileForHandle(fileHandle_t f) { - fsHandle_t *handle; + fsHandle_t *handle; handle = FS_GetFileByHandle(f); #ifdef ZIP if (handle->zip != NULL) + { Com_Error(ERR_DROP, "FS_FileForHandle: can't get FILE on zip file"); + } #endif if (handle->file == NULL) + { Com_Error(ERR_DROP, "FS_FileForHandle: NULL"); + } - return (handle->file); + return handle->file; } /* * Finds a free fileHandle_t. */ fsHandle_t * -FS_HandleForFile(const char *path, fileHandle_t * f) +FS_HandleForFile(const char *path, fileHandle_t *f) { - int i; - fsHandle_t *handle; + int i; + fsHandle_t *handle; handle = fs_handles; for (i = 0; i < MAX_HANDLES; i++, handle++) { - if (handle->file == NULL + if ((handle->file == NULL) #ifdef ZIP - && handle->zip == NULL + && (handle->zip == NULL) #endif - ) + ) { strncpy(handle->name, path, sizeof(handle->name)); *f = i + 1; - return (handle); + return handle; } } /* Failed. */ Com_Error(ERR_DROP, "FS_HandleForFile: none free"); - return (NULL); + return NULL; } /* @@ -315,24 +320,26 @@ FS_HandleForFile(const char *path, fileHandle_t * f) fsHandle_t * FS_GetFileByHandle(fileHandle_t f) { - if (f < 0 || f > MAX_HANDLES) + if ((f < 0) || (f > MAX_HANDLES)) { Com_Error(ERR_DROP, "FS_GetFileByHandle: out of range"); } if (f == 0) + { f++; + } - return (&fs_handles[f - 1]); + return &fs_handles[f - 1]; } /* * Returns file size or -1 on error. */ int -FS_FOpenFileAppend(fsHandle_t * handle) +FS_FOpenFileAppend(fsHandle_t *handle) { - char path[MAX_OSPATH]; + char path[MAX_OSPATH]; FS_CreatePath(handle->name); @@ -343,24 +350,28 @@ FS_FOpenFileAppend(fsHandle_t * handle) if (handle->file) { if (fs_debug->value) + { Com_Printf("FS_FOpenFileAppend: '%s'.\n", path); + } - return (FS_FileLength(handle->file)); + return FS_FileLength(handle->file); } if (fs_debug->value) + { Com_Printf("FS_FOpenFileAppend: couldn't open '%s'.\n", path); + } - return (-1); + return -1; } /* * Always returns 0 or -1 on error. */ int -FS_FOpenFileWrite(fsHandle_t * handle) +FS_FOpenFileWrite(fsHandle_t *handle) { - char path[MAX_OSPATH]; + char path[MAX_OSPATH]; FS_CreatePath(handle->name); @@ -369,15 +380,19 @@ FS_FOpenFileWrite(fsHandle_t * handle) if ((handle->file = fopen(path, "w")) == NULL) { if (fs_debug->value) + { Com_Printf("FS_FOpenFileWrite: '%s'.\n", path); + } - return (0); + return 0; } if (fs_debug->value) + { Com_Printf("FS_FOpenFileWrite: couldn't open '%s'.\n", path); + } - return (-1); + return -1; } /* @@ -385,12 +400,12 @@ FS_FOpenFileWrite(fsHandle_t * handle) * files inside pack files (both PAK and PK3). */ int -FS_FOpenFileRead(fsHandle_t * handle) +FS_FOpenFileRead(fsHandle_t *handle) { - char path[MAX_OSPATH]; - int i; + char path[MAX_OSPATH]; + int i; fsSearchPath_t *search; - fsPack_t *pack; + fsPack_t *pack; file_from_pak = 0; #ifdef ZIP @@ -410,12 +425,15 @@ FS_FOpenFileRead(fsHandle_t * handle) if (Q_stricmp(pack->files[i].name, handle->name) == 0) { /* Found it! */ - Com_FilePath(pack->name, fs_fileInPath, sizeof(fs_fileInPath)); + Com_FilePath(pack->name, fs_fileInPath, + sizeof(fs_fileInPath)); fs_fileInPack = true; if (fs_debug->value) + { Com_Printf("FS_FOpenFileRead: '%s' (found in '%s').\n", - handle->name, pack->name); + handle->name, pack->name); + } if (pack->pak) { @@ -426,24 +444,27 @@ FS_FOpenFileRead(fsHandle_t * handle) if (handle->file) { fseek(handle->file, pack->files[i].offset, SEEK_SET); - return (pack->files[i].size); + return pack->files[i].size; } } - #ifdef ZIP else if (pack->pk3) { /* PK3 */ file_from_pk3 = 1; - strncpy(file_from_pk3_name, strrchr(pack->name, '/') + 1, sizeof(file_from_pk3_name)); + strncpy(file_from_pk3_name, strrchr(pack->name, + '/') + 1, sizeof(file_from_pk3_name)); handle->zip = unzOpen(pack->name); if (handle->zip) { - if (unzLocateFile(handle->zip, handle->name, 2) == UNZ_OK) + if (unzLocateFile(handle->zip, handle->name, + 2) == UNZ_OK) { if (unzOpenCurrentFile(handle->zip) == UNZ_OK) - return (pack->files[i].size); + { + return pack->files[i].size; + } } unzClose(handle->zip); @@ -455,7 +476,6 @@ FS_FOpenFileRead(fsHandle_t * handle) } } } - else { /* Search in a directory tree. */ @@ -470,7 +490,9 @@ FS_FOpenFileRead(fsHandle_t * handle) } if (!handle->file) + { continue; + } if (handle->file) { @@ -479,8 +501,10 @@ FS_FOpenFileRead(fsHandle_t * handle) fs_fileInPack = false; if (fs_debug->value) + { Com_Printf("FS_FOpenFileRead: '%s' (found in '%s').\n", - handle->name, search->path); + handle->name, search->path); + } return FS_FileLength(handle->file); } @@ -492,9 +516,11 @@ FS_FOpenFileRead(fsHandle_t * handle) fs_fileInPack = false; if (fs_debug->value) + { Com_Printf("FS_FOpenFileRead: couldn't find '%s'.\n", handle->name); + } - return (-1); + return -1; } /* @@ -503,13 +529,14 @@ FS_FOpenFileRead(fsHandle_t * handle) void FS_FCloseFile(fileHandle_t f) { - fsHandle_t *handle; + fsHandle_t *handle; handle = FS_GetFileByHandle(f); if (handle->file) + { fclose(handle->file); - + } #ifdef ZIP else if (handle->zip) { @@ -529,13 +556,17 @@ Developer_searchpath(int who) for (search = fs_searchPaths; search; search = search->next) { if (strstr(search->path, "xatrix")) - return (1); + { + return 1; + } if (strstr(search->path, "rogue")) - return (2); + { + return 2; + } } - return (0); + return 0; } qboolean @@ -546,10 +577,12 @@ modType(char *name) for (search = fs_searchPaths; search; search = search->next) { if (strstr(search->path, name)) + { return true; + } } - return (0); + return 0; } /* @@ -557,10 +590,10 @@ modType(char *name) * for streaming data out of either a pak file or a seperate file. */ int -FS_FOpenFile(const char *name, fileHandle_t * f, fsMode_t mode) +FS_FOpenFile(const char *name, fileHandle_t *f, fsMode_t mode) { - int size = 0; - fsHandle_t *handle; + int size = 0; + fsHandle_t *handle; handle = FS_HandleForFile(name, f); @@ -584,13 +617,15 @@ FS_FOpenFile(const char *name, fileHandle_t * f, fsMode_t mode) } if (size != -1) - return (size); + { + return size; + } /* Couldn't open, so free the handle. */ memset(handle, 0, sizeof(*handle)); *f = 0; - return (-1); + return -1; } /* @@ -599,30 +634,34 @@ FS_FOpenFile(const char *name, fileHandle_t * f, fsMode_t mode) int FS_Read(void *buffer, int size, fileHandle_t f) { - qboolean tried = false; /* Tried to read from a CD. */ - byte *buf; /* Buffer. */ - int r; /* Number of bytes read. */ - int remaining;/* Remaining bytes. */ - fsHandle_t *handle; /* File handle. */ + qboolean tried = false; /* Tried to read from a CD. */ + byte *buf; /* Buffer. */ + int r; /* Number of bytes read. */ + int remaining; /* Remaining bytes. */ + fsHandle_t *handle; /* File handle. */ handle = FS_GetFileByHandle(f); /* Read. */ remaining = size; - buf = (byte *) buffer; + buf = (byte *)buffer; while (remaining) { if (handle->file) + { r = fread(buf, 1, remaining, handle->file); - + } #ifdef ZIP else if (handle->zip) + { r = unzReadCurrentFile(handle->zip, buf, remaining); + } #endif - else - return (0); + { + return 0; + } if (r == 0) { @@ -631,23 +670,26 @@ FS_Read(void *buffer, int size, fileHandle_t f) /* Might tried to read from a CD. */ tried = true; } - else { /* Already tried once. */ - Com_Error(ERR_FATAL, va("FS_Read: 0 bytes read from '%s'", handle->name)); - return (size - remaining); + Com_Error(ERR_FATAL, + va("FS_Read: 0 bytes read from '%s'", handle->name)); + return size - remaining; } } - else if (r == -1) - Com_Error(ERR_FATAL, "FS_Read: -1 bytes read from '%s'", handle->name); + { + Com_Error(ERR_FATAL, + "FS_Read: -1 bytes read from '%s'", + handle->name); + } remaining -= r; buf += r; } - return (size); + return size; } /* @@ -657,18 +699,18 @@ FS_Read(void *buffer, int size, fileHandle_t f) int FS_FRead(void *buffer, int size, int count, fileHandle_t f) { - qboolean tried = false; /* Tried to read from a CD. */ - byte *buf; /* Buffer. */ - int loops; /* Loop indicator. */ - int r; /* Number of bytes read. */ - int remaining; /* Remaining bytes. */ - fsHandle_t *handle; /* File handle. */ + qboolean tried = false; /* Tried to read from a CD. */ + byte *buf; /* Buffer. */ + int loops; /* Loop indicator. */ + int r; /* Number of bytes read. */ + int remaining; /* Remaining bytes. */ + fsHandle_t *handle; /* File handle. */ handle = FS_GetFileByHandle(f); /* Read. */ loops = count; - buf = (byte *) buffer; + buf = (byte *)buffer; while (loops) { @@ -678,15 +720,19 @@ FS_FRead(void *buffer, int size, int count, fileHandle_t f) while (remaining) { if (handle->file) + { r = fread(buf, 1, remaining, handle->file); - + } #ifdef ZIP else if (handle->zip) + { r = unzReadCurrentFile(handle->zip, buf, remaining); + } #endif - else - return (0); + { + return 0; + } if (r == 0) { @@ -695,16 +741,18 @@ FS_FRead(void *buffer, int size, int count, fileHandle_t f) /* Might tried to read from a CD. */ tried = true; } - else { /* Already tried once. */ - return (size - remaining); + return size - remaining; } } - else if (r == -1) - Com_Error(ERR_FATAL, "FS_FRead: -1 bytes read from '%s'", handle->name); + { + Com_Error(ERR_FATAL, + "FS_FRead: -1 bytes read from '%s'", + handle->name); + } remaining -= r; buf += r; @@ -713,7 +761,7 @@ FS_FRead(void *buffer, int size, int count, fileHandle_t f) loops--; } - return (size); + return size; } /* @@ -722,60 +770,71 @@ FS_FRead(void *buffer, int size, int count, fileHandle_t f) int FS_Write(const void *buffer, int size, fileHandle_t f) { - - byte *buf; /* Buffer. */ - int remaining; /* Remaining bytes. */ - int w = 0; /* Numbre of bytes written. */ - fsHandle_t *handle; /* File handle. */ + byte *buf; /* Buffer. */ + int remaining; /* Remaining bytes. */ + int w = 0; /* Numbre of bytes written. */ + fsHandle_t *handle; /* File handle. */ handle = FS_GetFileByHandle(f); /* Write. */ remaining = size; - buf = (byte *) buffer; + buf = (byte *)buffer; while (remaining) { if (handle->file) + { w = fwrite(buf, 1, remaining, handle->file); - + } #ifdef ZIP else if (handle->zip) - Com_Error(ERR_FATAL, "FS_Write: can't write to zip file '%s'", handle->name); + { + Com_Error(ERR_FATAL, + "FS_Write: can't write to zip file '%s'", + handle->name); + } #endif - else - return (0); + { + return 0; + } if (w == 0) { Com_Printf("FS_Write: 0 bytes written to '%s'.\n", handle->name); return size - remaining; } - else if (w == -1) - Com_Error(ERR_FATAL, "FS_Write: -1 bytes written to '%s'", handle->name); + { + Com_Error(ERR_FATAL, + "FS_Write: -1 bytes written to '%s'", + handle->name); + } remaining -= w; buf += w; } - return (size); + return size; } int FS_FTell(fileHandle_t f) { - fsHandle_t *handle; + fsHandle_t *handle; handle = FS_GetFileByHandle(f); if (handle->file) + { return ftell(handle->file); - + } #ifdef ZIP else if (handle->zip) + { return unztell(handle->zip); + } #endif return 0; @@ -787,24 +846,28 @@ FS_FTell(fileHandle_t f) char ** FS_ListPak(char *find, int *num) { - char **list = 0; /* File list. */ - int nfiles = 0; /* Number of files. */ - int nfound = 0; /* Number of files found. */ - int i; /* Loop counter. */ - fsPack_t *pak; /* Pak file. */ - fsSearchPath_t *search; /* Search path. */ + char **list = 0; /* File list. */ + int nfiles = 0; /* Number of files. */ + int nfound = 0; /* Number of files found. */ + int i; /* Loop counter. */ + fsPack_t *pak; /* Pak file. */ + fsSearchPath_t *search; /* Search path. */ /* Check pak files. */ for (search = fs_searchPaths; search != NULL; search = search->next) { if (search->pack == NULL) + { continue; + } pak = search->pack; /* Find and build list. */ for (i = 0; i < pak->numFiles; i++) + { nfiles++; + } } list = calloc(nfiles, sizeof(char *)); @@ -812,7 +875,9 @@ FS_ListPak(char *find, int *num) for (search = fs_searchPaths; search != NULL; search = search->next) { if (search->pack == NULL) + { continue; + } pak = search->pack; @@ -830,20 +895,20 @@ FS_ListPak(char *find, int *num) *num = nfound; list = realloc(list, sizeof(char *) * nfound); - return (list); + return list; } void FS_Seek(fileHandle_t f, int offset, fsOrigin_t origin) { #ifdef ZIP - byte dummy[0x8000]; /* Dummy buffer to skip bytes. */ - int len; /* Length of byte chunk to skip. */ - int r; /* Number of bytes read. */ - int remaining = 0; /* Remaining bytes to skip. */ - unz_file_info info; /* ZIP information. */ + byte dummy[0x8000]; /* Dummy buffer to skip bytes. */ + int len; /* Length of byte chunk to skip. */ + int r; /* Number of bytes read. */ + int remaining = 0; /* Remaining bytes to skip. */ + unz_file_info info; /* ZIP information. */ #endif - fsHandle_t *handle; /* File handle. */ + fsHandle_t *handle; /* File handle. */ handle = FS_GetFileByHandle(f); @@ -865,7 +930,6 @@ FS_Seek(fileHandle_t f, int offset, fsOrigin_t origin) break; } } - #ifdef ZIP else if (handle->zip) { @@ -878,7 +942,14 @@ FS_Seek(fileHandle_t f, int offset, fsOrigin_t origin) remaining = offset + unztell(handle->zip); break; case FS_SEEK_END: - unzGetCurrentFileInfo(handle->zip, &info, NULL, 0, NULL, 0, NULL, 0); + unzGetCurrentFileInfo(handle->zip, + &info, + NULL, + 0, + NULL, + 0, + NULL, + 0); remaining = offset + info.uncompressed_size; break; default: @@ -896,12 +967,16 @@ FS_Seek(fileHandle_t f, int offset, fsOrigin_t origin) len = remaining; if (len > sizeof(dummy)) + { len = sizeof(dummy); + } r = unzReadCurrentFile(handle->zip, dummy, len); if (r <= 0) + { break; + } remaining -= r; } @@ -915,35 +990,38 @@ FS_Seek(fileHandle_t f, int offset, fsOrigin_t origin) int FS_Tell(fileHandle_t f) { - fsHandle_t *handle; + fsHandle_t *handle; handle = FS_GetFileByHandle(f); if (handle->file) - return (ftell(handle->file)); - + { + return ftell(handle->file); + } #ifdef ZIP else if (handle->zip) - return (unztell(handle->zip)); + { + return unztell(handle->zip); + } #endif - return (-1); + return -1; } qboolean FS_FileExists(char *path) { - fileHandle_t f; + fileHandle_t f; FS_FOpenFile(path, &f, FS_READ); if (f != 0) { FS_FCloseFile(f); - return (true); + return true; } - return (false); + return false; } void @@ -952,7 +1030,10 @@ FS_RenameFile(const char *oldPath, const char *newPath) FS_DPrintf("FS_RenameFile(%s, %s)\n", oldPath, newPath); if (rename(oldPath, newPath)) - FS_DPrintf("FS_RenameFile: failed to rename '%s' to '%s'.\n", oldPath, newPath); + { + FS_DPrintf("FS_RenameFile: failed to rename '%s' to '%s'.\n", + oldPath, newPath); + } } void @@ -961,7 +1042,9 @@ FS_DeleteFile(const char *path) FS_DPrintf("FS_DeleteFile(%s)\n", path); if (remove(path)) + { FS_DPrintf("FS_DeleteFile: failed to delete '%s'.\n", path); + } } /* @@ -971,9 +1054,9 @@ FS_DeleteFile(const char *path) int FS_LoadFile(char *path, void **buffer) { - byte *buf; /* Buffer. */ - int size; /* File size. */ - fileHandle_t f; /* File handle. */ + byte *buf; /* Buffer. */ + int size; /* File size. */ + fileHandle_t f; /* File handle. */ buf = NULL; size = FS_FOpenFile(path, &f, FS_READ); @@ -981,15 +1064,17 @@ FS_LoadFile(char *path, void **buffer) if (size <= 0) { if (buffer) + { *buffer = NULL; + } - return (size); + return size; } if (buffer == NULL) { FS_FCloseFile(f); - return (size); + return size; } buf = Z_Malloc(size); @@ -998,7 +1083,7 @@ FS_LoadFile(char *path, void **buffer) FS_Read(buf, size, f); FS_FCloseFile(f); - return (size); + return size; } void @@ -1022,18 +1107,20 @@ FS_FreeFile(void *buffer) fsPack_t * FS_LoadPAK(const char *packPath) { - int i; /* Loop counter. */ - int numFiles; /* Number of files in PAK. */ - FILE *handle; /* File handle. */ - fsPackFile_t *files; /* List of files in PAK. */ - fsPack_t *pack; /* PAK file. */ - dpackheader_t header; /* PAK file header. */ - dpackfile_t info[MAX_FILES_IN_PACK]; /* PAK info. */ + int i; /* Loop counter. */ + int numFiles; /* Number of files in PAK. */ + FILE *handle; /* File handle. */ + fsPackFile_t *files; /* List of files in PAK. */ + fsPack_t *pack; /* PAK file. */ + dpackheader_t header; /* PAK file header. */ + dpackfile_t info[MAX_FILES_IN_PACK]; /* PAK info. */ handle = fopen(packPath, "rb"); if (handle == NULL) - return (NULL); + { + return NULL; + } fread(&header, 1, sizeof(dpackheader_t), handle); @@ -1048,10 +1135,11 @@ FS_LoadPAK(const char *packPath) numFiles = header.dirlen / sizeof(dpackfile_t); - if (numFiles > MAX_FILES_IN_PACK || numFiles == 0) + if ((numFiles > MAX_FILES_IN_PACK) || (numFiles == 0)) { fclose(handle); - Com_Error(ERR_FATAL, "FS_LoadPAK: '%s' has %i files", packPath, numFiles); + Com_Error(ERR_FATAL, "FS_LoadPAK: '%s' has %i files", + packPath, numFiles); } files = Z_Malloc(numFiles * sizeof(fsPackFile_t)); @@ -1078,7 +1166,7 @@ FS_LoadPAK(const char *packPath) Com_Printf("Added packfile '%s' (%i files).\n", pack, numFiles); - return (pack); + return pack; } #ifdef ZIP @@ -1091,22 +1179,24 @@ FS_LoadPAK(const char *packPath) fsPack_t * FS_LoadPK3(const char *packPath) { - char fileName[MAX_QPATH]; /* File name. */ - int i = 0; /* Loop counter. */ - int numFiles; /* Number of files in PK3. */ - int status; /* Error indicator. */ - fsPackFile_t *files; /* List of files in PK3. */ - fsPack_t *pack; /* PK3 file. */ - unzFile *handle; /* Zip file handle. */ - unz_file_info info; /* Zip file info. */ - unz_global_info global; /* Zip file global info. */ + char fileName[MAX_QPATH]; /* File name. */ + int i = 0; /* Loop counter. */ + int numFiles; /* Number of files in PK3. */ + int status; /* Error indicator. */ + fsPackFile_t *files; /* List of files in PK3. */ + fsPack_t *pack; /* PK3 file. */ + unzFile *handle; /* Zip file handle. */ + unz_file_info info; /* Zip file info. */ + unz_global_info global; /* Zip file global info. */ handle = unzOpen(packPath); if (handle == NULL) + { return NULL; + } - if (unzGetGlobalInfo(handle, &global)!=UNZ_OK) + if (unzGetGlobalInfo(handle, &global) != UNZ_OK) { unzClose(handle); Com_Error(ERR_FATAL, "FS_LoadPK3: '%s' is not a pack file", packPath); @@ -1114,10 +1204,11 @@ FS_LoadPK3(const char *packPath) numFiles = global.number_entry; - if (numFiles > MAX_FILES_IN_PACK || numFiles == 0) + if ((numFiles > MAX_FILES_IN_PACK) || (numFiles == 0)) { unzClose(handle); - Com_Error(ERR_FATAL, "FS_LoadPK3: '%s' has %i files", packPath, numFiles); + Com_Error(ERR_FATAL, "FS_LoadPK3: '%s' has %i files", + packPath, numFiles); } files = Z_Malloc(numFiles * sizeof(fsPackFile_t)); @@ -1128,7 +1219,8 @@ FS_LoadPK3(const char *packPath) while (status == UNZ_OK) { fileName[0] = '\0'; - unzGetCurrentFileInfo(handle, &info, fileName, MAX_QPATH, NULL, 0, NULL, 0); + unzGetCurrentFileInfo(handle, &info, fileName, MAX_QPATH, + NULL, 0, NULL, 0); strncpy(files[i].name, fileName, sizeof(files[i].name)); files[i].offset = -1; /* Not used in ZIP files */ files[i].size = info.uncompressed_size; @@ -1145,7 +1237,7 @@ FS_LoadPK3(const char *packPath) Com_Printf("Added packfile '%s' (%i files).\n", pack, numFiles); - return (pack); + return pack; } #endif @@ -1158,12 +1250,12 @@ FS_LoadPK3(const char *packPath) void FS_AddGameDirectory(const char *dir) { - char **list; /* File list. */ - char path[MAX_OSPATH]; /* Path to PAK / PK3. */ - int i, j; /* Loop counters. */ - int nfiles; /* Number of files in list. */ - fsSearchPath_t *search; /* Search path. */ - fsPack_t *pack; /* PAK / PK3 file. */ + char **list; /* File list. */ + char path[MAX_OSPATH]; /* Path to PAK / PK3. */ + int i, j; /* Loop counters. */ + int nfiles; /* Number of files in list. */ + fsSearchPath_t *search; /* Search path. */ + fsPack_t *pack; /* PAK / PK3 file. */ pack = NULL; @@ -1181,9 +1273,11 @@ FS_AddGameDirectory(const char *dir) /* Add numbered pack files in sequence. */ for (i = 0; i < sizeof(fs_packtypes) / sizeof(fs_packtypes[0]); i++) + { for (j = 0; j < MAX_PAKS; j++) { - Com_sprintf(path, sizeof(path), "%s/pak%d.%s", dir, j, fs_packtypes[i].suffix); + Com_sprintf(path, sizeof(path), "%s/pak%d.%s", + dir, j, fs_packtypes[i].suffix); switch (fs_packtypes[i].format) { @@ -1198,13 +1292,16 @@ FS_AddGameDirectory(const char *dir) } if (pack == NULL) + { continue; + } search = Z_Malloc(sizeof(fsSearchPath_t)); search->pack = pack; search->next = fs_searchPaths; fs_searchPaths = search; } + } /* Add not numbered pack files. */ for (i = 0; i < sizeof(fs_packtypes) / sizeof(fs_packtypes[0]); i++) @@ -1212,15 +1309,20 @@ FS_AddGameDirectory(const char *dir) Com_sprintf(path, sizeof(path), "%s/*.%s", dir, fs_packtypes[i].suffix); if ((list = FS_ListFiles(path, &nfiles, 0, SFF_SUBDIR)) == NULL) + { continue; + } - Com_sprintf(path, sizeof(path), "%s/pak*.%s", dir, fs_packtypes[i].suffix); + Com_sprintf(path, sizeof(path), "%s/pak*.%s", + dir, fs_packtypes[i].suffix); for (j = 0; j < nfiles - 1; j++) { /* Skip numbered packs. */ if (glob_match(path, list[j])) + { continue; + } switch (fs_packtypes[i].format) { @@ -1235,7 +1337,9 @@ FS_AddGameDirectory(const char *dir) } if (pack == NULL) + { continue; + } search = Z_Malloc(sizeof(fsSearchPath_t)); search->pack = pack; @@ -1267,33 +1371,34 @@ FS_AddHomeAsGameDirectory(char *dir) len = snprintf(gdir, sizeof(gdir), "%s%s/", home, dir); FS_CreatePath(gdir); - if ((len > 0) && (len < sizeof(gdir)) && (gdir[len-1] == '/')) - gdir[len-1] = 0; + if ((len > 0) && (len < sizeof(gdir)) && (gdir[len - 1] == '/')) + { + gdir[len - 1] = 0; + } - strncpy(fs_gamedir,gdir,sizeof(fs_gamedir)-1); - fs_gamedir[sizeof(fs_gamedir)-1] = 0; + strncpy(fs_gamedir, gdir, sizeof(fs_gamedir) - 1); + fs_gamedir[sizeof(fs_gamedir) - 1] = 0; - FS_AddGameDirectory (gdir); + FS_AddGameDirectory(gdir); } #ifdef SYSTEMWIDE - -void FS_AddSystemwideGameDirectory(char *dir) +void +FS_AddSystemwideGameDirectory(char *dir) { - char gdir[MAX_OSPATH]; - char *datadir = SYSTEMDIR; + char gdir[MAX_OSPATH]; + char *datadir = SYSTEMDIR; int len = snprintf(gdir, sizeof(gdir), "%s/%s/", datadir, dir); - printf("Using %s to fetch paks\n", gdir); + printf("Using %s to fetch paks\n", gdir); - if ((len > 0) && (len < sizeof(gdir)) && (gdir[len-1] == '/')) + if ((len > 0) && (len < sizeof(gdir)) && (gdir[len - 1] == '/')) { - gdir[len-1] = 0; + gdir[len - 1] = 0; } - FS_AddGameDirectory (gdir); + FS_AddGameDirectory(gdir); } - #endif /* @@ -1302,36 +1407,42 @@ void FS_AddSystemwideGameDirectory(char *dir) char * FS_NextPath(char *prevPath) { - char *prev; - fsSearchPath_t *search; + char *prev; + fsSearchPath_t *search; if (prevPath == NULL) - return (fs_gamedir); + { + return fs_gamedir; + } prev = fs_gamedir; for (search = fs_searchPaths; search; search = search->next) { if (search->pack != NULL) + { continue; + } if (prevPath == prev) - return (search->path); + { + return search->path; + } prev = search->path; } - return (NULL); + return NULL; } void FS_Path_f(void) { - int i; - int totalFiles = 0; - fsSearchPath_t *search; - fsHandle_t *handle; - fsLink_t *link; + int i; + int totalFiles = 0; + fsSearchPath_t *search; + fsHandle_t *handle; + fsLink_t *link; Com_Printf("Current search path:\n"); @@ -1339,26 +1450,34 @@ FS_Path_f(void) { if (search->pack != NULL) { - Com_Printf("%s (%i files)\n", search->pack->name, search->pack->numFiles); + Com_Printf("%s (%i files)\n", search->pack->name, + search->pack->numFiles); totalFiles += search->pack->numFiles; } - else + { Com_Printf("%s\n", search->path); + } } Com_Printf("\n"); for (i = 0, handle = fs_handles; i < MAX_HANDLES; i++, handle++) - if (handle->file != NULL + { + if ((handle->file != NULL) #ifdef ZIP - || handle->zip != NULL + || (handle->zip != NULL) #endif - ) + ) + { Com_Printf("Handle %i: '%s'.\n", i + 1, handle->name); + } + } for (i = 0, link = fs_links; link; i++, link = link->next) + { Com_Printf("Link %i: '%s' -> '%s'.\n", i, link->from, link->to); + } Com_Printf("----------------------\n"); #ifdef ZIP @@ -1371,14 +1490,14 @@ FS_Path_f(void) void FS_Startup(void) { - int i; + int i; fsSearchPath_t *next; - fsPack_t *pack; + fsPack_t *pack; if (strstr(fs_gamedirvar->string, "..") || - strstr(fs_gamedirvar->string, ".") || - strstr(fs_gamedirvar->string, "/") || - fs_gamedirvar->string[0] == '\0') + strstr(fs_gamedirvar->string, ".") || + strstr(fs_gamedirvar->string, "/") || + (fs_gamedirvar->string[0] == '\0')) { Com_Printf("Invalid game directory.\n"); Cvar_ForceSet("fs_game", BASEDIRNAME); @@ -1395,11 +1514,15 @@ FS_Startup(void) pack = fs_searchPaths->pack; if (pack->pak != NULL) + { fclose(pack->pak); + } #ifdef ZIP if (pack->pk3 != NULL) + { unzClose(pack->pk3); + } #endif Z_Free(pack->files); @@ -1413,21 +1536,29 @@ FS_Startup(void) /* Close open files for game dir. */ for (i = 0; i < MAX_HANDLES; i++) + { if (strstr(fs_handles[i].name, fs_currentGame) && - (fs_handles[i].file != NULL + ((fs_handles[i].file != NULL) #ifdef ZIP - || fs_handles[i].zip != NULL + || (fs_handles[i].zip != NULL) #endif - )) + )) + { FS_FCloseFile(i); + } + } /* Don't add baseq2 again. */ if (Q_stricmp(fs_gamedirvar->string, BASEDIRNAME) == 0) + { strncpy(fs_gamedir, fs_basedir->string, sizeof(fs_gamedir)); - + } else + { /* Add the directories. */ - FS_AddGameDirectory(va("%s/%s", fs_homepath->string, fs_gamedirvar->string)); + FS_AddGameDirectory(va("%s/%s", fs_homepath->string, + fs_gamedirvar->string)); + } } strncpy(fs_currentGame, fs_gamedirvar->string, sizeof(fs_currentGame)); @@ -1438,19 +1569,26 @@ FS_Startup(void) void FS_ExecAutoexec(void) { - char *dir; - char name[MAX_QPATH]; + char *dir; + char name[MAX_QPATH]; dir = (char *)Cvar_VariableString("gamedir"); if (dir[0] != '\0') - Com_sprintf(name, sizeof(name), "%s/%s/autoexec.cfg", fs_basedir->string, dir); - + { + Com_sprintf(name, sizeof(name), "%s/%s/autoexec.cfg", + fs_basedir->string, dir); + } else - Com_sprintf(name, sizeof(name), "%s/%s/autoexec.cfg", fs_basedir->string, BASEDIRNAME); + { + Com_sprintf(name, sizeof(name), "%s/%s/autoexec.cfg", + fs_basedir->string, BASEDIRNAME); + } if (Sys_FindFirst(name, 0, SFF_SUBDIR | SFF_HIDDEN | SFF_SYSTEM) != NULL) + { Cbuf_AddText("exec autoexec.cfg\n"); + } Sys_FindClose(); } @@ -1461,7 +1599,7 @@ FS_ExecAutoexec(void) void FS_SetGamedir(char *dir) { - int i; + int i; fsSearchPath_t *next; if (strstr(dir, "..") || strstr(dir, "/")) @@ -1476,11 +1614,15 @@ FS_SetGamedir(char *dir) if (fs_searchPaths->pack) { if (fs_searchPaths->pack->pak) + { fclose(fs_searchPaths->pack->pak); + } #ifdef ZIP if (fs_searchPaths->pack->pk3) + { unzClose(fs_searchPaths->pack->pk3); + } #endif Z_Free(fs_searchPaths->pack->files); @@ -1494,32 +1636,40 @@ FS_SetGamedir(char *dir) /* Close open files for game dir. */ for (i = 0; i < MAX_HANDLES; i++) + { if (strstr(fs_handles[i].name, dir) && - (fs_handles[i].file != NULL + ((fs_handles[i].file != NULL) #ifdef ZIP - || fs_handles[i].zip != NULL + || (fs_handles[i].zip != NULL) #endif - )) + )) + { FS_FCloseFile(i); + } + } /* Flush all data, so it will be forced to reload. */ - if (dedicated != NULL && dedicated->value != 1) + if ((dedicated != NULL) && (dedicated->value != 1)) + { Cbuf_AddText("vid_restart\nsnd_restart\n"); + } - Com_sprintf(fs_gamedir, sizeof(fs_gamedir), "%s/%s", fs_basedir->string, dir); + Com_sprintf(fs_gamedir, sizeof(fs_gamedir), "%s/%s", + fs_basedir->string, dir); - if (strcmp(dir, BASEDIRNAME) == 0 || (*dir == 0)) + if ((strcmp(dir, BASEDIRNAME) == 0) || (*dir == 0)) { Cvar_FullSet("gamedir", "", CVAR_SERVERINFO | CVAR_NOSET); Cvar_FullSet("game", "", CVAR_LATCH | CVAR_SERVERINFO); } - else { Cvar_FullSet("gamedir", dir, CVAR_SERVERINFO | CVAR_NOSET); if (fs_cddir->string[0] == '\0') + { FS_AddGameDirectory(va("%s/%s", fs_cddir->string, dir)); + } #ifdef SYSTEMWIDE FS_AddSystemwideGameDirectory(dir); @@ -1536,7 +1686,7 @@ FS_SetGamedir(char *dir) void FS_Link_f(void) { - fsLink_t *l, **prev; + fsLink_t *l, **prev; if (Cmd_Argc() != 3) { @@ -1582,11 +1732,12 @@ FS_Link_f(void) * Create a list of files that match a criteria. */ char ** -FS_ListFiles(char *findname, int *numfiles, unsigned musthave, unsigned canthave) +FS_ListFiles(char *findname, int *numfiles, + unsigned musthave, unsigned canthave) { - char **list; /* List of files. */ - char *s; /* Next file in list. */ - int nfiles; /* Number of files in list. */ + char **list; /* List of files. */ + char *s; /* Next file in list. */ + int nfiles; /* Number of files in list. */ /* Initialize variables. */ list = NULL; @@ -1598,7 +1749,9 @@ FS_ListFiles(char *findname, int *numfiles, unsigned musthave, unsigned canthave while (s != NULL) { if (s[strlen(s) - 1] != '.') + { nfiles++; + } s = Sys_FindNext(musthave, canthave); } @@ -1607,7 +1760,9 @@ FS_ListFiles(char *findname, int *numfiles, unsigned musthave, unsigned canthave /* Check if there are matches. */ if (nfiles == 0) - return (NULL); + { + return NULL; + } nfiles++; /* Add space for a guard. */ *numfiles = nfiles; @@ -1632,7 +1787,7 @@ FS_ListFiles(char *findname, int *numfiles, unsigned musthave, unsigned canthave Sys_FindClose(); - return (list); + return list; } /* @@ -1642,46 +1797,59 @@ FS_ListFiles(char *findname, int *numfiles, unsigned musthave, unsigned canthave * SFF_SUBDIR it changes). */ qboolean -ComparePackFiles(const char *findname, const char *name, - unsigned musthave, unsigned canthave, char *output, int size) +ComparePackFiles(const char *findname, const char *name, unsigned musthave, + unsigned canthave, char *output, int size) { - qboolean retval; - char *ptr; - char buffer[MAX_OSPATH]; + qboolean retval; + char *ptr; + char buffer[MAX_OSPATH]; strncpy(buffer, name, sizeof(buffer)); - if ((canthave & SFF_SUBDIR) && name[strlen(name)-1] == '/') - return (false); + if ((canthave & SFF_SUBDIR) && (name[strlen(name) - 1] == '/')) + { + return false; + } if (musthave & SFF_SUBDIR) { if ((ptr = strrchr(buffer, '/')) != NULL) + { *ptr = '\0'; - + } else - return (false); + { + return false; + } } if ((musthave & SFF_HIDDEN) || (canthave & SFF_HIDDEN)) { if ((ptr = strrchr(buffer, '/')) == NULL) + { ptr = buffer; + } - if (((musthave & SFF_HIDDEN) && ptr[1] != '.') || - ((canthave & SFF_HIDDEN) && ptr[1] == '.')) - return (false); + if (((musthave & SFF_HIDDEN) && (ptr[1] != '.')) || + ((canthave & SFF_HIDDEN) && (ptr[1] == '.'))) + { + return false; + } } if (canthave & SFF_RDONLY) - return (false); + { + return false; + } retval = glob_match((char *)findname, buffer); - if (retval && output != NULL) + if (retval && (output != NULL)) + { strncpy(output, buffer, size); + } - return (retval); + return retval; } /* @@ -1690,15 +1858,16 @@ ComparePackFiles(const char *findname, const char *name, * including .pak and .pk3 files. */ char ** -FS_ListFiles2(char *findname, int *numfiles, unsigned musthave, unsigned canthave) +FS_ListFiles2(char *findname, int *numfiles, + unsigned musthave, unsigned canthave) { - fsSearchPath_t *search; /* Search path. */ - int i, j; /* Loop counters. */ - int nfiles; /* Number of files found. */ - int tmpnfiles; /* Temp number of files. */ - char **tmplist; /* Temporary list of files. */ - char **list; /* List of files found. */ - char path[MAX_OSPATH]; /* Temporary path. */ + fsSearchPath_t *search; /* Search path. */ + int i, j; /* Loop counters. */ + int nfiles; /* Number of files found. */ + int tmpnfiles; /* Temp number of files. */ + char **tmplist; /* Temporary list of files. */ + char **list; /* List of files found. */ + char path[MAX_OSPATH]; /* Temporary path. */ nfiles = 0; list = malloc(sizeof(char *)); @@ -1708,38 +1877,45 @@ FS_ListFiles2(char *findname, int *numfiles, unsigned musthave, unsigned canthav if (search->pack != NULL) { if (canthave & SFF_INPACK) + { continue; + } for (i = 0, j = 0; i < search->pack->numFiles; i++) - if (ComparePackFiles(findname, - search->pack->files[i].name, - musthave, canthave, NULL, 0)) + { + if (ComparePackFiles(findname, search->pack->files[i].name, + musthave, canthave, NULL, 0)) + { j++; + } + } if (j == 0) + { continue; + } nfiles += j; list = realloc(list, nfiles * sizeof(char *)); - for (i = 0, j = nfiles - j; - i < search->pack->numFiles; - i++) - if (ComparePackFiles(findname, - search->pack->files[i].name, - musthave, canthave, path, sizeof(path))) + for (i = 0, j = nfiles - j; i < search->pack->numFiles; i++) + { + if (ComparePackFiles(findname, search->pack->files[i].name, + musthave, canthave, path, sizeof(path))) + { list[j++] = strdup(path); + } + } } - else if (search->path != NULL) { if (musthave & SFF_INPACK) + { continue; + } - Com_sprintf(path, sizeof(path), "%s/%s", - search->path, findname); - tmplist = FS_ListFiles(path, &tmpnfiles, musthave, - canthave); + Com_sprintf(path, sizeof(path), "%s/%s", search->path, findname); + tmplist = FS_ListFiles(path, &tmpnfiles, musthave, canthave); if (tmplist != NULL) { @@ -1747,11 +1923,10 @@ FS_ListFiles2(char *findname, int *numfiles, unsigned musthave, unsigned canthav nfiles += tmpnfiles; list = realloc(list, nfiles * sizeof(char *)); - for (i = 0, j = nfiles - tmpnfiles; - i < tmpnfiles; - i++, j++) - list[j] = strdup(tmplist[i] + - strlen(search->path) + 1); + for (i = 0, j = nfiles - tmpnfiles; i < tmpnfiles; i++, j++) + { + list[j] = strdup(tmplist[i] + strlen(search->path) + 1); + } FS_FreeList(tmplist, tmpnfiles + 1); } @@ -1764,16 +1939,20 @@ FS_ListFiles2(char *findname, int *numfiles, unsigned musthave, unsigned canthav for (i = 0; i < nfiles; i++) { if (list[i] == NULL) + { continue; + } for (j = i + 1; j < nfiles; j++) - if (list[j] != NULL && - strcmp(list[i], list[j]) == 0) + { + if ((list[j] != NULL) && + (strcmp(list[i], list[j]) == 0)) { free(list[j]); list[j] = NULL; tmpnfiles++; } + } } if (tmpnfiles > 0) @@ -1782,8 +1961,12 @@ FS_ListFiles2(char *findname, int *numfiles, unsigned musthave, unsigned canthav tmplist = malloc(nfiles * sizeof(char *)); for (i = 0, j = 0; i < nfiles + tmpnfiles; i++) + { if (list[i] != NULL) + { tmplist[j++] = list[i]; + } + } free(list); list = tmplist; @@ -1805,7 +1988,7 @@ FS_ListFiles2(char *findname, int *numfiles, unsigned musthave, unsigned canthav *numfiles = nfiles; - return (list); + return list; } /* @@ -1814,10 +1997,12 @@ FS_ListFiles2(char *findname, int *numfiles, unsigned musthave, unsigned canthav void FS_FreeList(char **list, int nfiles) { - int i; + int i; for (i = 0; i < nfiles - 1; i++) + { free(list[i]); + } free(list); } @@ -1828,16 +2013,18 @@ FS_FreeList(char **list, int nfiles) void FS_Dir_f(void) { - char **dirnames; /* File list. */ - char findname[1024]; /* File search path and pattern. */ - char *path = NULL; /* Search path. */ - char wildcard[1024] = "*.*"; /* File pattern. */ - int i; /* Loop counter. */ - int ndirs; /* Number of files in list. */ + char **dirnames; /* File list. */ + char findname[1024]; /* File search path and pattern. */ + char *path = NULL; /* Search path. */ + char wildcard[1024] = "*.*"; /* File pattern. */ + int i; /* Loop counter. */ + int ndirs; /* Number of files in list. */ /* Check for pattern in arguments. */ if (Cmd_Argc() != 1) + { strncpy(wildcard, Cmd_Argv(1), sizeof(wildcard)); + } /* Scan search paths and list files. */ while ((path = FS_NextPath(path)) != NULL) @@ -1851,10 +2038,13 @@ FS_Dir_f(void) for (i = 0; i < ndirs - 1; i++) { if (strrchr(dirnames[i], '/')) + { Com_Printf("%s\n", strrchr(dirnames[i], '/') + 1); - + } else + { Com_Printf("%s\n", dirnames[i]); + } } FS_FreeList(dirnames, ndirs); @@ -1872,19 +2062,17 @@ FS_InitFilesystem(void) Cmd_AddCommand("link", FS_Link_f); Cmd_AddCommand("dir", FS_Dir_f); - /* - * basedir Allows the game to run from outside the data tree. - */ + /* basedir Allows the game to run from outside the data tree. */ fs_basedir = Cvar_Get("basedir", ".", CVAR_NOSET); - /* - * cddir Logically concatenates the cddir after the basedir to - * allow the game to run from outside the data tree. - */ + /* cddir Logically concatenates the cddir after the basedir to + allow the game to run from outside the data tree. */ fs_cddir = Cvar_Get("cddir", "", CVAR_NOSET); if (fs_cddir->string[0] != '\0') + { FS_AddGameDirectory(va("%s/" BASEDIRNAME, fs_cddir->string)); + } /* Debug flag. */ fs_debug = Cvar_Get("fs_debug", "0", 0); @@ -1909,7 +2097,9 @@ FS_InitFilesystem(void) /* Check for game override. */ if (fs_gamedirvar->string[0] != '\0') + { FS_SetGamedir(fs_gamedirvar->string); + } /* Create directory if it does not exist. */ FS_CreatePath(fs_gamedir); @@ -1920,10 +2110,10 @@ FS_InitFilesystem(void) void FS_Shutdown(void) { - int i; - fsHandle_t *handle; - fsSearchPath_t *next; - fsPack_t *pack; + int i; + fsHandle_t *handle; + fsSearchPath_t *next; + fsPack_t *pack; /* Unregister commands. */ Cmd_RemoveCommand("dir"); @@ -1934,7 +2124,9 @@ FS_Shutdown(void) for (i = 0, handle = fs_handles; i < MAX_HANDLES; i++, handle++) { if (handle->file != NULL) + { fclose(handle->file); + } #ifdef ZIP if (handle->zip != NULL) @@ -1953,11 +2145,15 @@ FS_Shutdown(void) pack = fs_searchPaths->pack; if (pack->pak != NULL) + { fclose(pack->pak); + } #ifdef ZIP if (pack->pk3 != NULL) + { unzClose(pack->pk3); + } #endif Z_Free(pack->files); @@ -1969,3 +2165,4 @@ FS_Shutdown(void) fs_searchPaths = next; } } + diff --git a/src/common/glob.c b/src/common/glob.c index d37fcdc8..3e917fe2 100644 --- a/src/common/glob.c +++ b/src/common/glob.c @@ -31,25 +31,25 @@ * Like glob_match, but match PATTERN against any final segment of TEXT. */ static int -glob_match_after_star ( char *pattern, char *text ) +glob_match_after_star(char *pattern, char *text) { register char *p = pattern, *t = text; register char c, c1; - while ( ( c = *p++ ) == '?' || c == '*' ) + while ((c = *p++) == '?' || c == '*') { - if ( ( c == '?' ) && ( *t++ == '\0' ) ) + if ((c == '?') && (*t++ == '\0')) { - return ( 0 ); + return 0; } } - if ( c == '\0' ) + if (c == '\0') { - return ( 1 ); + return 1; } - if ( c == '\\' ) + if (c == '\\') { c1 = *p; } @@ -58,16 +58,16 @@ glob_match_after_star ( char *pattern, char *text ) c1 = c; } - while ( 1 ) + while (1) { - if ( ( ( c == '[' ) || ( *t == c1 ) ) && glob_match( p - 1, t ) ) + if (((c == '[') || (*t == c1)) && glob_match(p - 1, t)) { - return ( 1 ); + return 1; } - if ( *t++ == '\0' ) + if (*t++ == '\0') { - return ( 0 ); + return 0; } } } @@ -90,20 +90,20 @@ glob_match_after_star ( char *pattern, char *text ) * and match the character exactly, precede it with a `\'. */ int -glob_match ( char *pattern, char *text ) +glob_match(char *pattern, char *text) { register char *p = pattern, *t = text; register char c; - while ( ( c = *p++ ) != '\0' ) + while ((c = *p++) != '\0') { - switch ( c ) + switch (c) { case '?': - if ( *t == '\0' ) + if (*t == '\0') { - return ( 0 ); + return 0; } else { @@ -114,83 +114,83 @@ glob_match ( char *pattern, char *text ) case '\\': - if ( *p++ != *t++ ) + if (*p++ != *t++) { - return ( 0 ); + return 0; } break; case '*': - return ( glob_match_after_star( p, t ) ); + return glob_match_after_star(p, t); case '[': { register char c1 = *t++; int invert; - if ( !c1 ) + if (!c1) { - return ( 0 ); + return 0; } - invert = ( ( *p == '!' ) || ( *p == '^' ) ); + invert = ((*p == '!') || (*p == '^')); - if ( invert ) + if (invert) { p++; } c = *p++; - while ( 1 ) + while (1) { register char cstart = c, cend = c; - if ( c == '\\' ) + if (c == '\\') { cstart = *p++; cend = cstart; } - if ( c == '\0' ) + if (c == '\0') { - return ( 0 ); + return 0; } c = *p++; - if ( ( c == '-' ) && ( *p != ']' ) ) + if ((c == '-') && (*p != ']')) { cend = *p++; - if ( cend == '\\' ) + if (cend == '\\') { cend = *p++; } - if ( cend == '\0' ) + if (cend == '\0') { - return ( 0 ); + return 0; } c = *p++; } - if ( ( c1 >= cstart ) && ( c1 <= cend ) ) + if ((c1 >= cstart) && (c1 <= cend)) { goto match; } - if ( c == ']' ) + if (c == ']') { break; } } - if ( !invert ) + if (!invert) { - return ( 0 ); + return 0; } break; @@ -198,28 +198,28 @@ glob_match ( char *pattern, char *text ) match: /* Skip the rest of the [...] construct that already matched. */ - while ( c != ']' ) + while (c != ']') { - if ( c == '\0' ) + if (c == '\0') { - return ( 0 ); + return 0; } c = *p++; - if ( c == '\0' ) + if (c == '\0') { - return ( 0 ); + return 0; } - else if ( c == '\\' ) + else if (c == '\\') { ++p; } } - if ( invert ) + if (invert) { - return ( 0 ); + return 0; } break; @@ -227,12 +227,13 @@ glob_match ( char *pattern, char *text ) default: - if ( c != *t++ ) + if (c != *t++) { - return ( 0 ); + return 0; } } } - return ( *t == '\0' ); + return *t == '\0'; } + diff --git a/src/common/header/cmd.h b/src/common/header/cmd.h deleted file mode 100644 index 80f2bad6..00000000 --- a/src/common/header/cmd.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 1997-2001 Id Software, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - * - * ======================================================================= - * - * The header for the command processor system - * - * ======================================================================= - */ - -#ifndef CO_CMD_H -#define CO_CMD_H - -#define MAX_ALIAS_NAME 32 -#define ALIAS_LOOP_COUNT 16 - -typedef struct cmdalias_s { - struct cmdalias_s *next; - char name[MAX_ALIAS_NAME]; - char *value; -} cmdalias_t; - -cmdalias_t *cmd_alias; -qboolean cmd_wait; - -int alias_count; /* for detecting runaway loops */ - -void Cmd_Exec_f (void); -void Cmd_Echo_f (void); -void Cmd_Alias_f (void); -void Cmd_Wait_f (void); - -#endif diff --git a/src/common/header/cmodel.h b/src/common/header/cmodel.h deleted file mode 100644 index b29ce5f7..00000000 --- a/src/common/header/cmodel.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (C) 1997-2001 Id Software, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - * - * ======================================================================= - * - * The header file for the common model stuff. - * - * ======================================================================= - */ - -#ifndef CO_CMODEL_H -#define CO_CMODEL_H - -typedef struct -{ - cplane_t *plane; - int children[2]; /* negative numbers are leafs */ -} cnode_t; - -typedef struct -{ - cplane_t *plane; - mapsurface_t *surface; -} cbrushside_t; - -typedef struct -{ - int contents; - int cluster; - int area; - unsigned short firstleafbrush; - unsigned short numleafbrushes; -} cleaf_t; - -typedef struct -{ - int contents; - int numsides; - int firstbrushside; - int checkcount; /* to avoid repeated testings */ -} cbrush_t; - -typedef struct -{ - int numareaportals; - int firstareaportal; - int floodnum; /* if two areas have equal floodnums, they are connected */ - int floodvalid; -} carea_t; - -int checkcount; - -char map_name[MAX_QPATH]; - -int numbrushsides; -cbrushside_t map_brushsides[MAX_MAP_BRUSHSIDES]; - -int numtexinfo; -mapsurface_t map_surfaces[MAX_MAP_TEXINFO]; - -int numplanes; -cplane_t map_planes[MAX_MAP_PLANES+6]; /* extra for box hull */ - -int numnodes; -cnode_t map_nodes[MAX_MAP_NODES+6]; /* extra for box hull */ - -cleaf_t map_leafs[MAX_MAP_LEAFS]; -int emptyleaf, solidleaf; - -int numleafbrushes; -unsigned short map_leafbrushes[MAX_MAP_LEAFBRUSHES]; - -int numcmodels; -cmodel_t map_cmodels[MAX_MAP_MODELS]; - -int numbrushes; -cbrush_t map_brushes[MAX_MAP_BRUSHES]; - -int numvisibility; -byte map_visibility[MAX_MAP_VISIBILITY]; - -int numentitychars; -char map_entitystring[MAX_MAP_ENTSTRING]; - -carea_t map_areas[MAX_MAP_AREAS]; - -int numareaportals; -dareaportal_t map_areaportals[MAX_MAP_AREAPORTALS]; - -mapsurface_t nullsurface; - -int floodvalid; - -qboolean portalopen[MAX_MAP_AREAPORTALS]; - -cvar_t *map_noareas; - -void CM_InitBoxHull (void); -void FloodAreaConnections (void); - -#ifndef DEDICATED_ONLY -int c_pointcontents; -int c_traces, c_brush_traces; -#endif - -int CM_BoxLeafnums_headnode (vec3_t mins, vec3_t maxs, int *list, int listsize, int headnode, int *topnode); - -#endif diff --git a/src/common/header/common.h b/src/common/header/common.h index f017e455..080d2f93 100644 --- a/src/common/header/common.h +++ b/src/common/header/common.h @@ -32,139 +32,139 @@ #include "shared.h" #include "crc.h" -#define VERSION 4.90 -#define BASEDIRNAME "baseq2" +#define VERSION 4.90 +#define BASEDIRNAME "baseq2" #if defined __linux__ -#define BUILDSTRING "Linux" + #define BUILDSTRING "Linux" #elif defined __FreeBSD__ -#define BUILDSTRING "FreeBSD" + #define BUILDSTRING "FreeBSD" #elif defined _WIN32 -#define BUILDSTRING "Windows" + #define BUILDSTRING "Windows" #else -#define BUILDSTRING "Unknown" + #define BUILDSTRING "Unknown" #endif #ifdef __i386__ -#define CPUSTRING "i386" + #define CPUSTRING "i386" #elif defined __x86_64__ -#define CPUSTRING "amd64" + #define CPUSTRING "amd64" #elif defined __sparc__ -#define CPUSTRING "sparc64" + #define CPUSTRING "sparc64" #else -#define CPUSTRING "Unknown" + #define CPUSTRING "Unknown" #endif #ifdef _WIN32 -#define CFGDIR "YamagiQ2" + #define CFGDIR "YamagiQ2" #else -#define CFGDIR ".yq2" + #define CFGDIR ".yq2" #endif /* ================================================================== */ typedef struct sizebuf_s { - qboolean allowoverflow; /* if false, do a Com_Error */ - qboolean overflowed; /* set to true if the buffer size failed */ - byte *data; - int maxsize; - int cursize; - int readcount; + qboolean allowoverflow; /* if false, do a Com_Error */ + qboolean overflowed; /* set to true if the buffer size failed */ + byte *data; + int maxsize; + int cursize; + int readcount; } sizebuf_t; -void SZ_Init (sizebuf_t *buf, byte *data, int length); -void SZ_Clear (sizebuf_t *buf); -void *SZ_GetSpace (sizebuf_t *buf, int length); -void SZ_Write (sizebuf_t *buf, void *data, int length); -void SZ_Print (sizebuf_t *buf, char *data); /* strcats onto the sizebuf */ +void SZ_Init(sizebuf_t *buf, byte *data, int length); +void SZ_Clear(sizebuf_t *buf); +void *SZ_GetSpace(sizebuf_t *buf, int length); +void SZ_Write(sizebuf_t *buf, void *data, int length); +void SZ_Print(sizebuf_t *buf, char *data); /* strcats onto the sizebuf */ /* ================================================================== */ struct usercmd_s; struct entity_state_s; -void MSG_WriteChar (sizebuf_t *sb, int c); -void MSG_WriteByte (sizebuf_t *sb, int c); -void MSG_WriteShort (sizebuf_t *sb, int c); -void MSG_WriteLong (sizebuf_t *sb, int c); -void MSG_WriteFloat (sizebuf_t *sb, float f); -void MSG_WriteString (sizebuf_t *sb, char *s); -void MSG_WriteCoord (sizebuf_t *sb, float f); -void MSG_WritePos (sizebuf_t *sb, vec3_t pos); -void MSG_WriteAngle (sizebuf_t *sb, float f); -void MSG_WriteAngle16 (sizebuf_t *sb, float f); -void MSG_WriteDeltaUsercmd (sizebuf_t *sb, struct usercmd_s *from, struct usercmd_s *cmd); -void MSG_WriteDeltaEntity (struct entity_state_s *from, struct entity_state_s *to, sizebuf_t *msg, qboolean force, qboolean newentity); -void MSG_WriteDir (sizebuf_t *sb, vec3_t vector); +void MSG_WriteChar(sizebuf_t *sb, int c); +void MSG_WriteByte(sizebuf_t *sb, int c); +void MSG_WriteShort(sizebuf_t *sb, int c); +void MSG_WriteLong(sizebuf_t *sb, int c); +void MSG_WriteFloat(sizebuf_t *sb, float f); +void MSG_WriteString(sizebuf_t *sb, char *s); +void MSG_WriteCoord(sizebuf_t *sb, float f); +void MSG_WritePos(sizebuf_t *sb, vec3_t pos); +void MSG_WriteAngle(sizebuf_t *sb, float f); +void MSG_WriteAngle16(sizebuf_t *sb, float f); +void MSG_WriteDeltaUsercmd(sizebuf_t *sb, struct usercmd_s *from, + struct usercmd_s *cmd); +void MSG_WriteDeltaEntity(struct entity_state_s *from, + struct entity_state_s *to, sizebuf_t *msg, + qboolean force, qboolean newentity); +void MSG_WriteDir(sizebuf_t *sb, vec3_t vector); +void MSG_BeginReading(sizebuf_t *sb); -void MSG_BeginReading (sizebuf_t *sb); +int MSG_ReadChar(sizebuf_t *sb); +int MSG_ReadByte(sizebuf_t *sb); +int MSG_ReadShort(sizebuf_t *sb); +int MSG_ReadLong(sizebuf_t *sb); +float MSG_ReadFloat(sizebuf_t *sb); +char *MSG_ReadString(sizebuf_t *sb); +char *MSG_ReadStringLine(sizebuf_t *sb); -int MSG_ReadChar (sizebuf_t *sb); -int MSG_ReadByte (sizebuf_t *sb); -int MSG_ReadShort (sizebuf_t *sb); -int MSG_ReadLong (sizebuf_t *sb); -float MSG_ReadFloat (sizebuf_t *sb); -char *MSG_ReadString (sizebuf_t *sb); -char *MSG_ReadStringLine (sizebuf_t *sb); +float MSG_ReadCoord(sizebuf_t *sb); +void MSG_ReadPos(sizebuf_t *sb, vec3_t pos); +float MSG_ReadAngle(sizebuf_t *sb); +float MSG_ReadAngle16(sizebuf_t *sb); +void MSG_ReadDeltaUsercmd(sizebuf_t *sb, + struct usercmd_s *from, + struct usercmd_s *cmd); -float MSG_ReadCoord (sizebuf_t *sb); -void MSG_ReadPos (sizebuf_t *sb, vec3_t pos); -float MSG_ReadAngle (sizebuf_t *sb); -float MSG_ReadAngle16 (sizebuf_t *sb); -void MSG_ReadDeltaUsercmd (sizebuf_t *sb, struct usercmd_s *from, struct usercmd_s *cmd); +void MSG_ReadDir(sizebuf_t *sb, vec3_t vector); -void MSG_ReadDir (sizebuf_t *sb, vec3_t vector); - -void MSG_ReadData (sizebuf_t *sb, void *buffer, int size); +void MSG_ReadData(sizebuf_t *sb, void *buffer, int size); /* ================================================================== */ -extern qboolean bigendien; +extern qboolean bigendien; -extern short BigShort (short l); -extern short LittleShort (short l); -extern int BigLong (int l); -extern int LittleLong (int l); -extern float BigFloat (float l); -extern float LittleFloat (float l); +extern short BigShort(short l); +extern short LittleShort(short l); +extern int BigLong(int l); +extern int LittleLong(int l); +extern float BigFloat(float l); +extern float LittleFloat(float l); /* ================================================================== */ +int COM_Argc(void); +char *COM_Argv(int arg); /* range and null checked */ +void COM_ClearArgv(int arg); +int COM_CheckParm(char *parm); +void COM_AddParm(char *parm); -int COM_Argc (void); -char *COM_Argv (int arg); /* range and null checked */ -void COM_ClearArgv (int arg); -int COM_CheckParm (char *parm); -void COM_AddParm (char *parm); +void COM_Init(void); +void COM_InitArgv(int argc, char **argv); -void COM_Init (void); -void COM_InitArgv (int argc, char **argv); - -char *CopyString (char *in); +char *CopyString(char *in); /* ================================================================== */ -void Info_Print (char *s); - +void Info_Print(char *s); /* PROTOCOL */ -#define PROTOCOL_VERSION 34 +#define PROTOCOL_VERSION 34 /* ========================================= */ -#define PORT_MASTER 27900 -#define PORT_CLIENT 27901 -#define PORT_SERVER 27910 +#define PORT_MASTER 27900 +#define PORT_CLIENT 27901 +#define PORT_SERVER 27910 /* ========================================= */ -#define UPDATE_BACKUP 16 /* copies of entity_state_t to keep buffered */ -#define UPDATE_MASK (UPDATE_BACKUP-1) - - +#define UPDATE_BACKUP 16 /* copies of entity_state_t to keep buffered */ +#define UPDATE_MASK (UPDATE_BACKUP - 1) /* server to client */ enum svc_ops_e @@ -182,17 +182,17 @@ enum svc_ops_e svc_nop, svc_disconnect, svc_reconnect, - svc_sound, /* */ - svc_print, /* [byte] id [string] null terminated string */ - svc_stufftext, /* [string] stuffed into client's console buffer, should be \n terminated */ - svc_serverdata, /* [long] protocol ... */ - svc_configstring, /* [short] [string] */ + svc_sound, /* */ + svc_print, /* [byte] id [string] null terminated string */ + svc_stufftext, /* [string] stuffed into client's console buffer, should be \n terminated */ + svc_serverdata, /* [long] protocol ... */ + svc_configstring, /* [short] [string] */ svc_spawnbaseline, - svc_centerprint, /* [string] to put in center of the screen */ - svc_download, /* [short] size [size bytes] */ - svc_playerinfo, /* variable */ - svc_packetentities, /* [...] */ - svc_deltapacketentities, /* [...] */ + svc_centerprint, /* [string] to put in center of the screen */ + svc_download, /* [short] size [size bytes] */ + svc_playerinfo, /* variable */ + svc_packetentities, /* [...] */ + svc_deltapacketentities, /* [...] */ svc_frame }; @@ -203,55 +203,55 @@ enum clc_ops_e { clc_bad, clc_nop, - clc_move, /* [[usercmd_t] */ - clc_userinfo, /* [[userinfo string] */ - clc_stringcmd /* [string] message */ + clc_move, /* [[usercmd_t] */ + clc_userinfo, /* [[userinfo string] */ + clc_stringcmd /* [string] message */ }; /* ============================================== */ /* plyer_state_t communication */ -#define PS_M_TYPE (1<<0) -#define PS_M_ORIGIN (1<<1) -#define PS_M_VELOCITY (1<<2) -#define PS_M_TIME (1<<3) -#define PS_M_FLAGS (1<<4) -#define PS_M_GRAVITY (1<<5) -#define PS_M_DELTA_ANGLES (1<<6) +#define PS_M_TYPE (1 << 0) +#define PS_M_ORIGIN (1 << 1) +#define PS_M_VELOCITY (1 << 2) +#define PS_M_TIME (1 << 3) +#define PS_M_FLAGS (1 << 4) +#define PS_M_GRAVITY (1 << 5) +#define PS_M_DELTA_ANGLES (1 << 6) -#define PS_VIEWOFFSET (1<<7) -#define PS_VIEWANGLES (1<<8) -#define PS_KICKANGLES (1<<9) -#define PS_BLEND (1<<10) -#define PS_FOV (1<<11) -#define PS_WEAPONINDEX (1<<12) -#define PS_WEAPONFRAME (1<<13) -#define PS_RDFLAGS (1<<14) +#define PS_VIEWOFFSET (1 << 7) +#define PS_VIEWANGLES (1 << 8) +#define PS_KICKANGLES (1 << 9) +#define PS_BLEND (1 << 10) +#define PS_FOV (1 << 11) +#define PS_WEAPONINDEX (1 << 12) +#define PS_WEAPONFRAME (1 << 13) +#define PS_RDFLAGS (1 << 14) /*============================================== */ /* user_cmd_t communication */ /* ms and light always sent, the others are optional */ -#define CM_ANGLE1 (1<<0) -#define CM_ANGLE2 (1<<1) -#define CM_ANGLE3 (1<<2) -#define CM_FORWARD (1<<3) -#define CM_SIDE (1<<4) -#define CM_UP (1<<5) -#define CM_BUTTONS (1<<6) -#define CM_IMPULSE (1<<7) +#define CM_ANGLE1 (1 << 0) +#define CM_ANGLE2 (1 << 1) +#define CM_ANGLE3 (1 << 2) +#define CM_FORWARD (1 << 3) +#define CM_SIDE (1 << 4) +#define CM_UP (1 << 5) +#define CM_BUTTONS (1 << 6) +#define CM_IMPULSE (1 << 7) /*============================================== */ /* a sound without an ent or pos will be a local only sound */ -#define SND_VOLUME (1<<0) /* a byte */ -#define SND_ATTENUATION (1<<1) /* a byte */ -#define SND_POS (1<<2) /* three coordinates */ -#define SND_ENT (1<<3) /* a short 0-2: channel, 3-12: entity */ -#define SND_OFFSET (1<<4) /* a byte, msec offset from frame start */ +#define SND_VOLUME (1 << 0) /* a byte */ +#define SND_ATTENUATION (1 << 1) /* a byte */ +#define SND_POS (1 << 2) /* three coordinates */ +#define SND_ENT (1 << 3) /* a short 0-2: channel, 3-12: entity */ +#define SND_OFFSET (1 << 4) /* a byte, msec offset from frame start */ -#define DEFAULT_SOUND_PACKET_VOLUME 1.0 +#define DEFAULT_SOUND_PACKET_VOLUME 1.0 #define DEFAULT_SOUND_PACKET_ATTENUATION 1.0 /*============================================== */ @@ -259,212 +259,237 @@ enum clc_ops_e /* entity_state_t communication */ /* try to pack the common update flags into the first byte */ -#define U_ORIGIN1 (1<<0) -#define U_ORIGIN2 (1<<1) -#define U_ANGLE2 (1<<2) -#define U_ANGLE3 (1<<3) -#define U_FRAME8 (1<<4) /* frame is a byte */ -#define U_EVENT (1<<5) -#define U_REMOVE (1<<6) /* REMOVE this entity, don't add it */ -#define U_MOREBITS1 (1<<7) /* read one additional byte */ +#define U_ORIGIN1 (1 << 0) +#define U_ORIGIN2 (1 << 1) +#define U_ANGLE2 (1 << 2) +#define U_ANGLE3 (1 << 3) +#define U_FRAME8 (1 << 4) /* frame is a byte */ +#define U_EVENT (1 << 5) +#define U_REMOVE (1 << 6) /* REMOVE this entity, don't add it */ +#define U_MOREBITS1 (1 << 7) /* read one additional byte */ /* second byte */ -#define U_NUMBER16 (1<<8) /* NUMBER8 is implicit if not set */ -#define U_ORIGIN3 (1<<9) -#define U_ANGLE1 (1<<10) -#define U_MODEL (1<<11) -#define U_RENDERFX8 (1<<12) /* fullbright, etc */ -#define U_EFFECTS8 (1<<14) /* autorotate, trails, etc */ -#define U_MOREBITS2 (1<<15) /* read one additional byte */ +#define U_NUMBER16 (1 << 8) /* NUMBER8 is implicit if not set */ +#define U_ORIGIN3 (1 << 9) +#define U_ANGLE1 (1 << 10) +#define U_MODEL (1 << 11) +#define U_RENDERFX8 (1 << 12) /* fullbright, etc */ +#define U_EFFECTS8 (1 << 14) /* autorotate, trails, etc */ +#define U_MOREBITS2 (1 << 15) /* read one additional byte */ /* third byte */ -#define U_SKIN8 (1<<16) -#define U_FRAME16 (1<<17) /* frame is a short */ -#define U_RENDERFX16 (1<<18) /* 8 + 16 = 32 */ -#define U_EFFECTS16 (1<<19) /* 8 + 16 = 32 */ -#define U_MODEL2 (1<<20) /* weapons, flags, etc */ -#define U_MODEL3 (1<<21) -#define U_MODEL4 (1<<22) -#define U_MOREBITS3 (1<<23) /* read one additional byte */ +#define U_SKIN8 (1 << 16) +#define U_FRAME16 (1 << 17) /* frame is a short */ +#define U_RENDERFX16 (1 << 18) /* 8 + 16 = 32 */ +#define U_EFFECTS16 (1 << 19) /* 8 + 16 = 32 */ +#define U_MODEL2 (1 << 20) /* weapons, flags, etc */ +#define U_MODEL3 (1 << 21) +#define U_MODEL4 (1 << 22) +#define U_MOREBITS3 (1 << 23) /* read one additional byte */ /* fourth byte */ -#define U_OLDORIGIN (1<<24) -#define U_SKIN16 (1<<25) -#define U_SOUND (1<<26) -#define U_SOLID (1<<27) - +#define U_OLDORIGIN (1 << 24) +#define U_SKIN16 (1 << 25) +#define U_SOUND (1 << 26) +#define U_SOLID (1 << 27) /* CMD - Command text buffering and command execution */ /* -Any number of commands can be added in a frame, from several different -sources. Most commands come from either keybindings or console line -input, but remote servers can also send across commands and entire text -files can be execed. + * Any number of commands can be added in a frame, from several different + * sources. Most commands come from either keybindings or console line + * input, but remote servers can also send across commands and entire text + * files can be execed. + * + * The + command line options are also added to the command buffer. + * + * The game starts with a Cbuf_AddText ("exec quake.rc\n"); Cbuf_Execute + * (); + */ -The + command line options are also added to the command buffer. +#define EXEC_NOW 0 /* don't return until completed */ +#define EXEC_INSERT 1 /* insert at current position, but don't run yet */ +#define EXEC_APPEND 2 /* add to end of the command buffer */ -The game starts with a Cbuf_AddText ("exec quake.rc\n"); Cbuf_Execute -(); -*/ +void Cbuf_Init(void); -#define EXEC_NOW 0 /* don't return until completed */ -#define EXEC_INSERT 1 /* insert at current position, but don't run yet */ -#define EXEC_APPEND 2 /* add to end of the command buffer */ - -void Cbuf_Init (void); /* allocates an initial text buffer that will grow as needed */ -void Cbuf_AddText (char *text); +void Cbuf_AddText(char *text); + /* as new commands are generated from the console or keybindings, */ /* the text is added to the end of the command buffer. */ -void Cbuf_InsertText (char *text); +void Cbuf_InsertText(char *text); + /* when a command wants to issue other commands immediately, the text is */ /* inserted at the beginning of the buffer, before any remaining unexecuted */ /* commands. */ -void Cbuf_ExecuteText (int exec_when, char *text); +void Cbuf_ExecuteText(int exec_when, char *text); + /* this can be used in place of either Cbuf_AddText or Cbuf_InsertText */ -void Cbuf_AddEarlyCommands (qboolean clear); +void Cbuf_AddEarlyCommands(qboolean clear); + /* adds all the +set commands from the command line */ -qboolean Cbuf_AddLateCommands (void); +qboolean Cbuf_AddLateCommands(void); + /* adds all the remaining + commands from the command line */ /* Returns true if any late commands were added, which */ /* will keep the demoloop from immediately starting */ -void Cbuf_Execute (void); +void Cbuf_Execute(void); + /* Pulls off \n terminated lines of text from the command buffer and sends */ /* them through Cmd_ExecuteString. Stops when the buffer is empty. */ /* Normally called once per frame, but may be explicitly invoked. */ /* Do not call inside a command function! */ -void Cbuf_CopyToDefer (void); -void Cbuf_InsertFromDefer (void); +void Cbuf_CopyToDefer(void); +void Cbuf_InsertFromDefer(void); + /* These two functions are used to defer any pending commands while a map */ /* is being loaded */ /*=================================================================== */ /* -Command execution takes a null terminated string, breaks it into tokens, -then searches for a command or variable that matches the first token. -*/ + * Command execution takes a null terminated string, breaks it into tokens, + * then searches for a command or variable that matches the first token. + */ -typedef void (*xcommand_t) (void); +typedef void (*xcommand_t)(void); -void Cmd_Init (void); +void Cmd_Init(void); + +void Cmd_AddCommand(char *cmd_name, xcommand_t function); -void Cmd_AddCommand (char *cmd_name, xcommand_t function); /* called by the init functions of other parts of the program to */ /* register commands and functions to call for them. */ /* The cmd_name is referenced later, so it should not be in temp memory */ /* if function is NULL, the command will be forwarded to the server */ /* as a clc_stringcmd instead of executed locally */ -void Cmd_RemoveCommand (char *cmd_name); +void Cmd_RemoveCommand(char *cmd_name); + +qboolean Cmd_Exists(char *cmd_name); -qboolean Cmd_Exists (char *cmd_name); /* used by the cvar code to check for cvar / command name overlap */ -char *Cmd_CompleteCommand (char *partial); +char *Cmd_CompleteCommand(char *partial); + /* attempts to match a partial command for automatic command line completion */ /* returns NULL if nothing fits */ -int Cmd_Argc (void); -char *Cmd_Argv (int arg); -char *Cmd_Args (void); +int Cmd_Argc(void); +char *Cmd_Argv(int arg); +char *Cmd_Args(void); + /* The functions that execute commands get their parameters with these */ /* functions. Cmd_Argv () will return an empty string, not a NULL */ /* if arg > argc, so string operations are always safe. */ -void Cmd_TokenizeString (char *text, qboolean macroExpand); +void Cmd_TokenizeString(char *text, qboolean macroExpand); + /* Takes a null terminated string. Does not need to be /n terminated. */ /* breaks the string up into arg tokens. */ -void Cmd_ExecuteString (char *text); +void Cmd_ExecuteString(char *text); + /* Parses a single line of text into arguments and tries to execute it */ /* as if it was typed at the console */ -void Cmd_ForwardToServer (void); +void Cmd_ForwardToServer(void); + /* adds the current command line as a clc_stringcmd to the client message. */ /* things like godmode, noclip, etc, are commands directed to the server, */ /* so when they are typed in at the console, they will need to be forwarded. */ - /* CVAR */ /* -cvar_t variables are used to hold scalar or string variables that can be -changed or displayed at the console or prog code as well as accessed -directly in C code. + * cvar_t variables are used to hold scalar or string variables that can be + * changed or displayed at the console or prog code as well as accessed + * directly in C code. + * + * The user can access cvars from the console in three ways: + * r_draworder prints the current value + * r_draworder 0 sets the current value to 0 + * set r_draworder 0 as above, but creates the cvar if not present + * Cvars are restricted from having the same names as commands to keep this + * interface from being ambiguous. + */ -The user can access cvars from the console in three ways: -r_draworder prints the current value -r_draworder 0 sets the current value to 0 -set r_draworder 0 as above, but creates the cvar if not present -Cvars are restricted from having the same names as commands to keep this -interface from being ambiguous. -*/ +extern cvar_t *cvar_vars; -extern cvar_t *cvar_vars; +cvar_t *Cvar_Get(char *var_name, char *value, int flags); -cvar_t *Cvar_Get (char *var_name, char *value, int flags); /* creates the variable if it doesn't exist, or returns the existing one */ /* if it exists, the value will not be changed, but flags will be ORed in */ /* that allows variables to be unarchived without needing bitflags */ -cvar_t *Cvar_Set (char *var_name, char *value); +cvar_t *Cvar_Set(char *var_name, char *value); + /* will create the variable if it doesn't exist */ -cvar_t *Cvar_ForceSet (char *var_name, char *value); +cvar_t *Cvar_ForceSet(char *var_name, char *value); + /* will set the variable even if NOSET or LATCH */ -cvar_t *Cvar_FullSet (char *var_name, char *value, int flags); +cvar_t *Cvar_FullSet(char *var_name, char *value, int flags); + +void Cvar_SetValue(char *var_name, float value); -void Cvar_SetValue (char *var_name, float value); /* expands value to a string and calls Cvar_Set */ -float Cvar_VariableValue (char *var_name); +float Cvar_VariableValue(char *var_name); + /* returns 0 if not defined or non numeric */ -const char *Cvar_VariableString (const char *var_name); +const char *Cvar_VariableString(const char *var_name); + /* returns an empty string if not defined */ -char *Cvar_CompleteVariable (char *partial); +char *Cvar_CompleteVariable(char *partial); + /* attempts to match a partial variable name for command line completion */ /* returns NULL if nothing fits */ -void Cvar_GetLatchedVars (void); +void Cvar_GetLatchedVars(void); + /* any CVAR_LATCHED variables that have been set will now take effect */ -qboolean Cvar_Command (void); +qboolean Cvar_Command(void); + /* called by Cmd_ExecuteString when Cmd_Argv(0) doesn't match a known */ /* command. Returns true if the command was a variable reference that */ /* was handled. (print or change) */ -void Cvar_WriteVariables (char *path); +void Cvar_WriteVariables(char *path); + /* appends lines containing "set variable value" for all variables */ /* with the archive flag set to true. */ -void Cvar_Init (void); +void Cvar_Init(void); + +char *Cvar_Userinfo(void); -char *Cvar_Userinfo (void); /* returns an info string containing all the CVAR_USERINFO cvars */ -char *Cvar_Serverinfo (void); +char *Cvar_Serverinfo(void); + /* returns an info string containing all the CVAR_SERVERINFO cvars */ -extern qboolean userinfo_modified; +extern qboolean userinfo_modified; /* this is set each time a CVAR_USERINFO variable is changed */ /* so that the client knows to send it to the server */ /* NET */ -#define PORT_ANY -1 -#define MAX_MSGLEN 1400 /* max length of a message */ -#define PACKET_HEADER 10 /* two ints and a short */ +#define PORT_ANY -1 +#define MAX_MSGLEN 1400 /* max length of a message */ +#define PACKET_HEADER 10 /* two ints and a short */ typedef enum { @@ -481,144 +506,144 @@ typedef enum {NS_CLIENT, NS_SERVER} netsrc_t; typedef struct { - netadrtype_t type; - byte ip[16]; + netadrtype_t type; + byte ip[16]; unsigned int scope_id; - byte ipx[10]; + byte ipx[10]; - unsigned short port; + unsigned short port; } netadr_t; -void NET_Init (void); -void NET_Shutdown (void); +void NET_Init(void); +void NET_Shutdown(void); -void NET_Config (qboolean multiplayer); +void NET_Config(qboolean multiplayer); -qboolean NET_GetPacket (netsrc_t sock, netadr_t *net_from, sizebuf_t *net_message); -void NET_SendPacket (netsrc_t sock, int length, void *data, netadr_t to); +qboolean NET_GetPacket(netsrc_t sock, netadr_t *net_from, + sizebuf_t *net_message); +void NET_SendPacket(netsrc_t sock, int length, void *data, netadr_t to); -qboolean NET_CompareAdr (netadr_t a, netadr_t b); -qboolean NET_CompareBaseAdr (netadr_t a, netadr_t b); -qboolean NET_IsLocalAddress (netadr_t adr); -char *NET_AdrToString (netadr_t a); -qboolean NET_StringToAdr (char *s, netadr_t *a); -void NET_Sleep(int msec); +qboolean NET_CompareAdr(netadr_t a, netadr_t b); +qboolean NET_CompareBaseAdr(netadr_t a, netadr_t b); +qboolean NET_IsLocalAddress(netadr_t adr); +char *NET_AdrToString(netadr_t a); +qboolean NET_StringToAdr(char *s, netadr_t *a); +void NET_Sleep(int msec); /*=================================================================== */ -#define OLD_AVG 0.99 -#define MAX_LATENT 32 +#define OLD_AVG 0.99 +#define MAX_LATENT 32 typedef struct { - qboolean fatal_error; + qboolean fatal_error; - netsrc_t sock; + netsrc_t sock; - int dropped; /* between last packet and previous */ + int dropped; /* between last packet and previous */ - int last_received; /* for timeouts */ - int last_sent; /* for retransmits */ + int last_received; /* for timeouts */ + int last_sent; /* for retransmits */ - netadr_t remote_address; - int qport; /* qport value to write when transmitting */ + netadr_t remote_address; + int qport; /* qport value to write when transmitting */ /* sequencing variables */ - int incoming_sequence; - int incoming_acknowledged; - int incoming_reliable_acknowledged; /* single bit */ + int incoming_sequence; + int incoming_acknowledged; + int incoming_reliable_acknowledged; /* single bit */ - int incoming_reliable_sequence; /* single bit, maintained local */ + int incoming_reliable_sequence; /* single bit, maintained local */ - int outgoing_sequence; - int reliable_sequence; /* single bit */ - int last_reliable_sequence; /* sequence number of last send */ + int outgoing_sequence; + int reliable_sequence; /* single bit */ + int last_reliable_sequence; /* sequence number of last send */ /* reliable staging and holding areas */ - sizebuf_t message; /* writing buffer to send to server */ - byte message_buf[MAX_MSGLEN-16]; /* leave space for header */ + sizebuf_t message; /* writing buffer to send to server */ + byte message_buf[MAX_MSGLEN - 16]; /* leave space for header */ /* message is copied to this buffer when it is first transfered */ - int reliable_length; - byte reliable_buf[MAX_MSGLEN-16]; /* unacked reliable message */ + int reliable_length; + byte reliable_buf[MAX_MSGLEN - 16]; /* unacked reliable message */ } netchan_t; -extern netadr_t net_from; -extern sizebuf_t net_message; -extern byte net_message_buffer[MAX_MSGLEN]; +extern netadr_t net_from; +extern sizebuf_t net_message; +extern byte net_message_buffer[MAX_MSGLEN]; -void Netchan_Init (void); -void Netchan_Setup (netsrc_t sock, netchan_t *chan, netadr_t adr, int qport); +void Netchan_Init(void); +void Netchan_Setup(netsrc_t sock, netchan_t *chan, netadr_t adr, int qport); -qboolean Netchan_NeedReliable (netchan_t *chan); -void Netchan_Transmit (netchan_t *chan, int length, byte *data); -void Netchan_OutOfBand (int net_socket, netadr_t adr, int length, byte *data); -void Netchan_OutOfBandPrint (int net_socket, netadr_t adr, char *format, ...); -qboolean Netchan_Process (netchan_t *chan, sizebuf_t *msg); +qboolean Netchan_NeedReliable(netchan_t *chan); +void Netchan_Transmit(netchan_t *chan, int length, byte *data); +void Netchan_OutOfBand(int net_socket, netadr_t adr, int length, byte *data); +void Netchan_OutOfBandPrint(int net_socket, netadr_t adr, char *format, ...); +qboolean Netchan_Process(netchan_t *chan, sizebuf_t *msg); -qboolean Netchan_CanReliable (netchan_t *chan); +qboolean Netchan_CanReliable(netchan_t *chan); /* CMODEL */ #include "files.h" -cmodel_t *CM_LoadMap (char *name, qboolean clientload, unsigned *checksum); -cmodel_t *CM_InlineModel (char *name); /* *1, *2, etc */ +cmodel_t *CM_LoadMap(char *name, qboolean clientload, unsigned *checksum); +cmodel_t *CM_InlineModel(char *name); /* *1, *2, etc */ -int CM_NumClusters (void); -int CM_NumInlineModels (void); -char *CM_EntityString (void); +int CM_NumClusters(void); +int CM_NumInlineModels(void); +char *CM_EntityString(void); /* creates a clipping hull for an arbitrary box */ -int CM_HeadnodeForBox (vec3_t mins, vec3_t maxs); +int CM_HeadnodeForBox(vec3_t mins, vec3_t maxs); /* returns an ORed contents mask */ -int CM_PointContents (vec3_t p, int headnode); -int CM_TransformedPointContents (vec3_t p, int headnode, vec3_t origin, vec3_t angles); +int CM_PointContents(vec3_t p, int headnode); +int CM_TransformedPointContents(vec3_t p, int headnode, + vec3_t origin, vec3_t angles); -trace_t CM_BoxTrace (vec3_t start, vec3_t end, - vec3_t mins, vec3_t maxs, - int headnode, int brushmask); -trace_t CM_TransformedBoxTrace (vec3_t start, vec3_t end, - vec3_t mins, vec3_t maxs, - int headnode, int brushmask, - vec3_t origin, vec3_t angles); +trace_t CM_BoxTrace(vec3_t start, vec3_t end, vec3_t mins, + vec3_t maxs, int headnode, int brushmask); +trace_t CM_TransformedBoxTrace(vec3_t start, vec3_t end, + vec3_t mins, vec3_t maxs, int headnode, + int brushmask, vec3_t origin, vec3_t angles); -byte *CM_ClusterPVS (int cluster); -byte *CM_ClusterPHS (int cluster); +byte *CM_ClusterPVS(int cluster); +byte *CM_ClusterPHS(int cluster); -int CM_PointLeafnum (vec3_t p); +int CM_PointLeafnum(vec3_t p); /* call with topnode set to the headnode, returns with topnode */ /* set to the first node that splits the box */ -int CM_BoxLeafnums (vec3_t mins, vec3_t maxs, int *list, - int listsize, int *topnode); +int CM_BoxLeafnums(vec3_t mins, vec3_t maxs, int *list, + int listsize, int *topnode); -int CM_LeafContents (int leafnum); -int CM_LeafCluster (int leafnum); -int CM_LeafArea (int leafnum); +int CM_LeafContents(int leafnum); +int CM_LeafCluster(int leafnum); +int CM_LeafArea(int leafnum); -void CM_SetAreaPortalState (int portalnum, qboolean open); -qboolean CM_AreasConnected (int area1, int area2); +void CM_SetAreaPortalState(int portalnum, qboolean open); +qboolean CM_AreasConnected(int area1, int area2); -int CM_WriteAreaBits (byte *buffer, int area); -qboolean CM_HeadnodeVisible (int headnode, byte *visbits); +int CM_WriteAreaBits(byte *buffer, int area); +qboolean CM_HeadnodeVisible(int headnode, byte *visbits); -void CM_WritePortalState (FILE *f); +void CM_WritePortalState(FILE *f); /* PLAYER MOVEMENT CODE */ extern float pm_airaccelerate; -void Pmove (pmove_t *pmove); +void Pmove(pmove_t *pmove); /* FILESYSTEM */ -#define SFF_INPACK 0x20 +#define SFF_INPACK 0x20 -extern int file_from_pak; +extern int file_from_pak; -typedef int fileHandle_t; +typedef int fileHandle_t; typedef enum { @@ -641,125 +666,126 @@ typedef enum FS_SEARCH_FULL_PATH } fsSearchType_t; -void FS_Startup(void); -void FS_Shutdown(void); -void FS_DPrintf(const char *format,...); -FILE *FS_FileForHandle(fileHandle_t f); -int FS_FOpenFile(const char *name, fileHandle_t * f, fsMode_t mode); -void FS_FCloseFile(fileHandle_t f); -int FS_Read(void *buffer, int size, fileHandle_t f); -int FS_FRead(void *buffer, int size, int count, fileHandle_t f); -int FS_Write(const void *buffer, int size, fileHandle_t f); -void FS_Seek(fileHandle_t f, int offset, fsOrigin_t origin); -int FS_FTell(fileHandle_t f); -int FS_Tell(fileHandle_t f); -qboolean FS_FileExists(char *path); -void FS_CopyFile(const char *srcPath, const char *dstPath); -void FS_RenameFile(const char *oldPath, const char *newPath); -void FS_DeleteFile(const char *path); -int FS_GetFileList(const char *path, const char *extension, char *buffer, int size, fsSearchType_t searchType); -char **FS_ListPak(char *find, int *num); /* Knighmare- pak list function */ -char **FS_ListFiles(char *findname, int *numfiles, unsigned musthave, unsigned canthave); -char **FS_ListFiles2(char *findname, int *numfiles, unsigned musthave, unsigned canthave); -void FS_FreeList(char **list, int nfiles); +void FS_Startup(void); +void FS_Shutdown(void); +void FS_DPrintf(const char *format, ...); +FILE *FS_FileForHandle(fileHandle_t f); +int FS_FOpenFile(const char *name, fileHandle_t *f, fsMode_t mode); +void FS_FCloseFile(fileHandle_t f); +int FS_Read(void *buffer, int size, fileHandle_t f); +int FS_FRead(void *buffer, int size, int count, fileHandle_t f); +int FS_Write(const void *buffer, int size, fileHandle_t f); +void FS_Seek(fileHandle_t f, int offset, fsOrigin_t origin); +int FS_FTell(fileHandle_t f); +int FS_Tell(fileHandle_t f); +qboolean FS_FileExists(char *path); +void FS_CopyFile(const char *srcPath, const char *dstPath); +void FS_RenameFile(const char *oldPath, const char *newPath); +void FS_DeleteFile(const char *path); +int FS_GetFileList(const char *path, const char *extension, + char *buffer, int size, fsSearchType_t searchType); +char **FS_ListPak(char *find, int *num); +char **FS_ListFiles(char *findname, int *numfiles, + unsigned musthave, unsigned canthave); +char **FS_ListFiles2(char *findname, int *numfiles, + unsigned musthave, unsigned canthave); +void FS_FreeList(char **list, int nfiles); -void FS_InitFilesystem(void); -void FS_SetGamedir(char *dir); -char *FS_Gamedir(void); -char *FS_NextPath(char *prevpath); -void FS_ExecAutoexec(void); -int FS_LoadFile(char *path, void **buffer); +void FS_InitFilesystem(void); +void FS_SetGamedir(char *dir); +char *FS_Gamedir(void); +char *FS_NextPath(char *prevpath); +void FS_ExecAutoexec(void); +int FS_LoadFile(char *path, void **buffer); /* a null buffer will just return the file length without loading */ /* a -1 length is not present */ /* properly handles partial reads */ -void FS_FreeFile(void *buffer); - -void FS_CreatePath(char *path); +void FS_FreeFile(void *buffer); +void FS_CreatePath(char *path); /* MISC */ +#define ERR_FATAL 0 /* exit the entire game with a popup window */ +#define ERR_DROP 1 /* print to console and disconnect from game */ +#define ERR_QUIT 2 /* not an error, just a normal exit */ -#define ERR_FATAL 0 /* exit the entire game with a popup window */ -#define ERR_DROP 1 /* print to console and disconnect from game */ -#define ERR_QUIT 2 /* not an error, just a normal exit */ +#define EXEC_NOW 0 /* don't return until completed */ +#define EXEC_INSERT 1 /* insert at current position, but don't run yet */ +#define EXEC_APPEND 2 /* add to end of the command buffer */ -#define EXEC_NOW 0 /* don't return until completed */ -#define EXEC_INSERT 1 /* insert at current position, but don't run yet */ -#define EXEC_APPEND 2 /* add to end of the command buffer */ +#define PRINT_ALL 0 +#define PRINT_DEVELOPER 1 /* only print when "developer 1" */ -#define PRINT_ALL 0 -#define PRINT_DEVELOPER 1 /* only print when "developer 1" */ +void Com_BeginRedirect(int target, char *buffer, int buffersize, void (*flush)); +void Com_EndRedirect(void); +void Com_Printf(char *fmt, ...); +void Com_DPrintf(char *fmt, ...); +void Com_MDPrintf(char *fmt, ...); +void Com_Error(int code, char *fmt, ...); +void Com_Quit(void); -void Com_BeginRedirect (int target, char *buffer, int buffersize, void (*flush)); -void Com_EndRedirect (void); -void Com_Printf (char *fmt, ...); -void Com_DPrintf (char *fmt, ...); -void Com_MDPrintf (char *fmt, ...); -void Com_Error (int code, char *fmt, ...); -void Com_Quit (void); +int Com_ServerState(void); /* this should have just been a cvar... */ +void Com_SetServerState(int state); -int Com_ServerState (void); /* this should have just been a cvar... */ -void Com_SetServerState (int state); +unsigned Com_BlockChecksum(void *buffer, int length); +byte COM_BlockSequenceCRCByte(byte *base, int length, int sequence); -unsigned Com_BlockChecksum (void *buffer, int length); -byte COM_BlockSequenceCRCByte (byte *base, int length, int sequence); +extern cvar_t *developer; +extern cvar_t *modder; +extern cvar_t *dedicated; +extern cvar_t *host_speeds; +extern cvar_t *log_stats; -extern cvar_t *developer; -extern cvar_t *modder; -extern cvar_t *dedicated; -extern cvar_t *host_speeds; -extern cvar_t *log_stats; - -extern FILE *log_stats_file; +extern FILE *log_stats_file; /* host_speeds times */ -extern int time_before_game; -extern int time_after_game; -extern int time_before_ref; -extern int time_after_ref; +extern int time_before_game; +extern int time_after_game; +extern int time_before_ref; +extern int time_after_ref; -void Z_Free (void *ptr); -void *Z_Malloc (int size); /* returns 0 filled memory */ -void *Z_TagMalloc (int size, int tag); -void Z_FreeTags (int tag); +void Z_Free(void *ptr); +void *Z_Malloc(int size); /* returns 0 filled memory */ +void *Z_TagMalloc(int size, int tag); +void Z_FreeTags(int tag); -void Qcommon_Init (int argc, char **argv); -void Qcommon_Frame (int msec); -void Qcommon_Shutdown (void); +void Qcommon_Init(int argc, char **argv); +void Qcommon_Frame(int msec); +void Qcommon_Shutdown(void); -#define NUMVERTEXNORMALS 162 -extern vec3_t bytedirs[NUMVERTEXNORMALS]; +#define NUMVERTEXNORMALS 162 +extern vec3_t bytedirs[NUMVERTEXNORMALS]; /* this is in the client code, but can be used for debugging from server */ -void SCR_DebugGraph (float value, int color); +void SCR_DebugGraph(float value, int color); /* NON-PORTABLE SYSTEM SERVICES */ -void Sys_Init (void); -void Sys_UnloadGame (void); -void *Sys_GetGameAPI (void *parms); +void Sys_Init(void); +void Sys_UnloadGame(void); +void *Sys_GetGameAPI(void *parms); -char *Sys_ConsoleInput (void); -void Sys_ConsoleOutput (char *string); -void Sys_SendKeyEvents (void); -void Sys_Error (char *error, ...); -void Sys_Quit (void); -char *Sys_GetHomeDir(void); +char *Sys_ConsoleInput(void); +void Sys_ConsoleOutput(char *string); +void Sys_SendKeyEvents(void); +void Sys_Error(char *error, ...); +void Sys_Quit(void); +char *Sys_GetHomeDir(void); /* CLIENT / SERVER SYSTEMS */ -void CL_Init (void); -void CL_Drop (void); -void CL_Shutdown (void); -void CL_Frame (int msec); -void Con_Print (char *text); -void SCR_BeginLoadingPlaque (void); +void CL_Init(void); +void CL_Drop(void); +void CL_Shutdown(void); +void CL_Frame(int msec); +void Con_Print(char *text); +void SCR_BeginLoadingPlaque(void); -void SV_Init (void); -void SV_Shutdown (char *finalmsg, qboolean reconnect); -void SV_Frame (int msec); +void SV_Init(void); +void SV_Shutdown(char *finalmsg, qboolean reconnect); +void SV_Frame(int msec); #endif diff --git a/src/common/header/crc.h b/src/common/header/crc.h index 1c988099..6a2c64e2 100644 --- a/src/common/header/crc.h +++ b/src/common/header/crc.h @@ -30,6 +30,6 @@ void CRC_Init(unsigned short *crcvalue); void CRC_ProcessByte(unsigned short *crcvalue, byte data); unsigned short CRC_Value(unsigned short crcvalue); -unsigned short CRC_Block (byte *start, int count); +unsigned short CRC_Block(byte *start, int count); #endif diff --git a/src/common/header/files.h b/src/common/header/files.h index 9963f341..87e1cf30 100644 --- a/src/common/header/files.h +++ b/src/common/header/files.h @@ -29,405 +29,400 @@ /* The .pak files are just a linear collapse of a directory tree */ -#define IDPAKHEADER (('K'<<24)+('C'<<16)+('A'<<8)+'P') +#define IDPAKHEADER (('K' << 24) + ('C' << 16) + ('A' << 8) + 'P') typedef struct { - char name[56]; - int filepos, filelen; + char name[56]; + int filepos, filelen; } dpackfile_t; typedef struct { - int ident; /* == IDPAKHEADER */ - int dirofs; - int dirlen; + int ident; /* == IDPAKHEADER */ + int dirofs; + int dirlen; } dpackheader_t; -#define MAX_FILES_IN_PACK 4096 - +#define MAX_FILES_IN_PACK 4096 /* PCX files are used for as many images as possible */ typedef struct { - char manufacturer; - char version; - char encoding; - char bits_per_pixel; - unsigned short xmin,ymin,xmax,ymax; - unsigned short hres,vres; - unsigned char palette[48]; - char reserved; - char color_planes; - unsigned short bytes_per_line; - unsigned short palette_type; - char filler[58]; - unsigned char data; /* unbounded */ + char manufacturer; + char version; + char encoding; + char bits_per_pixel; + unsigned short xmin, ymin, xmax, ymax; + unsigned short hres, vres; + unsigned char palette[48]; + char reserved; + char color_planes; + unsigned short bytes_per_line; + unsigned short palette_type; + char filler[58]; + unsigned char data; /* unbounded */ } pcx_t; - /* .MD2 triangle model file format */ -#define IDALIASHEADER (('2'<<24)+('P'<<16)+('D'<<8)+'I') -#define ALIAS_VERSION 8 +#define IDALIASHEADER (('2' << 24) + ('P' << 16) + ('D' << 8) + 'I') +#define ALIAS_VERSION 8 -#define MAX_TRIANGLES 4096 -#define MAX_VERTS 2048 -#define MAX_FRAMES 512 -#define MAX_MD2SKINS 32 -#define MAX_SKINNAME 64 +#define MAX_TRIANGLES 4096 +#define MAX_VERTS 2048 +#define MAX_FRAMES 512 +#define MAX_MD2SKINS 32 +#define MAX_SKINNAME 64 typedef struct { - short s; - short t; + short s; + short t; } dstvert_t; typedef struct { - short index_xyz[3]; - short index_st[3]; + short index_xyz[3]; + short index_st[3]; } dtriangle_t; typedef struct { - byte v[3]; /* scaled byte to fit in frame mins/maxs */ - byte lightnormalindex; + byte v[3]; /* scaled byte to fit in frame mins/maxs */ + byte lightnormalindex; } dtrivertx_t; -#define DTRIVERTX_V0 0 -#define DTRIVERTX_V1 1 -#define DTRIVERTX_V2 2 -#define DTRIVERTX_LNI 3 +#define DTRIVERTX_V0 0 +#define DTRIVERTX_V1 1 +#define DTRIVERTX_V2 2 +#define DTRIVERTX_LNI 3 #define DTRIVERTX_SIZE 4 typedef struct { - float scale[3]; /* multiply byte verts by this */ - float translate[3]; /* then add this */ - char name[16]; /* frame name from grabbing */ - dtrivertx_t verts[1]; /* variable sized */ + float scale[3]; /* multiply byte verts by this */ + float translate[3]; /* then add this */ + char name[16]; /* frame name from grabbing */ + dtrivertx_t verts[1]; /* variable sized */ } daliasframe_t; /* the glcmd format: - - a positive integer starts a tristrip command, followed by that many - vertex structures. - - a negative integer starts a trifan command, followed by -x vertexes - a zero indicates the end of the command list. - - a vertex consists of a floating point s, a floating point t, - and an integer vertex index. */ + * - a positive integer starts a tristrip command, followed by that many + * vertex structures. + * - a negative integer starts a trifan command, followed by -x vertexes + * a zero indicates the end of the command list. + * - a vertex consists of a floating point s, a floating point t, + * and an integer vertex index. */ typedef struct { - int ident; - int version; + int ident; + int version; - int skinwidth; - int skinheight; - int framesize; /* byte size of each frame */ + int skinwidth; + int skinheight; + int framesize; /* byte size of each frame */ - int num_skins; - int num_xyz; - int num_st; /* greater than num_xyz for seams */ - int num_tris; - int num_glcmds; /* dwords in strip/fan command list */ - int num_frames; - - int ofs_skins; /* each skin is a MAX_SKINNAME string */ - int ofs_st; /* byte offset from start for stverts */ - int ofs_tris; /* offset for dtriangles */ - int ofs_frames; /* offset for first frame */ - int ofs_glcmds; - int ofs_end; /* end of file */ + int num_skins; + int num_xyz; + int num_st; /* greater than num_xyz for seams */ + int num_tris; + int num_glcmds; /* dwords in strip/fan command list */ + int num_frames; + int ofs_skins; /* each skin is a MAX_SKINNAME string */ + int ofs_st; /* byte offset from start for stverts */ + int ofs_tris; /* offset for dtriangles */ + int ofs_frames; /* offset for first frame */ + int ofs_glcmds; + int ofs_end; /* end of file */ } dmdl_t; /* .SP2 sprite file format */ -#define IDSPRITEHEADER (('2'<<24)+('S'<<16)+('D'<<8)+'I') /* little-endian "IDS2" */ -#define SPRITE_VERSION 2 +#define IDSPRITEHEADER (('2' << 24) + ('S' << 16) + ('D' << 8) + 'I') /* little-endian "IDS2" */ +#define SPRITE_VERSION 2 typedef struct { - int width, height; - int origin_x, origin_y; /* raster coordinates inside pic */ - char name[MAX_SKINNAME]; /* name of pcx file */ + int width, height; + int origin_x, origin_y; /* raster coordinates inside pic */ + char name[MAX_SKINNAME]; /* name of pcx file */ } dsprframe_t; typedef struct { - int ident; - int version; - int numframes; - dsprframe_t frames[1]; /* variable sized */ + int ident; + int version; + int numframes; + dsprframe_t frames[1]; /* variable sized */ } dsprite_t; /* .WAL texture file format */ -#define MIPLEVELS 4 +#define MIPLEVELS 4 typedef struct miptex_s { - char name[32]; - unsigned width, height; - unsigned offsets[MIPLEVELS]; /* four mip maps stored */ - char animname[32]; /* next frame in animation chain */ - int flags; - int contents; - int value; + char name[32]; + unsigned width, height; + unsigned offsets[MIPLEVELS]; /* four mip maps stored */ + char animname[32]; /* next frame in animation chain */ + int flags; + int contents; + int value; } miptex_t; /* .BSP file format */ -#define IDBSPHEADER (('P'<<24)+('S'<<16)+('B'<<8)+'I') /* little-endian "IBSP" */ -#define BSPVERSION 38 +#define IDBSPHEADER (('P' << 24) + ('S' << 16) + ('B' << 8) + 'I') /* little-endian "IBSP" */ +#define BSPVERSION 38 -/* upper design bounds */ -/* leaffaces, leafbrushes, planes, and verts are still bounded by */ -/* 16 bit short limits */ -#define MAX_MAP_MODELS 1024 -#define MAX_MAP_BRUSHES 8192 -#define MAX_MAP_ENTITIES 2048 -#define MAX_MAP_ENTSTRING 0x40000 -#define MAX_MAP_TEXINFO 8192 +/* upper design bounds: leaffaces, leafbrushes, planes, and + * verts are still bounded by 16 bit short limits */ +#define MAX_MAP_MODELS 1024 +#define MAX_MAP_BRUSHES 8192 +#define MAX_MAP_ENTITIES 2048 +#define MAX_MAP_ENTSTRING 0x40000 +#define MAX_MAP_TEXINFO 8192 -#define MAX_MAP_AREAS 256 -#define MAX_MAP_AREAPORTALS 1024 -#define MAX_MAP_PLANES 65536 -#define MAX_MAP_NODES 65536 -#define MAX_MAP_BRUSHSIDES 65536 -#define MAX_MAP_LEAFS 65536 -#define MAX_MAP_VERTS 65536 -#define MAX_MAP_FACES 65536 -#define MAX_MAP_LEAFFACES 65536 -#define MAX_MAP_LEAFBRUSHES 65536 -#define MAX_MAP_PORTALS 65536 -#define MAX_MAP_EDGES 128000 -#define MAX_MAP_SURFEDGES 256000 -#define MAX_MAP_LIGHTING 0x200000 -#define MAX_MAP_VISIBILITY 0x100000 +#define MAX_MAP_AREAS 256 +#define MAX_MAP_AREAPORTALS 1024 +#define MAX_MAP_PLANES 65536 +#define MAX_MAP_NODES 65536 +#define MAX_MAP_BRUSHSIDES 65536 +#define MAX_MAP_LEAFS 65536 +#define MAX_MAP_VERTS 65536 +#define MAX_MAP_FACES 65536 +#define MAX_MAP_LEAFFACES 65536 +#define MAX_MAP_LEAFBRUSHES 65536 +#define MAX_MAP_PORTALS 65536 +#define MAX_MAP_EDGES 128000 +#define MAX_MAP_SURFEDGES 256000 +#define MAX_MAP_LIGHTING 0x200000 +#define MAX_MAP_VISIBILITY 0x100000 /* key / value pair sizes */ -#define MAX_KEY 32 -#define MAX_VALUE 1024 +#define MAX_KEY 32 +#define MAX_VALUE 1024 /* ================================================================== */ typedef struct { - int fileofs, filelen; + int fileofs, filelen; } lump_t; -#define LUMP_ENTITIES 0 -#define LUMP_PLANES 1 -#define LUMP_VERTEXES 2 -#define LUMP_VISIBILITY 3 -#define LUMP_NODES 4 -#define LUMP_TEXINFO 5 -#define LUMP_FACES 6 -#define LUMP_LIGHTING 7 -#define LUMP_LEAFS 8 -#define LUMP_LEAFFACES 9 -#define LUMP_LEAFBRUSHES 10 -#define LUMP_EDGES 11 -#define LUMP_SURFEDGES 12 -#define LUMP_MODELS 13 -#define LUMP_BRUSHES 14 -#define LUMP_BRUSHSIDES 15 -#define LUMP_POP 16 -#define LUMP_AREAS 17 -#define LUMP_AREAPORTALS 18 -#define HEADER_LUMPS 19 +#define LUMP_ENTITIES 0 +#define LUMP_PLANES 1 +#define LUMP_VERTEXES 2 +#define LUMP_VISIBILITY 3 +#define LUMP_NODES 4 +#define LUMP_TEXINFO 5 +#define LUMP_FACES 6 +#define LUMP_LIGHTING 7 +#define LUMP_LEAFS 8 +#define LUMP_LEAFFACES 9 +#define LUMP_LEAFBRUSHES 10 +#define LUMP_EDGES 11 +#define LUMP_SURFEDGES 12 +#define LUMP_MODELS 13 +#define LUMP_BRUSHES 14 +#define LUMP_BRUSHSIDES 15 +#define LUMP_POP 16 +#define LUMP_AREAS 17 +#define LUMP_AREAPORTALS 18 +#define HEADER_LUMPS 19 typedef struct { - int ident; - int version; - lump_t lumps[HEADER_LUMPS]; + int ident; + int version; + lump_t lumps[HEADER_LUMPS]; } dheader_t; typedef struct { - float mins[3], maxs[3]; - float origin[3]; /* for sounds or lights */ - int headnode; - int firstface, numfaces; /* submodels just draw faces */ - /* without walking the bsp tree */ + float mins[3], maxs[3]; + float origin[3]; /* for sounds or lights */ + int headnode; + int firstface, numfaces; /* submodels just draw faces without + walking the bsp tree */ } dmodel_t; - typedef struct { - float point[3]; + float point[3]; } dvertex_t; - /* 0-2 are axial planes */ -#define PLANE_X 0 -#define PLANE_Y 1 -#define PLANE_Z 2 +#define PLANE_X 0 +#define PLANE_Y 1 +#define PLANE_Z 2 /* 3-5 are non-axial planes snapped to the nearest */ -#define PLANE_ANYX 3 -#define PLANE_ANYY 4 -#define PLANE_ANYZ 5 +#define PLANE_ANYX 3 +#define PLANE_ANYY 4 +#define PLANE_ANYZ 5 /* planes (x&~1) and (x&~1)+1 are always opposites */ typedef struct { - float normal[3]; - float dist; - int type; /* PLANE_X - PLANE_ANYZ */ + float normal[3]; + float dist; + int type; /* PLANE_X - PLANE_ANYZ */ } dplane_t; - /* contents flags are seperate bits - - given brush can contribute multiple content bits - - multiple brushes can be in a single leaf */ + * - given brush can contribute multiple content bits + * - multiple brushes can be in a single leaf */ /* lower bits are stronger, and will eat weaker brushes completely */ -#define CONTENTS_SOLID 1 /* an eye is never valid in a solid */ -#define CONTENTS_WINDOW 2 /* translucent, but not watery */ -#define CONTENTS_AUX 4 -#define CONTENTS_LAVA 8 -#define CONTENTS_SLIME 16 -#define CONTENTS_WATER 32 -#define CONTENTS_MIST 64 -#define LAST_VISIBLE_CONTENTS 64 +#define CONTENTS_SOLID 1 /* an eye is never valid in a solid */ +#define CONTENTS_WINDOW 2 /* translucent, but not watery */ +#define CONTENTS_AUX 4 +#define CONTENTS_LAVA 8 +#define CONTENTS_SLIME 16 +#define CONTENTS_WATER 32 +#define CONTENTS_MIST 64 +#define LAST_VISIBLE_CONTENTS 64 /* remaining contents are non-visible, and don't eat brushes */ -#define CONTENTS_AREAPORTAL 0x8000 +#define CONTENTS_AREAPORTAL 0x8000 -#define CONTENTS_PLAYERCLIP 0x10000 -#define CONTENTS_MONSTERCLIP 0x20000 +#define CONTENTS_PLAYERCLIP 0x10000 +#define CONTENTS_MONSTERCLIP 0x20000 /* currents can be added to any other contents, and may be mixed */ -#define CONTENTS_CURRENT_0 0x40000 -#define CONTENTS_CURRENT_90 0x80000 -#define CONTENTS_CURRENT_180 0x100000 -#define CONTENTS_CURRENT_270 0x200000 -#define CONTENTS_CURRENT_UP 0x400000 -#define CONTENTS_CURRENT_DOWN 0x800000 +#define CONTENTS_CURRENT_0 0x40000 +#define CONTENTS_CURRENT_90 0x80000 +#define CONTENTS_CURRENT_180 0x100000 +#define CONTENTS_CURRENT_270 0x200000 +#define CONTENTS_CURRENT_UP 0x400000 +#define CONTENTS_CURRENT_DOWN 0x800000 -#define CONTENTS_ORIGIN 0x1000000 /* removed before bsping an entity */ +#define CONTENTS_ORIGIN 0x1000000 /* removed before bsping an entity */ -#define CONTENTS_MONSTER 0x2000000 /* should never be on a brush, only in game */ -#define CONTENTS_DEADMONSTER 0x4000000 -#define CONTENTS_DETAIL 0x8000000 /* brushes to be added after vis leafs */ -#define CONTENTS_TRANSLUCENT 0x10000000 /* auto set if any surface has trans */ -#define CONTENTS_LADDER 0x20000000 +#define CONTENTS_MONSTER 0x2000000 /* should never be on a brush, only in game */ +#define CONTENTS_DEADMONSTER 0x4000000 +#define CONTENTS_DETAIL 0x8000000 /* brushes to be added after vis leafs */ +#define CONTENTS_TRANSLUCENT 0x10000000 /* auto set if any surface has trans */ +#define CONTENTS_LADDER 0x20000000 -#define SURF_LIGHT 0x1 /* value will hold the light strength */ +#define SURF_LIGHT 0x1 /* value will hold the light strength */ -#define SURF_SLICK 0x2 /* effects game physics */ +#define SURF_SLICK 0x2 /* effects game physics */ -#define SURF_SKY 0x4 /* don't draw, but add to skybox */ -#define SURF_WARP 0x8 /* turbulent water warp */ -#define SURF_TRANS33 0x10 -#define SURF_TRANS66 0x20 -#define SURF_FLOWING 0x40 /* scroll towards angle */ -#define SURF_NODRAW 0x80 /* don't bother referencing the texture */ +#define SURF_SKY 0x4 /* don't draw, but add to skybox */ +#define SURF_WARP 0x8 /* turbulent water warp */ +#define SURF_TRANS33 0x10 +#define SURF_TRANS66 0x20 +#define SURF_FLOWING 0x40 /* scroll towards angle */ +#define SURF_NODRAW 0x80 /* don't bother referencing the texture */ typedef struct { - int planenum; - int children[2]; /* negative numbers are -(leafs+1), not nodes */ - short mins[3]; /* for frustom culling */ - short maxs[3]; - unsigned short firstface; - unsigned short numfaces; /* counting both sides */ + int planenum; + int children[2]; /* negative numbers are -(leafs+1), not nodes */ + short mins[3]; /* for frustom culling */ + short maxs[3]; + unsigned short firstface; + unsigned short numfaces; /* counting both sides */ } dnode_t; typedef struct texinfo_s { - float vecs[2][4]; /* [s/t][xyz offset] */ - int flags; /* miptex flags + overrides */ - int value; /* light emission, etc */ - char texture[32]; /* texture name (textures*.wal) */ - int nexttexinfo; /* for animations, -1 = end of chain */ + float vecs[2][4]; /* [s/t][xyz offset] */ + int flags; /* miptex flags + overrides light emission, etc */ + int value; + char texture[32]; /* texture name (textures*.wal) */ + int nexttexinfo; /* for animations, -1 = end of chain */ } texinfo_t; -/* note that edge 0 is never used, because negative edge nums are used for */ -/* counterclockwise use of the edge in a face */ +/* note that edge 0 is never used, because negative edge + nums are used for counterclockwise use of the edge in + a face */ typedef struct { - unsigned short v[2]; /* vertex numbers */ + unsigned short v[2]; /* vertex numbers */ } dedge_t; -#define MAXLIGHTMAPS 4 +#define MAXLIGHTMAPS 4 typedef struct { - unsigned short planenum; - short side; + unsigned short planenum; + short side; - int firstedge; /* we must support > 64k edges */ - short numedges; - short texinfo; + int firstedge; /* we must support > 64k edges */ + short numedges; + short texinfo; /* lighting info */ - byte styles[MAXLIGHTMAPS]; - int lightofs; /* start of [numstyles*surfsize] samples */ + byte styles[MAXLIGHTMAPS]; + int lightofs; /* start of [numstyles*surfsize] samples */ } dface_t; typedef struct { - int contents; /* OR of all brushes (not needed?) */ + int contents; /* OR of all brushes (not needed?) */ - short cluster; - short area; + short cluster; + short area; - short mins[3]; /* for frustum culling */ - short maxs[3]; + short mins[3]; /* for frustum culling */ + short maxs[3]; - unsigned short firstleafface; - unsigned short numleaffaces; + unsigned short firstleafface; + unsigned short numleaffaces; - unsigned short firstleafbrush; - unsigned short numleafbrushes; + unsigned short firstleafbrush; + unsigned short numleafbrushes; } dleaf_t; typedef struct { - unsigned short planenum; /* facing out of the leaf */ - short texinfo; + unsigned short planenum; /* facing out of the leaf */ + short texinfo; } dbrushside_t; typedef struct { - int firstside; - int numsides; - int contents; + int firstside; + int numsides; + int contents; } dbrush_t; -#define ANGLE_UP -1 -#define ANGLE_DOWN -2 +#define ANGLE_UP -1 +#define ANGLE_DOWN -2 -/* the visibility lump consists of a header with a count, then */ -/* byte offsets for the PVS and PHS of each cluster, then the raw */ -/* compressed bit vectors */ -#define DVIS_PVS 0 -#define DVIS_PHS 1 +/* the visibility lump consists of a header with a count, then + * byte offsets for the PVS and PHS of each cluster, then the raw + * compressed bit vectors */ +#define DVIS_PVS 0 +#define DVIS_PHS 1 typedef struct { - int numclusters; - int bitofs[8][2]; /* bitofs[numclusters][2] */ + int numclusters; + int bitofs[8][2]; /* bitofs[numclusters][2] */ } dvis_t; -/* each area has a list of portals that lead into other areas */ -/* when portals are closed, other areas may not be visible or */ -/* hearable even if the vis info says that it should be */ +/* each area has a list of portals that lead into other areas + * when portals are closed, other areas may not be visible or + * hearable even if the vis info says that it should be */ typedef struct { - int portalnum; - int otherarea; + int portalnum; + int otherarea; } dareaportal_t; typedef struct { - int numareaportals; - int firstareaportal; + int numareaportals; + int firstareaportal; } darea_t; #endif + diff --git a/src/common/header/glob.h b/src/common/header/glob.h index 11d38587..1b8240bc 100644 --- a/src/common/header/glob.h +++ b/src/common/header/glob.h @@ -27,6 +27,6 @@ #ifndef UNIX_GLOB_H #define UNIX_GLOB_H -int glob_match ( char *pattern, char *text ); +int glob_match(char *pattern, char *text); #endif diff --git a/src/common/header/shared.h b/src/common/header/shared.h index 32daa2b7..2e5da573 100644 --- a/src/common/header/shared.h +++ b/src/common/header/shared.h @@ -55,14 +55,12 @@ typedef enum {false, true} qboolean; #define MAX_QPATH 64 /* max length of a quake game pathname */ #ifdef _WIN32 -#define MAX_OSPATH 256 /* max length of a filesystem pathname (same as MAX_PATH) */ + #define MAX_OSPATH 256 /* max length of a filesystem pathname (same as MAX_PATH) */ #else -#define MAX_OSPATH 128 /* max length of a filesystem pathname */ + #define MAX_OSPATH 128 /* max length of a filesystem pathname */ #endif -/* */ /* per-level limits */ -/* */ #define MAX_CLIENTS 256 /* absolute limit */ #define MAX_EDICTS 1024 /* must change protocol to increase more */ #define MAX_LIGHTSTYLES 256 @@ -128,10 +126,12 @@ extern vec3_t vec3_origin; #define Q_ftol(f) (long)(f) #define DotProduct(x, y) (x[0] * y[0] + x[1] * y[1] + x[2] * y[2]) -#define VectorSubtract(a, b, c) (c[0] = a[0] - b[0], c[1] = a[1] - b[1], c[2] = \ - a[2] - b[2]) -#define VectorAdd(a, b, c) (c[0] = a[0] + b[0], c[1] = a[1] + b[1], c[2] = \ - a[2] + b[2]) +#define VectorSubtract(a, b, c) \ + (c[0] = a[0] - b[0], c[1] = a[1] - b[1], c[2] = \ + a[2] - b[2]) +#define VectorAdd(a, b, c) \ + (c[0] = a[0] + b[0], c[1] = a[1] + b[1], c[2] = \ + a[2] + b[2]) #define VectorCopy(a, b) (b[0] = a[0], b[1] = a[1], b[2] = a[2]) #define VectorClear(a) (a[0] = a[1] = a[2] = 0) #define VectorNegate(a, b) (b[0] = -a[0], b[1] = -a[1], b[2] = -a[2]) @@ -183,8 +183,10 @@ float LerpAngle(float a1, float a2, float frac); void ProjectPointOnPlane(vec3_t dst, const vec3_t p, const vec3_t normal); void PerpendicularVector(vec3_t dst, const vec3_t src); -void RotatePointAroundVector(vec3_t dst, const vec3_t dir, - const vec3_t point, float degrees); +void RotatePointAroundVector(vec3_t dst, + const vec3_t dir, + const vec3_t point, + float degrees); /* ============================================= */ @@ -201,7 +203,7 @@ void Com_sprintf(char *dest, int size, char *fmt, ...); void Com_PageInMemory(byte *buffer, int size); -char *strlwr ( char *s ); +char *strlwr(char *s); /* ============================================= */ @@ -237,7 +239,7 @@ qboolean Info_Validate(char *s); /* ============================================= */ /* Random number generator */ -int randk(void); +int randk(void); float frandk(void); float crandk(void); void randk_seed(void); @@ -364,19 +366,23 @@ typedef struct cvar_s /* content masks */ #define MASK_ALL (-1) #define MASK_SOLID (CONTENTS_SOLID | CONTENTS_WINDOW) -#define MASK_PLAYERSOLID (CONTENTS_SOLID | CONTENTS_PLAYERCLIP | \ - CONTENTS_WINDOW | CONTENTS_MONSTER) +#define MASK_PLAYERSOLID \ + (CONTENTS_SOLID | CONTENTS_PLAYERCLIP | \ + CONTENTS_WINDOW | CONTENTS_MONSTER) #define MASK_DEADSOLID (CONTENTS_SOLID | CONTENTS_PLAYERCLIP | CONTENTS_WINDOW) -#define MASK_MONSTERSOLID (CONTENTS_SOLID | CONTENTS_MONSTERCLIP | \ - CONTENTS_WINDOW | CONTENTS_MONSTER) +#define MASK_MONSTERSOLID \ + (CONTENTS_SOLID | CONTENTS_MONSTERCLIP | \ + CONTENTS_WINDOW | CONTENTS_MONSTER) #define MASK_WATER (CONTENTS_WATER | CONTENTS_LAVA | CONTENTS_SLIME) #define MASK_OPAQUE (CONTENTS_SOLID | CONTENTS_SLIME | CONTENTS_LAVA) -#define MASK_SHOT (CONTENTS_SOLID | CONTENTS_MONSTER | CONTENTS_WINDOW | \ - CONTENTS_DEADMONSTER) -#define MASK_CURRENT (CONTENTS_CURRENT_0 | CONTENTS_CURRENT_90 | \ - CONTENTS_CURRENT_180 | CONTENTS_CURRENT_270 | \ - CONTENTS_CURRENT_UP | \ - CONTENTS_CURRENT_DOWN) +#define MASK_SHOT \ + (CONTENTS_SOLID | CONTENTS_MONSTER | CONTENTS_WINDOW | \ + CONTENTS_DEADMONSTER) +#define MASK_CURRENT \ + (CONTENTS_CURRENT_0 | CONTENTS_CURRENT_90 | \ + CONTENTS_CURRENT_180 | CONTENTS_CURRENT_270 | \ + CONTENTS_CURRENT_UP | \ + CONTENTS_CURRENT_DOWN) /* gi.BoxEdicts() can return a list of either solid or trigger entities */ #define AREA_SOLID 1 @@ -458,10 +464,10 @@ typedef enum #define PMF_NO_PREDICTION 64 /* temporarily disables prediction (used for grappling hook) */ /* this structure needs to be communicated bit-accurate/ - from the server to the client to guarantee that - prediction stays in sync, so no floats are used. - if any part of the game code modifies this struct, it - will result in a prediction error of some degree. */ + * from the server to the client to guarantee that + * prediction stays in sync, so no floats are used. + * if any part of the game code modifies this struct, it + * will result in a prediction error of some degree. */ typedef struct { pmtype_t pm_type; @@ -472,7 +478,7 @@ typedef struct byte pm_time; /* each unit = 8 ms */ short gravity; short delta_angles[3]; /* add to command angles to get view direction - changed by spawns, rotating objects, and teleporters */ + * changed by spawns, rotating objects, and teleporters */ } pmove_state_t; /* button bits */ @@ -520,10 +526,10 @@ typedef struct } pmove_t; /* entity_state_t->effects - Effects are things handled on the client side (lights, particles, - frame animations) that happen constantly on the given entity. - An entity that has effects will be sent to the client even if - it has a zero index model. */ + * Effects are things handled on the client side (lights, particles, + * frame animations) that happen constantly on the given entity. + * An entity that has effects will be sent to the client even if + * it has a zero index model. */ #define EF_ROTATE 0x00000001 /* rotate (bonus items) */ #define EF_GIB 0x00000002 /* leave a trail */ #define EF_BLASTER 0x00000008 /* redlight + trail */ @@ -844,9 +850,9 @@ typedef struct extern vec3_t monster_flash_offset[]; /* Temp entity events are for things that happen - at a location seperate from any existing entity. - Temporary entity messages are explicitly constructed - and broadcast. */ + * at a location seperate from any existing entity. + * Temporary entity messages are explicitly constructed + * and broadcast. */ typedef enum { TE_GUNSHOT, @@ -916,9 +922,9 @@ typedef enum #define SPLASH_BLOOD 6 /* sound channels: - channel 0 never willingly overrides - other channels (1-7) allways override - a playing sound on that channel */ + * channel 0 never willingly overrides + * other channels (1-7) allways override + * a playing sound on that channel */ #define CHAN_AUTO 0 #define CHAN_WEAPON 1 #define CHAN_VOICE 2 @@ -993,8 +999,8 @@ typedef enum #define SHORT2ANGLE(x) ((x) * (360.0 / 65536)) /* config strings are a general means of communication from - the server to all connected clients. Each config string - can be at most MAX_QPATH characters. */ + * the server to all connected clients. Each config string + * can be at most MAX_QPATH characters. */ #define CS_NAME 0 #define CS_CDTRACK 1 #define CS_SKY 2 @@ -1018,9 +1024,9 @@ typedef enum /* ============================================== */ /* entity_state_t->event values - entity events are for effects that take place reletive - to an existing entities origin. Very network efficient. - All muzzle flashes really should be converted to events... */ + * entity events are for effects that take place reletive + * to an existing entities origin. Very network efficient. + * All muzzle flashes really should be converted to events... */ typedef enum { EV_NONE, @@ -1034,8 +1040,8 @@ typedef enum } entity_event_t; /* entity_state_t is the information conveyed from the server - in an update message about entities that the client will - need to render in some way */ + * in an update message about entities that the client will + * need to render in some way */ typedef struct entity_state_s { int number; /* edict index */ @@ -1061,9 +1067,9 @@ typedef struct entity_state_s /* ============================================== */ /* player_state_t is the information needed in addition to pmove_state_t - to rendered a view. There will only be 10 player_state_t sent each second, - but the number of pmove_state_t changes will be reletive to client - frame rates */ + * to rendered a view. There will only be 10 player_state_t sent each second, + * but the number of pmove_state_t changes will be reletive to client + * frame rates */ typedef struct { pmove_state_t pmove; /* for prediction */ diff --git a/src/common/md4.c b/src/common/md4.c index a0dd8ad5..86f358c3 100644 --- a/src/common/md4.c +++ b/src/common/md4.c @@ -8,23 +8,26 @@ #include -#define ROTATELEFT32(x, s) (((x)<<(s))|((x)>>(32-(s)))) +#define ROTATELEFT32(x, s) (((x) << (s)) | ((x) >> (32 - (s)))) -#define F(X, Y, Z) (((X)&(Y)) | ((~X)&(Z))) -#define G(X, Y, Z) (((X)&(Y)) | ((X)&(Z)) | ((Y)&(Z))) -#define H(X, Y, Z) ((X) ^ (Y) ^ (Z)) +#define F(X, Y, Z) (((X)&(Y)) | ((~X) & (Z))) +#define G(X, Y, Z) (((X)&(Y)) | ((X)&(Z)) | ((Y)&(Z))) +#define H(X, Y, Z) ((X) ^ (Y) ^ (Z)) -#define S(a, b, c, d, k, s) { \ +#define S(a, b, c, d, k, s) \ + { \ a += (F((b), (c), (d)) + X[(k)]); \ - a = ROTATELEFT32(a, s); \ + a = ROTATELEFT32(a, s); \ } -#define T(a, b, c, d, k, s) { \ +#define T(a, b, c, d, k, s) \ + { \ a += (G((b), (c), (d)) + X[(k)] + 0x5A827999); \ - a = ROTATELEFT32(a, s); \ + a = ROTATELEFT32(a, s); \ } -#define U(a, b, c, d, k, s) { \ +#define U(a, b, c, d, k, s) \ + { \ a += (H((b), (c), (d)) + X[(k)] + 0x6ED9EBA1); \ - a = ROTATELEFT32(a, s); \ + a = ROTATELEFT32(a, s); \ } static uint32_t X[16]; @@ -33,62 +36,63 @@ static uint32_t B, BB; static uint32_t C, CC; static uint32_t D, DD; -static void DoMD4() +static void +DoMD4() { AA = A; BB = B; CC = C; DD = D; - S(A, B, C, D, 0, 3); - S(D, A, B, C, 1, 7); - S(C, D, A, B, 2, 11); - S(B, C, D, A, 3, 19); - S(A, B, C, D, 4, 3); - S(D, A, B, C, 5, 7); - S(C, D, A, B, 6, 11); - S(B, C, D, A, 7, 19); - S(A, B, C, D, 8, 3); - S(D, A, B, C, 9, 7); + S(A, B, C, D, 0, 3); + S(D, A, B, C, 1, 7); + S(C, D, A, B, 2, 11); + S(B, C, D, A, 3, 19); + S(A, B, C, D, 4, 3); + S(D, A, B, C, 5, 7); + S(C, D, A, B, 6, 11); + S(B, C, D, A, 7, 19); + S(A, B, C, D, 8, 3); + S(D, A, B, C, 9, 7); S(C, D, A, B, 10, 11); S(B, C, D, A, 11, 19); - S(A, B, C, D, 12, 3); - S(D, A, B, C, 13, 7); + S(A, B, C, D, 12, 3); + S(D, A, B, C, 13, 7); S(C, D, A, B, 14, 11); S(B, C, D, A, 15, 19); - T(A, B, C, D, 0, 3); - T(D, A, B, C, 4, 5); - T(C, D, A, B, 8, 9); + T(A, B, C, D, 0, 3); + T(D, A, B, C, 4, 5); + T(C, D, A, B, 8, 9); T(B, C, D, A, 12, 13); - T(A, B, C, D, 1, 3); - T(D, A, B, C, 5, 5); - T(C, D, A, B, 9, 9); + T(A, B, C, D, 1, 3); + T(D, A, B, C, 5, 5); + T(C, D, A, B, 9, 9); T(B, C, D, A, 13, 13); - T(A, B, C, D, 2, 3); - T(D, A, B, C, 6, 5); - T(C, D, A, B, 10, 9); + T(A, B, C, D, 2, 3); + T(D, A, B, C, 6, 5); + T(C, D, A, B, 10, 9); T(B, C, D, A, 14, 13); - T(A, B, C, D, 3, 3); - T(D, A, B, C, 7, 5); - T(C, D, A, B, 11, 9); + T(A, B, C, D, 3, 3); + T(D, A, B, C, 7, 5); + T(C, D, A, B, 11, 9); T(B, C, D, A, 15, 13); - U(A, B, C, D, 0, 3); - U(D, A, B, C, 8, 9); - U(C, D, A, B, 4, 11); + U(A, B, C, D, 0, 3); + U(D, A, B, C, 8, 9); + U(C, D, A, B, 4, 11); U(B, C, D, A, 12, 15); - U(A, B, C, D, 2, 3); - U(D, A, B, C, 10, 9); - U(C, D, A, B, 6, 11); + U(A, B, C, D, 2, 3); + U(D, A, B, C, 10, 9); + U(C, D, A, B, 6, 11); U(B, C, D, A, 14, 15); - U(A, B, C, D, 1, 3); - U(D, A, B, C, 9, 9); - U(C, D, A, B, 5, 11); + U(A, B, C, D, 1, 3); + U(D, A, B, C, 9, 9); + U(C, D, A, B, 5, 11); U(B, C, D, A, 13, 15); - U(A, B, C, D, 3, 3); - U(D, A, B, C, 11, 9); - U(C, D, A, B, 7, 11); + U(A, B, C, D, 3, 3); + U(D, A, B, C, 11, 9); + U(C, D, A, B, 7, 11); U(B, C, D, A, 15, 15); A += AA; @@ -97,7 +101,8 @@ static void DoMD4() D += DD; } -static void PerformMD4(const unsigned char *buf, int length, unsigned char *digest) +static void +PerformMD4(const unsigned char *buf, int length, unsigned char *digest) { int len = length / 64; /* number of full blocks */ int rem = length % 64; /* number of left over bytes */ @@ -115,8 +120,8 @@ static void PerformMD4(const unsigned char *buf, int length, unsigned char *dige { for (j = 0; j < 16; j++) { - X[j] = ((ptr[0]<< 0)|(ptr[1]<< 8)| - (ptr[2]<<16)|(ptr[3]<<24)); + X[j] = ((ptr[0] << 0) | (ptr[1] << 8) | + (ptr[2] << 16) | (ptr[3] << 24)); ptr += 4; } @@ -128,25 +133,27 @@ static void PerformMD4(const unsigned char *buf, int length, unsigned char *dige for (j = 0; j < i; j++) { - X[j] = ((ptr[0]<< 0)|(ptr[1]<< 8)| - (ptr[2]<<16)|(ptr[3]<<24)); + X[j] = ((ptr[0] << 0) | (ptr[1] << 8) | + (ptr[2] << 16) | (ptr[3] << 24)); ptr += 4; } - switch(rem % 4) + switch (rem % 4) { case 0: X[j] = 0x80U; break; case 1: - X[j] = ((ptr[0]<< 0)|((0x80U)<< 8)); + X[j] = ((ptr[0] << 0) | ((0x80U) << 8)); break; case 2: - X[j] = ((ptr[0]<< 0)|(ptr[1]<< 8)|((0x80U)<<16)); + X[j] = ((ptr[0] << 0) | (ptr[1] << 8) | ((0x80U) << 16)); break; case 3: - X[j] = ((ptr[0]<< 0)|(ptr[1]<< 8)|(ptr[2]<<16)|((0x80U)<<24)); + X[j] = + ((ptr[0] << + 0) | (ptr[1] << 8) | (ptr[2] << 16) | ((0x80U) << 24)); break; } @@ -154,32 +161,36 @@ static void PerformMD4(const unsigned char *buf, int length, unsigned char *dige if (j > 14) { - for (; j < 16; j++) + for ( ; j < 16; j++) + { X[j] = 0; + } DoMD4(); j = 0; } - for (; j < 14; j++) + for ( ; j < 14; j++) + { X[j] = 0; + } - X[14] = (length & 0x1FFFFFFF) << 3; + X[14] = (length & 0x1FFFFFFF) << 3; X[15] = (length & ~0x1FFFFFFF) >> 29; DoMD4(); - digest[ 0] = (A & 0x000000FF) >> 0; - digest[ 1] = (A & 0x0000FF00) >> 8; - digest[ 2] = (A & 0x00FF0000) >> 16; - digest[ 3] = (A & 0xFF000000) >> 24; - digest[ 4] = (B & 0x000000FF) >> 0; - digest[ 5] = (B & 0x0000FF00) >> 8; - digest[ 6] = (B & 0x00FF0000) >> 16; - digest[ 7] = (B & 0xFF000000) >> 24; - digest[ 8] = (C & 0x000000FF) >> 0; - digest[ 9] = (C & 0x0000FF00) >> 8; + digest[0] = (A & 0x000000FF) >> 0; + digest[1] = (A & 0x0000FF00) >> 8; + digest[2] = (A & 0x00FF0000) >> 16; + digest[3] = (A & 0xFF000000) >> 24; + digest[4] = (B & 0x000000FF) >> 0; + digest[5] = (B & 0x0000FF00) >> 8; + digest[6] = (B & 0x00FF0000) >> 16; + digest[7] = (B & 0xFF000000) >> 24; + digest[8] = (C & 0x000000FF) >> 0; + digest[9] = (C & 0x0000FF00) >> 8; digest[10] = (C & 0x00FF0000) >> 16; digest[11] = (C & 0xFF000000) >> 24; digest[12] = (D & 0x000000FF) >> 0; @@ -193,10 +204,13 @@ static void PerformMD4(const unsigned char *buf, int length, unsigned char *dige D = DD = 0; for (j = 0; j < 16; j++) + { X[j] = 0; + } } -unsigned Com_BlockChecksum (void *buffer, int length) +unsigned +Com_BlockChecksum(void *buffer, int length) { uint32_t digest[4]; unsigned val; @@ -207,3 +221,4 @@ unsigned Com_BlockChecksum (void *buffer, int length) return val; } + diff --git a/src/common/message/msg_read.c b/src/common/message/msg_read.c deleted file mode 100644 index 1c3f3822..00000000 --- a/src/common/message/msg_read.c +++ /dev/null @@ -1,243 +0,0 @@ -/* - * Copyright (C) 1997-2001 Id Software, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - * - * ======================================================================= - * - * Message reading and preprocessing - * - * ======================================================================= - */ - -#include "../header/common.h" - -void MSG_BeginReading (sizebuf_t *msg) -{ - msg->readcount = 0; -} - -int MSG_ReadChar (sizebuf_t *msg_read) -{ - int c; - - if (msg_read->readcount+1 > msg_read->cursize) - c = -1; - - else - c = (signed char)msg_read->data[msg_read->readcount]; - - msg_read->readcount++; - - return c; -} - -int MSG_ReadByte (sizebuf_t *msg_read) -{ - int c; - - if (msg_read->readcount+1 > msg_read->cursize) - c = -1; - - else - c = (unsigned char)msg_read->data[msg_read->readcount]; - - msg_read->readcount++; - - return c; -} - -int MSG_ReadShort (sizebuf_t *msg_read) -{ - int c; - - if (msg_read->readcount+2 > msg_read->cursize) - c = -1; - - else - c = (short)(msg_read->data[msg_read->readcount] - + (msg_read->data[msg_read->readcount+1]<<8)); - - msg_read->readcount += 2; - - return c; -} - -int MSG_ReadLong (sizebuf_t *msg_read) -{ - int c; - - if (msg_read->readcount+4 > msg_read->cursize) - c = -1; - - else - c = msg_read->data[msg_read->readcount] - + (msg_read->data[msg_read->readcount+1]<<8) - + (msg_read->data[msg_read->readcount+2]<<16) - + (msg_read->data[msg_read->readcount+3]<<24); - - msg_read->readcount += 4; - - return c; -} - -float MSG_ReadFloat (sizebuf_t *msg_read) -{ - union - { - byte b[4]; - float f; - int l; - } dat; - - if (msg_read->readcount+4 > msg_read->cursize) - dat.f = -1; - - else - { - dat.b[0] = msg_read->data[msg_read->readcount]; - dat.b[1] = msg_read->data[msg_read->readcount+1]; - dat.b[2] = msg_read->data[msg_read->readcount+2]; - dat.b[3] = msg_read->data[msg_read->readcount+3]; - } - - msg_read->readcount += 4; - - dat.l = LittleLong (dat.l); - - return dat.f; -} - -char *MSG_ReadString (sizebuf_t *msg_read) -{ - static char string[2048]; - int l,c; - - l = 0; - - do - { - c = MSG_ReadChar (msg_read); - - if (c == -1 || c == 0) - break; - - string[l] = c; - l++; - } - while (l < sizeof(string)-1); - - string[l] = 0; - - return string; -} - -char *MSG_ReadStringLine (sizebuf_t *msg_read) -{ - static char string[2048]; - int l,c; - - l = 0; - - do - { - c = MSG_ReadChar (msg_read); - - if (c == -1 || c == 0 || c == '\n') - break; - - string[l] = c; - l++; - } - while (l < sizeof(string)-1); - - string[l] = 0; - - return string; -} - -float MSG_ReadCoord (sizebuf_t *msg_read) -{ - return MSG_ReadShort(msg_read) * (0.125f); -} - -void MSG_ReadPos (sizebuf_t *msg_read, vec3_t pos) -{ - pos[0] = MSG_ReadShort(msg_read) * (0.125f); - pos[1] = MSG_ReadShort(msg_read) * (0.125f); - pos[2] = MSG_ReadShort(msg_read) * (0.125f); -} - -float MSG_ReadAngle (sizebuf_t *msg_read) -{ - return MSG_ReadChar(msg_read) * 1.40625f; -} - -float MSG_ReadAngle16 (sizebuf_t *msg_read) -{ - return SHORT2ANGLE(MSG_ReadShort(msg_read)); -} - -void MSG_ReadDeltaUsercmd (sizebuf_t *msg_read, usercmd_t *from, usercmd_t *move) -{ - int bits; - - memcpy (move, from, sizeof(*move)); - - bits = MSG_ReadByte (msg_read); - - /* read current angles */ - if (bits & CM_ANGLE1) - move->angles[0] = MSG_ReadShort (msg_read); - - if (bits & CM_ANGLE2) - move->angles[1] = MSG_ReadShort (msg_read); - - if (bits & CM_ANGLE3) - move->angles[2] = MSG_ReadShort (msg_read); - - /* read movement */ - if (bits & CM_FORWARD) - move->forwardmove = MSG_ReadShort (msg_read); - - if (bits & CM_SIDE) - move->sidemove = MSG_ReadShort (msg_read); - - if (bits & CM_UP) - move->upmove = MSG_ReadShort (msg_read); - - /* read buttons */ - if (bits & CM_BUTTONS) - move->buttons = MSG_ReadByte (msg_read); - - if (bits & CM_IMPULSE) - move->impulse = MSG_ReadByte (msg_read); - - /* read time to run command */ - move->msec = MSG_ReadByte (msg_read); - - /* read the light level */ - move->lightlevel = MSG_ReadByte (msg_read); -} - -void MSG_ReadData (sizebuf_t *msg_read, void *data, int len) -{ - int i; - - for (i=0 ; i -FILE *log_stats_file; -cvar_t *host_speeds; -cvar_t *log_stats; -cvar_t *developer; -cvar_t *modder; -cvar_t *timescale; -cvar_t *fixedtime; +FILE *log_stats_file; +cvar_t *host_speeds; +cvar_t *log_stats; +cvar_t *developer; +cvar_t *modder; +cvar_t *timescale; +cvar_t *fixedtime; #ifndef DEDICATED_ONLY -cvar_t *showtrace; +cvar_t *showtrace; #endif -cvar_t *dedicated; +cvar_t *dedicated; -extern cvar_t *logfile_active; -extern jmp_buf abortframe; /* an ERR_DROP occured, exit the entire frame */ -extern zhead_t z_chain; +extern cvar_t *logfile_active; +extern jmp_buf abortframe; /* an ERR_DROP occured, exit the entire frame */ +extern zhead_t z_chain; -static byte chktbl[1024] = -{ +static byte chktbl[1024] = { 0x84, 0x47, 0x51, 0xc1, 0x93, 0x22, 0x21, 0x24, 0x2f, 0x66, 0x60, 0x4d, 0xb0, 0x7c, 0xda, 0x88, 0x54, 0x15, 0x2b, 0xc6, 0x6c, 0x89, 0xc5, 0x9d, 0x48, 0xee, 0xe6, 0x8a, 0xb5, 0xf4, 0xcb, 0xfb, 0xf1, 0x0c, 0x2e, 0xa0, 0xd7, 0xc9, 0x1f, 0xd6, 0x06, 0x9a, 0x09, 0x41, 0x54, @@ -113,44 +112,51 @@ static byte chktbl[1024] = }; /* host_speeds times */ -int time_before_game; -int time_after_game; -int time_before_ref; -int time_after_ref; +int time_before_game; +int time_after_game; +int time_before_ref; +int time_after_ref; /* * For proxy protecting */ -byte COM_BlockSequenceCRCByte (byte *base, int length, int sequence) +byte +COM_BlockSequenceCRCByte(byte *base, int length, int sequence) { - int n; - int x; - byte *p; - byte chkb[60 + 4]; - unsigned short crc; - byte r; + int n; + int x; + byte *p; + byte chkb[60 + 4]; + unsigned short crc; + byte r; if (sequence < 0) + { Sys_Error("sequence < 0, this shouldn't happen\n"); + } p = chktbl + (sequence % (sizeof(chktbl) - 4)); if (length > 60) + { length = 60; + } - memcpy (chkb, base, length); + memcpy(chkb, base, length); chkb[length] = p[0]; - chkb[length+1] = p[1]; - chkb[length+2] = p[2]; - chkb[length+3] = p[3]; + chkb[length + 1] = p[1]; + chkb[length + 2] = p[2]; + chkb[length + 3] = p[3]; length += 4; crc = CRC_Block(chkb, length); - for (x=0, n=0; nvalue) - Cmd_AddCommand ("quit", Com_Quit); + { + Cmd_AddCommand("quit", Com_Quit); + } Sys_Init(); NET_Init(); - Netchan_Init (); - SV_Init (); + Netchan_Init(); + SV_Init(); #ifndef DEDICATED_ONLY - CL_Init (); + CL_Init(); #endif /* add + commands from command line */ - if (!Cbuf_AddLateCommands ()) + if (!Cbuf_AddLateCommands()) { /* if the user didn't give any commands, run default action */ if (!dedicated->value) - Cbuf_AddText ("d1\n"); - + { + Cbuf_AddText("d1\n"); + } else - Cbuf_AddText ("dedicated_start\n"); + { + Cbuf_AddText("dedicated_start\n"); + } - Cbuf_Execute (); + Cbuf_Execute(); } - #ifndef DEDICATED_ONLY - else { /* the user asked for something explicit so drop the loading plaque */ - SCR_EndLoadingPlaque (); + SCR_EndLoadingPlaque(); } - #endif - Com_Printf ("==== Yamagi Quake II Initialized ====\n\n"); - Com_Printf ("*************************************\n\n"); + Com_Printf("==== Yamagi Quake II Initialized ====\n\n"); + Com_Printf("*************************************\n\n"); } -void Qcommon_Frame (int msec) +void +Qcommon_Frame(int msec) { - char *s; + char *s; #ifndef DEDICATED_ONLY - int time_before = 0; - int time_between = 0; - int time_after; + int time_before = 0; + int time_between = 0; + int time_after; #endif - if (setjmp (abortframe) ) + if (setjmp(abortframe)) + { return; /* an ERR_DROP was thrown */ + } - if ( log_stats->modified ) + if (log_stats->modified) { log_stats->modified = false; - if ( log_stats->value ) + if (log_stats->value) { - if ( log_stats_file ) + if (log_stats_file) { - fclose( log_stats_file ); + fclose(log_stats_file); log_stats_file = 0; } - log_stats_file = fopen( "stats.log", "w" ); + log_stats_file = fopen("stats.log", "w"); - if ( log_stats_file ) - fprintf( log_stats_file, "entities,dlights,parts,frame time\n" ); + if (log_stats_file) + { + fprintf(log_stats_file, "entities,dlights,parts,frame time\n"); + } } - else { - if ( log_stats_file ) + if (log_stats_file) { - fclose( log_stats_file ); + fclose(log_stats_file); log_stats_file = 0; } } } if (fixedtime->value) + { msec = fixedtime->value; - + } else if (timescale->value) { msec *= timescale->value; if (msec < 1) + { msec = 1; + } } #ifndef DEDICATED_ONLY - if (showtrace->value) { - extern int c_traces, c_brush_traces; - extern int c_pointcontents; + extern int c_traces, c_brush_traces; + extern int c_pointcontents; - Com_Printf ("%4i traces %4i points\n", c_traces, c_pointcontents); + Com_Printf("%4i traces %4i points\n", c_traces, c_pointcontents); c_traces = 0; c_brush_traces = 0; c_pointcontents = 0; } - #endif do { - s = Sys_ConsoleInput (); + s = Sys_ConsoleInput(); if (s) - Cbuf_AddText (va("%s\n",s)); + { + Cbuf_AddText(va("%s\n", s)); + } } while (s); - Cbuf_Execute (); + Cbuf_Execute(); #ifndef DEDICATED_ONLY - if (host_speeds->value) - time_before = Sys_Milliseconds (); - + { + time_before = Sys_Milliseconds(); + } #endif - SV_Frame (msec); + SV_Frame(msec); #ifndef DEDICATED_ONLY - if (host_speeds->value) - time_between = Sys_Milliseconds (); + { + time_between = Sys_Milliseconds(); + } - CL_Frame (msec); + CL_Frame(msec); if (host_speeds->value) { - int all, sv, gm, cl, rf; + int all, sv, gm, cl, rf; - time_after = Sys_Milliseconds (); + time_after = Sys_Milliseconds(); all = time_after - time_before; sv = time_between - time_before; cl = time_after - time_between; @@ -378,13 +399,14 @@ void Qcommon_Frame (int msec) rf = time_after_ref - time_before_ref; sv -= gm; cl -= rf; - Com_Printf ("all:%3i sv:%3i gm:%3i cl:%3i rf:%3i\n", - all, sv, gm, cl, rf); + Com_Printf("all:%3i sv:%3i gm:%3i cl:%3i rf:%3i\n", + all, sv, gm, cl, rf); } - #endif } -void Qcommon_Shutdown (void) +void +Qcommon_Shutdown(void) { } + diff --git a/src/common/model/cm_areaportals.c b/src/common/model/cm_areaportals.c deleted file mode 100644 index 2cb81f9a..00000000 --- a/src/common/model/cm_areaportals.c +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright (C) 1997-2001 Id Software, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - * - * ======================================================================= - * - * This file implements the the area portals. - * - * ======================================================================= - */ - -#include "../header/common.h" -#include "../header/cmodel.h" - -extern int numareas; - -void FloodArea_r (carea_t *area, int floodnum) -{ - int i; - dareaportal_t *p; - - if (area->floodvalid == floodvalid) - { - if (area->floodnum == floodnum) - return; - - Com_Error (ERR_DROP, "FloodArea_r: reflooded"); - } - - area->floodnum = floodnum; - area->floodvalid = floodvalid; - p = &map_areaportals[area->firstareaportal]; - - for (i=0 ; inumareaportals ; i++, p++) - { - if (portalopen[LittleLong(p->portalnum)]) - FloodArea_r (&map_areas[LittleLong(p->otherarea)], floodnum); - } -} - -void FloodAreaConnections (void) -{ - int i; - carea_t *area; - int floodnum; - - /* all current floods are now invalid */ - floodvalid++; - floodnum = 0; - - /* area 0 is not used */ - for (i=1 ; ifloodvalid == floodvalid) - continue; /* already flooded into */ - - floodnum++; - FloodArea_r (area, floodnum); - } - -} - -void CM_SetAreaPortalState (int portalnum, qboolean open) -{ - if (portalnum > numareaportals) - Com_Error (ERR_DROP, "areaportal > numareaportals"); - - portalopen[portalnum] = open; - FloodAreaConnections (); -} - -qboolean CM_AreasConnected (int area1, int area2) -{ - if (map_noareas->value) - return true; - - if (area1 > numareas || area2 > numareas) - Com_Error (ERR_DROP, "area > numareas"); - - if (map_areas[area1].floodnum == map_areas[area2].floodnum) - return true; - - return false; -} - -/* - * Writes a length byte followed by a bit vector of all the areas - * that area in the same flood as the area parameter - * - * This is used by the client refreshes to cull visibility - */ -int CM_WriteAreaBits (byte *buffer, int area) -{ - int i; - int floodnum; - int bytes; - - bytes = (numareas+7)>>3; - - if (map_noareas->value) - { - /* for debugging, send everything */ - memset (buffer, 255, bytes); - } - - else - { - memset (buffer, 0, bytes); - - floodnum = map_areas[area].floodnum; - - for (i=0 ; i>3] |= 1<<(i&7); - } - } - - return bytes; -} - -/* - * Writes the portal state to a savegame file - */ -void CM_WritePortalState (FILE *f) -{ - fwrite (portalopen, sizeof(portalopen), 1, f); -} - -/* - * Reads the portal state from a savegame file - * and recalculates the area connections - */ -void CM_ReadPortalState (fileHandle_t f) -{ - FS_Read (portalopen, sizeof(portalopen), f); - FloodAreaConnections (); -} - -/* - * Returns true if any leaf under headnode has a cluster that - * is potentially visible - */ -qboolean CM_HeadnodeVisible (int nodenum, byte *visbits) -{ - int leafnum1; - int cluster; - cnode_t *node; - - if (nodenum < 0) - { - leafnum1 = -1-nodenum; - cluster = map_leafs[leafnum1].cluster; - - if (cluster == -1) - return false; - - if (visbits[cluster>>3] & (1<<(cluster&7))) - return true; - - return false; - } - - node = &map_nodes[nodenum]; - - if (CM_HeadnodeVisible(node->children[0], visbits)) - return true; - - return CM_HeadnodeVisible(node->children[1], visbits); -} diff --git a/src/common/model/cm_box.c b/src/common/model/cm_box.c deleted file mode 100644 index 2679c577..00000000 --- a/src/common/model/cm_box.c +++ /dev/null @@ -1,283 +0,0 @@ -/* - * Copyright (C) 1997-2001 Id Software, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - * - * ======================================================================= - * - * This files implements collision boxes for models of all kinds but - * mainly the world model - * - * ======================================================================= - */ - -#include "../header/common.h" -#include "../header/cmodel.h" - -extern int numleafs; - -cplane_t *box_planes; -int box_headnode; -cbrush_t *box_brush; -cleaf_t *box_leaf; - -/* - * Set up the planes and nodes so that the six floats of a bounding box - * can just be stored out and get a proper clipping hull structure. - */ -void CM_InitBoxHull (void) -{ - int i; - int side; - cnode_t *c; - cplane_t *p; - cbrushside_t *s; - - box_headnode = numnodes; - box_planes = &map_planes[numplanes]; - - if (numnodes+6 > MAX_MAP_NODES - || numbrushes+1 > MAX_MAP_BRUSHES - || numleafbrushes+1 > MAX_MAP_LEAFBRUSHES - || numbrushsides+6 > MAX_MAP_BRUSHSIDES - || numplanes+12 > MAX_MAP_PLANES) - Com_Error (ERR_DROP, "Not enough room for box tree"); - - box_brush = &map_brushes[numbrushes]; - box_brush->numsides = 6; - box_brush->firstbrushside = numbrushsides; - box_brush->contents = CONTENTS_MONSTER; - - box_leaf = &map_leafs[numleafs]; - box_leaf->contents = CONTENTS_MONSTER; - box_leaf->firstleafbrush = numleafbrushes; - box_leaf->numleafbrushes = 1; - - map_leafbrushes[numleafbrushes] = numbrushes; - - for (i=0 ; i<6 ; i++) - { - side = i&1; - - /* brush sides */ - s = &map_brushsides[numbrushsides+i]; - s->plane = map_planes + (numplanes+i*2+side); - s->surface = &nullsurface; - - /* nodes */ - c = &map_nodes[box_headnode+i]; - c->plane = map_planes + (numplanes+i*2); - c->children[side] = -1 - emptyleaf; - - if (i != 5) - c->children[side^1] = box_headnode+i + 1; - - else - c->children[side^1] = -1 - numleafs; - - /* planes */ - p = &box_planes[i*2]; - p->type = i>>1; - p->signbits = 0; - VectorClear (p->normal); - p->normal[i>>1] = 1; - - p = &box_planes[i*2+1]; - p->type = 3 + (i>>1); - p->signbits = 0; - VectorClear (p->normal); - p->normal[i>>1] = -1; - } -} - -/* - * To keep everything totally uniform, bounding boxes are turned into - * small BSP trees instead of being compared directly. - */ -int CM_HeadnodeForBox (vec3_t mins, vec3_t maxs) -{ - box_planes[0].dist = maxs[0]; - box_planes[1].dist = -maxs[0]; - box_planes[2].dist = mins[0]; - box_planes[3].dist = -mins[0]; - box_planes[4].dist = maxs[1]; - box_planes[5].dist = -maxs[1]; - box_planes[6].dist = mins[1]; - box_planes[7].dist = -mins[1]; - box_planes[8].dist = maxs[2]; - box_planes[9].dist = -maxs[2]; - box_planes[10].dist = mins[2]; - box_planes[11].dist = -mins[2]; - - return box_headnode; -} - -int CM_PointLeafnum_r (vec3_t p, int num) -{ - float d; - cnode_t *node; - cplane_t *plane; - - while (num >= 0) - { - node = map_nodes + num; - plane = node->plane; - - if (plane->type < 3) - d = p[plane->type] - plane->dist; - - else - d = DotProduct (plane->normal, p) - plane->dist; - - if (d < 0) - num = node->children[1]; - - else - num = node->children[0]; - } - -#ifndef DEDICATED_ONLY - c_pointcontents++; /* optimize counter */ -#endif - - return -1 - num; -} - -int CM_PointLeafnum (vec3_t p) -{ - if (!numplanes) - return 0; /* sound may call this without map loaded */ - - return CM_PointLeafnum_r (p, 0); -} - -/* - * Fills in a list of all the leafs touched - */ -int leaf_count, leaf_maxcount; -int *leaf_list; -float *leaf_mins, *leaf_maxs; -int leaf_topnode; - -void CM_BoxLeafnums_r (int nodenum) -{ - cplane_t *plane; - cnode_t *node; - int s; - - while (1) - { - if (nodenum < 0) - { - if (leaf_count >= leaf_maxcount) - { - return; - } - - leaf_list[leaf_count++] = -1 - nodenum; - return; - } - - node = &map_nodes[nodenum]; - plane = node->plane; - s = BOX_ON_PLANE_SIDE(leaf_mins, leaf_maxs, plane); - - if (s == 1) - nodenum = node->children[0]; - - else if (s == 2) - nodenum = node->children[1]; - - else - { - /* go down both */ - if (leaf_topnode == -1) - leaf_topnode = nodenum; - - CM_BoxLeafnums_r (node->children[0]); - nodenum = node->children[1]; - } - - } -} - -int CM_BoxLeafnums_headnode (vec3_t mins, vec3_t maxs, int *list, int listsize, int headnode, int *topnode) -{ - leaf_list = list; - leaf_count = 0; - leaf_maxcount = listsize; - leaf_mins = mins; - leaf_maxs = maxs; - - leaf_topnode = -1; - - CM_BoxLeafnums_r (headnode); - - if (topnode) - *topnode = leaf_topnode; - - return leaf_count; -} - -int CM_BoxLeafnums (vec3_t mins, vec3_t maxs, int *list, int listsize, int *topnode) -{ - return CM_BoxLeafnums_headnode (mins, maxs, list, - listsize, map_cmodels[0].headnode, topnode); -} - -int CM_PointContents (vec3_t p, int headnode) -{ - int l; - - if (!numnodes) /* map not loaded */ - return 0; - - l = CM_PointLeafnum_r (p, headnode); - - return map_leafs[l].contents; -} - -/* - * Handles offseting and rotation of the end points for moving and - * rotating entities - */ -int CM_TransformedPointContents (vec3_t p, int headnode, vec3_t origin, vec3_t angles) -{ - vec3_t p_l; - vec3_t temp; - vec3_t forward, right, up; - int l; - - /* subtract origin offset */ - VectorSubtract (p, origin, p_l); - - /* rotate start and end into the models frame of reference */ - if (headnode != box_headnode && - (angles[0] || angles[1] || angles[2]) ) - { - AngleVectors (angles, forward, right, up); - - VectorCopy (p_l, temp); - p_l[0] = DotProduct (temp, forward); - p_l[1] = -DotProduct (temp, right); - p_l[2] = DotProduct (temp, up); - } - - l = CM_PointLeafnum_r (p_l, headnode); - - return map_leafs[l].contents; -} diff --git a/src/common/model/cm_boxtracing.c b/src/common/model/cm_boxtracing.c deleted file mode 100644 index 4d3b4218..00000000 --- a/src/common/model/cm_boxtracing.c +++ /dev/null @@ -1,552 +0,0 @@ -/* - * Copyright (C) 1997-2001 Id Software, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - * - * ======================================================================= - * - * This file implements tracing of collision boxes through the world - * model - * - * ======================================================================= - */ - -#include "../header/common.h" -#include "../header/cmodel.h" - -extern int box_headnode; - -/* 1/32 epsilon to keep floating point happy */ -#define DIST_EPSILON (0.03125f) - -vec3_t trace_start, trace_end; -vec3_t trace_mins, trace_maxs; -vec3_t trace_extents; - -trace_t trace_trace; -int trace_contents; -qboolean trace_ispoint; /* optimized case */ - -void CM_ClipBoxToBrush (vec3_t mins, vec3_t maxs, vec3_t p1, vec3_t p2, - trace_t *trace, cbrush_t *brush) -{ - int i, j; - cplane_t *plane, *clipplane; - float dist; - float enterfrac, leavefrac; - vec3_t ofs; - float d1, d2; - qboolean getout, startout; - float f; - cbrushside_t *side, *leadside; - - enterfrac = -1; - leavefrac = 1; - clipplane = NULL; - - if (!brush->numsides) - return; - -#ifndef DEDICATED_ONLY - c_brush_traces++; -#endif - - getout = false; - startout = false; - leadside = NULL; - - for (i=0 ; inumsides ; i++) - { - side = &map_brushsides[brush->firstbrushside+i]; - plane = side->plane; - - if (!trace_ispoint) - { - /* general box case - push the plane out - apropriately for mins/maxs */ - for (j=0 ; j<3 ; j++) - { - if (plane->normal[j] < 0) - ofs[j] = maxs[j]; - - else - ofs[j] = mins[j]; - } - - dist = DotProduct (ofs, plane->normal); - dist = plane->dist - dist; - } - - else - { - /* special point case */ - dist = plane->dist; - } - - d1 = DotProduct (p1, plane->normal) - dist; - d2 = DotProduct (p2, plane->normal) - dist; - - if (d2 > 0) - getout = true; /* endpoint is not in solid */ - - if (d1 > 0) - startout = true; - - /* if completely in front of face, no intersection */ - if (d1 > 0 && d2 >= d1) - return; - - if (d1 <= 0 && d2 <= 0) - continue; - - /* crosses face */ - if (d1 > d2) - { - /* enter */ - f = (d1-DIST_EPSILON) / (d1-d2); - - if (f > enterfrac) - { - enterfrac = f; - clipplane = plane; - leadside = side; - } - } - - else - { - /* leave */ - f = (d1+DIST_EPSILON) / (d1-d2); - - if (f < leavefrac) - leavefrac = f; - } - } - - if (!startout) - { - /* original point was inside brush */ - trace->startsolid = true; - - if (!getout) - trace->allsolid = true; - - return; - } - - if (enterfrac < leavefrac) - { - if (enterfrac > -1 && enterfrac < trace->fraction) - { - if (enterfrac < 0) - enterfrac = 0; - - if (clipplane == NULL) - Com_Error(ERR_FATAL, "clipplane was NULL!\n"); - - trace->fraction = enterfrac; - trace->plane = *clipplane; - trace->surface = &(leadside->surface->c); - trace->contents = brush->contents; - } - } -} - -void CM_TestBoxInBrush (vec3_t mins, vec3_t maxs, vec3_t p1, - trace_t *trace, cbrush_t *brush) -{ - int i, j; - cplane_t *plane; - float dist; - vec3_t ofs; - float d1; - cbrushside_t *side; - - if (!brush->numsides) - return; - - for (i=0 ; inumsides ; i++) - { - side = &map_brushsides[brush->firstbrushside+i]; - plane = side->plane; - - /* general box case - push the plane out - apropriately for mins/maxs */ - for (j=0 ; j<3 ; j++) - { - if (plane->normal[j] < 0) - ofs[j] = maxs[j]; - - else - ofs[j] = mins[j]; - } - - dist = DotProduct (ofs, plane->normal); - dist = plane->dist - dist; - - d1 = DotProduct (p1, plane->normal) - dist; - - /* if completely in front of face, no intersection */ - if (d1 > 0) - return; - - } - - /* inside this brush */ - trace->startsolid = trace->allsolid = true; - trace->fraction = 0; - trace->contents = brush->contents; -} - -void CM_TraceToLeaf (int leafnum) -{ - int k; - int brushnum; - cleaf_t *leaf; - cbrush_t *b; - - leaf = &map_leafs[leafnum]; - - if ( !(leaf->contents & trace_contents)) - return; - - /* trace line against all brushes in the leaf */ - for (k=0 ; knumleafbrushes ; k++) - { - brushnum = map_leafbrushes[leaf->firstleafbrush+k]; - b = &map_brushes[brushnum]; - - if (b->checkcount == checkcount) - continue; /* already checked this brush in another leaf */ - - b->checkcount = checkcount; - - if ( !(b->contents & trace_contents)) - continue; - - CM_ClipBoxToBrush (trace_mins, trace_maxs, trace_start, trace_end, &trace_trace, b); - - if (!trace_trace.fraction) - return; - } - -} - -void CM_TestInLeaf (int leafnum) -{ - int k; - int brushnum; - cleaf_t *leaf; - cbrush_t *b; - - leaf = &map_leafs[leafnum]; - - if ( !(leaf->contents & trace_contents)) - return; - - /* trace line against all brushes in the leaf */ - for (k=0 ; knumleafbrushes ; k++) - { - brushnum = map_leafbrushes[leaf->firstleafbrush+k]; - b = &map_brushes[brushnum]; - - if (b->checkcount == checkcount) - continue; /* already checked this brush in another leaf */ - - b->checkcount = checkcount; - - if ( !(b->contents & trace_contents)) - continue; - - CM_TestBoxInBrush (trace_mins, trace_maxs, trace_start, &trace_trace, b); - - if (!trace_trace.fraction) - return; - } - -} - -void CM_RecursiveHullCheck (int num, float p1f, float p2f, vec3_t p1, vec3_t p2) -{ - cnode_t *node; - cplane_t *plane; - float t1, t2, offset; - float frac, frac2; - float idist; - int i; - vec3_t mid; - int side; - float midf; - - if (trace_trace.fraction <= p1f) - return; /* already hit something nearer */ - - /* if < 0, we are in a leaf node */ - if (num < 0) - { - CM_TraceToLeaf (-1-num); - return; - } - - /* find the point distances to the seperating plane - and the offset for the size of the box */ - node = map_nodes + num; - plane = node->plane; - - if (plane->type < 3) - { - t1 = p1[plane->type] - plane->dist; - t2 = p2[plane->type] - plane->dist; - offset = trace_extents[plane->type]; - } - - else - { - t1 = DotProduct (plane->normal, p1) - plane->dist; - t2 = DotProduct (plane->normal, p2) - plane->dist; - - if (trace_ispoint) - offset = 0; - - else - offset = (float)fabs(trace_extents[0]*plane->normal[0]) + - (float)fabs(trace_extents[1]*plane->normal[1]) + - (float)fabs(trace_extents[2]*plane->normal[2]); - } - - /* see which sides we need to consider */ - if (t1 >= offset && t2 >= offset) - { - CM_RecursiveHullCheck (node->children[0], p1f, p2f, p1, p2); - return; - } - - if (t1 < -offset && t2 < -offset) - { - CM_RecursiveHullCheck (node->children[1], p1f, p2f, p1, p2); - return; - } - - /* put the crosspoint DIST_EPSILON pixels on the near side */ - if (t1 < t2) - { - idist = 1.0f/(t1-t2); - side = 1; - frac2 = (t1 + offset + DIST_EPSILON)*idist; - frac = (t1 - offset + DIST_EPSILON)*idist; - } - - else if (t1 > t2) - { - idist = 1.0/(t1-t2); - side = 0; - frac2 = (t1 - offset - DIST_EPSILON)*idist; - frac = (t1 + offset + DIST_EPSILON)*idist; - } - - else - { - side = 0; - frac = 1; - frac2 = 0; - } - - /* move up to the node */ - if (frac < 0) - frac = 0; - - if (frac > 1) - frac = 1; - - midf = p1f + (p2f - p1f)*frac; - - for (i=0 ; i<3 ; i++) - mid[i] = p1[i] + frac*(p2[i] - p1[i]); - - CM_RecursiveHullCheck (node->children[side], p1f, midf, p1, mid); - - - /* go past the node */ - if (frac2 < 0) - frac2 = 0; - - if (frac2 > 1) - frac2 = 1; - - midf = p1f + (p2f - p1f)*frac2; - - for (i=0 ; i<3 ; i++) - mid[i] = p1[i] + frac2*(p2[i] - p1[i]); - - CM_RecursiveHullCheck (node->children[side^1], midf, p2f, mid, p2); -} - -trace_t CM_BoxTrace (vec3_t start, vec3_t end, - vec3_t mins, vec3_t maxs, - int headnode, int brushmask) -{ - int i; - - checkcount++; /* for multi-check avoidance */ - -#ifndef DEDICATED_ONLY - c_traces++; /* for statistics, may be zeroed */ -#endif - - /* fill in a default trace */ - memset (&trace_trace, 0, sizeof(trace_trace)); - trace_trace.fraction = 1; - trace_trace.surface = &(nullsurface.c); - - if (!numnodes) /* map not loaded */ - return trace_trace; - - trace_contents = brushmask; - VectorCopy (start, trace_start); - VectorCopy (end, trace_end); - VectorCopy (mins, trace_mins); - VectorCopy (maxs, trace_maxs); - - /* check for position test special case */ - if (start[0] == end[0] && start[1] == end[1] && start[2] == end[2]) - { - int leafs[1024]; - int i, numleafs; - vec3_t c1, c2; - int topnode; - - VectorAdd (start, mins, c1); - VectorAdd (start, maxs, c2); - - for (i=0 ; i<3 ; i++) - { - c1[i] -= 1; - c2[i] += 1; - } - - numleafs = CM_BoxLeafnums_headnode (c1, c2, leafs, 1024, headnode, &topnode); - - for (i=0 ; i maxs[0] ? -mins[0] : maxs[0]; - trace_extents[1] = -mins[1] > maxs[1] ? -mins[1] : maxs[1]; - trace_extents[2] = -mins[2] > maxs[2] ? -mins[2] : maxs[2]; - } - - /* general sweeping through world */ - CM_RecursiveHullCheck (headnode, 0, 1, start, end); - - if (trace_trace.fraction == 1) - { - VectorCopy (end, trace_trace.endpos); - } - - else - { - for (i=0 ; i<3 ; i++) - trace_trace.endpos[i] = start[i] + trace_trace.fraction * (end[i] - start[i]); - } - - return trace_trace; -} - -/* - * Handles offseting and rotation of the end points for moving and - * rotating entities - */ -trace_t CM_TransformedBoxTrace (vec3_t start, vec3_t end, - vec3_t mins, vec3_t maxs, - int headnode, int brushmask, - vec3_t origin, vec3_t angles) -{ - trace_t trace; - vec3_t start_l, end_l; - vec3_t a; - vec3_t forward, right, up; - vec3_t temp; - qboolean rotated; - - /* subtract origin offset */ - VectorSubtract (start, origin, start_l); - VectorSubtract (end, origin, end_l); - - /* rotate start and end into the models frame of reference */ - if (headnode != box_headnode && - (angles[0] || angles[1] || angles[2]) ) - rotated = true; - - else - rotated = false; - - if (rotated) - { - AngleVectors (angles, forward, right, up); - - VectorCopy (start_l, temp); - start_l[0] = DotProduct (temp, forward); - start_l[1] = -DotProduct (temp, right); - start_l[2] = DotProduct (temp, up); - - VectorCopy (end_l, temp); - end_l[0] = DotProduct (temp, forward); - end_l[1] = -DotProduct (temp, right); - end_l[2] = DotProduct (temp, up); - } - - /* sweep the box through the model */ - trace = CM_BoxTrace (start_l, end_l, mins, maxs, headnode, brushmask); - - if (rotated && trace.fraction != 1.0) - { - VectorNegate (angles, a); - AngleVectors (a, forward, right, up); - - VectorCopy (trace.plane.normal, temp); - trace.plane.normal[0] = DotProduct (temp, forward); - trace.plane.normal[1] = -DotProduct (temp, right); - trace.plane.normal[2] = DotProduct (temp, up); - } - - trace.endpos[0] = start[0] + trace.fraction * (end[0] - start[0]); - trace.endpos[1] = start[1] + trace.fraction * (end[1] - start[1]); - trace.endpos[2] = start[2] + trace.fraction * (end[2] - start[2]); - - return trace; -} diff --git a/src/common/model/cm_bsp.c b/src/common/model/cm_bsp.c deleted file mode 100644 index 42c63dc5..00000000 --- a/src/common/model/cm_bsp.c +++ /dev/null @@ -1,549 +0,0 @@ -/* - * Copyright (C) 1997-2001 Id Software, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - * - * ======================================================================= - * - * This file implements loading and parsing of BSP files and trees. - * - * ======================================================================= - */ - -#include "../header/common.h" -#include "../header/cmodel.h" - -extern dvis_t *map_vis; - -int numleafs = 1; /* allow leaf funcs to be called without a map */ -int numclusters = 1; -int numareas = 1; - -byte *cmod_base; - -void CMod_LoadSubmodels (lump_t *l) -{ - dmodel_t *in; - cmodel_t *out; - int i, j, count; - - in = (void *)(cmod_base + l->fileofs); - - if (l->filelen % sizeof(*in)) - Com_Error (ERR_DROP, "MOD_LoadBmodel: funny lump size"); - - count = l->filelen / sizeof(*in); - - if (count < 1) - Com_Error (ERR_DROP, "Map with no models"); - - if (count > MAX_MAP_MODELS) - Com_Error (ERR_DROP, "Map has too many models"); - - numcmodels = count; - - for ( i=0 ; imins[j] = LittleFloat (in->mins[j]) - 1; - out->maxs[j] = LittleFloat (in->maxs[j]) + 1; - out->origin[j] = LittleFloat (in->origin[j]); - } - - out->headnode = LittleLong (in->headnode); - } -} - -void CMod_LoadSurfaces (lump_t *l) -{ - texinfo_t *in; - mapsurface_t *out; - int i, count; - - in = (void *)(cmod_base + l->fileofs); - - if (l->filelen % sizeof(*in)) - Com_Error (ERR_DROP, "MOD_LoadBmodel: funny lump size"); - - count = l->filelen / sizeof(*in); - - if (count < 1) - Com_Error (ERR_DROP, "Map with no surfaces"); - - if (count > MAX_MAP_TEXINFO) - Com_Error (ERR_DROP, "Map has too many surfaces"); - - numtexinfo = count; - out = map_surfaces; - - for ( i=0 ; ic.name, in->texture, sizeof(out->c.name)-1); - strncpy (out->rname, in->texture, sizeof(out->rname)-1); - out->c.flags = LittleLong (in->flags); - out->c.value = LittleLong (in->value); - } -} - -void CMod_LoadNodes (lump_t *l) -{ - dnode_t *in; - int child; - cnode_t *out; - int i, j, count; - - in = (void *)(cmod_base + l->fileofs); - - if (l->filelen % sizeof(*in)) - Com_Error (ERR_DROP, "MOD_LoadBmodel: funny lump size"); - - count = l->filelen / sizeof(*in); - - if (count < 1) - Com_Error (ERR_DROP, "Map has no nodes"); - - if (count > MAX_MAP_NODES) - Com_Error (ERR_DROP, "Map has too many nodes"); - - out = map_nodes; - - numnodes = count; - - for (i=0 ; iplane = map_planes + LittleLong(in->planenum); - - for (j=0 ; j<2 ; j++) - { - child = LittleLong (in->children[j]); - out->children[j] = child; - } - } - -} - -void CMod_LoadBrushes (lump_t *l) -{ - dbrush_t *in; - cbrush_t *out; - int i, count; - - in = (void *)(cmod_base + l->fileofs); - - if (l->filelen % sizeof(*in)) - Com_Error (ERR_DROP, "MOD_LoadBmodel: funny lump size"); - - count = l->filelen / sizeof(*in); - - if (count > MAX_MAP_BRUSHES) - Com_Error (ERR_DROP, "Map has too many brushes"); - - out = map_brushes; - - numbrushes = count; - - for (i=0 ; ifirstbrushside = LittleLong(in->firstside); - out->numsides = LittleLong(in->numsides); - out->contents = LittleLong(in->contents); - } - -} - -void CMod_LoadLeafs (lump_t *l) -{ - int i; - cleaf_t *out; - dleaf_t *in; - int count; - - in = (void *)(cmod_base + l->fileofs); - - if (l->filelen % sizeof(*in)) - Com_Error (ERR_DROP, "MOD_LoadBmodel: funny lump size"); - - count = l->filelen / sizeof(*in); - - if (count < 1) - Com_Error (ERR_DROP, "Map with no leafs"); - - /* need to save space for box planes */ - if (count > MAX_MAP_PLANES) - Com_Error (ERR_DROP, "Map has too many planes"); - - out = map_leafs; - numleafs = count; - numclusters = 0; - - for ( i=0 ; icontents = LittleLong (in->contents); - out->cluster = LittleShort (in->cluster); - out->area = LittleShort (in->area); - out->firstleafbrush = LittleShort (in->firstleafbrush); - out->numleafbrushes = LittleShort (in->numleafbrushes); - - if (out->cluster >= numclusters) - numclusters = out->cluster + 1; - } - - if (map_leafs[0].contents != CONTENTS_SOLID) - Com_Error (ERR_DROP, "Map leaf 0 is not CONTENTS_SOLID"); - - solidleaf = 0; - emptyleaf = -1; - - for (i=1 ; ifileofs); - - if (l->filelen % sizeof(*in)) - Com_Error (ERR_DROP, "MOD_LoadBmodel: funny lump size"); - - count = l->filelen / sizeof(*in); - - if (count < 1) - Com_Error (ERR_DROP, "Map with no planes"); - - /* need to save space for box planes */ - if (count > MAX_MAP_PLANES) - Com_Error (ERR_DROP, "Map has too many planes"); - - out = map_planes; - numplanes = count; - - for ( i=0 ; inormal[j] = LittleFloat (in->normal[j]); - - if (out->normal[j] < 0) - bits |= 1<dist = LittleFloat (in->dist); - out->type = LittleLong (in->type); - out->signbits = bits; - } -} - -void CMod_LoadLeafBrushes (lump_t *l) -{ - int i; - unsigned short *out; - unsigned short *in; - int count; - - in = (void *)(cmod_base + l->fileofs); - - if (l->filelen % sizeof(*in)) - Com_Error (ERR_DROP, "MOD_LoadBmodel: funny lump size"); - - count = l->filelen / sizeof(*in); - - if (count < 1) - Com_Error (ERR_DROP, "Map with no planes"); - - /* need to save space for box planes */ - if (count > MAX_MAP_LEAFBRUSHES) - Com_Error (ERR_DROP, "Map has too many leafbrushes"); - - out = map_leafbrushes; - numleafbrushes = count; - - for ( i=0 ; ifileofs); - - if (l->filelen % sizeof(*in)) - Com_Error (ERR_DROP, "MOD_LoadBmodel: funny lump size"); - - count = l->filelen / sizeof(*in); - - /* need to save space for box planes */ - if (count > MAX_MAP_BRUSHSIDES) - Com_Error (ERR_DROP, "Map has too many planes"); - - out = map_brushsides; - numbrushsides = count; - - for ( i=0 ; iplanenum); - out->plane = &map_planes[num]; - j = LittleShort (in->texinfo); - - if (j >= numtexinfo) - Com_Error (ERR_DROP, "Bad brushside texinfo"); - - out->surface = &map_surfaces[j]; - } -} - -void CMod_LoadAreas (lump_t *l) -{ - int i; - carea_t *out; - darea_t *in; - int count; - - in = (void *)(cmod_base + l->fileofs); - - if (l->filelen % sizeof(*in)) - Com_Error (ERR_DROP, "MOD_LoadBmodel: funny lump size"); - - count = l->filelen / sizeof(*in); - - if (count > MAX_MAP_AREAS) - Com_Error (ERR_DROP, "Map has too many areas"); - - out = map_areas; - numareas = count; - - for ( i=0 ; inumareaportals = LittleLong (in->numareaportals); - out->firstareaportal = LittleLong (in->firstareaportal); - out->floodvalid = 0; - out->floodnum = 0; - } -} - -void CMod_LoadAreaPortals (lump_t *l) -{ - dareaportal_t *out; - dareaportal_t *in; - int count; - - in = (void *)(cmod_base + l->fileofs); - - if (l->filelen % sizeof(*in)) - Com_Error (ERR_DROP, "MOD_LoadBmodel: funny lump size"); - - count = l->filelen / sizeof(*in); - - if (count > MAX_MAP_AREAS) - Com_Error (ERR_DROP, "Map has too many areas"); - - out = map_areaportals; - numareaportals = count; - - memcpy (out, in, sizeof(dareaportal_t)*count); -} - -void CMod_LoadVisibility (lump_t *l) -{ - numvisibility = l->filelen; - - if (l->filelen > MAX_MAP_VISIBILITY) - Com_Error (ERR_DROP, "Map has too large visibility lump"); - - memcpy (map_visibility, cmod_base + l->fileofs, l->filelen); - - map_vis->numclusters = LittleLong (map_vis->numclusters); -} - -void CMod_LoadEntityString (lump_t *l) -{ - numentitychars = l->filelen; - - if (l->filelen > MAX_MAP_ENTSTRING) - Com_Error (ERR_DROP, "Map has too large entity lump"); - - memcpy (map_entitystring, cmod_base + l->fileofs, l->filelen); -} - -/* - * Loads in the map and all submodels - */ -cmodel_t *CM_LoadMap (char *name, qboolean clientload, unsigned *checksum) -{ - unsigned *buf; - int i; - dheader_t header; - int length; - static unsigned last_checksum; - - map_noareas = Cvar_Get ("map_noareas", "0", 0); - - if ( !strcmp (map_name, name) && (clientload || !Cvar_VariableValue ("flushmap")) ) - { - *checksum = last_checksum; - - if (!clientload) - { - memset (portalopen, 0, sizeof(portalopen)); - FloodAreaConnections (); - } - - return &map_cmodels[0]; /* still have the right version */ - } - - /* free old stuff */ - numplanes = 0; - numnodes = 0; - numleafs = 0; - numcmodels = 0; - numvisibility = 0; - numentitychars = 0; - map_entitystring[0] = 0; - map_name[0] = 0; - - if (!name || !name[0]) - { - numleafs = 1; - numclusters = 1; - numareas = 1; - *checksum = 0; - return &map_cmodels[0]; /* cinematic servers won't have anything at all */ - } - - length = FS_LoadFile (name, (void **)&buf); - - if (!buf) - Com_Error (ERR_DROP, "Couldn't load %s", name); - - last_checksum = LittleLong (Com_BlockChecksum (buf, length)); - *checksum = last_checksum; - - header = *(dheader_t *)buf; - - for (i=0 ; i= numcmodels) - Com_Error (ERR_DROP, "CM_InlineModel: bad number"); - - return &map_cmodels[num]; -} - -int CM_NumClusters (void) -{ - return numclusters; -} - -int CM_NumInlineModels (void) -{ - return numcmodels; -} - -char *CM_EntityString (void) -{ - return map_entitystring; -} - -int CM_LeafContents (int leafnum) -{ - if (leafnum < 0 || leafnum >= numleafs) - Com_Error (ERR_DROP, "CM_LeafContents: bad number"); - - return map_leafs[leafnum].contents; -} - -int CM_LeafCluster (int leafnum) -{ - if (leafnum < 0 || leafnum >= numleafs) - Com_Error (ERR_DROP, "CM_LeafCluster: bad number"); - - return map_leafs[leafnum].cluster; -} - -int CM_LeafArea (int leafnum) -{ - if (leafnum < 0 || leafnum >= numleafs) - Com_Error (ERR_DROP, "CM_LeafArea: bad number"); - - return map_leafs[leafnum].area; -} diff --git a/src/common/model/cm_vis.c b/src/common/model/cm_vis.c deleted file mode 100644 index 7723ea2e..00000000 --- a/src/common/model/cm_vis.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (C) 1997-2001 Id Software, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - * - * ======================================================================= - * - * This file implements loading an parsing of the vis of a map or model - * - * ======================================================================= - */ - -#include "../header/common.h" -#include "../header/cmodel.h" - -extern int numclusters; - -dvis_t *map_vis = (dvis_t *)map_visibility; - -void CM_DecompressVis (byte *in, byte *out) -{ - int c; - byte *out_p; - int row; - - row = (numclusters+7)>>3; - out_p = out; - - if (!in || !numvisibility) - { - /* no vis info, so make all visible */ - while (row) - { - *out_p++ = 0xff; - row--; - } - - return; - } - - do - { - if (*in) - { - *out_p++ = *in++; - continue; - } - - c = in[1]; - in += 2; - - if ((out_p - out) + c > row) - { - c = row - (out_p - out); - Com_DPrintf ("warning: Vis decompression overrun\n"); - } - - while (c) - { - *out_p++ = 0; - c--; - } - } - while (out_p - out < row); -} - -byte pvsrow[MAX_MAP_LEAFS/8]; -byte phsrow[MAX_MAP_LEAFS/8]; - -byte *CM_ClusterPVS (int cluster) -{ - if (cluster == -1) - memset (pvsrow, 0, (numclusters+7)>>3); - - else - CM_DecompressVis (map_visibility + LittleLong(map_vis->bitofs[cluster][DVIS_PVS]), pvsrow); - - return pvsrow; -} - -byte *CM_ClusterPHS (int cluster) -{ - if (cluster == -1) - memset (phsrow, 0, (numclusters+7)>>3); - - else - CM_DecompressVis (map_visibility + LittleLong(map_vis->bitofs[cluster][DVIS_PHS]), phsrow); - - return phsrow; -} diff --git a/src/common/message/msg_io.c b/src/common/movemsg.c similarity index 53% rename from src/common/message/msg_io.c rename to src/common/movemsg.c index 03cbacc2..79a5af7c 100644 --- a/src/common/message/msg_io.c +++ b/src/common/movemsg.c @@ -19,15 +19,14 @@ * * ======================================================================= * - * Client / Server interactions + * Movement message (forward, backward, left, right, etc) handling. * * ======================================================================= */ -#include "../header/common.h" +#include "header/common.h" -vec3_t bytedirs[NUMVERTEXNORMALS] = -{ +vec3_t bytedirs[NUMVERTEXNORMALS] = { {-0.525731, 0.000000, 0.850651}, {-0.442863, 0.238856, 0.864188}, {-0.295242, 0.000000, 0.955423}, @@ -192,166 +191,213 @@ vec3_t bytedirs[NUMVERTEXNORMALS] = {-0.688191, -0.587785, -0.425325} }; -void MSG_WriteChar (sizebuf_t *sb, int c) +void +MSG_WriteChar(sizebuf_t *sb, int c) { - byte *buf; + byte *buf; - buf = SZ_GetSpace (sb, 1); + buf = SZ_GetSpace(sb, 1); buf[0] = c; } -void MSG_WriteByte (sizebuf_t *sb, int c) +void +MSG_WriteByte(sizebuf_t *sb, int c) { - byte *buf; + byte *buf; - buf = SZ_GetSpace (sb, 1); + buf = SZ_GetSpace(sb, 1); buf[0] = c; } -void MSG_WriteShort (sizebuf_t *sb, int c) +void +MSG_WriteShort(sizebuf_t *sb, int c) { - byte *buf; + byte *buf; - buf = SZ_GetSpace (sb, 2); - buf[0] = c&0xff; - buf[1] = c>>8; + buf = SZ_GetSpace(sb, 2); + buf[0] = c & 0xff; + buf[1] = c >> 8; } -void MSG_WriteLong (sizebuf_t *sb, int c) +void +MSG_WriteLong(sizebuf_t *sb, int c) { - byte *buf; + byte *buf; - buf = SZ_GetSpace (sb, 4); - buf[0] = c&0xff; - buf[1] = (c>>8)&0xff; - buf[2] = (c>>16)&0xff; - buf[3] = c>>24; + buf = SZ_GetSpace(sb, 4); + buf[0] = c & 0xff; + buf[1] = (c >> 8) & 0xff; + buf[2] = (c >> 16) & 0xff; + buf[3] = c >> 24; } -void MSG_WriteFloat (sizebuf_t *sb, float f) +void +MSG_WriteFloat(sizebuf_t *sb, float f) { union { - float f; - int l; + float f; + int l; } dat; - dat.f = f; - dat.l = LittleLong (dat.l); + dat.l = LittleLong(dat.l); - SZ_Write (sb, &dat.l, 4); + SZ_Write(sb, &dat.l, 4); } -void MSG_WriteString (sizebuf_t *sb, char *s) +void +MSG_WriteString(sizebuf_t *sb, char *s) { if (!s) - SZ_Write (sb, "", 1); + { + SZ_Write(sb, "", 1); + } else - SZ_Write (sb, s, (int)strlen(s)+1); + { + SZ_Write(sb, s, (int)strlen(s) + 1); + } } -void MSG_WriteCoord (sizebuf_t *sb, float f) +void +MSG_WriteCoord(sizebuf_t *sb, float f) { - MSG_WriteShort (sb, (int)(f*8)); + MSG_WriteShort(sb, (int)(f * 8)); } -void MSG_WritePos (sizebuf_t *sb, vec3_t pos) +void +MSG_WritePos(sizebuf_t *sb, vec3_t pos) { - MSG_WriteShort (sb, (int)(pos[0]*8)); - MSG_WriteShort (sb, (int)(pos[1]*8)); - MSG_WriteShort (sb, (int)(pos[2]*8)); + MSG_WriteShort(sb, (int)(pos[0] * 8)); + MSG_WriteShort(sb, (int)(pos[1] * 8)); + MSG_WriteShort(sb, (int)(pos[2] * 8)); } -void MSG_WriteAngle (sizebuf_t *sb, float f) +void +MSG_WriteAngle(sizebuf_t *sb, float f) { - MSG_WriteByte (sb, (int)(f*256/360) & 255); + MSG_WriteByte(sb, (int)(f * 256 / 360) & 255); } -void MSG_WriteAngle16 (sizebuf_t *sb, float f) +void +MSG_WriteAngle16(sizebuf_t *sb, float f) { - MSG_WriteShort (sb, ANGLE2SHORT(f)); + MSG_WriteShort(sb, ANGLE2SHORT(f)); } -void MSG_WriteDeltaUsercmd (sizebuf_t *buf, usercmd_t *from, usercmd_t *cmd) +void +MSG_WriteDeltaUsercmd(sizebuf_t *buf, usercmd_t *from, usercmd_t *cmd) { - int bits; + int bits; /* Movement messages */ bits = 0; if (cmd->angles[0] != from->angles[0]) + { bits |= CM_ANGLE1; + } if (cmd->angles[1] != from->angles[1]) + { bits |= CM_ANGLE2; + } if (cmd->angles[2] != from->angles[2]) + { bits |= CM_ANGLE3; + } if (cmd->forwardmove != from->forwardmove) + { bits |= CM_FORWARD; + } if (cmd->sidemove != from->sidemove) + { bits |= CM_SIDE; + } if (cmd->upmove != from->upmove) + { bits |= CM_UP; + } if (cmd->buttons != from->buttons) + { bits |= CM_BUTTONS; + } if (cmd->impulse != from->impulse) + { bits |= CM_IMPULSE; + } - MSG_WriteByte (buf, bits); + MSG_WriteByte(buf, bits); if (bits & CM_ANGLE1) - MSG_WriteShort (buf, cmd->angles[0]); + { + MSG_WriteShort(buf, cmd->angles[0]); + } if (bits & CM_ANGLE2) - MSG_WriteShort (buf, cmd->angles[1]); + { + MSG_WriteShort(buf, cmd->angles[1]); + } if (bits & CM_ANGLE3) - MSG_WriteShort (buf, cmd->angles[2]); + { + MSG_WriteShort(buf, cmd->angles[2]); + } if (bits & CM_FORWARD) - MSG_WriteShort (buf, cmd->forwardmove); + { + MSG_WriteShort(buf, cmd->forwardmove); + } if (bits & CM_SIDE) - MSG_WriteShort (buf, cmd->sidemove); + { + MSG_WriteShort(buf, cmd->sidemove); + } if (bits & CM_UP) - MSG_WriteShort (buf, cmd->upmove); + { + MSG_WriteShort(buf, cmd->upmove); + } if (bits & CM_BUTTONS) - MSG_WriteByte (buf, cmd->buttons); + { + MSG_WriteByte(buf, cmd->buttons); + } if (bits & CM_IMPULSE) - MSG_WriteByte (buf, cmd->impulse); + { + MSG_WriteByte(buf, cmd->impulse); + } - MSG_WriteByte (buf, cmd->msec); - MSG_WriteByte (buf, cmd->lightlevel); + MSG_WriteByte(buf, cmd->msec); + MSG_WriteByte(buf, cmd->lightlevel); } -void MSG_WriteDir (sizebuf_t *sb, vec3_t dir) +void +MSG_WriteDir(sizebuf_t *sb, vec3_t dir) { - int i, best; - float d, bestd; + int i, best; + float d, bestd; if (!dir) { - MSG_WriteByte (sb, 0); + MSG_WriteByte(sb, 0); return; } bestd = 0; best = 0; - for (i=0 ; i bestd) { @@ -360,244 +406,639 @@ void MSG_WriteDir (sizebuf_t *sb, vec3_t dir) } } - MSG_WriteByte (sb, best); + MSG_WriteByte(sb, best); } -void MSG_ReadDir (sizebuf_t *sb, vec3_t dir) +void +MSG_ReadDir(sizebuf_t *sb, vec3_t dir) { - int b; + int b; - b = MSG_ReadByte (sb); + b = MSG_ReadByte(sb); if (b >= NUMVERTEXNORMALS) - Com_Error (ERR_DROP, "MSF_ReadDir: out of range"); + { + Com_Error(ERR_DROP, "MSF_ReadDir: out of range"); + } - VectorCopy (bytedirs[b], dir); + VectorCopy(bytedirs[b], dir); } /* * Writes part of a packetentities message. * Can delta from either a baseline or a previous packet_entity */ -void MSG_WriteDeltaEntity (entity_state_t *from, entity_state_t *to, sizebuf_t *msg, qboolean force, qboolean newentity) +void +MSG_WriteDeltaEntity(entity_state_t *from, + entity_state_t *to, + sizebuf_t *msg, + qboolean force, + qboolean newentity) { - int bits; + int bits; if (!to->number) - Com_Error (ERR_FATAL, "Unset entity number"); + { + Com_Error(ERR_FATAL, "Unset entity number"); + } if (to->number >= MAX_EDICTS) - Com_Error (ERR_FATAL, "Entity number >= MAX_EDICTS"); + { + Com_Error(ERR_FATAL, "Entity number >= MAX_EDICTS"); + } /* send an update */ bits = 0; if (to->number >= 256) + { bits |= U_NUMBER16; /* number8 is implicit otherwise */ + } if (to->origin[0] != from->origin[0]) + { bits |= U_ORIGIN1; + } if (to->origin[1] != from->origin[1]) + { bits |= U_ORIGIN2; + } if (to->origin[2] != from->origin[2]) + { bits |= U_ORIGIN3; + } - if ( to->angles[0] != from->angles[0] ) + if (to->angles[0] != from->angles[0]) + { bits |= U_ANGLE1; + } - if ( to->angles[1] != from->angles[1] ) + if (to->angles[1] != from->angles[1]) + { bits |= U_ANGLE2; + } - if ( to->angles[2] != from->angles[2] ) + if (to->angles[2] != from->angles[2]) + { bits |= U_ANGLE3; + } - if ( to->skinnum != from->skinnum ) + if (to->skinnum != from->skinnum) { if ((unsigned)to->skinnum < 256) + { bits |= U_SKIN8; + } else if ((unsigned)to->skinnum < 0x10000) + { bits |= U_SKIN16; + } else - bits |= (U_SKIN8|U_SKIN16); + { + bits |= (U_SKIN8 | U_SKIN16); + } } - if ( to->frame != from->frame ) + if (to->frame != from->frame) { if (to->frame < 256) + { bits |= U_FRAME8; + } else + { bits |= U_FRAME16; + } } - if ( to->effects != from->effects ) + if (to->effects != from->effects) { if (to->effects < 256) + { bits |= U_EFFECTS8; + } else if (to->effects < 0x8000) + { bits |= U_EFFECTS16; + } else - bits |= U_EFFECTS8|U_EFFECTS16; + { + bits |= U_EFFECTS8 | U_EFFECTS16; + } } - if ( to->renderfx != from->renderfx ) + if (to->renderfx != from->renderfx) { if (to->renderfx < 256) + { bits |= U_RENDERFX8; + } else if (to->renderfx < 0x8000) + { bits |= U_RENDERFX16; + } else - bits |= U_RENDERFX8|U_RENDERFX16; + { + bits |= U_RENDERFX8 | U_RENDERFX16; + } } - if ( to->solid != from->solid ) + if (to->solid != from->solid) + { bits |= U_SOLID; + } /* event is not delta compressed, just 0 compressed */ - if ( to->event ) + if (to->event) + { bits |= U_EVENT; + } - if ( to->modelindex != from->modelindex ) + if (to->modelindex != from->modelindex) + { bits |= U_MODEL; + } - if ( to->modelindex2 != from->modelindex2 ) + if (to->modelindex2 != from->modelindex2) + { bits |= U_MODEL2; + } - if ( to->modelindex3 != from->modelindex3 ) + if (to->modelindex3 != from->modelindex3) + { bits |= U_MODEL3; + } - if ( to->modelindex4 != from->modelindex4 ) + if (to->modelindex4 != from->modelindex4) + { bits |= U_MODEL4; + } - if ( to->sound != from->sound ) + if (to->sound != from->sound) + { bits |= U_SOUND; + } if (newentity || (to->renderfx & RF_BEAM)) + { bits |= U_OLDORIGIN; + } /* write the message */ if (!bits && !force) + { return; /* nothing to send! */ + } if (bits & 0xff000000) + { bits |= U_MOREBITS3 | U_MOREBITS2 | U_MOREBITS1; + } else if (bits & 0x00ff0000) + { bits |= U_MOREBITS2 | U_MOREBITS1; + } else if (bits & 0x0000ff00) + { bits |= U_MOREBITS1; + } - MSG_WriteByte (msg, bits&255 ); + MSG_WriteByte(msg, bits & 255); if (bits & 0xff000000) { - MSG_WriteByte (msg, (bits>>8)&255 ); - MSG_WriteByte (msg, (bits>>16)&255 ); - MSG_WriteByte (msg, (bits>>24)&255 ); + MSG_WriteByte(msg, (bits >> 8) & 255); + MSG_WriteByte(msg, (bits >> 16) & 255); + MSG_WriteByte(msg, (bits >> 24) & 255); } else if (bits & 0x00ff0000) { - MSG_WriteByte (msg, (bits>>8)&255 ); - MSG_WriteByte (msg, (bits>>16)&255 ); + MSG_WriteByte(msg, (bits >> 8) & 255); + MSG_WriteByte(msg, (bits >> 16) & 255); } else if (bits & 0x0000ff00) { - MSG_WriteByte (msg, (bits>>8)&255 ); + MSG_WriteByte(msg, (bits >> 8) & 255); } if (bits & U_NUMBER16) - MSG_WriteShort (msg, to->number); + { + MSG_WriteShort(msg, to->number); + } else - MSG_WriteByte (msg, to->number); + { + MSG_WriteByte(msg, to->number); + } if (bits & U_MODEL) - MSG_WriteByte (msg, to->modelindex); + { + MSG_WriteByte(msg, to->modelindex); + } if (bits & U_MODEL2) - MSG_WriteByte (msg, to->modelindex2); + { + MSG_WriteByte(msg, to->modelindex2); + } if (bits & U_MODEL3) - MSG_WriteByte (msg, to->modelindex3); + { + MSG_WriteByte(msg, to->modelindex3); + } if (bits & U_MODEL4) - MSG_WriteByte (msg, to->modelindex4); + { + MSG_WriteByte(msg, to->modelindex4); + } if (bits & U_FRAME8) - MSG_WriteByte (msg, to->frame); + { + MSG_WriteByte(msg, to->frame); + } if (bits & U_FRAME16) - MSG_WriteShort (msg, to->frame); + { + MSG_WriteShort(msg, to->frame); + } if ((bits & U_SKIN8) && (bits & U_SKIN16)) /*used for laser colors */ - MSG_WriteLong (msg, to->skinnum); + { + MSG_WriteLong(msg, to->skinnum); + } else if (bits & U_SKIN8) - MSG_WriteByte (msg, to->skinnum); + { + MSG_WriteByte(msg, to->skinnum); + } else if (bits & U_SKIN16) - MSG_WriteShort (msg, to->skinnum); + { + MSG_WriteShort(msg, to->skinnum); + } - if ( (bits & (U_EFFECTS8|U_EFFECTS16)) == (U_EFFECTS8|U_EFFECTS16) ) - MSG_WriteLong (msg, to->effects); + if ((bits & (U_EFFECTS8 | U_EFFECTS16)) == (U_EFFECTS8 | U_EFFECTS16)) + { + MSG_WriteLong(msg, to->effects); + } else if (bits & U_EFFECTS8) - MSG_WriteByte (msg, to->effects); + { + MSG_WriteByte(msg, to->effects); + } else if (bits & U_EFFECTS16) - MSG_WriteShort (msg, to->effects); + { + MSG_WriteShort(msg, to->effects); + } - if ( (bits & (U_RENDERFX8|U_RENDERFX16)) == (U_RENDERFX8|U_RENDERFX16) ) - MSG_WriteLong (msg, to->renderfx); + if ((bits & (U_RENDERFX8 | U_RENDERFX16)) == (U_RENDERFX8 | U_RENDERFX16)) + { + MSG_WriteLong(msg, to->renderfx); + } else if (bits & U_RENDERFX8) - MSG_WriteByte (msg, to->renderfx); + { + MSG_WriteByte(msg, to->renderfx); + } else if (bits & U_RENDERFX16) - MSG_WriteShort (msg, to->renderfx); + { + MSG_WriteShort(msg, to->renderfx); + } if (bits & U_ORIGIN1) - MSG_WriteCoord (msg, to->origin[0]); + { + MSG_WriteCoord(msg, to->origin[0]); + } if (bits & U_ORIGIN2) - MSG_WriteCoord (msg, to->origin[1]); + { + MSG_WriteCoord(msg, to->origin[1]); + } if (bits & U_ORIGIN3) - MSG_WriteCoord (msg, to->origin[2]); + { + MSG_WriteCoord(msg, to->origin[2]); + } if (bits & U_ANGLE1) + { MSG_WriteAngle(msg, to->angles[0]); + } if (bits & U_ANGLE2) + { MSG_WriteAngle(msg, to->angles[1]); + } if (bits & U_ANGLE3) + { MSG_WriteAngle(msg, to->angles[2]); + } if (bits & U_OLDORIGIN) { - MSG_WriteCoord (msg, to->old_origin[0]); - MSG_WriteCoord (msg, to->old_origin[1]); - MSG_WriteCoord (msg, to->old_origin[2]); + MSG_WriteCoord(msg, to->old_origin[0]); + MSG_WriteCoord(msg, to->old_origin[1]); + MSG_WriteCoord(msg, to->old_origin[2]); } if (bits & U_SOUND) - MSG_WriteByte (msg, to->sound); + { + MSG_WriteByte(msg, to->sound); + } if (bits & U_EVENT) - MSG_WriteByte (msg, to->event); + { + MSG_WriteByte(msg, to->event); + } if (bits & U_SOLID) - MSG_WriteShort (msg, to->solid); + { + MSG_WriteShort(msg, to->solid); + } } + +void +MSG_BeginReading(sizebuf_t *msg) +{ + msg->readcount = 0; +} + +int +MSG_ReadChar(sizebuf_t *msg_read) +{ + int c; + + if (msg_read->readcount + 1 > msg_read->cursize) + { + c = -1; + } + + else + { + c = (signed char)msg_read->data[msg_read->readcount]; + } + + msg_read->readcount++; + + return c; +} + +int +MSG_ReadByte(sizebuf_t *msg_read) +{ + int c; + + if (msg_read->readcount + 1 > msg_read->cursize) + { + c = -1; + } + + else + { + c = (unsigned char)msg_read->data[msg_read->readcount]; + } + + msg_read->readcount++; + + return c; +} + +int +MSG_ReadShort(sizebuf_t *msg_read) +{ + int c; + + if (msg_read->readcount + 2 > msg_read->cursize) + { + c = -1; + } + + else + { + c = (short)(msg_read->data[msg_read->readcount] + + (msg_read->data[msg_read->readcount + 1] << 8)); + } + + msg_read->readcount += 2; + + return c; +} + +int +MSG_ReadLong(sizebuf_t *msg_read) +{ + int c; + + if (msg_read->readcount + 4 > msg_read->cursize) + { + c = -1; + } + + else + { + c = msg_read->data[msg_read->readcount] + + (msg_read->data[msg_read->readcount + 1] << 8) + + (msg_read->data[msg_read->readcount + 2] << 16) + + (msg_read->data[msg_read->readcount + 3] << 24); + } + + msg_read->readcount += 4; + + return c; +} + +float +MSG_ReadFloat(sizebuf_t *msg_read) +{ + union + { + byte b[4]; + float f; + int l; + } dat; + + if (msg_read->readcount + 4 > msg_read->cursize) + { + dat.f = -1; + } + + else + { + dat.b[0] = msg_read->data[msg_read->readcount]; + dat.b[1] = msg_read->data[msg_read->readcount + 1]; + dat.b[2] = msg_read->data[msg_read->readcount + 2]; + dat.b[3] = msg_read->data[msg_read->readcount + 3]; + } + + msg_read->readcount += 4; + + dat.l = LittleLong(dat.l); + + return dat.f; +} + +char * +MSG_ReadString(sizebuf_t *msg_read) +{ + static char string[2048]; + int l, c; + + l = 0; + + do + { + c = MSG_ReadChar(msg_read); + + if ((c == -1) || (c == 0)) + { + break; + } + + string[l] = c; + l++; + } + while (l < sizeof(string) - 1); + + string[l] = 0; + + return string; +} + +char * +MSG_ReadStringLine(sizebuf_t *msg_read) +{ + static char string[2048]; + int l, c; + + l = 0; + + do + { + c = MSG_ReadChar(msg_read); + + if ((c == -1) || (c == 0) || (c == '\n')) + { + break; + } + + string[l] = c; + l++; + } + while (l < sizeof(string) - 1); + + string[l] = 0; + + return string; +} + +float +MSG_ReadCoord(sizebuf_t *msg_read) +{ + return MSG_ReadShort(msg_read) * (0.125f); +} + +void +MSG_ReadPos(sizebuf_t *msg_read, vec3_t pos) +{ + pos[0] = MSG_ReadShort(msg_read) * (0.125f); + pos[1] = MSG_ReadShort(msg_read) * (0.125f); + pos[2] = MSG_ReadShort(msg_read) * (0.125f); +} + +float +MSG_ReadAngle(sizebuf_t *msg_read) +{ + return MSG_ReadChar(msg_read) * 1.40625f; +} + +float +MSG_ReadAngle16(sizebuf_t *msg_read) +{ + return SHORT2ANGLE(MSG_ReadShort(msg_read)); +} + +void +MSG_ReadDeltaUsercmd(sizebuf_t *msg_read, usercmd_t *from, usercmd_t *move) +{ + int bits; + + memcpy(move, from, sizeof(*move)); + + bits = MSG_ReadByte(msg_read); + + /* read current angles */ + if (bits & CM_ANGLE1) + { + move->angles[0] = MSG_ReadShort(msg_read); + } + + if (bits & CM_ANGLE2) + { + move->angles[1] = MSG_ReadShort(msg_read); + } + + if (bits & CM_ANGLE3) + { + move->angles[2] = MSG_ReadShort(msg_read); + } + + /* read movement */ + if (bits & CM_FORWARD) + { + move->forwardmove = MSG_ReadShort(msg_read); + } + + if (bits & CM_SIDE) + { + move->sidemove = MSG_ReadShort(msg_read); + } + + if (bits & CM_UP) + { + move->upmove = MSG_ReadShort(msg_read); + } + + /* read buttons */ + if (bits & CM_BUTTONS) + { + move->buttons = MSG_ReadByte(msg_read); + } + + if (bits & CM_IMPULSE) + { + move->impulse = MSG_ReadByte(msg_read); + } + + /* read time to run command */ + move->msec = MSG_ReadByte(msg_read); + + /* read the light level */ + move->lightlevel = MSG_ReadByte(msg_read); +} + +void +MSG_ReadData(sizebuf_t *msg_read, void *data, int len) +{ + int i; + + for (i = 0; i < len; i++) + { + ((byte *)data)[i] = MSG_ReadByte(msg_read); + } +} + diff --git a/src/common/netchan.c b/src/common/netchan.c index 86828c7d..3b457d84 100644 --- a/src/common/netchan.c +++ b/src/common/netchan.c @@ -19,7 +19,7 @@ * * ======================================================================= * - * The low level network code + * The low level, platform independant network code * * ======================================================================= */ @@ -81,65 +81,69 @@ * something in the unacknowledged reliable */ -cvar_t *showpackets; -cvar_t *showdrop; -cvar_t *qport; +cvar_t *showpackets; +cvar_t *showdrop; +cvar_t *qport; -netadr_t net_from; -sizebuf_t net_message; -byte net_message_buffer[MAX_MSGLEN]; +netadr_t net_from; +sizebuf_t net_message; +byte net_message_buffer[MAX_MSGLEN]; -void Netchan_Init (void) +void +Netchan_Init(void) { - int port; + int port; /* pick a port value that should be nice and random */ port = Sys_Milliseconds() & 0xffff; - showpackets = Cvar_Get ("showpackets", "0", 0); - showdrop = Cvar_Get ("showdrop", "0", 0); - qport = Cvar_Get ("qport", va("%i", port), CVAR_NOSET); + showpackets = Cvar_Get("showpackets", "0", 0); + showdrop = Cvar_Get("showdrop", "0", 0); + qport = Cvar_Get("qport", va("%i", port), CVAR_NOSET); } /* * Sends an out-of-band datagram */ -void Netchan_OutOfBand (int net_socket, netadr_t adr, int length, byte *data) +void +Netchan_OutOfBand(int net_socket, netadr_t adr, int length, byte *data) { - sizebuf_t send; - byte send_buf[MAX_MSGLEN]; + sizebuf_t send; + byte send_buf[MAX_MSGLEN]; /* write the packet header */ - SZ_Init (&send, send_buf, sizeof(send_buf)); + SZ_Init(&send, send_buf, sizeof(send_buf)); - MSG_WriteLong (&send, -1); /* -1 sequence means out of band */ - SZ_Write (&send, data, length); + MSG_WriteLong(&send, -1); /* -1 sequence means out of band */ + SZ_Write(&send, data, length); /* send the datagram */ - NET_SendPacket (net_socket, send.cursize, send.data, adr); + NET_SendPacket(net_socket, send.cursize, send.data, adr); } /* * Sends a text message in an out-of-band datagram */ -void Netchan_OutOfBandPrint (int net_socket, netadr_t adr, char *format, ...) +void +Netchan_OutOfBandPrint(int net_socket, netadr_t adr, char *format, ...) { - va_list argptr; - static char string[MAX_MSGLEN - 4]; + va_list argptr; + static char string[MAX_MSGLEN - 4]; - va_start (argptr, format); - vsnprintf (string, MAX_MSGLEN - 4, format, argptr); - va_end (argptr); + va_start(argptr, format); + vsnprintf(string, MAX_MSGLEN - 4, format, argptr); + va_end(argptr); - Netchan_OutOfBand (net_socket, adr, strlen(string), (byte *)string); + Netchan_OutOfBand(net_socket, adr, strlen(string), (byte *)string); } /* * called to open a channel to a remote system */ -void Netchan_Setup (netsrc_t sock, netchan_t *chan, netadr_t adr, int qport) +void +Netchan_Setup(netsrc_t sock, netchan_t *chan, netadr_t adr, int qport) { - memset (chan, 0, sizeof(*chan)); + memset(chan, 0, sizeof(*chan)); chan->sock = sock; chan->remote_address = adr; @@ -148,31 +152,37 @@ void Netchan_Setup (netsrc_t sock, netchan_t *chan, netadr_t adr, int qport) chan->incoming_sequence = 0; chan->outgoing_sequence = 1; - SZ_Init (&chan->message, chan->message_buf, sizeof(chan->message_buf)); + SZ_Init(&chan->message, chan->message_buf, sizeof(chan->message_buf)); chan->message.allowoverflow = true; } /* * Returns true if the last reliable message has acked */ -qboolean Netchan_CanReliable (netchan_t *chan) +qboolean +Netchan_CanReliable(netchan_t *chan) { if (chan->reliable_length) + { return false; /* waiting for ack */ + } return true; } -qboolean Netchan_NeedReliable (netchan_t *chan) +qboolean +Netchan_NeedReliable(netchan_t *chan) { - qboolean send_reliable; + qboolean send_reliable; /* if the remote side dropped the last reliable message, resend it */ send_reliable = false; - if (chan->incoming_acknowledged > chan->last_reliable_sequence - && chan->incoming_reliable_acknowledged != chan->reliable_sequence) + if ((chan->incoming_acknowledged > chan->last_reliable_sequence) && + (chan->incoming_reliable_acknowledged != chan->reliable_sequence)) + { send_reliable = true; + } /* if the reliable transmit buffer is empty, copy the current message out */ if (!chan->reliable_length && chan->message.cursize) @@ -189,79 +199,89 @@ qboolean Netchan_NeedReliable (netchan_t *chan) * * A 0 length will still generate a packet and deal with the reliable messages. */ -void Netchan_Transmit (netchan_t *chan, int length, byte *data) +void +Netchan_Transmit(netchan_t *chan, int length, byte *data) { - sizebuf_t send; - byte send_buf[MAX_MSGLEN]; - qboolean send_reliable; - unsigned w1, w2; + sizebuf_t send; + byte send_buf[MAX_MSGLEN]; + qboolean send_reliable; + unsigned w1, w2; /* check for message overflow */ if (chan->message.overflowed) { chan->fatal_error = true; - Com_Printf ("%s:Outgoing message overflow\n" - , NET_AdrToString (chan->remote_address)); + Com_Printf("%s:Outgoing message overflow\n", + NET_AdrToString(chan->remote_address)); return; } - send_reliable = Netchan_NeedReliable (chan); + send_reliable = Netchan_NeedReliable(chan); if (!chan->reliable_length && chan->message.cursize) { - memcpy (chan->reliable_buf, chan->message_buf, chan->message.cursize); + memcpy(chan->reliable_buf, chan->message_buf, chan->message.cursize); chan->reliable_length = chan->message.cursize; chan->message.cursize = 0; chan->reliable_sequence ^= 1; } /* write the packet header */ - SZ_Init (&send, send_buf, sizeof(send_buf)); + SZ_Init(&send, send_buf, sizeof(send_buf)); - w1 = ( chan->outgoing_sequence & ~(1<<31) ) | (send_reliable<<31); - w2 = ( chan->incoming_sequence & ~(1<<31) ) | (chan->incoming_reliable_sequence<<31); + w1 = (chan->outgoing_sequence & ~(1 << 31)) | (send_reliable << 31); + w2 = + (chan->incoming_sequence & + ~(1 << 31)) | (chan->incoming_reliable_sequence << 31); chan->outgoing_sequence++; chan->last_sent = curtime; - MSG_WriteLong (&send, w1); - MSG_WriteLong (&send, w2); + MSG_WriteLong(&send, w1); + MSG_WriteLong(&send, w2); /* send the qport if we are a client */ if (chan->sock == NS_CLIENT) - MSG_WriteShort (&send, qport->value); + { + MSG_WriteShort(&send, qport->value); + } /* copy the reliable message to the packet first */ if (send_reliable) { - SZ_Write (&send, chan->reliable_buf, chan->reliable_length); + SZ_Write(&send, chan->reliable_buf, chan->reliable_length); chan->last_reliable_sequence = chan->outgoing_sequence; } /* add the unreliable part if space is available */ if (send.maxsize - send.cursize >= length) - SZ_Write (&send, data, length); + { + SZ_Write(&send, data, length); + } else - Com_Printf ("Netchan_Transmit: dumped unreliable\n"); + { + Com_Printf("Netchan_Transmit: dumped unreliable\n"); + } /* send the datagram */ - NET_SendPacket (chan->sock, send.cursize, send.data, chan->remote_address); + NET_SendPacket(chan->sock, send.cursize, send.data, chan->remote_address); if (showpackets->value) { if (send_reliable) - Com_Printf ("send %4i : s=%i reliable=%i ack=%i rack=%i\n" - , send.cursize - , chan->outgoing_sequence - 1 - , chan->reliable_sequence - , chan->incoming_sequence - , chan->incoming_reliable_sequence); + { + Com_Printf("send %4i : s=%i reliable=%i ack=%i rack=%i\n", + send.cursize, chan->outgoing_sequence - 1, + chan->reliable_sequence, chan->incoming_sequence, + chan->incoming_reliable_sequence); + } else - Com_Printf ("send %4i : s=%i ack=%i rack=%i\n" - , send.cursize - , chan->outgoing_sequence - 1 - , chan->incoming_sequence - , chan->incoming_reliable_sequence); + { + Com_Printf("send %4i : s=%i ack=%i rack=%i\n", + send.cursize, chan->outgoing_sequence - 1, + chan->incoming_sequence, + chan->incoming_reliable_sequence); + } } } @@ -269,71 +289,78 @@ void Netchan_Transmit (netchan_t *chan, int length, byte *data) * called when the current net_message is from remote_address * modifies net_message so that it points to the packet payload */ -qboolean Netchan_Process (netchan_t *chan, sizebuf_t *msg) +qboolean +Netchan_Process(netchan_t *chan, sizebuf_t *msg) { - unsigned sequence, sequence_ack; - unsigned reliable_ack, reliable_message; + unsigned sequence, sequence_ack; + unsigned reliable_ack, reliable_message; /* get sequence numbers */ - MSG_BeginReading (msg); - sequence = MSG_ReadLong (msg); - sequence_ack = MSG_ReadLong (msg); + MSG_BeginReading(msg); + sequence = MSG_ReadLong(msg); + sequence_ack = MSG_ReadLong(msg); /* read the qport if we are a server */ if (chan->sock == NS_SERVER) + { (void)MSG_ReadShort(msg); + } reliable_message = sequence >> 31; reliable_ack = sequence_ack >> 31; - sequence &= ~(1<<31); - sequence_ack &= ~(1<<31); + sequence &= ~(1 << 31); + sequence_ack &= ~(1 << 31); if (showpackets->value) { if (reliable_message) - Com_Printf ("recv %4i : s=%i reliable=%i ack=%i rack=%i\n" - , msg->cursize - , sequence - , chan->incoming_reliable_sequence ^ 1 - , sequence_ack - , reliable_ack); + { + Com_Printf("recv %4i : s=%i reliable=%i ack=%i rack=%i\n", + msg->cursize, sequence, + chan->incoming_reliable_sequence ^ 1, + sequence_ack, reliable_ack); + } else - Com_Printf ("recv %4i : s=%i ack=%i rack=%i\n" - , msg->cursize - , sequence - , sequence_ack - , reliable_ack); + { + Com_Printf("recv %4i : s=%i ack=%i rack=%i\n", + msg->cursize, sequence, sequence_ack, + reliable_ack); + } } /* discard stale or duplicated packets */ if (sequence <= chan->incoming_sequence) { if (showdrop->value) - Com_Printf ("%s:Out of order packet %i at %i\n" - , NET_AdrToString (chan->remote_address) - , sequence - , chan->incoming_sequence); + { + Com_Printf("%s:Out of order packet %i at %i\n", + NET_AdrToString(chan->remote_address), + sequence, chan->incoming_sequence); + } return false; } /* dropped packets don't keep the message from being used */ - chan->dropped = sequence - (chan->incoming_sequence+1); + chan->dropped = sequence - (chan->incoming_sequence + 1); if (chan->dropped > 0) { if (showdrop->value) - Com_Printf ("%s:Dropped %i packets at %i\n" - , NET_AdrToString (chan->remote_address) - , chan->dropped - , sequence); + { + Com_Printf("%s:Dropped %i packets at %i\n", + NET_AdrToString(chan->remote_address), + chan->dropped, sequence); + } } /* if the current outgoing reliable message has been acknowledged - clear the buffer to make way for the next */ + * clear the buffer to make way for the next */ if (reliable_ack == chan->reliable_sequence) + { chan->reliable_length = 0; /* it has been received */ + } /* if this message contains a reliable message, bump incoming_reliable_sequence */ chan->incoming_sequence = sequence; @@ -350,3 +377,4 @@ qboolean Netchan_Process (netchan_t *chan, sizebuf_t *msg) return true; } + diff --git a/src/common/pmove.c b/src/common/pmove.c index eeeb5f60..6a67ee8a 100644 --- a/src/common/pmove.c +++ b/src/common/pmove.c @@ -32,65 +32,64 @@ void AL_Underwater(); void AL_Overwater(); #endif -#define STEPSIZE 18 +#define STEPSIZE 18 /* all of the locals will be zeroed before each - pmove, just to make damn sure we don't have - any differences when running on client or server */ + * pmove, just to make damn sure we don't have + * any differences when running on client or server */ typedef struct { - vec3_t origin; /* full float precision */ - vec3_t velocity; /* full float precision */ + vec3_t origin; /* full float precision */ + vec3_t velocity; /* full float precision */ - vec3_t forward, right, up; - float frametime; + vec3_t forward, right, up; + float frametime; + csurface_t *groundsurface; + cplane_t groundplane; + int groundcontents; - csurface_t *groundsurface; - cplane_t groundplane; - int groundcontents; - - vec3_t previous_origin; - qboolean ladder; + vec3_t previous_origin; + qboolean ladder; } pml_t; -pmove_t *pm; -pml_t pml; +pmove_t *pm; +pml_t pml; /* movement parameters */ -float pm_stopspeed = 100; -float pm_maxspeed = 300; -float pm_duckspeed = 100; -float pm_accelerate = 10; -float pm_airaccelerate = 0; -float pm_wateraccelerate = 10; -float pm_friction = 6; -float pm_waterfriction = 1; -float pm_waterspeed = 400; +float pm_stopspeed = 100; +float pm_maxspeed = 300; +float pm_duckspeed = 100; +float pm_accelerate = 10; +float pm_airaccelerate = 0; +float pm_wateraccelerate = 10; +float pm_friction = 6; +float pm_waterfriction = 1; +float pm_waterspeed = 400; -/* - * Slide off of the impacting object - * returns the blocked flags (1 = floor, 2 = step / wall) - */ +#define STOP_EPSILON 0.1 /* Slide off of the impacting object returns the blocked flags (1 = floor, 2 = step / wall) */ +#define MIN_STEP_NORMAL 0.7 /* can't step up onto very steep slopes */ +#define MAX_CLIP_PLANES 5 -#define STOP_EPSILON 0.1 - -void PM_ClipVelocity (vec3_t in, vec3_t normal, vec3_t out, float overbounce) +void +PM_ClipVelocity(vec3_t in, vec3_t normal, vec3_t out, float overbounce) { - float backoff; - float change; - int i; + float backoff; + float change; + int i; - backoff = DotProduct (in, normal) * overbounce; + backoff = DotProduct(in, normal) * overbounce; - for (i=0 ; i<3 ; i++) + for (i = 0; i < 3; i++) { - change = normal[i]*backoff; + change = normal[i] * backoff; out[i] = in[i] - change; - if (out[i] > -STOP_EPSILON && out[i] < STOP_EPSILON) + if ((out[i] > -STOP_EPSILON) && (out[i] < STOP_EPSILON)) + { out[i] = 0; + } } } @@ -101,34 +100,35 @@ void PM_ClipVelocity (vec3_t in, vec3_t normal, vec3_t out, float overbounce) * Returns a new origin, velocity, and contact entity * Does not modify any world state? */ -#define MIN_STEP_NORMAL 0.7 /* can't step up onto very steep slopes */ -#define MAX_CLIP_PLANES 5 -void PM_StepSlideMove_ (void) +void +PM_StepSlideMove_(void) { - int bumpcount, numbumps; - vec3_t dir; - float d; - int numplanes; - vec3_t planes[MAX_CLIP_PLANES]; - vec3_t primal_velocity; - int i, j; - trace_t trace; - vec3_t end; - float time_left; + int bumpcount, numbumps; + vec3_t dir; + float d; + int numplanes; + vec3_t planes[MAX_CLIP_PLANES]; + vec3_t primal_velocity; + int i, j; + trace_t trace; + vec3_t end; + float time_left; numbumps = 4; - VectorCopy (pml.velocity, primal_velocity); + VectorCopy(pml.velocity, primal_velocity); numplanes = 0; time_left = pml.frametime; - for (bumpcount=0 ; bumpcounttrace (pml.origin, pm->mins, pm->maxs, end); + trace = pm->trace(pml.origin, pm->mins, pm->maxs, end); if (trace.allsolid) { @@ -140,15 +140,17 @@ void PM_StepSlideMove_ (void) if (trace.fraction > 0) { /* actually covered some distance */ - VectorCopy (trace.endpos, pml.origin); + VectorCopy(trace.endpos, pml.origin); numplanes = 0; } if (trace.fraction == 1) + { break; /* moved the entire distance */ + } /* save entity for contact */ - if (pm->numtouch < MAXTOUCH && trace.ent) + if ((pm->numtouch < MAXTOUCH) && trace.ent) { pm->touchents[pm->numtouch] = trace.ent; pm->numtouch++; @@ -160,27 +162,33 @@ void PM_StepSlideMove_ (void) if (numplanes >= MAX_CLIP_PLANES) { /* this shouldn't really happen */ - VectorCopy (vec3_origin, pml.velocity); + VectorCopy(vec3_origin, pml.velocity); break; } - VectorCopy (trace.plane.normal, planes[numplanes]); + VectorCopy(trace.plane.normal, planes[numplanes]); numplanes++; /* modify original_velocity so it parallels all of the clip planes */ - for (i=0 ; is.pm_time) { - VectorCopy (primal_velocity, pml.velocity); + VectorCopy(primal_velocity, pml.velocity); } } -void PM_StepSlideMove (void) +void +PM_StepSlideMove(void) { - vec3_t start_o, start_v; - vec3_t down_o, down_v; - trace_t trace; - float down_dist, up_dist; - vec3_t up, down; + vec3_t start_o, start_v; + vec3_t down_o, down_v; + trace_t trace; + float down_dist, up_dist; + vec3_t up, down; - VectorCopy (pml.origin, start_o); - VectorCopy (pml.velocity, start_v); + VectorCopy(pml.origin, start_o); + VectorCopy(pml.velocity, start_v); - PM_StepSlideMove_ (); + PM_StepSlideMove_(); - VectorCopy (pml.origin, down_o); - VectorCopy (pml.velocity, down_v); + VectorCopy(pml.origin, down_o); + VectorCopy(pml.velocity, down_v); - VectorCopy (start_o, up); + VectorCopy(start_o, up); up[2] += STEPSIZE; - trace = pm->trace (up, pm->mins, pm->maxs, up); + trace = pm->trace(up, pm->mins, pm->maxs, up); if (trace.allsolid) + { return; /* can't step up */ + } /* try sliding above */ - VectorCopy (up, pml.origin); - VectorCopy (start_v, pml.velocity); + VectorCopy(up, pml.origin); + VectorCopy(start_v, pml.velocity); - PM_StepSlideMove_ (); + PM_StepSlideMove_(); /* push down the final amount */ - VectorCopy (pml.origin, down); + VectorCopy(pml.origin, down); down[2] -= STEPSIZE; - trace = pm->trace (pml.origin, pm->mins, pm->maxs, down); + trace = pm->trace(pml.origin, pm->mins, pm->maxs, down); if (!trace.allsolid) { - VectorCopy (trace.endpos, pml.origin); + VectorCopy(trace.endpos, pml.origin); } VectorCopy(pml.origin, up); /* decide which one went farther */ - down_dist = (down_o[0] - start_o[0])*(down_o[0] - start_o[0]) - + (down_o[1] - start_o[1])*(down_o[1] - start_o[1]); - up_dist = (up[0] - start_o[0])*(up[0] - start_o[0]) - + (up[1] - start_o[1])*(up[1] - start_o[1]); + down_dist = (down_o[0] - start_o[0]) * (down_o[0] - start_o[0]) + + (down_o[1] - start_o[1]) * (down_o[1] - start_o[1]); + up_dist = (up[0] - start_o[0]) * (up[0] - start_o[0]) + + (up[1] - start_o[1]) * (up[1] - start_o[1]); - if (down_dist > up_dist || trace.plane.normal[2] < MIN_STEP_NORMAL) + if ((down_dist > up_dist) || (trace.plane.normal[2] < MIN_STEP_NORMAL)) { - VectorCopy (down_o, pml.origin); - VectorCopy (down_v, pml.velocity); + VectorCopy(down_o, pml.origin); + VectorCopy(down_v, pml.velocity); return; } @@ -277,16 +288,17 @@ void PM_StepSlideMove (void) /* * Handles both ground friction and water friction */ -void PM_Friction (void) +void +PM_Friction(void) { - float *vel; - float speed, newspeed, control; - float friction; - float drop; + float *vel; + float speed, newspeed, control; + float friction; + float drop; vel = pml.velocity; - speed = (float)sqrt(vel[0]*vel[0] +vel[1]*vel[1] + vel[2]*vel[2]); + speed = (float)sqrt(vel[0] * vel[0] + vel[1] * vel[1] + vel[2] * vel[2]); if (speed < 1) { @@ -298,16 +310,19 @@ void PM_Friction (void) drop = 0; /* apply ground friction */ - if ((pm->groundentity && pml.groundsurface && !(pml.groundsurface->flags & SURF_SLICK) ) || (pml.ladder) ) + if ((pm->groundentity && pml.groundsurface && + !(pml.groundsurface->flags & SURF_SLICK)) || (pml.ladder)) { friction = pm_friction; control = speed < pm_stopspeed ? pm_stopspeed : speed; - drop += control*friction*pml.frametime; + drop += control * friction * pml.frametime; } /* apply water friction */ if (pm->waterlevel && !pml.ladder) - drop += speed*pm_waterfriction*pm->waterlevel*pml.frametime; + { + drop += speed * pm_waterfriction * pm->waterlevel * pml.frametime; + } /* scale the velocity */ newspeed = speed - drop; @@ -327,199 +342,264 @@ void PM_Friction (void) /* * Handles user intended acceleration */ -void PM_Accelerate (vec3_t wishdir, float wishspeed, float accel) +void +PM_Accelerate(vec3_t wishdir, float wishspeed, float accel) { - int i; - float addspeed, accelspeed, currentspeed; + int i; + float addspeed, accelspeed, currentspeed; - currentspeed = DotProduct (pml.velocity, wishdir); + currentspeed = DotProduct(pml.velocity, wishdir); addspeed = wishspeed - currentspeed; if (addspeed <= 0) + { return; + } - accelspeed = accel*pml.frametime*wishspeed; + accelspeed = accel * pml.frametime * wishspeed; if (accelspeed > addspeed) + { accelspeed = addspeed; + } - for (i=0 ; i<3 ; i++) - pml.velocity[i] += accelspeed*wishdir[i]; + for (i = 0; i < 3; i++) + { + pml.velocity[i] += accelspeed * wishdir[i]; + } } -void PM_AirAccelerate (vec3_t wishdir, float wishspeed, float accel) +void +PM_AirAccelerate(vec3_t wishdir, float wishspeed, float accel) { - int i; - float addspeed, accelspeed, currentspeed, wishspd = wishspeed; + int i; + float addspeed, accelspeed, currentspeed, wishspd = wishspeed; if (wishspd > 30) + { wishspd = 30; + } - currentspeed = DotProduct (pml.velocity, wishdir); + currentspeed = DotProduct(pml.velocity, wishdir); addspeed = wishspd - currentspeed; if (addspeed <= 0) + { return; + } accelspeed = accel * wishspeed * pml.frametime; if (accelspeed > addspeed) + { accelspeed = addspeed; + } - for (i=0 ; i<3 ; i++) - pml.velocity[i] += accelspeed*wishdir[i]; + for (i = 0; i < 3; i++) + { + pml.velocity[i] += accelspeed * wishdir[i]; + } } -void PM_AddCurrents (vec3_t wishvel) +void +PM_AddCurrents(vec3_t wishvel) { - vec3_t v; - float s; + vec3_t v; + float s; /* account for ladders */ - if (pml.ladder && fabs(pml.velocity[2]) <= 200) + if (pml.ladder && (fabs(pml.velocity[2]) <= 200)) { if ((pm->viewangles[PITCH] <= -15) && (pm->cmd.forwardmove > 0)) + { wishvel[2] = 200; - + } else if ((pm->viewangles[PITCH] >= 15) && (pm->cmd.forwardmove > 0)) + { wishvel[2] = -200; - + } else if (pm->cmd.upmove > 0) + { wishvel[2] = 200; - + } else if (pm->cmd.upmove < 0) + { wishvel[2] = -200; - + } else + { wishvel[2] = 0; + } /* limit horizontal speed when on a ladder */ if (wishvel[0] < -25) + { wishvel[0] = -25; - + } else if (wishvel[0] > 25) + { wishvel[0] = 25; + } if (wishvel[1] < -25) + { wishvel[1] = -25; - + } else if (wishvel[1] > 25) + { wishvel[1] = 25; + } } /* add water currents */ if (pm->watertype & MASK_CURRENT) { - VectorClear (v); + VectorClear(v); if (pm->watertype & CONTENTS_CURRENT_0) + { v[0] += 1; + } if (pm->watertype & CONTENTS_CURRENT_90) + { v[1] += 1; + } if (pm->watertype & CONTENTS_CURRENT_180) + { v[0] -= 1; + } if (pm->watertype & CONTENTS_CURRENT_270) + { v[1] -= 1; + } if (pm->watertype & CONTENTS_CURRENT_UP) + { v[2] += 1; + } if (pm->watertype & CONTENTS_CURRENT_DOWN) + { v[2] -= 1; + } s = pm_waterspeed; if ((pm->waterlevel == 1) && (pm->groundentity)) + { s /= 2; + } - VectorMA (wishvel, s, v, wishvel); + VectorMA(wishvel, s, v, wishvel); } /* add conveyor belt velocities */ if (pm->groundentity) { - VectorClear (v); + VectorClear(v); if (pml.groundcontents & CONTENTS_CURRENT_0) + { v[0] += 1; + } if (pml.groundcontents & CONTENTS_CURRENT_90) + { v[1] += 1; + } if (pml.groundcontents & CONTENTS_CURRENT_180) + { v[0] -= 1; + } if (pml.groundcontents & CONTENTS_CURRENT_270) + { v[1] -= 1; + } if (pml.groundcontents & CONTENTS_CURRENT_UP) + { v[2] += 1; + } if (pml.groundcontents & CONTENTS_CURRENT_DOWN) + { v[2] -= 1; + } - VectorMA (wishvel, 100, v, wishvel); + VectorMA(wishvel, 100, v, wishvel); } } -void PM_WaterMove (void) +void +PM_WaterMove(void) { - int i; - vec3_t wishvel; - float wishspeed; - vec3_t wishdir; + int i; + vec3_t wishvel; + float wishspeed; + vec3_t wishdir; /* user intentions */ - for (i=0 ; i<3 ; i++) - wishvel[i] = pml.forward[i]*pm->cmd.forwardmove + pml.right[i]*pm->cmd.sidemove; + for (i = 0; i < 3; i++) + { + wishvel[i] = pml.forward[i] * pm->cmd.forwardmove + + pml.right[i] * pm->cmd.sidemove; + } if (!pm->cmd.forwardmove && !pm->cmd.sidemove && !pm->cmd.upmove) + { wishvel[2] -= 60; /* drift towards bottom */ - + } else + { wishvel[2] += pm->cmd.upmove; + } - PM_AddCurrents (wishvel); + PM_AddCurrents(wishvel); - VectorCopy (wishvel, wishdir); + VectorCopy(wishvel, wishdir); wishspeed = VectorNormalize(wishdir); if (wishspeed > pm_maxspeed) { - VectorScale (wishvel, pm_maxspeed/wishspeed, wishvel); + VectorScale(wishvel, pm_maxspeed / wishspeed, wishvel); wishspeed = pm_maxspeed; } wishspeed *= 0.5; - PM_Accelerate (wishdir, wishspeed, pm_wateraccelerate); + PM_Accelerate(wishdir, wishspeed, pm_wateraccelerate); - PM_StepSlideMove (); + PM_StepSlideMove(); } -void PM_AirMove (void) +void +PM_AirMove(void) { - int i; - vec3_t wishvel; - float fmove, smove; - vec3_t wishdir; - float wishspeed; - float maxspeed; + int i; + vec3_t wishvel; + float fmove, smove; + vec3_t wishdir; + float wishspeed; + float maxspeed; fmove = pm->cmd.forwardmove; smove = pm->cmd.sidemove; - for (i=0 ; i<2 ; i++) - wishvel[i] = pml.forward[i]*fmove + pml.right[i]*smove; + for (i = 0; i < 2; i++) + { + wishvel[i] = pml.forward[i] * fmove + pml.right[i] * smove; + } wishvel[2] = 0; - PM_AddCurrents (wishvel); + PM_AddCurrents(wishvel); - VectorCopy (wishvel, wishdir); + VectorCopy(wishvel, wishdir); wishspeed = VectorNormalize(wishdir); /* clamp to server defined max speed */ @@ -527,13 +607,13 @@ void PM_AirMove (void) if (wishspeed > maxspeed) { - VectorScale (wishvel, maxspeed/wishspeed, wishvel); + VectorScale(wishvel, maxspeed / wishspeed, wishvel); wishspeed = maxspeed; } - if ( pml.ladder ) + if (pml.ladder) { - PM_Accelerate (wishdir, wishspeed, pm_accelerate); + PM_Accelerate(wishdir, wishspeed, pm_accelerate); if (!wishvel[2]) { @@ -542,61 +622,71 @@ void PM_AirMove (void) pml.velocity[2] -= pm->s.gravity * pml.frametime; if (pml.velocity[2] < 0) - pml.velocity[2] = 0; + { + pml.velocity[2] = 0; + } } - else { pml.velocity[2] += pm->s.gravity * pml.frametime; if (pml.velocity[2] > 0) - pml.velocity[2] = 0; + { + pml.velocity[2] = 0; + } } } - PM_StepSlideMove (); + PM_StepSlideMove(); } - - else if ( pm->groundentity ) + else if (pm->groundentity) { /* walking on ground */ pml.velocity[2] = 0; - PM_Accelerate (wishdir, wishspeed, pm_accelerate); + PM_Accelerate(wishdir, wishspeed, pm_accelerate); - if(pm->s.gravity > 0) + if (pm->s.gravity > 0) + { pml.velocity[2] = 0; - + } else + { pml.velocity[2] -= pm->s.gravity * pml.frametime; + } if (!pml.velocity[0] && !pml.velocity[1]) + { return; + } - PM_StepSlideMove (); + PM_StepSlideMove(); } - else { /* not on ground, so little effect on velocity */ if (pm_airaccelerate) - PM_AirAccelerate (wishdir, wishspeed, pm_accelerate); - + { + PM_AirAccelerate(wishdir, wishspeed, pm_accelerate); + } else - PM_Accelerate (wishdir, wishspeed, 1); + { + PM_Accelerate(wishdir, wishspeed, 1); + } /* add gravity */ pml.velocity[2] -= pm->s.gravity * pml.frametime; - PM_StepSlideMove (); + PM_StepSlideMove(); } } -void PM_CatagorizePosition (void) +void +PM_CatagorizePosition(void) { - vec3_t point; - int cont; - trace_t trace; - float sample1; - float sample2; + vec3_t point; + int cont; + trace_t trace; + float sample1; + float sample2; /* if the player hull point one unit down is solid, the player is on ground */ @@ -611,20 +701,18 @@ void PM_CatagorizePosition (void) pm->s.pm_flags &= ~PMF_ON_GROUND; pm->groundentity = NULL; } - else { - trace = pm->trace (pml.origin, pm->mins, pm->maxs, point); + trace = pm->trace(pml.origin, pm->mins, pm->maxs, point); pml.groundplane = trace.plane; pml.groundsurface = trace.surface; pml.groundcontents = trace.contents; - if (!trace.ent || (trace.plane.normal[2] < 0.7 && !trace.startsolid) ) + if (!trace.ent || ((trace.plane.normal[2] < 0.7) && !trace.startsolid)) { pm->groundentity = NULL; pm->s.pm_flags &= ~PMF_ON_GROUND; } - else { pm->groundentity = trace.ent; @@ -632,11 +720,12 @@ void PM_CatagorizePosition (void) /* hitting solid ground will end a waterjump */ if (pm->s.pm_flags & PMF_TIME_WATERJUMP) { - pm->s.pm_flags &= ~(PMF_TIME_WATERJUMP | PMF_TIME_LAND | PMF_TIME_TELEPORT); + pm->s.pm_flags &= + ~(PMF_TIME_WATERJUMP | PMF_TIME_LAND | PMF_TIME_TELEPORT); pm->s.pm_time = 0; } - if (! (pm->s.pm_flags & PMF_ON_GROUND) ) + if (!(pm->s.pm_flags & PMF_ON_GROUND)) { /* just hit the ground */ pm->s.pm_flags |= PMF_ON_GROUND; @@ -648,15 +737,18 @@ void PM_CatagorizePosition (void) /* don't allow another jump for a little while */ if (pml.velocity[2] < -400) + { pm->s.pm_time = 25; - + } else + { pm->s.pm_time = 18; + } } } } - if (pm->numtouch < MAXTOUCH && trace.ent) + if ((pm->numtouch < MAXTOUCH) && trace.ent) { pm->touchents[pm->numtouch] = trace.ent; pm->numtouch++; @@ -671,29 +763,31 @@ void PM_CatagorizePosition (void) sample1 = sample2 / 2; point[2] = pml.origin[2] + pm->mins[2] + 1; - cont = pm->pointcontents (point); + cont = pm->pointcontents(point); if (cont & MASK_WATER) { pm->watertype = cont; pm->waterlevel = 1; point[2] = pml.origin[2] + pm->mins[2] + sample1; - cont = pm->pointcontents (point); + cont = pm->pointcontents(point); if (cont & MASK_WATER) { pm->waterlevel = 2; point[2] = pml.origin[2] + pm->mins[2] + sample2; - cont = pm->pointcontents (point); + cont = pm->pointcontents(point); if (cont & MASK_WATER) + { pm->waterlevel = 3; + } } } - } -void PM_CheckJump (void) +void +PM_CheckJump(void) { if (pm->s.pm_flags & PMF_TIME_LAND) { @@ -710,10 +804,14 @@ void PM_CheckJump (void) /* must wait for jump to be released */ if (pm->s.pm_flags & PMF_JUMP_HELD) + { return; + } if (pm->s.pm_type == PM_DEAD) + { return; + } if (pm->waterlevel >= 2) { @@ -721,22 +819,30 @@ void PM_CheckJump (void) pm->groundentity = NULL; if (pml.velocity[2] <= -300) + { return; + } if (pm->watertype == CONTENTS_WATER) + { pml.velocity[2] = 100; - + } else if (pm->watertype == CONTENTS_SLIME) + { pml.velocity[2] = 80; - + } else + { pml.velocity[2] = 50; + } return; } if (pm->groundentity == NULL) - return; /* in air, so no effect */ + { + return; /* in air, so no effect */ + } pm->s.pm_flags |= PMF_JUMP_HELD; @@ -744,18 +850,23 @@ void PM_CheckJump (void) pml.velocity[2] += 270; if (pml.velocity[2] < 270) + { pml.velocity[2] = 270; + } } -void PM_CheckSpecialMovement (void) +void +PM_CheckSpecialMovement(void) { - vec3_t spot; - int cont; - vec3_t flatforward; - trace_t trace; + vec3_t spot; + int cont; + vec3_t flatforward; + trace_t trace; if (pm->s.pm_time) + { return; + } pml.ladder = false; @@ -763,99 +874,111 @@ void PM_CheckSpecialMovement (void) flatforward[0] = pml.forward[0]; flatforward[1] = pml.forward[1]; flatforward[2] = 0; - VectorNormalize (flatforward); + VectorNormalize(flatforward); - VectorMA (pml.origin, 1, flatforward, spot); - trace = pm->trace (pml.origin, pm->mins, pm->maxs, spot); + VectorMA(pml.origin, 1, flatforward, spot); + trace = pm->trace(pml.origin, pm->mins, pm->maxs, spot); if ((trace.fraction < 1) && (trace.contents & CONTENTS_LADDER)) + { pml.ladder = true; + } /* check for water jump */ if (pm->waterlevel != 2) + { return; + } - VectorMA (pml.origin, 30, flatforward, spot); + VectorMA(pml.origin, 30, flatforward, spot); spot[2] += 4; - cont = pm->pointcontents (spot); + cont = pm->pointcontents(spot); if (!(cont & CONTENTS_SOLID)) + { return; + } spot[2] += 16; - cont = pm->pointcontents (spot); + cont = pm->pointcontents(spot); if (cont) + { return; + } /* jump out of water */ - VectorScale (flatforward, 50, pml.velocity); + VectorScale(flatforward, 50, pml.velocity); pml.velocity[2] = 350; pm->s.pm_flags |= PMF_TIME_WATERJUMP; pm->s.pm_time = 255; } -void PM_FlyMove (qboolean doclip) +void +PM_FlyMove(qboolean doclip) { - float speed, drop, friction, control, newspeed; - float currentspeed, addspeed, accelspeed; - int i; - vec3_t wishvel; - float fmove, smove; - vec3_t wishdir; - float wishspeed; - vec3_t end; - trace_t trace; + float speed, drop, friction, control, newspeed; + float currentspeed, addspeed, accelspeed; + int i; + vec3_t wishvel; + float fmove, smove; + vec3_t wishdir; + float wishspeed; + vec3_t end; + trace_t trace; pm->viewheight = 22; /* friction */ - speed = VectorLength (pml.velocity); + speed = VectorLength(pml.velocity); if (speed < 1) { - VectorCopy (vec3_origin, pml.velocity); + VectorCopy(vec3_origin, pml.velocity); } - else { drop = 0; - friction = pm_friction*1.5f; /* extra friction */ + friction = pm_friction * 1.5f; /* extra friction */ control = speed < pm_stopspeed ? pm_stopspeed : speed; - drop += control*friction*pml.frametime; + drop += control * friction * pml.frametime; /* scale the velocity */ newspeed = speed - drop; if (newspeed < 0) + { newspeed = 0; + } newspeed /= speed; - VectorScale (pml.velocity, newspeed, pml.velocity); + VectorScale(pml.velocity, newspeed, pml.velocity); } /* accelerate */ fmove = pm->cmd.forwardmove; smove = pm->cmd.sidemove; - VectorNormalize (pml.forward); - VectorNormalize (pml.right); + VectorNormalize(pml.forward); + VectorNormalize(pml.right); - for (i=0 ; i<3 ; i++) - wishvel[i] = pml.forward[i]*fmove + pml.right[i]*smove; + for (i = 0; i < 3; i++) + { + wishvel[i] = pml.forward[i] * fmove + pml.right[i] * smove; + } wishvel[2] += pm->cmd.upmove; - VectorCopy (wishvel, wishdir); + VectorCopy(wishvel, wishdir); wishspeed = VectorNormalize(wishdir); /* clamp to server defined max speed */ if (wishspeed > pm_maxspeed) { - VectorScale (wishvel, pm_maxspeed/wishspeed, wishvel); + VectorScale(wishvel, pm_maxspeed / wishspeed, wishvel); wishspeed = pm_maxspeed; } @@ -863,39 +986,47 @@ void PM_FlyMove (qboolean doclip) addspeed = wishspeed - currentspeed; if (addspeed <= 0) + { return; + } - accelspeed = pm_accelerate*pml.frametime*wishspeed; + accelspeed = pm_accelerate * pml.frametime * wishspeed; if (accelspeed > addspeed) + { accelspeed = addspeed; + } - for (i=0 ; i<3 ; i++) - pml.velocity[i] += accelspeed*wishdir[i]; + for (i = 0; i < 3; i++) + { + pml.velocity[i] += accelspeed * wishdir[i]; + } if (doclip) { - for (i=0 ; i<3 ; i++) + for (i = 0; i < 3; i++) + { end[i] = pml.origin[i] + pml.frametime * pml.velocity[i]; + } - trace = pm->trace (pml.origin, pm->mins, pm->maxs, end); + trace = pm->trace(pml.origin, pm->mins, pm->maxs, end); - VectorCopy (trace.endpos, pml.origin); + VectorCopy(trace.endpos, pml.origin); } - else { /* move */ - VectorMA (pml.origin, pml.frametime, pml.velocity, pml.origin); + VectorMA(pml.origin, pml.frametime, pml.velocity, pml.origin); } } /* * Sets mins, maxs, and pm->viewheight */ -void PM_CheckDuck (void) +void +PM_CheckDuck(void) { - trace_t trace; + trace_t trace; pm->mins[0] = -16; pm->mins[1] = -16; @@ -917,13 +1048,11 @@ void PM_CheckDuck (void) { pm->s.pm_flags |= PMF_DUCKED; } - - else if (pm->cmd.upmove < 0 && (pm->s.pm_flags & PMF_ON_GROUND) ) + else if ((pm->cmd.upmove < 0) && (pm->s.pm_flags & PMF_ON_GROUND)) { /* duck */ pm->s.pm_flags |= PMF_DUCKED; } - else { /* stand up if possible */ @@ -931,10 +1060,12 @@ void PM_CheckDuck (void) { /* try to stand up */ pm->maxs[2] = 32; - trace = pm->trace (pml.origin, pm->mins, pm->maxs, pml.origin); + trace = pm->trace(pml.origin, pm->mins, pm->maxs, pml.origin); if (!trace.allsolid) + { pm->s.pm_flags &= ~PMF_DUCKED; + } } } @@ -943,7 +1074,6 @@ void PM_CheckDuck (void) pm->maxs[2] = 4; pm->viewheight = -2; } - else { pm->maxs[2] = 32; @@ -951,42 +1081,49 @@ void PM_CheckDuck (void) } } -void PM_DeadMove (void) +void +PM_DeadMove(void) { - float forward; + float forward; if (!pm->groundentity) + { return; + } /* extra friction */ - forward = VectorLength (pml.velocity); + forward = VectorLength(pml.velocity); forward -= 20; if (forward <= 0) { - VectorClear (pml.velocity); + VectorClear(pml.velocity); } - else { - VectorNormalize (pml.velocity); - VectorScale (pml.velocity, forward, pml.velocity); + VectorNormalize(pml.velocity); + VectorScale(pml.velocity, forward, pml.velocity); } } -qboolean PM_GoodPosition (void) +qboolean +PM_GoodPosition(void) { - trace_t trace; - vec3_t origin, end; - int i; + trace_t trace; + vec3_t origin, end; + int i; if (pm->s.pm_type == PM_SPECTATOR) + { return true; + } - for (i=0 ; i<3 ; i++) - origin[i] = end[i] = pm->s.origin[i]*0.125f; + for (i = 0; i < 3; i++) + { + origin[i] = end[i] = pm->s.origin[i] * 0.125f; + } - trace = pm->trace (origin, pm->mins, pm->maxs, end); + trace = pm->trace(origin, pm->mins, pm->maxs, end); return !trace.allsolid; } @@ -995,123 +1132,143 @@ qboolean PM_GoodPosition (void) * On exit, the origin will have a value that is pre-quantized to the 0.125 * precision of the network channel and in a valid position. */ -void PM_SnapPosition (void) +void +PM_SnapPosition(void) { - int sign[3]; - int i, j, bits; - short base[3]; + int sign[3]; + int i, j, bits; + short base[3]; /* try all single bits first */ - static int jitterbits[8] = {0,4,1,2,3,5,6,7}; + static int jitterbits[8] = {0, 4, 1, 2, 3, 5, 6, 7}; /* snap velocity to eigths */ - for (i=0 ; i<3 ; i++) - pm->s.velocity[i] = (int)(pml.velocity[i]*8); - - for (i=0 ; i<3 ; i++) + for (i = 0; i < 3; i++) { - if (pml.origin[i] >= 0) - sign[i] = 1; - - else - sign[i] = -1; - - pm->s.origin[i] = (int)(pml.origin[i]*8); - - if (pm->s.origin[i]*0.125f == pml.origin[i]) - sign[i] = 0; + pm->s.velocity[i] = (int)(pml.velocity[i] * 8); } - VectorCopy (pm->s.origin, base); + for (i = 0; i < 3; i++) + { + if (pml.origin[i] >= 0) + { + sign[i] = 1; + } + else + { + sign[i] = -1; + } + + pm->s.origin[i] = (int)(pml.origin[i] * 8); + + if (pm->s.origin[i] * 0.125f == pml.origin[i]) + { + sign[i] = 0; + } + } + + VectorCopy(pm->s.origin, base); /* try all combinations */ - for (j=0 ; j<8 ; j++) + for (j = 0; j < 8; j++) { bits = jitterbits[j]; - VectorCopy (base, pm->s.origin); + VectorCopy(base, pm->s.origin); - for (i=0 ; i<3 ; i++) - if (bits & (1<s.origin[i] += sign[i]; + } + } - if (PM_GoodPosition ()) + if (PM_GoodPosition()) + { return; + } } /* go back to the last position */ - VectorCopy (pml.previous_origin, pm->s.origin); + VectorCopy(pml.previous_origin, pm->s.origin); } -void PM_InitialSnapPosition(void) +void +PM_InitialSnapPosition(void) { - int x, y, z; - short base[3]; - static int offset[3] = { 0, -1, 1 }; + int x, y, z; + short base[3]; + static int offset[3] = {0, -1, 1}; - VectorCopy (pm->s.origin, base); + VectorCopy(pm->s.origin, base); - for ( z = 0; z < 3; z++ ) + for (z = 0; z < 3; z++) { - pm->s.origin[2] = base[2] + offset[ z ]; + pm->s.origin[2] = base[2] + offset[z]; - for ( y = 0; y < 3; y++ ) + for (y = 0; y < 3; y++) { - pm->s.origin[1] = base[1] + offset[ y ]; + pm->s.origin[1] = base[1] + offset[y]; - for ( x = 0; x < 3; x++ ) + for (x = 0; x < 3; x++) { - pm->s.origin[0] = base[0] + offset[ x ]; + pm->s.origin[0] = base[0] + offset[x]; - if (PM_GoodPosition ()) + if (PM_GoodPosition()) { - pml.origin[0] = pm->s.origin[0]*0.125f; - pml.origin[1] = pm->s.origin[1]*0.125f; - pml.origin[2] = pm->s.origin[2]*0.125f; - VectorCopy (pm->s.origin, pml.previous_origin); + pml.origin[0] = pm->s.origin[0] * 0.125f; + pml.origin[1] = pm->s.origin[1] * 0.125f; + pml.origin[2] = pm->s.origin[2] * 0.125f; + VectorCopy(pm->s.origin, pml.previous_origin); return; } } } } - Com_DPrintf ("Bad InitialSnapPosition\n"); + Com_DPrintf("Bad InitialSnapPosition\n"); } -void PM_ClampAngles (void) +void +PM_ClampAngles(void) { - short temp; - int i; + short temp; + int i; if (pm->s.pm_flags & PMF_TIME_TELEPORT) { - pm->viewangles[YAW] = SHORT2ANGLE(pm->cmd.angles[YAW] + pm->s.delta_angles[YAW]); + pm->viewangles[YAW] = SHORT2ANGLE( + pm->cmd.angles[YAW] + pm->s.delta_angles[YAW]); pm->viewangles[PITCH] = 0; pm->viewangles[ROLL] = 0; } - else { /* circularly clamp the angles with deltas */ - for (i=0 ; i<3 ; i++) + for (i = 0; i < 3; i++) { temp = pm->cmd.angles[i] + pm->s.delta_angles[i]; pm->viewangles[i] = SHORT2ANGLE(temp); } /* don't let the player look up or down more than 90 degrees */ - if (pm->viewangles[PITCH] > 89 && pm->viewangles[PITCH] < 180) + if ((pm->viewangles[PITCH] > 89) && (pm->viewangles[PITCH] < 180)) + { pm->viewangles[PITCH] = 89; - - else if (pm->viewangles[PITCH] < 271 && pm->viewangles[PITCH] >= 180) + } + else if ((pm->viewangles[PITCH] < 271) && (pm->viewangles[PITCH] >= 180)) + { pm->viewangles[PITCH] = 271; + } } - AngleVectors (pm->viewangles, pml.forward, pml.right, pml.up); + AngleVectors(pm->viewangles, pml.forward, pml.right, pml.up); } /* * Can be called by either the server or the client */ -void Pmove (pmove_t *pmove) +void +Pmove(pmove_t *pmove) { #if !defined(DEDICATED_ONLY) && defined(USE_OPENAL) static int underwater; @@ -1121,35 +1278,35 @@ void Pmove (pmove_t *pmove) /* clear results */ pm->numtouch = 0; - VectorClear (pm->viewangles); + VectorClear(pm->viewangles); pm->viewheight = 0; pm->groundentity = 0; pm->watertype = 0; pm->waterlevel = 0; /* clear all pmove local vars */ - memset (&pml, 0, sizeof(pml)); + memset(&pml, 0, sizeof(pml)); /* convert origin and velocity to float values */ - pml.origin[0] = pm->s.origin[0]*0.125f; - pml.origin[1] = pm->s.origin[1]*0.125f; - pml.origin[2] = pm->s.origin[2]*0.125f; + pml.origin[0] = pm->s.origin[0] * 0.125f; + pml.origin[1] = pm->s.origin[1] * 0.125f; + pml.origin[2] = pm->s.origin[2] * 0.125f; - pml.velocity[0] = pm->s.velocity[0]*0.125f; - pml.velocity[1] = pm->s.velocity[1]*0.125f; - pml.velocity[2] = pm->s.velocity[2]*0.125f; + pml.velocity[0] = pm->s.velocity[0] * 0.125f; + pml.velocity[1] = pm->s.velocity[1] * 0.125f; + pml.velocity[2] = pm->s.velocity[2] * 0.125f; /* save old org in case we get stuck */ - VectorCopy (pm->s.origin, pml.previous_origin); + VectorCopy(pm->s.origin, pml.previous_origin); pml.frametime = pm->cmd.msec * 0.001f; - PM_ClampAngles (); + PM_ClampAngles(); if (pm->s.pm_type == PM_SPECTATOR) { - PM_FlyMove (false); - PM_SnapPosition (); + PM_FlyMove(false); + PM_SnapPosition(); return; } @@ -1161,40 +1318,50 @@ void Pmove (pmove_t *pmove) } if (pm->s.pm_type == PM_FREEZE) - return; /* no movement at all */ + { + return; /* no movement at all */ + } /* set mins, maxs, and viewheight */ - PM_CheckDuck (); + PM_CheckDuck(); if (pm->snapinitial) - PM_InitialSnapPosition (); + { + PM_InitialSnapPosition(); + } /* set groundentity, watertype, and waterlevel */ - PM_CatagorizePosition (); + PM_CatagorizePosition(); if (pm->s.pm_type == PM_DEAD) - PM_DeadMove (); + { + PM_DeadMove(); + } - PM_CheckSpecialMovement (); + PM_CheckSpecialMovement(); /* drop timing counter */ if (pm->s.pm_time) { - int msec; + int msec; msec = pm->cmd.msec >> 3; if (!msec) - msec = 1; - - if ( msec >= pm->s.pm_time) { - pm->s.pm_flags &= ~(PMF_TIME_WATERJUMP | PMF_TIME_LAND | PMF_TIME_TELEPORT); - pm->s.pm_time = 0; + msec = 1; } + if (msec >= pm->s.pm_time) + { + pm->s.pm_flags &= + ~(PMF_TIME_WATERJUMP | PMF_TIME_LAND | PMF_TIME_TELEPORT); + pm->s.pm_time = 0; + } else + { pm->s.pm_time -= msec; + } } if (pm->s.pm_flags & PMF_TIME_TELEPORT) @@ -1213,36 +1380,39 @@ void Pmove (pmove_t *pmove) pm->s.pm_time = 0; } - PM_StepSlideMove (); + PM_StepSlideMove(); } else { - PM_CheckJump (); + PM_CheckJump(); - PM_Friction (); + PM_Friction(); if (pm->waterlevel >= 2) - PM_WaterMove (); - + { + PM_WaterMove(); + } else { - vec3_t angles; + vec3_t angles; VectorCopy(pm->viewangles, angles); if (angles[PITCH] > 180) + { angles[PITCH] = angles[PITCH] - 360; + } angles[PITCH] /= 3; - AngleVectors (angles, pml.forward, pml.right, pml.up); + AngleVectors(angles, pml.forward, pml.right, pml.up); - PM_AirMove (); + PM_AirMove(); } } /* set groundentity, watertype, and waterlevel for final spot */ - PM_CatagorizePosition (); + PM_CatagorizePosition(); #if !defined(DEDICATED_ONLY) && defined(USE_OPENAL) if ((pm->waterlevel == 3) && !underwater) @@ -1251,12 +1421,13 @@ void Pmove (pmove_t *pmove) AL_Underwater(); } - if ((pm->waterlevel < 3 && underwater)) + if (((pm->waterlevel < 3) && underwater)) { underwater = 0; AL_Overwater(); } #endif - PM_SnapPosition (); + PM_SnapPosition(); } + diff --git a/src/common/szone.c b/src/common/szone.c index 6b94d632..190bd815 100644 --- a/src/common/szone.c +++ b/src/common/szone.c @@ -26,34 +26,42 @@ #include "header/common.h" -void SZ_Init (sizebuf_t *buf, byte *data, int length) +void +SZ_Init(sizebuf_t *buf, byte *data, int length) { - memset (buf, 0, sizeof(*buf)); + memset(buf, 0, sizeof(*buf)); buf->data = data; buf->maxsize = length; } -void SZ_Clear (sizebuf_t *buf) +void +SZ_Clear(sizebuf_t *buf) { buf->cursize = 0; buf->overflowed = false; } -void *SZ_GetSpace (sizebuf_t *buf, int length) +void * +SZ_GetSpace(sizebuf_t *buf, int length) { - void *data; + void *data; if (buf->cursize + length > buf->maxsize) { if (!buf->allowoverflow) - Com_Error (ERR_FATAL, "SZ_GetSpace: overflow without allowoverflow set"); + { + Com_Error(ERR_FATAL, "SZ_GetSpace: overflow without allowoverflow set"); + } if (length > buf->maxsize) - Com_Error (ERR_FATAL, "SZ_GetSpace: %i is > full buffer size", length); + { + Com_Error(ERR_FATAL, "SZ_GetSpace: %i is > full buffer size", + length); + } - SZ_Clear (buf); + SZ_Clear(buf); buf->overflowed = true; - Com_Printf ("SZ_GetSpace: overflow\n"); + Com_Printf("SZ_GetSpace: overflow\n"); } data = buf->data + buf->cursize; @@ -62,26 +70,33 @@ void *SZ_GetSpace (sizebuf_t *buf, int length) return data; } -void SZ_Write (sizebuf_t *buf, void *data, int length) +void +SZ_Write(sizebuf_t *buf, void *data, int length) { - memcpy (SZ_GetSpace(buf,length),data,length); + memcpy(SZ_GetSpace(buf, length), data, length); } -void SZ_Print (sizebuf_t *buf, char *data) +void +SZ_Print(sizebuf_t *buf, char *data) { - int len; + int len; - len = (int)strlen(data)+1; + len = (int)strlen(data) + 1; if (buf->cursize) { - if (buf->data[buf->cursize-1]) - memcpy ((byte *)SZ_GetSpace(buf, len),data,len); /* no trailing 0 */ - + if (buf->data[buf->cursize - 1]) + { + memcpy((byte *)SZ_GetSpace(buf, len), data, len); /* no trailing 0 */ + } else - memcpy ((byte *)SZ_GetSpace(buf, len-1)-1,data,len); /* write over trailing 0 */ + { + memcpy((byte *)SZ_GetSpace(buf, len - 1) - 1, data, len); /* write over trailing 0 */ + } } - else - memcpy ((byte *)SZ_GetSpace(buf, len),data,len); + { + memcpy((byte *)SZ_GetSpace(buf, len), data, len); + } } + diff --git a/src/common/zone.c b/src/common/zone.c index 24bec289..275ef07b 100644 --- a/src/common/zone.c +++ b/src/common/zone.c @@ -19,7 +19,7 @@ * * ======================================================================= * - * Zone malloc. It's just a normal mallic with counter. + * Zone malloc. It's just a normal malloc with tags. * * ======================================================================= */ @@ -29,20 +29,21 @@ #define Z_MAGIC 0x1d1d -zhead_t z_chain; -int z_count, z_bytes; +zhead_t z_chain; +int z_count, z_bytes; -void Z_Free (void *ptr) +void +Z_Free(void *ptr) { - zhead_t *z; + zhead_t *z; z = ((zhead_t *)ptr) - 1; if (z->magic != Z_MAGIC) { - printf( "free: %p failed\n", ptr ); + printf("free: %p failed\n", ptr); abort(); - Com_Error (ERR_FATAL, "Z_Free: bad magic"); + Com_Error(ERR_FATAL, "Z_Free: bad magic"); } z->prev->next = z->next; @@ -50,38 +51,45 @@ void Z_Free (void *ptr) z_count--; z_bytes -= z->size; - free (z); + free(z); } -void Z_Stats_f (void) +void +Z_Stats_f(void) { - Com_Printf ("%i bytes in %i blocks\n", z_bytes, z_count); + Com_Printf("%i bytes in %i blocks\n", z_bytes, z_count); } -void Z_FreeTags (int tag) +void +Z_FreeTags(int tag) { - zhead_t *z, *next; + zhead_t *z, *next; - for (z=z_chain.next ; z != &z_chain ; z=next) + for (z = z_chain.next; z != &z_chain; z = next) { next = z->next; if (z->tag == tag) - Z_Free ((void *)(z+1)); + { + Z_Free((void *)(z + 1)); + } } } -void *Z_TagMalloc (int size, int tag) +void * +Z_TagMalloc(int size, int tag) { - zhead_t *z; + zhead_t *z; size = size + sizeof(zhead_t); z = malloc(size); if (!z) - Com_Error (ERR_FATAL, "Z_Malloc: failed on allocation of %i bytes",size); + { + Com_Error(ERR_FATAL, "Z_Malloc: failed on allocation of %i bytes", size); + } - memset (z, 0, size); + memset(z, 0, size); z_count++; z_bytes += size; z->magic = Z_MAGIC; @@ -93,10 +101,12 @@ void *Z_TagMalloc (int size, int tag) z_chain.next->prev = z; z_chain.next = z; - return (void *)(z+1); + return (void *)(z + 1); } -void *Z_Malloc (int size) +void * +Z_Malloc(int size) { - return Z_TagMalloc (size, 0); + return Z_TagMalloc(size, 0); } + diff --git a/src/sdl/cd.c b/src/sdl/cd.c index 82e3a6c5..64dee575 100644 --- a/src/sdl/cd.c +++ b/src/sdl/cd.c @@ -30,9 +30,9 @@ #include #ifdef _WIN32 -#include "SDL/SDL.h" + #include "SDL/SDL.h" #else -#include "SDL.h" + #include "SDL.h" #endif #include "../client/header/client.h" @@ -49,39 +49,39 @@ cvar_t *cd_volume; cvar_t *cd_nocd; cvar_t *cd_dev; -static void CD_f (); +static void CD_f(); static void -CDAudio_Eject () +CDAudio_Eject() { - if ( !cd_id || !enabled ) + if (!cd_id || !enabled) { return; } - if ( SDL_CDEject( cd_id ) ) + if (SDL_CDEject(cd_id)) { - Com_DPrintf( "Unable to eject CD-ROM tray.\n" ); + Com_DPrintf("Unable to eject CD-ROM tray.\n"); } } void -CDAudio_Play ( int track, qboolean looping ) +CDAudio_Play(int track, qboolean looping) { CDstatus cd_stat; lastTrack = track + 1; - if ( !cd_id || !enabled ) + if (!cd_id || !enabled) { return; } - cd_stat = SDL_CDStatus( cd_id ); + cd_stat = SDL_CDStatus(cd_id); - if ( !cdValid ) + if (!cdValid) { - if ( !CD_INDRIVE( cd_stat ) || ( !cd_id->numtracks ) ) + if (!CD_INDRIVE(cd_stat) || (!cd_id->numtracks)) { return; } @@ -89,17 +89,17 @@ CDAudio_Play ( int track, qboolean looping ) cdValid = true; } - if ( ( track < 1 ) || ( track >= cd_id->numtracks ) ) + if ((track < 1) || (track >= cd_id->numtracks)) { - Com_DPrintf( "CDAudio: Bad track number: %d\n", track ); + Com_DPrintf("CDAudio: Bad track number: %d\n", track); return; } track--; - if ( cd_stat == CD_PLAYING ) + if (cd_stat == CD_PLAYING) { - if ( cd_id->cur_track == track ) + if (cd_id->cur_track == track) { return; } @@ -107,10 +107,11 @@ CDAudio_Play ( int track, qboolean looping ) CDAudio_Stop(); } - if ( SDL_CDPlay( cd_id, cd_id->track [ track ].offset, - cd_id->track [ track ].length ) ) + if (SDL_CDPlay(cd_id, cd_id->track[track].offset, + cd_id->track[track].length)) { - Com_DPrintf( "CDAudio_Play: Unable to play track: %d (%s)\n", track + 1, SDL_GetError() ); + Com_DPrintf("CDAudio_Play: Unable to play track: %d (%s)\n", + track + 1, SDL_GetError()); return; } @@ -118,35 +119,35 @@ CDAudio_Play ( int track, qboolean looping ) } void -CDAudio_RandomPlay ( void ) +CDAudio_RandomPlay(void) { int track, i = 0, free_tracks = 0; float f; CDstatus cd_stat; byte *track_bools; - if ( !cd_id || !enabled ) + if (!cd_id || !enabled) { return; } - track_bools = (byte *) malloc( cd_id->numtracks * sizeof ( byte ) ); + track_bools = (byte *)malloc(cd_id->numtracks * sizeof(byte)); - if ( track_bools == 0 ) + if (track_bools == 0) { return; } /* create an array of available audio tracknumbers */ - for ( ; i < cd_id->numtracks; i++ ) + for ( ; i < cd_id->numtracks; i++) { - track_bools [ i ] = cd_id->track [ i ].type == SDL_AUDIO_TRACK; - free_tracks += track_bools [ i ]; + track_bools[i] = cd_id->track[i].type == SDL_AUDIO_TRACK; + free_tracks += track_bools[i]; } - if ( !free_tracks ) + if (!free_tracks) { - Com_DPrintf( "CDAudio_RandomPlay: Unable to find and play a random audio track, insert an audio cd please" ); + Com_DPrintf("CDAudio_RandomPlay: Unable to find and play a random audio track, insert an audio cd please"); goto free_end; } @@ -155,18 +156,18 @@ CDAudio_RandomPlay ( void ) { do { - f = ( (float) randk() ) / ( (float) RAND_MAX + 1.0 ); - track = (int) ( cd_id->numtracks * f ); + f = ((float)randk()) / ((float)RAND_MAX + 1.0); + track = (int)(cd_id->numtracks * f); } - while ( !track_bools [ track ] ); + while (!track_bools[track]); lastTrack = track + 1; - cd_stat = SDL_CDStatus( cd_id ); + cd_stat = SDL_CDStatus(cd_id); - if ( !cdValid ) + if (!cdValid) { - if ( !CD_INDRIVE( cd_stat ) || ( !cd_id->numtracks ) ) + if (!CD_INDRIVE(cd_stat) || (!cd_id->numtracks)) { goto free_end; } @@ -174,9 +175,9 @@ CDAudio_RandomPlay ( void ) cdValid = true; } - if ( cd_stat == CD_PLAYING ) + if (cd_stat == CD_PLAYING) { - if ( cd_id->cur_track == track + 1 ) + if (cd_id->cur_track == track + 1) { goto free_end; } @@ -184,10 +185,10 @@ CDAudio_RandomPlay ( void ) CDAudio_Stop(); } - if ( SDL_CDPlay( cd_id, cd_id->track [ track ].offset, - cd_id->track [ track ].length ) ) + if (SDL_CDPlay(cd_id, cd_id->track[track].offset, + cd_id->track[track].length)) { - track_bools [ track ] = 0; + track_bools[track] = 0; free_tracks--; } else @@ -196,95 +197,95 @@ CDAudio_RandomPlay ( void ) break; } } - while ( free_tracks > 0 ); + while (free_tracks > 0); free_end: - free( (void *) track_bools ); + free((void *)track_bools); } void -CDAudio_Stop () +CDAudio_Stop() { int cdstate; - if ( !cd_id || !enabled ) + if (!cd_id || !enabled) { return; } - cdstate = SDL_CDStatus( cd_id ); + cdstate = SDL_CDStatus(cd_id); - if ( ( cdstate != CD_PLAYING ) && ( cdstate != CD_PAUSED ) ) + if ((cdstate != CD_PLAYING) && (cdstate != CD_PAUSED)) { return; } - if ( SDL_CDStop( cd_id ) ) + if (SDL_CDStop(cd_id)) { - Com_DPrintf( "CDAudio_Stop: Failed to stop track.\n" ); + Com_DPrintf("CDAudio_Stop: Failed to stop track.\n"); } playLooping = 0; } void -CDAudio_Pause () +CDAudio_Pause() { - if ( !cd_id || !enabled ) + if (!cd_id || !enabled) { return; } - if ( SDL_CDStatus( cd_id ) != CD_PLAYING ) + if (SDL_CDStatus(cd_id) != CD_PLAYING) { return; } - if ( SDL_CDPause( cd_id ) ) + if (SDL_CDPause(cd_id)) { - Com_DPrintf( "CDAudio_Pause: Failed to pause track.\n" ); + Com_DPrintf("CDAudio_Pause: Failed to pause track.\n"); } } void -CDAudio_Resume () +CDAudio_Resume() { - if ( !cd_id || !enabled ) + if (!cd_id || !enabled) { return; } - if ( SDL_CDStatus( cd_id ) != CD_PAUSED ) + if (SDL_CDStatus(cd_id) != CD_PAUSED) { return; } - if ( SDL_CDResume( cd_id ) ) + if (SDL_CDResume(cd_id)) { - Com_DPrintf( "CDAudio_Resume: Failed to resume track.\n" ); + Com_DPrintf("CDAudio_Resume: Failed to resume track.\n"); } } void -CDAudio_Update () +CDAudio_Update() { static int cnt = 0; - if ( !cd_id || !enabled ) + if (!cd_id || !enabled) { return; } - if ( cd_volume && ( cd_volume->value != cdvolume ) ) + if (cd_volume && (cd_volume->value != cdvolume)) { - if ( cdvolume ) + if (cdvolume) { - Cvar_SetValue( "cd_volume", 0.0 ); + Cvar_SetValue("cd_volume", 0.0); CDAudio_Pause(); } else { - Cvar_SetValue( "cd_volume", 1.0 ); + Cvar_SetValue("cd_volume", 1.0); CDAudio_Resume(); } @@ -293,150 +294,150 @@ CDAudio_Update () } /* this causes too much overhead to be executed every frame */ - if ( ++cnt == 16 ) + if (++cnt == 16) { cnt = 0; - if ( cd_nocd->value ) + if (cd_nocd->value) { CDAudio_Stop(); return; } - if ( playLooping && - ( SDL_CDStatus( cd_id ) != CD_PLAYING ) && - ( SDL_CDStatus( cd_id ) != CD_PAUSED ) ) + if (playLooping && + (SDL_CDStatus(cd_id) != CD_PLAYING) && + (SDL_CDStatus(cd_id) != CD_PAUSED)) { - CDAudio_Play( lastTrack, true ); + CDAudio_Play(lastTrack, true); } } } int -CDAudio_Init () +CDAudio_Init() { cvar_t *cv; - if ( initialized ) + if (initialized) { - return ( 0 ); + return 0; } - cv = Cvar_Get( "nocdaudio", "0", CVAR_NOSET ); + cv = Cvar_Get("nocdaudio", "0", CVAR_NOSET); - if ( cv->value ) + if (cv->value) { - return ( -1 ); + return -1; } - cd_nocd = Cvar_Get( "cd_nocd", "0", CVAR_ARCHIVE ); + cd_nocd = Cvar_Get("cd_nocd", "0", CVAR_ARCHIVE); - if ( cd_nocd->value ) + if (cd_nocd->value) { - return ( -1 ); + return -1; } - cd_volume = Cvar_Get( "cd_volume", "1", CVAR_ARCHIVE ); + cd_volume = Cvar_Get("cd_volume", "1", CVAR_ARCHIVE); - if ( SDL_WasInit( SDL_INIT_EVERYTHING ) == 0 ) + if (SDL_WasInit(SDL_INIT_EVERYTHING) == 0) { - if ( SDL_Init( SDL_INIT_CDROM ) < 0 ) + if (SDL_Init(SDL_INIT_CDROM) < 0) { - Com_Printf( "Couldn't init SDL cdrom: %s\n", SDL_GetError() ); - return ( -1 ); + Com_Printf("Couldn't init SDL cdrom: %s\n", SDL_GetError()); + return -1; } } - else if ( SDL_WasInit( SDL_INIT_CDROM ) == 0 ) + else if (SDL_WasInit(SDL_INIT_CDROM) == 0) { - if ( SDL_InitSubSystem( SDL_INIT_CDROM ) < 0 ) + if (SDL_InitSubSystem(SDL_INIT_CDROM) < 0) { - Com_Printf( "Couldn't init SDL cdrom: %s\n", SDL_GetError() ); - return ( -1 ); + Com_Printf("Couldn't init SDL cdrom: %s\n", SDL_GetError()); + return -1; } } - cd_id = SDL_CDOpen( 0 ); + cd_id = SDL_CDOpen(0); - if ( !cd_id ) + if (!cd_id) { - Com_Printf( "CDAudio_Init: Unable to open default CD-ROM drive: %s\n", - SDL_GetError() ); - return ( -1 ); + Com_Printf("CDAudio_Init: Unable to open default CD-ROM drive: %s\n", + SDL_GetError()); + return -1; } initialized = true; enabled = true; cdValid = true; - if ( !CD_INDRIVE( SDL_CDStatus( cd_id ) ) ) + if (!CD_INDRIVE(SDL_CDStatus(cd_id))) { - Com_Printf( "CDAudio_Init: No CD in drive.\n" ); + Com_Printf("CDAudio_Init: No CD in drive.\n"); cdValid = false; } - if ( !cd_id->numtracks ) + if (!cd_id->numtracks) { - Com_Printf( "CDAudio_Init: CD contains no audio tracks.\n" ); + Com_Printf("CDAudio_Init: CD contains no audio tracks.\n"); cdValid = false; } - Cmd_AddCommand( "cd", CD_f ); - Com_Printf( "CD Audio Initialized.\n" ); - return ( 0 ); + Cmd_AddCommand("cd", CD_f); + Com_Printf("CD Audio Initialized.\n"); + return 0; } void -CDAudio_Shutdown () +CDAudio_Shutdown() { - if ( !cd_id ) + if (!cd_id) { return; } CDAudio_Stop(); - SDL_CDClose( cd_id ); + SDL_CDClose(cd_id); cd_id = NULL; - if ( SDL_WasInit( SDL_INIT_EVERYTHING ) == SDL_INIT_CDROM ) + if (SDL_WasInit(SDL_INIT_EVERYTHING) == SDL_INIT_CDROM) { SDL_Quit(); } else { - SDL_QuitSubSystem( SDL_INIT_CDROM ); + SDL_QuitSubSystem(SDL_INIT_CDROM); } initialized = false; } static void -CD_f () +CD_f() { char *command; int cdstate; - if ( Cmd_Argc() < 2 ) + if (Cmd_Argc() < 2) { return; } - command = Cmd_Argv( 1 ); + command = Cmd_Argv(1); - if ( !Q_strcasecmp( command, "on" ) ) + if (!Q_strcasecmp(command, "on")) { enabled = true; } - if ( !Q_strcasecmp( command, "off" ) ) + if (!Q_strcasecmp(command, "off")) { - if ( !cd_id ) + if (!cd_id) { return; } - cdstate = SDL_CDStatus( cd_id ); + cdstate = SDL_CDStatus(cd_id); - if ( ( cdstate == CD_PLAYING ) || ( cdstate == CD_PAUSED ) ) + if ((cdstate == CD_PLAYING) || (cdstate == CD_PAUSED)) { CDAudio_Stop(); } @@ -445,64 +446,64 @@ CD_f () return; } - if ( !Q_strcasecmp( command, "play" ) ) + if (!Q_strcasecmp(command, "play")) { - CDAudio_Play( (byte) (int)strtol( Cmd_Argv( 2 ), (char **)NULL, 10 ), false ); + CDAudio_Play((byte)(int)strtol(Cmd_Argv(2), (char **)NULL, 10), false); return; } - if ( !Q_strcasecmp( command, "loop" ) ) + if (!Q_strcasecmp(command, "loop")) { - CDAudio_Play( (byte) (int)strtol( Cmd_Argv( 2 ), (char **)NULL, 10 ), true ); + CDAudio_Play((byte)(int)strtol(Cmd_Argv(2), (char **)NULL, 10), true); return; } - if ( !Q_strcasecmp( command, "stop" ) ) + if (!Q_strcasecmp(command, "stop")) { CDAudio_Stop(); return; } - if ( !Q_strcasecmp( command, "pause" ) ) + if (!Q_strcasecmp(command, "pause")) { CDAudio_Pause(); return; } - if ( !Q_strcasecmp( command, "resume" ) ) + if (!Q_strcasecmp(command, "resume")) { CDAudio_Resume(); return; } - if ( !Q_strcasecmp( command, "eject" ) ) + if (!Q_strcasecmp(command, "eject")) { CDAudio_Eject(); return; } - if ( !Q_strcasecmp( command, "info" ) ) + if (!Q_strcasecmp(command, "info")) { - if ( !cd_id ) + if (!cd_id) { return; } - cdstate = SDL_CDStatus( cd_id ); - Com_Printf( "%d tracks\n", cd_id->numtracks ); + cdstate = SDL_CDStatus(cd_id); + Com_Printf("%d tracks\n", cd_id->numtracks); - if ( cdstate == CD_PLAYING ) + if (cdstate == CD_PLAYING) { - Com_Printf( "Currently %s track %d\n", + Com_Printf("Currently %s track %d\n", playLooping ? "looping" : "playing", - cd_id->cur_track + 1 ); + cd_id->cur_track + 1); } else - if ( cdstate == CD_PAUSED ) + if (cdstate == CD_PAUSED) { - Com_Printf( "Paused %s track %d\n", + Com_Printf("Paused %s track %d\n", playLooping ? "looping" : "playing", - cd_id->cur_track + 1 ); + cd_id->cur_track + 1); } return; @@ -510,9 +511,9 @@ CD_f () } void -CDAudio_Activate ( qboolean active ) +CDAudio_Activate(qboolean active) { - if ( active ) + if (active) { CDAudio_Resume(); } diff --git a/src/sdl/input.c b/src/sdl/input.c index 41521dec..6959962f 100644 --- a/src/sdl/input.c +++ b/src/sdl/input.c @@ -39,31 +39,31 @@ #define MOUSE_MAX 3000 #define MOUSE_MIN 40 -static int old_windowed_mouse; -static cvar_t *windowed_mouse; -static cvar_t *in_grab; -static int mouse_x, mouse_y; -static int old_mouse_x, old_mouse_y; -static int mouse_buttonstate; -static int mouse_oldbuttonstate; +static int old_windowed_mouse; +static cvar_t *windowed_mouse; +static cvar_t *in_grab; +static int mouse_x, mouse_y; +static int old_mouse_x, old_mouse_y; +static int mouse_buttonstate; +static int mouse_oldbuttonstate; struct { - int key; - int down; + int key; + int down; } keyq[128]; -int keyq_head=0; -int keyq_tail=0; +int keyq_head = 0; +int keyq_tail = 0; int mx; int my; Key_Event_fp_t Key_Event_fp; -extern SDL_Surface *surface; -static in_state_t *in_state; +extern SDL_Surface *surface; +static in_state_t *in_state; static unsigned char KeyStates[SDLK_LAST]; -static qboolean mlooking; +static qboolean mlooking; static cvar_t *sensitivity; static cvar_t *exponential_speedup; @@ -84,103 +84,228 @@ static cvar_t *in_mouse; int IN_TranslateSDLtoQ2Key(unsigned int keysym) { - int key = 0; + int key = 0; - if( keysym >= SDLK_SPACE && keysym < SDLK_DELETE ) - { - /* These happen to match the ASCII chars */ - key = (int)keysym; - } - else - { - switch( keysym ) - { - case SDLK_PAGEUP: key = K_PGUP; break; - case SDLK_KP9: key = K_KP_PGUP; break; - case SDLK_PAGEDOWN: key = K_PGDN; break; - case SDLK_KP3: key = K_KP_PGDN; break; - case SDLK_KP7: key = K_KP_HOME; break; - case SDLK_HOME: key = K_HOME; break; - case SDLK_KP1: key = K_KP_END; break; - case SDLK_END: key = K_END; break; - case SDLK_KP4: key = K_KP_LEFTARROW; break; - case SDLK_LEFT: key = K_LEFTARROW; break; - case SDLK_KP6: key = K_KP_RIGHTARROW; break; - case SDLK_RIGHT: key = K_RIGHTARROW; break; - case SDLK_KP2: key = K_KP_DOWNARROW; break; - case SDLK_DOWN: key = K_DOWNARROW; break; - case SDLK_KP8: key = K_KP_UPARROW; break; - case SDLK_UP: key = K_UPARROW; break; - case SDLK_ESCAPE: key = K_ESCAPE; break; - case SDLK_KP_ENTER: key = K_KP_ENTER; break; - case SDLK_RETURN: key = K_ENTER; break; - case SDLK_TAB: key = K_TAB; break; - case SDLK_F1: key = K_F1; break; - case SDLK_F2: key = K_F2; break; - case SDLK_F3: key = K_F3; break; - case SDLK_F4: key = K_F4; break; - case SDLK_F5: key = K_F5; break; - case SDLK_F6: key = K_F6; break; - case SDLK_F7: key = K_F7; break; - case SDLK_F8: key = K_F8; break; - case SDLK_F9: key = K_F9; break; - case SDLK_F10: key = K_F10; break; - case SDLK_F11: key = K_F11; break; - case SDLK_F12: key = K_F12; break; - case SDLK_F13: key = K_F13; break; - case SDLK_F14: key = K_F14; break; - case SDLK_F15: key = K_F15; break; + if ((keysym >= SDLK_SPACE) && (keysym < SDLK_DELETE)) + { + /* These happen to match + the ASCII chars */ + key = (int)keysym; + } + else + { + switch (keysym) + { + case SDLK_PAGEUP: + key = K_PGUP; + break; + case SDLK_KP9: + key = K_KP_PGUP; + break; + case SDLK_PAGEDOWN: + key = K_PGDN; + break; + case SDLK_KP3: + key = K_KP_PGDN; + break; + case SDLK_KP7: + key = K_KP_HOME; + break; + case SDLK_HOME: + key = K_HOME; + break; + case SDLK_KP1: + key = K_KP_END; + break; + case SDLK_END: + key = K_END; + break; + case SDLK_KP4: + key = K_KP_LEFTARROW; + break; + case SDLK_LEFT: + key = K_LEFTARROW; + break; + case SDLK_KP6: + key = K_KP_RIGHTARROW; + break; + case SDLK_RIGHT: + key = K_RIGHTARROW; + break; + case SDLK_KP2: + key = K_KP_DOWNARROW; + break; + case SDLK_DOWN: + key = K_DOWNARROW; + break; + case SDLK_KP8: + key = K_KP_UPARROW; + break; + case SDLK_UP: + key = K_UPARROW; + break; + case SDLK_ESCAPE: + key = K_ESCAPE; + break; + case SDLK_KP_ENTER: + key = K_KP_ENTER; + break; + case SDLK_RETURN: + key = K_ENTER; + break; + case SDLK_TAB: + key = K_TAB; + break; + case SDLK_F1: + key = K_F1; + break; + case SDLK_F2: + key = K_F2; + break; + case SDLK_F3: + key = K_F3; + break; + case SDLK_F4: + key = K_F4; + break; + case SDLK_F5: + key = K_F5; + break; + case SDLK_F6: + key = K_F6; + break; + case SDLK_F7: + key = K_F7; + break; + case SDLK_F8: + key = K_F8; + break; + case SDLK_F9: + key = K_F9; + break; + case SDLK_F10: + key = K_F10; + break; + case SDLK_F11: + key = K_F11; + break; + case SDLK_F12: + key = K_F12; + break; + case SDLK_F13: + key = K_F13; + break; + case SDLK_F14: + key = K_F14; + break; + case SDLK_F15: + key = K_F15; + break; + case SDLK_BACKSPACE: + key = K_BACKSPACE; + break; + case SDLK_KP_PERIOD: + key = K_KP_DEL; + break; + case SDLK_DELETE: + key = K_DEL; + break; + case SDLK_PAUSE: + key = K_PAUSE; + break; + case SDLK_LSHIFT: + case SDLK_RSHIFT: + key = K_SHIFT; + break; + case SDLK_LCTRL: + case SDLK_RCTRL: + key = K_CTRL; + break; + case SDLK_RMETA: + case SDLK_LMETA: + key = K_COMMAND; + break; + case SDLK_RALT: + case SDLK_LALT: + key = K_ALT; + break; + case SDLK_LSUPER: + case SDLK_RSUPER: + key = K_SUPER; + break; + case SDLK_KP5: + key = K_KP_5; + break; + case SDLK_INSERT: + key = K_INS; + break; + case SDLK_KP0: + key = K_KP_INS; + break; + case SDLK_KP_MULTIPLY: + key = K_KP_STAR; + break; + case SDLK_KP_PLUS: + key = K_KP_PLUS; + break; + case SDLK_KP_MINUS: + key = K_KP_MINUS; + break; + case SDLK_KP_DIVIDE: + key = K_KP_SLASH; + break; + case SDLK_MODE: + key = K_MODE; + break; + case SDLK_COMPOSE: + key = K_COMPOSE; + break; + case SDLK_HELP: + key = K_HELP; + break; + case SDLK_PRINT: + key = K_PRINT; + break; + case SDLK_SYSREQ: + key = K_SYSREQ; + break; + case SDLK_BREAK: + key = K_BREAK; + break; + case SDLK_MENU: + key = K_MENU; + break; + case SDLK_POWER: + key = K_POWER; + break; + case SDLK_EURO: + key = K_EURO; + break; + case SDLK_UNDO: + key = K_UNDO; + break; + case SDLK_SCROLLOCK: + key = K_SCROLLOCK; + break; + case SDLK_NUMLOCK: + key = K_KP_NUMLOCK; + break; + case SDLK_CAPSLOCK: + key = K_CAPSLOCK; + break; - case SDLK_BACKSPACE: key = K_BACKSPACE; break; - case SDLK_KP_PERIOD: key = K_KP_DEL; break; - case SDLK_DELETE: key = K_DEL; break; - case SDLK_PAUSE: key = K_PAUSE; break; + default: - case SDLK_LSHIFT: - case SDLK_RSHIFT: key = K_SHIFT; break; + if ((keysym >= SDLK_WORLD_0) && (keysym <= SDLK_WORLD_95)) + { + key = (keysym - SDLK_WORLD_0) + K_WORLD_0; + } - case SDLK_LCTRL: - case SDLK_RCTRL: key = K_CTRL; break; + break; + } + } - case SDLK_RMETA: - case SDLK_LMETA: key = K_COMMAND; break; - - case SDLK_RALT: - case SDLK_LALT: key = K_ALT; break; - - case SDLK_LSUPER: - case SDLK_RSUPER: key = K_SUPER; break; - - case SDLK_KP5: key = K_KP_5; break; - case SDLK_INSERT: key = K_INS; break; - case SDLK_KP0: key = K_KP_INS; break; - case SDLK_KP_MULTIPLY: key = K_KP_STAR; break; - case SDLK_KP_PLUS: key = K_KP_PLUS; break; - case SDLK_KP_MINUS: key = K_KP_MINUS; break; - case SDLK_KP_DIVIDE: key = K_KP_SLASH; break; - - case SDLK_MODE: key = K_MODE; break; - case SDLK_COMPOSE: key = K_COMPOSE; break; - case SDLK_HELP: key = K_HELP; break; - case SDLK_PRINT: key = K_PRINT; break; - case SDLK_SYSREQ: key = K_SYSREQ; break; - case SDLK_BREAK: key = K_BREAK; break; - case SDLK_MENU: key = K_MENU; break; - case SDLK_POWER: key = K_POWER; break; - case SDLK_EURO: key = K_EURO; break; - case SDLK_UNDO: key = K_UNDO; break; - case SDLK_SCROLLOCK: key = K_SCROLLOCK; break; - case SDLK_NUMLOCK: key = K_KP_NUMLOCK; break; - case SDLK_CAPSLOCK: key = K_CAPSLOCK; break; - - default: - if( keysym >= SDLK_WORLD_0 && keysym <= SDLK_WORLD_95 ) - key = ( keysym - SDLK_WORLD_0 ) + K_WORLD_0; - break; - } - } - - return key; + return key; } /* @@ -191,10 +316,11 @@ IN_GetEvent(SDL_Event *event) { unsigned int key; - switch(event->type) + switch (event->type) { /* The mouse wheel */ case SDL_MOUSEBUTTONDOWN: + if (event->button.button == 4) { keyq[keyq_head].key = K_MWHEELUP; @@ -213,6 +339,7 @@ IN_GetEvent(SDL_Event *event) keyq[keyq_head].down = false; keyq_head = (keyq_head + 1) & 127; } + break; case SDL_MOUSEBUTTONUP: @@ -220,8 +347,11 @@ IN_GetEvent(SDL_Event *event) /* The user pressed a button */ case SDL_KEYDOWN: + /* Fullscreen switch via Alt-Return */ - if ( (KeyStates[SDLK_LALT] || KeyStates[SDLK_RALT]) && (event->key.keysym.sym == SDLK_RETURN) ) + if ((KeyStates[SDLK_LALT] || + KeyStates[SDLK_RALT]) && + (event->key.keysym.sym == SDLK_RETURN)) { cvar_t *fullscreen; @@ -229,14 +359,14 @@ IN_GetEvent(SDL_Event *event) if (surface->flags & SDL_FULLSCREEN) { - ri.Cvar_SetValue( "vid_fullscreen", 1 ); + ri.Cvar_SetValue("vid_fullscreen", 1); } else { - ri.Cvar_SetValue( "vid_fullscreen", 0 ); + ri.Cvar_SetValue("vid_fullscreen", 0); } - fullscreen = ri.Cvar_Get( "vid_fullscreen", "0", 0 ); + fullscreen = ri.Cvar_Get("vid_fullscreen", "0", 0); fullscreen->modified = false; break; @@ -246,22 +376,26 @@ IN_GetEvent(SDL_Event *event) /* Get the pressed key and add it to the key list */ key = IN_TranslateSDLtoQ2Key(event->key.keysym.sym); + if (key) { keyq[keyq_head].key = key; keyq[keyq_head].down = true; keyq_head = (keyq_head + 1) & 127; } + break; /* The user released a key */ case SDL_KEYUP: + if (KeyStates[event->key.keysym.sym]) { KeyStates[event->key.keysym.sym] = 0; /* Get the pressed key and remove it from the key list */ key = IN_TranslateSDLtoQ2Key(event->key.keysym.sym); + if (key) { keyq[keyq_head].key = key; @@ -269,6 +403,7 @@ IN_GetEvent(SDL_Event *event) keyq_head = (keyq_head + 1) & 127; } } + break; } } @@ -276,104 +411,105 @@ IN_GetEvent(SDL_Event *event) /* * Updates the state of the input queue */ -void IN_Update(void) +void +IN_Update(void) { - SDL_Event event; - static int IN_Update_Flag; - int bstate; + SDL_Event event; + static int IN_Update_Flag; + int bstate; - /* Protection against multiple calls */ - if (IN_Update_Flag == 1) - { - return; - } + /* Protection against multiple calls */ + if (IN_Update_Flag == 1) + { + return; + } - IN_Update_Flag = 1; + IN_Update_Flag = 1; - while (SDL_PollEvent(&event)) - { - IN_GetEvent(&event); - } + while (SDL_PollEvent(&event)) + { + IN_GetEvent(&event); + } - /* Mouse button processing. Button 4 - and 5 are the mousewheel and thus - not processed here. */ + /* Mouse button processing. Button 4 + and 5 are the mousewheel and thus + not processed here. */ + if (!mx && !my) + { + SDL_GetRelativeMouseState(&mx, &my); + } - if (!mx && !my) - { - SDL_GetRelativeMouseState(&mx, &my); - } + mouse_buttonstate = 0; + bstate = SDL_GetMouseState(NULL, NULL); - mouse_buttonstate = 0; - bstate = SDL_GetMouseState(NULL, NULL); + if (SDL_BUTTON(1) & bstate) + { + mouse_buttonstate |= (1 << 0); + } - if (SDL_BUTTON(1) & bstate) - { - mouse_buttonstate |= (1 << 0); - } + if (SDL_BUTTON(3) & bstate) + { + mouse_buttonstate |= (1 << 1); + } - if (SDL_BUTTON(3) & bstate) - { - mouse_buttonstate |= (1 << 1); - } + if (SDL_BUTTON(2) & bstate) + { + mouse_buttonstate |= (1 << 2); + } - if (SDL_BUTTON(2) & bstate) - { - mouse_buttonstate |= (1 << 2); - } + if (SDL_BUTTON(6) & bstate) + { + mouse_buttonstate |= (1 << 3); + } - if (SDL_BUTTON(6) & bstate) - { - mouse_buttonstate |= (1 << 3); - } + if (SDL_BUTTON(7) & bstate) + { + mouse_buttonstate |= (1 << 4); + } - if (SDL_BUTTON(7) & bstate) - { - mouse_buttonstate |= (1 << 4); - } + /* Grab and ungrab the mouse if the + * console is opened */ + if (in_grab->value == 2) + { + if (old_windowed_mouse != windowed_mouse->value) + { + old_windowed_mouse = windowed_mouse->value; - /* Grab and ungrab the mouse if the - console is opened */ - if (in_grab->value == 2) - { - if (old_windowed_mouse != windowed_mouse->value) - { - old_windowed_mouse = windowed_mouse->value; + if (!windowed_mouse->value) + { + SDL_WM_GrabInput(SDL_GRAB_OFF); + } + else + { + SDL_WM_GrabInput(SDL_GRAB_ON); + } + } + } + else if (in_grab->value == 1) + { + SDL_WM_GrabInput(SDL_GRAB_ON); + } + else + { + SDL_WM_GrabInput(SDL_GRAB_OFF); + } - if (!windowed_mouse->value) - { - SDL_WM_GrabInput(SDL_GRAB_OFF); - } - else - { - SDL_WM_GrabInput(SDL_GRAB_ON); - } - } - } - else if (in_grab->value == 1) - { - SDL_WM_GrabInput(SDL_GRAB_ON); - } - else - { - SDL_WM_GrabInput(SDL_GRAB_OFF); - } + /* Process the key events */ + while (keyq_head != keyq_tail) + { + in_state->Key_Event_fp(keyq[keyq_tail].key, keyq[keyq_tail].down); + keyq_tail = (keyq_tail + 1) & 127; + } - /* Process the key events */ - while (keyq_head != keyq_tail) - { - in_state->Key_Event_fp(keyq[keyq_tail].key, keyq[keyq_tail].down); - keyq_tail = (keyq_tail + 1) & 127; - } - - IN_Update_Flag = 0; + IN_Update_Flag = 0; } /* * Closes all inputs and clears * the input queue. */ -void IN_Close(void) +void +IN_Close(void) { keyq_head = 0; keyq_tail = 0; @@ -384,34 +520,37 @@ void IN_Close(void) /* * Gets the mouse state */ -void IN_GetMouseState(int *x, int *y, int *state) { - *x = mx; - *y = my; - *state = mouse_buttonstate; +void +IN_GetMouseState(int *x, int *y, int *state) +{ + *x = mx; + *y = my; + *state = mouse_buttonstate; } /* * Cleares the mouse state */ -void IN_ClearMouseState() +void +IN_ClearMouseState() { - mx = my = 0; + mx = my = 0; } /* * Centers the view */ static void -IN_ForceCenterView ( void ) +IN_ForceCenterView(void) { - in_state->viewangles [ PITCH ] = 0; + in_state->viewangles[PITCH] = 0; } /* * Look up */ static void -IN_MLookDown ( void ) +IN_MLookDown(void) { mlooking = true; } @@ -420,7 +559,7 @@ IN_MLookDown ( void ) * Look down */ static void -IN_MLookUp ( void ) +IN_MLookUp(void) { mlooking = false; in_state->IN_CenterView_fp(); @@ -440,47 +579,48 @@ IN_KeyboardInit(Key_Event_fp_t fp) * Initializes the backend */ void -IN_BackendInit ( in_state_t *in_state_p ) +IN_BackendInit(in_state_t *in_state_p) { in_state = in_state_p; - m_filter = ri.Cvar_Get( "m_filter", "0", CVAR_ARCHIVE ); - in_mouse = ri.Cvar_Get( "in_mouse", "0", CVAR_ARCHIVE ); + m_filter = ri.Cvar_Get("m_filter", "0", CVAR_ARCHIVE); + in_mouse = ri.Cvar_Get("in_mouse", "0", CVAR_ARCHIVE); - freelook = ri.Cvar_Get( "freelook", "1", 0 ); - lookstrafe = ri.Cvar_Get( "lookstrafe", "0", 0 ); - sensitivity = ri.Cvar_Get( "sensitivity", "3", 0 ); - exponential_speedup = ri.Cvar_Get( "exponential_speedup", "0", CVAR_ARCHIVE ); + freelook = ri.Cvar_Get("freelook", "1", 0); + lookstrafe = ri.Cvar_Get("lookstrafe", "0", 0); + sensitivity = ri.Cvar_Get("sensitivity", "3", 0); + exponential_speedup = ri.Cvar_Get("exponential_speedup", "0", CVAR_ARCHIVE); - m_pitch = ri.Cvar_Get( "m_pitch", "0.022", 0 ); - m_yaw = ri.Cvar_Get( "m_yaw", "0.022", 0 ); - m_forward = ri.Cvar_Get( "m_forward", "1", 0 ); - m_side = ri.Cvar_Get( "m_side", "0.8", 0 ); + m_pitch = ri.Cvar_Get("m_pitch", "0.022", 0); + m_yaw = ri.Cvar_Get("m_yaw", "0.022", 0); + m_forward = ri.Cvar_Get("m_forward", "1", 0); + m_side = ri.Cvar_Get("m_side", "0.8", 0); - ri.Cmd_AddCommand( "+mlook", IN_MLookDown ); - ri.Cmd_AddCommand( "-mlook", IN_MLookUp ); - ri.Cmd_AddCommand( "force_centerview", IN_ForceCenterView ); + ri.Cmd_AddCommand("+mlook", IN_MLookDown); + ri.Cmd_AddCommand("-mlook", IN_MLookUp); + ri.Cmd_AddCommand("force_centerview", IN_ForceCenterView); mouse_x = mouse_y = 0.0; /* SDL stuff */ - SDL_EnableUNICODE( 0 ); - SDL_EnableKeyRepeat( SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL ); + SDL_EnableUNICODE(0); + SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); - windowed_mouse = ri.Cvar_Get ("windowed_mouse", "1", CVAR_USERINFO | CVAR_ARCHIVE); - in_grab = ri.Cvar_Get ("in_grab", "2", CVAR_ARCHIVE); + windowed_mouse = ri.Cvar_Get("windowed_mouse", "1", + CVAR_USERINFO | CVAR_ARCHIVE); + in_grab = ri.Cvar_Get("in_grab", "2", CVAR_ARCHIVE); - Com_Printf( "Input initialized.\n" ); + Com_Printf("Input initialized.\n"); } /* * Shuts the backend down */ void -IN_BackendShutdown ( void ) +IN_BackendShutdown(void) { - ri.Cmd_RemoveCommand( "+mlook" ); - ri.Cmd_RemoveCommand( "-mlook" ); - ri.Cmd_RemoveCommand( "force_centerview" ); + ri.Cmd_RemoveCommand("+mlook"); + ri.Cmd_RemoveCommand("-mlook"); + ri.Cmd_RemoveCommand("force_centerview"); Com_Printf("Input shut down.\n"); } @@ -488,43 +628,43 @@ IN_BackendShutdown ( void ) * Mouse button handling */ void -IN_BackendMouseButtons ( void ) +IN_BackendMouseButtons(void) { int i; - IN_GetMouseState( &mouse_x, &mouse_y, &mouse_buttonstate ); + IN_GetMouseState(&mouse_x, &mouse_y, &mouse_buttonstate); - for ( i = 0; i < 3; i++ ) + for (i = 0; i < 3; i++) { - if ( ( mouse_buttonstate & ( 1 << i ) ) && !( mouse_oldbuttonstate & ( 1 << i ) ) ) + if ((mouse_buttonstate & (1 << i)) && !(mouse_oldbuttonstate & (1 << i))) { - in_state->Key_Event_fp( K_MOUSE1 + i, true ); + in_state->Key_Event_fp(K_MOUSE1 + i, true); } - if ( !( mouse_buttonstate & ( 1 << i ) ) && ( mouse_oldbuttonstate & ( 1 << i ) ) ) + if (!(mouse_buttonstate & (1 << i)) && (mouse_oldbuttonstate & (1 << i))) { - in_state->Key_Event_fp( K_MOUSE1 + i, false ); + in_state->Key_Event_fp(K_MOUSE1 + i, false); } } - if ( ( mouse_buttonstate & ( 1 << 3 ) ) && !( mouse_oldbuttonstate & ( 1 << 3 ) ) ) + if ((mouse_buttonstate & (1 << 3)) && !(mouse_oldbuttonstate & (1 << 3))) { - in_state->Key_Event_fp( K_MOUSE4, true ); + in_state->Key_Event_fp(K_MOUSE4, true); } - if ( !( mouse_buttonstate & ( 1 << 3 ) ) && ( mouse_oldbuttonstate & ( 1 << 3 ) ) ) + if (!(mouse_buttonstate & (1 << 3)) && (mouse_oldbuttonstate & (1 << 3))) { - in_state->Key_Event_fp( K_MOUSE4, false ); + in_state->Key_Event_fp(K_MOUSE4, false); } - if ( ( mouse_buttonstate & ( 1 << 4 ) ) && !( mouse_oldbuttonstate & ( 1 << 4 ) ) ) + if ((mouse_buttonstate & (1 << 4)) && !(mouse_oldbuttonstate & (1 << 4))) { - in_state->Key_Event_fp( K_MOUSE5, true ); + in_state->Key_Event_fp(K_MOUSE5, true); } - if ( !( mouse_buttonstate & ( 1 << 4 ) ) && ( mouse_oldbuttonstate & ( 1 << 4 ) ) ) + if (!(mouse_buttonstate & (1 << 4)) && (mouse_oldbuttonstate & (1 << 4))) { - in_state->Key_Event_fp( K_MOUSE5, false ); + in_state->Key_Event_fp(K_MOUSE5, false); } mouse_oldbuttonstate = mouse_buttonstate; @@ -534,54 +674,55 @@ IN_BackendMouseButtons ( void ) * Move handling */ void -IN_BackendMove ( usercmd_t *cmd ) +IN_BackendMove(usercmd_t *cmd) { - IN_GetMouseState( &mouse_x, &mouse_y, &mouse_buttonstate ); + IN_GetMouseState(&mouse_x, &mouse_y, &mouse_buttonstate); - if ( m_filter->value ) + if (m_filter->value) { - if ( ( mouse_x > 1 ) || ( mouse_x < -1) ) + if ((mouse_x > 1) || (mouse_x < -1)) { - mouse_x = ( mouse_x + old_mouse_x ) * 0.5; + mouse_x = (mouse_x + old_mouse_x) * 0.5; } - if ( ( mouse_y > 1 ) || ( mouse_y < -1) ) + + if ((mouse_y > 1) || (mouse_y < -1)) { - mouse_y = ( mouse_y + old_mouse_y ) * 0.5; + mouse_y = (mouse_y + old_mouse_y) * 0.5; } } old_mouse_x = mouse_x; old_mouse_y = mouse_y; - if ( mouse_x || mouse_y ) + if (mouse_x || mouse_y) { - if ( !exponential_speedup->value ) + if (!exponential_speedup->value) { mouse_x *= sensitivity->value; mouse_y *= sensitivity->value; } else { - if ( ( mouse_x > MOUSE_MIN ) || ( mouse_y > MOUSE_MIN ) || - ( mouse_x < -MOUSE_MIN ) || ( mouse_y < -MOUSE_MIN ) ) + if ((mouse_x > MOUSE_MIN) || (mouse_y > MOUSE_MIN) || + (mouse_x < -MOUSE_MIN) || (mouse_y < -MOUSE_MIN)) { - mouse_x = ( mouse_x * mouse_x * mouse_x ) / 4; - mouse_y = ( mouse_y * mouse_y * mouse_y ) / 4; + mouse_x = (mouse_x * mouse_x * mouse_x) / 4; + mouse_y = (mouse_y * mouse_y * mouse_y) / 4; - if ( mouse_x > MOUSE_MAX ) + if (mouse_x > MOUSE_MAX) { mouse_x = MOUSE_MAX; } - else if ( mouse_x < -MOUSE_MAX ) + else if (mouse_x < -MOUSE_MAX) { mouse_x = -MOUSE_MAX; } - if ( mouse_y > MOUSE_MAX ) + if (mouse_y > MOUSE_MAX) { mouse_y = MOUSE_MAX; } - else if ( mouse_y < -MOUSE_MAX ) + else if (mouse_y < -MOUSE_MAX) { mouse_y = -MOUSE_MAX; } @@ -589,20 +730,20 @@ IN_BackendMove ( usercmd_t *cmd ) } /* add mouse X/Y movement to cmd */ - if ( ( *in_state->in_strafe_state & 1 ) || - ( lookstrafe->value && mlooking ) ) + if ((*in_state->in_strafe_state & 1) || + (lookstrafe->value && mlooking)) { cmd->sidemove += m_side->value * mouse_x; } else { - in_state->viewangles [ YAW ] -= m_yaw->value * mouse_x; + in_state->viewangles[YAW] -= m_yaw->value * mouse_x; } - if ( ( mlooking || freelook->value ) && - !( *in_state->in_strafe_state & 1 ) ) + if ((mlooking || freelook->value) && + !(*in_state->in_strafe_state & 1)) { - in_state->viewangles [ PITCH ] += m_pitch->value * mouse_y; + in_state->viewangles[PITCH] += m_pitch->value * mouse_y; } else { @@ -612,3 +753,4 @@ IN_BackendMove ( usercmd_t *cmd ) IN_ClearMouseState(); } } + diff --git a/src/sdl/refresh.c b/src/sdl/refresh.c index 6ea27369..57b77b23 100644 --- a/src/sdl/refresh.c +++ b/src/sdl/refresh.c @@ -41,15 +41,15 @@ /* X.org stuff */ #ifdef X11GAMMA -#include -#include -#include -#include + #include + #include + #include + #include #endif -SDL_Surface *surface; -glwstate_t glw_state; -qboolean have_stencil = false; +SDL_Surface *surface; +glwstate_t glw_state; +qboolean have_stencil = false; char *displayname = NULL; int screen = -1; @@ -62,19 +62,22 @@ XF86VidModeGamma x11_oldgamma; /* * Initialzes the SDL OpenGL context */ -int GLimp_Init(void) +int +GLimp_Init(void) { if (!SDL_WasInit(SDL_INIT_VIDEO)) - { - char driverName[ 64 ]; + { + char driverName[64]; - if (SDL_Init(SDL_INIT_VIDEO) == -1) - { - ri.Con_Printf( PRINT_ALL, "Couldn't init SDL video: %s.\n", SDL_GetError()); - return false; - } - SDL_VideoDriverName( driverName, sizeof( driverName ) - 1 ); - ri.Con_Printf( PRINT_ALL, "SDL video driver is \"%s\".\n", driverName ); + if (SDL_Init(SDL_INIT_VIDEO) == -1) + { + ri.Con_Printf(PRINT_ALL, "Couldn't init SDL video: %s.\n", + SDL_GetError()); + return false; + } + + SDL_VideoDriverName(driverName, sizeof(driverName) - 1); + ri.Con_Printf(PRINT_ALL, "SDL video driver is \"%s\".\n", driverName); } return true; @@ -83,15 +86,18 @@ int GLimp_Init(void) /* * Sets the window icon */ -static void SetSDLIcon() +static void +SetSDLIcon() { SDL_Surface *icon; - SDL_Color color; - Uint8 *ptr; - int i; - int mask; + SDL_Color color; + Uint8 *ptr; + int i; + int mask; - icon = SDL_CreateRGBSurface(SDL_SWSURFACE, q2icon_width, q2icon_height, 8, 0, 0, 0, 0); + icon = SDL_CreateRGBSurface(SDL_SWSURFACE, + q2icon_width, q2icon_height, 8, + 0, 0, 0, 0); if (icon == NULL) { @@ -116,7 +122,8 @@ static void SetSDLIcon() for (i = 0; i < sizeof(q2icon_bits); i++) { - for (mask = 1; mask != 0x100; mask <<= 1) { + for (mask = 1; mask != 0x100; mask <<= 1) + { *ptr = (q2icon_bits[i] & mask) ? 1 : 0; ptr++; } @@ -136,7 +143,7 @@ UpdateHardwareGamma(void) float gamma; XF86VidModeGamma x11_gamma; - gamma =vid_gamma->value; + gamma = vid_gamma->value; x11_gamma.red = gamma; x11_gamma.green = gamma; @@ -147,6 +154,7 @@ UpdateHardwareGamma(void) /* This forces X11 to update the gamma tables */ XF86VidModeGetGamma(dpy, screen, &x11_gamma); } + #else void UpdateHardwareGamma(void) @@ -161,7 +169,8 @@ UpdateHardwareGamma(void) /* * Initializes the OpenGL window */ -static qboolean GLimp_InitGraphics( qboolean fullscreen ) +static qboolean +GLimp_InitGraphics(qboolean fullscreen) { int counter = 0; int flags; @@ -195,7 +204,7 @@ static qboolean GLimp_InitGraphics( qboolean fullscreen ) } /* Create the window */ - ri.Vid_NewWindow (vid.width, vid.height); + ri.Vid_NewWindow(vid.width, vid.height); SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8); @@ -217,15 +226,17 @@ static qboolean GLimp_InitGraphics( qboolean fullscreen ) while (1) { - if ((surface = SDL_SetVideoMode(vid.width, vid.height, 0, flags)) == NULL) + if ((surface = + SDL_SetVideoMode(vid.width, vid.height, 0, flags)) == NULL) { - if (counter == 1) + if (counter == 1) { Sys_Error(PRINT_ALL, "Failed to revert to gl_mode 4. Exiting...\n"); return false; } - ri.Con_Printf(PRINT_ALL, "SDL SetVideoMode failed: %s\n", SDL_GetError()); + ri.Con_Printf(PRINT_ALL, "SDL SetVideoMode failed: %s\n", + SDL_GetError()); ri.Con_Printf(PRINT_ALL, "Reverting to gl_mode 4 (640x480) and windowed mode.\n"); /* Try to recover */ @@ -256,7 +267,7 @@ static qboolean GLimp_InitGraphics( qboolean fullscreen ) /* Initialize hardware gamma */ #ifdef X11GAMMA - if ( ( dpy = XOpenDisplay( displayname ) ) == NULL ) + if ((dpy = XOpenDisplay(displayname)) == NULL) { ri.Con_Printf(PRINT_ALL, "Unable to open display.\n"); } @@ -270,7 +281,7 @@ static qboolean GLimp_InitGraphics( qboolean fullscreen ) gl_state.hwgamma = true; vid_gamma->modified = true; - XF86VidModeGetGamma(dpy, screen, &x11_oldgamma); + XF86VidModeGetGamma(dpy, screen, &x11_oldgamma); ri.Con_Printf(PRINT_ALL, "Using hardware gamma via X11.\n"); } @@ -293,7 +304,8 @@ static qboolean GLimp_InitGraphics( qboolean fullscreen ) /* * Swaps the buffers to show the new frame */ -void GLimp_EndFrame (void) +void +GLimp_EndFrame(void) { SDL_GL_SwapBuffers(); } @@ -301,21 +313,22 @@ void GLimp_EndFrame (void) /* * Changes the video mode */ -int GLimp_SetMode( int *pwidth, int *pheight, int mode, qboolean fullscreen ) +int +GLimp_SetMode(int *pwidth, int *pheight, int mode, qboolean fullscreen) { - ri.Con_Printf (PRINT_ALL, "setting mode %d:", mode ); + ri.Con_Printf(PRINT_ALL, "setting mode %d:", mode); /* mode -1 is not in the vid mode table - so we keep the values in pwidth and pheight and don't even try to look up the mode info */ - if ( mode != -1 && !ri.Vid_GetModeInfo( pwidth, pheight, mode ) ) + if ((mode != -1) && !ri.Vid_GetModeInfo(pwidth, pheight, mode)) { - ri.Con_Printf( PRINT_ALL, " invalid mode\n" ); + ri.Con_Printf(PRINT_ALL, " invalid mode\n"); return rserr_invalid_mode; } - ri.Con_Printf( PRINT_ALL, " %d %d\n", *pwidth, *pheight); + ri.Con_Printf(PRINT_ALL, " %d %d\n", *pwidth, *pheight); - if ( !GLimp_InitGraphics( fullscreen ) ) + if (!GLimp_InitGraphics(fullscreen)) { return rserr_invalid_mode; } @@ -326,7 +339,8 @@ int GLimp_SetMode( int *pwidth, int *pheight, int mode, qboolean fullscreen ) /* * Shuts the SDL render backend down */ -void GLimp_Shutdown( void ) +void +GLimp_Shutdown(void) { if (surface) { @@ -356,3 +370,4 @@ void GLimp_Shutdown( void ) gl_state.hwgamma = false; } + diff --git a/src/sdl/sound.c b/src/sdl/sound.c index 594d3d0e..11652a49 100644 --- a/src/sdl/sound.c +++ b/src/sdl/sound.c @@ -272,3 +272,4 @@ SNDDMA_BeginPainting(void) { SDL_LockAudio(); } + diff --git a/src/unix/header/qal.h b/src/unix/header/qal.h index 5ab765ec..7c6616b1 100644 --- a/src/unix/header/qal.h +++ b/src/unix/header/qal.h @@ -29,13 +29,13 @@ #ifdef USE_OPENAL #ifndef _QAL_API_H_ -#define _QAL_API_H_ + #define _QAL_API_H_ -#include -#include + #include + #include /* Function pointers used to tie - the qal API to the OpenAL API */ +* the qal API to the OpenAL API */ extern LPALENABLE qalEnable; extern LPALDISABLE qalDisable; extern LPALISENABLED qalIsEnabled; diff --git a/src/unix/header/unix.h b/src/unix/header/unix.h index d64dabe8..24f05c08 100644 --- a/src/unix/header/unix.h +++ b/src/unix/header/unix.h @@ -28,13 +28,13 @@ #ifndef UNIX_UNIX_H #define UNIX_UNIX_H -typedef void ( *Key_Event_fp_t )( int key, qboolean down ); -extern void ( *IN_Update_fp )( void ); +typedef void (*Key_Event_fp_t)(int key, qboolean down); +extern void (*IN_Update_fp)(void); typedef struct in_state { /* Pointers to functions back in client, set by vid_so */ - void ( *IN_CenterView_fp )( void ); + void (*IN_CenterView_fp)(void); Key_Event_fp_t Key_Event_fp; vec_t *viewangles; int *in_strafe_state; diff --git a/src/unix/hunk.c b/src/unix/hunk.c index 1e638ae1..5b7269a3 100644 --- a/src/unix/hunk.c +++ b/src/unix/hunk.c @@ -24,9 +24,8 @@ * ======================================================================= */ - /* For mremap() - must be before sys/mman.h include! */ -#if defined( __linux__ ) && ! defined( _GNU_SOURCE ) +#if defined(__linux__) && !defined(_GNU_SOURCE) #define _GNU_SOURCE #endif @@ -36,107 +35,106 @@ #include "../common/header/common.h" -#if defined( __FreeBSD__ ) +#if defined(__FreeBSD__) #include #define MAP_ANONYMOUS MAP_ANON #endif - byte *membase; int maxhunksize; int curhunksize; void * -Hunk_Begin ( int maxsize ) +Hunk_Begin(int maxsize) { /* reserve a huge chunk of memory, but don't commit any yet */ - maxhunksize = maxsize + sizeof ( int ); + maxhunksize = maxsize + sizeof(int); curhunksize = 0; - membase = mmap( 0, maxhunksize, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_ANONYMOUS, -1, 0 ); + membase = mmap(0, maxhunksize, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); - if ( ( membase == NULL ) || ( membase == (byte *) -1 ) ) + if ((membase == NULL) || (membase == (byte *)-1)) { - Sys_Error( "unable to virtual allocate %d bytes", maxsize ); + Sys_Error("unable to virtual allocate %d bytes", maxsize); } - *( (int *) membase ) = curhunksize; + *((int *)membase) = curhunksize; - return ( membase + sizeof ( int ) ); + return membase + sizeof(int); } void * -Hunk_Alloc ( int size ) +Hunk_Alloc(int size) { byte *buf; /* round to cacheline */ - size = ( size + 31 ) & ~31; + size = (size + 31) & ~31; - if ( curhunksize + size > maxhunksize ) + if (curhunksize + size > maxhunksize) { - Sys_Error( "Hunk_Alloc overflow" ); + Sys_Error("Hunk_Alloc overflow"); } - buf = membase + sizeof ( int ) + curhunksize; + buf = membase + sizeof(int) + curhunksize; curhunksize += size; - return ( buf ); + return buf; } int -Hunk_End ( void ) +Hunk_End(void) { byte *n = NULL; -#if defined( __FreeBSD__ ) +#if defined(__FreeBSD__) size_t old_size = maxhunksize; - size_t new_size = curhunksize + sizeof ( int ); + size_t new_size = curhunksize + sizeof(int); void *unmap_base; size_t unmap_len; - new_size = round_page( new_size ); - old_size = round_page( old_size ); + new_size = round_page(new_size); + old_size = round_page(old_size); - if ( new_size > old_size ) + if (new_size > old_size) { n = 0; /* error */ } - else if ( new_size < old_size ) + else if (new_size < old_size) { - unmap_base = (caddr_t) ( membase + new_size ); + unmap_base = (caddr_t)(membase + new_size); unmap_len = old_size - new_size; - n = munmap( unmap_base, unmap_len ) + membase; + n = munmap(unmap_base, unmap_len) + membase; } - #endif -#if defined( __linux__ ) - n = (byte *)mremap( membase, maxhunksize, curhunksize + sizeof ( int ), 0 ); +#if defined(__linux__) + n = (byte *)mremap(membase, maxhunksize, curhunksize + sizeof(int), 0); #endif - if ( n != membase ) + if (n != membase) { - Sys_Error( "Hunk_End: Could not remap virtual block (%d)", errno ); + Sys_Error("Hunk_End: Could not remap virtual block (%d)", errno); } - *( (int *) membase ) = curhunksize + sizeof ( int ); + *((int *)membase) = curhunksize + sizeof(int); - return ( curhunksize ); + return curhunksize; } void -Hunk_Free ( void *base ) +Hunk_Free(void *base) { byte *m; - if ( base ) + if (base) { - m = ( (byte *) base ) - sizeof ( int ); + m = ((byte *)base) - sizeof(int); - if ( munmap( m, *( (int *) m ) ) ) + if (munmap(m, *((int *)m))) { - Sys_Error( "Hunk_Free: munmap failed (%d)", errno ); + Sys_Error("Hunk_Free: munmap failed (%d)", errno); } } } + diff --git a/src/unix/main.c b/src/unix/main.c index 8f26282f..8ee990d3 100644 --- a/src/unix/main.c +++ b/src/unix/main.c @@ -35,11 +35,11 @@ #include "header/unix.h" int -main ( int argc, char **argv ) +main(int argc, char **argv) { int time, oldtime, newtime; - /* register signal handler */ + /* register signal handler */ registerHandler(); /* Prevent running Quake II as root. Only very mad @@ -59,7 +59,7 @@ main ( int argc, char **argv ) { printf("The effective UID is not the real UID! Your binary is probably marked\n"); printf("'setuid'. That is not good idea, please fix it :) If you really know\n"); - printf("what you're doin edit src/unix/main.c and remove this check. Don't\n"); + printf("what you're doin edit src/unix/main.c and remove this check. Don't\n"); printf("complain if Quake II eats your dog afterwards!\n"); return 1; @@ -68,8 +68,8 @@ main ( int argc, char **argv ) /* enforce C locale */ setenv("LC_ALL", "C", 1); - printf( "\nYamagi Quake II v%4.2f\n", VERSION); - printf( "=====================\n\n"); + printf("\nYamagi Quake II v%4.2f\n", VERSION); + printf("=====================\n\n"); #ifndef DEDICATED_ONLY printf("Client build options:\n"); @@ -95,14 +95,14 @@ main ( int argc, char **argv ) #endif #endif - printf("Platform: %s\n", BUILDSTRING); + printf("Platform: %s\n", BUILDSTRING); printf("Architecture: %s\n", CPUSTRING); - + /* Seed PRNG */ randk_seed(); /* Initialze the game */ - Qcommon_Init( argc, argv ); + Qcommon_Init(argc, argv); /* Do not delay reads on stdin*/ fcntl(fileno(stdin), F_SETFL, fcntl(fileno(stdin), F_GETFL, NULL) | FNDELAY); @@ -110,7 +110,7 @@ main ( int argc, char **argv ) oldtime = Sys_Milliseconds(); /* The legendary Quake II mainloop */ - while ( 1 ) + while (1) { /* find time spent rendering last frame */ do @@ -118,11 +118,12 @@ main ( int argc, char **argv ) newtime = Sys_Milliseconds(); time = newtime - oldtime; } - while ( time < 1 ); + while (time < 1); - Qcommon_Frame( time ); + Qcommon_Frame(time); oldtime = newtime; } return 0; } + diff --git a/src/unix/network.c b/src/unix/network.c index 4f16fe0e..a248f490 100644 --- a/src/unix/network.c +++ b/src/unix/network.c @@ -40,33 +40,33 @@ netadr_t net_local_adr; -#define LOOPBACK 0x7f000001 -#define MAX_LOOPBACK 4 -#define QUAKE2MCAST "ff12::666" +#define LOOPBACK 0x7f000001 +#define MAX_LOOPBACK 4 +#define QUAKE2MCAST "ff12::666" typedef struct { - byte data [ MAX_MSGLEN ]; + byte data[MAX_MSGLEN]; int datalen; } loopmsg_t; typedef struct { - loopmsg_t msgs [ MAX_LOOPBACK ]; + loopmsg_t msgs[MAX_LOOPBACK]; int get, send; } loopback_t; -loopback_t loopbacks [ 2 ]; -int ip_sockets [ 2 ]; +loopback_t loopbacks[2]; +int ip_sockets[2]; int ip6_sockets[2]; -int ipx_sockets [ 2 ]; +int ipx_sockets[2]; char *multicast_interface = NULL; int NET_Socket(char *net_interface, int port, netsrc_t type, int family); -char *NET_ErrorString ( void ); +char *NET_ErrorString(void); void -NetadrToSockadr ( netadr_t *a, struct sockaddr_storage *s ) +NetadrToSockadr(netadr_t *a, struct sockaddr_storage *s) { struct sockaddr_in6 *s6; @@ -91,7 +91,8 @@ NetadrToSockadr ( netadr_t *a, struct sockaddr_storage *s ) if (inet_pton(AF_INET6, QUAKE2MCAST, &s6->sin6_addr.s6_addr) != 1) { - Com_Printf("NET_NetadrToSockadr: inet_pton: %s\n", strerror(errno)); + Com_Printf("NET_NetadrToSockadr: inet_pton: %s\n", + strerror(errno)); return; } @@ -102,12 +103,13 @@ NetadrToSockadr ( netadr_t *a, struct sockaddr_storage *s ) #endif /* scope_id is important for - link-local destination.*/ + * link-local destination.*/ s6->sin6_scope_id = a->scope_id; break; case NA_IP6: + if (IN6_IS_ADDR_V4MAPPED((struct in6_addr *)a->ip)) { #ifdef __FreeBSD__ @@ -115,8 +117,8 @@ NetadrToSockadr ( netadr_t *a, struct sockaddr_storage *s ) #endif s->ss_family = AF_INET; memcpy(&((struct sockaddr_in *)s)->sin_addr, - &((struct in6_addr *)a->ip)->s6_addr[12], - sizeof(struct in_addr)); + &((struct in6_addr *)a->ip)->s6_addr[12], + sizeof(struct in_addr)); ((struct sockaddr_in *)s)->sin_port = a->port; } else @@ -131,7 +133,7 @@ NetadrToSockadr ( netadr_t *a, struct sockaddr_storage *s ) #endif /* scope_id is important for - link-local destination. */ + * link-local destination. */ s6->sin6_scope_id = a->scope_id; } @@ -145,9 +147,9 @@ NetadrToSockadr ( netadr_t *a, struct sockaddr_storage *s ) } void -SockadrToNetadr ( struct sockaddr_storage *s, netadr_t *a ) +SockadrToNetadr(struct sockaddr_storage *s, netadr_t *a) { - struct sockaddr_in6 *s6; + struct sockaddr_in6 *s6; if (s->ss_family == AF_INET) { @@ -181,12 +183,12 @@ SockadrToNetadr ( struct sockaddr_storage *s, netadr_t *a ) } void -NET_Init ( ) +NET_Init() { } qboolean -NET_CompareAdr ( netadr_t a, netadr_t b ) +NET_CompareAdr(netadr_t a, netadr_t b) { if (a.type != b.type) { @@ -222,7 +224,7 @@ NET_CompareAdr ( netadr_t a, netadr_t b ) * Compares without the port */ qboolean -NET_CompareBaseAdr ( netadr_t a, netadr_t b ) +NET_CompareBaseAdr(netadr_t a, netadr_t b) { if (a.type != b.type) { @@ -317,7 +319,9 @@ NET_BaseAdrToString(netadr_t a) #else socklen_t const salen = sizeof(ss); #endif - if (getnameinfo((struct sockaddr*)&ss, salen, s, sizeof(s), NULL, 0, NI_NUMERICHOST)) + + if (getnameinfo((struct sockaddr *)&ss, salen, s, sizeof(s), NULL, + 0, NI_NUMERICHOST)) { Com_sprintf(s, sizeof(s), ""); } @@ -325,7 +329,8 @@ NET_BaseAdrToString(netadr_t a) else { if ((a.type == NA_MULTICAST6) || - IN6_IS_ADDR_LINKLOCAL(&((struct sockaddr_in6 *)&ss)-> sin6_addr)) + IN6_IS_ADDR_LINKLOCAL(&((struct sockaddr_in6 *)&ss)-> + sin6_addr)) { /* If the address is multicast (link) or a link-local, need to carry the scope. The string @@ -349,7 +354,7 @@ NET_BaseAdrToString(netadr_t a) } char * -NET_AdrToString ( netadr_t a ) +NET_AdrToString(netadr_t a) { static char s[64]; const char *base; @@ -361,7 +366,7 @@ NET_AdrToString ( netadr_t a ) } qboolean -NET_StringToSockaddr ( char *s, struct sockaddr_storage *sadr ) +NET_StringToSockaddr(char *s, struct sockaddr_storage *sadr) { char copy[128]; char *addrs, *space; @@ -406,7 +411,8 @@ NET_StringToSockaddr ( char *s, struct sockaddr_storage *sadr ) if ((err = getaddrinfo(addrs, ports, &hints, &resultp))) { /* Error */ - Com_Printf("NET_StringToSockaddr: string %s:\n%s\n", s, gai_strerror(err)); + Com_Printf("NET_StringToSockaddr: string %s:\n%s\n", s, + gai_strerror(err)); return 0; } @@ -434,7 +440,7 @@ NET_StringToSockaddr ( char *s, struct sockaddr_storage *sadr ) } qboolean -NET_StringToAdr ( char *s, netadr_t *a ) +NET_StringToAdr(char *s, netadr_t *a) { struct sockaddr_storage sadr; @@ -457,55 +463,55 @@ NET_StringToAdr ( char *s, netadr_t *a ) } qboolean -NET_IsLocalAddress ( netadr_t adr ) +NET_IsLocalAddress(netadr_t adr) { - return ( NET_CompareAdr( adr, net_local_adr ) ); + return NET_CompareAdr(adr, net_local_adr); } qboolean -NET_GetLoopPacket ( netsrc_t sock, netadr_t *net_from, sizebuf_t *net_message ) +NET_GetLoopPacket(netsrc_t sock, netadr_t *net_from, sizebuf_t *net_message) { int i; - loopback_t *loop; + loopback_t *loop; - loop = &loopbacks [ sock ]; + loop = &loopbacks[sock]; - if ( loop->send - loop->get > MAX_LOOPBACK ) + if (loop->send - loop->get > MAX_LOOPBACK) { loop->get = loop->send - MAX_LOOPBACK; } - if ( loop->get >= loop->send ) + if (loop->get >= loop->send) { - return ( false ); + return false; } - i = loop->get & ( MAX_LOOPBACK - 1 ); + i = loop->get & (MAX_LOOPBACK - 1); loop->get++; - memcpy( net_message->data, loop->msgs [ i ].data, loop->msgs [ i ].datalen ); - net_message->cursize = loop->msgs [ i ].datalen; + memcpy(net_message->data, loop->msgs[i].data, loop->msgs[i].datalen); + net_message->cursize = loop->msgs[i].datalen; *net_from = net_local_adr; - return ( true ); + return true; } void -NET_SendLoopPacket ( netsrc_t sock, int length, void *data, netadr_t to ) +NET_SendLoopPacket(netsrc_t sock, int length, void *data, netadr_t to) { int i; - loopback_t *loop; + loopback_t *loop; - loop = &loopbacks [ sock ^ 1 ]; + loop = &loopbacks[sock ^ 1]; - i = loop->send & ( MAX_LOOPBACK - 1 ); + i = loop->send & (MAX_LOOPBACK - 1); loop->send++; - memcpy( loop->msgs [ i ].data, data, length ); - loop->msgs [ i ].datalen = length; + memcpy(loop->msgs[i].data, data, length); + loop->msgs[i].datalen = length; } qboolean -NET_GetPacket ( netsrc_t sock, netadr_t *net_from, sizebuf_t *net_message ) +NET_GetPacket(netsrc_t sock, netadr_t *net_from, sizebuf_t *net_message) { int ret; struct sockaddr_storage from; @@ -573,7 +579,7 @@ NET_GetPacket ( netsrc_t sock, netadr_t *net_from, sizebuf_t *net_message ) } void -NET_SendPacket ( netsrc_t sock, int length, void *data, netadr_t to ) +NET_SendPacket(netsrc_t sock, int length, void *data, netadr_t to) { int ret; struct sockaddr_storage addr; @@ -668,13 +674,15 @@ NET_SendPacket ( netsrc_t sock, int length, void *data, netadr_t to ) error = getnameinfo((struct sockaddr *)s6, s6->sin6_len, tmp, sizeof(tmp), NULL, 0, NI_NUMERICHOST); #else - error = getnameinfo((struct sockaddr *)s6, sizeof(struct sockaddr_in6), + error = getnameinfo((struct sockaddr *)s6, + sizeof(struct sockaddr_in6), tmp, sizeof(tmp), NULL, 0, NI_NUMERICHOST); #endif if (error) { - Com_Printf("NET_SendPacket: getnameinfo: %s\n", gai_strerror(error)); + Com_Printf("NET_SendPacket: getnameinfo: %s\n", + gai_strerror(error)); return; } @@ -691,7 +699,8 @@ NET_SendPacket ( netsrc_t sock, int length, void *data, netadr_t to ) if (error) { - Com_Printf("NET_SendPacket: getaddrinfo: %s\n", gai_strerror(error)); + Com_Printf("NET_SendPacket: getaddrinfo: %s\n", + gai_strerror(error)); return; } @@ -707,7 +716,12 @@ NET_SendPacket ( netsrc_t sock, int length, void *data, netadr_t to ) } } - ret = sendto(net_socket, data, length, 0, (struct sockaddr *)&addr, addr_size); + ret = sendto(net_socket, + data, + length, + 0, + (struct sockaddr *)&addr, + addr_size); if (ret == -1) { @@ -717,7 +731,7 @@ NET_SendPacket ( netsrc_t sock, int length, void *data, netadr_t to ) } void -NET_OpenIP ( void ) +NET_OpenIP(void) { cvar_t *port, *ip; @@ -753,7 +767,7 @@ NET_OpenIP ( void ) * A single player game will only use the loopback code */ void -NET_Config ( qboolean multiplayer ) +NET_Config(qboolean multiplayer) { int i; @@ -791,7 +805,7 @@ NET_Config ( qboolean multiplayer ) /* =================================================================== */ int -NET_Socket ( char *net_interface, int port, netsrc_t type, int family ) +NET_Socket(char *net_interface, int port, netsrc_t type, int family) { char Buf[BUFSIZ], *Host, *Service; int newsocket, Error; @@ -836,7 +850,8 @@ NET_Socket ( char *net_interface, int port, netsrc_t type, int family ) for (ai = res; ai != NULL; ai = ai->ai_next) { - if ((newsocket = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol)) == -1) + if ((newsocket = + socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol)) == -1) { Com_Printf("NET_Socket: socket: %s\n", strerror(errno)); continue; @@ -852,7 +867,8 @@ NET_Socket ( char *net_interface, int port, netsrc_t type, int family ) if (family == AF_INET) { /* make it broadcast capable */ - if (setsockopt(newsocket, SOL_SOCKET, SO_BROADCAST, (char *)&i, sizeof(i)) == -1) + if (setsockopt(newsocket, SOL_SOCKET, SO_BROADCAST, (char *)&i, + sizeof(i)) == -1) { Com_Printf("ERROR: NET_Socket: setsockopt SO_BROADCAST:%s\n", NET_ErrorString()); @@ -861,11 +877,12 @@ NET_Socket ( char *net_interface, int port, netsrc_t type, int family ) } /* make it reusable */ - if (setsockopt(newsocket, SOL_SOCKET, SO_REUSEADDR, (char *)&i, sizeof(i)) == -1) + if (setsockopt(newsocket, SOL_SOCKET, SO_REUSEADDR, (char *)&i, + sizeof(i)) == -1) { Com_Printf("ERROR: NET_Socket: setsockopt SO_REUSEADDR:%s\n", - NET_ErrorString()); - return 0; + NET_ErrorString()); + return 0; } if (bind(newsocket, ai->ai_addr, ai->ai_addrlen) < 0) @@ -895,37 +912,47 @@ NET_Socket ( char *net_interface, int port, netsrc_t type, int family ) break; case AF_INET6: + /* Multicast outgoing interface is specified for client and server (+set multicast ) */ mcast = Cvar_Get("multicast", "NULL", CVAR_NOSET); - multicast_interface = (strcmp(mcast->string, "NULL") ? mcast->string : NULL); + multicast_interface = + (strcmp(mcast->string, "NULL") ? mcast->string : NULL); if (multicast_interface != NULL) { /* multicast_interface is a global variable. Also used in NET_SendPacket() */ - if ((mreq.ipv6mr_interface = if_nametoindex(multicast_interface)) == 0) + if ((mreq.ipv6mr_interface = + if_nametoindex(multicast_interface)) == 0) { - Com_Printf("NET_Socket: invalid interface: %s\n", multicast_interface); + Com_Printf("NET_Socket: invalid interface: %s\n", + multicast_interface); } if (setsockopt(newsocket, IPPROTO_IPV6, IPV6_MULTICAST_IF, - &mreq.ipv6mr_interface, sizeof(mreq.ipv6mr_interface)) < 0) + &mreq.ipv6mr_interface, + sizeof(mreq.ipv6mr_interface)) < 0) { - Com_Printf("NET_Socket: IPV6_MULTICAST_IF: %s\n", strerror(errno)); + Com_Printf("NET_Socket: IPV6_MULTICAST_IF: %s\n", + strerror(errno)); } /* Join multicast group ONLY if server */ if (type == NS_SERVER) { - if (inet_pton(AF_INET6, QUAKE2MCAST, &mreq.ipv6mr_multiaddr.s6_addr) != 1) + if (inet_pton(AF_INET6, QUAKE2MCAST, + &mreq.ipv6mr_multiaddr.s6_addr) != 1) { - Com_Printf("NET_Socket: inet_pton: %s\n", strerror(errno)); + Com_Printf("NET_Socket: inet_pton: %s\n", + strerror(errno)); } - if (setsockopt(newsocket, IPPROTO_IPV6, IPV6_JOIN_GROUP, &mreq, sizeof(mreq)) < 0) + if (setsockopt(newsocket, IPPROTO_IPV6, IPV6_JOIN_GROUP, + &mreq, sizeof(mreq)) < 0) { - Com_Printf("NET_Socket: IPV6_JOIN_GROUP: %s\n", strerror(errno)); + Com_Printf("NET_Socket: IPV6_JOIN_GROUP: %s\n", + strerror(errno)); } } } @@ -937,32 +964,33 @@ NET_Socket ( char *net_interface, int port, netsrc_t type, int family ) } void -NET_Shutdown ( void ) +NET_Shutdown(void) { - NET_Config( false ); /* close sockets */ + NET_Config(false); /* close sockets */ } char * -NET_ErrorString ( void ) +NET_ErrorString(void) { int code; code = errno; - return ( strerror( code ) ); + return strerror(code); } /* * sleeps msec or until net socket is ready */ void -NET_Sleep ( int msec ) +NET_Sleep(int msec) { struct timeval timeout; fd_set fdset; extern cvar_t *dedicated; extern qboolean stdin_active; - if ((!ip_sockets[NS_SERVER] && !ip6_sockets[NS_SERVER]) || (dedicated && !dedicated->value)) + if ((!ip_sockets[NS_SERVER] && + !ip6_sockets[NS_SERVER]) || (dedicated && !dedicated->value)) { return; /* we're not a server, just run full speed */ } @@ -978,5 +1006,7 @@ NET_Sleep ( int msec ) FD_SET(ip6_sockets[NS_SERVER], &fdset); /* IPv6 network socket */ timeout.tv_sec = msec / 1000; timeout.tv_usec = (msec % 1000) * 1000; - select(MAX(ip_sockets[NS_SERVER], ip6_sockets[NS_SERVER]) + 1, &fdset, NULL, NULL, &timeout); + select(MAX(ip_sockets[NS_SERVER], + ip6_sockets[NS_SERVER]) + 1, &fdset, NULL, NULL, &timeout); } + diff --git a/src/unix/qgl.c b/src/unix/qgl.c index 6b0b13b8..f3561e5f 100644 --- a/src/unix/qgl.c +++ b/src/unix/qgl.c @@ -34,3441 +34,3594 @@ #include "../refresh/header/local.h" #include "header/glwindow.h" -void ( APIENTRY *qglAccum )( GLenum op, GLfloat value ); -void ( APIENTRY *qglAlphaFunc )( GLenum func, GLclampf ref ); -GLboolean ( APIENTRY *qglAreTexturesResident )( GLsizei n, const GLuint *textures, GLboolean *residences ); -void ( APIENTRY *qglArrayElement )( GLint i ); -void ( APIENTRY *qglBegin )( GLenum mode ); -void ( APIENTRY *qglBindTexture )( GLenum target, GLuint texture ); -void ( APIENTRY *qglBitmap )( GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, - const GLubyte *bitmap ); -void ( APIENTRY *qglBlendFunc )( GLenum sfactor, GLenum dfactor ); -void ( APIENTRY *qglCallList )( GLuint list ); -void ( APIENTRY *qglCallLists )( GLsizei n, GLenum type, const GLvoid *lists ); -void ( APIENTRY *qglClear )( GLbitfield mask ); -void ( APIENTRY *qglClearAccum )( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ); -void ( APIENTRY *qglClearColor )( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ); -void ( APIENTRY *qglClearDepth )( GLclampd depth ); -void ( APIENTRY *qglClearIndex )( GLfloat c ); -void ( APIENTRY *qglClearStencil )( GLint s ); -void ( APIENTRY *qglClipPlane )( GLenum plane, const GLdouble *equation ); -void ( APIENTRY *qglColor3b )( GLbyte red, GLbyte green, GLbyte blue ); -void ( APIENTRY *qglColor3bv )( const GLbyte *v ); -void ( APIENTRY *qglColor3d )( GLdouble red, GLdouble green, GLdouble blue ); -void ( APIENTRY *qglColor3dv )( const GLdouble *v ); -void ( APIENTRY *qglColor3f )( GLfloat red, GLfloat green, GLfloat blue ); -void ( APIENTRY *qglColor3fv )( const GLfloat *v ); -void ( APIENTRY *qglColor3i )( GLint red, GLint green, GLint blue ); -void ( APIENTRY *qglColor3iv )( const GLint *v ); -void ( APIENTRY *qglColor3s )( GLshort red, GLshort green, GLshort blue ); -void ( APIENTRY *qglColor3sv )( const GLshort *v ); -void ( APIENTRY *qglColor3ub )( GLubyte red, GLubyte green, GLubyte blue ); -void ( APIENTRY *qglColor3ubv )( const GLubyte *v ); -void ( APIENTRY *qglColor3ui )( GLuint red, GLuint green, GLuint blue ); -void ( APIENTRY *qglColor3uiv )( const GLuint *v ); -void ( APIENTRY *qglColor3us )( GLushort red, GLushort green, GLushort blue ); -void ( APIENTRY *qglColor3usv )( const GLushort *v ); -void ( APIENTRY *qglColor4b )( GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha ); -void ( APIENTRY *qglColor4bv )( const GLbyte *v ); -void ( APIENTRY *qglColor4d )( GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha ); -void ( APIENTRY *qglColor4dv )( const GLdouble *v ); -void ( APIENTRY *qglColor4f )( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ); -void ( APIENTRY *qglColor4fv )( const GLfloat *v ); -void ( APIENTRY *qglColor4i )( GLint red, GLint green, GLint blue, GLint alpha ); -void ( APIENTRY *qglColor4iv )( const GLint *v ); -void ( APIENTRY *qglColor4s )( GLshort red, GLshort green, GLshort blue, GLshort alpha ); -void ( APIENTRY *qglColor4sv )( const GLshort *v ); -void ( APIENTRY *qglColor4ub )( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ); -void ( APIENTRY *qglColor4ubv )( const GLubyte *v ); -void ( APIENTRY *qglColor4ui )( GLuint red, GLuint green, GLuint blue, GLuint alpha ); -void ( APIENTRY *qglColor4uiv )( const GLuint *v ); -void ( APIENTRY *qglColor4us )( GLushort red, GLushort green, GLushort blue, GLushort alpha ); -void ( APIENTRY *qglColor4usv )( const GLushort *v ); -void ( APIENTRY *qglColorMask )( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ); -void ( APIENTRY *qglColorMaterial )( GLenum face, GLenum mode ); -void ( APIENTRY *qglColorPointer )( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ); -void ( APIENTRY *qglCopyPixels )( GLint x, GLint y, GLsizei width, GLsizei height, GLenum type ); -void ( APIENTRY *qglCopyTexImage1D )( GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, - GLint border ); -void ( APIENTRY *qglCopyTexImage2D )( GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, - GLsizei height, GLint border ); -void ( APIENTRY *qglCopyTexSubImage1D )( GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width ); -void ( APIENTRY *qglCopyTexSubImage2D )( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, - GLsizei width, GLsizei height ); -void ( APIENTRY *qglCullFace )( GLenum mode ); -void ( APIENTRY *qglDeleteLists )( GLuint list, GLsizei range ); -void ( APIENTRY *qglDeleteTextures )( GLsizei n, const GLuint *textures ); -void ( APIENTRY *qglDepthFunc )( GLenum func ); -void ( APIENTRY *qglDepthMask )( GLboolean flag ); -void ( APIENTRY *qglDepthRange )( GLclampd zNear, GLclampd zFar ); -void ( APIENTRY *qglDisable )( GLenum cap ); -void ( APIENTRY *qglDisableClientState )( GLenum array ); -void ( APIENTRY *qglDrawArrays )( GLenum mode, GLint first, GLsizei count ); -void ( APIENTRY *qglDrawBuffer )( GLenum mode ); -void ( APIENTRY *qglDrawElements )( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices ); -void ( APIENTRY *qglDrawPixels )( GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ); -void ( APIENTRY *qglEdgeFlag )( GLboolean flag ); -void ( APIENTRY *qglEdgeFlagPointer )( GLsizei stride, const GLvoid *pointer ); -void ( APIENTRY *qglEdgeFlagv )( const GLboolean *flag ); -void ( APIENTRY *qglEnable )( GLenum cap ); -void ( APIENTRY *qglEnableClientState )( GLenum array ); -void ( APIENTRY *qglEnd )( void ); -void ( APIENTRY *qglEndList )( void ); -void ( APIENTRY *qglEvalCoord1d )( GLdouble u ); -void ( APIENTRY *qglEvalCoord1dv )( const GLdouble *u ); -void ( APIENTRY *qglEvalCoord1f )( GLfloat u ); -void ( APIENTRY *qglEvalCoord1fv )( const GLfloat *u ); -void ( APIENTRY *qglEvalCoord2d )( GLdouble u, GLdouble v ); -void ( APIENTRY *qglEvalCoord2dv )( const GLdouble *u ); -void ( APIENTRY *qglEvalCoord2f )( GLfloat u, GLfloat v ); -void ( APIENTRY *qglEvalCoord2fv )( const GLfloat *u ); -void ( APIENTRY *qglEvalMesh1 )( GLenum mode, GLint i1, GLint i2 ); -void ( APIENTRY *qglEvalMesh2 )( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ); -void ( APIENTRY *qglEvalPoint1 )( GLint i ); -void ( APIENTRY *qglEvalPoint2 )( GLint i, GLint j ); -void ( APIENTRY *qglFeedbackBuffer )( GLsizei size, GLenum type, GLfloat *buffer ); -void ( APIENTRY *qglFinish )( void ); -void ( APIENTRY *qglFlush )( void ); -void ( APIENTRY *qglFogf )( GLenum pname, GLfloat param ); -void ( APIENTRY *qglFogfv )( GLenum pname, const GLfloat *params ); -void ( APIENTRY *qglFogi )( GLenum pname, GLint param ); -void ( APIENTRY *qglFogiv )( GLenum pname, const GLint *params ); -void ( APIENTRY *qglFrontFace )( GLenum mode ); -void ( APIENTRY *qglFrustum )( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar ); -GLuint ( APIENTRY *qglGenLists )( GLsizei range ); -void ( APIENTRY *qglGenTextures )( GLsizei n, GLuint *textures ); -void ( APIENTRY *qglGetBooleanv )( GLenum pname, GLboolean *params ); -void ( APIENTRY *qglGetClipPlane )( GLenum plane, GLdouble *equation ); -void ( APIENTRY *qglGetDoublev )( GLenum pname, GLdouble *params ); -GLenum ( APIENTRY *qglGetError )( void ); -void ( APIENTRY *qglGetFloatv )( GLenum pname, GLfloat *params ); -void ( APIENTRY *qglGetIntegerv )( GLenum pname, GLint *params ); -void ( APIENTRY *qglGetLightfv )( GLenum light, GLenum pname, GLfloat *params ); -void ( APIENTRY *qglGetLightiv )( GLenum light, GLenum pname, GLint *params ); -void ( APIENTRY *qglGetMapdv )( GLenum target, GLenum query, GLdouble *v ); -void ( APIENTRY *qglGetMapfv )( GLenum target, GLenum query, GLfloat *v ); -void ( APIENTRY *qglGetMapiv )( GLenum target, GLenum query, GLint *v ); -void ( APIENTRY *qglGetMaterialfv )( GLenum face, GLenum pname, GLfloat *params ); -void ( APIENTRY *qglGetMaterialiv )( GLenum face, GLenum pname, GLint *params ); -void ( APIENTRY *qglGetPixelMapfv )( GLenum map, GLfloat *values ); -void ( APIENTRY *qglGetPixelMapuiv )( GLenum map, GLuint *values ); -void ( APIENTRY *qglGetPixelMapusv )( GLenum map, GLushort *values ); -void ( APIENTRY *qglGetPointerv )( GLenum pname, GLvoid **params ); -void ( APIENTRY *qglGetPolygonStipple )( GLubyte *mask ); -const GLubyte * ( APIENTRY * qglGetString )(GLenum name); -void ( APIENTRY *qglGetTexEnvfv )( GLenum target, GLenum pname, GLfloat *params ); -void ( APIENTRY *qglGetTexEnviv )( GLenum target, GLenum pname, GLint *params ); -void ( APIENTRY *qglGetTexGendv )( GLenum coord, GLenum pname, GLdouble *params ); -void ( APIENTRY *qglGetTexGenfv )( GLenum coord, GLenum pname, GLfloat *params ); -void ( APIENTRY *qglGetTexGeniv )( GLenum coord, GLenum pname, GLint *params ); -void ( APIENTRY *qglGetTexImage )( GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels ); -void ( APIENTRY *qglGetTexLevelParameterfv )( GLenum target, GLint level, GLenum pname, GLfloat *params ); -void ( APIENTRY *qglGetTexLevelParameteriv )( GLenum target, GLint level, GLenum pname, GLint *params ); -void ( APIENTRY *qglGetTexParameterfv )( GLenum target, GLenum pname, GLfloat *params ); -void ( APIENTRY *qglGetTexParameteriv )( GLenum target, GLenum pname, GLint *params ); -void ( APIENTRY *qglHint )( GLenum target, GLenum mode ); -void ( APIENTRY *qglIndexMask )( GLuint mask ); -void ( APIENTRY *qglIndexPointer )( GLenum type, GLsizei stride, const GLvoid *pointer ); -void ( APIENTRY *qglIndexd )( GLdouble c ); -void ( APIENTRY *qglIndexdv )( const GLdouble *c ); -void ( APIENTRY *qglIndexf )( GLfloat c ); -void ( APIENTRY *qglIndexfv )( const GLfloat *c ); -void ( APIENTRY *qglIndexi )( GLint c ); -void ( APIENTRY *qglIndexiv )( const GLint *c ); -void ( APIENTRY *qglIndexs )( GLshort c ); -void ( APIENTRY *qglIndexsv )( const GLshort *c ); -void ( APIENTRY *qglIndexub )( GLubyte c ); -void ( APIENTRY *qglIndexubv )( const GLubyte *c ); -void ( APIENTRY *qglInitNames )( void ); -void ( APIENTRY *qglInterleavedArrays )( GLenum format, GLsizei stride, const GLvoid *pointer ); -GLboolean ( APIENTRY *qglIsEnabled )( GLenum cap ); -GLboolean ( APIENTRY *qglIsList )( GLuint list ); -GLboolean ( APIENTRY *qglIsTexture )( GLuint texture ); -void ( APIENTRY *qglLightModelf )( GLenum pname, GLfloat param ); -void ( APIENTRY *qglLightModelfv )( GLenum pname, const GLfloat *params ); -void ( APIENTRY *qglLightModeli )( GLenum pname, GLint param ); -void ( APIENTRY *qglLightModeliv )( GLenum pname, const GLint *params ); -void ( APIENTRY *qglLightf )( GLenum light, GLenum pname, GLfloat param ); -void ( APIENTRY *qglLightfv )( GLenum light, GLenum pname, const GLfloat *params ); -void ( APIENTRY *qglLighti )( GLenum light, GLenum pname, GLint param ); -void ( APIENTRY *qglLightiv )( GLenum light, GLenum pname, const GLint *params ); -void ( APIENTRY *qglLineStipple )( GLint factor, GLushort pattern ); -void ( APIENTRY *qglLineWidth )( GLfloat width ); -void ( APIENTRY *qglListBase )( GLuint base ); -void ( APIENTRY *qglLoadIdentity )( void ); -void ( APIENTRY *qglLoadMatrixd )( const GLdouble *m ); -void ( APIENTRY *qglLoadMatrixf )( const GLfloat *m ); -void ( APIENTRY *qglLoadName )( GLuint name ); -void ( APIENTRY *qglLogicOp )( GLenum opcode ); -void ( APIENTRY *qglMap1d )( GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points ); -void ( APIENTRY *qglMap1f )( GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points ); -void ( APIENTRY *qglMap2d )( GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, - GLint vstride, GLint vorder, const GLdouble *points ); -void ( APIENTRY *qglMap2f )( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, - GLint vstride, GLint vorder, const GLfloat *points ); -void ( APIENTRY *qglMapGrid1d )( GLint un, GLdouble u1, GLdouble u2 ); -void ( APIENTRY *qglMapGrid1f )( GLint un, GLfloat u1, GLfloat u2 ); -void ( APIENTRY *qglMapGrid2d )( GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2 ); -void ( APIENTRY *qglMapGrid2f )( GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2 ); -void ( APIENTRY *qglMaterialf )( GLenum face, GLenum pname, GLfloat param ); -void ( APIENTRY *qglMaterialfv )( GLenum face, GLenum pname, const GLfloat *params ); -void ( APIENTRY *qglMateriali )( GLenum face, GLenum pname, GLint param ); -void ( APIENTRY *qglMaterialiv )( GLenum face, GLenum pname, const GLint *params ); -void ( APIENTRY *qglMatrixMode )( GLenum mode ); -void ( APIENTRY *qglMultMatrixd )( const GLdouble *m ); -void ( APIENTRY *qglMultMatrixf )( const GLfloat *m ); -void ( APIENTRY *qglNewList )( GLuint list, GLenum mode ); -void ( APIENTRY *qglNormal3b )( GLbyte nx, GLbyte ny, GLbyte nz ); -void ( APIENTRY *qglNormal3bv )( const GLbyte *v ); -void ( APIENTRY *qglNormal3d )( GLdouble nx, GLdouble ny, GLdouble nz ); -void ( APIENTRY *qglNormal3dv )( const GLdouble *v ); -void ( APIENTRY *qglNormal3f )( GLfloat nx, GLfloat ny, GLfloat nz ); -void ( APIENTRY *qglNormal3fv )( const GLfloat *v ); -void ( APIENTRY *qglNormal3i )( GLint nx, GLint ny, GLint nz ); -void ( APIENTRY *qglNormal3iv )( const GLint *v ); -void ( APIENTRY *qglNormal3s )( GLshort nx, GLshort ny, GLshort nz ); -void ( APIENTRY *qglNormal3sv )( const GLshort *v ); -void ( APIENTRY *qglNormalPointer )( GLenum type, GLsizei stride, const GLvoid *pointer ); -void ( APIENTRY *qglOrtho )( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar ); -void ( APIENTRY *qglPassThrough )( GLfloat token ); -void ( APIENTRY *qglPixelMapfv )( GLenum map, GLsizei mapsize, const GLfloat *values ); -void ( APIENTRY *qglPixelMapuiv )( GLenum map, GLsizei mapsize, const GLuint *values ); -void ( APIENTRY *qglPixelMapusv )( GLenum map, GLsizei mapsize, const GLushort *values ); -void ( APIENTRY *qglPixelStoref )( GLenum pname, GLfloat param ); -void ( APIENTRY *qglPixelStorei )( GLenum pname, GLint param ); -void ( APIENTRY *qglPixelTransferf )( GLenum pname, GLfloat param ); -void ( APIENTRY *qglPixelTransferi )( GLenum pname, GLint param ); -void ( APIENTRY *qglPixelZoom )( GLfloat xfactor, GLfloat yfactor ); -void ( APIENTRY *qglPointSize )( GLfloat size ); -void ( APIENTRY *qglPolygonMode )( GLenum face, GLenum mode ); -void ( APIENTRY *qglPolygonOffset )( GLfloat factor, GLfloat units ); -void ( APIENTRY *qglPolygonStipple )( const GLubyte *mask ); -void ( APIENTRY *qglPopAttrib )( void ); -void ( APIENTRY *qglPopClientAttrib )( void ); -void ( APIENTRY *qglPopMatrix )( void ); -void ( APIENTRY *qglPopName )( void ); -void ( APIENTRY *qglPrioritizeTextures )( GLsizei n, const GLuint *textures, const GLclampf *priorities ); -void ( APIENTRY *qglPushAttrib )( GLbitfield mask ); -void ( APIENTRY *qglPushClientAttrib )( GLbitfield mask ); -void ( APIENTRY *qglPushMatrix )( void ); -void ( APIENTRY *qglPushName )( GLuint name ); -void ( APIENTRY *qglRasterPos2d )( GLdouble x, GLdouble y ); -void ( APIENTRY *qglRasterPos2dv )( const GLdouble *v ); -void ( APIENTRY *qglRasterPos2f )( GLfloat x, GLfloat y ); -void ( APIENTRY *qglRasterPos2fv )( const GLfloat *v ); -void ( APIENTRY *qglRasterPos2i )( GLint x, GLint y ); -void ( APIENTRY *qglRasterPos2iv )( const GLint *v ); -void ( APIENTRY *qglRasterPos2s )( GLshort x, GLshort y ); -void ( APIENTRY *qglRasterPos2sv )( const GLshort *v ); -void ( APIENTRY *qglRasterPos3d )( GLdouble x, GLdouble y, GLdouble z ); -void ( APIENTRY *qglRasterPos3dv )( const GLdouble *v ); -void ( APIENTRY *qglRasterPos3f )( GLfloat x, GLfloat y, GLfloat z ); -void ( APIENTRY *qglRasterPos3fv )( const GLfloat *v ); -void ( APIENTRY *qglRasterPos3i )( GLint x, GLint y, GLint z ); -void ( APIENTRY *qglRasterPos3iv )( const GLint *v ); -void ( APIENTRY *qglRasterPos3s )( GLshort x, GLshort y, GLshort z ); -void ( APIENTRY *qglRasterPos3sv )( const GLshort *v ); -void ( APIENTRY *qglRasterPos4d )( GLdouble x, GLdouble y, GLdouble z, GLdouble w ); -void ( APIENTRY *qglRasterPos4dv )( const GLdouble *v ); -void ( APIENTRY *qglRasterPos4f )( GLfloat x, GLfloat y, GLfloat z, GLfloat w ); -void ( APIENTRY *qglRasterPos4fv )( const GLfloat *v ); -void ( APIENTRY *qglRasterPos4i )( GLint x, GLint y, GLint z, GLint w ); -void ( APIENTRY *qglRasterPos4iv )( const GLint *v ); -void ( APIENTRY *qglRasterPos4s )( GLshort x, GLshort y, GLshort z, GLshort w ); -void ( APIENTRY *qglRasterPos4sv )( const GLshort *v ); -void ( APIENTRY *qglReadBuffer )( GLenum mode ); -void ( APIENTRY *qglReadPixels )( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels ); -void ( APIENTRY *qglRectd )( GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2 ); -void ( APIENTRY *qglRectdv )( const GLdouble *v1, const GLdouble *v2 ); -void ( APIENTRY *qglRectf )( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ); -void ( APIENTRY *qglRectfv )( const GLfloat *v1, const GLfloat *v2 ); -void ( APIENTRY *qglRecti )( GLint x1, GLint y1, GLint x2, GLint y2 ); -void ( APIENTRY *qglRectiv )( const GLint *v1, const GLint *v2 ); -void ( APIENTRY *qglRects )( GLshort x1, GLshort y1, GLshort x2, GLshort y2 ); -void ( APIENTRY *qglRectsv )( const GLshort *v1, const GLshort *v2 ); -GLint ( APIENTRY *qglRenderMode )( GLenum mode ); -void ( APIENTRY *qglRotated )( GLdouble angle, GLdouble x, GLdouble y, GLdouble z ); -void ( APIENTRY *qglRotatef )( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ); -void ( APIENTRY *qglScaled )( GLdouble x, GLdouble y, GLdouble z ); -void ( APIENTRY *qglScalef )( GLfloat x, GLfloat y, GLfloat z ); -void ( APIENTRY *qglScissor )( GLint x, GLint y, GLsizei width, GLsizei height ); -void ( APIENTRY *qglSelectBuffer )( GLsizei size, GLuint *buffer ); -void ( APIENTRY *qglShadeModel )( GLenum mode ); -void ( APIENTRY *qglStencilFunc )( GLenum func, GLint ref, GLuint mask ); -void ( APIENTRY *qglStencilMask )( GLuint mask ); -void ( APIENTRY *qglStencilOp )( GLenum fail, GLenum zfail, GLenum zpass ); -void ( APIENTRY *qglTexCoord1d )( GLdouble s ); -void ( APIENTRY *qglTexCoord1dv )( const GLdouble *v ); -void ( APIENTRY *qglTexCoord1f )( GLfloat s ); -void ( APIENTRY *qglTexCoord1fv )( const GLfloat *v ); -void ( APIENTRY *qglTexCoord1i )( GLint s ); -void ( APIENTRY *qglTexCoord1iv )( const GLint *v ); -void ( APIENTRY *qglTexCoord1s )( GLshort s ); -void ( APIENTRY *qglTexCoord1sv )( const GLshort *v ); -void ( APIENTRY *qglTexCoord2d )( GLdouble s, GLdouble t ); -void ( APIENTRY *qglTexCoord2dv )( const GLdouble *v ); -void ( APIENTRY *qglTexCoord2f )( GLfloat s, GLfloat t ); -void ( APIENTRY *qglTexCoord2fv )( const GLfloat *v ); -void ( APIENTRY *qglTexCoord2i )( GLint s, GLint t ); -void ( APIENTRY *qglTexCoord2iv )( const GLint *v ); -void ( APIENTRY *qglTexCoord2s )( GLshort s, GLshort t ); -void ( APIENTRY *qglTexCoord2sv )( const GLshort *v ); -void ( APIENTRY *qglTexCoord3d )( GLdouble s, GLdouble t, GLdouble r ); -void ( APIENTRY *qglTexCoord3dv )( const GLdouble *v ); -void ( APIENTRY *qglTexCoord3f )( GLfloat s, GLfloat t, GLfloat r ); -void ( APIENTRY *qglTexCoord3fv )( const GLfloat *v ); -void ( APIENTRY *qglTexCoord3i )( GLint s, GLint t, GLint r ); -void ( APIENTRY *qglTexCoord3iv )( const GLint *v ); -void ( APIENTRY *qglTexCoord3s )( GLshort s, GLshort t, GLshort r ); -void ( APIENTRY *qglTexCoord3sv )( const GLshort *v ); -void ( APIENTRY *qglTexCoord4d )( GLdouble s, GLdouble t, GLdouble r, GLdouble q ); -void ( APIENTRY *qglTexCoord4dv )( const GLdouble *v ); -void ( APIENTRY *qglTexCoord4f )( GLfloat s, GLfloat t, GLfloat r, GLfloat q ); -void ( APIENTRY *qglTexCoord4fv )( const GLfloat *v ); -void ( APIENTRY *qglTexCoord4i )( GLint s, GLint t, GLint r, GLint q ); -void ( APIENTRY *qglTexCoord4iv )( const GLint *v ); -void ( APIENTRY *qglTexCoord4s )( GLshort s, GLshort t, GLshort r, GLshort q ); -void ( APIENTRY *qglTexCoord4sv )( const GLshort *v ); -void ( APIENTRY *qglTexCoordPointer )( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ); -void ( APIENTRY *qglTexEnvf )( GLenum target, GLenum pname, GLfloat param ); -void ( APIENTRY *qglTexEnvfv )( GLenum target, GLenum pname, const GLfloat *params ); -void ( APIENTRY *qglTexEnvi )( GLenum target, GLenum pname, GLint param ); -void ( APIENTRY *qglTexEnviv )( GLenum target, GLenum pname, const GLint *params ); -void ( APIENTRY *qglTexGend )( GLenum coord, GLenum pname, GLdouble param ); -void ( APIENTRY *qglTexGendv )( GLenum coord, GLenum pname, const GLdouble *params ); -void ( APIENTRY *qglTexGenf )( GLenum coord, GLenum pname, GLfloat param ); -void ( APIENTRY *qglTexGenfv )( GLenum coord, GLenum pname, const GLfloat *params ); -void ( APIENTRY *qglTexGeni )( GLenum coord, GLenum pname, GLint param ); -void ( APIENTRY *qglTexGeniv )( GLenum coord, GLenum pname, const GLint *params ); -void ( APIENTRY *qglTexImage1D )( GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, - GLenum type, const GLvoid *pixels ); -void ( APIENTRY *qglTexImage2D )( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, - GLenum format, GLenum type, const GLvoid *pixels ); -void ( APIENTRY *qglTexParameterf )( GLenum target, GLenum pname, GLfloat param ); -void ( APIENTRY *qglTexParameterfv )( GLenum target, GLenum pname, const GLfloat *params ); -void ( APIENTRY *qglTexParameteri )( GLenum target, GLenum pname, GLint param ); -void ( APIENTRY *qglTexParameteriv )( GLenum target, GLenum pname, const GLint *params ); -void ( APIENTRY *qglTexSubImage1D )( GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, - const GLvoid *pixels ); -void ( APIENTRY *qglTexSubImage2D )( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, - GLenum format, GLenum type, const GLvoid *pixels ); -void ( APIENTRY *qglTranslated )( GLdouble x, GLdouble y, GLdouble z ); -void ( APIENTRY *qglTranslatef )( GLfloat x, GLfloat y, GLfloat z ); -void ( APIENTRY *qglVertex2d )( GLdouble x, GLdouble y ); -void ( APIENTRY *qglVertex2dv )( const GLdouble *v ); -void ( APIENTRY *qglVertex2f )( GLfloat x, GLfloat y ); -void ( APIENTRY *qglVertex2fv )( const GLfloat *v ); -void ( APIENTRY *qglVertex2i )( GLint x, GLint y ); -void ( APIENTRY *qglVertex2iv )( const GLint *v ); -void ( APIENTRY *qglVertex2s )( GLshort x, GLshort y ); -void ( APIENTRY *qglVertex2sv )( const GLshort *v ); -void ( APIENTRY *qglVertex3d )( GLdouble x, GLdouble y, GLdouble z ); -void ( APIENTRY *qglVertex3dv )( const GLdouble *v ); -void ( APIENTRY *qglVertex3f )( GLfloat x, GLfloat y, GLfloat z ); -void ( APIENTRY *qglVertex3fv )( const GLfloat *v ); -void ( APIENTRY *qglVertex3i )( GLint x, GLint y, GLint z ); -void ( APIENTRY *qglVertex3iv )( const GLint *v ); -void ( APIENTRY *qglVertex3s )( GLshort x, GLshort y, GLshort z ); -void ( APIENTRY *qglVertex3sv )( const GLshort *v ); -void ( APIENTRY *qglVertex4d )( GLdouble x, GLdouble y, GLdouble z, GLdouble w ); -void ( APIENTRY *qglVertex4dv )( const GLdouble *v ); -void ( APIENTRY *qglVertex4f )( GLfloat x, GLfloat y, GLfloat z, GLfloat w ); -void ( APIENTRY *qglVertex4fv )( const GLfloat *v ); -void ( APIENTRY *qglVertex4i )( GLint x, GLint y, GLint z, GLint w ); -void ( APIENTRY *qglVertex4iv )( const GLint *v ); -void ( APIENTRY *qglVertex4s )( GLshort x, GLshort y, GLshort z, GLshort w ); -void ( APIENTRY *qglVertex4sv )( const GLshort *v ); -void ( APIENTRY *qglVertexPointer )( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ); -void ( APIENTRY *qglViewport )( GLint x, GLint y, GLsizei width, GLsizei height ); +void (APIENTRY *qglAccum)(GLenum op, GLfloat value); +void (APIENTRY *qglAlphaFunc)(GLenum func, GLclampf ref); +GLboolean (APIENTRY *qglAreTexturesResident)(GLsizei n, const GLuint *textures, + GLboolean *residences); +void (APIENTRY *qglArrayElement)(GLint i); +void (APIENTRY *qglBegin)(GLenum mode); +void (APIENTRY *qglBindTexture)(GLenum target, GLuint texture); +void (APIENTRY *qglBitmap)(GLsizei width, GLsizei height, GLfloat xorig, + GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap); +void (APIENTRY *qglBlendFunc)(GLenum sfactor, GLenum dfactor); +void (APIENTRY *qglCallList)(GLuint list); +void (APIENTRY *qglCallLists)(GLsizei n, GLenum type, const GLvoid *lists); +void (APIENTRY *qglClear)(GLbitfield mask); +void (APIENTRY *qglClearAccum)(GLfloat red, GLfloat green, GLfloat blue, + GLfloat alpha); +void (APIENTRY *qglClearColor)(GLclampf red, GLclampf green, GLclampf blue, + GLclampf alpha); +void (APIENTRY *qglClearDepth)(GLclampd depth); +void (APIENTRY *qglClearIndex)(GLfloat c); +void (APIENTRY *qglClearStencil)(GLint s); +void (APIENTRY *qglClipPlane)(GLenum plane, const GLdouble *equation); +void (APIENTRY *qglColor3b)(GLbyte red, GLbyte green, GLbyte blue); +void (APIENTRY *qglColor3bv)(const GLbyte *v); +void (APIENTRY *qglColor3d)(GLdouble red, GLdouble green, GLdouble blue); +void (APIENTRY *qglColor3dv)(const GLdouble *v); +void (APIENTRY *qglColor3f)(GLfloat red, GLfloat green, GLfloat blue); +void (APIENTRY *qglColor3fv)(const GLfloat *v); +void (APIENTRY *qglColor3i)(GLint red, GLint green, GLint blue); +void (APIENTRY *qglColor3iv)(const GLint *v); +void (APIENTRY *qglColor3s)(GLshort red, GLshort green, GLshort blue); +void (APIENTRY *qglColor3sv)(const GLshort *v); +void (APIENTRY *qglColor3ub)(GLubyte red, GLubyte green, GLubyte blue); +void (APIENTRY *qglColor3ubv)(const GLubyte *v); +void (APIENTRY *qglColor3ui)(GLuint red, GLuint green, GLuint blue); +void (APIENTRY *qglColor3uiv)(const GLuint *v); +void (APIENTRY *qglColor3us)(GLushort red, GLushort green, GLushort blue); +void (APIENTRY *qglColor3usv)(const GLushort *v); +void (APIENTRY *qglColor4b)(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha); +void (APIENTRY *qglColor4bv)(const GLbyte *v); +void (APIENTRY *qglColor4d)(GLdouble red, GLdouble green, GLdouble blue, + GLdouble alpha); +void (APIENTRY *qglColor4dv)(const GLdouble *v); +void (APIENTRY *qglColor4f)(GLfloat red, GLfloat green, GLfloat blue, + GLfloat alpha); +void (APIENTRY *qglColor4fv)(const GLfloat *v); +void (APIENTRY *qglColor4i)(GLint red, GLint green, GLint blue, GLint alpha); +void (APIENTRY *qglColor4iv)(const GLint *v); +void (APIENTRY *qglColor4s)(GLshort red, GLshort green, GLshort blue, + GLshort alpha); +void (APIENTRY *qglColor4sv)(const GLshort *v); +void (APIENTRY *qglColor4ub)(GLubyte red, GLubyte green, GLubyte blue, + GLubyte alpha); +void (APIENTRY *qglColor4ubv)(const GLubyte *v); +void (APIENTRY *qglColor4ui)(GLuint red, GLuint green, GLuint blue, + GLuint alpha); +void (APIENTRY *qglColor4uiv)(const GLuint *v); +void (APIENTRY *qglColor4us)(GLushort red, GLushort green, GLushort blue, + GLushort alpha); +void (APIENTRY *qglColor4usv)(const GLushort *v); +void (APIENTRY *qglColorMask)(GLboolean red, GLboolean green, GLboolean blue, + GLboolean alpha); +void (APIENTRY *qglColorMaterial)(GLenum face, GLenum mode); +void (APIENTRY *qglColorPointer)(GLint size, GLenum type, GLsizei stride, + const GLvoid *pointer); +void (APIENTRY *qglCopyPixels)(GLint x, GLint y, GLsizei width, GLsizei height, + GLenum type); +void (APIENTRY *qglCopyTexImage1D)(GLenum target, GLint level, + GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border); +void (APIENTRY *qglCopyTexImage2D)(GLenum target, GLint level, + GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, + GLint border); +void (APIENTRY *qglCopyTexSubImage1D)(GLenum target, GLint level, GLint xoffset, + GLint x, GLint y, GLsizei width); +void (APIENTRY *qglCopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, + GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +void (APIENTRY *qglCullFace)(GLenum mode); +void (APIENTRY *qglDeleteLists)(GLuint list, GLsizei range); +void (APIENTRY *qglDeleteTextures)(GLsizei n, const GLuint *textures); +void (APIENTRY *qglDepthFunc)(GLenum func); +void (APIENTRY *qglDepthMask)(GLboolean flag); +void (APIENTRY *qglDepthRange)(GLclampd zNear, GLclampd zFar); +void (APIENTRY *qglDisable)(GLenum cap); +void (APIENTRY *qglDisableClientState)(GLenum array); +void (APIENTRY *qglDrawArrays)(GLenum mode, GLint first, GLsizei count); +void (APIENTRY *qglDrawBuffer)(GLenum mode); +void (APIENTRY *qglDrawElements)(GLenum mode, GLsizei count, GLenum type, + const GLvoid *indices); +void (APIENTRY *qglDrawPixels)(GLsizei width, GLsizei height, GLenum format, + GLenum type, const GLvoid *pixels); +void (APIENTRY *qglEdgeFlag)(GLboolean flag); +void (APIENTRY *qglEdgeFlagPointer)(GLsizei stride, const GLvoid *pointer); +void (APIENTRY *qglEdgeFlagv)(const GLboolean *flag); +void (APIENTRY *qglEnable)(GLenum cap); +void (APIENTRY *qglEnableClientState)(GLenum array); +void (APIENTRY *qglEnd)(void); +void (APIENTRY *qglEndList)(void); +void (APIENTRY *qglEvalCoord1d)(GLdouble u); +void (APIENTRY *qglEvalCoord1dv)(const GLdouble *u); +void (APIENTRY *qglEvalCoord1f)(GLfloat u); +void (APIENTRY *qglEvalCoord1fv)(const GLfloat *u); +void (APIENTRY *qglEvalCoord2d)(GLdouble u, GLdouble v); +void (APIENTRY *qglEvalCoord2dv)(const GLdouble *u); +void (APIENTRY *qglEvalCoord2f)(GLfloat u, GLfloat v); +void (APIENTRY *qglEvalCoord2fv)(const GLfloat *u); +void (APIENTRY *qglEvalMesh1)(GLenum mode, GLint i1, GLint i2); +void (APIENTRY *qglEvalMesh2)(GLenum mode, GLint i1, GLint i2, GLint j1, + GLint j2); +void (APIENTRY *qglEvalPoint1)(GLint i); +void (APIENTRY *qglEvalPoint2)(GLint i, GLint j); +void (APIENTRY *qglFeedbackBuffer)(GLsizei size, GLenum type, GLfloat *buffer); +void (APIENTRY *qglFinish)(void); +void (APIENTRY *qglFlush)(void); +void (APIENTRY *qglFogf)(GLenum pname, GLfloat param); +void (APIENTRY *qglFogfv)(GLenum pname, const GLfloat *params); +void (APIENTRY *qglFogi)(GLenum pname, GLint param); +void (APIENTRY *qglFogiv)(GLenum pname, const GLint *params); +void (APIENTRY *qglFrontFace)(GLenum mode); +void (APIENTRY *qglFrustum)(GLdouble left, GLdouble right, GLdouble bottom, + GLdouble top, GLdouble zNear, GLdouble zFar); +GLuint (APIENTRY *qglGenLists)(GLsizei range); +void (APIENTRY *qglGenTextures)(GLsizei n, GLuint *textures); +void (APIENTRY *qglGetBooleanv)(GLenum pname, GLboolean *params); +void (APIENTRY *qglGetClipPlane)(GLenum plane, GLdouble *equation); +void (APIENTRY *qglGetDoublev)(GLenum pname, GLdouble *params); +GLenum (APIENTRY *qglGetError)(void); +void (APIENTRY *qglGetFloatv)(GLenum pname, GLfloat *params); +void (APIENTRY *qglGetIntegerv)(GLenum pname, GLint *params); +void (APIENTRY *qglGetLightfv)(GLenum light, GLenum pname, GLfloat *params); +void (APIENTRY *qglGetLightiv)(GLenum light, GLenum pname, GLint *params); +void (APIENTRY *qglGetMapdv)(GLenum target, GLenum query, GLdouble *v); +void (APIENTRY *qglGetMapfv)(GLenum target, GLenum query, GLfloat *v); +void (APIENTRY *qglGetMapiv)(GLenum target, GLenum query, GLint *v); +void (APIENTRY *qglGetMaterialfv)(GLenum face, GLenum pname, GLfloat *params); +void (APIENTRY *qglGetMaterialiv)(GLenum face, GLenum pname, GLint *params); +void (APIENTRY *qglGetPixelMapfv)(GLenum map, GLfloat *values); +void (APIENTRY *qglGetPixelMapuiv)(GLenum map, GLuint *values); +void (APIENTRY *qglGetPixelMapusv)(GLenum map, GLushort *values); +void (APIENTRY *qglGetPointerv)(GLenum pname, GLvoid **params); +void (APIENTRY *qglGetPolygonStipple)(GLubyte *mask); +const GLubyte * (APIENTRY * qglGetString)(GLenum name); +void (APIENTRY *qglGetTexEnvfv)(GLenum target, GLenum pname, GLfloat *params); +void (APIENTRY *qglGetTexEnviv)(GLenum target, GLenum pname, GLint *params); +void (APIENTRY *qglGetTexGendv)(GLenum coord, GLenum pname, GLdouble *params); +void (APIENTRY *qglGetTexGenfv)(GLenum coord, GLenum pname, GLfloat *params); +void (APIENTRY *qglGetTexGeniv)(GLenum coord, GLenum pname, GLint *params); +void (APIENTRY *qglGetTexImage)(GLenum target, GLint level, GLenum format, + GLenum type, GLvoid *pixels); +void (APIENTRY *qglGetTexLevelParameterfv)(GLenum target, GLint level, + GLenum pname, GLfloat *params); +void (APIENTRY *qglGetTexLevelParameteriv)(GLenum target, GLint level, + GLenum pname, GLint *params); +void (APIENTRY *qglGetTexParameterfv)(GLenum target, GLenum pname, + GLfloat *params); +void (APIENTRY *qglGetTexParameteriv)(GLenum target, GLenum pname, + GLint *params); +void (APIENTRY *qglHint)(GLenum target, GLenum mode); +void (APIENTRY *qglIndexMask)(GLuint mask); +void (APIENTRY *qglIndexPointer)(GLenum type, GLsizei stride, + const GLvoid *pointer); +void (APIENTRY *qglIndexd)(GLdouble c); +void (APIENTRY *qglIndexdv)(const GLdouble *c); +void (APIENTRY *qglIndexf)(GLfloat c); +void (APIENTRY *qglIndexfv)(const GLfloat *c); +void (APIENTRY *qglIndexi)(GLint c); +void (APIENTRY *qglIndexiv)(const GLint *c); +void (APIENTRY *qglIndexs)(GLshort c); +void (APIENTRY *qglIndexsv)(const GLshort *c); +void (APIENTRY *qglIndexub)(GLubyte c); +void (APIENTRY *qglIndexubv)(const GLubyte *c); +void (APIENTRY *qglInitNames)(void); +void (APIENTRY *qglInterleavedArrays)(GLenum format, GLsizei stride, + const GLvoid *pointer); +GLboolean (APIENTRY *qglIsEnabled)(GLenum cap); +GLboolean (APIENTRY *qglIsList)(GLuint list); +GLboolean (APIENTRY *qglIsTexture)(GLuint texture); +void (APIENTRY *qglLightModelf)(GLenum pname, GLfloat param); +void (APIENTRY *qglLightModelfv)(GLenum pname, const GLfloat *params); +void (APIENTRY *qglLightModeli)(GLenum pname, GLint param); +void (APIENTRY *qglLightModeliv)(GLenum pname, const GLint *params); +void (APIENTRY *qglLightf)(GLenum light, GLenum pname, GLfloat param); +void (APIENTRY *qglLightfv)(GLenum light, GLenum pname, const GLfloat *params); +void (APIENTRY *qglLighti)(GLenum light, GLenum pname, GLint param); +void (APIENTRY *qglLightiv)(GLenum light, GLenum pname, const GLint *params); +void (APIENTRY *qglLineStipple)(GLint factor, GLushort pattern); +void (APIENTRY *qglLineWidth)(GLfloat width); +void (APIENTRY *qglListBase)(GLuint base); +void (APIENTRY *qglLoadIdentity)(void); +void (APIENTRY *qglLoadMatrixd)(const GLdouble *m); +void (APIENTRY *qglLoadMatrixf)(const GLfloat *m); +void (APIENTRY *qglLoadName)(GLuint name); +void (APIENTRY *qglLogicOp)(GLenum opcode); +void (APIENTRY *qglMap1d)(GLenum target, GLdouble u1, GLdouble u2, GLint stride, + GLint order, const GLdouble *points); +void (APIENTRY *qglMap1f)(GLenum target, GLfloat u1, GLfloat u2, GLint stride, + GLint order, const GLfloat *points); +void (APIENTRY *qglMap2d)(GLenum target, GLdouble u1, GLdouble u2, + GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, + GLint vorder, const GLdouble *points); +void (APIENTRY *qglMap2f)(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, + GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, + const GLfloat *points); +void (APIENTRY *qglMapGrid1d)(GLint un, GLdouble u1, GLdouble u2); +void (APIENTRY *qglMapGrid1f)(GLint un, GLfloat u1, GLfloat u2); +void (APIENTRY *qglMapGrid2d)(GLint un, GLdouble u1, GLdouble u2, GLint vn, + GLdouble v1, GLdouble v2); +void (APIENTRY *qglMapGrid2f)(GLint un, GLfloat u1, GLfloat u2, GLint vn, + GLfloat v1, GLfloat v2); +void (APIENTRY *qglMaterialf)(GLenum face, GLenum pname, GLfloat param); +void (APIENTRY *qglMaterialfv)(GLenum face, GLenum pname, const GLfloat *params); +void (APIENTRY *qglMateriali)(GLenum face, GLenum pname, GLint param); +void (APIENTRY *qglMaterialiv)(GLenum face, GLenum pname, const GLint *params); +void (APIENTRY *qglMatrixMode)(GLenum mode); +void (APIENTRY *qglMultMatrixd)(const GLdouble *m); +void (APIENTRY *qglMultMatrixf)(const GLfloat *m); +void (APIENTRY *qglNewList)(GLuint list, GLenum mode); +void (APIENTRY *qglNormal3b)(GLbyte nx, GLbyte ny, GLbyte nz); +void (APIENTRY *qglNormal3bv)(const GLbyte *v); +void (APIENTRY *qglNormal3d)(GLdouble nx, GLdouble ny, GLdouble nz); +void (APIENTRY *qglNormal3dv)(const GLdouble *v); +void (APIENTRY *qglNormal3f)(GLfloat nx, GLfloat ny, GLfloat nz); +void (APIENTRY *qglNormal3fv)(const GLfloat *v); +void (APIENTRY *qglNormal3i)(GLint nx, GLint ny, GLint nz); +void (APIENTRY *qglNormal3iv)(const GLint *v); +void (APIENTRY *qglNormal3s)(GLshort nx, GLshort ny, GLshort nz); +void (APIENTRY *qglNormal3sv)(const GLshort *v); +void (APIENTRY *qglNormalPointer)(GLenum type, GLsizei stride, + const GLvoid *pointer); +void (APIENTRY *qglOrtho)(GLdouble left, GLdouble right, GLdouble bottom, + GLdouble top, GLdouble zNear, GLdouble zFar); +void (APIENTRY *qglPassThrough)(GLfloat token); +void (APIENTRY *qglPixelMapfv)(GLenum map, GLsizei mapsize, + const GLfloat *values); +void (APIENTRY *qglPixelMapuiv)(GLenum map, GLsizei mapsize, + const GLuint *values); +void (APIENTRY *qglPixelMapusv)(GLenum map, GLsizei mapsize, + const GLushort *values); +void (APIENTRY *qglPixelStoref)(GLenum pname, GLfloat param); +void (APIENTRY *qglPixelStorei)(GLenum pname, GLint param); +void (APIENTRY *qglPixelTransferf)(GLenum pname, GLfloat param); +void (APIENTRY *qglPixelTransferi)(GLenum pname, GLint param); +void (APIENTRY *qglPixelZoom)(GLfloat xfactor, GLfloat yfactor); +void (APIENTRY *qglPointSize)(GLfloat size); +void (APIENTRY *qglPolygonMode)(GLenum face, GLenum mode); +void (APIENTRY *qglPolygonOffset)(GLfloat factor, GLfloat units); +void (APIENTRY *qglPolygonStipple)(const GLubyte *mask); +void (APIENTRY *qglPopAttrib)(void); +void (APIENTRY *qglPopClientAttrib)(void); +void (APIENTRY *qglPopMatrix)(void); +void (APIENTRY *qglPopName)(void); +void (APIENTRY *qglPrioritizeTextures)(GLsizei n, const GLuint *textures, + const GLclampf *priorities); +void (APIENTRY *qglPushAttrib)(GLbitfield mask); +void (APIENTRY *qglPushClientAttrib)(GLbitfield mask); +void (APIENTRY *qglPushMatrix)(void); +void (APIENTRY *qglPushName)(GLuint name); +void (APIENTRY *qglRasterPos2d)(GLdouble x, GLdouble y); +void (APIENTRY *qglRasterPos2dv)(const GLdouble *v); +void (APIENTRY *qglRasterPos2f)(GLfloat x, GLfloat y); +void (APIENTRY *qglRasterPos2fv)(const GLfloat *v); +void (APIENTRY *qglRasterPos2i)(GLint x, GLint y); +void (APIENTRY *qglRasterPos2iv)(const GLint *v); +void (APIENTRY *qglRasterPos2s)(GLshort x, GLshort y); +void (APIENTRY *qglRasterPos2sv)(const GLshort *v); +void (APIENTRY *qglRasterPos3d)(GLdouble x, GLdouble y, GLdouble z); +void (APIENTRY *qglRasterPos3dv)(const GLdouble *v); +void (APIENTRY *qglRasterPos3f)(GLfloat x, GLfloat y, GLfloat z); +void (APIENTRY *qglRasterPos3fv)(const GLfloat *v); +void (APIENTRY *qglRasterPos3i)(GLint x, GLint y, GLint z); +void (APIENTRY *qglRasterPos3iv)(const GLint *v); +void (APIENTRY *qglRasterPos3s)(GLshort x, GLshort y, GLshort z); +void (APIENTRY *qglRasterPos3sv)(const GLshort *v); +void (APIENTRY *qglRasterPos4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); +void (APIENTRY *qglRasterPos4dv)(const GLdouble *v); +void (APIENTRY *qglRasterPos4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); +void (APIENTRY *qglRasterPos4fv)(const GLfloat *v); +void (APIENTRY *qglRasterPos4i)(GLint x, GLint y, GLint z, GLint w); +void (APIENTRY *qglRasterPos4iv)(const GLint *v); +void (APIENTRY *qglRasterPos4s)(GLshort x, GLshort y, GLshort z, GLshort w); +void (APIENTRY *qglRasterPos4sv)(const GLshort *v); +void (APIENTRY *qglReadBuffer)(GLenum mode); +void (APIENTRY *qglReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, + GLenum format, GLenum type, GLvoid *pixels); +void (APIENTRY *qglRectd)(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2); +void (APIENTRY *qglRectdv)(const GLdouble *v1, const GLdouble *v2); +void (APIENTRY *qglRectf)(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2); +void (APIENTRY *qglRectfv)(const GLfloat *v1, const GLfloat *v2); +void (APIENTRY *qglRecti)(GLint x1, GLint y1, GLint x2, GLint y2); +void (APIENTRY *qglRectiv)(const GLint *v1, const GLint *v2); +void (APIENTRY *qglRects)(GLshort x1, GLshort y1, GLshort x2, GLshort y2); +void (APIENTRY *qglRectsv)(const GLshort *v1, const GLshort *v2); +GLint (APIENTRY *qglRenderMode)(GLenum mode); +void (APIENTRY *qglRotated)(GLdouble angle, GLdouble x, GLdouble y, GLdouble z); +void (APIENTRY *qglRotatef)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z); +void (APIENTRY *qglScaled)(GLdouble x, GLdouble y, GLdouble z); +void (APIENTRY *qglScalef)(GLfloat x, GLfloat y, GLfloat z); +void (APIENTRY *qglScissor)(GLint x, GLint y, GLsizei width, GLsizei height); +void (APIENTRY *qglSelectBuffer)(GLsizei size, GLuint *buffer); +void (APIENTRY *qglShadeModel)(GLenum mode); +void (APIENTRY *qglStencilFunc)(GLenum func, GLint ref, GLuint mask); +void (APIENTRY *qglStencilMask)(GLuint mask); +void (APIENTRY *qglStencilOp)(GLenum fail, GLenum zfail, GLenum zpass); +void (APIENTRY *qglTexCoord1d)(GLdouble s); +void (APIENTRY *qglTexCoord1dv)(const GLdouble *v); +void (APIENTRY *qglTexCoord1f)(GLfloat s); +void (APIENTRY *qglTexCoord1fv)(const GLfloat *v); +void (APIENTRY *qglTexCoord1i)(GLint s); +void (APIENTRY *qglTexCoord1iv)(const GLint *v); +void (APIENTRY *qglTexCoord1s)(GLshort s); +void (APIENTRY *qglTexCoord1sv)(const GLshort *v); +void (APIENTRY *qglTexCoord2d)(GLdouble s, GLdouble t); +void (APIENTRY *qglTexCoord2dv)(const GLdouble *v); +void (APIENTRY *qglTexCoord2f)(GLfloat s, GLfloat t); +void (APIENTRY *qglTexCoord2fv)(const GLfloat *v); +void (APIENTRY *qglTexCoord2i)(GLint s, GLint t); +void (APIENTRY *qglTexCoord2iv)(const GLint *v); +void (APIENTRY *qglTexCoord2s)(GLshort s, GLshort t); +void (APIENTRY *qglTexCoord2sv)(const GLshort *v); +void (APIENTRY *qglTexCoord3d)(GLdouble s, GLdouble t, GLdouble r); +void (APIENTRY *qglTexCoord3dv)(const GLdouble *v); +void (APIENTRY *qglTexCoord3f)(GLfloat s, GLfloat t, GLfloat r); +void (APIENTRY *qglTexCoord3fv)(const GLfloat *v); +void (APIENTRY *qglTexCoord3i)(GLint s, GLint t, GLint r); +void (APIENTRY *qglTexCoord3iv)(const GLint *v); +void (APIENTRY *qglTexCoord3s)(GLshort s, GLshort t, GLshort r); +void (APIENTRY *qglTexCoord3sv)(const GLshort *v); +void (APIENTRY *qglTexCoord4d)(GLdouble s, GLdouble t, GLdouble r, GLdouble q); +void (APIENTRY *qglTexCoord4dv)(const GLdouble *v); +void (APIENTRY *qglTexCoord4f)(GLfloat s, GLfloat t, GLfloat r, GLfloat q); +void (APIENTRY *qglTexCoord4fv)(const GLfloat *v); +void (APIENTRY *qglTexCoord4i)(GLint s, GLint t, GLint r, GLint q); +void (APIENTRY *qglTexCoord4iv)(const GLint *v); +void (APIENTRY *qglTexCoord4s)(GLshort s, GLshort t, GLshort r, GLshort q); +void (APIENTRY *qglTexCoord4sv)(const GLshort *v); +void (APIENTRY *qglTexCoordPointer)(GLint size, GLenum type, GLsizei stride, + const GLvoid *pointer); +void (APIENTRY *qglTexEnvf)(GLenum target, GLenum pname, GLfloat param); +void (APIENTRY *qglTexEnvfv)(GLenum target, GLenum pname, const GLfloat *params); +void (APIENTRY *qglTexEnvi)(GLenum target, GLenum pname, GLint param); +void (APIENTRY *qglTexEnviv)(GLenum target, GLenum pname, const GLint *params); +void (APIENTRY *qglTexGend)(GLenum coord, GLenum pname, GLdouble param); +void (APIENTRY *qglTexGendv)(GLenum coord, GLenum pname, const GLdouble *params); +void (APIENTRY *qglTexGenf)(GLenum coord, GLenum pname, GLfloat param); +void (APIENTRY *qglTexGenfv)(GLenum coord, GLenum pname, const GLfloat *params); +void (APIENTRY *qglTexGeni)(GLenum coord, GLenum pname, GLint param); +void (APIENTRY *qglTexGeniv)(GLenum coord, GLenum pname, const GLint *params); +void (APIENTRY *qglTexImage1D)(GLenum target, GLint level, GLint internalformat, + GLsizei width, GLint border, GLenum format, GLenum type, + const GLvoid *pixels); +void (APIENTRY *qglTexImage2D)(GLenum target, GLint level, GLint internalformat, + GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, + const GLvoid *pixels); +void (APIENTRY *qglTexParameterf)(GLenum target, GLenum pname, GLfloat param); +void (APIENTRY *qglTexParameterfv)(GLenum target, GLenum pname, + const GLfloat *params); +void (APIENTRY *qglTexParameteri)(GLenum target, GLenum pname, GLint param); +void (APIENTRY *qglTexParameteriv)(GLenum target, GLenum pname, + const GLint *params); +void (APIENTRY *qglTexSubImage1D)(GLenum target, GLint level, GLint xoffset, + GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); +void (APIENTRY *qglTexSubImage2D)(GLenum target, GLint level, GLint xoffset, + GLint yoffset, GLsizei width, GLsizei height, GLenum format, + GLenum type, const GLvoid *pixels); +void (APIENTRY *qglTranslated)(GLdouble x, GLdouble y, GLdouble z); +void (APIENTRY *qglTranslatef)(GLfloat x, GLfloat y, GLfloat z); +void (APIENTRY *qglVertex2d)(GLdouble x, GLdouble y); +void (APIENTRY *qglVertex2dv)(const GLdouble *v); +void (APIENTRY *qglVertex2f)(GLfloat x, GLfloat y); +void (APIENTRY *qglVertex2fv)(const GLfloat *v); +void (APIENTRY *qglVertex2i)(GLint x, GLint y); +void (APIENTRY *qglVertex2iv)(const GLint *v); +void (APIENTRY *qglVertex2s)(GLshort x, GLshort y); +void (APIENTRY *qglVertex2sv)(const GLshort *v); +void (APIENTRY *qglVertex3d)(GLdouble x, GLdouble y, GLdouble z); +void (APIENTRY *qglVertex3dv)(const GLdouble *v); +void (APIENTRY *qglVertex3f)(GLfloat x, GLfloat y, GLfloat z); +void (APIENTRY *qglVertex3fv)(const GLfloat *v); +void (APIENTRY *qglVertex3i)(GLint x, GLint y, GLint z); +void (APIENTRY *qglVertex3iv)(const GLint *v); +void (APIENTRY *qglVertex3s)(GLshort x, GLshort y, GLshort z); +void (APIENTRY *qglVertex3sv)(const GLshort *v); +void (APIENTRY *qglVertex4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); +void (APIENTRY *qglVertex4dv)(const GLdouble *v); +void (APIENTRY *qglVertex4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); +void (APIENTRY *qglVertex4fv)(const GLfloat *v); +void (APIENTRY *qglVertex4i)(GLint x, GLint y, GLint z, GLint w); +void (APIENTRY *qglVertex4iv)(const GLint *v); +void (APIENTRY *qglVertex4s)(GLshort x, GLshort y, GLshort z, GLshort w); +void (APIENTRY *qglVertex4sv)(const GLshort *v); +void (APIENTRY *qglVertexPointer)(GLint size, GLenum type, GLsizei stride, + const GLvoid *pointer); +void (APIENTRY *qglViewport)(GLint x, GLint y, GLsizei width, GLsizei height); -void ( APIENTRY *qglLockArraysEXT )( int, int ); -void ( APIENTRY *qglUnlockArraysEXT )( void ); +void (APIENTRY *qglLockArraysEXT)(int, int); +void (APIENTRY *qglUnlockArraysEXT)(void); -void ( APIENTRY *qglPointParameterfEXT )( GLenum param, GLfloat value ); -void ( APIENTRY *qglPointParameterfvEXT )( GLenum param, const GLfloat *value ); -void ( APIENTRY *qglColorTableEXT )( GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid * ); +void (APIENTRY *qglPointParameterfEXT)(GLenum param, GLfloat value); +void (APIENTRY *qglPointParameterfvEXT)(GLenum param, const GLfloat *value); +void (APIENTRY *qglColorTableEXT)(GLenum, GLenum, GLsizei, GLenum, GLenum, + const GLvoid *); -void ( APIENTRY *qgl3DfxSetPaletteEXT )( GLuint * ); -void ( APIENTRY *qglSelectTextureSGIS )( GLenum ); -void ( APIENTRY *qglMTexCoord2fSGIS )( GLenum, GLfloat, GLfloat ); -void ( APIENTRY *qglActiveTextureARB )( GLenum ); -void ( APIENTRY *qglClientActiveTextureARB )( GLenum ); +void (APIENTRY *qgl3DfxSetPaletteEXT)(GLuint *); +void (APIENTRY *qglSelectTextureSGIS)(GLenum); +void (APIENTRY *qglMTexCoord2fSGIS)(GLenum, GLfloat, GLfloat); +void (APIENTRY *qglActiveTextureARB)(GLenum); +void (APIENTRY *qglClientActiveTextureARB)(GLenum); -static void ( APIENTRY *dllAccum )( GLenum op, GLfloat value ); -static void ( APIENTRY *dllAlphaFunc )( GLenum func, GLclampf ref ); -GLboolean ( APIENTRY *dllAreTexturesResident )( GLsizei n, const GLuint *textures, GLboolean *residences ); -static void ( APIENTRY *dllArrayElement )( GLint i ); -static void ( APIENTRY *dllBegin )( GLenum mode ); -static void ( APIENTRY *dllBindTexture )( GLenum target, GLuint texture ); -static void ( APIENTRY *dllBitmap )( GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, - const GLubyte *bitmap ); -static void ( APIENTRY *dllBlendFunc )( GLenum sfactor, GLenum dfactor ); -static void ( APIENTRY *dllCallList )( GLuint list ); -static void ( APIENTRY *dllCallLists )( GLsizei n, GLenum type, const GLvoid *lists ); -static void ( APIENTRY *dllClear )( GLbitfield mask ); -static void ( APIENTRY *dllClearAccum )( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ); -static void ( APIENTRY *dllClearColor )( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ); -static void ( APIENTRY *dllClearDepth )( GLclampd depth ); -static void ( APIENTRY *dllClearIndex )( GLfloat c ); -static void ( APIENTRY *dllClearStencil )( GLint s ); -static void ( APIENTRY *dllClipPlane )( GLenum plane, const GLdouble *equation ); -static void ( APIENTRY *dllColor3b )( GLbyte red, GLbyte green, GLbyte blue ); -static void ( APIENTRY *dllColor3bv )( const GLbyte *v ); -static void ( APIENTRY *dllColor3d )( GLdouble red, GLdouble green, GLdouble blue ); -static void ( APIENTRY *dllColor3dv )( const GLdouble *v ); -static void ( APIENTRY *dllColor3f )( GLfloat red, GLfloat green, GLfloat blue ); -static void ( APIENTRY *dllColor3fv )( const GLfloat *v ); -static void ( APIENTRY *dllColor3i )( GLint red, GLint green, GLint blue ); -static void ( APIENTRY *dllColor3iv )( const GLint *v ); -static void ( APIENTRY *dllColor3s )( GLshort red, GLshort green, GLshort blue ); -static void ( APIENTRY *dllColor3sv )( const GLshort *v ); -static void ( APIENTRY *dllColor3ub )( GLubyte red, GLubyte green, GLubyte blue ); -static void ( APIENTRY *dllColor3ubv )( const GLubyte *v ); -static void ( APIENTRY *dllColor3ui )( GLuint red, GLuint green, GLuint blue ); -static void ( APIENTRY *dllColor3uiv )( const GLuint *v ); -static void ( APIENTRY *dllColor3us )( GLushort red, GLushort green, GLushort blue ); -static void ( APIENTRY *dllColor3usv )( const GLushort *v ); -static void ( APIENTRY *dllColor4b )( GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha ); -static void ( APIENTRY *dllColor4bv )( const GLbyte *v ); -static void ( APIENTRY *dllColor4d )( GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha ); -static void ( APIENTRY *dllColor4dv )( const GLdouble *v ); -static void ( APIENTRY *dllColor4f )( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ); -static void ( APIENTRY *dllColor4fv )( const GLfloat *v ); -static void ( APIENTRY *dllColor4i )( GLint red, GLint green, GLint blue, GLint alpha ); -static void ( APIENTRY *dllColor4iv )( const GLint *v ); -static void ( APIENTRY *dllColor4s )( GLshort red, GLshort green, GLshort blue, GLshort alpha ); -static void ( APIENTRY *dllColor4sv )( const GLshort *v ); -static void ( APIENTRY *dllColor4ub )( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ); -static void ( APIENTRY *dllColor4ubv )( const GLubyte *v ); -static void ( APIENTRY *dllColor4ui )( GLuint red, GLuint green, GLuint blue, GLuint alpha ); -static void ( APIENTRY *dllColor4uiv )( const GLuint *v ); -static void ( APIENTRY *dllColor4us )( GLushort red, GLushort green, GLushort blue, GLushort alpha ); -static void ( APIENTRY *dllColor4usv )( const GLushort *v ); -static void ( APIENTRY *dllColorMask )( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ); -static void ( APIENTRY *dllColorMaterial )( GLenum face, GLenum mode ); -static void ( APIENTRY *dllColorPointer )( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ); -static void ( APIENTRY *dllCopyPixels )( GLint x, GLint y, GLsizei width, GLsizei height, GLenum type ); -static void ( APIENTRY *dllCopyTexImage1D )( GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, - GLint border ); -static void ( APIENTRY *dllCopyTexImage2D )( GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, - GLsizei height, GLint border ); -static void ( APIENTRY *dllCopyTexSubImage1D )( GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width ); -static void ( APIENTRY *dllCopyTexSubImage2D )( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, - GLsizei width, GLsizei height ); -static void ( APIENTRY *dllCullFace )( GLenum mode ); -static void ( APIENTRY *dllDeleteLists )( GLuint list, GLsizei range ); -static void ( APIENTRY *dllDeleteTextures )( GLsizei n, const GLuint *textures ); -static void ( APIENTRY *dllDepthFunc )( GLenum func ); -static void ( APIENTRY *dllDepthMask )( GLboolean flag ); -static void ( APIENTRY *dllDepthRange )( GLclampd zNear, GLclampd zFar ); -static void ( APIENTRY *dllDisable )( GLenum cap ); -static void ( APIENTRY *dllDisableClientState )( GLenum array ); -static void ( APIENTRY *dllDrawArrays )( GLenum mode, GLint first, GLsizei count ); -static void ( APIENTRY *dllDrawBuffer )( GLenum mode ); -static void ( APIENTRY *dllDrawElements )( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices ); -static void ( APIENTRY *dllDrawPixels )( GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ); -static void ( APIENTRY *dllEdgeFlag )( GLboolean flag ); -static void ( APIENTRY *dllEdgeFlagPointer )( GLsizei stride, const GLvoid *pointer ); -static void ( APIENTRY *dllEdgeFlagv )( const GLboolean *flag ); -static void ( APIENTRY *dllEnable )( GLenum cap ); -static void ( APIENTRY *dllEnableClientState )( GLenum array ); -static void ( APIENTRY *dllEnd )( void ); -static void ( APIENTRY *dllEndList )( void ); -static void ( APIENTRY *dllEvalCoord1d )( GLdouble u ); -static void ( APIENTRY *dllEvalCoord1dv )( const GLdouble *u ); -static void ( APIENTRY *dllEvalCoord1f )( GLfloat u ); -static void ( APIENTRY *dllEvalCoord1fv )( const GLfloat *u ); -static void ( APIENTRY *dllEvalCoord2d )( GLdouble u, GLdouble v ); -static void ( APIENTRY *dllEvalCoord2dv )( const GLdouble *u ); -static void ( APIENTRY *dllEvalCoord2f )( GLfloat u, GLfloat v ); -static void ( APIENTRY *dllEvalCoord2fv )( const GLfloat *u ); -static void ( APIENTRY *dllEvalMesh1 )( GLenum mode, GLint i1, GLint i2 ); -static void ( APIENTRY *dllEvalMesh2 )( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ); -static void ( APIENTRY *dllEvalPoint1 )( GLint i ); -static void ( APIENTRY *dllEvalPoint2 )( GLint i, GLint j ); -static void ( APIENTRY *dllFeedbackBuffer )( GLsizei size, GLenum type, GLfloat *buffer ); -static void ( APIENTRY *dllFinish )( void ); -static void ( APIENTRY *dllFlush )( void ); -static void ( APIENTRY *dllFogf )( GLenum pname, GLfloat param ); -static void ( APIENTRY *dllFogfv )( GLenum pname, const GLfloat *params ); -static void ( APIENTRY *dllFogi )( GLenum pname, GLint param ); -static void ( APIENTRY *dllFogiv )( GLenum pname, const GLint *params ); -static void ( APIENTRY *dllFrontFace )( GLenum mode ); -static void ( APIENTRY *dllFrustum )( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar ); -GLuint ( APIENTRY *dllGenLists )( GLsizei range ); -static void ( APIENTRY *dllGenTextures )( GLsizei n, GLuint *textures ); -static void ( APIENTRY *dllGetBooleanv )( GLenum pname, GLboolean *params ); -static void ( APIENTRY *dllGetClipPlane )( GLenum plane, GLdouble *equation ); -static void ( APIENTRY *dllGetDoublev )( GLenum pname, GLdouble *params ); -GLenum ( APIENTRY *dllGetError )( void ); -static void ( APIENTRY *dllGetFloatv )( GLenum pname, GLfloat *params ); -static void ( APIENTRY *dllGetIntegerv )( GLenum pname, GLint *params ); -static void ( APIENTRY *dllGetLightfv )( GLenum light, GLenum pname, GLfloat *params ); -static void ( APIENTRY *dllGetLightiv )( GLenum light, GLenum pname, GLint *params ); -static void ( APIENTRY *dllGetMapdv )( GLenum target, GLenum query, GLdouble *v ); -static void ( APIENTRY *dllGetMapfv )( GLenum target, GLenum query, GLfloat *v ); -static void ( APIENTRY *dllGetMapiv )( GLenum target, GLenum query, GLint *v ); -static void ( APIENTRY *dllGetMaterialfv )( GLenum face, GLenum pname, GLfloat *params ); -static void ( APIENTRY *dllGetMaterialiv )( GLenum face, GLenum pname, GLint *params ); -static void ( APIENTRY *dllGetPixelMapfv )( GLenum map, GLfloat *values ); -static void ( APIENTRY *dllGetPixelMapuiv )( GLenum map, GLuint *values ); -static void ( APIENTRY *dllGetPixelMapusv )( GLenum map, GLushort *values ); -static void ( APIENTRY *dllGetPointerv )( GLenum pname, GLvoid **params ); -static void ( APIENTRY *dllGetPolygonStipple )( GLubyte *mask ); -const GLubyte * ( APIENTRY * dllGetString )(GLenum name); -static void ( APIENTRY *dllGetTexEnvfv )( GLenum target, GLenum pname, GLfloat *params ); -static void ( APIENTRY *dllGetTexEnviv )( GLenum target, GLenum pname, GLint *params ); -static void ( APIENTRY *dllGetTexGendv )( GLenum coord, GLenum pname, GLdouble *params ); -static void ( APIENTRY *dllGetTexGenfv )( GLenum coord, GLenum pname, GLfloat *params ); -static void ( APIENTRY *dllGetTexGeniv )( GLenum coord, GLenum pname, GLint *params ); -static void ( APIENTRY *dllGetTexImage )( GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels ); -static void ( APIENTRY *dllGetTexLevelParameterfv )( GLenum target, GLint level, GLenum pname, GLfloat *params ); -static void ( APIENTRY *dllGetTexLevelParameteriv )( GLenum target, GLint level, GLenum pname, GLint *params ); -static void ( APIENTRY *dllGetTexParameterfv )( GLenum target, GLenum pname, GLfloat *params ); -static void ( APIENTRY *dllGetTexParameteriv )( GLenum target, GLenum pname, GLint *params ); -static void ( APIENTRY *dllHint )( GLenum target, GLenum mode ); -static void ( APIENTRY *dllIndexMask )( GLuint mask ); -static void ( APIENTRY *dllIndexPointer )( GLenum type, GLsizei stride, const GLvoid *pointer ); -static void ( APIENTRY *dllIndexd )( GLdouble c ); -static void ( APIENTRY *dllIndexdv )( const GLdouble *c ); -static void ( APIENTRY *dllIndexf )( GLfloat c ); -static void ( APIENTRY *dllIndexfv )( const GLfloat *c ); -static void ( APIENTRY *dllIndexi )( GLint c ); -static void ( APIENTRY *dllIndexiv )( const GLint *c ); -static void ( APIENTRY *dllIndexs )( GLshort c ); -static void ( APIENTRY *dllIndexsv )( const GLshort *c ); -static void ( APIENTRY *dllIndexub )( GLubyte c ); -static void ( APIENTRY *dllIndexubv )( const GLubyte *c ); -static void ( APIENTRY *dllInitNames )( void ); -static void ( APIENTRY *dllInterleavedArrays )( GLenum format, GLsizei stride, const GLvoid *pointer ); -GLboolean ( APIENTRY *dllIsEnabled )( GLenum cap ); -GLboolean ( APIENTRY *dllIsList )( GLuint list ); -GLboolean ( APIENTRY *dllIsTexture )( GLuint texture ); -static void ( APIENTRY *dllLightModelf )( GLenum pname, GLfloat param ); -static void ( APIENTRY *dllLightModelfv )( GLenum pname, const GLfloat *params ); -static void ( APIENTRY *dllLightModeli )( GLenum pname, GLint param ); -static void ( APIENTRY *dllLightModeliv )( GLenum pname, const GLint *params ); -static void ( APIENTRY *dllLightf )( GLenum light, GLenum pname, GLfloat param ); -static void ( APIENTRY *dllLightfv )( GLenum light, GLenum pname, const GLfloat *params ); -static void ( APIENTRY *dllLighti )( GLenum light, GLenum pname, GLint param ); -static void ( APIENTRY *dllLightiv )( GLenum light, GLenum pname, const GLint *params ); -static void ( APIENTRY *dllLineStipple )( GLint factor, GLushort pattern ); -static void ( APIENTRY *dllLineWidth )( GLfloat width ); -static void ( APIENTRY *dllListBase )( GLuint base ); -static void ( APIENTRY *dllLoadIdentity )( void ); -static void ( APIENTRY *dllLoadMatrixd )( const GLdouble *m ); -static void ( APIENTRY *dllLoadMatrixf )( const GLfloat *m ); -static void ( APIENTRY *dllLoadName )( GLuint name ); -static void ( APIENTRY *dllLogicOp )( GLenum opcode ); -static void ( APIENTRY *dllMap1d )( GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points ); -static void ( APIENTRY *dllMap1f )( GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points ); -static void ( APIENTRY *dllMap2d )( GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, - GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points ); -static void ( APIENTRY *dllMap2f )( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, - GLint vstride, GLint vorder, const GLfloat *points ); -static void ( APIENTRY *dllMapGrid1d )( GLint un, GLdouble u1, GLdouble u2 ); -static void ( APIENTRY *dllMapGrid1f )( GLint un, GLfloat u1, GLfloat u2 ); -static void ( APIENTRY *dllMapGrid2d )( GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2 ); -static void ( APIENTRY *dllMapGrid2f )( GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2 ); -static void ( APIENTRY *dllMaterialf )( GLenum face, GLenum pname, GLfloat param ); -static void ( APIENTRY *dllMaterialfv )( GLenum face, GLenum pname, const GLfloat *params ); -static void ( APIENTRY *dllMateriali )( GLenum face, GLenum pname, GLint param ); -static void ( APIENTRY *dllMaterialiv )( GLenum face, GLenum pname, const GLint *params ); -static void ( APIENTRY *dllMatrixMode )( GLenum mode ); -static void ( APIENTRY *dllMultMatrixd )( const GLdouble *m ); -static void ( APIENTRY *dllMultMatrixf )( const GLfloat *m ); -static void ( APIENTRY *dllNewList )( GLuint list, GLenum mode ); -static void ( APIENTRY *dllNormal3b )( GLbyte nx, GLbyte ny, GLbyte nz ); -static void ( APIENTRY *dllNormal3bv )( const GLbyte *v ); -static void ( APIENTRY *dllNormal3d )( GLdouble nx, GLdouble ny, GLdouble nz ); -static void ( APIENTRY *dllNormal3dv )( const GLdouble *v ); -static void ( APIENTRY *dllNormal3f )( GLfloat nx, GLfloat ny, GLfloat nz ); -static void ( APIENTRY *dllNormal3fv )( const GLfloat *v ); -static void ( APIENTRY *dllNormal3i )( GLint nx, GLint ny, GLint nz ); -static void ( APIENTRY *dllNormal3iv )( const GLint *v ); -static void ( APIENTRY *dllNormal3s )( GLshort nx, GLshort ny, GLshort nz ); -static void ( APIENTRY *dllNormal3sv )( const GLshort *v ); -static void ( APIENTRY *dllNormalPointer )( GLenum type, GLsizei stride, const GLvoid *pointer ); -static void ( APIENTRY *dllOrtho )( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar ); -static void ( APIENTRY *dllPassThrough )( GLfloat token ); -static void ( APIENTRY *dllPixelMapfv )( GLenum map, GLsizei mapsize, const GLfloat *values ); -static void ( APIENTRY *dllPixelMapuiv )( GLenum map, GLsizei mapsize, const GLuint *values ); -static void ( APIENTRY *dllPixelMapusv )( GLenum map, GLsizei mapsize, const GLushort *values ); -static void ( APIENTRY *dllPixelStoref )( GLenum pname, GLfloat param ); -static void ( APIENTRY *dllPixelStorei )( GLenum pname, GLint param ); -static void ( APIENTRY *dllPixelTransferf )( GLenum pname, GLfloat param ); -static void ( APIENTRY *dllPixelTransferi )( GLenum pname, GLint param ); -static void ( APIENTRY *dllPixelZoom )( GLfloat xfactor, GLfloat yfactor ); -static void ( APIENTRY *dllPointSize )( GLfloat size ); -static void ( APIENTRY *dllPolygonMode )( GLenum face, GLenum mode ); -static void ( APIENTRY *dllPolygonOffset )( GLfloat factor, GLfloat units ); -static void ( APIENTRY *dllPolygonStipple )( const GLubyte *mask ); -static void ( APIENTRY *dllPopAttrib )( void ); -static void ( APIENTRY *dllPopClientAttrib )( void ); -static void ( APIENTRY *dllPopMatrix )( void ); -static void ( APIENTRY *dllPopName )( void ); -static void ( APIENTRY *dllPrioritizeTextures )( GLsizei n, const GLuint *textures, const GLclampf *priorities ); -static void ( APIENTRY *dllPushAttrib )( GLbitfield mask ); -static void ( APIENTRY *dllPushClientAttrib )( GLbitfield mask ); -static void ( APIENTRY *dllPushMatrix )( void ); -static void ( APIENTRY *dllPushName )( GLuint name ); -static void ( APIENTRY *dllRasterPos2d )( GLdouble x, GLdouble y ); -static void ( APIENTRY *dllRasterPos2dv )( const GLdouble *v ); -static void ( APIENTRY *dllRasterPos2f )( GLfloat x, GLfloat y ); -static void ( APIENTRY *dllRasterPos2fv )( const GLfloat *v ); -static void ( APIENTRY *dllRasterPos2i )( GLint x, GLint y ); -static void ( APIENTRY *dllRasterPos2iv )( const GLint *v ); -static void ( APIENTRY *dllRasterPos2s )( GLshort x, GLshort y ); -static void ( APIENTRY *dllRasterPos2sv )( const GLshort *v ); -static void ( APIENTRY *dllRasterPos3d )( GLdouble x, GLdouble y, GLdouble z ); -static void ( APIENTRY *dllRasterPos3dv )( const GLdouble *v ); -static void ( APIENTRY *dllRasterPos3f )( GLfloat x, GLfloat y, GLfloat z ); -static void ( APIENTRY *dllRasterPos3fv )( const GLfloat *v ); -static void ( APIENTRY *dllRasterPos3i )( GLint x, GLint y, GLint z ); -static void ( APIENTRY *dllRasterPos3iv )( const GLint *v ); -static void ( APIENTRY *dllRasterPos3s )( GLshort x, GLshort y, GLshort z ); -static void ( APIENTRY *dllRasterPos3sv )( const GLshort *v ); -static void ( APIENTRY *dllRasterPos4d )( GLdouble x, GLdouble y, GLdouble z, GLdouble w ); -static void ( APIENTRY *dllRasterPos4dv )( const GLdouble *v ); -static void ( APIENTRY *dllRasterPos4f )( GLfloat x, GLfloat y, GLfloat z, GLfloat w ); -static void ( APIENTRY *dllRasterPos4fv )( const GLfloat *v ); -static void ( APIENTRY *dllRasterPos4i )( GLint x, GLint y, GLint z, GLint w ); -static void ( APIENTRY *dllRasterPos4iv )( const GLint *v ); -static void ( APIENTRY *dllRasterPos4s )( GLshort x, GLshort y, GLshort z, GLshort w ); -static void ( APIENTRY *dllRasterPos4sv )( const GLshort *v ); -static void ( APIENTRY *dllReadBuffer )( GLenum mode ); -static void ( APIENTRY *dllReadPixels )( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, - GLvoid *pixels ); -static void ( APIENTRY *dllRectd )( GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2 ); -static void ( APIENTRY *dllRectdv )( const GLdouble *v1, const GLdouble *v2 ); -static void ( APIENTRY *dllRectf )( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ); -static void ( APIENTRY *dllRectfv )( const GLfloat *v1, const GLfloat *v2 ); -static void ( APIENTRY *dllRecti )( GLint x1, GLint y1, GLint x2, GLint y2 ); -static void ( APIENTRY *dllRectiv )( const GLint *v1, const GLint *v2 ); -static void ( APIENTRY *dllRects )( GLshort x1, GLshort y1, GLshort x2, GLshort y2 ); -static void ( APIENTRY *dllRectsv )( const GLshort *v1, const GLshort *v2 ); -GLint ( APIENTRY *dllRenderMode )( GLenum mode ); -static void ( APIENTRY *dllRotated )( GLdouble angle, GLdouble x, GLdouble y, GLdouble z ); -static void ( APIENTRY *dllRotatef )( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ); -static void ( APIENTRY *dllScaled )( GLdouble x, GLdouble y, GLdouble z ); -static void ( APIENTRY *dllScalef )( GLfloat x, GLfloat y, GLfloat z ); -static void ( APIENTRY *dllScissor )( GLint x, GLint y, GLsizei width, GLsizei height ); -static void ( APIENTRY *dllSelectBuffer )( GLsizei size, GLuint *buffer ); -static void ( APIENTRY *dllShadeModel )( GLenum mode ); -static void ( APIENTRY *dllStencilFunc )( GLenum func, GLint ref, GLuint mask ); -static void ( APIENTRY *dllStencilMask )( GLuint mask ); -static void ( APIENTRY *dllStencilOp )( GLenum fail, GLenum zfail, GLenum zpass ); -static void ( APIENTRY *dllTexCoord1d )( GLdouble s ); -static void ( APIENTRY *dllTexCoord1dv )( const GLdouble *v ); -static void ( APIENTRY *dllTexCoord1f )( GLfloat s ); -static void ( APIENTRY *dllTexCoord1fv )( const GLfloat *v ); -static void ( APIENTRY *dllTexCoord1i )( GLint s ); -static void ( APIENTRY *dllTexCoord1iv )( const GLint *v ); -static void ( APIENTRY *dllTexCoord1s )( GLshort s ); -static void ( APIENTRY *dllTexCoord1sv )( const GLshort *v ); -static void ( APIENTRY *dllTexCoord2d )( GLdouble s, GLdouble t ); -static void ( APIENTRY *dllTexCoord2dv )( const GLdouble *v ); -static void ( APIENTRY *dllTexCoord2f )( GLfloat s, GLfloat t ); -static void ( APIENTRY *dllTexCoord2fv )( const GLfloat *v ); -static void ( APIENTRY *dllTexCoord2i )( GLint s, GLint t ); -static void ( APIENTRY *dllTexCoord2iv )( const GLint *v ); -static void ( APIENTRY *dllTexCoord2s )( GLshort s, GLshort t ); -static void ( APIENTRY *dllTexCoord2sv )( const GLshort *v ); -static void ( APIENTRY *dllTexCoord3d )( GLdouble s, GLdouble t, GLdouble r ); -static void ( APIENTRY *dllTexCoord3dv )( const GLdouble *v ); -static void ( APIENTRY *dllTexCoord3f )( GLfloat s, GLfloat t, GLfloat r ); -static void ( APIENTRY *dllTexCoord3fv )( const GLfloat *v ); -static void ( APIENTRY *dllTexCoord3i )( GLint s, GLint t, GLint r ); -static void ( APIENTRY *dllTexCoord3iv )( const GLint *v ); -static void ( APIENTRY *dllTexCoord3s )( GLshort s, GLshort t, GLshort r ); -static void ( APIENTRY *dllTexCoord3sv )( const GLshort *v ); -static void ( APIENTRY *dllTexCoord4d )( GLdouble s, GLdouble t, GLdouble r, GLdouble q ); -static void ( APIENTRY *dllTexCoord4dv )( const GLdouble *v ); -static void ( APIENTRY *dllTexCoord4f )( GLfloat s, GLfloat t, GLfloat r, GLfloat q ); -static void ( APIENTRY *dllTexCoord4fv )( const GLfloat *v ); -static void ( APIENTRY *dllTexCoord4i )( GLint s, GLint t, GLint r, GLint q ); -static void ( APIENTRY *dllTexCoord4iv )( const GLint *v ); -static void ( APIENTRY *dllTexCoord4s )( GLshort s, GLshort t, GLshort r, GLshort q ); -static void ( APIENTRY *dllTexCoord4sv )( const GLshort *v ); -static void ( APIENTRY *dllTexCoordPointer )( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ); -static void ( APIENTRY *dllTexEnvf )( GLenum target, GLenum pname, GLfloat param ); -static void ( APIENTRY *dllTexEnvfv )( GLenum target, GLenum pname, const GLfloat *params ); -static void ( APIENTRY *dllTexEnvi )( GLenum target, GLenum pname, GLint param ); -static void ( APIENTRY *dllTexEnviv )( GLenum target, GLenum pname, const GLint *params ); -static void ( APIENTRY *dllTexGend )( GLenum coord, GLenum pname, GLdouble param ); -static void ( APIENTRY *dllTexGendv )( GLenum coord, GLenum pname, const GLdouble *params ); -static void ( APIENTRY *dllTexGenf )( GLenum coord, GLenum pname, GLfloat param ); -static void ( APIENTRY *dllTexGenfv )( GLenum coord, GLenum pname, const GLfloat *params ); -static void ( APIENTRY *dllTexGeni )( GLenum coord, GLenum pname, GLint param ); -static void ( APIENTRY *dllTexGeniv )( GLenum coord, GLenum pname, const GLint *params ); -static void ( APIENTRY *dllTexImage1D )( GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, - GLenum format, GLenum type, const GLvoid *pixels ); -static void ( APIENTRY *dllTexImage2D )( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, - GLint border, GLenum format, GLenum type, const GLvoid *pixels ); -static void ( APIENTRY *dllTexParameterf )( GLenum target, GLenum pname, GLfloat param ); -static void ( APIENTRY *dllTexParameterfv )( GLenum target, GLenum pname, const GLfloat *params ); -static void ( APIENTRY *dllTexParameteri )( GLenum target, GLenum pname, GLint param ); -static void ( APIENTRY *dllTexParameteriv )( GLenum target, GLenum pname, const GLint *params ); -static void ( APIENTRY *dllTexSubImage1D )( GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, - const GLvoid *pixels ); -static void ( APIENTRY *dllTexSubImage2D )( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, - GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ); -static void ( APIENTRY *dllTranslated )( GLdouble x, GLdouble y, GLdouble z ); -static void ( APIENTRY *dllTranslatef )( GLfloat x, GLfloat y, GLfloat z ); -static void ( APIENTRY *dllVertex2d )( GLdouble x, GLdouble y ); -static void ( APIENTRY *dllVertex2dv )( const GLdouble *v ); -static void ( APIENTRY *dllVertex2f )( GLfloat x, GLfloat y ); -static void ( APIENTRY *dllVertex2fv )( const GLfloat *v ); -static void ( APIENTRY *dllVertex2i )( GLint x, GLint y ); -static void ( APIENTRY *dllVertex2iv )( const GLint *v ); -static void ( APIENTRY *dllVertex2s )( GLshort x, GLshort y ); -static void ( APIENTRY *dllVertex2sv )( const GLshort *v ); -static void ( APIENTRY *dllVertex3d )( GLdouble x, GLdouble y, GLdouble z ); -static void ( APIENTRY *dllVertex3dv )( const GLdouble *v ); -static void ( APIENTRY *dllVertex3f )( GLfloat x, GLfloat y, GLfloat z ); -static void ( APIENTRY *dllVertex3fv )( const GLfloat *v ); -static void ( APIENTRY *dllVertex3i )( GLint x, GLint y, GLint z ); -static void ( APIENTRY *dllVertex3iv )( const GLint *v ); -static void ( APIENTRY *dllVertex3s )( GLshort x, GLshort y, GLshort z ); -static void ( APIENTRY *dllVertex3sv )( const GLshort *v ); -static void ( APIENTRY *dllVertex4d )( GLdouble x, GLdouble y, GLdouble z, GLdouble w ); -static void ( APIENTRY *dllVertex4dv )( const GLdouble *v ); -static void ( APIENTRY *dllVertex4f )( GLfloat x, GLfloat y, GLfloat z, GLfloat w ); -static void ( APIENTRY *dllVertex4fv )( const GLfloat *v ); -static void ( APIENTRY *dllVertex4i )( GLint x, GLint y, GLint z, GLint w ); -static void ( APIENTRY *dllVertex4iv )( const GLint *v ); -static void ( APIENTRY *dllVertex4s )( GLshort x, GLshort y, GLshort z, GLshort w ); -static void ( APIENTRY *dllVertex4sv )( const GLshort *v ); -static void ( APIENTRY *dllVertexPointer )( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ); -static void ( APIENTRY *dllViewport )( GLint x, GLint y, GLsizei width, GLsizei height ); +static void (APIENTRY *dllAccum)(GLenum op, GLfloat value); +static void (APIENTRY *dllAlphaFunc)(GLenum func, GLclampf ref); +GLboolean (APIENTRY *dllAreTexturesResident)(GLsizei n, const GLuint *textures, + GLboolean *residences); +static void (APIENTRY *dllArrayElement)(GLint i); +static void (APIENTRY *dllBegin)(GLenum mode); +static void (APIENTRY *dllBindTexture)(GLenum target, GLuint texture); +static void (APIENTRY *dllBitmap)(GLsizei width, GLsizei height, GLfloat xorig, + GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap); +static void (APIENTRY *dllBlendFunc)(GLenum sfactor, GLenum dfactor); +static void (APIENTRY *dllCallList)(GLuint list); +static void (APIENTRY *dllCallLists)(GLsizei n, GLenum type, + const GLvoid *lists); +static void (APIENTRY *dllClear)(GLbitfield mask); +static void (APIENTRY *dllClearAccum)(GLfloat red, GLfloat green, GLfloat blue, + GLfloat alpha); +static void (APIENTRY *dllClearColor)(GLclampf red, GLclampf green, + GLclampf blue, GLclampf alpha); +static void (APIENTRY *dllClearDepth)(GLclampd depth); +static void (APIENTRY *dllClearIndex)(GLfloat c); +static void (APIENTRY *dllClearStencil)(GLint s); +static void (APIENTRY *dllClipPlane)(GLenum plane, const GLdouble *equation); +static void (APIENTRY *dllColor3b)(GLbyte red, GLbyte green, GLbyte blue); +static void (APIENTRY *dllColor3bv)(const GLbyte *v); +static void (APIENTRY *dllColor3d)(GLdouble red, GLdouble green, GLdouble blue); +static void (APIENTRY *dllColor3dv)(const GLdouble *v); +static void (APIENTRY *dllColor3f)(GLfloat red, GLfloat green, GLfloat blue); +static void (APIENTRY *dllColor3fv)(const GLfloat *v); +static void (APIENTRY *dllColor3i)(GLint red, GLint green, GLint blue); +static void (APIENTRY *dllColor3iv)(const GLint *v); +static void (APIENTRY *dllColor3s)(GLshort red, GLshort green, GLshort blue); +static void (APIENTRY *dllColor3sv)(const GLshort *v); +static void (APIENTRY *dllColor3ub)(GLubyte red, GLubyte green, GLubyte blue); +static void (APIENTRY *dllColor3ubv)(const GLubyte *v); +static void (APIENTRY *dllColor3ui)(GLuint red, GLuint green, GLuint blue); +static void (APIENTRY *dllColor3uiv)(const GLuint *v); +static void (APIENTRY *dllColor3us)(GLushort red, GLushort green, GLushort blue); +static void (APIENTRY *dllColor3usv)(const GLushort *v); +static void (APIENTRY *dllColor4b)(GLbyte red, GLbyte green, GLbyte blue, + GLbyte alpha); +static void (APIENTRY *dllColor4bv)(const GLbyte *v); +static void (APIENTRY *dllColor4d)(GLdouble red, GLdouble green, GLdouble blue, + GLdouble alpha); +static void (APIENTRY *dllColor4dv)(const GLdouble *v); +static void (APIENTRY *dllColor4f)(GLfloat red, GLfloat green, GLfloat blue, + GLfloat alpha); +static void (APIENTRY *dllColor4fv)(const GLfloat *v); +static void (APIENTRY *dllColor4i)(GLint red, GLint green, GLint blue, + GLint alpha); +static void (APIENTRY *dllColor4iv)(const GLint *v); +static void (APIENTRY *dllColor4s)(GLshort red, GLshort green, GLshort blue, + GLshort alpha); +static void (APIENTRY *dllColor4sv)(const GLshort *v); +static void (APIENTRY *dllColor4ub)(GLubyte red, GLubyte green, GLubyte blue, + GLubyte alpha); +static void (APIENTRY *dllColor4ubv)(const GLubyte *v); +static void (APIENTRY *dllColor4ui)(GLuint red, GLuint green, GLuint blue, + GLuint alpha); +static void (APIENTRY *dllColor4uiv)(const GLuint *v); +static void (APIENTRY *dllColor4us)(GLushort red, GLushort green, GLushort blue, + GLushort alpha); +static void (APIENTRY *dllColor4usv)(const GLushort *v); +static void (APIENTRY *dllColorMask)(GLboolean red, GLboolean green, + GLboolean blue, GLboolean alpha); +static void (APIENTRY *dllColorMaterial)(GLenum face, GLenum mode); +static void (APIENTRY *dllColorPointer)(GLint size, GLenum type, GLsizei stride, + const GLvoid *pointer); +static void (APIENTRY *dllCopyPixels)(GLint x, GLint y, GLsizei width, + GLsizei height, GLenum type); +static void (APIENTRY *dllCopyTexImage1D)(GLenum target, GLint level, + GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border); +static void (APIENTRY *dllCopyTexImage2D)(GLenum target, GLint level, + GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, + GLint border); +static void (APIENTRY *dllCopyTexSubImage1D)(GLenum target, GLint level, + GLint xoffset, GLint x, GLint y, GLsizei width); +static void (APIENTRY *dllCopyTexSubImage2D)(GLenum target, GLint level, + GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, + GLsizei height); +static void (APIENTRY *dllCullFace)(GLenum mode); +static void (APIENTRY *dllDeleteLists)(GLuint list, GLsizei range); +static void (APIENTRY *dllDeleteTextures)(GLsizei n, const GLuint *textures); +static void (APIENTRY *dllDepthFunc)(GLenum func); +static void (APIENTRY *dllDepthMask)(GLboolean flag); +static void (APIENTRY *dllDepthRange)(GLclampd zNear, GLclampd zFar); +static void (APIENTRY *dllDisable)(GLenum cap); +static void (APIENTRY *dllDisableClientState)(GLenum array); +static void (APIENTRY *dllDrawArrays)(GLenum mode, GLint first, GLsizei count); +static void (APIENTRY *dllDrawBuffer)(GLenum mode); +static void (APIENTRY *dllDrawElements)(GLenum mode, GLsizei count, GLenum type, + const GLvoid *indices); +static void (APIENTRY *dllDrawPixels)(GLsizei width, GLsizei height, + GLenum format, GLenum type, const GLvoid *pixels); +static void (APIENTRY *dllEdgeFlag)(GLboolean flag); +static void (APIENTRY *dllEdgeFlagPointer)(GLsizei stride, + const GLvoid *pointer); +static void (APIENTRY *dllEdgeFlagv)(const GLboolean *flag); +static void (APIENTRY *dllEnable)(GLenum cap); +static void (APIENTRY *dllEnableClientState)(GLenum array); +static void (APIENTRY *dllEnd)(void); +static void (APIENTRY *dllEndList)(void); +static void (APIENTRY *dllEvalCoord1d)(GLdouble u); +static void (APIENTRY *dllEvalCoord1dv)(const GLdouble *u); +static void (APIENTRY *dllEvalCoord1f)(GLfloat u); +static void (APIENTRY *dllEvalCoord1fv)(const GLfloat *u); +static void (APIENTRY *dllEvalCoord2d)(GLdouble u, GLdouble v); +static void (APIENTRY *dllEvalCoord2dv)(const GLdouble *u); +static void (APIENTRY *dllEvalCoord2f)(GLfloat u, GLfloat v); +static void (APIENTRY *dllEvalCoord2fv)(const GLfloat *u); +static void (APIENTRY *dllEvalMesh1)(GLenum mode, GLint i1, GLint i2); +static void (APIENTRY *dllEvalMesh2)(GLenum mode, GLint i1, GLint i2, GLint j1, + GLint j2); +static void (APIENTRY *dllEvalPoint1)(GLint i); +static void (APIENTRY *dllEvalPoint2)(GLint i, GLint j); +static void (APIENTRY *dllFeedbackBuffer)(GLsizei size, GLenum type, + GLfloat *buffer); +static void (APIENTRY *dllFinish)(void); +static void (APIENTRY *dllFlush)(void); +static void (APIENTRY *dllFogf)(GLenum pname, GLfloat param); +static void (APIENTRY *dllFogfv)(GLenum pname, const GLfloat *params); +static void (APIENTRY *dllFogi)(GLenum pname, GLint param); +static void (APIENTRY *dllFogiv)(GLenum pname, const GLint *params); +static void (APIENTRY *dllFrontFace)(GLenum mode); +static void (APIENTRY *dllFrustum)(GLdouble left, GLdouble right, + GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); +GLuint (APIENTRY *dllGenLists)(GLsizei range); +static void (APIENTRY *dllGenTextures)(GLsizei n, GLuint *textures); +static void (APIENTRY *dllGetBooleanv)(GLenum pname, GLboolean *params); +static void (APIENTRY *dllGetClipPlane)(GLenum plane, GLdouble *equation); +static void (APIENTRY *dllGetDoublev)(GLenum pname, GLdouble *params); +GLenum (APIENTRY *dllGetError)(void); +static void (APIENTRY *dllGetFloatv)(GLenum pname, GLfloat *params); +static void (APIENTRY *dllGetIntegerv)(GLenum pname, GLint *params); +static void (APIENTRY *dllGetLightfv)(GLenum light, GLenum pname, + GLfloat *params); +static void (APIENTRY *dllGetLightiv)(GLenum light, GLenum pname, GLint *params); +static void (APIENTRY *dllGetMapdv)(GLenum target, GLenum query, GLdouble *v); +static void (APIENTRY *dllGetMapfv)(GLenum target, GLenum query, GLfloat *v); +static void (APIENTRY *dllGetMapiv)(GLenum target, GLenum query, GLint *v); +static void (APIENTRY *dllGetMaterialfv)(GLenum face, GLenum pname, + GLfloat *params); +static void (APIENTRY *dllGetMaterialiv)(GLenum face, GLenum pname, + GLint *params); +static void (APIENTRY *dllGetPixelMapfv)(GLenum map, GLfloat *values); +static void (APIENTRY *dllGetPixelMapuiv)(GLenum map, GLuint *values); +static void (APIENTRY *dllGetPixelMapusv)(GLenum map, GLushort *values); +static void (APIENTRY *dllGetPointerv)(GLenum pname, GLvoid **params); +static void (APIENTRY *dllGetPolygonStipple)(GLubyte *mask); +const GLubyte * (APIENTRY * dllGetString)(GLenum name); +static void (APIENTRY *dllGetTexEnvfv)(GLenum target, GLenum pname, + GLfloat *params); +static void (APIENTRY *dllGetTexEnviv)(GLenum target, GLenum pname, + GLint *params); +static void (APIENTRY *dllGetTexGendv)(GLenum coord, GLenum pname, + GLdouble *params); +static void (APIENTRY *dllGetTexGenfv)(GLenum coord, GLenum pname, + GLfloat *params); +static void (APIENTRY *dllGetTexGeniv)(GLenum coord, GLenum pname, + GLint *params); +static void (APIENTRY *dllGetTexImage)(GLenum target, GLint level, + GLenum format, GLenum type, GLvoid *pixels); +static void (APIENTRY *dllGetTexLevelParameterfv)(GLenum target, GLint level, + GLenum pname, GLfloat *params); +static void (APIENTRY *dllGetTexLevelParameteriv)(GLenum target, GLint level, + GLenum pname, GLint *params); +static void (APIENTRY *dllGetTexParameterfv)(GLenum target, GLenum pname, + GLfloat *params); +static void (APIENTRY *dllGetTexParameteriv)(GLenum target, GLenum pname, + GLint *params); +static void (APIENTRY *dllHint)(GLenum target, GLenum mode); +static void (APIENTRY *dllIndexMask)(GLuint mask); +static void (APIENTRY *dllIndexPointer)(GLenum type, GLsizei stride, + const GLvoid *pointer); +static void (APIENTRY *dllIndexd)(GLdouble c); +static void (APIENTRY *dllIndexdv)(const GLdouble *c); +static void (APIENTRY *dllIndexf)(GLfloat c); +static void (APIENTRY *dllIndexfv)(const GLfloat *c); +static void (APIENTRY *dllIndexi)(GLint c); +static void (APIENTRY *dllIndexiv)(const GLint *c); +static void (APIENTRY *dllIndexs)(GLshort c); +static void (APIENTRY *dllIndexsv)(const GLshort *c); +static void (APIENTRY *dllIndexub)(GLubyte c); +static void (APIENTRY *dllIndexubv)(const GLubyte *c); +static void (APIENTRY *dllInitNames)(void); +static void (APIENTRY *dllInterleavedArrays)(GLenum format, GLsizei stride, + const GLvoid *pointer); +GLboolean (APIENTRY *dllIsEnabled)(GLenum cap); +GLboolean (APIENTRY *dllIsList)(GLuint list); +GLboolean (APIENTRY *dllIsTexture)(GLuint texture); +static void (APIENTRY *dllLightModelf)(GLenum pname, GLfloat param); +static void (APIENTRY *dllLightModelfv)(GLenum pname, const GLfloat *params); +static void (APIENTRY *dllLightModeli)(GLenum pname, GLint param); +static void (APIENTRY *dllLightModeliv)(GLenum pname, const GLint *params); +static void (APIENTRY *dllLightf)(GLenum light, GLenum pname, GLfloat param); +static void (APIENTRY *dllLightfv)(GLenum light, GLenum pname, + const GLfloat *params); +static void (APIENTRY *dllLighti)(GLenum light, GLenum pname, GLint param); +static void (APIENTRY *dllLightiv)(GLenum light, GLenum pname, + const GLint *params); +static void (APIENTRY *dllLineStipple)(GLint factor, GLushort pattern); +static void (APIENTRY *dllLineWidth)(GLfloat width); +static void (APIENTRY *dllListBase)(GLuint base); +static void (APIENTRY *dllLoadIdentity)(void); +static void (APIENTRY *dllLoadMatrixd)(const GLdouble *m); +static void (APIENTRY *dllLoadMatrixf)(const GLfloat *m); +static void (APIENTRY *dllLoadName)(GLuint name); +static void (APIENTRY *dllLogicOp)(GLenum opcode); +static void (APIENTRY *dllMap1d)(GLenum target, GLdouble u1, GLdouble u2, + GLint stride, GLint order, const GLdouble *points); +static void (APIENTRY *dllMap1f)(GLenum target, GLfloat u1, GLfloat u2, + GLint stride, GLint order, const GLfloat *points); +static void (APIENTRY *dllMap2d)(GLenum target, GLdouble u1, GLdouble u2, + GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, + GLint vorder, const GLdouble *points); +static void (APIENTRY *dllMap2f)(GLenum target, GLfloat u1, GLfloat u2, + GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, + GLint vorder, const GLfloat *points); +static void (APIENTRY *dllMapGrid1d)(GLint un, GLdouble u1, GLdouble u2); +static void (APIENTRY *dllMapGrid1f)(GLint un, GLfloat u1, GLfloat u2); +static void (APIENTRY *dllMapGrid2d)(GLint un, GLdouble u1, GLdouble u2, + GLint vn, GLdouble v1, GLdouble v2); +static void (APIENTRY *dllMapGrid2f)(GLint un, GLfloat u1, GLfloat u2, GLint vn, + GLfloat v1, GLfloat v2); +static void (APIENTRY *dllMaterialf)(GLenum face, GLenum pname, GLfloat param); +static void (APIENTRY *dllMaterialfv)(GLenum face, GLenum pname, + const GLfloat *params); +static void (APIENTRY *dllMateriali)(GLenum face, GLenum pname, GLint param); +static void (APIENTRY *dllMaterialiv)(GLenum face, GLenum pname, + const GLint *params); +static void (APIENTRY *dllMatrixMode)(GLenum mode); +static void (APIENTRY *dllMultMatrixd)(const GLdouble *m); +static void (APIENTRY *dllMultMatrixf)(const GLfloat *m); +static void (APIENTRY *dllNewList)(GLuint list, GLenum mode); +static void (APIENTRY *dllNormal3b)(GLbyte nx, GLbyte ny, GLbyte nz); +static void (APIENTRY *dllNormal3bv)(const GLbyte *v); +static void (APIENTRY *dllNormal3d)(GLdouble nx, GLdouble ny, GLdouble nz); +static void (APIENTRY *dllNormal3dv)(const GLdouble *v); +static void (APIENTRY *dllNormal3f)(GLfloat nx, GLfloat ny, GLfloat nz); +static void (APIENTRY *dllNormal3fv)(const GLfloat *v); +static void (APIENTRY *dllNormal3i)(GLint nx, GLint ny, GLint nz); +static void (APIENTRY *dllNormal3iv)(const GLint *v); +static void (APIENTRY *dllNormal3s)(GLshort nx, GLshort ny, GLshort nz); +static void (APIENTRY *dllNormal3sv)(const GLshort *v); +static void (APIENTRY *dllNormalPointer)(GLenum type, GLsizei stride, + const GLvoid *pointer); +static void (APIENTRY *dllOrtho)(GLdouble left, GLdouble right, GLdouble bottom, + GLdouble top, GLdouble zNear, GLdouble zFar); +static void (APIENTRY *dllPassThrough)(GLfloat token); +static void (APIENTRY *dllPixelMapfv)(GLenum map, GLsizei mapsize, + const GLfloat *values); +static void (APIENTRY *dllPixelMapuiv)(GLenum map, GLsizei mapsize, + const GLuint *values); +static void (APIENTRY *dllPixelMapusv)(GLenum map, GLsizei mapsize, + const GLushort *values); +static void (APIENTRY *dllPixelStoref)(GLenum pname, GLfloat param); +static void (APIENTRY *dllPixelStorei)(GLenum pname, GLint param); +static void (APIENTRY *dllPixelTransferf)(GLenum pname, GLfloat param); +static void (APIENTRY *dllPixelTransferi)(GLenum pname, GLint param); +static void (APIENTRY *dllPixelZoom)(GLfloat xfactor, GLfloat yfactor); +static void (APIENTRY *dllPointSize)(GLfloat size); +static void (APIENTRY *dllPolygonMode)(GLenum face, GLenum mode); +static void (APIENTRY *dllPolygonOffset)(GLfloat factor, GLfloat units); +static void (APIENTRY *dllPolygonStipple)(const GLubyte *mask); +static void (APIENTRY *dllPopAttrib)(void); +static void (APIENTRY *dllPopClientAttrib)(void); +static void (APIENTRY *dllPopMatrix)(void); +static void (APIENTRY *dllPopName)(void); +static void (APIENTRY *dllPrioritizeTextures)(GLsizei n, const GLuint *textures, + const GLclampf *priorities); +static void (APIENTRY *dllPushAttrib)(GLbitfield mask); +static void (APIENTRY *dllPushClientAttrib)(GLbitfield mask); +static void (APIENTRY *dllPushMatrix)(void); +static void (APIENTRY *dllPushName)(GLuint name); +static void (APIENTRY *dllRasterPos2d)(GLdouble x, GLdouble y); +static void (APIENTRY *dllRasterPos2dv)(const GLdouble *v); +static void (APIENTRY *dllRasterPos2f)(GLfloat x, GLfloat y); +static void (APIENTRY *dllRasterPos2fv)(const GLfloat *v); +static void (APIENTRY *dllRasterPos2i)(GLint x, GLint y); +static void (APIENTRY *dllRasterPos2iv)(const GLint *v); +static void (APIENTRY *dllRasterPos2s)(GLshort x, GLshort y); +static void (APIENTRY *dllRasterPos2sv)(const GLshort *v); +static void (APIENTRY *dllRasterPos3d)(GLdouble x, GLdouble y, GLdouble z); +static void (APIENTRY *dllRasterPos3dv)(const GLdouble *v); +static void (APIENTRY *dllRasterPos3f)(GLfloat x, GLfloat y, GLfloat z); +static void (APIENTRY *dllRasterPos3fv)(const GLfloat *v); +static void (APIENTRY *dllRasterPos3i)(GLint x, GLint y, GLint z); +static void (APIENTRY *dllRasterPos3iv)(const GLint *v); +static void (APIENTRY *dllRasterPos3s)(GLshort x, GLshort y, GLshort z); +static void (APIENTRY *dllRasterPos3sv)(const GLshort *v); +static void (APIENTRY *dllRasterPos4d)(GLdouble x, GLdouble y, GLdouble z, + GLdouble w); +static void (APIENTRY *dllRasterPos4dv)(const GLdouble *v); +static void (APIENTRY *dllRasterPos4f)(GLfloat x, GLfloat y, GLfloat z, + GLfloat w); +static void (APIENTRY *dllRasterPos4fv)(const GLfloat *v); +static void (APIENTRY *dllRasterPos4i)(GLint x, GLint y, GLint z, GLint w); +static void (APIENTRY *dllRasterPos4iv)(const GLint *v); +static void (APIENTRY *dllRasterPos4s)(GLshort x, GLshort y, GLshort z, + GLshort w); +static void (APIENTRY *dllRasterPos4sv)(const GLshort *v); +static void (APIENTRY *dllReadBuffer)(GLenum mode); +static void (APIENTRY *dllReadPixels)(GLint x, GLint y, GLsizei width, + GLsizei height, GLenum format, GLenum type, GLvoid *pixels); +static void (APIENTRY *dllRectd)(GLdouble x1, GLdouble y1, GLdouble x2, + GLdouble y2); +static void (APIENTRY *dllRectdv)(const GLdouble *v1, const GLdouble *v2); +static void (APIENTRY *dllRectf)(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2); +static void (APIENTRY *dllRectfv)(const GLfloat *v1, const GLfloat *v2); +static void (APIENTRY *dllRecti)(GLint x1, GLint y1, GLint x2, GLint y2); +static void (APIENTRY *dllRectiv)(const GLint *v1, const GLint *v2); +static void (APIENTRY *dllRects)(GLshort x1, GLshort y1, GLshort x2, GLshort y2); +static void (APIENTRY *dllRectsv)(const GLshort *v1, const GLshort *v2); +GLint (APIENTRY *dllRenderMode)(GLenum mode); +static void (APIENTRY *dllRotated)(GLdouble angle, GLdouble x, GLdouble y, + GLdouble z); +static void (APIENTRY *dllRotatef)(GLfloat angle, GLfloat x, GLfloat y, + GLfloat z); +static void (APIENTRY *dllScaled)(GLdouble x, GLdouble y, GLdouble z); +static void (APIENTRY *dllScalef)(GLfloat x, GLfloat y, GLfloat z); +static void (APIENTRY *dllScissor)(GLint x, GLint y, GLsizei width, + GLsizei height); +static void (APIENTRY *dllSelectBuffer)(GLsizei size, GLuint *buffer); +static void (APIENTRY *dllShadeModel)(GLenum mode); +static void (APIENTRY *dllStencilFunc)(GLenum func, GLint ref, GLuint mask); +static void (APIENTRY *dllStencilMask)(GLuint mask); +static void (APIENTRY *dllStencilOp)(GLenum fail, GLenum zfail, GLenum zpass); +static void (APIENTRY *dllTexCoord1d)(GLdouble s); +static void (APIENTRY *dllTexCoord1dv)(const GLdouble *v); +static void (APIENTRY *dllTexCoord1f)(GLfloat s); +static void (APIENTRY *dllTexCoord1fv)(const GLfloat *v); +static void (APIENTRY *dllTexCoord1i)(GLint s); +static void (APIENTRY *dllTexCoord1iv)(const GLint *v); +static void (APIENTRY *dllTexCoord1s)(GLshort s); +static void (APIENTRY *dllTexCoord1sv)(const GLshort *v); +static void (APIENTRY *dllTexCoord2d)(GLdouble s, GLdouble t); +static void (APIENTRY *dllTexCoord2dv)(const GLdouble *v); +static void (APIENTRY *dllTexCoord2f)(GLfloat s, GLfloat t); +static void (APIENTRY *dllTexCoord2fv)(const GLfloat *v); +static void (APIENTRY *dllTexCoord2i)(GLint s, GLint t); +static void (APIENTRY *dllTexCoord2iv)(const GLint *v); +static void (APIENTRY *dllTexCoord2s)(GLshort s, GLshort t); +static void (APIENTRY *dllTexCoord2sv)(const GLshort *v); +static void (APIENTRY *dllTexCoord3d)(GLdouble s, GLdouble t, GLdouble r); +static void (APIENTRY *dllTexCoord3dv)(const GLdouble *v); +static void (APIENTRY *dllTexCoord3f)(GLfloat s, GLfloat t, GLfloat r); +static void (APIENTRY *dllTexCoord3fv)(const GLfloat *v); +static void (APIENTRY *dllTexCoord3i)(GLint s, GLint t, GLint r); +static void (APIENTRY *dllTexCoord3iv)(const GLint *v); +static void (APIENTRY *dllTexCoord3s)(GLshort s, GLshort t, GLshort r); +static void (APIENTRY *dllTexCoord3sv)(const GLshort *v); +static void (APIENTRY *dllTexCoord4d)(GLdouble s, GLdouble t, GLdouble r, + GLdouble q); +static void (APIENTRY *dllTexCoord4dv)(const GLdouble *v); +static void (APIENTRY *dllTexCoord4f)(GLfloat s, GLfloat t, GLfloat r, + GLfloat q); +static void (APIENTRY *dllTexCoord4fv)(const GLfloat *v); +static void (APIENTRY *dllTexCoord4i)(GLint s, GLint t, GLint r, GLint q); +static void (APIENTRY *dllTexCoord4iv)(const GLint *v); +static void (APIENTRY *dllTexCoord4s)(GLshort s, GLshort t, GLshort r, + GLshort q); +static void (APIENTRY *dllTexCoord4sv)(const GLshort *v); +static void (APIENTRY *dllTexCoordPointer)(GLint size, GLenum type, + GLsizei stride, const GLvoid *pointer); +static void (APIENTRY *dllTexEnvf)(GLenum target, GLenum pname, GLfloat param); +static void (APIENTRY *dllTexEnvfv)(GLenum target, GLenum pname, + const GLfloat *params); +static void (APIENTRY *dllTexEnvi)(GLenum target, GLenum pname, GLint param); +static void (APIENTRY *dllTexEnviv)(GLenum target, GLenum pname, + const GLint *params); +static void (APIENTRY *dllTexGend)(GLenum coord, GLenum pname, GLdouble param); +static void (APIENTRY *dllTexGendv)(GLenum coord, GLenum pname, + const GLdouble *params); +static void (APIENTRY *dllTexGenf)(GLenum coord, GLenum pname, GLfloat param); +static void (APIENTRY *dllTexGenfv)(GLenum coord, GLenum pname, + const GLfloat *params); +static void (APIENTRY *dllTexGeni)(GLenum coord, GLenum pname, GLint param); +static void (APIENTRY *dllTexGeniv)(GLenum coord, GLenum pname, + const GLint *params); +static void (APIENTRY *dllTexImage1D)(GLenum target, GLint level, + GLint internalformat, GLsizei width, GLint border, GLenum format, + GLenum type, const GLvoid *pixels); +static void (APIENTRY *dllTexImage2D)(GLenum target, GLint level, + GLint internalformat, GLsizei width, GLsizei height, GLint border, + GLenum format, GLenum type, const GLvoid *pixels); +static void (APIENTRY *dllTexParameterf)(GLenum target, GLenum pname, + GLfloat param); +static void (APIENTRY *dllTexParameterfv)(GLenum target, GLenum pname, + const GLfloat *params); +static void (APIENTRY *dllTexParameteri)(GLenum target, GLenum pname, + GLint param); +static void (APIENTRY *dllTexParameteriv)(GLenum target, GLenum pname, + const GLint *params); +static void (APIENTRY *dllTexSubImage1D)(GLenum target, GLint level, + GLint xoffset, GLsizei width, GLenum format, GLenum type, + const GLvoid *pixels); +static void (APIENTRY *dllTexSubImage2D)(GLenum target, GLint level, + GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, + GLenum format, GLenum type, const GLvoid *pixels); +static void (APIENTRY *dllTranslated)(GLdouble x, GLdouble y, GLdouble z); +static void (APIENTRY *dllTranslatef)(GLfloat x, GLfloat y, GLfloat z); +static void (APIENTRY *dllVertex2d)(GLdouble x, GLdouble y); +static void (APIENTRY *dllVertex2dv)(const GLdouble *v); +static void (APIENTRY *dllVertex2f)(GLfloat x, GLfloat y); +static void (APIENTRY *dllVertex2fv)(const GLfloat *v); +static void (APIENTRY *dllVertex2i)(GLint x, GLint y); +static void (APIENTRY *dllVertex2iv)(const GLint *v); +static void (APIENTRY *dllVertex2s)(GLshort x, GLshort y); +static void (APIENTRY *dllVertex2sv)(const GLshort *v); +static void (APIENTRY *dllVertex3d)(GLdouble x, GLdouble y, GLdouble z); +static void (APIENTRY *dllVertex3dv)(const GLdouble *v); +static void (APIENTRY *dllVertex3f)(GLfloat x, GLfloat y, GLfloat z); +static void (APIENTRY *dllVertex3fv)(const GLfloat *v); +static void (APIENTRY *dllVertex3i)(GLint x, GLint y, GLint z); +static void (APIENTRY *dllVertex3iv)(const GLint *v); +static void (APIENTRY *dllVertex3s)(GLshort x, GLshort y, GLshort z); +static void (APIENTRY *dllVertex3sv)(const GLshort *v); +static void (APIENTRY *dllVertex4d)(GLdouble x, GLdouble y, GLdouble z, + GLdouble w); +static void (APIENTRY *dllVertex4dv)(const GLdouble *v); +static void (APIENTRY *dllVertex4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); +static void (APIENTRY *dllVertex4fv)(const GLfloat *v); +static void (APIENTRY *dllVertex4i)(GLint x, GLint y, GLint z, GLint w); +static void (APIENTRY *dllVertex4iv)(const GLint *v); +static void (APIENTRY *dllVertex4s)(GLshort x, GLshort y, GLshort z, GLshort w); +static void (APIENTRY *dllVertex4sv)(const GLshort *v); +static void (APIENTRY *dllVertexPointer)(GLint size, GLenum type, + GLsizei stride, const GLvoid *pointer); +static void (APIENTRY *dllViewport)(GLint x, GLint y, GLsizei width, + GLsizei height); static void APIENTRY -logAccum ( GLenum op, GLfloat value ) +logAccum(GLenum op, GLfloat value) { - fprintf( glw_state.log_fp, "glAccum\n" ); - dllAccum( op, value ); + fprintf(glw_state.log_fp, "glAccum\n"); + dllAccum(op, value); } static void APIENTRY -logAlphaFunc ( GLenum func, GLclampf ref ) +logAlphaFunc(GLenum func, GLclampf ref) { - fprintf( glw_state.log_fp, "glAlphaFunc( 0x%x, %f )\n", func, ref ); - dllAlphaFunc( func, ref ); + fprintf(glw_state.log_fp, "glAlphaFunc( 0x%x, %f )\n", func, ref); + dllAlphaFunc(func, ref); } static GLboolean APIENTRY -logAreTexturesResident ( GLsizei n, const GLuint *textures, GLboolean *residences ) +logAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences) { - fprintf( glw_state.log_fp, "glAreTexturesResident\n" ); - return ( dllAreTexturesResident( n, textures, residences ) ); + fprintf(glw_state.log_fp, "glAreTexturesResident\n"); + return dllAreTexturesResident(n, textures, residences); } static void APIENTRY -logArrayElement ( GLint i ) +logArrayElement(GLint i) { - fprintf( glw_state.log_fp, "glArrayElement\n" ); - dllArrayElement( i ); + fprintf(glw_state.log_fp, "glArrayElement\n"); + dllArrayElement(i); } static void APIENTRY -logBegin ( GLenum mode ) +logBegin(GLenum mode) { - fprintf( glw_state.log_fp, "glBegin( 0x%x )\n", mode ); - dllBegin( mode ); + fprintf(glw_state.log_fp, "glBegin( 0x%x )\n", mode); + dllBegin(mode); } static void APIENTRY -logBindTexture ( GLenum target, GLuint texture ) +logBindTexture(GLenum target, GLuint texture) { - fprintf( glw_state.log_fp, "glBindTexture( 0x%x, %u )\n", target, texture ); - dllBindTexture( target, texture ); + fprintf(glw_state.log_fp, "glBindTexture( 0x%x, %u )\n", target, texture); + dllBindTexture(target, texture); } static void APIENTRY -logBitmap ( GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap ) +logBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, + GLfloat xmove, GLfloat ymove, const GLubyte *bitmap) { - fprintf( glw_state.log_fp, "glBitmap\n" ); - dllBitmap( width, height, xorig, yorig, xmove, ymove, bitmap ); + fprintf(glw_state.log_fp, "glBitmap\n"); + dllBitmap(width, height, xorig, yorig, xmove, ymove, bitmap); } static void APIENTRY -logBlendFunc ( GLenum sfactor, GLenum dfactor ) +logBlendFunc(GLenum sfactor, GLenum dfactor) { - fprintf( glw_state.log_fp, "glBlendFunc( 0x%x, 0x%x )\n", sfactor, dfactor ); - dllBlendFunc( sfactor, dfactor ); + fprintf(glw_state.log_fp, "glBlendFunc( 0x%x, 0x%x )\n", sfactor, dfactor); + dllBlendFunc(sfactor, dfactor); } static void APIENTRY -logCallList ( GLuint list ) +logCallList(GLuint list) { - fprintf( glw_state.log_fp, "glCallList( %u )\n", list ); - dllCallList( list ); + fprintf(glw_state.log_fp, "glCallList( %u )\n", list); + dllCallList(list); } static void APIENTRY -logCallLists ( GLsizei n, GLenum type, const void *lists ) +logCallLists(GLsizei n, GLenum type, const void *lists) { - fprintf( glw_state.log_fp, "glCallLists\n" ); - dllCallLists( n, type, lists ); + fprintf(glw_state.log_fp, "glCallLists\n"); + dllCallLists(n, type, lists); } static void APIENTRY -logClear ( GLbitfield mask ) +logClear(GLbitfield mask) { - fprintf( glw_state.log_fp, "glClear\n" ); - dllClear( mask ); + fprintf(glw_state.log_fp, "glClear\n"); + dllClear(mask); } static void APIENTRY -logClearAccum ( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) +logClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) { - fprintf( glw_state.log_fp, "glClearAccum\n" ); - dllClearAccum( red, green, blue, alpha ); + fprintf(glw_state.log_fp, "glClearAccum\n"); + dllClearAccum(red, green, blue, alpha); } static void APIENTRY -logClearColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) +logClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { - fprintf( glw_state.log_fp, "glClearColor\n" ); - dllClearColor( red, green, blue, alpha ); + fprintf(glw_state.log_fp, "glClearColor\n"); + dllClearColor(red, green, blue, alpha); } static void APIENTRY -logClearDepth ( GLclampd depth ) +logClearDepth(GLclampd depth) { - fprintf( glw_state.log_fp, "glClearDepth\n" ); - dllClearDepth( depth ); + fprintf(glw_state.log_fp, "glClearDepth\n"); + dllClearDepth(depth); } static void APIENTRY -logClearIndex ( GLfloat c ) +logClearIndex(GLfloat c) { - fprintf( glw_state.log_fp, "glClearIndex\n" ); - dllClearIndex( c ); + fprintf(glw_state.log_fp, "glClearIndex\n"); + dllClearIndex(c); } static void APIENTRY -logClearStencil ( GLint s ) +logClearStencil(GLint s) { - fprintf( glw_state.log_fp, "glClearStencil\n" ); - dllClearStencil( s ); + fprintf(glw_state.log_fp, "glClearStencil\n"); + dllClearStencil(s); } static void APIENTRY -logClipPlane ( GLenum plane, const GLdouble *equation ) +logClipPlane(GLenum plane, const GLdouble *equation) { - fprintf( glw_state.log_fp, "glClipPlane\n" ); - dllClipPlane( plane, equation ); + fprintf(glw_state.log_fp, "glClipPlane\n"); + dllClipPlane(plane, equation); } static void APIENTRY -logColor3b ( GLbyte red, GLbyte green, GLbyte blue ) +logColor3b(GLbyte red, GLbyte green, GLbyte blue) { - fprintf( glw_state.log_fp, "glColor3b\n" ); - dllColor3b( red, green, blue ); + fprintf(glw_state.log_fp, "glColor3b\n"); + dllColor3b(red, green, blue); } static void APIENTRY -logColor3bv ( const GLbyte *v ) +logColor3bv(const GLbyte *v) { - fprintf( glw_state.log_fp, "glColor3bv\n" ); - dllColor3bv( v ); + fprintf(glw_state.log_fp, "glColor3bv\n"); + dllColor3bv(v); } static void APIENTRY -logColor3d ( GLdouble red, GLdouble green, GLdouble blue ) +logColor3d(GLdouble red, GLdouble green, GLdouble blue) { - fprintf( glw_state.log_fp, "glColor3d\n" ); - dllColor3d( red, green, blue ); + fprintf(glw_state.log_fp, "glColor3d\n"); + dllColor3d(red, green, blue); } static void APIENTRY -logColor3dv ( const GLdouble *v ) +logColor3dv(const GLdouble *v) { - fprintf( glw_state.log_fp, "glColor3dv\n" ); - dllColor3dv( v ); + fprintf(glw_state.log_fp, "glColor3dv\n"); + dllColor3dv(v); } static void APIENTRY -logColor3f ( GLfloat red, GLfloat green, GLfloat blue ) +logColor3f(GLfloat red, GLfloat green, GLfloat blue) { - fprintf( glw_state.log_fp, "glColor3f\n" ); - dllColor3f( red, green, blue ); + fprintf(glw_state.log_fp, "glColor3f\n"); + dllColor3f(red, green, blue); } static void APIENTRY -logColor3fv ( const GLfloat *v ) +logColor3fv(const GLfloat *v) { - fprintf( glw_state.log_fp, "glColor3fv\n" ); - dllColor3fv( v ); + fprintf(glw_state.log_fp, "glColor3fv\n"); + dllColor3fv(v); } static void APIENTRY -logColor3i ( GLint red, GLint green, GLint blue ) +logColor3i(GLint red, GLint green, GLint blue) { - fprintf( glw_state.log_fp, "glColor3i\n" ); - dllColor3i( red, green, blue ); + fprintf(glw_state.log_fp, "glColor3i\n"); + dllColor3i(red, green, blue); } static void APIENTRY -logColor3iv ( const GLint *v ) +logColor3iv(const GLint *v) { - fprintf( glw_state.log_fp, "glColor3iv\n" ); - dllColor3iv( v ); + fprintf(glw_state.log_fp, "glColor3iv\n"); + dllColor3iv(v); } static void APIENTRY -logColor3s ( GLshort red, GLshort green, GLshort blue ) +logColor3s(GLshort red, GLshort green, GLshort blue) { - fprintf( glw_state.log_fp, "glColor3s\n" ); - dllColor3s( red, green, blue ); + fprintf(glw_state.log_fp, "glColor3s\n"); + dllColor3s(red, green, blue); } static void APIENTRY -logColor3sv ( const GLshort *v ) +logColor3sv(const GLshort *v) { - fprintf( glw_state.log_fp, "glColor3sv\n" ); - dllColor3sv( v ); + fprintf(glw_state.log_fp, "glColor3sv\n"); + dllColor3sv(v); } static void APIENTRY -logColor3ub ( GLubyte red, GLubyte green, GLubyte blue ) +logColor3ub(GLubyte red, GLubyte green, GLubyte blue) { - fprintf( glw_state.log_fp, "glColor3ub\n" ); - dllColor3ub( red, green, blue ); + fprintf(glw_state.log_fp, "glColor3ub\n"); + dllColor3ub(red, green, blue); } static void APIENTRY -logColor3ubv ( const GLubyte *v ) +logColor3ubv(const GLubyte *v) { - fprintf( glw_state.log_fp, "glColor3ubv\n" ); - dllColor3ubv( v ); + fprintf(glw_state.log_fp, "glColor3ubv\n"); + dllColor3ubv(v); } -#define SIG( x ) fprintf( glw_state.log_fp, x "\n" ) +#define SIG(x) fprintf(glw_state.log_fp, x "\n") static void APIENTRY -logColor3ui ( GLuint red, GLuint green, GLuint blue ) +logColor3ui(GLuint red, GLuint green, GLuint blue) { - SIG( "glColor3ui" ); - dllColor3ui( red, green, blue ); + SIG("glColor3ui"); + dllColor3ui(red, green, blue); } static void APIENTRY -logColor3uiv ( const GLuint *v ) +logColor3uiv(const GLuint *v) { - SIG( "glColor3uiv" ); - dllColor3uiv( v ); + SIG("glColor3uiv"); + dllColor3uiv(v); } static void APIENTRY -logColor3us ( GLushort red, GLushort green, GLushort blue ) +logColor3us(GLushort red, GLushort green, GLushort blue) { - SIG( "glColor3us" ); - dllColor3us( red, green, blue ); + SIG("glColor3us"); + dllColor3us(red, green, blue); } static void APIENTRY -logColor3usv ( const GLushort *v ) +logColor3usv(const GLushort *v) { - SIG( "glColor3usv" ); - dllColor3usv( v ); + SIG("glColor3usv"); + dllColor3usv(v); } static void APIENTRY -logColor4b ( GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha ) +logColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha) { - SIG( "glColor4b" ); - dllColor4b( red, green, blue, alpha ); + SIG("glColor4b"); + dllColor4b(red, green, blue, alpha); } static void APIENTRY -logColor4bv ( const GLbyte *v ) +logColor4bv(const GLbyte *v) { - SIG( "glColor4bv" ); - dllColor4bv( v ); + SIG("glColor4bv"); + dllColor4bv(v); } static void APIENTRY -logColor4d ( GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha ) +logColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha) { - SIG( "glColor4d" ); - dllColor4d( red, green, blue, alpha ); + SIG("glColor4d"); + dllColor4d(red, green, blue, alpha); } static void APIENTRY -logColor4dv ( const GLdouble *v ) +logColor4dv(const GLdouble *v) { - SIG( "glColor4dv" ); - dllColor4dv( v ); + SIG("glColor4dv"); + dllColor4dv(v); } static void APIENTRY -logColor4f ( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) +logColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) { - fprintf( glw_state.log_fp, "glColor4f( %f,%f,%f,%f )\n", red, green, blue, alpha ); - dllColor4f( red, green, blue, alpha ); + fprintf(glw_state.log_fp, "glColor4f( %f,%f,%f,%f )\n", + red, green, blue, alpha); + dllColor4f(red, green, blue, alpha); } static void APIENTRY -logColor4fv ( const GLfloat *v ) +logColor4fv(const GLfloat *v) { - fprintf( glw_state.log_fp, "glColor4fv( %f,%f,%f,%f )\n", v [ 0 ], v [ 1 ], v [ 2 ], v [ 3 ] ); - dllColor4fv( v ); + fprintf(glw_state.log_fp, "glColor4fv( %f,%f,%f,%f )\n", + v[0], v[1], v[2], v[3]); + dllColor4fv(v); } static void APIENTRY -logColor4i ( GLint red, GLint green, GLint blue, GLint alpha ) +logColor4i(GLint red, GLint green, GLint blue, GLint alpha) { - SIG( "glColor4i" ); - dllColor4i( red, green, blue, alpha ); + SIG("glColor4i"); + dllColor4i(red, green, blue, alpha); } static void APIENTRY -logColor4iv ( const GLint *v ) +logColor4iv(const GLint *v) { - SIG( "glColor4iv" ); - dllColor4iv( v ); + SIG("glColor4iv"); + dllColor4iv(v); } static void APIENTRY -logColor4s ( GLshort red, GLshort green, GLshort blue, GLshort alpha ) +logColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha) { - SIG( "glColor4s" ); - dllColor4s( red, green, blue, alpha ); + SIG("glColor4s"); + dllColor4s(red, green, blue, alpha); } static void APIENTRY -logColor4sv ( const GLshort *v ) +logColor4sv(const GLshort *v) { - SIG( "glColor4sv" ); - dllColor4sv( v ); + SIG("glColor4sv"); + dllColor4sv(v); } static void APIENTRY -logColor4ub ( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ) +logColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) { - SIG( "glColor4b" ); - dllColor4b( red, green, blue, alpha ); + SIG("glColor4b"); + dllColor4b(red, green, blue, alpha); } static void APIENTRY -logColor4ubv ( const GLubyte *v ) +logColor4ubv(const GLubyte *v) { - SIG( "glColor4ubv" ); - dllColor4ubv( v ); + SIG("glColor4ubv"); + dllColor4ubv(v); } static void APIENTRY -logColor4ui ( GLuint red, GLuint green, GLuint blue, GLuint alpha ) +logColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha) { - SIG( "glColor4ui" ); - dllColor4ui( red, green, blue, alpha ); + SIG("glColor4ui"); + dllColor4ui(red, green, blue, alpha); } static void APIENTRY -logColor4uiv ( const GLuint *v ) +logColor4uiv(const GLuint *v) { - SIG( "glColor4uiv" ); - dllColor4uiv( v ); + SIG("glColor4uiv"); + dllColor4uiv(v); } static void APIENTRY -logColor4us ( GLushort red, GLushort green, GLushort blue, GLushort alpha ) +logColor4us(GLushort red, GLushort green, GLushort blue, GLushort alpha) { - SIG( "glColor4us" ); - dllColor4us( red, green, blue, alpha ); + SIG("glColor4us"); + dllColor4us(red, green, blue, alpha); } static void APIENTRY -logColor4usv ( const GLushort *v ) +logColor4usv(const GLushort *v) { - SIG( "glColor4usv" ); - dllColor4usv( v ); + SIG("glColor4usv"); + dllColor4usv(v); } static void APIENTRY -logColorMask ( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ) +logColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) { - SIG( "glColorMask" ); - dllColorMask( red, green, blue, alpha ); + SIG("glColorMask"); + dllColorMask(red, green, blue, alpha); } static void APIENTRY -logColorMaterial ( GLenum face, GLenum mode ) +logColorMaterial(GLenum face, GLenum mode) { - SIG( "glColorMaterial" ); - dllColorMaterial( face, mode ); + SIG("glColorMaterial"); + dllColorMaterial(face, mode); } static void APIENTRY -logColorPointer ( GLint size, GLenum type, GLsizei stride, const void *pointer ) +logColorPointer(GLint size, GLenum type, GLsizei stride, const void *pointer) { - SIG( "glColorPointer" ); - dllColorPointer( size, type, stride, pointer ); + SIG("glColorPointer"); + dllColorPointer(size, type, stride, pointer); } static void APIENTRY -logCopyPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum type ) +logCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type) { - SIG( "glCopyPixels" ); - dllCopyPixels( x, y, width, height, type ); + SIG("glCopyPixels"); + dllCopyPixels(x, y, width, height, type); } static void APIENTRY -logCopyTexImage1D ( GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border ) +logCopyTexImage1D(GLenum target, GLint level, GLenum internalFormat, + GLint x, GLint y, GLsizei width, GLint border) { - SIG( "glCopyTexImage1D" ); - dllCopyTexImage1D( target, level, internalFormat, x, y, width, border ); + SIG("glCopyTexImage1D"); + dllCopyTexImage1D(target, level, internalFormat, x, y, width, border); } static void APIENTRY -logCopyTexImage2D ( GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, - GLint border ) +logCopyTexImage2D(GLenum target, GLint level, GLenum internalFormat, + GLint x, GLint y, GLsizei width, GLsizei height, GLint border) { - SIG( "glCopyTexImage2D" ); - dllCopyTexImage2D( target, level, internalFormat, x, y, width, height, border ); + SIG("glCopyTexImage2D"); + dllCopyTexImage2D(target, level, internalFormat, x, + y, width, height, border); } static void APIENTRY -logCopyTexSubImage1D ( GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width ) +logCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, + GLint x, GLint y, GLsizei width) { - SIG( "glCopyTexSubImage1D" ); - dllCopyTexSubImage1D( target, level, xoffset, x, y, width ); + SIG("glCopyTexSubImage1D"); + dllCopyTexSubImage1D(target, level, xoffset, x, y, width); } static void APIENTRY -logCopyTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ) +logCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, + GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) { - SIG( "glCopyTexSubImage2D" ); - dllCopyTexSubImage2D( target, level, xoffset, yoffset, x, y, width, height ); + SIG("glCopyTexSubImage2D"); + dllCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); } static void APIENTRY -logCullFace ( GLenum mode ) +logCullFace(GLenum mode) { - SIG( "glCullFace" ); - dllCullFace( mode ); + SIG("glCullFace"); + dllCullFace(mode); } static void APIENTRY -logDeleteLists ( GLuint list, GLsizei range ) +logDeleteLists(GLuint list, GLsizei range) { - SIG( "glDeleteLists" ); - dllDeleteLists( list, range ); + SIG("glDeleteLists"); + dllDeleteLists(list, range); } static void APIENTRY -logDeleteTextures ( GLsizei n, const GLuint *textures ) +logDeleteTextures(GLsizei n, const GLuint *textures) { - SIG( "glDeleteTextures" ); - dllDeleteTextures( n, textures ); + SIG("glDeleteTextures"); + dllDeleteTextures(n, textures); } static void APIENTRY -logDepthFunc ( GLenum func ) +logDepthFunc(GLenum func) { - SIG( "glDepthFunc" ); - dllDepthFunc( func ); + SIG("glDepthFunc"); + dllDepthFunc(func); } static void APIENTRY -logDepthMask ( GLboolean flag ) +logDepthMask(GLboolean flag) { - SIG( "glDepthMask" ); - dllDepthMask( flag ); + SIG("glDepthMask"); + dllDepthMask(flag); } static void APIENTRY -logDepthRange ( GLclampd zNear, GLclampd zFar ) +logDepthRange(GLclampd zNear, GLclampd zFar) { - SIG( "glDepthRange" ); - dllDepthRange( zNear, zFar ); + SIG("glDepthRange"); + dllDepthRange(zNear, zFar); } static void APIENTRY -logDisable ( GLenum cap ) +logDisable(GLenum cap) { - fprintf( glw_state.log_fp, "glDisable( 0x%x )\n", cap ); - dllDisable( cap ); + fprintf(glw_state.log_fp, "glDisable( 0x%x )\n", cap); + dllDisable(cap); } static void APIENTRY -logDisableClientState ( GLenum array ) +logDisableClientState(GLenum array) { - SIG( "glDisableClientState" ); - dllDisableClientState( array ); + SIG("glDisableClientState"); + dllDisableClientState(array); } static void APIENTRY -logDrawArrays ( GLenum mode, GLint first, GLsizei count ) +logDrawArrays(GLenum mode, GLint first, GLsizei count) { - SIG( "glDrawArrays" ); - dllDrawArrays( mode, first, count ); + SIG("glDrawArrays"); + dllDrawArrays(mode, first, count); } static void APIENTRY -logDrawBuffer ( GLenum mode ) +logDrawBuffer(GLenum mode) { - SIG( "glDrawBuffer" ); - dllDrawBuffer( mode ); + SIG("glDrawBuffer"); + dllDrawBuffer(mode); } static void APIENTRY -logDrawElements ( GLenum mode, GLsizei count, GLenum type, const void *indices ) +logDrawElements(GLenum mode, GLsizei count, GLenum type, const void *indices) { - SIG( "glDrawElements" ); - dllDrawElements( mode, count, type, indices ); + SIG("glDrawElements"); + dllDrawElements(mode, count, type, indices); } static void APIENTRY -logDrawPixels ( GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels ) +logDrawPixels(GLsizei width, GLsizei height, GLenum format, + GLenum type, const void *pixels) { - SIG( "glDrawPixels" ); - dllDrawPixels( width, height, format, type, pixels ); + SIG("glDrawPixels"); + dllDrawPixels(width, height, format, type, pixels); } static void APIENTRY -logEdgeFlag ( GLboolean flag ) +logEdgeFlag(GLboolean flag) { - SIG( "glEdgeFlag" ); - dllEdgeFlag( flag ); + SIG("glEdgeFlag"); + dllEdgeFlag(flag); } static void APIENTRY -logEdgeFlagPointer ( GLsizei stride, const void *pointer ) +logEdgeFlagPointer(GLsizei stride, const void *pointer) { - SIG( "glEdgeFlagPointer" ); - dllEdgeFlagPointer( stride, pointer ); + SIG("glEdgeFlagPointer"); + dllEdgeFlagPointer(stride, pointer); } static void APIENTRY -logEdgeFlagv ( const GLboolean *flag ) +logEdgeFlagv(const GLboolean *flag) { - SIG( "glEdgeFlagv" ); - dllEdgeFlagv( flag ); + SIG("glEdgeFlagv"); + dllEdgeFlagv(flag); } static void APIENTRY -logEnable ( GLenum cap ) +logEnable(GLenum cap) { - fprintf( glw_state.log_fp, "glEnable( 0x%x )\n", cap ); - dllEnable( cap ); + fprintf(glw_state.log_fp, "glEnable( 0x%x )\n", cap); + dllEnable(cap); } static void APIENTRY -logEnableClientState ( GLenum array ) +logEnableClientState(GLenum array) { - SIG( "glEnableClientState" ); - dllEnableClientState( array ); + SIG("glEnableClientState"); + dllEnableClientState(array); } static void APIENTRY -logEnd ( void ) +logEnd(void) { - SIG( "glEnd" ); + SIG("glEnd"); dllEnd(); } static void APIENTRY -logEndList ( void ) +logEndList(void) { - SIG( "glEndList" ); + SIG("glEndList"); dllEndList(); } static void APIENTRY -logEvalCoord1d ( GLdouble u ) +logEvalCoord1d(GLdouble u) { - SIG( "glEvalCoord1d" ); - dllEvalCoord1d( u ); + SIG("glEvalCoord1d"); + dllEvalCoord1d(u); } static void APIENTRY -logEvalCoord1dv ( const GLdouble *u ) +logEvalCoord1dv(const GLdouble *u) { - SIG( "glEvalCoord1dv" ); - dllEvalCoord1dv( u ); + SIG("glEvalCoord1dv"); + dllEvalCoord1dv(u); } static void APIENTRY -logEvalCoord1f ( GLfloat u ) +logEvalCoord1f(GLfloat u) { - SIG( "glEvalCoord1f" ); - dllEvalCoord1f( u ); + SIG("glEvalCoord1f"); + dllEvalCoord1f(u); } static void APIENTRY -logEvalCoord1fv ( const GLfloat *u ) +logEvalCoord1fv(const GLfloat *u) { - SIG( "glEvalCoord1fv" ); - dllEvalCoord1fv( u ); + SIG("glEvalCoord1fv"); + dllEvalCoord1fv(u); } static void APIENTRY -logEvalCoord2d ( GLdouble u, GLdouble v ) +logEvalCoord2d(GLdouble u, GLdouble v) { - SIG( "glEvalCoord2d" ); - dllEvalCoord2d( u, v ); + SIG("glEvalCoord2d"); + dllEvalCoord2d(u, v); } static void APIENTRY -logEvalCoord2dv ( const GLdouble *u ) +logEvalCoord2dv(const GLdouble *u) { - SIG( "glEvalCoord2dv" ); - dllEvalCoord2dv( u ); + SIG("glEvalCoord2dv"); + dllEvalCoord2dv(u); } static void APIENTRY -logEvalCoord2f ( GLfloat u, GLfloat v ) +logEvalCoord2f(GLfloat u, GLfloat v) { - SIG( "glEvalCoord2f" ); - dllEvalCoord2f( u, v ); + SIG("glEvalCoord2f"); + dllEvalCoord2f(u, v); } static void APIENTRY -logEvalCoord2fv ( const GLfloat *u ) +logEvalCoord2fv(const GLfloat *u) { - SIG( "glEvalCoord2fv" ); - dllEvalCoord2fv( u ); + SIG("glEvalCoord2fv"); + dllEvalCoord2fv(u); } static void APIENTRY -logEvalMesh1 ( GLenum mode, GLint i1, GLint i2 ) +logEvalMesh1(GLenum mode, GLint i1, GLint i2) { - SIG( "glEvalMesh1" ); - dllEvalMesh1( mode, i1, i2 ); + SIG("glEvalMesh1"); + dllEvalMesh1(mode, i1, i2); } static void APIENTRY -logEvalMesh2 ( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ) +logEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2) { - SIG( "glEvalMesh2" ); - dllEvalMesh2( mode, i1, i2, j1, j2 ); + SIG("glEvalMesh2"); + dllEvalMesh2(mode, i1, i2, j1, j2); } static void APIENTRY -logEvalPoint1 ( GLint i ) +logEvalPoint1(GLint i) { - SIG( "glEvalPoint1" ); - dllEvalPoint1( i ); + SIG("glEvalPoint1"); + dllEvalPoint1(i); } static void APIENTRY -logEvalPoint2 ( GLint i, GLint j ) +logEvalPoint2(GLint i, GLint j) { - SIG( "glEvalPoint2" ); - dllEvalPoint2( i, j ); + SIG("glEvalPoint2"); + dllEvalPoint2(i, j); } static void APIENTRY -logFeedbackBuffer ( GLsizei size, GLenum type, GLfloat *buffer ) +logFeedbackBuffer(GLsizei size, GLenum type, GLfloat *buffer) { - SIG( "glFeedbackBuffer" ); - dllFeedbackBuffer( size, type, buffer ); + SIG("glFeedbackBuffer"); + dllFeedbackBuffer(size, type, buffer); } static void APIENTRY -logFinish ( void ) +logFinish(void) { - SIG( "glFinish" ); + SIG("glFinish"); dllFinish(); } static void APIENTRY -logFlush ( void ) +logFlush(void) { - SIG( "glFlush" ); + SIG("glFlush"); dllFlush(); } static void APIENTRY -logFogf ( GLenum pname, GLfloat param ) +logFogf(GLenum pname, GLfloat param) { - SIG( "glFogf" ); - dllFogf( pname, param ); + SIG("glFogf"); + dllFogf(pname, param); } static void APIENTRY -logFogfv ( GLenum pname, const GLfloat *params ) +logFogfv(GLenum pname, const GLfloat *params) { - SIG( "glFogfv" ); - dllFogfv( pname, params ); + SIG("glFogfv"); + dllFogfv(pname, params); } static void APIENTRY -logFogi ( GLenum pname, GLint param ) +logFogi(GLenum pname, GLint param) { - SIG( "glFogi" ); - dllFogi( pname, param ); + SIG("glFogi"); + dllFogi(pname, param); } static void APIENTRY -logFogiv ( GLenum pname, const GLint *params ) +logFogiv(GLenum pname, const GLint *params) { - SIG( "glFogiv" ); - dllFogiv( pname, params ); + SIG("glFogiv"); + dllFogiv(pname, params); } static void APIENTRY -logFrontFace ( GLenum mode ) +logFrontFace(GLenum mode) { - SIG( "glFrontFace" ); - dllFrontFace( mode ); + SIG("glFrontFace"); + dllFrontFace(mode); } static void APIENTRY -logFrustum ( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar ) +logFrustum(GLdouble left, GLdouble right, GLdouble bottom, + GLdouble top, GLdouble zNear, GLdouble zFar) { - SIG( "glFrustum" ); - dllFrustum( left, right, bottom, top, zNear, zFar ); + SIG("glFrustum"); + dllFrustum(left, right, bottom, top, zNear, zFar); } static GLuint APIENTRY -logGenLists ( GLsizei range ) +logGenLists(GLsizei range) { - SIG( "glGenLists" ); - return ( dllGenLists( range ) ); + SIG("glGenLists"); + return dllGenLists(range); } static void APIENTRY -logGenTextures ( GLsizei n, GLuint *textures ) +logGenTextures(GLsizei n, GLuint *textures) { - SIG( "glGenTextures" ); - dllGenTextures( n, textures ); + SIG("glGenTextures"); + dllGenTextures(n, textures); } static void APIENTRY -logGetBooleanv ( GLenum pname, GLboolean *params ) +logGetBooleanv(GLenum pname, GLboolean *params) { - SIG( "glGetBooleanv" ); - dllGetBooleanv( pname, params ); + SIG("glGetBooleanv"); + dllGetBooleanv(pname, params); } static void APIENTRY -logGetClipPlane ( GLenum plane, GLdouble *equation ) +logGetClipPlane(GLenum plane, GLdouble *equation) { - SIG( "glGetClipPlane" ); - dllGetClipPlane( plane, equation ); + SIG("glGetClipPlane"); + dllGetClipPlane(plane, equation); } static void APIENTRY -logGetDoublev ( GLenum pname, GLdouble *params ) +logGetDoublev(GLenum pname, GLdouble *params) { - SIG( "glGetDoublev" ); - dllGetDoublev( pname, params ); + SIG("glGetDoublev"); + dllGetDoublev(pname, params); } static GLenum APIENTRY -logGetError ( void ) +logGetError(void) { - SIG( "glGetError" ); - return ( dllGetError() ); + SIG("glGetError"); + return dllGetError(); } static void APIENTRY -logGetFloatv ( GLenum pname, GLfloat *params ) +logGetFloatv(GLenum pname, GLfloat *params) { - SIG( "glGetFloatv" ); - dllGetFloatv( pname, params ); + SIG("glGetFloatv"); + dllGetFloatv(pname, params); } static void APIENTRY -logGetIntegerv ( GLenum pname, GLint *params ) +logGetIntegerv(GLenum pname, GLint *params) { - SIG( "glGetIntegerv" ); - dllGetIntegerv( pname, params ); + SIG("glGetIntegerv"); + dllGetIntegerv(pname, params); } static void APIENTRY -logGetLightfv ( GLenum light, GLenum pname, GLfloat *params ) +logGetLightfv(GLenum light, GLenum pname, GLfloat *params) { - SIG( "glGetLightfv" ); - dllGetLightfv( light, pname, params ); + SIG("glGetLightfv"); + dllGetLightfv(light, pname, params); } static void APIENTRY -logGetLightiv ( GLenum light, GLenum pname, GLint *params ) +logGetLightiv(GLenum light, GLenum pname, GLint *params) { - SIG( "glGetLightiv" ); - dllGetLightiv( light, pname, params ); + SIG("glGetLightiv"); + dllGetLightiv(light, pname, params); } static void APIENTRY -logGetMapdv ( GLenum target, GLenum query, GLdouble *v ) +logGetMapdv(GLenum target, GLenum query, GLdouble *v) { - SIG( "glGetMapdv" ); - dllGetMapdv( target, query, v ); + SIG("glGetMapdv"); + dllGetMapdv(target, query, v); } static void APIENTRY -logGetMapfv ( GLenum target, GLenum query, GLfloat *v ) +logGetMapfv(GLenum target, GLenum query, GLfloat *v) { - SIG( "glGetMapfv" ); - dllGetMapfv( target, query, v ); + SIG("glGetMapfv"); + dllGetMapfv(target, query, v); } static void APIENTRY -logGetMapiv ( GLenum target, GLenum query, GLint *v ) +logGetMapiv(GLenum target, GLenum query, GLint *v) { - SIG( "glGetMapiv" ); - dllGetMapiv( target, query, v ); + SIG("glGetMapiv"); + dllGetMapiv(target, query, v); } static void APIENTRY -logGetMaterialfv ( GLenum face, GLenum pname, GLfloat *params ) +logGetMaterialfv(GLenum face, GLenum pname, GLfloat *params) { - SIG( "glGetMaterialfv" ); - dllGetMaterialfv( face, pname, params ); + SIG("glGetMaterialfv"); + dllGetMaterialfv(face, pname, params); } static void APIENTRY -logGetMaterialiv ( GLenum face, GLenum pname, GLint *params ) +logGetMaterialiv(GLenum face, GLenum pname, GLint *params) { - SIG( "glGetMaterialiv" ); - dllGetMaterialiv( face, pname, params ); + SIG("glGetMaterialiv"); + dllGetMaterialiv(face, pname, params); } static void APIENTRY -logGetPixelMapfv ( GLenum map, GLfloat *values ) +logGetPixelMapfv(GLenum map, GLfloat *values) { - SIG( "glGetPixelMapfv" ); - dllGetPixelMapfv( map, values ); + SIG("glGetPixelMapfv"); + dllGetPixelMapfv(map, values); } static void APIENTRY -logGetPixelMapuiv ( GLenum map, GLuint *values ) +logGetPixelMapuiv(GLenum map, GLuint *values) { - SIG( "glGetPixelMapuiv" ); - dllGetPixelMapuiv( map, values ); + SIG("glGetPixelMapuiv"); + dllGetPixelMapuiv(map, values); } static void APIENTRY -logGetPixelMapusv ( GLenum map, GLushort *values ) +logGetPixelMapusv(GLenum map, GLushort *values) { - SIG( "glGetPixelMapusv" ); - dllGetPixelMapusv( map, values ); + SIG("glGetPixelMapusv"); + dllGetPixelMapusv(map, values); } static void APIENTRY -logGetPointerv ( GLenum pname, GLvoid **params ) +logGetPointerv(GLenum pname, GLvoid **params) { - SIG( "glGetPointerv" ); - dllGetPointerv( pname, params ); + SIG("glGetPointerv"); + dllGetPointerv(pname, params); } static void APIENTRY -logGetPolygonStipple ( GLubyte *mask ) +logGetPolygonStipple(GLubyte *mask) { - SIG( "glGetPolygonStipple" ); - dllGetPolygonStipple( mask ); + SIG("glGetPolygonStipple"); + dllGetPolygonStipple(mask); } static const GLubyte *APIENTRY -logGetString ( GLenum name ) +logGetString(GLenum name) { - SIG( "glGetString" ); - return ( dllGetString( name ) ); + SIG("glGetString"); + return dllGetString(name); } static void APIENTRY -logGetTexEnvfv ( GLenum target, GLenum pname, GLfloat *params ) +logGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params) { - SIG( "glGetTexEnvfv" ); - dllGetTexEnvfv( target, pname, params ); + SIG("glGetTexEnvfv"); + dllGetTexEnvfv(target, pname, params); } static void APIENTRY -logGetTexEnviv ( GLenum target, GLenum pname, GLint *params ) +logGetTexEnviv(GLenum target, GLenum pname, GLint *params) { - SIG( "glGetTexEnviv" ); - dllGetTexEnviv( target, pname, params ); + SIG("glGetTexEnviv"); + dllGetTexEnviv(target, pname, params); } static void APIENTRY -logGetTexGendv ( GLenum coord, GLenum pname, GLdouble *params ) +logGetTexGendv(GLenum coord, GLenum pname, GLdouble *params) { - SIG( "glGetTexGendv" ); - dllGetTexGendv( coord, pname, params ); + SIG("glGetTexGendv"); + dllGetTexGendv(coord, pname, params); } static void APIENTRY -logGetTexGenfv ( GLenum coord, GLenum pname, GLfloat *params ) +logGetTexGenfv(GLenum coord, GLenum pname, GLfloat *params) { - SIG( "glGetTexGenfv" ); - dllGetTexGenfv( coord, pname, params ); + SIG("glGetTexGenfv"); + dllGetTexGenfv(coord, pname, params); } static void APIENTRY -logGetTexGeniv ( GLenum coord, GLenum pname, GLint *params ) +logGetTexGeniv(GLenum coord, GLenum pname, GLint *params) { - SIG( "glGetTexGeniv" ); - dllGetTexGeniv( coord, pname, params ); + SIG("glGetTexGeniv"); + dllGetTexGeniv(coord, pname, params); +} + +static void APIENTRY logGetTexImage(GLenum target, GLint level, + GLenum format, GLenum type, void *pixels) +{ + SIG("glGetTexImage"); + dllGetTexImage(target, level, format, type, pixels); } static void APIENTRY -logGetTexImage ( GLenum target, GLint level, GLenum format, GLenum type, void *pixels ) +logGetTexLevelParameterfv(GLenum target, GLint level, + GLenum pname, GLfloat *params) { - SIG( "glGetTexImage" ); - dllGetTexImage( target, level, format, type, pixels ); + SIG("glGetTexLevelParameterfv"); + dllGetTexLevelParameterfv(target, level, pname, params); } static void APIENTRY -logGetTexLevelParameterfv ( GLenum target, GLint level, GLenum pname, GLfloat *params ) +logGetTexLevelParameteriv(GLenum target, GLint level, + GLenum pname, GLint *params) { - SIG( "glGetTexLevelParameterfv" ); - dllGetTexLevelParameterfv( target, level, pname, params ); + SIG("glGetTexLevelParameteriv"); + dllGetTexLevelParameteriv(target, level, pname, params); } static void APIENTRY -logGetTexLevelParameteriv ( GLenum target, GLint level, GLenum pname, GLint *params ) +logGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params) { - SIG( "glGetTexLevelParameteriv" ); - dllGetTexLevelParameteriv( target, level, pname, params ); + SIG("glGetTexParameterfv"); + dllGetTexParameterfv(target, pname, params); } static void APIENTRY -logGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) +logGetTexParameteriv(GLenum target, GLenum pname, GLint *params) { - SIG( "glGetTexParameterfv" ); - dllGetTexParameterfv( target, pname, params ); + SIG("glGetTexParameteriv"); + dllGetTexParameteriv(target, pname, params); } static void APIENTRY -logGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) +logHint(GLenum target, GLenum mode) { - SIG( "glGetTexParameteriv" ); - dllGetTexParameteriv( target, pname, params ); + fprintf(glw_state.log_fp, "glHint( 0x%x, 0x%x )\n", target, mode); + dllHint(target, mode); } static void APIENTRY -logHint ( GLenum target, GLenum mode ) +logIndexMask(GLuint mask) { - fprintf( glw_state.log_fp, "glHint( 0x%x, 0x%x )\n", target, mode ); - dllHint( target, mode ); + SIG("glIndexMask"); + dllIndexMask(mask); } static void APIENTRY -logIndexMask ( GLuint mask ) +logIndexPointer(GLenum type, GLsizei stride, const void *pointer) { - SIG( "glIndexMask" ); - dllIndexMask( mask ); + SIG("glIndexPointer"); + dllIndexPointer(type, stride, pointer); } static void APIENTRY -logIndexPointer ( GLenum type, GLsizei stride, const void *pointer ) +logIndexd(GLdouble c) { - SIG( "glIndexPointer" ); - dllIndexPointer( type, stride, pointer ); + SIG("glIndexd"); + dllIndexd(c); } static void APIENTRY -logIndexd ( GLdouble c ) +logIndexdv(const GLdouble *c) { - SIG( "glIndexd" ); - dllIndexd( c ); + SIG("glIndexdv"); + dllIndexdv(c); } static void APIENTRY -logIndexdv ( const GLdouble *c ) +logIndexf(GLfloat c) { - SIG( "glIndexdv" ); - dllIndexdv( c ); + SIG("glIndexf"); + dllIndexf(c); } static void APIENTRY -logIndexf ( GLfloat c ) +logIndexfv(const GLfloat *c) { - SIG( "glIndexf" ); - dllIndexf( c ); + SIG("glIndexfv"); + dllIndexfv(c); } static void APIENTRY -logIndexfv ( const GLfloat *c ) +logIndexi(GLint c) { - SIG( "glIndexfv" ); - dllIndexfv( c ); + SIG("glIndexi"); + dllIndexi(c); } static void APIENTRY -logIndexi ( GLint c ) +logIndexiv(const GLint *c) { - SIG( "glIndexi" ); - dllIndexi( c ); + SIG("glIndexiv"); + dllIndexiv(c); } static void APIENTRY -logIndexiv ( const GLint *c ) +logIndexs(GLshort c) { - SIG( "glIndexiv" ); - dllIndexiv( c ); + SIG("glIndexs"); + dllIndexs(c); } static void APIENTRY -logIndexs ( GLshort c ) +logIndexsv(const GLshort *c) { - SIG( "glIndexs" ); - dllIndexs( c ); + SIG("glIndexsv"); + dllIndexsv(c); } static void APIENTRY -logIndexsv ( const GLshort *c ) +logIndexub(GLubyte c) { - SIG( "glIndexsv" ); - dllIndexsv( c ); + SIG("glIndexub"); + dllIndexub(c); } static void APIENTRY -logIndexub ( GLubyte c ) +logIndexubv(const GLubyte *c) { - SIG( "glIndexub" ); - dllIndexub( c ); + SIG("glIndexubv"); + dllIndexubv(c); } static void APIENTRY -logIndexubv ( const GLubyte *c ) +logInitNames(void) { - SIG( "glIndexubv" ); - dllIndexubv( c ); -} - -static void APIENTRY -logInitNames ( void ) -{ - SIG( "glInitNames" ); + SIG("glInitNames"); dllInitNames(); } static void APIENTRY -logInterleavedArrays ( GLenum format, GLsizei stride, const void *pointer ) +logInterleavedArrays(GLenum format, GLsizei stride, const void *pointer) { - SIG( "glInterleavedArrays" ); - dllInterleavedArrays( format, stride, pointer ); + SIG("glInterleavedArrays"); + dllInterleavedArrays(format, stride, pointer); } static GLboolean APIENTRY -logIsEnabled ( GLenum cap ) +logIsEnabled(GLenum cap) { - SIG( "glIsEnabled" ); - return ( dllIsEnabled( cap ) ); + SIG("glIsEnabled"); + return dllIsEnabled(cap); } static GLboolean APIENTRY -logIsList ( GLuint list ) +logIsList(GLuint list) { - SIG( "glIsList" ); - return ( dllIsList( list ) ); + SIG("glIsList"); + return dllIsList(list); } static GLboolean APIENTRY -logIsTexture ( GLuint texture ) +logIsTexture(GLuint texture) { - SIG( "glIsTexture" ); - return ( dllIsTexture( texture ) ); + SIG("glIsTexture"); + return dllIsTexture(texture); } static void APIENTRY -logLightModelf ( GLenum pname, GLfloat param ) +logLightModelf(GLenum pname, GLfloat param) { - SIG( "glLightModelf" ); - dllLightModelf( pname, param ); + SIG("glLightModelf"); + dllLightModelf(pname, param); } static void APIENTRY -logLightModelfv ( GLenum pname, const GLfloat *params ) +logLightModelfv(GLenum pname, const GLfloat *params) { - SIG( "glLightModelfv" ); - dllLightModelfv( pname, params ); + SIG("glLightModelfv"); + dllLightModelfv(pname, params); } static void APIENTRY -logLightModeli ( GLenum pname, GLint param ) +logLightModeli(GLenum pname, GLint param) { - SIG( "glLightModeli" ); - dllLightModeli( pname, param ); + SIG("glLightModeli"); + dllLightModeli(pname, param); } static void APIENTRY -logLightModeliv ( GLenum pname, const GLint *params ) +logLightModeliv(GLenum pname, const GLint *params) { - SIG( "glLightModeliv" ); - dllLightModeliv( pname, params ); + SIG("glLightModeliv"); + dllLightModeliv(pname, params); } static void APIENTRY -logLightf ( GLenum light, GLenum pname, GLfloat param ) +logLightf(GLenum light, GLenum pname, GLfloat param) { - SIG( "glLightf" ); - dllLightf( light, pname, param ); + SIG("glLightf"); + dllLightf(light, pname, param); } static void APIENTRY -logLightfv ( GLenum light, GLenum pname, const GLfloat *params ) +logLightfv(GLenum light, GLenum pname, const GLfloat *params) { - SIG( "glLightfv" ); - dllLightfv( light, pname, params ); + SIG("glLightfv"); + dllLightfv(light, pname, params); } static void APIENTRY -logLighti ( GLenum light, GLenum pname, GLint param ) +logLighti(GLenum light, GLenum pname, GLint param) { - SIG( "glLighti" ); - dllLighti( light, pname, param ); + SIG("glLighti"); + dllLighti(light, pname, param); } static void APIENTRY -logLightiv ( GLenum light, GLenum pname, const GLint *params ) +logLightiv(GLenum light, GLenum pname, const GLint *params) { - SIG( "glLightiv" ); - dllLightiv( light, pname, params ); + SIG("glLightiv"); + dllLightiv(light, pname, params); } static void APIENTRY -logLineStipple ( GLint factor, GLushort pattern ) +logLineStipple(GLint factor, GLushort pattern) { - SIG( "glLineStipple" ); - dllLineStipple( factor, pattern ); + SIG("glLineStipple"); + dllLineStipple(factor, pattern); } static void APIENTRY -logLineWidth ( GLfloat width ) +logLineWidth(GLfloat width) { - SIG( "glLineWidth" ); - dllLineWidth( width ); + SIG("glLineWidth"); + dllLineWidth(width); } static void APIENTRY -logListBase ( GLuint base ) +logListBase(GLuint base) { - SIG( "glListBase" ); - dllListBase( base ); + SIG("glListBase"); + dllListBase(base); } static void APIENTRY -logLoadIdentity ( void ) +logLoadIdentity(void) { - SIG( "glLoadIdentity" ); + SIG("glLoadIdentity"); dllLoadIdentity(); } static void APIENTRY -logLoadMatrixd ( const GLdouble *m ) +logLoadMatrixd(const GLdouble *m) { - SIG( "glLoadMatrixd" ); - dllLoadMatrixd( m ); + SIG("glLoadMatrixd"); + dllLoadMatrixd(m); } static void APIENTRY -logLoadMatrixf ( const GLfloat *m ) +logLoadMatrixf(const GLfloat *m) { - SIG( "glLoadMatrixf" ); - dllLoadMatrixf( m ); + SIG("glLoadMatrixf"); + dllLoadMatrixf(m); } static void APIENTRY -logLoadName ( GLuint name ) +logLoadName(GLuint name) { - SIG( "glLoadName" ); - dllLoadName( name ); + SIG("glLoadName"); + dllLoadName(name); } static void APIENTRY -logLogicOp ( GLenum opcode ) +logLogicOp(GLenum opcode) { - SIG( "glLogicOp" ); - dllLogicOp( opcode ); + SIG("glLogicOp"); + dllLogicOp(opcode); } static void APIENTRY -logMap1d ( GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points ) +logMap1d(GLenum target, GLdouble u1, GLdouble u2, + GLint stride, GLint order, const GLdouble *points) { - SIG( "glMap1d" ); - dllMap1d( target, u1, u2, stride, order, points ); + SIG("glMap1d"); + dllMap1d(target, u1, u2, stride, order, points); } static void APIENTRY -logMap1f ( GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points ) +logMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, + GLint order, const GLfloat *points) { - SIG( "glMap1f" ); - dllMap1f( target, u1, u2, stride, order, points ); + SIG("glMap1f"); + dllMap1f(target, u1, u2, stride, order, points); } static void APIENTRY -logMap2d ( GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, - GLint vorder, - const GLdouble *points ) +logMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, + GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, + GLint vorder, const GLdouble *points) { - SIG( "glMap2d" ); - dllMap2d( target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points ); + SIG("glMap2d"); + dllMap2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points); } static void APIENTRY -logMap2f ( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, - GLint vorder, - const GLfloat *points ) +logMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, + GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points) { - SIG( "glMap2f" ); - dllMap2f( target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points ); + SIG("glMap2f"); + dllMap2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points); } static void APIENTRY -logMapGrid1d ( GLint un, GLdouble u1, GLdouble u2 ) +logMapGrid1d(GLint un, GLdouble u1, GLdouble u2) { - SIG( "glMapGrid1d" ); - dllMapGrid1d( un, u1, u2 ); + SIG("glMapGrid1d"); + dllMapGrid1d(un, u1, u2); } static void APIENTRY -logMapGrid1f ( GLint un, GLfloat u1, GLfloat u2 ) +logMapGrid1f(GLint un, GLfloat u1, GLfloat u2) { - SIG( "glMapGrid1f" ); - dllMapGrid1f( un, u1, u2 ); + SIG("glMapGrid1f"); + dllMapGrid1f(un, u1, u2); } static void APIENTRY -logMapGrid2d ( GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2 ) +logMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, + GLdouble v1, GLdouble v2) { - SIG( "glMapGrid2d" ); - dllMapGrid2d( un, u1, u2, vn, v1, v2 ); + SIG("glMapGrid2d"); + dllMapGrid2d(un, u1, u2, vn, v1, v2); } static void APIENTRY -logMapGrid2f ( GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2 ) +logMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2) { - SIG( "glMapGrid2f" ); - dllMapGrid2f( un, u1, u2, vn, v1, v2 ); + SIG("glMapGrid2f"); + dllMapGrid2f(un, u1, u2, vn, v1, v2); } static void APIENTRY -logMaterialf ( GLenum face, GLenum pname, GLfloat param ) +logMaterialf(GLenum face, GLenum pname, GLfloat param) { - SIG( "glMaterialf" ); - dllMaterialf( face, pname, param ); + SIG("glMaterialf"); + dllMaterialf(face, pname, param); } static void APIENTRY -logMaterialfv ( GLenum face, GLenum pname, const GLfloat *params ) +logMaterialfv(GLenum face, GLenum pname, const GLfloat *params) { - SIG( "glMaterialfv" ); - dllMaterialfv( face, pname, params ); + SIG("glMaterialfv"); + dllMaterialfv(face, pname, params); } static void APIENTRY -logMateriali ( GLenum face, GLenum pname, GLint param ) +logMateriali(GLenum face, GLenum pname, GLint param) { - SIG( "glMateriali" ); - dllMateriali( face, pname, param ); + SIG("glMateriali"); + dllMateriali(face, pname, param); } static void APIENTRY -logMaterialiv ( GLenum face, GLenum pname, const GLint *params ) +logMaterialiv(GLenum face, GLenum pname, const GLint *params) { - SIG( "glMaterialiv" ); - dllMaterialiv( face, pname, params ); + SIG("glMaterialiv"); + dllMaterialiv(face, pname, params); } static void APIENTRY -logMatrixMode ( GLenum mode ) +logMatrixMode(GLenum mode) { - SIG( "glMatrixMode" ); - dllMatrixMode( mode ); + SIG("glMatrixMode"); + dllMatrixMode(mode); } static void APIENTRY -logMultMatrixd ( const GLdouble *m ) +logMultMatrixd(const GLdouble *m) { - SIG( "glMultMatrixd" ); - dllMultMatrixd( m ); + SIG("glMultMatrixd"); + dllMultMatrixd(m); } static void APIENTRY -logMultMatrixf ( const GLfloat *m ) +logMultMatrixf(const GLfloat *m) { - SIG( "glMultMatrixf" ); - dllMultMatrixf( m ); + SIG("glMultMatrixf"); + dllMultMatrixf(m); } static void APIENTRY -logNewList ( GLuint list, GLenum mode ) +logNewList(GLuint list, GLenum mode) { - SIG( "glNewList" ); - dllNewList( list, mode ); + SIG("glNewList"); + dllNewList(list, mode); } static void APIENTRY -logNormal3b ( GLbyte nx, GLbyte ny, GLbyte nz ) +logNormal3b(GLbyte nx, GLbyte ny, GLbyte nz) { - SIG( "glNormal3b" ); - dllNormal3b( nx, ny, nz ); + SIG("glNormal3b"); + dllNormal3b(nx, ny, nz); } static void APIENTRY -logNormal3bv ( const GLbyte *v ) +logNormal3bv(const GLbyte *v) { - SIG( "glNormal3bv" ); - dllNormal3bv( v ); + SIG("glNormal3bv"); + dllNormal3bv(v); } static void APIENTRY -logNormal3d ( GLdouble nx, GLdouble ny, GLdouble nz ) +logNormal3d(GLdouble nx, GLdouble ny, GLdouble nz) { - SIG( "glNormal3d" ); - dllNormal3d( nx, ny, nz ); + SIG("glNormal3d"); + dllNormal3d(nx, ny, nz); } static void APIENTRY -logNormal3dv ( const GLdouble *v ) +logNormal3dv(const GLdouble *v) { - SIG( "glNormal3dv" ); - dllNormal3dv( v ); + SIG("glNormal3dv"); + dllNormal3dv(v); } static void APIENTRY -logNormal3f ( GLfloat nx, GLfloat ny, GLfloat nz ) +logNormal3f(GLfloat nx, GLfloat ny, GLfloat nz) { - SIG( "glNormal3f" ); - dllNormal3f( nx, ny, nz ); + SIG("glNormal3f"); + dllNormal3f(nx, ny, nz); } static void APIENTRY -logNormal3fv ( const GLfloat *v ) +logNormal3fv(const GLfloat *v) { - SIG( "glNormal3fv" ); - dllNormal3fv( v ); + SIG("glNormal3fv"); + dllNormal3fv(v); } static void APIENTRY -logNormal3i ( GLint nx, GLint ny, GLint nz ) +logNormal3i(GLint nx, GLint ny, GLint nz) { - SIG( "glNormal3i" ); - dllNormal3i( nx, ny, nz ); + SIG("glNormal3i"); + dllNormal3i(nx, ny, nz); } static void APIENTRY -logNormal3iv ( const GLint *v ) +logNormal3iv(const GLint *v) { - SIG( "glNormal3iv" ); - dllNormal3iv( v ); + SIG("glNormal3iv"); + dllNormal3iv(v); } static void APIENTRY -logNormal3s ( GLshort nx, GLshort ny, GLshort nz ) +logNormal3s(GLshort nx, GLshort ny, GLshort nz) { - SIG( "glNormal3s" ); - dllNormal3s( nx, ny, nz ); + SIG("glNormal3s"); + dllNormal3s(nx, ny, nz); } static void APIENTRY -logNormal3sv ( const GLshort *v ) +logNormal3sv(const GLshort *v) { - SIG( "glNormal3sv" ); - dllNormal3sv( v ); + SIG("glNormal3sv"); + dllNormal3sv(v); } static void APIENTRY -logNormalPointer ( GLenum type, GLsizei stride, const void *pointer ) +logNormalPointer(GLenum type, GLsizei stride, const void *pointer) { - SIG( "glNormalPointer" ); - dllNormalPointer( type, stride, pointer ); + SIG("glNormalPointer"); + dllNormalPointer(type, stride, pointer); } static void APIENTRY -logOrtho ( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar ) +logOrtho(GLdouble left, GLdouble right, GLdouble bottom, + GLdouble top, GLdouble zNear, GLdouble zFar) { - SIG( "glOrtho" ); - dllOrtho( left, right, bottom, top, zNear, zFar ); + SIG("glOrtho"); + dllOrtho(left, right, bottom, top, zNear, zFar); } static void APIENTRY -logPassThrough ( GLfloat token ) +logPassThrough(GLfloat token) { - SIG( "glPassThrough" ); - dllPassThrough( token ); + SIG("glPassThrough"); + dllPassThrough(token); } static void APIENTRY -logPixelMapfv ( GLenum map, GLsizei mapsize, const GLfloat *values ) +logPixelMapfv(GLenum map, GLsizei mapsize, const GLfloat *values) { - SIG( "glPixelMapfv" ); - dllPixelMapfv( map, mapsize, values ); + SIG("glPixelMapfv"); + dllPixelMapfv(map, mapsize, values); } static void APIENTRY -logPixelMapuiv ( GLenum map, GLsizei mapsize, const GLuint *values ) +logPixelMapuiv(GLenum map, GLsizei mapsize, const GLuint *values) { - SIG( "glPixelMapuiv" ); - dllPixelMapuiv( map, mapsize, values ); + SIG("glPixelMapuiv"); + dllPixelMapuiv(map, mapsize, values); } static void APIENTRY -logPixelMapusv ( GLenum map, GLsizei mapsize, const GLushort *values ) +logPixelMapusv(GLenum map, GLsizei mapsize, const GLushort *values) { - SIG( "glPixelMapusv" ); - dllPixelMapusv( map, mapsize, values ); + SIG("glPixelMapusv"); + dllPixelMapusv(map, mapsize, values); } static void APIENTRY -logPixelStoref ( GLenum pname, GLfloat param ) +logPixelStoref(GLenum pname, GLfloat param) { - SIG( "glPixelStoref" ); - dllPixelStoref( pname, param ); + SIG("glPixelStoref"); + dllPixelStoref(pname, param); } static void APIENTRY -logPixelStorei ( GLenum pname, GLint param ) +logPixelStorei(GLenum pname, GLint param) { - SIG( "glPixelStorei" ); - dllPixelStorei( pname, param ); + SIG("glPixelStorei"); + dllPixelStorei(pname, param); } static void APIENTRY -logPixelTransferf ( GLenum pname, GLfloat param ) +logPixelTransferf(GLenum pname, GLfloat param) { - SIG( "glPixelTransferf" ); - dllPixelTransferf( pname, param ); + SIG("glPixelTransferf"); + dllPixelTransferf(pname, param); } static void APIENTRY -logPixelTransferi ( GLenum pname, GLint param ) +logPixelTransferi(GLenum pname, GLint param) { - SIG( "glPixelTransferi" ); - dllPixelTransferi( pname, param ); + SIG("glPixelTransferi"); + dllPixelTransferi(pname, param); } static void APIENTRY -logPixelZoom ( GLfloat xfactor, GLfloat yfactor ) +logPixelZoom(GLfloat xfactor, GLfloat yfactor) { - SIG( "glPixelZoom" ); - dllPixelZoom( xfactor, yfactor ); + SIG("glPixelZoom"); + dllPixelZoom(xfactor, yfactor); } static void APIENTRY -logPointSize ( GLfloat size ) +logPointSize(GLfloat size) { - SIG( "glPointSize" ); - dllPointSize( size ); + SIG("glPointSize"); + dllPointSize(size); } static void APIENTRY -logPolygonMode ( GLenum face, GLenum mode ) +logPolygonMode(GLenum face, GLenum mode) { - fprintf( glw_state.log_fp, "glPolygonMode( 0x%x, 0x%x )\n", face, mode ); - dllPolygonMode( face, mode ); + fprintf(glw_state.log_fp, "glPolygonMode( 0x%x, 0x%x )\n", face, mode); + dllPolygonMode(face, mode); } static void APIENTRY -logPolygonOffset ( GLfloat factor, GLfloat units ) +logPolygonOffset(GLfloat factor, GLfloat units) { - SIG( "glPolygonOffset" ); - dllPolygonOffset( factor, units ); + SIG("glPolygonOffset"); + dllPolygonOffset(factor, units); } static void APIENTRY -logPolygonStipple ( const GLubyte *mask ) +logPolygonStipple(const GLubyte *mask) { - SIG( "glPolygonStipple" ); - dllPolygonStipple( mask ); + SIG("glPolygonStipple"); + dllPolygonStipple(mask); } static void APIENTRY -logPopAttrib ( void ) +logPopAttrib(void) { - SIG( "glPopAttrib" ); + SIG("glPopAttrib"); dllPopAttrib(); } static void APIENTRY -logPopClientAttrib ( void ) +logPopClientAttrib(void) { - SIG( "glPopClientAttrib" ); + SIG("glPopClientAttrib"); dllPopClientAttrib(); } static void APIENTRY -logPopMatrix ( void ) +logPopMatrix(void) { - SIG( "glPopMatrix" ); + SIG("glPopMatrix"); dllPopMatrix(); } static void APIENTRY -logPopName ( void ) +logPopName(void) { - SIG( "glPopName" ); + SIG("glPopName"); dllPopName(); } static void APIENTRY -logPrioritizeTextures ( GLsizei n, const GLuint *textures, const GLclampf *priorities ) +logPrioritizeTextures(GLsizei n, const GLuint *textures, + const GLclampf *priorities) { - SIG( "glPrioritizeTextures" ); - dllPrioritizeTextures( n, textures, priorities ); + SIG("glPrioritizeTextures"); + dllPrioritizeTextures(n, textures, priorities); } static void APIENTRY -logPushAttrib ( GLbitfield mask ) +logPushAttrib(GLbitfield mask) { - SIG( "glPushAttrib" ); - dllPushAttrib( mask ); + SIG("glPushAttrib"); + dllPushAttrib(mask); } static void APIENTRY -logPushClientAttrib ( GLbitfield mask ) +logPushClientAttrib(GLbitfield mask) { - SIG( "glPushClientAttrib" ); - dllPushClientAttrib( mask ); + SIG("glPushClientAttrib"); + dllPushClientAttrib(mask); } static void APIENTRY -logPushMatrix ( void ) +logPushMatrix(void) { - SIG( "glPushMatrix" ); + SIG("glPushMatrix"); dllPushMatrix(); } static void APIENTRY -logPushName ( GLuint name ) +logPushName(GLuint name) { - SIG( "glPushName" ); - dllPushName( name ); + SIG("glPushName"); + dllPushName(name); } static void APIENTRY -logRasterPos2d ( GLdouble x, GLdouble y ) +logRasterPos2d(GLdouble x, GLdouble y) { - SIG( "glRasterPot2d" ); - dllRasterPos2d( x, y ); + SIG("glRasterPot2d"); + dllRasterPos2d(x, y); } static void APIENTRY -logRasterPos2dv ( const GLdouble *v ) +logRasterPos2dv(const GLdouble *v) { - SIG( "glRasterPos2dv" ); - dllRasterPos2dv( v ); + SIG("glRasterPos2dv"); + dllRasterPos2dv(v); } static void APIENTRY -logRasterPos2f ( GLfloat x, GLfloat y ) +logRasterPos2f(GLfloat x, GLfloat y) { - SIG( "glRasterPos2f" ); - dllRasterPos2f( x, y ); + SIG("glRasterPos2f"); + dllRasterPos2f(x, y); } static void APIENTRY -logRasterPos2fv ( const GLfloat *v ) +logRasterPos2fv(const GLfloat *v) { - SIG( "glRasterPos2dv" ); - dllRasterPos2fv( v ); + SIG("glRasterPos2dv"); + dllRasterPos2fv(v); } static void APIENTRY -logRasterPos2i ( GLint x, GLint y ) +logRasterPos2i(GLint x, GLint y) { - SIG( "glRasterPos2if" ); - dllRasterPos2i( x, y ); + SIG("glRasterPos2if"); + dllRasterPos2i(x, y); } static void APIENTRY -logRasterPos2iv ( const GLint *v ) +logRasterPos2iv(const GLint *v) { - SIG( "glRasterPos2iv" ); - dllRasterPos2iv( v ); + SIG("glRasterPos2iv"); + dllRasterPos2iv(v); } static void APIENTRY -logRasterPos2s ( GLshort x, GLshort y ) +logRasterPos2s(GLshort x, GLshort y) { - SIG( "glRasterPos2s" ); - dllRasterPos2s( x, y ); + SIG("glRasterPos2s"); + dllRasterPos2s(x, y); } static void APIENTRY -logRasterPos2sv ( const GLshort *v ) +logRasterPos2sv(const GLshort *v) { - SIG( "glRasterPos2sv" ); - dllRasterPos2sv( v ); + SIG("glRasterPos2sv"); + dllRasterPos2sv(v); } static void APIENTRY -logRasterPos3d ( GLdouble x, GLdouble y, GLdouble z ) +logRasterPos3d(GLdouble x, GLdouble y, GLdouble z) { - SIG( "glRasterPos3d" ); - dllRasterPos3d( x, y, z ); + SIG("glRasterPos3d"); + dllRasterPos3d(x, y, z); } static void APIENTRY -logRasterPos3dv ( const GLdouble *v ) +logRasterPos3dv(const GLdouble *v) { - SIG( "glRasterPos3dv" ); - dllRasterPos3dv( v ); + SIG("glRasterPos3dv"); + dllRasterPos3dv(v); } static void APIENTRY -logRasterPos3f ( GLfloat x, GLfloat y, GLfloat z ) +logRasterPos3f(GLfloat x, GLfloat y, GLfloat z) { - SIG( "glRasterPos3f" ); - dllRasterPos3f( x, y, z ); + SIG("glRasterPos3f"); + dllRasterPos3f(x, y, z); } static void APIENTRY -logRasterPos3fv ( const GLfloat *v ) +logRasterPos3fv(const GLfloat *v) { - SIG( "glRasterPos3fv" ); - dllRasterPos3fv( v ); + SIG("glRasterPos3fv"); + dllRasterPos3fv(v); } static void APIENTRY -logRasterPos3i ( GLint x, GLint y, GLint z ) +logRasterPos3i(GLint x, GLint y, GLint z) { - SIG( "glRasterPos3i" ); - dllRasterPos3i( x, y, z ); + SIG("glRasterPos3i"); + dllRasterPos3i(x, y, z); } static void APIENTRY -logRasterPos3iv ( const GLint *v ) +logRasterPos3iv(const GLint *v) { - SIG( "glRasterPos3iv" ); - dllRasterPos3iv( v ); + SIG("glRasterPos3iv"); + dllRasterPos3iv(v); } static void APIENTRY -logRasterPos3s ( GLshort x, GLshort y, GLshort z ) +logRasterPos3s(GLshort x, GLshort y, GLshort z) { - SIG( "glRasterPos3s" ); - dllRasterPos3s( x, y, z ); + SIG("glRasterPos3s"); + dllRasterPos3s(x, y, z); } static void APIENTRY -logRasterPos3sv ( const GLshort *v ) +logRasterPos3sv(const GLshort *v) { - SIG( "glRasterPos3sv" ); - dllRasterPos3sv( v ); + SIG("glRasterPos3sv"); + dllRasterPos3sv(v); } static void APIENTRY -logRasterPos4d ( GLdouble x, GLdouble y, GLdouble z, GLdouble w ) +logRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w) { - SIG( "glRasterPos4d" ); - dllRasterPos4d( x, y, z, w ); + SIG("glRasterPos4d"); + dllRasterPos4d(x, y, z, w); } static void APIENTRY -logRasterPos4dv ( const GLdouble *v ) +logRasterPos4dv(const GLdouble *v) { - SIG( "glRasterPos4dv" ); - dllRasterPos4dv( v ); + SIG("glRasterPos4dv"); + dllRasterPos4dv(v); } static void APIENTRY -logRasterPos4f ( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) +logRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) { - SIG( "glRasterPos4f" ); - dllRasterPos4f( x, y, z, w ); + SIG("glRasterPos4f"); + dllRasterPos4f(x, y, z, w); } static void APIENTRY -logRasterPos4fv ( const GLfloat *v ) +logRasterPos4fv(const GLfloat *v) { - SIG( "glRasterPos4fv" ); - dllRasterPos4fv( v ); + SIG("glRasterPos4fv"); + dllRasterPos4fv(v); } static void APIENTRY -logRasterPos4i ( GLint x, GLint y, GLint z, GLint w ) +logRasterPos4i(GLint x, GLint y, GLint z, GLint w) { - SIG( "glRasterPos4i" ); - dllRasterPos4i( x, y, z, w ); + SIG("glRasterPos4i"); + dllRasterPos4i(x, y, z, w); } static void APIENTRY -logRasterPos4iv ( const GLint *v ) +logRasterPos4iv(const GLint *v) { - SIG( "glRasterPos4iv" ); - dllRasterPos4iv( v ); + SIG("glRasterPos4iv"); + dllRasterPos4iv(v); } static void APIENTRY -logRasterPos4s ( GLshort x, GLshort y, GLshort z, GLshort w ) +logRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w) { - SIG( "glRasterPos4s" ); - dllRasterPos4s( x, y, z, w ); + SIG("glRasterPos4s"); + dllRasterPos4s(x, y, z, w); } static void APIENTRY -logRasterPos4sv ( const GLshort *v ) +logRasterPos4sv(const GLshort *v) { - SIG( "glRasterPos4sv" ); - dllRasterPos4sv( v ); + SIG("glRasterPos4sv"); + dllRasterPos4sv(v); } static void APIENTRY -logReadBuffer ( GLenum mode ) +logReadBuffer(GLenum mode) { - SIG( "glReadBuffer" ); - dllReadBuffer( mode ); + SIG("glReadBuffer"); + dllReadBuffer(mode); } static void APIENTRY -logReadPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels ) +logReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, + GLenum format, GLenum type, void *pixels) { - SIG( "glReadPixels" ); - dllReadPixels( x, y, width, height, format, type, pixels ); + SIG("glReadPixels"); + dllReadPixels(x, y, width, height, format, type, pixels); } static void APIENTRY -logRectd ( GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2 ) +logRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2) { - SIG( "glRectd" ); - dllRectd( x1, y1, x2, y2 ); + SIG("glRectd"); + dllRectd(x1, y1, x2, y2); } static void APIENTRY -logRectdv ( const GLdouble *v1, const GLdouble *v2 ) +logRectdv(const GLdouble *v1, const GLdouble *v2) { - SIG( "glRectdv" ); - dllRectdv( v1, v2 ); + SIG("glRectdv"); + dllRectdv(v1, v2); } static void APIENTRY -logRectf ( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ) +logRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2) { - SIG( "glRectf" ); - dllRectf( x1, y1, x2, y2 ); + SIG("glRectf"); + dllRectf(x1, y1, x2, y2); } static void APIENTRY -logRectfv ( const GLfloat *v1, const GLfloat *v2 ) +logRectfv(const GLfloat *v1, const GLfloat *v2) { - SIG( "glRectfv" ); - dllRectfv( v1, v2 ); + SIG("glRectfv"); + dllRectfv(v1, v2); } static void APIENTRY -logRecti ( GLint x1, GLint y1, GLint x2, GLint y2 ) +logRecti(GLint x1, GLint y1, GLint x2, GLint y2) { - SIG( "glRecti" ); - dllRecti( x1, y1, x2, y2 ); + SIG("glRecti"); + dllRecti(x1, y1, x2, y2); } static void APIENTRY -logRectiv ( const GLint *v1, const GLint *v2 ) +logRectiv(const GLint *v1, const GLint *v2) { - SIG( "glRectiv" ); - dllRectiv( v1, v2 ); + SIG("glRectiv"); + dllRectiv(v1, v2); } static void APIENTRY -logRects ( GLshort x1, GLshort y1, GLshort x2, GLshort y2 ) +logRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2) { - SIG( "glRects" ); - dllRects( x1, y1, x2, y2 ); + SIG("glRects"); + dllRects(x1, y1, x2, y2); } static void APIENTRY -logRectsv ( const GLshort *v1, const GLshort *v2 ) +logRectsv(const GLshort *v1, const GLshort *v2) { - SIG( "glRectsv" ); - dllRectsv( v1, v2 ); + SIG("glRectsv"); + dllRectsv(v1, v2); } static GLint APIENTRY -logRenderMode ( GLenum mode ) +logRenderMode(GLenum mode) { - SIG( "glRenderMode" ); - return ( dllRenderMode( mode ) ); + SIG("glRenderMode"); + return dllRenderMode(mode); } static void APIENTRY -logRotated ( GLdouble angle, GLdouble x, GLdouble y, GLdouble z ) +logRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z) { - SIG( "glRotated" ); - dllRotated( angle, x, y, z ); + SIG("glRotated"); + dllRotated(angle, x, y, z); } static void APIENTRY -logRotatef ( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) +logRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) { - SIG( "glRotatef" ); - dllRotatef( angle, x, y, z ); + SIG("glRotatef"); + dllRotatef(angle, x, y, z); } static void APIENTRY -logScaled ( GLdouble x, GLdouble y, GLdouble z ) +logScaled(GLdouble x, GLdouble y, GLdouble z) { - SIG( "glScaled" ); - dllScaled( x, y, z ); + SIG("glScaled"); + dllScaled(x, y, z); } static void APIENTRY -logScalef ( GLfloat x, GLfloat y, GLfloat z ) +logScalef(GLfloat x, GLfloat y, GLfloat z) { - SIG( "glScalef" ); - dllScalef( x, y, z ); + SIG("glScalef"); + dllScalef(x, y, z); } static void APIENTRY -logScissor ( GLint x, GLint y, GLsizei width, GLsizei height ) +logScissor(GLint x, GLint y, GLsizei width, GLsizei height) { - SIG( "glScissor" ); - dllScissor( x, y, width, height ); + SIG("glScissor"); + dllScissor(x, y, width, height); } static void APIENTRY -logSelectBuffer ( GLsizei size, GLuint *buffer ) +logSelectBuffer(GLsizei size, GLuint *buffer) { - SIG( "glSelectBuffer" ); - dllSelectBuffer( size, buffer ); + SIG("glSelectBuffer"); + dllSelectBuffer(size, buffer); } static void APIENTRY -logShadeModel ( GLenum mode ) +logShadeModel(GLenum mode) { - SIG( "glShadeModel" ); - dllShadeModel( mode ); + SIG("glShadeModel"); + dllShadeModel(mode); } static void APIENTRY -logStencilFunc ( GLenum func, GLint ref, GLuint mask ) +logStencilFunc(GLenum func, GLint ref, GLuint mask) { - SIG( "glStencilFunc" ); - dllStencilFunc( func, ref, mask ); + SIG("glStencilFunc"); + dllStencilFunc(func, ref, mask); } static void APIENTRY -logStencilMask ( GLuint mask ) +logStencilMask(GLuint mask) { - SIG( "glStencilMask" ); - dllStencilMask( mask ); + SIG("glStencilMask"); + dllStencilMask(mask); } static void APIENTRY -logStencilOp ( GLenum fail, GLenum zfail, GLenum zpass ) +logStencilOp(GLenum fail, GLenum zfail, GLenum zpass) { - SIG( "glStencilOp" ); - dllStencilOp( fail, zfail, zpass ); + SIG("glStencilOp"); + dllStencilOp(fail, zfail, zpass); } static void APIENTRY -logTexCoord1d ( GLdouble s ) +logTexCoord1d(GLdouble s) { - SIG( "glTexCoord1d" ); - dllTexCoord1d( s ); + SIG("glTexCoord1d"); + dllTexCoord1d(s); } static void APIENTRY -logTexCoord1dv ( const GLdouble *v ) +logTexCoord1dv(const GLdouble *v) { - SIG( "glTexCoord1dv" ); - dllTexCoord1dv( v ); + SIG("glTexCoord1dv"); + dllTexCoord1dv(v); } static void APIENTRY -logTexCoord1f ( GLfloat s ) +logTexCoord1f(GLfloat s) { - SIG( "glTexCoord1f" ); - dllTexCoord1f( s ); + SIG("glTexCoord1f"); + dllTexCoord1f(s); } static void APIENTRY -logTexCoord1fv ( const GLfloat *v ) +logTexCoord1fv(const GLfloat *v) { - SIG( "glTexCoord1fv" ); - dllTexCoord1fv( v ); + SIG("glTexCoord1fv"); + dllTexCoord1fv(v); } static void APIENTRY -logTexCoord1i ( GLint s ) +logTexCoord1i(GLint s) { - SIG( "glTexCoord1i" ); - dllTexCoord1i( s ); + SIG("glTexCoord1i"); + dllTexCoord1i(s); } static void APIENTRY -logTexCoord1iv ( const GLint *v ) +logTexCoord1iv(const GLint *v) { - SIG( "glTexCoord1iv" ); - dllTexCoord1iv( v ); + SIG("glTexCoord1iv"); + dllTexCoord1iv(v); } static void APIENTRY -logTexCoord1s ( GLshort s ) +logTexCoord1s(GLshort s) { - SIG( "glTexCoord1s" ); - dllTexCoord1s( s ); + SIG("glTexCoord1s"); + dllTexCoord1s(s); } static void APIENTRY -logTexCoord1sv ( const GLshort *v ) +logTexCoord1sv(const GLshort *v) { - SIG( "glTexCoord1sv" ); - dllTexCoord1sv( v ); + SIG("glTexCoord1sv"); + dllTexCoord1sv(v); } static void APIENTRY -logTexCoord2d ( GLdouble s, GLdouble t ) +logTexCoord2d(GLdouble s, GLdouble t) { - SIG( "glTexCoord2d" ); - dllTexCoord2d( s, t ); + SIG("glTexCoord2d"); + dllTexCoord2d(s, t); } static void APIENTRY -logTexCoord2dv ( const GLdouble *v ) +logTexCoord2dv(const GLdouble *v) { - SIG( "glTexCoord2dv" ); - dllTexCoord2dv( v ); + SIG("glTexCoord2dv"); + dllTexCoord2dv(v); } static void APIENTRY -logTexCoord2f ( GLfloat s, GLfloat t ) +logTexCoord2f(GLfloat s, GLfloat t) { - SIG( "glTexCoord2f" ); - dllTexCoord2f( s, t ); + SIG("glTexCoord2f"); + dllTexCoord2f(s, t); } static void APIENTRY -logTexCoord2fv ( const GLfloat *v ) +logTexCoord2fv(const GLfloat *v) { - SIG( "glTexCoord2fv" ); - dllTexCoord2fv( v ); + SIG("glTexCoord2fv"); + dllTexCoord2fv(v); } static void APIENTRY -logTexCoord2i ( GLint s, GLint t ) +logTexCoord2i(GLint s, GLint t) { - SIG( "glTexCoord2i" ); - dllTexCoord2i( s, t ); + SIG("glTexCoord2i"); + dllTexCoord2i(s, t); } static void APIENTRY -logTexCoord2iv ( const GLint *v ) +logTexCoord2iv(const GLint *v) { - SIG( "glTexCoord2iv" ); - dllTexCoord2iv( v ); + SIG("glTexCoord2iv"); + dllTexCoord2iv(v); } static void APIENTRY -logTexCoord2s ( GLshort s, GLshort t ) +logTexCoord2s(GLshort s, GLshort t) { - SIG( "glTexCoord2s" ); - dllTexCoord2s( s, t ); + SIG("glTexCoord2s"); + dllTexCoord2s(s, t); } static void APIENTRY -logTexCoord2sv ( const GLshort *v ) +logTexCoord2sv(const GLshort *v) { - SIG( "glTexCoord2sv" ); - dllTexCoord2sv( v ); + SIG("glTexCoord2sv"); + dllTexCoord2sv(v); } static void APIENTRY -logTexCoord3d ( GLdouble s, GLdouble t, GLdouble r ) +logTexCoord3d(GLdouble s, GLdouble t, GLdouble r) { - SIG( "glTexCoord3d" ); - dllTexCoord3d( s, t, r ); + SIG("glTexCoord3d"); + dllTexCoord3d(s, t, r); } static void APIENTRY -logTexCoord3dv ( const GLdouble *v ) +logTexCoord3dv(const GLdouble *v) { - SIG( "glTexCoord3dv" ); - dllTexCoord3dv( v ); + SIG("glTexCoord3dv"); + dllTexCoord3dv(v); } static void APIENTRY -logTexCoord3f ( GLfloat s, GLfloat t, GLfloat r ) +logTexCoord3f(GLfloat s, GLfloat t, GLfloat r) { - SIG( "glTexCoord3f" ); - dllTexCoord3f( s, t, r ); + SIG("glTexCoord3f"); + dllTexCoord3f(s, t, r); } static void APIENTRY -logTexCoord3fv ( const GLfloat *v ) +logTexCoord3fv(const GLfloat *v) { - SIG( "glTexCoord3fv" ); - dllTexCoord3fv( v ); + SIG("glTexCoord3fv"); + dllTexCoord3fv(v); } static void APIENTRY -logTexCoord3i ( GLint s, GLint t, GLint r ) +logTexCoord3i(GLint s, GLint t, GLint r) { - SIG( "glTexCoord3i" ); - dllTexCoord3i( s, t, r ); + SIG("glTexCoord3i"); + dllTexCoord3i(s, t, r); } static void APIENTRY -logTexCoord3iv ( const GLint *v ) +logTexCoord3iv(const GLint *v) { - SIG( "glTexCoord3iv" ); - dllTexCoord3iv( v ); + SIG("glTexCoord3iv"); + dllTexCoord3iv(v); } static void APIENTRY -logTexCoord3s ( GLshort s, GLshort t, GLshort r ) +logTexCoord3s(GLshort s, GLshort t, GLshort r) { - SIG( "glTexCoord3s" ); - dllTexCoord3s( s, t, r ); + SIG("glTexCoord3s"); + dllTexCoord3s(s, t, r); } static void APIENTRY -logTexCoord3sv ( const GLshort *v ) +logTexCoord3sv(const GLshort *v) { - SIG( "glTexCoord3sv" ); - dllTexCoord3sv( v ); + SIG("glTexCoord3sv"); + dllTexCoord3sv(v); } static void APIENTRY -logTexCoord4d ( GLdouble s, GLdouble t, GLdouble r, GLdouble q ) +logTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q) { - SIG( "glTexCoord4d" ); - dllTexCoord4d( s, t, r, q ); + SIG("glTexCoord4d"); + dllTexCoord4d(s, t, r, q); } static void APIENTRY -logTexCoord4dv ( const GLdouble *v ) +logTexCoord4dv(const GLdouble *v) { - SIG( "glTexCoord4dv" ); - dllTexCoord4dv( v ); + SIG("glTexCoord4dv"); + dllTexCoord4dv(v); } static void APIENTRY -logTexCoord4f ( GLfloat s, GLfloat t, GLfloat r, GLfloat q ) +logTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q) { - SIG( "glTexCoord4f" ); - dllTexCoord4f( s, t, r, q ); + SIG("glTexCoord4f"); + dllTexCoord4f(s, t, r, q); } static void APIENTRY -logTexCoord4fv ( const GLfloat *v ) +logTexCoord4fv(const GLfloat *v) { - SIG( "glTexCoord4fv" ); - dllTexCoord4fv( v ); + SIG("glTexCoord4fv"); + dllTexCoord4fv(v); } static void APIENTRY -logTexCoord4i ( GLint s, GLint t, GLint r, GLint q ) +logTexCoord4i(GLint s, GLint t, GLint r, GLint q) { - SIG( "glTexCoord4i" ); - dllTexCoord4i( s, t, r, q ); + SIG("glTexCoord4i"); + dllTexCoord4i(s, t, r, q); } static void APIENTRY -logTexCoord4iv ( const GLint *v ) +logTexCoord4iv(const GLint *v) { - SIG( "glTexCoord4iv" ); - dllTexCoord4iv( v ); + SIG("glTexCoord4iv"); + dllTexCoord4iv(v); } static void APIENTRY -logTexCoord4s ( GLshort s, GLshort t, GLshort r, GLshort q ) +logTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q) { - SIG( "glTexCoord4s" ); - dllTexCoord4s( s, t, r, q ); + SIG("glTexCoord4s"); + dllTexCoord4s(s, t, r, q); } static void APIENTRY -logTexCoord4sv ( const GLshort *v ) +logTexCoord4sv(const GLshort *v) { - SIG( "glTexCoord4sv" ); - dllTexCoord4sv( v ); + SIG("glTexCoord4sv"); + dllTexCoord4sv(v); } static void APIENTRY -logTexCoordPointer ( GLint size, GLenum type, GLsizei stride, const void *pointer ) +logTexCoordPointer(GLint size, GLenum type, GLsizei stride, const void *pointer) { - SIG( "glTexCoordPointer" ); - dllTexCoordPointer( size, type, stride, pointer ); + SIG("glTexCoordPointer"); + dllTexCoordPointer(size, type, stride, pointer); } static void APIENTRY -logTexEnvf ( GLenum target, GLenum pname, GLfloat param ) +logTexEnvf(GLenum target, GLenum pname, GLfloat param) { - fprintf( glw_state.log_fp, "glTexEnvf( 0x%x, 0x%x, %f )\n", target, pname, param ); - dllTexEnvf( target, pname, param ); + fprintf(glw_state.log_fp, "glTexEnvf( 0x%x, 0x%x, %f )\n", + target, pname, param); + dllTexEnvf(target, pname, param); } static void APIENTRY -logTexEnvfv ( GLenum target, GLenum pname, const GLfloat *params ) +logTexEnvfv(GLenum target, GLenum pname, const GLfloat *params) { - SIG( "glTexEnvfv" ); - dllTexEnvfv( target, pname, params ); + SIG("glTexEnvfv"); + dllTexEnvfv(target, pname, params); } static void APIENTRY -logTexEnvi ( GLenum target, GLenum pname, GLint param ) +logTexEnvi(GLenum target, GLenum pname, GLint param) { - fprintf( glw_state.log_fp, "glTexEnvi( 0x%x, 0x%x, 0x%x )\n", target, pname, param ); - dllTexEnvi( target, pname, param ); + fprintf(glw_state.log_fp, "glTexEnvi( 0x%x, 0x%x, 0x%x )\n", + target, pname, param); + dllTexEnvi(target, pname, param); } static void APIENTRY -logTexEnviv ( GLenum target, GLenum pname, const GLint *params ) +logTexEnviv(GLenum target, GLenum pname, const GLint *params) { - SIG( "glTexEnviv" ); - dllTexEnviv( target, pname, params ); + SIG("glTexEnviv"); + dllTexEnviv(target, pname, params); } static void APIENTRY -logTexGend ( GLenum coord, GLenum pname, GLdouble param ) +logTexGend(GLenum coord, GLenum pname, GLdouble param) { - SIG( "glTexGend" ); - dllTexGend( coord, pname, param ); + SIG("glTexGend"); + dllTexGend(coord, pname, param); } static void APIENTRY -logTexGendv ( GLenum coord, GLenum pname, const GLdouble *params ) +logTexGendv(GLenum coord, GLenum pname, const GLdouble *params) { - SIG( "glTexGendv" ); - dllTexGendv( coord, pname, params ); + SIG("glTexGendv"); + dllTexGendv(coord, pname, params); } static void APIENTRY -logTexGenf ( GLenum coord, GLenum pname, GLfloat param ) +logTexGenf(GLenum coord, GLenum pname, GLfloat param) { - SIG( "glTexGenf" ); - dllTexGenf( coord, pname, param ); + SIG("glTexGenf"); + dllTexGenf(coord, pname, param); } static void APIENTRY -logTexGenfv ( GLenum coord, GLenum pname, const GLfloat *params ) +logTexGenfv(GLenum coord, GLenum pname, const GLfloat *params) { - SIG( "glTexGenfv" ); - dllTexGenfv( coord, pname, params ); + SIG("glTexGenfv"); + dllTexGenfv(coord, pname, params); } static void APIENTRY -logTexGeni ( GLenum coord, GLenum pname, GLint param ) +logTexGeni(GLenum coord, GLenum pname, GLint param) { - SIG( "glTexGeni" ); - dllTexGeni( coord, pname, param ); + SIG("glTexGeni"); + dllTexGeni(coord, pname, param); } static void APIENTRY -logTexGeniv ( GLenum coord, GLenum pname, const GLint *params ) +logTexGeniv(GLenum coord, GLenum pname, const GLint *params) { - SIG( "glTexGeniv" ); - dllTexGeniv( coord, pname, params ); + SIG("glTexGeniv"); + dllTexGeniv(coord, pname, params); } static void APIENTRY -logTexImage1D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, - const void *pixels ) +logTexImage1D(GLenum target, GLint level, GLint internalformat, + GLsizei width, GLint border, GLenum format, GLenum type, + const void *pixels) { - SIG( "glTexImage1D" ); - dllTexImage1D( target, level, internalformat, width, border, format, type, pixels ); + SIG("glTexImage1D"); + dllTexImage1D(target, level, internalformat, width, + border, format, type, pixels); } static void APIENTRY -logTexImage2D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, - GLenum type, - const void *pixels ) +logTexImage2D(GLenum target, GLint level, GLint internalformat, + GLsizei width, GLsizei height, GLint border, GLenum format, + GLenum type, const void *pixels) { - SIG( "glTexImage2D" ); - dllTexImage2D( target, level, internalformat, width, height, border, format, type, pixels ); + SIG("glTexImage2D"); + dllTexImage2D(target, level, internalformat, width, + height, border, format, type, pixels); } static void APIENTRY -logTexParameterf ( GLenum target, GLenum pname, GLfloat param ) +logTexParameterf(GLenum target, GLenum pname, GLfloat param) { - fprintf( glw_state.log_fp, "glTexParameterf( 0x%x, 0x%x, %f )\n", target, pname, param ); - dllTexParameterf( target, pname, param ); + fprintf(glw_state.log_fp, "glTexParameterf( 0x%x, 0x%x, %f )\n", + target, pname, param); + dllTexParameterf(target, pname, param); } static void APIENTRY -logTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) +logTexParameterfv(GLenum target, GLenum pname, const GLfloat *params) { - SIG( "glTexParameterfv" ); - dllTexParameterfv( target, pname, params ); + SIG("glTexParameterfv"); + dllTexParameterfv(target, pname, params); } static void APIENTRY -logTexParameteri ( GLenum target, GLenum pname, GLint param ) +logTexParameteri(GLenum target, GLenum pname, GLint param) { - fprintf( glw_state.log_fp, "glTexParameteri( 0x%x, 0x%x, 0x%x )\n", target, pname, param ); - dllTexParameteri( target, pname, param ); + fprintf(glw_state.log_fp, "glTexParameteri( 0x%x, 0x%x, 0x%x )\n", + target, pname, param); + dllTexParameteri(target, pname, param); } static void APIENTRY -logTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) +logTexParameteriv(GLenum target, GLenum pname, const GLint *params) { - SIG( "glTexParameteriv" ); - dllTexParameteriv( target, pname, params ); + SIG("glTexParameteriv"); + dllTexParameteriv(target, pname, params); } static void APIENTRY -logTexSubImage1D ( GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels ) +logTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, + GLenum format, GLenum type, const void *pixels) { - SIG( "glTexSubImage1D" ); - dllTexSubImage1D( target, level, xoffset, width, format, type, pixels ); + SIG("glTexSubImage1D"); + dllTexSubImage1D(target, level, xoffset, width, format, type, pixels); } static void APIENTRY -logTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, - GLenum type, - const void *pixels ) +logTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, GLenum format, GLenum type, + const void *pixels) { - SIG( "glTexSubImage2D" ); - dllTexSubImage2D( target, level, xoffset, yoffset, width, height, format, type, pixels ); + SIG("glTexSubImage2D"); + dllTexSubImage2D(target, level, xoffset, yoffset, width, + height, format, type, pixels); } static void APIENTRY -logTranslated ( GLdouble x, GLdouble y, GLdouble z ) +logTranslated(GLdouble x, GLdouble y, GLdouble z) { - SIG( "glTranslated" ); - dllTranslated( x, y, z ); + SIG("glTranslated"); + dllTranslated(x, y, z); } static void APIENTRY -logTranslatef ( GLfloat x, GLfloat y, GLfloat z ) +logTranslatef(GLfloat x, GLfloat y, GLfloat z) { - SIG( "glTranslatef" ); - dllTranslatef( x, y, z ); + SIG("glTranslatef"); + dllTranslatef(x, y, z); } static void APIENTRY -logVertex2d ( GLdouble x, GLdouble y ) +logVertex2d(GLdouble x, GLdouble y) { - SIG( "glVertex2d" ); - dllVertex2d( x, y ); + SIG("glVertex2d"); + dllVertex2d(x, y); } static void APIENTRY -logVertex2dv ( const GLdouble *v ) +logVertex2dv(const GLdouble *v) { - SIG( "glVertex2dv" ); - dllVertex2dv( v ); + SIG("glVertex2dv"); + dllVertex2dv(v); } static void APIENTRY -logVertex2f ( GLfloat x, GLfloat y ) +logVertex2f(GLfloat x, GLfloat y) { - SIG( "glVertex2f" ); - dllVertex2f( x, y ); + SIG("glVertex2f"); + dllVertex2f(x, y); } static void APIENTRY -logVertex2fv ( const GLfloat *v ) +logVertex2fv(const GLfloat *v) { - SIG( "glVertex2fv" ); - dllVertex2fv( v ); + SIG("glVertex2fv"); + dllVertex2fv(v); } static void APIENTRY -logVertex2i ( GLint x, GLint y ) +logVertex2i(GLint x, GLint y) { - SIG( "glVertex2i" ); - dllVertex2i( x, y ); + SIG("glVertex2i"); + dllVertex2i(x, y); } static void APIENTRY -logVertex2iv ( const GLint *v ) +logVertex2iv(const GLint *v) { - SIG( "glVertex2iv" ); - dllVertex2iv( v ); + SIG("glVertex2iv"); + dllVertex2iv(v); } static void APIENTRY -logVertex2s ( GLshort x, GLshort y ) +logVertex2s(GLshort x, GLshort y) { - SIG( "glVertex2s" ); - dllVertex2s( x, y ); + SIG("glVertex2s"); + dllVertex2s(x, y); } static void APIENTRY -logVertex2sv ( const GLshort *v ) +logVertex2sv(const GLshort *v) { - SIG( "glVertex2sv" ); - dllVertex2sv( v ); + SIG("glVertex2sv"); + dllVertex2sv(v); } static void APIENTRY -logVertex3d ( GLdouble x, GLdouble y, GLdouble z ) +logVertex3d(GLdouble x, GLdouble y, GLdouble z) { - SIG( "glVertex3d" ); - dllVertex3d( x, y, z ); + SIG("glVertex3d"); + dllVertex3d(x, y, z); } static void APIENTRY -logVertex3dv ( const GLdouble *v ) +logVertex3dv(const GLdouble *v) { - SIG( "glVertex3dv" ); - dllVertex3dv( v ); + SIG("glVertex3dv"); + dllVertex3dv(v); } static void APIENTRY -logVertex3f ( GLfloat x, GLfloat y, GLfloat z ) +logVertex3f(GLfloat x, GLfloat y, GLfloat z) { - SIG( "glVertex3f" ); - dllVertex3f( x, y, z ); + SIG("glVertex3f"); + dllVertex3f(x, y, z); } static void APIENTRY -logVertex3fv ( const GLfloat *v ) +logVertex3fv(const GLfloat *v) { - SIG( "glVertex3fv" ); - dllVertex3fv( v ); + SIG("glVertex3fv"); + dllVertex3fv(v); } static void APIENTRY -logVertex3i ( GLint x, GLint y, GLint z ) +logVertex3i(GLint x, GLint y, GLint z) { - SIG( "glVertex3i" ); - dllVertex3i( x, y, z ); + SIG("glVertex3i"); + dllVertex3i(x, y, z); } static void APIENTRY -logVertex3iv ( const GLint *v ) +logVertex3iv(const GLint *v) { - SIG( "glVertex3iv" ); - dllVertex3iv( v ); + SIG("glVertex3iv"); + dllVertex3iv(v); } static void APIENTRY -logVertex3s ( GLshort x, GLshort y, GLshort z ) +logVertex3s(GLshort x, GLshort y, GLshort z) { - SIG( "glVertex3s" ); - dllVertex3s( x, y, z ); + SIG("glVertex3s"); + dllVertex3s(x, y, z); } static void APIENTRY -logVertex3sv ( const GLshort *v ) +logVertex3sv(const GLshort *v) { - SIG( "glVertex3sv" ); - dllVertex3sv( v ); + SIG("glVertex3sv"); + dllVertex3sv(v); } static void APIENTRY -logVertex4d ( GLdouble x, GLdouble y, GLdouble z, GLdouble w ) +logVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w) { - SIG( "glVertex4d" ); - dllVertex4d( x, y, z, w ); + SIG("glVertex4d"); + dllVertex4d(x, y, z, w); } static void APIENTRY -logVertex4dv ( const GLdouble *v ) +logVertex4dv(const GLdouble *v) { - SIG( "glVertex4dv" ); - dllVertex4dv( v ); + SIG("glVertex4dv"); + dllVertex4dv(v); } static void APIENTRY -logVertex4f ( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) +logVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) { - SIG( "glVertex4f" ); - dllVertex4f( x, y, z, w ); + SIG("glVertex4f"); + dllVertex4f(x, y, z, w); } static void APIENTRY -logVertex4fv ( const GLfloat *v ) +logVertex4fv(const GLfloat *v) { - SIG( "glVertex4fv" ); - dllVertex4fv( v ); + SIG("glVertex4fv"); + dllVertex4fv(v); } static void APIENTRY -logVertex4i ( GLint x, GLint y, GLint z, GLint w ) +logVertex4i(GLint x, GLint y, GLint z, GLint w) { - SIG( "glVertex4i" ); - dllVertex4i( x, y, z, w ); + SIG("glVertex4i"); + dllVertex4i(x, y, z, w); } static void APIENTRY -logVertex4iv ( const GLint *v ) +logVertex4iv(const GLint *v) { - SIG( "glVertex4iv" ); - dllVertex4iv( v ); + SIG("glVertex4iv"); + dllVertex4iv(v); } static void APIENTRY -logVertex4s ( GLshort x, GLshort y, GLshort z, GLshort w ) +logVertex4s(GLshort x, GLshort y, GLshort z, GLshort w) { - SIG( "glVertex4s" ); - dllVertex4s( x, y, z, w ); + SIG("glVertex4s"); + dllVertex4s(x, y, z, w); } static void APIENTRY -logVertex4sv ( const GLshort *v ) +logVertex4sv(const GLshort *v) { - SIG( "glVertex4sv" ); - dllVertex4sv( v ); + SIG("glVertex4sv"); + dllVertex4sv(v); } static void APIENTRY -logVertexPointer ( GLint size, GLenum type, GLsizei stride, const void *pointer ) +logVertexPointer(GLint size, GLenum type, GLsizei stride, const void *pointer) { - SIG( "glVertexPointer" ); - dllVertexPointer( size, type, stride, pointer ); + SIG("glVertexPointer"); + dllVertexPointer(size, type, stride, pointer); } static void APIENTRY -logViewport ( GLint x, GLint y, GLsizei width, GLsizei height ) +logViewport(GLint x, GLint y, GLsizei width, GLsizei height) { - SIG( "glViewport" ); - dllViewport( x, y, width, height ); + SIG("glViewport"); + dllViewport(x, y, width, height); } /* * Unloads the specified DLL then nulls out all the proc pointers. */ void -QGL_Shutdown ( void ) +QGL_Shutdown(void) { - if ( glw_state.OpenGLLib ) + if (glw_state.OpenGLLib) { - dlclose( glw_state.OpenGLLib ); + dlclose(glw_state.OpenGLLib); glw_state.OpenGLLib = NULL; } glw_state.OpenGLLib = NULL; - qglAccum = NULL; - qglAlphaFunc = NULL; - qglAreTexturesResident = NULL; - qglArrayElement = NULL; - qglBegin = NULL; - qglBindTexture = NULL; - qglBitmap = NULL; - qglBlendFunc = NULL; - qglCallList = NULL; - qglCallLists = NULL; - qglClear = NULL; - qglClearAccum = NULL; - qglClearColor = NULL; - qglClearDepth = NULL; - qglClearIndex = NULL; - qglClearStencil = NULL; - qglClipPlane = NULL; - qglColor3b = NULL; - qglColor3bv = NULL; - qglColor3d = NULL; - qglColor3dv = NULL; - qglColor3f = NULL; - qglColor3fv = NULL; - qglColor3i = NULL; - qglColor3iv = NULL; - qglColor3s = NULL; - qglColor3sv = NULL; - qglColor3ub = NULL; - qglColor3ubv = NULL; - qglColor3ui = NULL; - qglColor3uiv = NULL; - qglColor3us = NULL; - qglColor3usv = NULL; - qglColor4b = NULL; - qglColor4bv = NULL; - qglColor4d = NULL; - qglColor4dv = NULL; - qglColor4f = NULL; - qglColor4fv = NULL; - qglColor4i = NULL; - qglColor4iv = NULL; - qglColor4s = NULL; - qglColor4sv = NULL; - qglColor4ub = NULL; - qglColor4ubv = NULL; - qglColor4ui = NULL; - qglColor4uiv = NULL; - qglColor4us = NULL; - qglColor4usv = NULL; - qglColorMask = NULL; - qglColorMaterial = NULL; - qglColorPointer = NULL; - qglCopyPixels = NULL; - qglCopyTexImage1D = NULL; - qglCopyTexImage2D = NULL; - qglCopyTexSubImage1D = NULL; - qglCopyTexSubImage2D = NULL; - qglCullFace = NULL; - qglDeleteLists = NULL; - qglDeleteTextures = NULL; - qglDepthFunc = NULL; - qglDepthMask = NULL; - qglDepthRange = NULL; - qglDisable = NULL; - qglDisableClientState = NULL; - qglDrawArrays = NULL; - qglDrawBuffer = NULL; - qglDrawElements = NULL; - qglDrawPixels = NULL; - qglEdgeFlag = NULL; - qglEdgeFlagPointer = NULL; - qglEdgeFlagv = NULL; - qglEnable = NULL; - qglEnableClientState = NULL; - qglEnd = NULL; - qglEndList = NULL; - qglEvalCoord1d = NULL; - qglEvalCoord1dv = NULL; - qglEvalCoord1f = NULL; - qglEvalCoord1fv = NULL; - qglEvalCoord2d = NULL; - qglEvalCoord2dv = NULL; - qglEvalCoord2f = NULL; - qglEvalCoord2fv = NULL; - qglEvalMesh1 = NULL; - qglEvalMesh2 = NULL; - qglEvalPoint1 = NULL; - qglEvalPoint2 = NULL; - qglFeedbackBuffer = NULL; - qglFinish = NULL; - qglFlush = NULL; - qglFogf = NULL; - qglFogfv = NULL; - qglFogi = NULL; - qglFogiv = NULL; - qglFrontFace = NULL; - qglFrustum = NULL; - qglGenLists = NULL; - qglGenTextures = NULL; - qglGetBooleanv = NULL; - qglGetClipPlane = NULL; - qglGetDoublev = NULL; - qglGetError = NULL; - qglGetFloatv = NULL; - qglGetIntegerv = NULL; - qglGetLightfv = NULL; - qglGetLightiv = NULL; - qglGetMapdv = NULL; - qglGetMapfv = NULL; - qglGetMapiv = NULL; - qglGetMaterialfv = NULL; - qglGetMaterialiv = NULL; - qglGetPixelMapfv = NULL; - qglGetPixelMapuiv = NULL; - qglGetPixelMapusv = NULL; - qglGetPointerv = NULL; - qglGetPolygonStipple = NULL; - qglGetString = NULL; - qglGetTexEnvfv = NULL; - qglGetTexEnviv = NULL; - qglGetTexGendv = NULL; - qglGetTexGenfv = NULL; - qglGetTexGeniv = NULL; - qglGetTexImage = NULL; - qglGetTexLevelParameterfv = NULL; - qglGetTexLevelParameteriv = NULL; - qglGetTexParameterfv = NULL; - qglGetTexParameteriv = NULL; - qglHint = NULL; - qglIndexMask = NULL; - qglIndexPointer = NULL; - qglIndexd = NULL; - qglIndexdv = NULL; - qglIndexf = NULL; - qglIndexfv = NULL; - qglIndexi = NULL; - qglIndexiv = NULL; - qglIndexs = NULL; - qglIndexsv = NULL; - qglIndexub = NULL; - qglIndexubv = NULL; - qglInitNames = NULL; - qglInterleavedArrays = NULL; - qglIsEnabled = NULL; - qglIsList = NULL; - qglIsTexture = NULL; - qglLightModelf = NULL; - qglLightModelfv = NULL; - qglLightModeli = NULL; - qglLightModeliv = NULL; - qglLightf = NULL; - qglLightfv = NULL; - qglLighti = NULL; - qglLightiv = NULL; - qglLineStipple = NULL; - qglLineWidth = NULL; - qglListBase = NULL; - qglLoadIdentity = NULL; - qglLoadMatrixd = NULL; - qglLoadMatrixf = NULL; - qglLoadName = NULL; - qglLogicOp = NULL; - qglMap1d = NULL; - qglMap1f = NULL; - qglMap2d = NULL; - qglMap2f = NULL; - qglMapGrid1d = NULL; - qglMapGrid1f = NULL; - qglMapGrid2d = NULL; - qglMapGrid2f = NULL; - qglMaterialf = NULL; - qglMaterialfv = NULL; - qglMateriali = NULL; - qglMaterialiv = NULL; - qglMatrixMode = NULL; - qglMultMatrixd = NULL; - qglMultMatrixf = NULL; - qglNewList = NULL; - qglNormal3b = NULL; - qglNormal3bv = NULL; - qglNormal3d = NULL; - qglNormal3dv = NULL; - qglNormal3f = NULL; - qglNormal3fv = NULL; - qglNormal3i = NULL; - qglNormal3iv = NULL; - qglNormal3s = NULL; - qglNormal3sv = NULL; - qglNormalPointer = NULL; - qglOrtho = NULL; - qglPassThrough = NULL; - qglPixelMapfv = NULL; - qglPixelMapuiv = NULL; - qglPixelMapusv = NULL; - qglPixelStoref = NULL; - qglPixelStorei = NULL; - qglPixelTransferf = NULL; - qglPixelTransferi = NULL; - qglPixelZoom = NULL; - qglPointSize = NULL; - qglPolygonMode = NULL; - qglPolygonOffset = NULL; - qglPolygonStipple = NULL; - qglPopAttrib = NULL; - qglPopClientAttrib = NULL; - qglPopMatrix = NULL; - qglPopName = NULL; - qglPrioritizeTextures = NULL; - qglPushAttrib = NULL; - qglPushClientAttrib = NULL; - qglPushMatrix = NULL; - qglPushName = NULL; - qglRasterPos2d = NULL; - qglRasterPos2dv = NULL; - qglRasterPos2f = NULL; - qglRasterPos2fv = NULL; - qglRasterPos2i = NULL; - qglRasterPos2iv = NULL; - qglRasterPos2s = NULL; - qglRasterPos2sv = NULL; - qglRasterPos3d = NULL; - qglRasterPos3dv = NULL; - qglRasterPos3f = NULL; - qglRasterPos3fv = NULL; - qglRasterPos3i = NULL; - qglRasterPos3iv = NULL; - qglRasterPos3s = NULL; - qglRasterPos3sv = NULL; - qglRasterPos4d = NULL; - qglRasterPos4dv = NULL; - qglRasterPos4f = NULL; - qglRasterPos4fv = NULL; - qglRasterPos4i = NULL; - qglRasterPos4iv = NULL; - qglRasterPos4s = NULL; - qglRasterPos4sv = NULL; - qglReadBuffer = NULL; - qglReadPixels = NULL; - qglRectd = NULL; - qglRectdv = NULL; - qglRectf = NULL; - qglRectfv = NULL; - qglRecti = NULL; - qglRectiv = NULL; - qglRects = NULL; - qglRectsv = NULL; - qglRenderMode = NULL; - qglRotated = NULL; - qglRotatef = NULL; - qglScaled = NULL; - qglScalef = NULL; - qglScissor = NULL; - qglSelectBuffer = NULL; - qglShadeModel = NULL; - qglStencilFunc = NULL; - qglStencilMask = NULL; - qglStencilOp = NULL; - qglTexCoord1d = NULL; - qglTexCoord1dv = NULL; - qglTexCoord1f = NULL; - qglTexCoord1fv = NULL; - qglTexCoord1i = NULL; - qglTexCoord1iv = NULL; - qglTexCoord1s = NULL; - qglTexCoord1sv = NULL; - qglTexCoord2d = NULL; - qglTexCoord2dv = NULL; - qglTexCoord2f = NULL; - qglTexCoord2fv = NULL; - qglTexCoord2i = NULL; - qglTexCoord2iv = NULL; - qglTexCoord2s = NULL; - qglTexCoord2sv = NULL; - qglTexCoord3d = NULL; - qglTexCoord3dv = NULL; - qglTexCoord3f = NULL; - qglTexCoord3fv = NULL; - qglTexCoord3i = NULL; - qglTexCoord3iv = NULL; - qglTexCoord3s = NULL; - qglTexCoord3sv = NULL; - qglTexCoord4d = NULL; - qglTexCoord4dv = NULL; - qglTexCoord4f = NULL; - qglTexCoord4fv = NULL; - qglTexCoord4i = NULL; - qglTexCoord4iv = NULL; - qglTexCoord4s = NULL; - qglTexCoord4sv = NULL; - qglTexCoordPointer = NULL; - qglTexEnvf = NULL; - qglTexEnvfv = NULL; - qglTexEnvi = NULL; - qglTexEnviv = NULL; - qglTexGend = NULL; - qglTexGendv = NULL; - qglTexGenf = NULL; - qglTexGenfv = NULL; - qglTexGeni = NULL; - qglTexGeniv = NULL; - qglTexImage1D = NULL; - qglTexImage2D = NULL; - qglTexParameterf = NULL; - qglTexParameterfv = NULL; - qglTexParameteri = NULL; - qglTexParameteriv = NULL; - qglTexSubImage1D = NULL; - qglTexSubImage2D = NULL; - qglTranslated = NULL; - qglTranslatef = NULL; - qglVertex2d = NULL; - qglVertex2dv = NULL; - qglVertex2f = NULL; - qglVertex2fv = NULL; - qglVertex2i = NULL; - qglVertex2iv = NULL; - qglVertex2s = NULL; - qglVertex2sv = NULL; - qglVertex3d = NULL; - qglVertex3dv = NULL; - qglVertex3f = NULL; - qglVertex3fv = NULL; - qglVertex3i = NULL; - qglVertex3iv = NULL; - qglVertex3s = NULL; - qglVertex3sv = NULL; - qglVertex4d = NULL; - qglVertex4dv = NULL; - qglVertex4f = NULL; - qglVertex4fv = NULL; - qglVertex4i = NULL; - qglVertex4iv = NULL; - qglVertex4s = NULL; - qglVertex4sv = NULL; - qglVertexPointer = NULL; - qglViewport = NULL; + qglAccum = NULL; + qglAlphaFunc = NULL; + qglAreTexturesResident = NULL; + qglArrayElement = NULL; + qglBegin = NULL; + qglBindTexture = NULL; + qglBitmap = NULL; + qglBlendFunc = NULL; + qglCallList = NULL; + qglCallLists = NULL; + qglClear = NULL; + qglClearAccum = NULL; + qglClearColor = NULL; + qglClearDepth = NULL; + qglClearIndex = NULL; + qglClearStencil = NULL; + qglClipPlane = NULL; + qglColor3b = NULL; + qglColor3bv = NULL; + qglColor3d = NULL; + qglColor3dv = NULL; + qglColor3f = NULL; + qglColor3fv = NULL; + qglColor3i = NULL; + qglColor3iv = NULL; + qglColor3s = NULL; + qglColor3sv = NULL; + qglColor3ub = NULL; + qglColor3ubv = NULL; + qglColor3ui = NULL; + qglColor3uiv = NULL; + qglColor3us = NULL; + qglColor3usv = NULL; + qglColor4b = NULL; + qglColor4bv = NULL; + qglColor4d = NULL; + qglColor4dv = NULL; + qglColor4f = NULL; + qglColor4fv = NULL; + qglColor4i = NULL; + qglColor4iv = NULL; + qglColor4s = NULL; + qglColor4sv = NULL; + qglColor4ub = NULL; + qglColor4ubv = NULL; + qglColor4ui = NULL; + qglColor4uiv = NULL; + qglColor4us = NULL; + qglColor4usv = NULL; + qglColorMask = NULL; + qglColorMaterial = NULL; + qglColorPointer = NULL; + qglCopyPixels = NULL; + qglCopyTexImage1D = NULL; + qglCopyTexImage2D = NULL; + qglCopyTexSubImage1D = NULL; + qglCopyTexSubImage2D = NULL; + qglCullFace = NULL; + qglDeleteLists = NULL; + qglDeleteTextures = NULL; + qglDepthFunc = NULL; + qglDepthMask = NULL; + qglDepthRange = NULL; + qglDisable = NULL; + qglDisableClientState = NULL; + qglDrawArrays = NULL; + qglDrawBuffer = NULL; + qglDrawElements = NULL; + qglDrawPixels = NULL; + qglEdgeFlag = NULL; + qglEdgeFlagPointer = NULL; + qglEdgeFlagv = NULL; + qglEnable = NULL; + qglEnableClientState = NULL; + qglEnd = NULL; + qglEndList = NULL; + qglEvalCoord1d = NULL; + qglEvalCoord1dv = NULL; + qglEvalCoord1f = NULL; + qglEvalCoord1fv = NULL; + qglEvalCoord2d = NULL; + qglEvalCoord2dv = NULL; + qglEvalCoord2f = NULL; + qglEvalCoord2fv = NULL; + qglEvalMesh1 = NULL; + qglEvalMesh2 = NULL; + qglEvalPoint1 = NULL; + qglEvalPoint2 = NULL; + qglFeedbackBuffer = NULL; + qglFinish = NULL; + qglFlush = NULL; + qglFogf = NULL; + qglFogfv = NULL; + qglFogi = NULL; + qglFogiv = NULL; + qglFrontFace = NULL; + qglFrustum = NULL; + qglGenLists = NULL; + qglGenTextures = NULL; + qglGetBooleanv = NULL; + qglGetClipPlane = NULL; + qglGetDoublev = NULL; + qglGetError = NULL; + qglGetFloatv = NULL; + qglGetIntegerv = NULL; + qglGetLightfv = NULL; + qglGetLightiv = NULL; + qglGetMapdv = NULL; + qglGetMapfv = NULL; + qglGetMapiv = NULL; + qglGetMaterialfv = NULL; + qglGetMaterialiv = NULL; + qglGetPixelMapfv = NULL; + qglGetPixelMapuiv = NULL; + qglGetPixelMapusv = NULL; + qglGetPointerv = NULL; + qglGetPolygonStipple = NULL; + qglGetString = NULL; + qglGetTexEnvfv = NULL; + qglGetTexEnviv = NULL; + qglGetTexGendv = NULL; + qglGetTexGenfv = NULL; + qglGetTexGeniv = NULL; + qglGetTexImage = NULL; + qglGetTexLevelParameterfv = NULL; + qglGetTexLevelParameteriv = NULL; + qglGetTexParameterfv = NULL; + qglGetTexParameteriv = NULL; + qglHint = NULL; + qglIndexMask = NULL; + qglIndexPointer = NULL; + qglIndexd = NULL; + qglIndexdv = NULL; + qglIndexf = NULL; + qglIndexfv = NULL; + qglIndexi = NULL; + qglIndexiv = NULL; + qglIndexs = NULL; + qglIndexsv = NULL; + qglIndexub = NULL; + qglIndexubv = NULL; + qglInitNames = NULL; + qglInterleavedArrays = NULL; + qglIsEnabled = NULL; + qglIsList = NULL; + qglIsTexture = NULL; + qglLightModelf = NULL; + qglLightModelfv = NULL; + qglLightModeli = NULL; + qglLightModeliv = NULL; + qglLightf = NULL; + qglLightfv = NULL; + qglLighti = NULL; + qglLightiv = NULL; + qglLineStipple = NULL; + qglLineWidth = NULL; + qglListBase = NULL; + qglLoadIdentity = NULL; + qglLoadMatrixd = NULL; + qglLoadMatrixf = NULL; + qglLoadName = NULL; + qglLogicOp = NULL; + qglMap1d = NULL; + qglMap1f = NULL; + qglMap2d = NULL; + qglMap2f = NULL; + qglMapGrid1d = NULL; + qglMapGrid1f = NULL; + qglMapGrid2d = NULL; + qglMapGrid2f = NULL; + qglMaterialf = NULL; + qglMaterialfv = NULL; + qglMateriali = NULL; + qglMaterialiv = NULL; + qglMatrixMode = NULL; + qglMultMatrixd = NULL; + qglMultMatrixf = NULL; + qglNewList = NULL; + qglNormal3b = NULL; + qglNormal3bv = NULL; + qglNormal3d = NULL; + qglNormal3dv = NULL; + qglNormal3f = NULL; + qglNormal3fv = NULL; + qglNormal3i = NULL; + qglNormal3iv = NULL; + qglNormal3s = NULL; + qglNormal3sv = NULL; + qglNormalPointer = NULL; + qglOrtho = NULL; + qglPassThrough = NULL; + qglPixelMapfv = NULL; + qglPixelMapuiv = NULL; + qglPixelMapusv = NULL; + qglPixelStoref = NULL; + qglPixelStorei = NULL; + qglPixelTransferf = NULL; + qglPixelTransferi = NULL; + qglPixelZoom = NULL; + qglPointSize = NULL; + qglPolygonMode = NULL; + qglPolygonOffset = NULL; + qglPolygonStipple = NULL; + qglPopAttrib = NULL; + qglPopClientAttrib = NULL; + qglPopMatrix = NULL; + qglPopName = NULL; + qglPrioritizeTextures = NULL; + qglPushAttrib = NULL; + qglPushClientAttrib = NULL; + qglPushMatrix = NULL; + qglPushName = NULL; + qglRasterPos2d = NULL; + qglRasterPos2dv = NULL; + qglRasterPos2f = NULL; + qglRasterPos2fv = NULL; + qglRasterPos2i = NULL; + qglRasterPos2iv = NULL; + qglRasterPos2s = NULL; + qglRasterPos2sv = NULL; + qglRasterPos3d = NULL; + qglRasterPos3dv = NULL; + qglRasterPos3f = NULL; + qglRasterPos3fv = NULL; + qglRasterPos3i = NULL; + qglRasterPos3iv = NULL; + qglRasterPos3s = NULL; + qglRasterPos3sv = NULL; + qglRasterPos4d = NULL; + qglRasterPos4dv = NULL; + qglRasterPos4f = NULL; + qglRasterPos4fv = NULL; + qglRasterPos4i = NULL; + qglRasterPos4iv = NULL; + qglRasterPos4s = NULL; + qglRasterPos4sv = NULL; + qglReadBuffer = NULL; + qglReadPixels = NULL; + qglRectd = NULL; + qglRectdv = NULL; + qglRectf = NULL; + qglRectfv = NULL; + qglRecti = NULL; + qglRectiv = NULL; + qglRects = NULL; + qglRectsv = NULL; + qglRenderMode = NULL; + qglRotated = NULL; + qglRotatef = NULL; + qglScaled = NULL; + qglScalef = NULL; + qglScissor = NULL; + qglSelectBuffer = NULL; + qglShadeModel = NULL; + qglStencilFunc = NULL; + qglStencilMask = NULL; + qglStencilOp = NULL; + qglTexCoord1d = NULL; + qglTexCoord1dv = NULL; + qglTexCoord1f = NULL; + qglTexCoord1fv = NULL; + qglTexCoord1i = NULL; + qglTexCoord1iv = NULL; + qglTexCoord1s = NULL; + qglTexCoord1sv = NULL; + qglTexCoord2d = NULL; + qglTexCoord2dv = NULL; + qglTexCoord2f = NULL; + qglTexCoord2fv = NULL; + qglTexCoord2i = NULL; + qglTexCoord2iv = NULL; + qglTexCoord2s = NULL; + qglTexCoord2sv = NULL; + qglTexCoord3d = NULL; + qglTexCoord3dv = NULL; + qglTexCoord3f = NULL; + qglTexCoord3fv = NULL; + qglTexCoord3i = NULL; + qglTexCoord3iv = NULL; + qglTexCoord3s = NULL; + qglTexCoord3sv = NULL; + qglTexCoord4d = NULL; + qglTexCoord4dv = NULL; + qglTexCoord4f = NULL; + qglTexCoord4fv = NULL; + qglTexCoord4i = NULL; + qglTexCoord4iv = NULL; + qglTexCoord4s = NULL; + qglTexCoord4sv = NULL; + qglTexCoordPointer = NULL; + qglTexEnvf = NULL; + qglTexEnvfv = NULL; + qglTexEnvi = NULL; + qglTexEnviv = NULL; + qglTexGend = NULL; + qglTexGendv = NULL; + qglTexGenf = NULL; + qglTexGenfv = NULL; + qglTexGeni = NULL; + qglTexGeniv = NULL; + qglTexImage1D = NULL; + qglTexImage2D = NULL; + qglTexParameterf = NULL; + qglTexParameterfv = NULL; + qglTexParameteri = NULL; + qglTexParameteriv = NULL; + qglTexSubImage1D = NULL; + qglTexSubImage2D = NULL; + qglTranslated = NULL; + qglTranslatef = NULL; + qglVertex2d = NULL; + qglVertex2dv = NULL; + qglVertex2f = NULL; + qglVertex2fv = NULL; + qglVertex2i = NULL; + qglVertex2iv = NULL; + qglVertex2s = NULL; + qglVertex2sv = NULL; + qglVertex3d = NULL; + qglVertex3dv = NULL; + qglVertex3f = NULL; + qglVertex3fv = NULL; + qglVertex3i = NULL; + qglVertex3iv = NULL; + qglVertex3s = NULL; + qglVertex3sv = NULL; + qglVertex4d = NULL; + qglVertex4dv = NULL; + qglVertex4f = NULL; + qglVertex4fv = NULL; + qglVertex4i = NULL; + qglVertex4iv = NULL; + qglVertex4s = NULL; + qglVertex4sv = NULL; + qglVertexPointer = NULL; + qglViewport = NULL; } -#define GPA( a ) dlsym( glw_state.OpenGLLib, a ) +#define GPA(a) dlsym(glw_state.OpenGLLib, a) void * -qwglGetProcAddress ( char *symbol ) +qwglGetProcAddress(char *symbol) { - if ( glw_state.OpenGLLib ) + if (glw_state.OpenGLLib) { - return ( GPA( symbol ) ); + return GPA(symbol); } - return ( NULL ); + return NULL; } /* @@ -3479,381 +3632,385 @@ qwglGetProcAddress ( char *symbol ) * might be. */ qboolean -QGL_Init ( const char *dllname ) +QGL_Init(const char *dllname) { - if ( glw_state.OpenGLLib ) + if (glw_state.OpenGLLib) { QGL_Shutdown(); } - if ( ( glw_state.OpenGLLib = dlopen( dllname, RTLD_LAZY ) ) == 0 ) + if ((glw_state.OpenGLLib = dlopen(dllname, RTLD_LAZY)) == 0) { - char fn [ MAX_OSPATH ]; - char *path; + char fn[MAX_OSPATH]; + char *path; /* try basedir next */ - path = ri.Cvar_Get( "basedir", ".", CVAR_NOSET )->string; + path = ri.Cvar_Get("basedir", ".", CVAR_NOSET)->string; - snprintf( fn, MAX_OSPATH, "%s/%s", path, dllname ); + snprintf(fn, MAX_OSPATH, "%s/%s", path, dllname); - if ( ( glw_state.OpenGLLib = dlopen( fn, RTLD_LAZY ) ) == 0 ) + if ((glw_state.OpenGLLib = dlopen(fn, RTLD_LAZY)) == 0) { - ri.Con_Printf( PRINT_ALL, "%s\n", dlerror() ); - ri.Con_Printf( PRINT_ALL, "Trying hardcoded default libGL\n" ); - if ( ( glw_state.OpenGLLib = dlopen( "libGL.so.1", RTLD_LAZY ) ) == 0) - { - ri.Con_Printf( PRINT_ALL, "%s\n", dlerror() ); - return ( false ); - } else { - ri.Cvar_Set("gl_driver", "libGL.so.1"); - Com_Printf( "Using libGL.so.1 for OpenGL.\n" ); - } - } else { + ri.Con_Printf(PRINT_ALL, "%s\n", dlerror()); + ri.Con_Printf(PRINT_ALL, "Trying hardcoded default libGL\n"); - Com_Printf( "Using %s for OpenGL.\n", fn ); + if ((glw_state.OpenGLLib = dlopen("libGL.so.1", RTLD_LAZY)) == 0) + { + ri.Con_Printf(PRINT_ALL, "%s\n", dlerror()); + return false; + } + else + { + ri.Cvar_Set("gl_driver", "libGL.so.1"); + Com_Printf("Using libGL.so.1 for OpenGL.\n"); + } + } + else + { + Com_Printf("Using %s for OpenGL.\n", fn); } } else { - Com_Printf( "Using %s for OpenGL.\n", dllname ); + Com_Printf("Using %s for OpenGL.\n", dllname); } - qglAccum = dllAccum = GPA( "glAccum" ); - qglAlphaFunc = dllAlphaFunc = GPA( "glAlphaFunc" ); - qglAreTexturesResident = dllAreTexturesResident = GPA( "glAreTexturesResident" ); - qglArrayElement = dllArrayElement = GPA( "glArrayElement" ); - qglBegin = dllBegin = GPA( "glBegin" ); - qglBindTexture = dllBindTexture = GPA( "glBindTexture" ); - qglBitmap = dllBitmap = GPA( "glBitmap" ); - qglBlendFunc = dllBlendFunc = GPA( "glBlendFunc" ); - qglCallList = dllCallList = GPA( "glCallList" ); - qglCallLists = dllCallLists = GPA( "glCallLists" ); - qglClear = dllClear = GPA( "glClear" ); - qglClearAccum = dllClearAccum = GPA( "glClearAccum" ); - qglClearColor = dllClearColor = GPA( "glClearColor" ); - qglClearDepth = dllClearDepth = GPA( "glClearDepth" ); - qglClearIndex = dllClearIndex = GPA( "glClearIndex" ); - qglClearStencil = dllClearStencil = GPA( "glClearStencil" ); - qglClipPlane = dllClipPlane = GPA( "glClipPlane" ); - qglColor3b = dllColor3b = GPA( "glColor3b" ); - qglColor3bv = dllColor3bv = GPA( "glColor3bv" ); - qglColor3d = dllColor3d = GPA( "glColor3d" ); - qglColor3dv = dllColor3dv = GPA( "glColor3dv" ); - qglColor3f = dllColor3f = GPA( "glColor3f" ); - qglColor3fv = dllColor3fv = GPA( "glColor3fv" ); - qglColor3i = dllColor3i = GPA( "glColor3i" ); - qglColor3iv = dllColor3iv = GPA( "glColor3iv" ); - qglColor3s = dllColor3s = GPA( "glColor3s" ); - qglColor3sv = dllColor3sv = GPA( "glColor3sv" ); - qglColor3ub = dllColor3ub = GPA( "glColor3ub" ); - qglColor3ubv = dllColor3ubv = GPA( "glColor3ubv" ); - qglColor3ui = dllColor3ui = GPA( "glColor3ui" ); - qglColor3uiv = dllColor3uiv = GPA( "glColor3uiv" ); - qglColor3us = dllColor3us = GPA( "glColor3us" ); - qglColor3usv = dllColor3usv = GPA( "glColor3usv" ); - qglColor4b = dllColor4b = GPA( "glColor4b" ); - qglColor4bv = dllColor4bv = GPA( "glColor4bv" ); - qglColor4d = dllColor4d = GPA( "glColor4d" ); - qglColor4dv = dllColor4dv = GPA( "glColor4dv" ); - qglColor4f = dllColor4f = GPA( "glColor4f" ); - qglColor4fv = dllColor4fv = GPA( "glColor4fv" ); - qglColor4i = dllColor4i = GPA( "glColor4i" ); - qglColor4iv = dllColor4iv = GPA( "glColor4iv" ); - qglColor4s = dllColor4s = GPA( "glColor4s" ); - qglColor4sv = dllColor4sv = GPA( "glColor4sv" ); - qglColor4ub = dllColor4ub = GPA( "glColor4ub" ); - qglColor4ubv = dllColor4ubv = GPA( "glColor4ubv" ); - qglColor4ui = dllColor4ui = GPA( "glColor4ui" ); - qglColor4uiv = dllColor4uiv = GPA( "glColor4uiv" ); - qglColor4us = dllColor4us = GPA( "glColor4us" ); - qglColor4usv = dllColor4usv = GPA( "glColor4usv" ); - qglColorMask = dllColorMask = GPA( "glColorMask" ); - qglColorMaterial = dllColorMaterial = GPA( "glColorMaterial" ); - qglColorPointer = dllColorPointer = GPA( "glColorPointer" ); - qglCopyPixels = dllCopyPixels = GPA( "glCopyPixels" ); - qglCopyTexImage1D = dllCopyTexImage1D = GPA( "glCopyTexImage1D" ); - qglCopyTexImage2D = dllCopyTexImage2D = GPA( "glCopyTexImage2D" ); - qglCopyTexSubImage1D = dllCopyTexSubImage1D = GPA( "glCopyTexSubImage1D" ); - qglCopyTexSubImage2D = dllCopyTexSubImage2D = GPA( "glCopyTexSubImage2D" ); - qglCullFace = dllCullFace = GPA( "glCullFace" ); - qglDeleteLists = dllDeleteLists = GPA( "glDeleteLists" ); - qglDeleteTextures = dllDeleteTextures = GPA( "glDeleteTextures" ); - qglDepthFunc = dllDepthFunc = GPA( "glDepthFunc" ); - qglDepthMask = dllDepthMask = GPA( "glDepthMask" ); - qglDepthRange = dllDepthRange = GPA( "glDepthRange" ); - qglDisable = dllDisable = GPA( "glDisable" ); - qglDisableClientState = dllDisableClientState = GPA( "glDisableClientState" ); - qglDrawArrays = dllDrawArrays = GPA( "glDrawArrays" ); - qglDrawBuffer = dllDrawBuffer = GPA( "glDrawBuffer" ); - qglDrawElements = dllDrawElements = GPA( "glDrawElements" ); - qglDrawPixels = dllDrawPixels = GPA( "glDrawPixels" ); - qglEdgeFlag = dllEdgeFlag = GPA( "glEdgeFlag" ); - qglEdgeFlagPointer = dllEdgeFlagPointer = GPA( "glEdgeFlagPointer" ); - qglEdgeFlagv = dllEdgeFlagv = GPA( "glEdgeFlagv" ); - qglEnable = dllEnable = GPA( "glEnable" ); - qglEnableClientState = dllEnableClientState = GPA( "glEnableClientState" ); - qglEnd = dllEnd = GPA( "glEnd" ); - qglEndList = dllEndList = GPA( "glEndList" ); - qglEvalCoord1d = dllEvalCoord1d = GPA( "glEvalCoord1d" ); - qglEvalCoord1dv = dllEvalCoord1dv = GPA( "glEvalCoord1dv" ); - qglEvalCoord1f = dllEvalCoord1f = GPA( "glEvalCoord1f" ); - qglEvalCoord1fv = dllEvalCoord1fv = GPA( "glEvalCoord1fv" ); - qglEvalCoord2d = dllEvalCoord2d = GPA( "glEvalCoord2d" ); - qglEvalCoord2dv = dllEvalCoord2dv = GPA( "glEvalCoord2dv" ); - qglEvalCoord2f = dllEvalCoord2f = GPA( "glEvalCoord2f" ); - qglEvalCoord2fv = dllEvalCoord2fv = GPA( "glEvalCoord2fv" ); - qglEvalMesh1 = dllEvalMesh1 = GPA( "glEvalMesh1" ); - qglEvalMesh2 = dllEvalMesh2 = GPA( "glEvalMesh2" ); - qglEvalPoint1 = dllEvalPoint1 = GPA( "glEvalPoint1" ); - qglEvalPoint2 = dllEvalPoint2 = GPA( "glEvalPoint2" ); - qglFeedbackBuffer = dllFeedbackBuffer = GPA( "glFeedbackBuffer" ); - qglFinish = dllFinish = GPA( "glFinish" ); - qglFlush = dllFlush = GPA( "glFlush" ); - qglFogf = dllFogf = GPA( "glFogf" ); - qglFogfv = dllFogfv = GPA( "glFogfv" ); - qglFogi = dllFogi = GPA( "glFogi" ); - qglFogiv = dllFogiv = GPA( "glFogiv" ); - qglFrontFace = dllFrontFace = GPA( "glFrontFace" ); - qglFrustum = dllFrustum = GPA( "glFrustum" ); - qglGenLists = dllGenLists = GPA( "glGenLists" ); - qglGenTextures = dllGenTextures = GPA( "glGenTextures" ); - qglGetBooleanv = dllGetBooleanv = GPA( "glGetBooleanv" ); - qglGetClipPlane = dllGetClipPlane = GPA( "glGetClipPlane" ); - qglGetDoublev = dllGetDoublev = GPA( "glGetDoublev" ); - qglGetError = dllGetError = GPA( "glGetError" ); - qglGetFloatv = dllGetFloatv = GPA( "glGetFloatv" ); - qglGetIntegerv = dllGetIntegerv = GPA( "glGetIntegerv" ); - qglGetLightfv = dllGetLightfv = GPA( "glGetLightfv" ); - qglGetLightiv = dllGetLightiv = GPA( "glGetLightiv" ); - qglGetMapdv = dllGetMapdv = GPA( "glGetMapdv" ); - qglGetMapfv = dllGetMapfv = GPA( "glGetMapfv" ); - qglGetMapiv = dllGetMapiv = GPA( "glGetMapiv" ); - qglGetMaterialfv = dllGetMaterialfv = GPA( "glGetMaterialfv" ); - qglGetMaterialiv = dllGetMaterialiv = GPA( "glGetMaterialiv" ); - qglGetPixelMapfv = dllGetPixelMapfv = GPA( "glGetPixelMapfv" ); - qglGetPixelMapuiv = dllGetPixelMapuiv = GPA( "glGetPixelMapuiv" ); - qglGetPixelMapusv = dllGetPixelMapusv = GPA( "glGetPixelMapusv" ); - qglGetPointerv = dllGetPointerv = GPA( "glGetPointerv" ); - qglGetPolygonStipple = dllGetPolygonStipple = GPA( "glGetPolygonStipple" ); - qglGetString = dllGetString = GPA( "glGetString" ); - qglGetTexEnvfv = dllGetTexEnvfv = GPA( "glGetTexEnvfv" ); - qglGetTexEnviv = dllGetTexEnviv = GPA( "glGetTexEnviv" ); - qglGetTexGendv = dllGetTexGendv = GPA( "glGetTexGendv" ); - qglGetTexGenfv = dllGetTexGenfv = GPA( "glGetTexGenfv" ); - qglGetTexGeniv = dllGetTexGeniv = GPA( "glGetTexGeniv" ); - qglGetTexImage = dllGetTexImage = GPA( "glGetTexImage" ); - qglGetTexLevelParameterfv = dllGetTexLevelParameterfv = GPA( "glGetLevelParameterfv" ); - qglGetTexLevelParameteriv = dllGetTexLevelParameteriv = GPA( "glGetLevelParameteriv" ); - qglGetTexParameterfv = dllGetTexParameterfv = GPA( "glGetTexParameterfv" ); - qglGetTexParameteriv = dllGetTexParameteriv = GPA( "glGetTexParameteriv" ); - qglHint = dllHint = GPA( "glHint" ); - qglIndexMask = dllIndexMask = GPA( "glIndexMask" ); - qglIndexPointer = dllIndexPointer = GPA( "glIndexPointer" ); - qglIndexd = dllIndexd = GPA( "glIndexd" ); - qglIndexdv = dllIndexdv = GPA( "glIndexdv" ); - qglIndexf = dllIndexf = GPA( "glIndexf" ); - qglIndexfv = dllIndexfv = GPA( "glIndexfv" ); - qglIndexi = dllIndexi = GPA( "glIndexi" ); - qglIndexiv = dllIndexiv = GPA( "glIndexiv" ); - qglIndexs = dllIndexs = GPA( "glIndexs" ); - qglIndexsv = dllIndexsv = GPA( "glIndexsv" ); - qglIndexub = dllIndexub = GPA( "glIndexub" ); - qglIndexubv = dllIndexubv = GPA( "glIndexubv" ); - qglInitNames = dllInitNames = GPA( "glInitNames" ); - qglInterleavedArrays = dllInterleavedArrays = GPA( "glInterleavedArrays" ); - qglIsEnabled = dllIsEnabled = GPA( "glIsEnabled" ); - qglIsList = dllIsList = GPA( "glIsList" ); - qglIsTexture = dllIsTexture = GPA( "glIsTexture" ); - qglLightModelf = dllLightModelf = GPA( "glLightModelf" ); - qglLightModelfv = dllLightModelfv = GPA( "glLightModelfv" ); - qglLightModeli = dllLightModeli = GPA( "glLightModeli" ); - qglLightModeliv = dllLightModeliv = GPA( "glLightModeliv" ); - qglLightf = dllLightf = GPA( "glLightf" ); - qglLightfv = dllLightfv = GPA( "glLightfv" ); - qglLighti = dllLighti = GPA( "glLighti" ); - qglLightiv = dllLightiv = GPA( "glLightiv" ); - qglLineStipple = dllLineStipple = GPA( "glLineStipple" ); - qglLineWidth = dllLineWidth = GPA( "glLineWidth" ); - qglListBase = dllListBase = GPA( "glListBase" ); - qglLoadIdentity = dllLoadIdentity = GPA( "glLoadIdentity" ); - qglLoadMatrixd = dllLoadMatrixd = GPA( "glLoadMatrixd" ); - qglLoadMatrixf = dllLoadMatrixf = GPA( "glLoadMatrixf" ); - qglLoadName = dllLoadName = GPA( "glLoadName" ); - qglLogicOp = dllLogicOp = GPA( "glLogicOp" ); - qglMap1d = dllMap1d = GPA( "glMap1d" ); - qglMap1f = dllMap1f = GPA( "glMap1f" ); - qglMap2d = dllMap2d = GPA( "glMap2d" ); - qglMap2f = dllMap2f = GPA( "glMap2f" ); - qglMapGrid1d = dllMapGrid1d = GPA( "glMapGrid1d" ); - qglMapGrid1f = dllMapGrid1f = GPA( "glMapGrid1f" ); - qglMapGrid2d = dllMapGrid2d = GPA( "glMapGrid2d" ); - qglMapGrid2f = dllMapGrid2f = GPA( "glMapGrid2f" ); - qglMaterialf = dllMaterialf = GPA( "glMaterialf" ); - qglMaterialfv = dllMaterialfv = GPA( "glMaterialfv" ); - qglMateriali = dllMateriali = GPA( "glMateriali" ); - qglMaterialiv = dllMaterialiv = GPA( "glMaterialiv" ); - qglMatrixMode = dllMatrixMode = GPA( "glMatrixMode" ); - qglMultMatrixd = dllMultMatrixd = GPA( "glMultMatrixd" ); - qglMultMatrixf = dllMultMatrixf = GPA( "glMultMatrixf" ); - qglNewList = dllNewList = GPA( "glNewList" ); - qglNormal3b = dllNormal3b = GPA( "glNormal3b" ); - qglNormal3bv = dllNormal3bv = GPA( "glNormal3bv" ); - qglNormal3d = dllNormal3d = GPA( "glNormal3d" ); - qglNormal3dv = dllNormal3dv = GPA( "glNormal3dv" ); - qglNormal3f = dllNormal3f = GPA( "glNormal3f" ); - qglNormal3fv = dllNormal3fv = GPA( "glNormal3fv" ); - qglNormal3i = dllNormal3i = GPA( "glNormal3i" ); - qglNormal3iv = dllNormal3iv = GPA( "glNormal3iv" ); - qglNormal3s = dllNormal3s = GPA( "glNormal3s" ); - qglNormal3sv = dllNormal3sv = GPA( "glNormal3sv" ); - qglNormalPointer = dllNormalPointer = GPA( "glNormalPointer" ); - qglOrtho = dllOrtho = GPA( "glOrtho" ); - qglPassThrough = dllPassThrough = GPA( "glPassThrough" ); - qglPixelMapfv = dllPixelMapfv = GPA( "glPixelMapfv" ); - qglPixelMapuiv = dllPixelMapuiv = GPA( "glPixelMapuiv" ); - qglPixelMapusv = dllPixelMapusv = GPA( "glPixelMapusv" ); - qglPixelStoref = dllPixelStoref = GPA( "glPixelStoref" ); - qglPixelStorei = dllPixelStorei = GPA( "glPixelStorei" ); - qglPixelTransferf = dllPixelTransferf = GPA( "glPixelTransferf" ); - qglPixelTransferi = dllPixelTransferi = GPA( "glPixelTransferi" ); - qglPixelZoom = dllPixelZoom = GPA( "glPixelZoom" ); - qglPointSize = dllPointSize = GPA( "glPointSize" ); - qglPolygonMode = dllPolygonMode = GPA( "glPolygonMode" ); - qglPolygonOffset = dllPolygonOffset = GPA( "glPolygonOffset" ); - qglPolygonStipple = dllPolygonStipple = GPA( "glPolygonStipple" ); - qglPopAttrib = dllPopAttrib = GPA( "glPopAttrib" ); - qglPopClientAttrib = dllPopClientAttrib = GPA( "glPopClientAttrib" ); - qglPopMatrix = dllPopMatrix = GPA( "glPopMatrix" ); - qglPopName = dllPopName = GPA( "glPopName" ); - qglPrioritizeTextures = dllPrioritizeTextures = GPA( "glPrioritizeTextures" ); - qglPushAttrib = dllPushAttrib = GPA( "glPushAttrib" ); - qglPushClientAttrib = dllPushClientAttrib = GPA( "glPushClientAttrib" ); - qglPushMatrix = dllPushMatrix = GPA( "glPushMatrix" ); - qglPushName = dllPushName = GPA( "glPushName" ); - qglRasterPos2d = dllRasterPos2d = GPA( "glRasterPos2d" ); - qglRasterPos2dv = dllRasterPos2dv = GPA( "glRasterPos2dv" ); - qglRasterPos2f = dllRasterPos2f = GPA( "glRasterPos2f" ); - qglRasterPos2fv = dllRasterPos2fv = GPA( "glRasterPos2fv" ); - qglRasterPos2i = dllRasterPos2i = GPA( "glRasterPos2i" ); - qglRasterPos2iv = dllRasterPos2iv = GPA( "glRasterPos2iv" ); - qglRasterPos2s = dllRasterPos2s = GPA( "glRasterPos2s" ); - qglRasterPos2sv = dllRasterPos2sv = GPA( "glRasterPos2sv" ); - qglRasterPos3d = dllRasterPos3d = GPA( "glRasterPos3d" ); - qglRasterPos3dv = dllRasterPos3dv = GPA( "glRasterPos3dv" ); - qglRasterPos3f = dllRasterPos3f = GPA( "glRasterPos3f" ); - qglRasterPos3fv = dllRasterPos3fv = GPA( "glRasterPos3fv" ); - qglRasterPos3i = dllRasterPos3i = GPA( "glRasterPos3i" ); - qglRasterPos3iv = dllRasterPos3iv = GPA( "glRasterPos3iv" ); - qglRasterPos3s = dllRasterPos3s = GPA( "glRasterPos3s" ); - qglRasterPos3sv = dllRasterPos3sv = GPA( "glRasterPos3sv" ); - qglRasterPos4d = dllRasterPos4d = GPA( "glRasterPos4d" ); - qglRasterPos4dv = dllRasterPos4dv = GPA( "glRasterPos4dv" ); - qglRasterPos4f = dllRasterPos4f = GPA( "glRasterPos4f" ); - qglRasterPos4fv = dllRasterPos4fv = GPA( "glRasterPos4fv" ); - qglRasterPos4i = dllRasterPos4i = GPA( "glRasterPos4i" ); - qglRasterPos4iv = dllRasterPos4iv = GPA( "glRasterPos4iv" ); - qglRasterPos4s = dllRasterPos4s = GPA( "glRasterPos4s" ); - qglRasterPos4sv = dllRasterPos4sv = GPA( "glRasterPos4sv" ); - qglReadBuffer = dllReadBuffer = GPA( "glReadBuffer" ); - qglReadPixels = dllReadPixels = GPA( "glReadPixels" ); - qglRectd = dllRectd = GPA( "glRectd" ); - qglRectdv = dllRectdv = GPA( "glRectdv" ); - qglRectf = dllRectf = GPA( "glRectf" ); - qglRectfv = dllRectfv = GPA( "glRectfv" ); - qglRecti = dllRecti = GPA( "glRecti" ); - qglRectiv = dllRectiv = GPA( "glRectiv" ); - qglRects = dllRects = GPA( "glRects" ); - qglRectsv = dllRectsv = GPA( "glRectsv" ); - qglRenderMode = dllRenderMode = GPA( "glRenderMode" ); - qglRotated = dllRotated = GPA( "glRotated" ); - qglRotatef = dllRotatef = GPA( "glRotatef" ); - qglScaled = dllScaled = GPA( "glScaled" ); - qglScalef = dllScalef = GPA( "glScalef" ); - qglScissor = dllScissor = GPA( "glScissor" ); - qglSelectBuffer = dllSelectBuffer = GPA( "glSelectBuffer" ); - qglShadeModel = dllShadeModel = GPA( "glShadeModel" ); - qglStencilFunc = dllStencilFunc = GPA( "glStencilFunc" ); - qglStencilMask = dllStencilMask = GPA( "glStencilMask" ); - qglStencilOp = dllStencilOp = GPA( "glStencilOp" ); - qglTexCoord1d = dllTexCoord1d = GPA( "glTexCoord1d" ); - qglTexCoord1dv = dllTexCoord1dv = GPA( "glTexCoord1dv" ); - qglTexCoord1f = dllTexCoord1f = GPA( "glTexCoord1f" ); - qglTexCoord1fv = dllTexCoord1fv = GPA( "glTexCoord1fv" ); - qglTexCoord1i = dllTexCoord1i = GPA( "glTexCoord1i" ); - qglTexCoord1iv = dllTexCoord1iv = GPA( "glTexCoord1iv" ); - qglTexCoord1s = dllTexCoord1s = GPA( "glTexCoord1s" ); - qglTexCoord1sv = dllTexCoord1sv = GPA( "glTexCoord1sv" ); - qglTexCoord2d = dllTexCoord2d = GPA( "glTexCoord2d" ); - qglTexCoord2dv = dllTexCoord2dv = GPA( "glTexCoord2dv" ); - qglTexCoord2f = dllTexCoord2f = GPA( "glTexCoord2f" ); - qglTexCoord2fv = dllTexCoord2fv = GPA( "glTexCoord2fv" ); - qglTexCoord2i = dllTexCoord2i = GPA( "glTexCoord2i" ); - qglTexCoord2iv = dllTexCoord2iv = GPA( "glTexCoord2iv" ); - qglTexCoord2s = dllTexCoord2s = GPA( "glTexCoord2s" ); - qglTexCoord2sv = dllTexCoord2sv = GPA( "glTexCoord2sv" ); - qglTexCoord3d = dllTexCoord3d = GPA( "glTexCoord3d" ); - qglTexCoord3dv = dllTexCoord3dv = GPA( "glTexCoord3dv" ); - qglTexCoord3f = dllTexCoord3f = GPA( "glTexCoord3f" ); - qglTexCoord3fv = dllTexCoord3fv = GPA( "glTexCoord3fv" ); - qglTexCoord3i = dllTexCoord3i = GPA( "glTexCoord3i" ); - qglTexCoord3iv = dllTexCoord3iv = GPA( "glTexCoord3iv" ); - qglTexCoord3s = dllTexCoord3s = GPA( "glTexCoord3s" ); - qglTexCoord3sv = dllTexCoord3sv = GPA( "glTexCoord3sv" ); - qglTexCoord4d = dllTexCoord4d = GPA( "glTexCoord4d" ); - qglTexCoord4dv = dllTexCoord4dv = GPA( "glTexCoord4dv" ); - qglTexCoord4f = dllTexCoord4f = GPA( "glTexCoord4f" ); - qglTexCoord4fv = dllTexCoord4fv = GPA( "glTexCoord4fv" ); - qglTexCoord4i = dllTexCoord4i = GPA( "glTexCoord4i" ); - qglTexCoord4iv = dllTexCoord4iv = GPA( "glTexCoord4iv" ); - qglTexCoord4s = dllTexCoord4s = GPA( "glTexCoord4s" ); - qglTexCoord4sv = dllTexCoord4sv = GPA( "glTexCoord4sv" ); - qglTexCoordPointer = dllTexCoordPointer = GPA( "glTexCoordPointer" ); - qglTexEnvf = dllTexEnvf = GPA( "glTexEnvf" ); - qglTexEnvfv = dllTexEnvfv = GPA( "glTexEnvfv" ); - qglTexEnvi = dllTexEnvi = GPA( "glTexEnvi" ); - qglTexEnviv = dllTexEnviv = GPA( "glTexEnviv" ); - qglTexGend = dllTexGend = GPA( "glTexGend" ); - qglTexGendv = dllTexGendv = GPA( "glTexGendv" ); - qglTexGenf = dllTexGenf = GPA( "glTexGenf" ); - qglTexGenfv = dllTexGenfv = GPA( "glTexGenfv" ); - qglTexGeni = dllTexGeni = GPA( "glTexGeni" ); - qglTexGeniv = dllTexGeniv = GPA( "glTexGeniv" ); - qglTexImage1D = dllTexImage1D = GPA( "glTexImage1D" ); - qglTexImage2D = dllTexImage2D = GPA( "glTexImage2D" ); - qglTexParameterf = dllTexParameterf = GPA( "glTexParameterf" ); - qglTexParameterfv = dllTexParameterfv = GPA( "glTexParameterfv" ); - qglTexParameteri = dllTexParameteri = GPA( "glTexParameteri" ); - qglTexParameteriv = dllTexParameteriv = GPA( "glTexParameteriv" ); - qglTexSubImage1D = dllTexSubImage1D = GPA( "glTexSubImage1D" ); - qglTexSubImage2D = dllTexSubImage2D = GPA( "glTexSubImage2D" ); - qglTranslated = dllTranslated = GPA( "glTranslated" ); - qglTranslatef = dllTranslatef = GPA( "glTranslatef" ); - qglVertex2d = dllVertex2d = GPA( "glVertex2d" ); - qglVertex2dv = dllVertex2dv = GPA( "glVertex2dv" ); - qglVertex2f = dllVertex2f = GPA( "glVertex2f" ); - qglVertex2fv = dllVertex2fv = GPA( "glVertex2fv" ); - qglVertex2i = dllVertex2i = GPA( "glVertex2i" ); - qglVertex2iv = dllVertex2iv = GPA( "glVertex2iv" ); - qglVertex2s = dllVertex2s = GPA( "glVertex2s" ); - qglVertex2sv = dllVertex2sv = GPA( "glVertex2sv" ); - qglVertex3d = dllVertex3d = GPA( "glVertex3d" ); - qglVertex3dv = dllVertex3dv = GPA( "glVertex3dv" ); - qglVertex3f = dllVertex3f = GPA( "glVertex3f" ); - qglVertex3fv = dllVertex3fv = GPA( "glVertex3fv" ); - qglVertex3i = dllVertex3i = GPA( "glVertex3i" ); - qglVertex3iv = dllVertex3iv = GPA( "glVertex3iv" ); - qglVertex3s = dllVertex3s = GPA( "glVertex3s" ); - qglVertex3sv = dllVertex3sv = GPA( "glVertex3sv" ); - qglVertex4d = dllVertex4d = GPA( "glVertex4d" ); - qglVertex4dv = dllVertex4dv = GPA( "glVertex4dv" ); - qglVertex4f = dllVertex4f = GPA( "glVertex4f" ); - qglVertex4fv = dllVertex4fv = GPA( "glVertex4fv" ); - qglVertex4i = dllVertex4i = GPA( "glVertex4i" ); - qglVertex4iv = dllVertex4iv = GPA( "glVertex4iv" ); - qglVertex4s = dllVertex4s = GPA( "glVertex4s" ); - qglVertex4sv = dllVertex4sv = GPA( "glVertex4sv" ); - qglVertexPointer = dllVertexPointer = GPA( "glVertexPointer" ); - qglViewport = dllViewport = GPA( "glViewport" ); + qglAccum = dllAccum = GPA("glAccum"); + qglAlphaFunc = dllAlphaFunc = GPA("glAlphaFunc"); + qglAreTexturesResident = dllAreTexturesResident = GPA("glAreTexturesResident"); + qglArrayElement = dllArrayElement = GPA("glArrayElement"); + qglBegin = dllBegin = GPA("glBegin"); + qglBindTexture = dllBindTexture = GPA("glBindTexture"); + qglBitmap = dllBitmap = GPA("glBitmap"); + qglBlendFunc = dllBlendFunc = GPA("glBlendFunc"); + qglCallList = dllCallList = GPA("glCallList"); + qglCallLists = dllCallLists = GPA("glCallLists"); + qglClear = dllClear = GPA("glClear"); + qglClearAccum = dllClearAccum = GPA("glClearAccum"); + qglClearColor = dllClearColor = GPA("glClearColor"); + qglClearDepth = dllClearDepth = GPA("glClearDepth"); + qglClearIndex = dllClearIndex = GPA("glClearIndex"); + qglClearStencil = dllClearStencil = GPA("glClearStencil"); + qglClipPlane = dllClipPlane = GPA("glClipPlane"); + qglColor3b = dllColor3b = GPA("glColor3b"); + qglColor3bv = dllColor3bv = GPA("glColor3bv"); + qglColor3d = dllColor3d = GPA("glColor3d"); + qglColor3dv = dllColor3dv = GPA("glColor3dv"); + qglColor3f = dllColor3f = GPA("glColor3f"); + qglColor3fv = dllColor3fv = GPA("glColor3fv"); + qglColor3i = dllColor3i = GPA("glColor3i"); + qglColor3iv = dllColor3iv = GPA("glColor3iv"); + qglColor3s = dllColor3s = GPA("glColor3s"); + qglColor3sv = dllColor3sv = GPA("glColor3sv"); + qglColor3ub = dllColor3ub = GPA("glColor3ub"); + qglColor3ubv = dllColor3ubv = GPA("glColor3ubv"); + qglColor3ui = dllColor3ui = GPA("glColor3ui"); + qglColor3uiv = dllColor3uiv = GPA("glColor3uiv"); + qglColor3us = dllColor3us = GPA("glColor3us"); + qglColor3usv = dllColor3usv = GPA("glColor3usv"); + qglColor4b = dllColor4b = GPA("glColor4b"); + qglColor4bv = dllColor4bv = GPA("glColor4bv"); + qglColor4d = dllColor4d = GPA("glColor4d"); + qglColor4dv = dllColor4dv = GPA("glColor4dv"); + qglColor4f = dllColor4f = GPA("glColor4f"); + qglColor4fv = dllColor4fv = GPA("glColor4fv"); + qglColor4i = dllColor4i = GPA("glColor4i"); + qglColor4iv = dllColor4iv = GPA("glColor4iv"); + qglColor4s = dllColor4s = GPA("glColor4s"); + qglColor4sv = dllColor4sv = GPA("glColor4sv"); + qglColor4ub = dllColor4ub = GPA("glColor4ub"); + qglColor4ubv = dllColor4ubv = GPA("glColor4ubv"); + qglColor4ui = dllColor4ui = GPA("glColor4ui"); + qglColor4uiv = dllColor4uiv = GPA("glColor4uiv"); + qglColor4us = dllColor4us = GPA("glColor4us"); + qglColor4usv = dllColor4usv = GPA("glColor4usv"); + qglColorMask = dllColorMask = GPA("glColorMask"); + qglColorMaterial = dllColorMaterial = GPA("glColorMaterial"); + qglColorPointer = dllColorPointer = GPA("glColorPointer"); + qglCopyPixels = dllCopyPixels = GPA("glCopyPixels"); + qglCopyTexImage1D = dllCopyTexImage1D = GPA("glCopyTexImage1D"); + qglCopyTexImage2D = dllCopyTexImage2D = GPA("glCopyTexImage2D"); + qglCopyTexSubImage1D = dllCopyTexSubImage1D = GPA("glCopyTexSubImage1D"); + qglCopyTexSubImage2D = dllCopyTexSubImage2D = GPA("glCopyTexSubImage2D"); + qglCullFace = dllCullFace = GPA("glCullFace"); + qglDeleteLists = dllDeleteLists = GPA("glDeleteLists"); + qglDeleteTextures = dllDeleteTextures = GPA("glDeleteTextures"); + qglDepthFunc = dllDepthFunc = GPA("glDepthFunc"); + qglDepthMask = dllDepthMask = GPA("glDepthMask"); + qglDepthRange = dllDepthRange = GPA("glDepthRange"); + qglDisable = dllDisable = GPA("glDisable"); + qglDisableClientState = dllDisableClientState = GPA("glDisableClientState"); + qglDrawArrays = dllDrawArrays = GPA("glDrawArrays"); + qglDrawBuffer = dllDrawBuffer = GPA("glDrawBuffer"); + qglDrawElements = dllDrawElements = GPA("glDrawElements"); + qglDrawPixels = dllDrawPixels = GPA("glDrawPixels"); + qglEdgeFlag = dllEdgeFlag = GPA("glEdgeFlag"); + qglEdgeFlagPointer = dllEdgeFlagPointer = GPA("glEdgeFlagPointer"); + qglEdgeFlagv = dllEdgeFlagv = GPA("glEdgeFlagv"); + qglEnable = dllEnable = GPA("glEnable"); + qglEnableClientState = dllEnableClientState = GPA("glEnableClientState"); + qglEnd = dllEnd = GPA("glEnd"); + qglEndList = dllEndList = GPA("glEndList"); + qglEvalCoord1d = dllEvalCoord1d = GPA("glEvalCoord1d"); + qglEvalCoord1dv = dllEvalCoord1dv = GPA("glEvalCoord1dv"); + qglEvalCoord1f = dllEvalCoord1f = GPA("glEvalCoord1f"); + qglEvalCoord1fv = dllEvalCoord1fv = GPA("glEvalCoord1fv"); + qglEvalCoord2d = dllEvalCoord2d = GPA("glEvalCoord2d"); + qglEvalCoord2dv = dllEvalCoord2dv = GPA("glEvalCoord2dv"); + qglEvalCoord2f = dllEvalCoord2f = GPA("glEvalCoord2f"); + qglEvalCoord2fv = dllEvalCoord2fv = GPA("glEvalCoord2fv"); + qglEvalMesh1 = dllEvalMesh1 = GPA("glEvalMesh1"); + qglEvalMesh2 = dllEvalMesh2 = GPA("glEvalMesh2"); + qglEvalPoint1 = dllEvalPoint1 = GPA("glEvalPoint1"); + qglEvalPoint2 = dllEvalPoint2 = GPA("glEvalPoint2"); + qglFeedbackBuffer = dllFeedbackBuffer = GPA("glFeedbackBuffer"); + qglFinish = dllFinish = GPA("glFinish"); + qglFlush = dllFlush = GPA("glFlush"); + qglFogf = dllFogf = GPA("glFogf"); + qglFogfv = dllFogfv = GPA("glFogfv"); + qglFogi = dllFogi = GPA("glFogi"); + qglFogiv = dllFogiv = GPA("glFogiv"); + qglFrontFace = dllFrontFace = GPA("glFrontFace"); + qglFrustum = dllFrustum = GPA("glFrustum"); + qglGenLists = dllGenLists = GPA("glGenLists"); + qglGenTextures = dllGenTextures = GPA("glGenTextures"); + qglGetBooleanv = dllGetBooleanv = GPA("glGetBooleanv"); + qglGetClipPlane = dllGetClipPlane = GPA("glGetClipPlane"); + qglGetDoublev = dllGetDoublev = GPA("glGetDoublev"); + qglGetError = dllGetError = GPA("glGetError"); + qglGetFloatv = dllGetFloatv = GPA("glGetFloatv"); + qglGetIntegerv = dllGetIntegerv = GPA("glGetIntegerv"); + qglGetLightfv = dllGetLightfv = GPA("glGetLightfv"); + qglGetLightiv = dllGetLightiv = GPA("glGetLightiv"); + qglGetMapdv = dllGetMapdv = GPA("glGetMapdv"); + qglGetMapfv = dllGetMapfv = GPA("glGetMapfv"); + qglGetMapiv = dllGetMapiv = GPA("glGetMapiv"); + qglGetMaterialfv = dllGetMaterialfv = GPA("glGetMaterialfv"); + qglGetMaterialiv = dllGetMaterialiv = GPA("glGetMaterialiv"); + qglGetPixelMapfv = dllGetPixelMapfv = GPA("glGetPixelMapfv"); + qglGetPixelMapuiv = dllGetPixelMapuiv = GPA("glGetPixelMapuiv"); + qglGetPixelMapusv = dllGetPixelMapusv = GPA("glGetPixelMapusv"); + qglGetPointerv = dllGetPointerv = GPA("glGetPointerv"); + qglGetPolygonStipple = dllGetPolygonStipple = GPA("glGetPolygonStipple"); + qglGetString = dllGetString = GPA("glGetString"); + qglGetTexEnvfv = dllGetTexEnvfv = GPA("glGetTexEnvfv"); + qglGetTexEnviv = dllGetTexEnviv = GPA("glGetTexEnviv"); + qglGetTexGendv = dllGetTexGendv = GPA("glGetTexGendv"); + qglGetTexGenfv = dllGetTexGenfv = GPA("glGetTexGenfv"); + qglGetTexGeniv = dllGetTexGeniv = GPA("glGetTexGeniv"); + qglGetTexImage = dllGetTexImage = GPA("glGetTexImage"); + qglGetTexLevelParameterfv = dllGetTexLevelParameterfv = GPA("glGetLevelParameterfv"); + qglGetTexLevelParameteriv = dllGetTexLevelParameteriv = GPA("glGetLevelParameteriv"); + qglGetTexParameterfv = dllGetTexParameterfv = GPA("glGetTexParameterfv"); + qglGetTexParameteriv = dllGetTexParameteriv = GPA("glGetTexParameteriv"); + qglHint = dllHint = GPA("glHint"); + qglIndexMask = dllIndexMask = GPA("glIndexMask"); + qglIndexPointer = dllIndexPointer = GPA("glIndexPointer"); + qglIndexd = dllIndexd = GPA("glIndexd"); + qglIndexdv = dllIndexdv = GPA("glIndexdv"); + qglIndexf = dllIndexf = GPA("glIndexf"); + qglIndexfv = dllIndexfv = GPA("glIndexfv"); + qglIndexi = dllIndexi = GPA("glIndexi"); + qglIndexiv = dllIndexiv = GPA("glIndexiv"); + qglIndexs = dllIndexs = GPA("glIndexs"); + qglIndexsv = dllIndexsv = GPA("glIndexsv"); + qglIndexub = dllIndexub = GPA("glIndexub"); + qglIndexubv = dllIndexubv = GPA("glIndexubv"); + qglInitNames = dllInitNames = GPA("glInitNames"); + qglInterleavedArrays = dllInterleavedArrays = GPA("glInterleavedArrays"); + qglIsEnabled = dllIsEnabled = GPA("glIsEnabled"); + qglIsList = dllIsList = GPA("glIsList"); + qglIsTexture = dllIsTexture = GPA("glIsTexture"); + qglLightModelf = dllLightModelf = GPA("glLightModelf"); + qglLightModelfv = dllLightModelfv = GPA("glLightModelfv"); + qglLightModeli = dllLightModeli = GPA("glLightModeli"); + qglLightModeliv = dllLightModeliv = GPA("glLightModeliv"); + qglLightf = dllLightf = GPA("glLightf"); + qglLightfv = dllLightfv = GPA("glLightfv"); + qglLighti = dllLighti = GPA("glLighti"); + qglLightiv = dllLightiv = GPA("glLightiv"); + qglLineStipple = dllLineStipple = GPA("glLineStipple"); + qglLineWidth = dllLineWidth = GPA("glLineWidth"); + qglListBase = dllListBase = GPA("glListBase"); + qglLoadIdentity = dllLoadIdentity = GPA("glLoadIdentity"); + qglLoadMatrixd = dllLoadMatrixd = GPA("glLoadMatrixd"); + qglLoadMatrixf = dllLoadMatrixf = GPA("glLoadMatrixf"); + qglLoadName = dllLoadName = GPA("glLoadName"); + qglLogicOp = dllLogicOp = GPA("glLogicOp"); + qglMap1d = dllMap1d = GPA("glMap1d"); + qglMap1f = dllMap1f = GPA("glMap1f"); + qglMap2d = dllMap2d = GPA("glMap2d"); + qglMap2f = dllMap2f = GPA("glMap2f"); + qglMapGrid1d = dllMapGrid1d = GPA("glMapGrid1d"); + qglMapGrid1f = dllMapGrid1f = GPA("glMapGrid1f"); + qglMapGrid2d = dllMapGrid2d = GPA("glMapGrid2d"); + qglMapGrid2f = dllMapGrid2f = GPA("glMapGrid2f"); + qglMaterialf = dllMaterialf = GPA("glMaterialf"); + qglMaterialfv = dllMaterialfv = GPA("glMaterialfv"); + qglMateriali = dllMateriali = GPA("glMateriali"); + qglMaterialiv = dllMaterialiv = GPA("glMaterialiv"); + qglMatrixMode = dllMatrixMode = GPA("glMatrixMode"); + qglMultMatrixd = dllMultMatrixd = GPA("glMultMatrixd"); + qglMultMatrixf = dllMultMatrixf = GPA("glMultMatrixf"); + qglNewList = dllNewList = GPA("glNewList"); + qglNormal3b = dllNormal3b = GPA("glNormal3b"); + qglNormal3bv = dllNormal3bv = GPA("glNormal3bv"); + qglNormal3d = dllNormal3d = GPA("glNormal3d"); + qglNormal3dv = dllNormal3dv = GPA("glNormal3dv"); + qglNormal3f = dllNormal3f = GPA("glNormal3f"); + qglNormal3fv = dllNormal3fv = GPA("glNormal3fv"); + qglNormal3i = dllNormal3i = GPA("glNormal3i"); + qglNormal3iv = dllNormal3iv = GPA("glNormal3iv"); + qglNormal3s = dllNormal3s = GPA("glNormal3s"); + qglNormal3sv = dllNormal3sv = GPA("glNormal3sv"); + qglNormalPointer = dllNormalPointer = GPA("glNormalPointer"); + qglOrtho = dllOrtho = GPA("glOrtho"); + qglPassThrough = dllPassThrough = GPA("glPassThrough"); + qglPixelMapfv = dllPixelMapfv = GPA("glPixelMapfv"); + qglPixelMapuiv = dllPixelMapuiv = GPA("glPixelMapuiv"); + qglPixelMapusv = dllPixelMapusv = GPA("glPixelMapusv"); + qglPixelStoref = dllPixelStoref = GPA("glPixelStoref"); + qglPixelStorei = dllPixelStorei = GPA("glPixelStorei"); + qglPixelTransferf = dllPixelTransferf = GPA("glPixelTransferf"); + qglPixelTransferi = dllPixelTransferi = GPA("glPixelTransferi"); + qglPixelZoom = dllPixelZoom = GPA("glPixelZoom"); + qglPointSize = dllPointSize = GPA("glPointSize"); + qglPolygonMode = dllPolygonMode = GPA("glPolygonMode"); + qglPolygonOffset = dllPolygonOffset = GPA("glPolygonOffset"); + qglPolygonStipple = dllPolygonStipple = GPA("glPolygonStipple"); + qglPopAttrib = dllPopAttrib = GPA("glPopAttrib"); + qglPopClientAttrib = dllPopClientAttrib = GPA("glPopClientAttrib"); + qglPopMatrix = dllPopMatrix = GPA("glPopMatrix"); + qglPopName = dllPopName = GPA("glPopName"); + qglPrioritizeTextures = dllPrioritizeTextures = GPA("glPrioritizeTextures"); + qglPushAttrib = dllPushAttrib = GPA("glPushAttrib"); + qglPushClientAttrib = dllPushClientAttrib = GPA("glPushClientAttrib"); + qglPushMatrix = dllPushMatrix = GPA("glPushMatrix"); + qglPushName = dllPushName = GPA("glPushName"); + qglRasterPos2d = dllRasterPos2d = GPA("glRasterPos2d"); + qglRasterPos2dv = dllRasterPos2dv = GPA("glRasterPos2dv"); + qglRasterPos2f = dllRasterPos2f = GPA("glRasterPos2f"); + qglRasterPos2fv = dllRasterPos2fv = GPA("glRasterPos2fv"); + qglRasterPos2i = dllRasterPos2i = GPA("glRasterPos2i"); + qglRasterPos2iv = dllRasterPos2iv = GPA("glRasterPos2iv"); + qglRasterPos2s = dllRasterPos2s = GPA("glRasterPos2s"); + qglRasterPos2sv = dllRasterPos2sv = GPA("glRasterPos2sv"); + qglRasterPos3d = dllRasterPos3d = GPA("glRasterPos3d"); + qglRasterPos3dv = dllRasterPos3dv = GPA("glRasterPos3dv"); + qglRasterPos3f = dllRasterPos3f = GPA("glRasterPos3f"); + qglRasterPos3fv = dllRasterPos3fv = GPA("glRasterPos3fv"); + qglRasterPos3i = dllRasterPos3i = GPA("glRasterPos3i"); + qglRasterPos3iv = dllRasterPos3iv = GPA("glRasterPos3iv"); + qglRasterPos3s = dllRasterPos3s = GPA("glRasterPos3s"); + qglRasterPos3sv = dllRasterPos3sv = GPA("glRasterPos3sv"); + qglRasterPos4d = dllRasterPos4d = GPA("glRasterPos4d"); + qglRasterPos4dv = dllRasterPos4dv = GPA("glRasterPos4dv"); + qglRasterPos4f = dllRasterPos4f = GPA("glRasterPos4f"); + qglRasterPos4fv = dllRasterPos4fv = GPA("glRasterPos4fv"); + qglRasterPos4i = dllRasterPos4i = GPA("glRasterPos4i"); + qglRasterPos4iv = dllRasterPos4iv = GPA("glRasterPos4iv"); + qglRasterPos4s = dllRasterPos4s = GPA("glRasterPos4s"); + qglRasterPos4sv = dllRasterPos4sv = GPA("glRasterPos4sv"); + qglReadBuffer = dllReadBuffer = GPA("glReadBuffer"); + qglReadPixels = dllReadPixels = GPA("glReadPixels"); + qglRectd = dllRectd = GPA("glRectd"); + qglRectdv = dllRectdv = GPA("glRectdv"); + qglRectf = dllRectf = GPA("glRectf"); + qglRectfv = dllRectfv = GPA("glRectfv"); + qglRecti = dllRecti = GPA("glRecti"); + qglRectiv = dllRectiv = GPA("glRectiv"); + qglRects = dllRects = GPA("glRects"); + qglRectsv = dllRectsv = GPA("glRectsv"); + qglRenderMode = dllRenderMode = GPA("glRenderMode"); + qglRotated = dllRotated = GPA("glRotated"); + qglRotatef = dllRotatef = GPA("glRotatef"); + qglScaled = dllScaled = GPA("glScaled"); + qglScalef = dllScalef = GPA("glScalef"); + qglScissor = dllScissor = GPA("glScissor"); + qglSelectBuffer = dllSelectBuffer = GPA("glSelectBuffer"); + qglShadeModel = dllShadeModel = GPA("glShadeModel"); + qglStencilFunc = dllStencilFunc = GPA("glStencilFunc"); + qglStencilMask = dllStencilMask = GPA("glStencilMask"); + qglStencilOp = dllStencilOp = GPA("glStencilOp"); + qglTexCoord1d = dllTexCoord1d = GPA("glTexCoord1d"); + qglTexCoord1dv = dllTexCoord1dv = GPA("glTexCoord1dv"); + qglTexCoord1f = dllTexCoord1f = GPA("glTexCoord1f"); + qglTexCoord1fv = dllTexCoord1fv = GPA("glTexCoord1fv"); + qglTexCoord1i = dllTexCoord1i = GPA("glTexCoord1i"); + qglTexCoord1iv = dllTexCoord1iv = GPA("glTexCoord1iv"); + qglTexCoord1s = dllTexCoord1s = GPA("glTexCoord1s"); + qglTexCoord1sv = dllTexCoord1sv = GPA("glTexCoord1sv"); + qglTexCoord2d = dllTexCoord2d = GPA("glTexCoord2d"); + qglTexCoord2dv = dllTexCoord2dv = GPA("glTexCoord2dv"); + qglTexCoord2f = dllTexCoord2f = GPA("glTexCoord2f"); + qglTexCoord2fv = dllTexCoord2fv = GPA("glTexCoord2fv"); + qglTexCoord2i = dllTexCoord2i = GPA("glTexCoord2i"); + qglTexCoord2iv = dllTexCoord2iv = GPA("glTexCoord2iv"); + qglTexCoord2s = dllTexCoord2s = GPA("glTexCoord2s"); + qglTexCoord2sv = dllTexCoord2sv = GPA("glTexCoord2sv"); + qglTexCoord3d = dllTexCoord3d = GPA("glTexCoord3d"); + qglTexCoord3dv = dllTexCoord3dv = GPA("glTexCoord3dv"); + qglTexCoord3f = dllTexCoord3f = GPA("glTexCoord3f"); + qglTexCoord3fv = dllTexCoord3fv = GPA("glTexCoord3fv"); + qglTexCoord3i = dllTexCoord3i = GPA("glTexCoord3i"); + qglTexCoord3iv = dllTexCoord3iv = GPA("glTexCoord3iv"); + qglTexCoord3s = dllTexCoord3s = GPA("glTexCoord3s"); + qglTexCoord3sv = dllTexCoord3sv = GPA("glTexCoord3sv"); + qglTexCoord4d = dllTexCoord4d = GPA("glTexCoord4d"); + qglTexCoord4dv = dllTexCoord4dv = GPA("glTexCoord4dv"); + qglTexCoord4f = dllTexCoord4f = GPA("glTexCoord4f"); + qglTexCoord4fv = dllTexCoord4fv = GPA("glTexCoord4fv"); + qglTexCoord4i = dllTexCoord4i = GPA("glTexCoord4i"); + qglTexCoord4iv = dllTexCoord4iv = GPA("glTexCoord4iv"); + qglTexCoord4s = dllTexCoord4s = GPA("glTexCoord4s"); + qglTexCoord4sv = dllTexCoord4sv = GPA("glTexCoord4sv"); + qglTexCoordPointer = dllTexCoordPointer = GPA("glTexCoordPointer"); + qglTexEnvf = dllTexEnvf = GPA("glTexEnvf"); + qglTexEnvfv = dllTexEnvfv = GPA("glTexEnvfv"); + qglTexEnvi = dllTexEnvi = GPA("glTexEnvi"); + qglTexEnviv = dllTexEnviv = GPA("glTexEnviv"); + qglTexGend = dllTexGend = GPA("glTexGend"); + qglTexGendv = dllTexGendv = GPA("glTexGendv"); + qglTexGenf = dllTexGenf = GPA("glTexGenf"); + qglTexGenfv = dllTexGenfv = GPA("glTexGenfv"); + qglTexGeni = dllTexGeni = GPA("glTexGeni"); + qglTexGeniv = dllTexGeniv = GPA("glTexGeniv"); + qglTexImage1D = dllTexImage1D = GPA("glTexImage1D"); + qglTexImage2D = dllTexImage2D = GPA("glTexImage2D"); + qglTexParameterf = dllTexParameterf = GPA("glTexParameterf"); + qglTexParameterfv = dllTexParameterfv = GPA("glTexParameterfv"); + qglTexParameteri = dllTexParameteri = GPA("glTexParameteri"); + qglTexParameteriv = dllTexParameteriv = GPA("glTexParameteriv"); + qglTexSubImage1D = dllTexSubImage1D = GPA("glTexSubImage1D"); + qglTexSubImage2D = dllTexSubImage2D = GPA("glTexSubImage2D"); + qglTranslated = dllTranslated = GPA("glTranslated"); + qglTranslatef = dllTranslatef = GPA("glTranslatef"); + qglVertex2d = dllVertex2d = GPA("glVertex2d"); + qglVertex2dv = dllVertex2dv = GPA("glVertex2dv"); + qglVertex2f = dllVertex2f = GPA("glVertex2f"); + qglVertex2fv = dllVertex2fv = GPA("glVertex2fv"); + qglVertex2i = dllVertex2i = GPA("glVertex2i"); + qglVertex2iv = dllVertex2iv = GPA("glVertex2iv"); + qglVertex2s = dllVertex2s = GPA("glVertex2s"); + qglVertex2sv = dllVertex2sv = GPA("glVertex2sv"); + qglVertex3d = dllVertex3d = GPA("glVertex3d"); + qglVertex3dv = dllVertex3dv = GPA("glVertex3dv"); + qglVertex3f = dllVertex3f = GPA("glVertex3f"); + qglVertex3fv = dllVertex3fv = GPA("glVertex3fv"); + qglVertex3i = dllVertex3i = GPA("glVertex3i"); + qglVertex3iv = dllVertex3iv = GPA("glVertex3iv"); + qglVertex3s = dllVertex3s = GPA("glVertex3s"); + qglVertex3sv = dllVertex3sv = GPA("glVertex3sv"); + qglVertex4d = dllVertex4d = GPA("glVertex4d"); + qglVertex4dv = dllVertex4dv = GPA("glVertex4dv"); + qglVertex4f = dllVertex4f = GPA("glVertex4f"); + qglVertex4fv = dllVertex4fv = GPA("glVertex4fv"); + qglVertex4i = dllVertex4i = GPA("glVertex4i"); + qglVertex4iv = dllVertex4iv = GPA("glVertex4iv"); + qglVertex4s = dllVertex4s = GPA("glVertex4s"); + qglVertex4sv = dllVertex4sv = GPA("glVertex4sv"); + qglVertexPointer = dllVertexPointer = GPA("glVertexPointer"); + qglViewport = dllViewport = GPA("glViewport"); qglLockArraysEXT = 0; qglUnlockArraysEXT = 0; @@ -3866,711 +4023,712 @@ QGL_Init ( const char *dllname ) qglActiveTextureARB = 0; qglClientActiveTextureARB = 0; - return ( true ); + return true; } void -GLimp_EnableLogging ( qboolean enable ) +GLimp_EnableLogging(qboolean enable) { - if ( enable ) + if (enable) { - if ( !glw_state.log_fp ) + if (!glw_state.log_fp) { struct tm *newtime; time_t aclock; - char buffer [ 1024 ]; + char buffer[1024]; - time( &aclock ); - newtime = localtime( &aclock ); + time(&aclock); + newtime = localtime(&aclock); - asctime( newtime ); + asctime(newtime); - Com_sprintf( buffer, sizeof ( buffer ), "%s/gl.log", ri.FS_Gamedir() ); - glw_state.log_fp = fopen( buffer, "wt" ); + Com_sprintf(buffer, sizeof(buffer), "%s/gl.log", ri.FS_Gamedir()); + glw_state.log_fp = fopen(buffer, "wt"); - fprintf( glw_state.log_fp, "%s\n", asctime( newtime ) ); + fprintf(glw_state.log_fp, "%s\n", asctime(newtime)); } - qglAccum = logAccum; - qglAlphaFunc = logAlphaFunc; - qglAreTexturesResident = logAreTexturesResident; - qglArrayElement = logArrayElement; - qglBegin = logBegin; - qglBindTexture = logBindTexture; - qglBitmap = logBitmap; - qglBlendFunc = logBlendFunc; - qglCallList = logCallList; - qglCallLists = logCallLists; - qglClear = logClear; - qglClearAccum = logClearAccum; - qglClearColor = logClearColor; - qglClearDepth = logClearDepth; - qglClearIndex = logClearIndex; - qglClearStencil = logClearStencil; - qglClipPlane = logClipPlane; - qglColor3b = logColor3b; - qglColor3bv = logColor3bv; - qglColor3d = logColor3d; - qglColor3dv = logColor3dv; - qglColor3f = logColor3f; - qglColor3fv = logColor3fv; - qglColor3i = logColor3i; - qglColor3iv = logColor3iv; - qglColor3s = logColor3s; - qglColor3sv = logColor3sv; - qglColor3ub = logColor3ub; - qglColor3ubv = logColor3ubv; - qglColor3ui = logColor3ui; - qglColor3uiv = logColor3uiv; - qglColor3us = logColor3us; - qglColor3usv = logColor3usv; - qglColor4b = logColor4b; - qglColor4bv = logColor4bv; - qglColor4d = logColor4d; - qglColor4dv = logColor4dv; - qglColor4f = logColor4f; - qglColor4fv = logColor4fv; - qglColor4i = logColor4i; - qglColor4iv = logColor4iv; - qglColor4s = logColor4s; - qglColor4sv = logColor4sv; - qglColor4ub = logColor4ub; - qglColor4ubv = logColor4ubv; - qglColor4ui = logColor4ui; - qglColor4uiv = logColor4uiv; - qglColor4us = logColor4us; - qglColor4usv = logColor4usv; - qglColorMask = logColorMask; - qglColorMaterial = logColorMaterial; - qglColorPointer = logColorPointer; - qglCopyPixels = logCopyPixels; - qglCopyTexImage1D = logCopyTexImage1D; - qglCopyTexImage2D = logCopyTexImage2D; - qglCopyTexSubImage1D = logCopyTexSubImage1D; - qglCopyTexSubImage2D = logCopyTexSubImage2D; - qglCullFace = logCullFace; - qglDeleteLists = logDeleteLists; - qglDeleteTextures = logDeleteTextures; - qglDepthFunc = logDepthFunc; - qglDepthMask = logDepthMask; - qglDepthRange = logDepthRange; - qglDisable = logDisable; - qglDisableClientState = logDisableClientState; - qglDrawArrays = logDrawArrays; - qglDrawBuffer = logDrawBuffer; - qglDrawElements = logDrawElements; - qglDrawPixels = logDrawPixels; - qglEdgeFlag = logEdgeFlag; - qglEdgeFlagPointer = logEdgeFlagPointer; - qglEdgeFlagv = logEdgeFlagv; - qglEnable = logEnable; - qglEnableClientState = logEnableClientState; - qglEnd = logEnd; - qglEndList = logEndList; - qglEvalCoord1d = logEvalCoord1d; - qglEvalCoord1dv = logEvalCoord1dv; - qglEvalCoord1f = logEvalCoord1f; - qglEvalCoord1fv = logEvalCoord1fv; - qglEvalCoord2d = logEvalCoord2d; - qglEvalCoord2dv = logEvalCoord2dv; - qglEvalCoord2f = logEvalCoord2f; - qglEvalCoord2fv = logEvalCoord2fv; - qglEvalMesh1 = logEvalMesh1; - qglEvalMesh2 = logEvalMesh2; - qglEvalPoint1 = logEvalPoint1; - qglEvalPoint2 = logEvalPoint2; - qglFeedbackBuffer = logFeedbackBuffer; - qglFinish = logFinish; - qglFlush = logFlush; - qglFogf = logFogf; - qglFogfv = logFogfv; - qglFogi = logFogi; - qglFogiv = logFogiv; - qglFrontFace = logFrontFace; - qglFrustum = logFrustum; - qglGenLists = logGenLists; - qglGenTextures = logGenTextures; - qglGetBooleanv = logGetBooleanv; - qglGetClipPlane = logGetClipPlane; - qglGetDoublev = logGetDoublev; - qglGetError = logGetError; - qglGetFloatv = logGetFloatv; - qglGetIntegerv = logGetIntegerv; - qglGetLightfv = logGetLightfv; - qglGetLightiv = logGetLightiv; - qglGetMapdv = logGetMapdv; - qglGetMapfv = logGetMapfv; - qglGetMapiv = logGetMapiv; - qglGetMaterialfv = logGetMaterialfv; - qglGetMaterialiv = logGetMaterialiv; - qglGetPixelMapfv = logGetPixelMapfv; - qglGetPixelMapuiv = logGetPixelMapuiv; - qglGetPixelMapusv = logGetPixelMapusv; - qglGetPointerv = logGetPointerv; - qglGetPolygonStipple = logGetPolygonStipple; - qglGetString = logGetString; - qglGetTexEnvfv = logGetTexEnvfv; - qglGetTexEnviv = logGetTexEnviv; - qglGetTexGendv = logGetTexGendv; - qglGetTexGenfv = logGetTexGenfv; - qglGetTexGeniv = logGetTexGeniv; - qglGetTexImage = logGetTexImage; - qglGetTexLevelParameterfv = logGetTexLevelParameterfv; - qglGetTexLevelParameteriv = logGetTexLevelParameteriv; - qglGetTexParameterfv = logGetTexParameterfv; - qglGetTexParameteriv = logGetTexParameteriv; - qglHint = logHint; - qglIndexMask = logIndexMask; - qglIndexPointer = logIndexPointer; - qglIndexd = logIndexd; - qglIndexdv = logIndexdv; - qglIndexf = logIndexf; - qglIndexfv = logIndexfv; - qglIndexi = logIndexi; - qglIndexiv = logIndexiv; - qglIndexs = logIndexs; - qglIndexsv = logIndexsv; - qglIndexub = logIndexub; - qglIndexubv = logIndexubv; - qglInitNames = logInitNames; - qglInterleavedArrays = logInterleavedArrays; - qglIsEnabled = logIsEnabled; - qglIsList = logIsList; - qglIsTexture = logIsTexture; - qglLightModelf = logLightModelf; - qglLightModelfv = logLightModelfv; - qglLightModeli = logLightModeli; - qglLightModeliv = logLightModeliv; - qglLightf = logLightf; - qglLightfv = logLightfv; - qglLighti = logLighti; - qglLightiv = logLightiv; - qglLineStipple = logLineStipple; - qglLineWidth = logLineWidth; - qglListBase = logListBase; - qglLoadIdentity = logLoadIdentity; - qglLoadMatrixd = logLoadMatrixd; - qglLoadMatrixf = logLoadMatrixf; - qglLoadName = logLoadName; - qglLogicOp = logLogicOp; - qglMap1d = logMap1d; - qglMap1f = logMap1f; - qglMap2d = logMap2d; - qglMap2f = logMap2f; - qglMapGrid1d = logMapGrid1d; - qglMapGrid1f = logMapGrid1f; - qglMapGrid2d = logMapGrid2d; - qglMapGrid2f = logMapGrid2f; - qglMaterialf = logMaterialf; - qglMaterialfv = logMaterialfv; - qglMateriali = logMateriali; - qglMaterialiv = logMaterialiv; - qglMatrixMode = logMatrixMode; - qglMultMatrixd = logMultMatrixd; - qglMultMatrixf = logMultMatrixf; - qglNewList = logNewList; - qglNormal3b = logNormal3b; - qglNormal3bv = logNormal3bv; - qglNormal3d = logNormal3d; - qglNormal3dv = logNormal3dv; - qglNormal3f = logNormal3f; - qglNormal3fv = logNormal3fv; - qglNormal3i = logNormal3i; - qglNormal3iv = logNormal3iv; - qglNormal3s = logNormal3s; - qglNormal3sv = logNormal3sv; - qglNormalPointer = logNormalPointer; - qglOrtho = logOrtho; - qglPassThrough = logPassThrough; - qglPixelMapfv = logPixelMapfv; - qglPixelMapuiv = logPixelMapuiv; - qglPixelMapusv = logPixelMapusv; - qglPixelStoref = logPixelStoref; - qglPixelStorei = logPixelStorei; - qglPixelTransferf = logPixelTransferf; - qglPixelTransferi = logPixelTransferi; - qglPixelZoom = logPixelZoom; - qglPointSize = logPointSize; - qglPolygonMode = logPolygonMode; - qglPolygonOffset = logPolygonOffset; - qglPolygonStipple = logPolygonStipple; - qglPopAttrib = logPopAttrib; - qglPopClientAttrib = logPopClientAttrib; - qglPopMatrix = logPopMatrix; - qglPopName = logPopName; - qglPrioritizeTextures = logPrioritizeTextures; - qglPushAttrib = logPushAttrib; - qglPushClientAttrib = logPushClientAttrib; - qglPushMatrix = logPushMatrix; - qglPushName = logPushName; - qglRasterPos2d = logRasterPos2d; - qglRasterPos2dv = logRasterPos2dv; - qglRasterPos2f = logRasterPos2f; - qglRasterPos2fv = logRasterPos2fv; - qglRasterPos2i = logRasterPos2i; - qglRasterPos2iv = logRasterPos2iv; - qglRasterPos2s = logRasterPos2s; - qglRasterPos2sv = logRasterPos2sv; - qglRasterPos3d = logRasterPos3d; - qglRasterPos3dv = logRasterPos3dv; - qglRasterPos3f = logRasterPos3f; - qglRasterPos3fv = logRasterPos3fv; - qglRasterPos3i = logRasterPos3i; - qglRasterPos3iv = logRasterPos3iv; - qglRasterPos3s = logRasterPos3s; - qglRasterPos3sv = logRasterPos3sv; - qglRasterPos4d = logRasterPos4d; - qglRasterPos4dv = logRasterPos4dv; - qglRasterPos4f = logRasterPos4f; - qglRasterPos4fv = logRasterPos4fv; - qglRasterPos4i = logRasterPos4i; - qglRasterPos4iv = logRasterPos4iv; - qglRasterPos4s = logRasterPos4s; - qglRasterPos4sv = logRasterPos4sv; - qglReadBuffer = logReadBuffer; - qglReadPixels = logReadPixels; - qglRectd = logRectd; - qglRectdv = logRectdv; - qglRectf = logRectf; - qglRectfv = logRectfv; - qglRecti = logRecti; - qglRectiv = logRectiv; - qglRects = logRects; - qglRectsv = logRectsv; - qglRenderMode = logRenderMode; - qglRotated = logRotated; - qglRotatef = logRotatef; - qglScaled = logScaled; - qglScalef = logScalef; - qglScissor = logScissor; - qglSelectBuffer = logSelectBuffer; - qglShadeModel = logShadeModel; - qglStencilFunc = logStencilFunc; - qglStencilMask = logStencilMask; - qglStencilOp = logStencilOp; - qglTexCoord1d = logTexCoord1d; - qglTexCoord1dv = logTexCoord1dv; - qglTexCoord1f = logTexCoord1f; - qglTexCoord1fv = logTexCoord1fv; - qglTexCoord1i = logTexCoord1i; - qglTexCoord1iv = logTexCoord1iv; - qglTexCoord1s = logTexCoord1s; - qglTexCoord1sv = logTexCoord1sv; - qglTexCoord2d = logTexCoord2d; - qglTexCoord2dv = logTexCoord2dv; - qglTexCoord2f = logTexCoord2f; - qglTexCoord2fv = logTexCoord2fv; - qglTexCoord2i = logTexCoord2i; - qglTexCoord2iv = logTexCoord2iv; - qglTexCoord2s = logTexCoord2s; - qglTexCoord2sv = logTexCoord2sv; - qglTexCoord3d = logTexCoord3d; - qglTexCoord3dv = logTexCoord3dv; - qglTexCoord3f = logTexCoord3f; - qglTexCoord3fv = logTexCoord3fv; - qglTexCoord3i = logTexCoord3i; - qglTexCoord3iv = logTexCoord3iv; - qglTexCoord3s = logTexCoord3s; - qglTexCoord3sv = logTexCoord3sv; - qglTexCoord4d = logTexCoord4d; - qglTexCoord4dv = logTexCoord4dv; - qglTexCoord4f = logTexCoord4f; - qglTexCoord4fv = logTexCoord4fv; - qglTexCoord4i = logTexCoord4i; - qglTexCoord4iv = logTexCoord4iv; - qglTexCoord4s = logTexCoord4s; - qglTexCoord4sv = logTexCoord4sv; - qglTexCoordPointer = logTexCoordPointer; - qglTexEnvf = logTexEnvf; - qglTexEnvfv = logTexEnvfv; - qglTexEnvi = logTexEnvi; - qglTexEnviv = logTexEnviv; - qglTexGend = logTexGend; - qglTexGendv = logTexGendv; - qglTexGenf = logTexGenf; - qglTexGenfv = logTexGenfv; - qglTexGeni = logTexGeni; - qglTexGeniv = logTexGeniv; - qglTexImage1D = logTexImage1D; - qglTexImage2D = logTexImage2D; - qglTexParameterf = logTexParameterf; - qglTexParameterfv = logTexParameterfv; - qglTexParameteri = logTexParameteri; - qglTexParameteriv = logTexParameteriv; - qglTexSubImage1D = logTexSubImage1D; - qglTexSubImage2D = logTexSubImage2D; - qglTranslated = logTranslated; - qglTranslatef = logTranslatef; - qglVertex2d = logVertex2d; - qglVertex2dv = logVertex2dv; - qglVertex2f = logVertex2f; - qglVertex2fv = logVertex2fv; - qglVertex2i = logVertex2i; - qglVertex2iv = logVertex2iv; - qglVertex2s = logVertex2s; - qglVertex2sv = logVertex2sv; - qglVertex3d = logVertex3d; - qglVertex3dv = logVertex3dv; - qglVertex3f = logVertex3f; - qglVertex3fv = logVertex3fv; - qglVertex3i = logVertex3i; - qglVertex3iv = logVertex3iv; - qglVertex3s = logVertex3s; - qglVertex3sv = logVertex3sv; - qglVertex4d = logVertex4d; - qglVertex4dv = logVertex4dv; - qglVertex4f = logVertex4f; - qglVertex4fv = logVertex4fv; - qglVertex4i = logVertex4i; - qglVertex4iv = logVertex4iv; - qglVertex4s = logVertex4s; - qglVertex4sv = logVertex4sv; - qglVertexPointer = logVertexPointer; - qglViewport = logViewport; + qglAccum = logAccum; + qglAlphaFunc = logAlphaFunc; + qglAreTexturesResident = logAreTexturesResident; + qglArrayElement = logArrayElement; + qglBegin = logBegin; + qglBindTexture = logBindTexture; + qglBitmap = logBitmap; + qglBlendFunc = logBlendFunc; + qglCallList = logCallList; + qglCallLists = logCallLists; + qglClear = logClear; + qglClearAccum = logClearAccum; + qglClearColor = logClearColor; + qglClearDepth = logClearDepth; + qglClearIndex = logClearIndex; + qglClearStencil = logClearStencil; + qglClipPlane = logClipPlane; + qglColor3b = logColor3b; + qglColor3bv = logColor3bv; + qglColor3d = logColor3d; + qglColor3dv = logColor3dv; + qglColor3f = logColor3f; + qglColor3fv = logColor3fv; + qglColor3i = logColor3i; + qglColor3iv = logColor3iv; + qglColor3s = logColor3s; + qglColor3sv = logColor3sv; + qglColor3ub = logColor3ub; + qglColor3ubv = logColor3ubv; + qglColor3ui = logColor3ui; + qglColor3uiv = logColor3uiv; + qglColor3us = logColor3us; + qglColor3usv = logColor3usv; + qglColor4b = logColor4b; + qglColor4bv = logColor4bv; + qglColor4d = logColor4d; + qglColor4dv = logColor4dv; + qglColor4f = logColor4f; + qglColor4fv = logColor4fv; + qglColor4i = logColor4i; + qglColor4iv = logColor4iv; + qglColor4s = logColor4s; + qglColor4sv = logColor4sv; + qglColor4ub = logColor4ub; + qglColor4ubv = logColor4ubv; + qglColor4ui = logColor4ui; + qglColor4uiv = logColor4uiv; + qglColor4us = logColor4us; + qglColor4usv = logColor4usv; + qglColorMask = logColorMask; + qglColorMaterial = logColorMaterial; + qglColorPointer = logColorPointer; + qglCopyPixels = logCopyPixels; + qglCopyTexImage1D = logCopyTexImage1D; + qglCopyTexImage2D = logCopyTexImage2D; + qglCopyTexSubImage1D = logCopyTexSubImage1D; + qglCopyTexSubImage2D = logCopyTexSubImage2D; + qglCullFace = logCullFace; + qglDeleteLists = logDeleteLists; + qglDeleteTextures = logDeleteTextures; + qglDepthFunc = logDepthFunc; + qglDepthMask = logDepthMask; + qglDepthRange = logDepthRange; + qglDisable = logDisable; + qglDisableClientState = logDisableClientState; + qglDrawArrays = logDrawArrays; + qglDrawBuffer = logDrawBuffer; + qglDrawElements = logDrawElements; + qglDrawPixels = logDrawPixels; + qglEdgeFlag = logEdgeFlag; + qglEdgeFlagPointer = logEdgeFlagPointer; + qglEdgeFlagv = logEdgeFlagv; + qglEnable = logEnable; + qglEnableClientState = logEnableClientState; + qglEnd = logEnd; + qglEndList = logEndList; + qglEvalCoord1d = logEvalCoord1d; + qglEvalCoord1dv = logEvalCoord1dv; + qglEvalCoord1f = logEvalCoord1f; + qglEvalCoord1fv = logEvalCoord1fv; + qglEvalCoord2d = logEvalCoord2d; + qglEvalCoord2dv = logEvalCoord2dv; + qglEvalCoord2f = logEvalCoord2f; + qglEvalCoord2fv = logEvalCoord2fv; + qglEvalMesh1 = logEvalMesh1; + qglEvalMesh2 = logEvalMesh2; + qglEvalPoint1 = logEvalPoint1; + qglEvalPoint2 = logEvalPoint2; + qglFeedbackBuffer = logFeedbackBuffer; + qglFinish = logFinish; + qglFlush = logFlush; + qglFogf = logFogf; + qglFogfv = logFogfv; + qglFogi = logFogi; + qglFogiv = logFogiv; + qglFrontFace = logFrontFace; + qglFrustum = logFrustum; + qglGenLists = logGenLists; + qglGenTextures = logGenTextures; + qglGetBooleanv = logGetBooleanv; + qglGetClipPlane = logGetClipPlane; + qglGetDoublev = logGetDoublev; + qglGetError = logGetError; + qglGetFloatv = logGetFloatv; + qglGetIntegerv = logGetIntegerv; + qglGetLightfv = logGetLightfv; + qglGetLightiv = logGetLightiv; + qglGetMapdv = logGetMapdv; + qglGetMapfv = logGetMapfv; + qglGetMapiv = logGetMapiv; + qglGetMaterialfv = logGetMaterialfv; + qglGetMaterialiv = logGetMaterialiv; + qglGetPixelMapfv = logGetPixelMapfv; + qglGetPixelMapuiv = logGetPixelMapuiv; + qglGetPixelMapusv = logGetPixelMapusv; + qglGetPointerv = logGetPointerv; + qglGetPolygonStipple = logGetPolygonStipple; + qglGetString = logGetString; + qglGetTexEnvfv = logGetTexEnvfv; + qglGetTexEnviv = logGetTexEnviv; + qglGetTexGendv = logGetTexGendv; + qglGetTexGenfv = logGetTexGenfv; + qglGetTexGeniv = logGetTexGeniv; + qglGetTexImage = logGetTexImage; + qglGetTexLevelParameterfv = logGetTexLevelParameterfv; + qglGetTexLevelParameteriv = logGetTexLevelParameteriv; + qglGetTexParameterfv = logGetTexParameterfv; + qglGetTexParameteriv = logGetTexParameteriv; + qglHint = logHint; + qglIndexMask = logIndexMask; + qglIndexPointer = logIndexPointer; + qglIndexd = logIndexd; + qglIndexdv = logIndexdv; + qglIndexf = logIndexf; + qglIndexfv = logIndexfv; + qglIndexi = logIndexi; + qglIndexiv = logIndexiv; + qglIndexs = logIndexs; + qglIndexsv = logIndexsv; + qglIndexub = logIndexub; + qglIndexubv = logIndexubv; + qglInitNames = logInitNames; + qglInterleavedArrays = logInterleavedArrays; + qglIsEnabled = logIsEnabled; + qglIsList = logIsList; + qglIsTexture = logIsTexture; + qglLightModelf = logLightModelf; + qglLightModelfv = logLightModelfv; + qglLightModeli = logLightModeli; + qglLightModeliv = logLightModeliv; + qglLightf = logLightf; + qglLightfv = logLightfv; + qglLighti = logLighti; + qglLightiv = logLightiv; + qglLineStipple = logLineStipple; + qglLineWidth = logLineWidth; + qglListBase = logListBase; + qglLoadIdentity = logLoadIdentity; + qglLoadMatrixd = logLoadMatrixd; + qglLoadMatrixf = logLoadMatrixf; + qglLoadName = logLoadName; + qglLogicOp = logLogicOp; + qglMap1d = logMap1d; + qglMap1f = logMap1f; + qglMap2d = logMap2d; + qglMap2f = logMap2f; + qglMapGrid1d = logMapGrid1d; + qglMapGrid1f = logMapGrid1f; + qglMapGrid2d = logMapGrid2d; + qglMapGrid2f = logMapGrid2f; + qglMaterialf = logMaterialf; + qglMaterialfv = logMaterialfv; + qglMateriali = logMateriali; + qglMaterialiv = logMaterialiv; + qglMatrixMode = logMatrixMode; + qglMultMatrixd = logMultMatrixd; + qglMultMatrixf = logMultMatrixf; + qglNewList = logNewList; + qglNormal3b = logNormal3b; + qglNormal3bv = logNormal3bv; + qglNormal3d = logNormal3d; + qglNormal3dv = logNormal3dv; + qglNormal3f = logNormal3f; + qglNormal3fv = logNormal3fv; + qglNormal3i = logNormal3i; + qglNormal3iv = logNormal3iv; + qglNormal3s = logNormal3s; + qglNormal3sv = logNormal3sv; + qglNormalPointer = logNormalPointer; + qglOrtho = logOrtho; + qglPassThrough = logPassThrough; + qglPixelMapfv = logPixelMapfv; + qglPixelMapuiv = logPixelMapuiv; + qglPixelMapusv = logPixelMapusv; + qglPixelStoref = logPixelStoref; + qglPixelStorei = logPixelStorei; + qglPixelTransferf = logPixelTransferf; + qglPixelTransferi = logPixelTransferi; + qglPixelZoom = logPixelZoom; + qglPointSize = logPointSize; + qglPolygonMode = logPolygonMode; + qglPolygonOffset = logPolygonOffset; + qglPolygonStipple = logPolygonStipple; + qglPopAttrib = logPopAttrib; + qglPopClientAttrib = logPopClientAttrib; + qglPopMatrix = logPopMatrix; + qglPopName = logPopName; + qglPrioritizeTextures = logPrioritizeTextures; + qglPushAttrib = logPushAttrib; + qglPushClientAttrib = logPushClientAttrib; + qglPushMatrix = logPushMatrix; + qglPushName = logPushName; + qglRasterPos2d = logRasterPos2d; + qglRasterPos2dv = logRasterPos2dv; + qglRasterPos2f = logRasterPos2f; + qglRasterPos2fv = logRasterPos2fv; + qglRasterPos2i = logRasterPos2i; + qglRasterPos2iv = logRasterPos2iv; + qglRasterPos2s = logRasterPos2s; + qglRasterPos2sv = logRasterPos2sv; + qglRasterPos3d = logRasterPos3d; + qglRasterPos3dv = logRasterPos3dv; + qglRasterPos3f = logRasterPos3f; + qglRasterPos3fv = logRasterPos3fv; + qglRasterPos3i = logRasterPos3i; + qglRasterPos3iv = logRasterPos3iv; + qglRasterPos3s = logRasterPos3s; + qglRasterPos3sv = logRasterPos3sv; + qglRasterPos4d = logRasterPos4d; + qglRasterPos4dv = logRasterPos4dv; + qglRasterPos4f = logRasterPos4f; + qglRasterPos4fv = logRasterPos4fv; + qglRasterPos4i = logRasterPos4i; + qglRasterPos4iv = logRasterPos4iv; + qglRasterPos4s = logRasterPos4s; + qglRasterPos4sv = logRasterPos4sv; + qglReadBuffer = logReadBuffer; + qglReadPixels = logReadPixels; + qglRectd = logRectd; + qglRectdv = logRectdv; + qglRectf = logRectf; + qglRectfv = logRectfv; + qglRecti = logRecti; + qglRectiv = logRectiv; + qglRects = logRects; + qglRectsv = logRectsv; + qglRenderMode = logRenderMode; + qglRotated = logRotated; + qglRotatef = logRotatef; + qglScaled = logScaled; + qglScalef = logScalef; + qglScissor = logScissor; + qglSelectBuffer = logSelectBuffer; + qglShadeModel = logShadeModel; + qglStencilFunc = logStencilFunc; + qglStencilMask = logStencilMask; + qglStencilOp = logStencilOp; + qglTexCoord1d = logTexCoord1d; + qglTexCoord1dv = logTexCoord1dv; + qglTexCoord1f = logTexCoord1f; + qglTexCoord1fv = logTexCoord1fv; + qglTexCoord1i = logTexCoord1i; + qglTexCoord1iv = logTexCoord1iv; + qglTexCoord1s = logTexCoord1s; + qglTexCoord1sv = logTexCoord1sv; + qglTexCoord2d = logTexCoord2d; + qglTexCoord2dv = logTexCoord2dv; + qglTexCoord2f = logTexCoord2f; + qglTexCoord2fv = logTexCoord2fv; + qglTexCoord2i = logTexCoord2i; + qglTexCoord2iv = logTexCoord2iv; + qglTexCoord2s = logTexCoord2s; + qglTexCoord2sv = logTexCoord2sv; + qglTexCoord3d = logTexCoord3d; + qglTexCoord3dv = logTexCoord3dv; + qglTexCoord3f = logTexCoord3f; + qglTexCoord3fv = logTexCoord3fv; + qglTexCoord3i = logTexCoord3i; + qglTexCoord3iv = logTexCoord3iv; + qglTexCoord3s = logTexCoord3s; + qglTexCoord3sv = logTexCoord3sv; + qglTexCoord4d = logTexCoord4d; + qglTexCoord4dv = logTexCoord4dv; + qglTexCoord4f = logTexCoord4f; + qglTexCoord4fv = logTexCoord4fv; + qglTexCoord4i = logTexCoord4i; + qglTexCoord4iv = logTexCoord4iv; + qglTexCoord4s = logTexCoord4s; + qglTexCoord4sv = logTexCoord4sv; + qglTexCoordPointer = logTexCoordPointer; + qglTexEnvf = logTexEnvf; + qglTexEnvfv = logTexEnvfv; + qglTexEnvi = logTexEnvi; + qglTexEnviv = logTexEnviv; + qglTexGend = logTexGend; + qglTexGendv = logTexGendv; + qglTexGenf = logTexGenf; + qglTexGenfv = logTexGenfv; + qglTexGeni = logTexGeni; + qglTexGeniv = logTexGeniv; + qglTexImage1D = logTexImage1D; + qglTexImage2D = logTexImage2D; + qglTexParameterf = logTexParameterf; + qglTexParameterfv = logTexParameterfv; + qglTexParameteri = logTexParameteri; + qglTexParameteriv = logTexParameteriv; + qglTexSubImage1D = logTexSubImage1D; + qglTexSubImage2D = logTexSubImage2D; + qglTranslated = logTranslated; + qglTranslatef = logTranslatef; + qglVertex2d = logVertex2d; + qglVertex2dv = logVertex2dv; + qglVertex2f = logVertex2f; + qglVertex2fv = logVertex2fv; + qglVertex2i = logVertex2i; + qglVertex2iv = logVertex2iv; + qglVertex2s = logVertex2s; + qglVertex2sv = logVertex2sv; + qglVertex3d = logVertex3d; + qglVertex3dv = logVertex3dv; + qglVertex3f = logVertex3f; + qglVertex3fv = logVertex3fv; + qglVertex3i = logVertex3i; + qglVertex3iv = logVertex3iv; + qglVertex3s = logVertex3s; + qglVertex3sv = logVertex3sv; + qglVertex4d = logVertex4d; + qglVertex4dv = logVertex4dv; + qglVertex4f = logVertex4f; + qglVertex4fv = logVertex4fv; + qglVertex4i = logVertex4i; + qglVertex4iv = logVertex4iv; + qglVertex4s = logVertex4s; + qglVertex4sv = logVertex4sv; + qglVertexPointer = logVertexPointer; + qglViewport = logViewport; } else { - qglAccum = dllAccum; - qglAlphaFunc = dllAlphaFunc; - qglAreTexturesResident = dllAreTexturesResident; - qglArrayElement = dllArrayElement; - qglBegin = dllBegin; - qglBindTexture = dllBindTexture; - qglBitmap = dllBitmap; - qglBlendFunc = dllBlendFunc; - qglCallList = dllCallList; - qglCallLists = dllCallLists; - qglClear = dllClear; - qglClearAccum = dllClearAccum; - qglClearColor = dllClearColor; - qglClearDepth = dllClearDepth; - qglClearIndex = dllClearIndex; - qglClearStencil = dllClearStencil; - qglClipPlane = dllClipPlane; - qglColor3b = dllColor3b; - qglColor3bv = dllColor3bv; - qglColor3d = dllColor3d; - qglColor3dv = dllColor3dv; - qglColor3f = dllColor3f; - qglColor3fv = dllColor3fv; - qglColor3i = dllColor3i; - qglColor3iv = dllColor3iv; - qglColor3s = dllColor3s; - qglColor3sv = dllColor3sv; - qglColor3ub = dllColor3ub; - qglColor3ubv = dllColor3ubv; - qglColor3ui = dllColor3ui; - qglColor3uiv = dllColor3uiv; - qglColor3us = dllColor3us; - qglColor3usv = dllColor3usv; - qglColor4b = dllColor4b; - qglColor4bv = dllColor4bv; - qglColor4d = dllColor4d; - qglColor4dv = dllColor4dv; - qglColor4f = dllColor4f; - qglColor4fv = dllColor4fv; - qglColor4i = dllColor4i; - qglColor4iv = dllColor4iv; - qglColor4s = dllColor4s; - qglColor4sv = dllColor4sv; - qglColor4ub = dllColor4ub; - qglColor4ubv = dllColor4ubv; - qglColor4ui = dllColor4ui; - qglColor4uiv = dllColor4uiv; - qglColor4us = dllColor4us; - qglColor4usv = dllColor4usv; - qglColorMask = dllColorMask; - qglColorMaterial = dllColorMaterial; - qglColorPointer = dllColorPointer; - qglCopyPixels = dllCopyPixels; - qglCopyTexImage1D = dllCopyTexImage1D; - qglCopyTexImage2D = dllCopyTexImage2D; - qglCopyTexSubImage1D = dllCopyTexSubImage1D; - qglCopyTexSubImage2D = dllCopyTexSubImage2D; - qglCullFace = dllCullFace; - qglDeleteLists = dllDeleteLists; - qglDeleteTextures = dllDeleteTextures; - qglDepthFunc = dllDepthFunc; - qglDepthMask = dllDepthMask; - qglDepthRange = dllDepthRange; - qglDisable = dllDisable; - qglDisableClientState = dllDisableClientState; - qglDrawArrays = dllDrawArrays; - qglDrawBuffer = dllDrawBuffer; - qglDrawElements = dllDrawElements; - qglDrawPixels = dllDrawPixels; - qglEdgeFlag = dllEdgeFlag; - qglEdgeFlagPointer = dllEdgeFlagPointer; - qglEdgeFlagv = dllEdgeFlagv; - qglEnable = dllEnable; - qglEnableClientState = dllEnableClientState; - qglEnd = dllEnd; - qglEndList = dllEndList; - qglEvalCoord1d = dllEvalCoord1d; - qglEvalCoord1dv = dllEvalCoord1dv; - qglEvalCoord1f = dllEvalCoord1f; - qglEvalCoord1fv = dllEvalCoord1fv; - qglEvalCoord2d = dllEvalCoord2d; - qglEvalCoord2dv = dllEvalCoord2dv; - qglEvalCoord2f = dllEvalCoord2f; - qglEvalCoord2fv = dllEvalCoord2fv; - qglEvalMesh1 = dllEvalMesh1; - qglEvalMesh2 = dllEvalMesh2; - qglEvalPoint1 = dllEvalPoint1; - qglEvalPoint2 = dllEvalPoint2; - qglFeedbackBuffer = dllFeedbackBuffer; - qglFinish = dllFinish; - qglFlush = dllFlush; - qglFogf = dllFogf; - qglFogfv = dllFogfv; - qglFogi = dllFogi; - qglFogiv = dllFogiv; - qglFrontFace = dllFrontFace; - qglFrustum = dllFrustum; - qglGenLists = dllGenLists; - qglGenTextures = dllGenTextures; - qglGetBooleanv = dllGetBooleanv; - qglGetClipPlane = dllGetClipPlane; - qglGetDoublev = dllGetDoublev; - qglGetError = dllGetError; - qglGetFloatv = dllGetFloatv; - qglGetIntegerv = dllGetIntegerv; - qglGetLightfv = dllGetLightfv; - qglGetLightiv = dllGetLightiv; - qglGetMapdv = dllGetMapdv; - qglGetMapfv = dllGetMapfv; - qglGetMapiv = dllGetMapiv; - qglGetMaterialfv = dllGetMaterialfv; - qglGetMaterialiv = dllGetMaterialiv; - qglGetPixelMapfv = dllGetPixelMapfv; - qglGetPixelMapuiv = dllGetPixelMapuiv; - qglGetPixelMapusv = dllGetPixelMapusv; - qglGetPointerv = dllGetPointerv; - qglGetPolygonStipple = dllGetPolygonStipple; - qglGetString = dllGetString; - qglGetTexEnvfv = dllGetTexEnvfv; - qglGetTexEnviv = dllGetTexEnviv; - qglGetTexGendv = dllGetTexGendv; - qglGetTexGenfv = dllGetTexGenfv; - qglGetTexGeniv = dllGetTexGeniv; - qglGetTexImage = dllGetTexImage; - qglGetTexLevelParameterfv = dllGetTexLevelParameterfv; - qglGetTexLevelParameteriv = dllGetTexLevelParameteriv; - qglGetTexParameterfv = dllGetTexParameterfv; - qglGetTexParameteriv = dllGetTexParameteriv; - qglHint = dllHint; - qglIndexMask = dllIndexMask; - qglIndexPointer = dllIndexPointer; - qglIndexd = dllIndexd; - qglIndexdv = dllIndexdv; - qglIndexf = dllIndexf; - qglIndexfv = dllIndexfv; - qglIndexi = dllIndexi; - qglIndexiv = dllIndexiv; - qglIndexs = dllIndexs; - qglIndexsv = dllIndexsv; - qglIndexub = dllIndexub; - qglIndexubv = dllIndexubv; - qglInitNames = dllInitNames; - qglInterleavedArrays = dllInterleavedArrays; - qglIsEnabled = dllIsEnabled; - qglIsList = dllIsList; - qglIsTexture = dllIsTexture; - qglLightModelf = dllLightModelf; - qglLightModelfv = dllLightModelfv; - qglLightModeli = dllLightModeli; - qglLightModeliv = dllLightModeliv; - qglLightf = dllLightf; - qglLightfv = dllLightfv; - qglLighti = dllLighti; - qglLightiv = dllLightiv; - qglLineStipple = dllLineStipple; - qglLineWidth = dllLineWidth; - qglListBase = dllListBase; - qglLoadIdentity = dllLoadIdentity; - qglLoadMatrixd = dllLoadMatrixd; - qglLoadMatrixf = dllLoadMatrixf; - qglLoadName = dllLoadName; - qglLogicOp = dllLogicOp; - qglMap1d = dllMap1d; - qglMap1f = dllMap1f; - qglMap2d = dllMap2d; - qglMap2f = dllMap2f; - qglMapGrid1d = dllMapGrid1d; - qglMapGrid1f = dllMapGrid1f; - qglMapGrid2d = dllMapGrid2d; - qglMapGrid2f = dllMapGrid2f; - qglMaterialf = dllMaterialf; - qglMaterialfv = dllMaterialfv; - qglMateriali = dllMateriali; - qglMaterialiv = dllMaterialiv; - qglMatrixMode = dllMatrixMode; - qglMultMatrixd = dllMultMatrixd; - qglMultMatrixf = dllMultMatrixf; - qglNewList = dllNewList; - qglNormal3b = dllNormal3b; - qglNormal3bv = dllNormal3bv; - qglNormal3d = dllNormal3d; - qglNormal3dv = dllNormal3dv; - qglNormal3f = dllNormal3f; - qglNormal3fv = dllNormal3fv; - qglNormal3i = dllNormal3i; - qglNormal3iv = dllNormal3iv; - qglNormal3s = dllNormal3s; - qglNormal3sv = dllNormal3sv; - qglNormalPointer = dllNormalPointer; - qglOrtho = dllOrtho; - qglPassThrough = dllPassThrough; - qglPixelMapfv = dllPixelMapfv; - qglPixelMapuiv = dllPixelMapuiv; - qglPixelMapusv = dllPixelMapusv; - qglPixelStoref = dllPixelStoref; - qglPixelStorei = dllPixelStorei; - qglPixelTransferf = dllPixelTransferf; - qglPixelTransferi = dllPixelTransferi; - qglPixelZoom = dllPixelZoom; - qglPointSize = dllPointSize; - qglPolygonMode = dllPolygonMode; - qglPolygonOffset = dllPolygonOffset; - qglPolygonStipple = dllPolygonStipple; - qglPopAttrib = dllPopAttrib; - qglPopClientAttrib = dllPopClientAttrib; - qglPopMatrix = dllPopMatrix; - qglPopName = dllPopName; - qglPrioritizeTextures = dllPrioritizeTextures; - qglPushAttrib = dllPushAttrib; - qglPushClientAttrib = dllPushClientAttrib; - qglPushMatrix = dllPushMatrix; - qglPushName = dllPushName; - qglRasterPos2d = dllRasterPos2d; - qglRasterPos2dv = dllRasterPos2dv; - qglRasterPos2f = dllRasterPos2f; - qglRasterPos2fv = dllRasterPos2fv; - qglRasterPos2i = dllRasterPos2i; - qglRasterPos2iv = dllRasterPos2iv; - qglRasterPos2s = dllRasterPos2s; - qglRasterPos2sv = dllRasterPos2sv; - qglRasterPos3d = dllRasterPos3d; - qglRasterPos3dv = dllRasterPos3dv; - qglRasterPos3f = dllRasterPos3f; - qglRasterPos3fv = dllRasterPos3fv; - qglRasterPos3i = dllRasterPos3i; - qglRasterPos3iv = dllRasterPos3iv; - qglRasterPos3s = dllRasterPos3s; - qglRasterPos3sv = dllRasterPos3sv; - qglRasterPos4d = dllRasterPos4d; - qglRasterPos4dv = dllRasterPos4dv; - qglRasterPos4f = dllRasterPos4f; - qglRasterPos4fv = dllRasterPos4fv; - qglRasterPos4i = dllRasterPos4i; - qglRasterPos4iv = dllRasterPos4iv; - qglRasterPos4s = dllRasterPos4s; - qglRasterPos4sv = dllRasterPos4sv; - qglReadBuffer = dllReadBuffer; - qglReadPixels = dllReadPixels; - qglRectd = dllRectd; - qglRectdv = dllRectdv; - qglRectf = dllRectf; - qglRectfv = dllRectfv; - qglRecti = dllRecti; - qglRectiv = dllRectiv; - qglRects = dllRects; - qglRectsv = dllRectsv; - qglRenderMode = dllRenderMode; - qglRotated = dllRotated; - qglRotatef = dllRotatef; - qglScaled = dllScaled; - qglScalef = dllScalef; - qglScissor = dllScissor; - qglSelectBuffer = dllSelectBuffer; - qglShadeModel = dllShadeModel; - qglStencilFunc = dllStencilFunc; - qglStencilMask = dllStencilMask; - qglStencilOp = dllStencilOp; - qglTexCoord1d = dllTexCoord1d; - qglTexCoord1dv = dllTexCoord1dv; - qglTexCoord1f = dllTexCoord1f; - qglTexCoord1fv = dllTexCoord1fv; - qglTexCoord1i = dllTexCoord1i; - qglTexCoord1iv = dllTexCoord1iv; - qglTexCoord1s = dllTexCoord1s; - qglTexCoord1sv = dllTexCoord1sv; - qglTexCoord2d = dllTexCoord2d; - qglTexCoord2dv = dllTexCoord2dv; - qglTexCoord2f = dllTexCoord2f; - qglTexCoord2fv = dllTexCoord2fv; - qglTexCoord2i = dllTexCoord2i; - qglTexCoord2iv = dllTexCoord2iv; - qglTexCoord2s = dllTexCoord2s; - qglTexCoord2sv = dllTexCoord2sv; - qglTexCoord3d = dllTexCoord3d; - qglTexCoord3dv = dllTexCoord3dv; - qglTexCoord3f = dllTexCoord3f; - qglTexCoord3fv = dllTexCoord3fv; - qglTexCoord3i = dllTexCoord3i; - qglTexCoord3iv = dllTexCoord3iv; - qglTexCoord3s = dllTexCoord3s; - qglTexCoord3sv = dllTexCoord3sv; - qglTexCoord4d = dllTexCoord4d; - qglTexCoord4dv = dllTexCoord4dv; - qglTexCoord4f = dllTexCoord4f; - qglTexCoord4fv = dllTexCoord4fv; - qglTexCoord4i = dllTexCoord4i; - qglTexCoord4iv = dllTexCoord4iv; - qglTexCoord4s = dllTexCoord4s; - qglTexCoord4sv = dllTexCoord4sv; - qglTexCoordPointer = dllTexCoordPointer; - qglTexEnvf = dllTexEnvf; - qglTexEnvfv = dllTexEnvfv; - qglTexEnvi = dllTexEnvi; - qglTexEnviv = dllTexEnviv; - qglTexGend = dllTexGend; - qglTexGendv = dllTexGendv; - qglTexGenf = dllTexGenf; - qglTexGenfv = dllTexGenfv; - qglTexGeni = dllTexGeni; - qglTexGeniv = dllTexGeniv; - qglTexImage1D = dllTexImage1D; - qglTexImage2D = dllTexImage2D; - qglTexParameterf = dllTexParameterf; - qglTexParameterfv = dllTexParameterfv; - qglTexParameteri = dllTexParameteri; - qglTexParameteriv = dllTexParameteriv; - qglTexSubImage1D = dllTexSubImage1D; - qglTexSubImage2D = dllTexSubImage2D; - qglTranslated = dllTranslated; - qglTranslatef = dllTranslatef; - qglVertex2d = dllVertex2d; - qglVertex2dv = dllVertex2dv; - qglVertex2f = dllVertex2f; - qglVertex2fv = dllVertex2fv; - qglVertex2i = dllVertex2i; - qglVertex2iv = dllVertex2iv; - qglVertex2s = dllVertex2s; - qglVertex2sv = dllVertex2sv; - qglVertex3d = dllVertex3d; - qglVertex3dv = dllVertex3dv; - qglVertex3f = dllVertex3f; - qglVertex3fv = dllVertex3fv; - qglVertex3i = dllVertex3i; - qglVertex3iv = dllVertex3iv; - qglVertex3s = dllVertex3s; - qglVertex3sv = dllVertex3sv; - qglVertex4d = dllVertex4d; - qglVertex4dv = dllVertex4dv; - qglVertex4f = dllVertex4f; - qglVertex4fv = dllVertex4fv; - qglVertex4i = dllVertex4i; - qglVertex4iv = dllVertex4iv; - qglVertex4s = dllVertex4s; - qglVertex4sv = dllVertex4sv; - qglVertexPointer = dllVertexPointer; - qglViewport = dllViewport; + qglAccum = dllAccum; + qglAlphaFunc = dllAlphaFunc; + qglAreTexturesResident = dllAreTexturesResident; + qglArrayElement = dllArrayElement; + qglBegin = dllBegin; + qglBindTexture = dllBindTexture; + qglBitmap = dllBitmap; + qglBlendFunc = dllBlendFunc; + qglCallList = dllCallList; + qglCallLists = dllCallLists; + qglClear = dllClear; + qglClearAccum = dllClearAccum; + qglClearColor = dllClearColor; + qglClearDepth = dllClearDepth; + qglClearIndex = dllClearIndex; + qglClearStencil = dllClearStencil; + qglClipPlane = dllClipPlane; + qglColor3b = dllColor3b; + qglColor3bv = dllColor3bv; + qglColor3d = dllColor3d; + qglColor3dv = dllColor3dv; + qglColor3f = dllColor3f; + qglColor3fv = dllColor3fv; + qglColor3i = dllColor3i; + qglColor3iv = dllColor3iv; + qglColor3s = dllColor3s; + qglColor3sv = dllColor3sv; + qglColor3ub = dllColor3ub; + qglColor3ubv = dllColor3ubv; + qglColor3ui = dllColor3ui; + qglColor3uiv = dllColor3uiv; + qglColor3us = dllColor3us; + qglColor3usv = dllColor3usv; + qglColor4b = dllColor4b; + qglColor4bv = dllColor4bv; + qglColor4d = dllColor4d; + qglColor4dv = dllColor4dv; + qglColor4f = dllColor4f; + qglColor4fv = dllColor4fv; + qglColor4i = dllColor4i; + qglColor4iv = dllColor4iv; + qglColor4s = dllColor4s; + qglColor4sv = dllColor4sv; + qglColor4ub = dllColor4ub; + qglColor4ubv = dllColor4ubv; + qglColor4ui = dllColor4ui; + qglColor4uiv = dllColor4uiv; + qglColor4us = dllColor4us; + qglColor4usv = dllColor4usv; + qglColorMask = dllColorMask; + qglColorMaterial = dllColorMaterial; + qglColorPointer = dllColorPointer; + qglCopyPixels = dllCopyPixels; + qglCopyTexImage1D = dllCopyTexImage1D; + qglCopyTexImage2D = dllCopyTexImage2D; + qglCopyTexSubImage1D = dllCopyTexSubImage1D; + qglCopyTexSubImage2D = dllCopyTexSubImage2D; + qglCullFace = dllCullFace; + qglDeleteLists = dllDeleteLists; + qglDeleteTextures = dllDeleteTextures; + qglDepthFunc = dllDepthFunc; + qglDepthMask = dllDepthMask; + qglDepthRange = dllDepthRange; + qglDisable = dllDisable; + qglDisableClientState = dllDisableClientState; + qglDrawArrays = dllDrawArrays; + qglDrawBuffer = dllDrawBuffer; + qglDrawElements = dllDrawElements; + qglDrawPixels = dllDrawPixels; + qglEdgeFlag = dllEdgeFlag; + qglEdgeFlagPointer = dllEdgeFlagPointer; + qglEdgeFlagv = dllEdgeFlagv; + qglEnable = dllEnable; + qglEnableClientState = dllEnableClientState; + qglEnd = dllEnd; + qglEndList = dllEndList; + qglEvalCoord1d = dllEvalCoord1d; + qglEvalCoord1dv = dllEvalCoord1dv; + qglEvalCoord1f = dllEvalCoord1f; + qglEvalCoord1fv = dllEvalCoord1fv; + qglEvalCoord2d = dllEvalCoord2d; + qglEvalCoord2dv = dllEvalCoord2dv; + qglEvalCoord2f = dllEvalCoord2f; + qglEvalCoord2fv = dllEvalCoord2fv; + qglEvalMesh1 = dllEvalMesh1; + qglEvalMesh2 = dllEvalMesh2; + qglEvalPoint1 = dllEvalPoint1; + qglEvalPoint2 = dllEvalPoint2; + qglFeedbackBuffer = dllFeedbackBuffer; + qglFinish = dllFinish; + qglFlush = dllFlush; + qglFogf = dllFogf; + qglFogfv = dllFogfv; + qglFogi = dllFogi; + qglFogiv = dllFogiv; + qglFrontFace = dllFrontFace; + qglFrustum = dllFrustum; + qglGenLists = dllGenLists; + qglGenTextures = dllGenTextures; + qglGetBooleanv = dllGetBooleanv; + qglGetClipPlane = dllGetClipPlane; + qglGetDoublev = dllGetDoublev; + qglGetError = dllGetError; + qglGetFloatv = dllGetFloatv; + qglGetIntegerv = dllGetIntegerv; + qglGetLightfv = dllGetLightfv; + qglGetLightiv = dllGetLightiv; + qglGetMapdv = dllGetMapdv; + qglGetMapfv = dllGetMapfv; + qglGetMapiv = dllGetMapiv; + qglGetMaterialfv = dllGetMaterialfv; + qglGetMaterialiv = dllGetMaterialiv; + qglGetPixelMapfv = dllGetPixelMapfv; + qglGetPixelMapuiv = dllGetPixelMapuiv; + qglGetPixelMapusv = dllGetPixelMapusv; + qglGetPointerv = dllGetPointerv; + qglGetPolygonStipple = dllGetPolygonStipple; + qglGetString = dllGetString; + qglGetTexEnvfv = dllGetTexEnvfv; + qglGetTexEnviv = dllGetTexEnviv; + qglGetTexGendv = dllGetTexGendv; + qglGetTexGenfv = dllGetTexGenfv; + qglGetTexGeniv = dllGetTexGeniv; + qglGetTexImage = dllGetTexImage; + qglGetTexLevelParameterfv = dllGetTexLevelParameterfv; + qglGetTexLevelParameteriv = dllGetTexLevelParameteriv; + qglGetTexParameterfv = dllGetTexParameterfv; + qglGetTexParameteriv = dllGetTexParameteriv; + qglHint = dllHint; + qglIndexMask = dllIndexMask; + qglIndexPointer = dllIndexPointer; + qglIndexd = dllIndexd; + qglIndexdv = dllIndexdv; + qglIndexf = dllIndexf; + qglIndexfv = dllIndexfv; + qglIndexi = dllIndexi; + qglIndexiv = dllIndexiv; + qglIndexs = dllIndexs; + qglIndexsv = dllIndexsv; + qglIndexub = dllIndexub; + qglIndexubv = dllIndexubv; + qglInitNames = dllInitNames; + qglInterleavedArrays = dllInterleavedArrays; + qglIsEnabled = dllIsEnabled; + qglIsList = dllIsList; + qglIsTexture = dllIsTexture; + qglLightModelf = dllLightModelf; + qglLightModelfv = dllLightModelfv; + qglLightModeli = dllLightModeli; + qglLightModeliv = dllLightModeliv; + qglLightf = dllLightf; + qglLightfv = dllLightfv; + qglLighti = dllLighti; + qglLightiv = dllLightiv; + qglLineStipple = dllLineStipple; + qglLineWidth = dllLineWidth; + qglListBase = dllListBase; + qglLoadIdentity = dllLoadIdentity; + qglLoadMatrixd = dllLoadMatrixd; + qglLoadMatrixf = dllLoadMatrixf; + qglLoadName = dllLoadName; + qglLogicOp = dllLogicOp; + qglMap1d = dllMap1d; + qglMap1f = dllMap1f; + qglMap2d = dllMap2d; + qglMap2f = dllMap2f; + qglMapGrid1d = dllMapGrid1d; + qglMapGrid1f = dllMapGrid1f; + qglMapGrid2d = dllMapGrid2d; + qglMapGrid2f = dllMapGrid2f; + qglMaterialf = dllMaterialf; + qglMaterialfv = dllMaterialfv; + qglMateriali = dllMateriali; + qglMaterialiv = dllMaterialiv; + qglMatrixMode = dllMatrixMode; + qglMultMatrixd = dllMultMatrixd; + qglMultMatrixf = dllMultMatrixf; + qglNewList = dllNewList; + qglNormal3b = dllNormal3b; + qglNormal3bv = dllNormal3bv; + qglNormal3d = dllNormal3d; + qglNormal3dv = dllNormal3dv; + qglNormal3f = dllNormal3f; + qglNormal3fv = dllNormal3fv; + qglNormal3i = dllNormal3i; + qglNormal3iv = dllNormal3iv; + qglNormal3s = dllNormal3s; + qglNormal3sv = dllNormal3sv; + qglNormalPointer = dllNormalPointer; + qglOrtho = dllOrtho; + qglPassThrough = dllPassThrough; + qglPixelMapfv = dllPixelMapfv; + qglPixelMapuiv = dllPixelMapuiv; + qglPixelMapusv = dllPixelMapusv; + qglPixelStoref = dllPixelStoref; + qglPixelStorei = dllPixelStorei; + qglPixelTransferf = dllPixelTransferf; + qglPixelTransferi = dllPixelTransferi; + qglPixelZoom = dllPixelZoom; + qglPointSize = dllPointSize; + qglPolygonMode = dllPolygonMode; + qglPolygonOffset = dllPolygonOffset; + qglPolygonStipple = dllPolygonStipple; + qglPopAttrib = dllPopAttrib; + qglPopClientAttrib = dllPopClientAttrib; + qglPopMatrix = dllPopMatrix; + qglPopName = dllPopName; + qglPrioritizeTextures = dllPrioritizeTextures; + qglPushAttrib = dllPushAttrib; + qglPushClientAttrib = dllPushClientAttrib; + qglPushMatrix = dllPushMatrix; + qglPushName = dllPushName; + qglRasterPos2d = dllRasterPos2d; + qglRasterPos2dv = dllRasterPos2dv; + qglRasterPos2f = dllRasterPos2f; + qglRasterPos2fv = dllRasterPos2fv; + qglRasterPos2i = dllRasterPos2i; + qglRasterPos2iv = dllRasterPos2iv; + qglRasterPos2s = dllRasterPos2s; + qglRasterPos2sv = dllRasterPos2sv; + qglRasterPos3d = dllRasterPos3d; + qglRasterPos3dv = dllRasterPos3dv; + qglRasterPos3f = dllRasterPos3f; + qglRasterPos3fv = dllRasterPos3fv; + qglRasterPos3i = dllRasterPos3i; + qglRasterPos3iv = dllRasterPos3iv; + qglRasterPos3s = dllRasterPos3s; + qglRasterPos3sv = dllRasterPos3sv; + qglRasterPos4d = dllRasterPos4d; + qglRasterPos4dv = dllRasterPos4dv; + qglRasterPos4f = dllRasterPos4f; + qglRasterPos4fv = dllRasterPos4fv; + qglRasterPos4i = dllRasterPos4i; + qglRasterPos4iv = dllRasterPos4iv; + qglRasterPos4s = dllRasterPos4s; + qglRasterPos4sv = dllRasterPos4sv; + qglReadBuffer = dllReadBuffer; + qglReadPixels = dllReadPixels; + qglRectd = dllRectd; + qglRectdv = dllRectdv; + qglRectf = dllRectf; + qglRectfv = dllRectfv; + qglRecti = dllRecti; + qglRectiv = dllRectiv; + qglRects = dllRects; + qglRectsv = dllRectsv; + qglRenderMode = dllRenderMode; + qglRotated = dllRotated; + qglRotatef = dllRotatef; + qglScaled = dllScaled; + qglScalef = dllScalef; + qglScissor = dllScissor; + qglSelectBuffer = dllSelectBuffer; + qglShadeModel = dllShadeModel; + qglStencilFunc = dllStencilFunc; + qglStencilMask = dllStencilMask; + qglStencilOp = dllStencilOp; + qglTexCoord1d = dllTexCoord1d; + qglTexCoord1dv = dllTexCoord1dv; + qglTexCoord1f = dllTexCoord1f; + qglTexCoord1fv = dllTexCoord1fv; + qglTexCoord1i = dllTexCoord1i; + qglTexCoord1iv = dllTexCoord1iv; + qglTexCoord1s = dllTexCoord1s; + qglTexCoord1sv = dllTexCoord1sv; + qglTexCoord2d = dllTexCoord2d; + qglTexCoord2dv = dllTexCoord2dv; + qglTexCoord2f = dllTexCoord2f; + qglTexCoord2fv = dllTexCoord2fv; + qglTexCoord2i = dllTexCoord2i; + qglTexCoord2iv = dllTexCoord2iv; + qglTexCoord2s = dllTexCoord2s; + qglTexCoord2sv = dllTexCoord2sv; + qglTexCoord3d = dllTexCoord3d; + qglTexCoord3dv = dllTexCoord3dv; + qglTexCoord3f = dllTexCoord3f; + qglTexCoord3fv = dllTexCoord3fv; + qglTexCoord3i = dllTexCoord3i; + qglTexCoord3iv = dllTexCoord3iv; + qglTexCoord3s = dllTexCoord3s; + qglTexCoord3sv = dllTexCoord3sv; + qglTexCoord4d = dllTexCoord4d; + qglTexCoord4dv = dllTexCoord4dv; + qglTexCoord4f = dllTexCoord4f; + qglTexCoord4fv = dllTexCoord4fv; + qglTexCoord4i = dllTexCoord4i; + qglTexCoord4iv = dllTexCoord4iv; + qglTexCoord4s = dllTexCoord4s; + qglTexCoord4sv = dllTexCoord4sv; + qglTexCoordPointer = dllTexCoordPointer; + qglTexEnvf = dllTexEnvf; + qglTexEnvfv = dllTexEnvfv; + qglTexEnvi = dllTexEnvi; + qglTexEnviv = dllTexEnviv; + qglTexGend = dllTexGend; + qglTexGendv = dllTexGendv; + qglTexGenf = dllTexGenf; + qglTexGenfv = dllTexGenfv; + qglTexGeni = dllTexGeni; + qglTexGeniv = dllTexGeniv; + qglTexImage1D = dllTexImage1D; + qglTexImage2D = dllTexImage2D; + qglTexParameterf = dllTexParameterf; + qglTexParameterfv = dllTexParameterfv; + qglTexParameteri = dllTexParameteri; + qglTexParameteriv = dllTexParameteriv; + qglTexSubImage1D = dllTexSubImage1D; + qglTexSubImage2D = dllTexSubImage2D; + qglTranslated = dllTranslated; + qglTranslatef = dllTranslatef; + qglVertex2d = dllVertex2d; + qglVertex2dv = dllVertex2dv; + qglVertex2f = dllVertex2f; + qglVertex2fv = dllVertex2fv; + qglVertex2i = dllVertex2i; + qglVertex2iv = dllVertex2iv; + qglVertex2s = dllVertex2s; + qglVertex2sv = dllVertex2sv; + qglVertex3d = dllVertex3d; + qglVertex3dv = dllVertex3dv; + qglVertex3f = dllVertex3f; + qglVertex3fv = dllVertex3fv; + qglVertex3i = dllVertex3i; + qglVertex3iv = dllVertex3iv; + qglVertex3s = dllVertex3s; + qglVertex3sv = dllVertex3sv; + qglVertex4d = dllVertex4d; + qglVertex4dv = dllVertex4dv; + qglVertex4f = dllVertex4f; + qglVertex4fv = dllVertex4fv; + qglVertex4i = dllVertex4i; + qglVertex4iv = dllVertex4iv; + qglVertex4s = dllVertex4s; + qglVertex4sv = dllVertex4sv; + qglVertexPointer = dllVertexPointer; + qglViewport = dllViewport; } } void -GLimp_LogNewFrame ( void ) +GLimp_LogNewFrame(void) { - fprintf( glw_state.log_fp, "*** R_BeginFrame ***\n" ); + fprintf(glw_state.log_fp, "*** R_BeginFrame ***\n"); } + diff --git a/src/unix/system.c b/src/unix/system.c index 3de2485d..88a1f1f8 100644 --- a/src/unix/system.c +++ b/src/unix/system.c @@ -53,180 +53,206 @@ unsigned sys_frame_time; int curtime; static void *game_library; -static char findbase [ MAX_OSPATH ]; -static char findpath [ MAX_OSPATH ]; -static char findpattern [ MAX_OSPATH ]; -static DIR *fdir; +static char findbase[MAX_OSPATH]; +static char findpath[MAX_OSPATH]; +static char findpattern[MAX_OSPATH]; +static DIR *fdir; qboolean stdin_active = true; extern FILE *logfile; static qboolean -CompareAttributes ( char *path, char *name, unsigned musthave, unsigned canthave ) +CompareAttributes(char *path, char *name, unsigned musthave, unsigned canthave) { struct stat st; - char fn [ MAX_OSPATH ]; + char fn[MAX_OSPATH]; /* . and .. never match */ - if ( ( strcmp( name, "." ) == 0 ) || ( strcmp( name, ".." ) == 0 ) ) + if ((strcmp(name, ".") == 0) || (strcmp(name, "..") == 0)) { - return ( false ); + return false; } - return ( true ); + return true; - if ( stat( fn, &st ) == -1 ) + if (stat(fn, &st) == -1) { - return ( false ); /* shouldn't happen */ + return false; /* shouldn't happen */ } - if ( ( st.st_mode & S_IFDIR ) && ( canthave & SFF_SUBDIR ) ) + if ((st.st_mode & S_IFDIR) && (canthave & SFF_SUBDIR)) { - return ( false ); + return false; } - if ( ( musthave & SFF_SUBDIR ) && !( st.st_mode & S_IFDIR ) ) + if ((musthave & SFF_SUBDIR) && !(st.st_mode & S_IFDIR)) { - return ( false ); + return false; } - return ( true ); + return true; } void -Sys_Init ( void ) +Sys_Init(void) { } int -Sys_Milliseconds ( void ) +Sys_Milliseconds(void) { struct timeval tp; struct timezone tzp; static int secbase; - gettimeofday( &tp, &tzp ); + gettimeofday(&tp, &tzp); - if ( !secbase ) + if (!secbase) { secbase = tp.tv_sec; - return ( tp.tv_usec / 1000 ); + return tp.tv_usec / 1000; } - curtime = ( tp.tv_sec - secbase ) * 1000 + tp.tv_usec / 1000; + curtime = (tp.tv_sec - secbase) * 1000 + tp.tv_usec / 1000; - return ( curtime ); + return curtime; } void -Sys_Mkdir ( char *path ) +Sys_Mkdir(char *path) { - mkdir( path, 0755 ); + mkdir(path, 0755); } char * -Sys_GetCurrentDirectory ( void ) +Sys_GetCurrentDirectory(void) { - static char dir [ MAX_OSPATH ]; + static char dir[MAX_OSPATH]; - if ( !getcwd( dir, sizeof ( dir ) ) ) + if (!getcwd(dir, sizeof(dir))) { - Sys_Error( "Couldn't get current working directory" ); + Sys_Error("Couldn't get current working directory"); } - return ( dir ); + return dir; } char * -Sys_FindFirst ( char *path, unsigned musthave, unsigned canhave ) +Sys_FindFirst(char *path, unsigned musthave, unsigned canhave) { struct dirent *d; char *p; - if ( fdir ) + if (fdir) { - Sys_Error( "Sys_BeginFind without close" ); + Sys_Error("Sys_BeginFind without close"); } - strcpy( findbase, path ); + strcpy(findbase, path); - if ( ( p = strrchr( findbase, '/' ) ) != NULL ) + if ((p = strrchr(findbase, '/')) != NULL) { *p = 0; - strcpy( findpattern, p + 1 ); + strcpy(findpattern, p + 1); } else { - strcpy( findpattern, "*" ); + strcpy(findpattern, "*"); } - if ( strcmp( findpattern, "*.*" ) == 0 ) + if (strcmp(findpattern, "*.*") == 0) { - strcpy( findpattern, "*" ); + strcpy(findpattern, "*"); } - if ( ( fdir = opendir( findbase ) ) == NULL ) + if ((fdir = opendir(findbase)) == NULL) { - return ( NULL ); + return NULL; } - while ( ( d = readdir( fdir ) ) != NULL ) + while ((d = readdir(fdir)) != NULL) { - if ( !*findpattern || glob_match( findpattern, d->d_name ) ) + if (!*findpattern || glob_match(findpattern, d->d_name)) { - if ( CompareAttributes( findbase, d->d_name, musthave, canhave ) ) + if (CompareAttributes(findbase, d->d_name, musthave, canhave)) { - sprintf( findpath, "%s/%s", findbase, d->d_name ); - return ( findpath ); + sprintf(findpath, "%s/%s", findbase, d->d_name); + return findpath; } } } - return ( NULL ); + return NULL; } char * -Sys_FindNext ( unsigned musthave, unsigned canhave ) +Sys_FindNext(unsigned musthave, unsigned canhave) { struct dirent *d; - if ( fdir == NULL ) + if (fdir == NULL) { - return ( NULL ); + return NULL; } - while ( ( d = readdir( fdir ) ) != NULL ) + while ((d = readdir(fdir)) != NULL) { - if ( !*findpattern || glob_match( findpattern, d->d_name ) ) + if (!*findpattern || glob_match(findpattern, d->d_name)) { - if ( CompareAttributes( findbase, d->d_name, musthave, canhave ) ) + if (CompareAttributes(findbase, d->d_name, musthave, canhave)) { - sprintf( findpath, "%s/%s", findbase, d->d_name ); - return ( findpath ); + sprintf(findpath, "%s/%s", findbase, d->d_name); + return findpath; } } } - return ( NULL ); + return NULL; } void -Sys_FindClose ( void ) +Sys_FindClose(void) { - if ( fdir != NULL ) + if (fdir != NULL) { - closedir( fdir ); + closedir(fdir); } fdir = NULL; } void -Sys_ConsoleOutput ( char *string ) +Sys_ConsoleOutput(char *string) { fputs(string, stdout); } +void +Sys_Printf(char *fmt, ...) +{ + va_list argptr; + char text[1024]; + unsigned char *p; + + va_start(argptr, fmt); + vsnprintf(text, 1024, fmt, argptr); + va_end(argptr); + + for (p = (unsigned char *)text; *p; p++) + { + *p &= 0x7f; + + if (((*p > 128) || (*p < 32)) && (*p != 10) && (*p != 13) && (*p != 9)) + { + printf("[%02x]", *p); + } + else + { + putc(*p, stdout); + } + } +} + void Sys_Quit(void) { @@ -234,116 +260,116 @@ Sys_Quit(void) CL_Shutdown(); #endif - if (logfile) + if (logfile) { - fclose (logfile); + fclose(logfile); logfile = NULL; } Qcommon_Shutdown(); - fcntl( 0, F_SETFL, fcntl( 0, F_GETFL, 0 ) & ~FNDELAY ); + fcntl(0, F_SETFL, fcntl(0, F_GETFL, 0) & ~FNDELAY); printf("------------------------------------\n"); - exit( 0 ); + exit(0); } void -Sys_Error ( char *error, ... ) +Sys_Error(char *error, ...) { va_list argptr; - char string [ 1024 ]; + char string[1024]; /* change stdin to non blocking */ - fcntl( 0, F_SETFL, fcntl( 0, F_GETFL, 0 ) & ~FNDELAY ); + fcntl(0, F_SETFL, fcntl(0, F_GETFL, 0) & ~FNDELAY); #ifndef DEDICATED_ONLY CL_Shutdown(); #endif Qcommon_Shutdown(); - va_start( argptr, error ); - vsnprintf( string, 1024, error, argptr ); - va_end( argptr ); - fprintf( stderr, "Error: %s\n", string ); + va_start(argptr, error); + vsnprintf(string, 1024, error, argptr); + va_end(argptr); + fprintf(stderr, "Error: %s\n", string); - exit( 1 ); + exit(1); } /* * returns -1 if not present */ int -Sys_FileTime ( char *path ) +Sys_FileTime(char *path) { struct stat buf; - if ( stat( path, &buf ) == -1 ) + if (stat(path, &buf) == -1) { - return ( -1 ); + return -1; } - return ( buf.st_mtime ); + return buf.st_mtime; } void -floating_point_exception_handler ( int whatever ) +floating_point_exception_handler(int whatever) { - signal( SIGFPE, floating_point_exception_handler ); + signal(SIGFPE, floating_point_exception_handler); } char * -Sys_ConsoleInput ( void ) +Sys_ConsoleInput(void) { - static char text [ 256 ]; + static char text[256]; int len; fd_set fdset; struct timeval timeout; - if ( !dedicated || !dedicated->value ) + if (!dedicated || !dedicated->value) { - return ( NULL ); + return NULL; } - if ( !stdin_active ) + if (!stdin_active) { - return ( NULL ); + return NULL; } - FD_ZERO( &fdset ); - FD_SET( 0, &fdset ); /* stdin */ + FD_ZERO(&fdset); + FD_SET(0, &fdset); /* stdin */ timeout.tv_sec = 0; timeout.tv_usec = 0; - if ( ( select( 1, &fdset, NULL, NULL, &timeout ) == -1 ) || !FD_ISSET( 0, &fdset ) ) + if ((select(1, &fdset, NULL, NULL, &timeout) == -1) || !FD_ISSET(0, &fdset)) { - return ( NULL ); + return NULL; } - len = read( 0, text, sizeof ( text ) ); + len = read(0, text, sizeof(text)); - if ( len == 0 ) /* eof! */ + if (len == 0) /* eof! */ { stdin_active = false; - return ( NULL ); + return NULL; } - if ( len < 1 ) + if (len < 1) { - return ( NULL ); + return NULL; } - text [ len - 1 ] = 0; /* rip off the /n and terminate */ + text[len - 1] = 0; /* rip off the /n and terminate */ - return ( text ); + return text; } void -Sys_UnloadGame ( void ) +Sys_UnloadGame(void) { - if ( game_library ) + if (game_library) { - dlclose( game_library ); + dlclose(game_library); } game_library = NULL; @@ -353,65 +379,65 @@ Sys_UnloadGame ( void ) * Loads the game dll */ void * -Sys_GetGameAPI ( void *parms ) +Sys_GetGameAPI(void *parms) { - void *( *GetGameAPI )(void *); + void *(*GetGameAPI)(void *); - FILE *fp; - char name [ MAX_OSPATH ]; - char *path; - char *str_p; + FILE *fp; + char name[MAX_OSPATH]; + char *path; + char *str_p; const char *gamename = "game.so"; - setreuid( getuid(), getuid() ); - setegid( getgid() ); + setreuid(getuid(), getuid()); + setegid(getgid()); - if ( game_library ) + if (game_library) { - Com_Error( ERR_FATAL, "Sys_GetGameAPI without Sys_UnloadingGame" ); + Com_Error(ERR_FATAL, "Sys_GetGameAPI without Sys_UnloadingGame"); } - Com_Printf( "LoadLibrary(\"%s\")\n", gamename ); + Com_Printf("LoadLibrary(\"%s\")\n", gamename); /* now run through the search paths */ path = NULL; - while ( 1 ) + while (1) { - path = FS_NextPath( path ); + path = FS_NextPath(path); - if ( !path ) + if (!path) { - return ( NULL ); /* couldn't find one anywhere */ + return NULL; /* couldn't find one anywhere */ } - snprintf( name, MAX_OSPATH, "%s/%s", path, gamename ); + snprintf(name, MAX_OSPATH, "%s/%s", path, gamename); /* skip it if it just doesn't exist */ - fp = fopen( name, "rb" ); + fp = fopen(name, "rb"); - if ( fp == NULL ) + if (fp == NULL) { continue; } - fclose( fp ); + fclose(fp); - game_library = dlopen( name, RTLD_NOW ); + game_library = dlopen(name, RTLD_NOW); - if ( game_library ) + if (game_library) { - Com_MDPrintf( "LoadLibrary (%s)\n", name ); + Com_MDPrintf("LoadLibrary (%s)\n", name); break; } else { - Com_Printf( "LoadLibrary (%s):", name ); + Com_Printf("LoadLibrary (%s):", name); - path = (char *) dlerror(); - str_p = strchr( path, ':' ); /* skip the path (already shown) */ + path = (char *)dlerror(); + str_p = strchr(path, ':'); /* skip the path (already shown) */ - if ( str_p == NULL ) + if (str_p == NULL) { str_p = path; } @@ -420,33 +446,31 @@ Sys_GetGameAPI ( void *parms ) str_p++; } - Com_Printf( "%s\n", str_p ); + Com_Printf("%s\n", str_p); - return ( NULL ); + return NULL; } } - GetGameAPI = (void *) dlsym( game_library, "GetGameAPI" ); + GetGameAPI = (void *)dlsym(game_library, "GetGameAPI"); - if ( !GetGameAPI ) + if (!GetGameAPI) { Sys_UnloadGame(); - return ( NULL ); + return NULL; } - return ( GetGameAPI( parms ) ); + return GetGameAPI(parms); } void -Sys_SendKeyEvents ( void ) +Sys_SendKeyEvents(void) { #ifndef DEDICATED_ONLY - - if ( IN_Update_fp ) + if (IN_Update_fp) { IN_Update_fp(); } - #endif /* grab frame time */ diff --git a/src/unix/vid.c b/src/unix/vid.c index 4e941645..8a58efa3 100644 --- a/src/unix/vid.c +++ b/src/unix/vid.c @@ -45,69 +45,70 @@ refexport_t re; /* Console variables that we need to access from this module */ -cvar_t *vid_gamma; -cvar_t *vid_ref; /* Name of Refresh DLL loaded */ -cvar_t *vid_xpos; /* X coordinate of window position */ -cvar_t *vid_ypos; /* Y coordinate of window position */ -cvar_t *vid_fullscreen; +cvar_t *vid_gamma; +cvar_t *vid_ref; /* Name of Refresh DLL loaded */ +cvar_t *vid_xpos; /* X coordinate of window position */ +cvar_t *vid_ypos; /* Y coordinate of window position */ +cvar_t *vid_fullscreen; /* Global variables used internally by this module */ viddef_t viddef; /* global video state; used by other modules */ -void *reflib_library; /* Handle to refresh DLL */ +void *reflib_library; /* Handle to refresh DLL */ qboolean reflib_active = 0; -#define VID_NUM_MODES ( sizeof ( vid_modes ) / sizeof ( vid_modes [ 0 ] ) ) +#define VID_NUM_MODES (sizeof(vid_modes) / sizeof(vid_modes[0])) /* INPUT */ -void Do_Key_Event ( int key, qboolean down ); -void ( *IN_Update_fp )( void ); -void ( *IN_KeyboardInit_fp )( Key_Event_fp_t fp ); -void ( *IN_Close_fp )( void ); +void Do_Key_Event(int key, qboolean down); + +void (*IN_Update_fp)(void); +void (*IN_KeyboardInit_fp)(Key_Event_fp_t fp); +void (*IN_Close_fp)(void); in_state_t in_state; -void ( *IN_BackendInit_fp )( in_state_t *in_state_p ); -void ( *IN_BackendShutdown_fp )( void ); -void ( *IN_BackendMouseButtons_fp )( void ); -void ( *IN_BackendMove_fp )( usercmd_t *cmd ); +void (*IN_BackendInit_fp)(in_state_t *in_state_p); +void (*IN_BackendShutdown_fp)(void); +void (*IN_BackendMouseButtons_fp)(void); +void (*IN_BackendMove_fp)(usercmd_t *cmd); -extern void VID_MenuShutdown ( void ); +extern void VID_MenuShutdown(void); /* DLL GLUE */ #define MAXPRINTMSG 4096 void -VID_Printf ( int print_level, char *fmt, ... ) +VID_Printf(int print_level, char *fmt, ...) { va_list argptr; - char msg [ MAXPRINTMSG ]; + char msg[MAXPRINTMSG]; - va_start( argptr, fmt ); - vsnprintf( msg, MAXPRINTMSG, fmt, argptr ); - va_end( argptr ); + va_start(argptr, fmt); + vsnprintf(msg, MAXPRINTMSG, fmt, argptr); + va_end(argptr); - if ( print_level == PRINT_ALL ) + if (print_level == PRINT_ALL) { - Com_Printf( "%s", msg ); + Com_Printf("%s", msg); } else { - Com_DPrintf( "%s", msg ); + Com_DPrintf("%s", msg); } } void -VID_Error ( int err_level, char *fmt, ... ) +VID_Error(int err_level, char *fmt, ...) { va_list argptr; - char msg [ MAXPRINTMSG ]; + char msg[MAXPRINTMSG]; - va_start( argptr, fmt ); - vsnprintf( msg, MAXPRINTMSG, fmt, argptr ); - va_end( argptr ); + va_start(argptr, fmt); + vsnprintf(msg, MAXPRINTMSG, fmt, argptr); + va_end(argptr); - Com_Error( err_level, "%s", msg ); + Com_Error(err_level, "%s", msg); } /* @@ -116,7 +117,7 @@ VID_Error ( int err_level, char *fmt, ... ) * cause the entire video mode and refresh DLL to be reset on the next frame. */ void -VID_Restart_f ( void ) +VID_Restart_f(void) { vid_ref->modified = true; } @@ -130,68 +131,68 @@ typedef struct vidmode_s /* This must be the same as in menu.c! */ vidmode_t vid_modes[] = { - { "Mode 0: 320x240", 320, 240, 0 }, - { "Mode 1: 400x300", 400, 300, 1 }, - { "Mode 2: 512x384", 512, 384, 2 }, - { "Mode 3: 640x400", 640, 400, 3 }, - { "Mode 4: 640x480", 640, 480, 4 }, - { "Mode 5: 800x500", 800, 500, 5 }, - { "Mode 6: 800x600", 800, 600, 6 }, - { "Mode 7: 960x720", 960, 720, 7 }, - { "Mode 8: 1024x480", 1024, 480, 8 }, - { "Mode 9: 1024x640", 1024, 640, 9 }, - { "Mode 10: 1024x768", 1024, 768, 10 }, - { "Mode 11: 1152x768", 1152, 768, 11 }, - { "Mode 12: 1152x864", 1152, 864, 12 }, - { "Mode 13: 1280x800", 1280, 800, 13 }, - { "Mode 14: 1280x854", 1280, 854, 14 }, - { "Mode 15: 1280x960", 1280, 860, 15 }, - { "Mode 16: 1280x1024", 1280, 1024, 16 }, - { "Mode 17: 1440x900", 1440, 900, 17 }, - { "Mode 18: 1600x1200", 1600, 1200, 18 }, - { "Mode 19: 1680x1050", 1680, 1050, 19 }, - { "Mode 20: 1920x1080", 1920, 1080, 20 }, - { "Mode 21: 1920x1200", 1920, 1200, 21 }, - { "Mode 22: 2048x1536", 2048, 1536, 22 }, + {"Mode 0: 320x240", 320, 240, 0}, + {"Mode 1: 400x300", 400, 300, 1}, + {"Mode 2: 512x384", 512, 384, 2}, + {"Mode 3: 640x400", 640, 400, 3}, + {"Mode 4: 640x480", 640, 480, 4}, + {"Mode 5: 800x500", 800, 500, 5}, + {"Mode 6: 800x600", 800, 600, 6}, + {"Mode 7: 960x720", 960, 720, 7}, + {"Mode 8: 1024x480", 1024, 480, 8}, + {"Mode 9: 1024x640", 1024, 640, 9}, + {"Mode 10: 1024x768", 1024, 768, 10}, + {"Mode 11: 1152x768", 1152, 768, 11}, + {"Mode 12: 1152x864", 1152, 864, 12}, + {"Mode 13: 1280x800", 1280, 800, 13}, + {"Mode 14: 1280x854", 1280, 854, 14}, + {"Mode 15: 1280x960", 1280, 860, 15}, + {"Mode 16: 1280x1024", 1280, 1024, 16}, + {"Mode 17: 1440x900", 1440, 900, 17}, + {"Mode 18: 1600x1200", 1600, 1200, 18}, + {"Mode 19: 1680x1050", 1680, 1050, 19}, + {"Mode 20: 1920x1080", 1920, 1080, 20}, + {"Mode 21: 1920x1200", 1920, 1200, 21}, + {"Mode 22: 2048x1536", 2048, 1536, 22}, }; qboolean -VID_GetModeInfo ( int *width, int *height, int mode ) +VID_GetModeInfo(int *width, int *height, int mode) { - if ( ( mode < 0 ) || ( mode >= VID_NUM_MODES ) ) + if ((mode < 0) || (mode >= VID_NUM_MODES)) { - return ( false ); + return false; } - *width = vid_modes [ mode ].width; - *height = vid_modes [ mode ].height; + *width = vid_modes[mode].width; + *height = vid_modes[mode].height; - return ( true ); + return true; } void -VID_NewWindow ( int width, int height ) +VID_NewWindow(int width, int height) { - viddef.width = width; + viddef.width = width; viddef.height = height; } void -VID_FreeReflib ( void ) +VID_FreeReflib(void) { - if ( reflib_library ) + if (reflib_library) { - if ( IN_Close_fp ) + if (IN_Close_fp) { IN_Close_fp(); } - if ( IN_BackendShutdown_fp ) + if (IN_BackendShutdown_fp) { IN_BackendShutdown_fp(); } - dlclose( reflib_library ); + dlclose(reflib_library); } IN_KeyboardInit_fp = NULL; @@ -202,28 +203,28 @@ VID_FreeReflib ( void ) IN_BackendMouseButtons_fp = NULL; IN_BackendMove_fp = NULL; - memset( &re, 0, sizeof ( re ) ); + memset(&re, 0, sizeof(re)); reflib_library = NULL; - reflib_active = false; + reflib_active = false; } qboolean -VID_LoadRefresh ( char *name ) +VID_LoadRefresh(char *name) { refimport_t ri; R_GetRefAPI_t R_GetRefAPI; - char fn [ MAX_OSPATH ]; - char *path; + char fn[MAX_OSPATH]; + char *path; struct stat st; - if ( reflib_active ) + if (reflib_active) { - if ( IN_Close_fp ) + if (IN_Close_fp) { IN_Close_fp(); } - if ( IN_BackendShutdown_fp ) + if (IN_BackendShutdown_fp) { IN_BackendShutdown_fp(); } @@ -234,24 +235,24 @@ VID_LoadRefresh ( char *name ) VID_FreeReflib(); } - Com_Printf( "----- refresher initialization -----\n"); + Com_Printf("----- refresher initialization -----\n"); - path = Cvar_Get( "basedir", ".", CVAR_NOSET )->string; - snprintf( fn, MAX_OSPATH, "%s/%s", path, name ); + path = Cvar_Get("basedir", ".", CVAR_NOSET)->string; + snprintf(fn, MAX_OSPATH, "%s/%s", path, name); - if ( stat( fn, &st ) == -1 ) + if (stat(fn, &st) == -1) { - Com_Printf( "LoadLibrary(\"%s\") failed: %s\n", name, strerror( errno ) ); - return ( false ); + Com_Printf("LoadLibrary(\"%s\") failed: %s\n", name, strerror(errno)); + return false; } - if ( ( reflib_library = dlopen( fn, RTLD_LAZY ) ) == 0 ) + if ((reflib_library = dlopen(fn, RTLD_LAZY)) == 0) { - Com_Printf( "LoadLibrary(\"%s\") failed: %s\n", name, dlerror() ); - return ( false ); + Com_Printf("LoadLibrary(\"%s\") failed: %s\n", name, dlerror()); + return false; } - Com_Printf( "LoadLibrary(\"%s\")\n", fn ); + Com_Printf("LoadLibrary(\"%s\")\n", fn); ri.Cmd_AddCommand = Cmd_AddCommand; ri.Cmd_RemoveCommand = Cmd_RemoveCommand; @@ -271,17 +272,17 @@ VID_LoadRefresh ( char *name ) ri.Vid_MenuInit = VID_MenuInit; ri.Vid_NewWindow = VID_NewWindow; - if ( ( R_GetRefAPI = (void *) dlsym( reflib_library, "R_GetRefAPI" ) ) == 0 ) + if ((R_GetRefAPI = (void *)dlsym(reflib_library, "R_GetRefAPI")) == 0) { - Com_Error( ERR_FATAL, "dlsym failed on %s", name ); + Com_Error(ERR_FATAL, "dlsym failed on %s", name); } - re = R_GetRefAPI( ri ); + re = R_GetRefAPI(ri); - if ( re.api_version != API_VERSION ) + if (re.api_version != API_VERSION) { VID_FreeReflib(); - Com_Error( ERR_FATAL, "%s has incompatible api_version", name ); + Com_Error(ERR_FATAL, "%s has incompatible api_version", name); } /* Init IN (Mouse) */ @@ -291,40 +292,40 @@ VID_LoadRefresh ( char *name ) in_state.in_strafe_state = &in_strafe.state; in_state.in_speed_state = &in_speed.state; - if ( ( ( IN_BackendInit_fp = dlsym( reflib_library, "IN_BackendInit" ) ) == NULL ) || - ( ( IN_BackendShutdown_fp = dlsym( reflib_library, "IN_BackendShutdown" ) ) == NULL ) || - ( ( IN_BackendMouseButtons_fp = dlsym( reflib_library, "IN_BackendMouseButtons" ) ) == NULL ) || - ( ( IN_BackendMove_fp = dlsym( reflib_library, "IN_BackendMove" ) ) == NULL ) ) + if (((IN_BackendInit_fp = dlsym(reflib_library, "IN_BackendInit")) == NULL) || + ((IN_BackendShutdown_fp = dlsym(reflib_library, "IN_BackendShutdown")) == NULL) || + ((IN_BackendMouseButtons_fp = dlsym(reflib_library, "IN_BackendMouseButtons")) == NULL) || + ((IN_BackendMove_fp = dlsym(reflib_library, "IN_BackendMove")) == NULL)) { - Com_Error( ERR_FATAL, "No input backend init functions in REF.\n" ); + Com_Error(ERR_FATAL, "No input backend init functions in REF.\n"); } - if ( IN_BackendInit_fp ) + if (IN_BackendInit_fp) { - IN_BackendInit_fp( &in_state ); + IN_BackendInit_fp(&in_state); } - if ( re.Init( 0, 0 ) == -1 ) + if (re.Init(0, 0) == -1) { re.Shutdown(); VID_FreeReflib(); - return ( false ); + return false; } /* Init IN */ - if ( ( ( IN_KeyboardInit_fp = dlsym( reflib_library, "IN_KeyboardInit" ) ) == NULL ) || - ( ( IN_Update_fp = dlsym( reflib_library, "IN_Update" ) ) == NULL ) || - ( ( IN_Close_fp = dlsym( reflib_library, "IN_Close" ) ) == NULL ) ) + if (((IN_KeyboardInit_fp = dlsym(reflib_library, "IN_KeyboardInit")) == NULL) || + ((IN_Update_fp = dlsym(reflib_library, "IN_Update")) == NULL) || + ((IN_Close_fp = dlsym(reflib_library, "IN_Close")) == NULL)) { - Com_Error( ERR_FATAL, "No keyboard input functions in REF.\n" ); + Com_Error(ERR_FATAL, "No keyboard input functions in REF.\n"); } - IN_KeyboardInit_fp( Do_Key_Event ); + IN_KeyboardInit_fp(Do_Key_Event); Key_ClearStates(); - Com_Printf( "------------------------------------\n\n" ); + Com_Printf("------------------------------------\n\n"); reflib_active = true; - return ( true ); + return true; } /* @@ -334,16 +335,16 @@ VID_LoadRefresh ( char *name ) * and/or video mode to match. */ void -VID_CheckChanges ( void ) +VID_CheckChanges(void) { - char name [ 100 ]; + char name[100]; - if ( vid_ref->modified ) + if (vid_ref->modified) { S_StopAllSounds(); } - while ( vid_ref->modified ) + while (vid_ref->modified) { /* refresh has changed */ vid_ref->modified = false; @@ -351,47 +352,46 @@ VID_CheckChanges ( void ) cl.refresh_prepped = false; cls.disable_screen = true; - sprintf( name, "ref_%s.so", vid_ref->string ); + sprintf(name, "ref_%s.so", vid_ref->string); - if ( !VID_LoadRefresh( name ) ) + if (!VID_LoadRefresh(name)) { - Cvar_Set( "vid_ref", "gl" ); + Cvar_Set("vid_ref", "gl"); } cls.disable_screen = false; } } - void -VID_Init ( void ) +VID_Init(void) { /* Create the video variables so we know how to start the graphics drivers */ - vid_ref = Cvar_Get( "vid_ref", "gl", CVAR_ARCHIVE ); + vid_ref = Cvar_Get("vid_ref", "gl", CVAR_ARCHIVE); - vid_xpos = Cvar_Get( "vid_xpos", "3", CVAR_ARCHIVE ); - vid_ypos = Cvar_Get( "vid_ypos", "22", CVAR_ARCHIVE ); - vid_fullscreen = Cvar_Get( "vid_fullscreen", "0", CVAR_ARCHIVE ); - vid_gamma = Cvar_Get( "vid_gamma", "1", CVAR_ARCHIVE ); + vid_xpos = Cvar_Get("vid_xpos", "3", CVAR_ARCHIVE); + vid_ypos = Cvar_Get("vid_ypos", "22", CVAR_ARCHIVE); + vid_fullscreen = Cvar_Get("vid_fullscreen", "0", CVAR_ARCHIVE); + vid_gamma = Cvar_Get("vid_gamma", "1", CVAR_ARCHIVE); /* Add some console commands that we want to handle */ - Cmd_AddCommand( "vid_restart", VID_Restart_f ); + Cmd_AddCommand("vid_restart", VID_Restart_f); /* Start the graphics mode and load refresh DLL */ VID_CheckChanges(); } void -VID_Shutdown ( void ) +VID_Shutdown(void) { - if ( reflib_active ) + if (reflib_active) { - if ( IN_Close_fp ) + if (IN_Close_fp) { IN_Close_fp(); } - if ( IN_BackendShutdown_fp ) + if (IN_BackendShutdown_fp) { IN_BackendShutdown_fp(); } @@ -411,55 +411,56 @@ VID_Shutdown ( void ) * ever have their names changed. */ qboolean -VID_CheckRefExists ( const char *ref ) +VID_CheckRefExists(const char *ref) { - char fn [ MAX_OSPATH ]; - char *path; + char fn[MAX_OSPATH]; + char *path; struct stat st; - path = Cvar_Get( "basedir", ".", CVAR_NOSET )->string; - snprintf( fn, MAX_OSPATH, "%s/ref_%s.so", path, ref ); + path = Cvar_Get("basedir", ".", CVAR_NOSET)->string; + snprintf(fn, MAX_OSPATH, "%s/ref_%s.so", path, ref); - if ( stat( fn, &st ) == 0 ) + if (stat(fn, &st) == 0) { - return ( true ); + return true; } else { - return ( false ); + return false; } } /* INPUT */ void -IN_Shutdown ( void ) +IN_Shutdown(void) { - if ( IN_BackendShutdown_fp ) + if (IN_BackendShutdown_fp) { IN_BackendShutdown_fp(); } } void -IN_Commands ( void ) +IN_Commands(void) { - if ( IN_BackendMouseButtons_fp ) + if (IN_BackendMouseButtons_fp) { IN_BackendMouseButtons_fp(); } } void -IN_Move ( usercmd_t *cmd ) +IN_Move(usercmd_t *cmd) { - if ( IN_BackendMove_fp ) + if (IN_BackendMove_fp) { - IN_BackendMove_fp( cmd ); + IN_BackendMove_fp(cmd); } } void -Do_Key_Event ( int key, qboolean down ) +Do_Key_Event(int key, qboolean down) { - Key_Event( key, down, Sys_Milliseconds() ); + Key_Event(key, down, Sys_Milliseconds()); } +