├── icon2.ico ├── quake.ico ├── quake.rc ├── demo_fw.pcx ├── demo_rw.pcx ├── .gitattributes ├── changelog.txt ├── demo_bar.pcx ├── menufont.pcx ├── .gitignore ├── pngasmrd.h ├── version.h ├── dzip.h ├── README.md ├── reQuiem.dsw ├── resource.h ├── music.h ├── crc.h ├── movie.h ├── wad.h ├── conproc.h ├── snd_mac.c ├── security.h ├── input.h ├── net_none.c ├── net_loop.h ├── net_vcr.h ├── prglobals.h ├── jconfig.h ├── movie_avi.h ├── nehahra.h ├── security.c ├── cdaudio.h ├── menu.h ├── fmod_errors.h ├── prfields.h ├── net_udp.h ├── net_wipx.h ├── net_wins.h ├── modelgen.h ├── view.h ├── screen.h ├── console.h ├── net_dgrm.h ├── net_bsd.c ├── version.c ├── sbar.h ├── sys_x86.s ├── cd_mac.c ├── asm_i386.h ├── chase.c ├── spritegn.h ├── net_win.c ├── sys.h ├── cl_effect_H2.h ├── world.h ├── progdefs.h ├── vid.h ├── gl_warp_sin.h ├── makefile.linux ├── makefile.mingw ├── crc.c ├── zone.h ├── draw.h ├── winquake.h ├── fontsize.lmp ├── net_vcr.c ├── keys.h ├── pr_comp.h ├── progdefs_H2.h ├── gl_refrag.c ├── cvar.h ├── dzlib.h ├── wad.c ├── sound.h ├── snd_mixa.s ├── mathlib.h ├── net_loop.c ├── cd_linux.c ├── anorms.h ├── cmd.h ├── quakeasm.h └── menu_H2.c /icon2.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpiritQuaddicted/reQuiem/HEAD/icon2.ico -------------------------------------------------------------------------------- /quake.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpiritQuaddicted/reQuiem/HEAD/quake.ico -------------------------------------------------------------------------------- /quake.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpiritQuaddicted/reQuiem/HEAD/quake.rc -------------------------------------------------------------------------------- /demo_fw.pcx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpiritQuaddicted/reQuiem/HEAD/demo_fw.pcx -------------------------------------------------------------------------------- /demo_rw.pcx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpiritQuaddicted/reQuiem/HEAD/demo_rw.pcx -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /changelog.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpiritQuaddicted/reQuiem/HEAD/changelog.txt -------------------------------------------------------------------------------- /demo_bar.pcx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpiritQuaddicted/reQuiem/HEAD/demo_bar.pcx -------------------------------------------------------------------------------- /menufont.pcx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpiritQuaddicted/reQuiem/HEAD/menufont.pcx -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | gas2masm.exe 2 | DebugGL/ 3 | release_gl/ 4 | Server_Debug/ 5 | release_glx/ 6 | -------------------------------------------------------------------------------- /pngasmrd.h: -------------------------------------------------------------------------------- 1 | /* pngasmrd.h - assembler version of utilities to read a PNG file 2 | * 3 | * libpng 1.2.5 - October 3, 2002 4 | * For conditions of distribution and use, see copyright notice in png.h 5 | * Copyright (c) 2002 Glenn Randers-Pehrson 6 | * 7 | */ 8 | 9 | /* This file is obsolete in libpng-1.0.9 and later; its contents now appear 10 | * at the end of pngconf.h. 11 | */ 12 | -------------------------------------------------------------------------------- /version.h: -------------------------------------------------------------------------------- 1 | // version.h 2 | 3 | #define SERVER_VERSION 1.09 4 | //#define SERVER_VERSION_PLUS 1.10 5 | 6 | #ifdef HEXEN2_SUPPORT 7 | #define SERVER_VERSION_H2 1.12 8 | #endif 9 | 10 | #define REQUIEM_VERSION_SHORT "0.95" 11 | #define REQUIEM_VERSION REQUIEM_VERSION_SHORT"-b2" 12 | 13 | int build_number (void); 14 | void Host_Version_f (cmd_source_t src); 15 | char *VersionString (void); 16 | -------------------------------------------------------------------------------- /dzip.h: -------------------------------------------------------------------------------- 1 | 2 | qboolean Dzip_Init (void); 3 | void Dzip_Shutdown (void); 4 | 5 | pack_t *Dzip_LoadFileList (const char *dzpath); 6 | void Dzip_Close (void *dzhandle); 7 | 8 | FILE * Dzip_ExtractFile (void *dzhandle, int index); 9 | FILE * Dzip_OpenFromArchive (const char *dzpath, const char *filename); 10 | 11 | qboolean Dzip_CompressFile (const char *path, const char *filename, const char *dzname, qboolean stdzip); 12 | qboolean Dzip_Verify (const char *dzpath); 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | reQuiem 2 | ======= 3 | 4 | reQuiem is a custom OpenGL Quake engine for Windows and Linux. It's designed for maximum compatibility with all things Quake - past, present and future. It's fast, reliable, and easy to configure. In short: it fixes what was broken, improves what needed improving, and leaves the rest alone. It was developed by jdhack. 5 | 6 | Read this 7 | ========= 8 | 9 | You are looking at this before it is ready. 10 | 11 | TODO 12 | ==== 13 | 14 | - Some nicer README.md 15 | - Binaries 16 | - Update changelog and readme 17 | - Add known issues and bugs and feature requests 18 | -------------------------------------------------------------------------------- /reQuiem.dsw: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 6.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | 4 | ############################################################################### 5 | 6 | Project: "reQuiem"=reQuiem.dsp - Package Owner=<4> 7 | 8 | Package=<5> 9 | {{{ 10 | }}} 11 | 12 | Package=<4> 13 | {{{ 14 | }}} 15 | 16 | ############################################################################### 17 | 18 | Global: 19 | 20 | Package=<5> 21 | {{{ 22 | }}} 23 | 24 | Package=<3> 25 | {{{ 26 | }}} 27 | 28 | ############################################################################### 29 | 30 | -------------------------------------------------------------------------------- /resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Developer Studio generated include file. 3 | // Used by quake.rc 4 | // 5 | #define IDS_STRING1 1 6 | #define IDI_ICON1 1 7 | #define IDI_ICON2 119 8 | #define IDC_PROGRESS 1000 9 | 10 | // Next default values for new objects 11 | // 12 | #ifdef APSTUDIO_INVOKED 13 | #ifndef APSTUDIO_READONLY_SYMBOLS 14 | #define _APS_NEXT_RESOURCE_VALUE 121 15 | #define _APS_NEXT_COMMAND_VALUE 40001 16 | #define _APS_NEXT_CONTROL_VALUE 1004 17 | #define _APS_NEXT_SYMED_VALUE 101 18 | #endif 19 | #endif 20 | -------------------------------------------------------------------------------- /music.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __MUSIC_H__ 3 | #define __MUSIC_H__ 4 | 5 | #ifndef QUAKE_GAME 6 | #include "quakedef.h" 7 | #endif 8 | 9 | qboolean Music_Init (void); 10 | qboolean Music_IsInitialized (void); 11 | void Music_Shutdown (void); 12 | 13 | void Music_ChangeVolume (float value); // value is 0-1 14 | void Music_ChangeVolume_f (cmd_source_t src); 15 | 16 | void Music_Stop_f (cmd_source_t src); 17 | void Music_Pause_f (cmd_source_t src); 18 | void Music_Resume (void); 19 | 20 | qboolean Music_PlayTrack (cmd_source_t src, byte track, qboolean loop); 21 | 22 | #ifdef HEXEN2_SUPPORT 23 | void Music_PlayMIDI_f (cmd_source_t src); 24 | void Music_PlayMIDI (cmd_source_t src, const char *name); 25 | 26 | void Music_Loop_f (cmd_source_t src); 27 | #endif 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /crc.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | // crc.h 21 | 22 | void CRC_Init (unsigned short *crcvalue); 23 | void CRC_ProcessByte (unsigned short *crcvalue, byte data); 24 | unsigned short CRC_Value (unsigned short crcvalue); 25 | unsigned short CRC_Block (const byte *data, int size); 26 | -------------------------------------------------------------------------------- /movie.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002 Quake done Quick 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | // movie.h 21 | 22 | void Movie_Init (void); 23 | void Movie_StopDemoCapture (void); 24 | double Movie_FrameTime (void); 25 | void Movie_UpdateScreen (void); 26 | void Movie_TransferStereo16 (short *data, int len); 27 | qboolean Movie_GetSoundtime (void); 28 | qboolean Movie_IsActive (void); 29 | void Movie_UpdateColorRamps (void); 30 | -------------------------------------------------------------------------------- /wad.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | // wad.h 21 | 22 | typedef struct 23 | { 24 | int width, height; 25 | byte data[4]; // variably sized 26 | } qpic_t; 27 | 28 | qboolean W_LoadWadFile (const char *filename); 29 | void *W_GetLumpByName (const char *name, int *size_out); 30 | byte * Wad_LoadPalette (void); 31 | byte * Wad_LoadColormap (void); 32 | 33 | void SwapPic (qpic_t *pic); 34 | -------------------------------------------------------------------------------- /conproc.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | // conproc.h 21 | 22 | #define CCOM_WRITE_TEXT 0x2 23 | // Param1 : Text 24 | 25 | #define CCOM_GET_TEXT 0x3 26 | // Param1 : Begin line 27 | // Param2 : End line 28 | 29 | #define CCOM_GET_SCR_LINES 0x4 30 | // No params 31 | 32 | #define CCOM_SET_SCR_LINES 0x5 33 | // Param1 : Number of lines 34 | 35 | void InitConProc (HANDLE hFile, HANDLE heventParent, HANDLE heventChild); 36 | void DeinitConProc (void); 37 | 38 | -------------------------------------------------------------------------------- /snd_mac.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | /**** NEEDS IMPLEMENTING!!! ****/ 22 | 23 | 24 | #include "quakedef.h" 25 | 26 | qboolean SNDDMA_Init (void) 27 | { 28 | return false; 29 | } 30 | 31 | int SNDDMA_GetDMAPos (void) 32 | { 33 | return 0; 34 | } 35 | 36 | void SNDDMA_Shutdown (void) 37 | { 38 | } 39 | 40 | /* 41 | ============== 42 | SNDDMA_Submit 43 | 44 | Send sound to device if buffer isn't really the dma buffer 45 | =============== 46 | */ 47 | void SNDDMA_Submit (void) 48 | { 49 | } 50 | -------------------------------------------------------------------------------- /security.h: -------------------------------------------------------------------------------- 1 | // 2 | // security.h 3 | // 4 | // Created by JPG for ProQuake v3.20 5 | // 6 | 7 | #ifndef SECURITY_H 8 | #define SECURITY_H 9 | 10 | extern qboolean pq_cheatfreeEnabled; 11 | extern qboolean pq_cheatfree; 12 | extern unsigned long net_seed; 13 | extern unsigned long net_seed75; 14 | extern unsigned long qsmackAddr; 15 | extern qboolean qsmackActive; 16 | extern cvar_t pq_cvar_cheatfree; 17 | 18 | // Functions exported by security module 19 | typedef void (*Security_InitCRC_t) (unsigned k); 20 | typedef void (*Security_SetSeed_t) (unsigned long seed, char *filename); 21 | typedef void (*Security_Encode_t) (unsigned char *src, unsigned char *dst, int len, int to); 22 | typedef void (*Security_Decode_t) (unsigned char *src, unsigned char *dst, int len, int from); 23 | typedef unsigned long (*Security_CRC_t) (unsigned char *data, int len); 24 | typedef unsigned (*Security_CRC_File_t) (char *filename); 25 | typedef int (*Security_Verify_t) (unsigned a, unsigned b); 26 | 27 | extern Security_InitCRC_t Security_InitCRC; 28 | extern Security_SetSeed_t Security_SetSeed; 29 | extern Security_Decode_t Security_Decode; 30 | extern Security_Encode_t Security_Encode; 31 | extern Security_CRC_t Security_CRC; 32 | extern Security_CRC_File_t Security_CRC_File; 33 | extern Security_Verify_t Security_Verify; 34 | 35 | void Security_Init (void); 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /input.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | // input.h -- external (non-keyboard) input devices 21 | 22 | void IN_Init (void); 23 | 24 | void IN_Shutdown (void); 25 | 26 | void IN_Commands (void); 27 | // oportunity for devices to stick commands on the script buffer 28 | 29 | void IN_Move (usercmd_t *cmd); 30 | // add additional movement on top of the keyboard move cmd 31 | 32 | void IN_SetupKeyMap (void); 33 | 34 | #ifdef _WIN32 35 | void IN_ClearStates (void); 36 | // restores all button and position states to defaults 37 | void IN_Accumulate (void); 38 | #endif 39 | 40 | extern cvar_t _windowed_mouse; 41 | -------------------------------------------------------------------------------- /net_none.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | #include "quakedef.h" 21 | 22 | #include "net_loop.h" 23 | 24 | net_driver_t net_drivers[MAX_NET_DRIVERS] = 25 | { 26 | { 27 | "Loopback", 28 | false, 29 | Loop_Init, 30 | Loop_Listen, 31 | Loop_SearchForHosts, 32 | Loop_Connect, 33 | Loop_CheckNewConnections, 34 | Loop_GetMessage, 35 | Loop_SendMessage, 36 | Loop_SendUnreliableMessage, 37 | Loop_CanSendMessage, 38 | Loop_CanSendUnreliableMessage, 39 | Loop_Close, 40 | Loop_Shutdown 41 | } 42 | }; 43 | int net_numdrivers = 1; 44 | 45 | net_landriver_t net_landrivers[MAX_NET_DRIVERS]; 46 | int net_numlandrivers = 0; 47 | -------------------------------------------------------------------------------- /net_loop.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | // net_loop.h 21 | 22 | int Loop_Init (void); 23 | void Loop_Listen (qboolean state); 24 | void Loop_SearchForHosts (qboolean xmit); 25 | qsocket_t *Loop_Connect (const char *host); 26 | qsocket_t *Loop_CheckNewConnections (void); 27 | int Loop_GetMessage (qsocket_t *sock); 28 | int Loop_SendMessage (qsocket_t *sock, sizebuf_t *data); 29 | int Loop_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data); 30 | qboolean Loop_CanSendMessage (qsocket_t *sock); 31 | qboolean Loop_CanSendUnreliableMessage (qsocket_t *sock); 32 | void Loop_Close (qsocket_t *sock); 33 | void Loop_Shutdown (void); 34 | -------------------------------------------------------------------------------- /net_vcr.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | // net_vcr.h 21 | 22 | #define VCR_OP_CONNECT 1 23 | #define VCR_OP_GETMESSAGE 2 24 | #define VCR_OP_SENDMESSAGE 3 25 | #define VCR_OP_CANSENDMESSAGE 4 26 | #define VCR_MAX_MESSAGE 4 27 | 28 | int VCR_Init (void); 29 | void VCR_Listen (qboolean state); 30 | void VCR_SearchForHosts (qboolean xmit); 31 | qsocket_t *VCR_Connect (const char *host); 32 | qsocket_t *VCR_CheckNewConnections (void); 33 | int VCR_GetMessage (qsocket_t *sock); 34 | int VCR_SendMessage (qsocket_t *sock, sizebuf_t *data); 35 | qboolean VCR_CanSendMessage (qsocket_t *sock); 36 | void VCR_Close (qsocket_t *sock); 37 | void VCR_Shutdown (void); 38 | -------------------------------------------------------------------------------- /prglobals.h: -------------------------------------------------------------------------------- 1 | /* JDH: split off from progdefs.h */ 2 | 3 | int pad[28]; 4 | int self; 5 | int other; 6 | int world; 7 | float time; 8 | float frametime; 9 | #ifndef PRGLOBALS_BETA 10 | float force_retouch; // not in beta QC 11 | #endif 12 | string_t mapname; 13 | float deathmatch; 14 | float coop; 15 | float teamplay; 16 | float serverflags; 17 | float total_secrets; 18 | float total_monsters; 19 | float found_secrets; 20 | float killed_monsters; 21 | float parm1; 22 | float parm2; 23 | float parm3; 24 | float parm4; 25 | float parm5; 26 | float parm6; 27 | float parm7; 28 | float parm8; 29 | float parm9; 30 | float parm10; 31 | float parm11; 32 | float parm12; 33 | float parm13; 34 | float parm14; 35 | float parm15; 36 | float parm16; 37 | vec3_t v_forward; 38 | vec3_t v_up; 39 | vec3_t v_right; 40 | float trace_allsolid; 41 | float trace_startsolid; 42 | float trace_fraction; 43 | vec3_t trace_endpos; 44 | vec3_t trace_plane_normal; 45 | float trace_plane_dist; 46 | int trace_ent; 47 | float trace_inopen; 48 | float trace_inwater; 49 | #ifndef PRGLOBALS_BETA 50 | int msg_entity; // not in beta QC 51 | #endif 52 | func_t main; 53 | func_t StartFrame; 54 | func_t PlayerPreThink; 55 | func_t PlayerPostThink; 56 | func_t ClientKill; 57 | func_t ClientConnect; 58 | func_t PutClientInServer; 59 | func_t ClientDisconnect; 60 | func_t SetNewParms; 61 | func_t SetChangeParms; 62 | -------------------------------------------------------------------------------- /jconfig.h: -------------------------------------------------------------------------------- 1 | /* jconfig.vc --- jconfig.h for Microsoft Visual C++ on Windows 95 or NT. */ 2 | /* see jconfig.doc for explanations */ 3 | 4 | #define HAVE_PROTOTYPES 5 | #define HAVE_UNSIGNED_CHAR 6 | #define HAVE_UNSIGNED_SHORT 7 | /* #define void char */ 8 | /* #define const */ 9 | #undef CHAR_IS_UNSIGNED 10 | #define HAVE_STDDEF_H 11 | #define HAVE_STDLIB_H 12 | #undef NEED_BSD_STRINGS 13 | #undef NEED_SYS_TYPES_H 14 | #undef NEED_FAR_POINTERS /* we presume a 32-bit flat memory model */ 15 | #undef NEED_SHORT_EXTERNAL_NAMES 16 | #undef INCOMPLETE_TYPES_BROKEN 17 | 18 | /* Define "boolean" as unsigned char, not int, per Windows custom */ 19 | #ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */ 20 | typedef unsigned char boolean; 21 | #endif 22 | #define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */ 23 | 24 | 25 | #ifdef JPEG_INTERNALS 26 | 27 | #undef RIGHT_SHIFT_IS_UNSIGNED 28 | 29 | #endif /* JPEG_INTERNALS */ 30 | 31 | #ifdef JPEG_CJPEG_DJPEG 32 | 33 | #define BMP_SUPPORTED /* BMP image file format */ 34 | #define GIF_SUPPORTED /* GIF image file format */ 35 | #define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ 36 | #undef RLE_SUPPORTED /* Utah RLE image file format */ 37 | #define TARGA_SUPPORTED /* Targa image file format */ 38 | 39 | #define TWO_FILE_COMMANDLINE /* optional */ 40 | #define USE_SETMODE /* Microsoft has setmode() */ 41 | #undef NEED_SIGNAL_CATCHER 42 | #undef DONT_USE_B_MODE 43 | #undef PROGRESS_REPORT /* optional */ 44 | 45 | #endif /* JPEG_CJPEG_DJPEG */ 46 | -------------------------------------------------------------------------------- /movie_avi.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002 Quake done Quick 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | // movie_avi.h 21 | 22 | // if QWINAVI is defined, the Windows API code in movie_win.c is used. 23 | // Otherwise, LordHavoc's direct AVI creation code is used (movie_avi.c) 24 | 25 | //#define QWINAVI 26 | 27 | qboolean Capture_InitAVI (void); 28 | qboolean Capture_InitACM (void); 29 | qboolean Capture_Open (const char *filename, int width, int height, float fps); 30 | qboolean Capture_WriteVideo (void); 31 | qboolean Capture_WriteAudio (const byte *sample_buffer, int samples); 32 | void Capture_Close (void); 33 | double Capture_FrameTime (void); 34 | qboolean Capture_GetSoundtime (void); 35 | void Capture_UpdateRamps (void); 36 | 37 | extern byte * Movie_ScaleDownBGR (const byte *in, int inw, int inh, byte *out, int outw, int outh); 38 | -------------------------------------------------------------------------------- /nehahra.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2000 LordHavoc, Ender 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | // nehahra.h 21 | 22 | #define NEHAHRA_VERSION 2.54 23 | 24 | // system types 25 | typedef enum {NEH_TYPE_NONE, NEH_TYPE_DEMO, NEH_TYPE_GAME, NEH_TYPE_BOTH} neh_gametype_t; 26 | 27 | extern neh_gametype_t NehGameType; 28 | 29 | #ifndef RQM_SV_ONLY 30 | extern char prev_skybox[64]; 31 | 32 | extern cvar_t gl_notrans, r_waterripple; 33 | 34 | extern float r_modelalpha; 35 | 36 | extern sfx_t *known_sfx; 37 | extern int num_sfx, num_sfxorig; 38 | 39 | void Neh_ResetSFX (void); 40 | void Neh_ChangeMusicVol (float value); 41 | 42 | void SHOWLMP_drawall (void); 43 | void SHOWLMP_clear (void); 44 | void SHOWLMP_decodehide (void); 45 | void SHOWLMP_decodeshow (void); 46 | 47 | #endif //#ifndef RQM_SV_ONLY 48 | 49 | void Neh_Init (void); 50 | void Neh_InitEnv (void); 51 | void Neh_InitVars (void); 52 | void Neh_UninitEnv (void); 53 | 54 | -------------------------------------------------------------------------------- /security.c: -------------------------------------------------------------------------------- 1 | // 2 | // security.c 3 | // 4 | // Created by JPG for ProQuake v3.20 5 | // 6 | 7 | #include "quakedef.h" 8 | 9 | #ifdef _WIN32 10 | #include 11 | #else 12 | #include 13 | #endif 14 | 15 | qboolean pq_cheatfreeEnabled = false; 16 | qboolean pq_cheatfree = false; 17 | unsigned long qsmackAddr; 18 | qboolean qsmackActive = false; // only allow one qsmack connection 19 | unsigned long net_seed; 20 | cvar_t pq_cvar_cheatfree = {"pq_cheatfree", "0"}; 21 | 22 | Security_InitCRC_t Security_InitCRC = NULL; 23 | Security_SetSeed_t Security_SetSeed = NULL; 24 | Security_Decode_t Security_Decode = NULL; 25 | Security_Encode_t Security_Encode = NULL; 26 | Security_CRC_t Security_CRC = NULL; 27 | Security_CRC_File_t Security_CRC_File = NULL; 28 | Security_Verify_t Security_Verify = NULL; 29 | 30 | #ifdef _WIN32 31 | #define PROCADDRESS GetProcAddress 32 | #else 33 | #define PROCADDRESS dlsym 34 | #endif 35 | 36 | #define GETFUNC(f) if (!(Security_##f = (Security_##f##_t) PROCADDRESS(h, "Security_" #f))) goto error 37 | 38 | void Security_Init (void) 39 | { 40 | #ifdef _WIN32 41 | HINSTANCE h = LoadLibrary ("qsecurity.dll"); 42 | #else 43 | void *h = dlopen ("./qsecurity.so", RTLD_LAZY); 44 | #endif 45 | 46 | if (!h) 47 | goto error; 48 | 49 | GETFUNC(InitCRC); 50 | GETFUNC(SetSeed); 51 | GETFUNC(Decode); 52 | GETFUNC(Encode); 53 | GETFUNC(CRC); 54 | GETFUNC(CRC_File); 55 | GETFUNC(Verify); 56 | 57 | Security_InitCRC (0x3915c28b); 58 | 59 | pq_cheatfreeEnabled = true; 60 | 61 | Cvar_RegisterBool (&pq_cvar_cheatfree); 62 | Con_Print ("Security module initialized\n"); 63 | 64 | return; 65 | 66 | error: 67 | Con_Print ("\x02" "Security module not found\n"); 68 | } 69 | -------------------------------------------------------------------------------- /cdaudio.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | // cdaudio.h 21 | 22 | int CDAudio_Init (void); 23 | void CDAudio_Play (cmd_source_t src, byte track, qboolean looping); 24 | void CDAudio_Stop (cmd_source_t src); 25 | void CDAudio_Pause (cmd_source_t src); 26 | void CDAudio_Resume (cmd_source_t src); 27 | void CDAudio_Shutdown (void); 28 | void CDAudio_Update (void); 29 | 30 | void CDAudio_Eject (void); 31 | void CDAudio_CloseDoor (void); 32 | int CDAudio_GetNumTracks (void); 33 | 34 | extern qboolean CDAudio_InitDevice (void); 35 | extern void CDAudio_CloseDevice (void); 36 | extern qboolean CDAudio_PlayTrack (byte track, int length); 37 | extern int CDAudio_GetTrackLength (byte track); 38 | extern qboolean CDAudio_StopDevice (void); 39 | extern qboolean CDAudio_PauseDevice (void); 40 | extern qboolean CDAudio_ResumeDevice (void); 41 | extern void CDAudio_UpdateVolume (float vol); 42 | #ifndef _WIN32 43 | extern void CDAudio_Update_Linux (void); 44 | #endif 45 | 46 | -------------------------------------------------------------------------------- /menu.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | // menu.h 21 | 22 | // menus 23 | void M_Init (void); 24 | qboolean M_HandleKey (int key, qboolean down); 25 | void M_Draw (void); 26 | void M_ToggleMenu_f (cmd_source_t src); 27 | void M_Menu_Main_f (cmd_source_t src); 28 | void M_Menu_Quit_f (cmd_source_t src); 29 | 30 | void M_Print (int cx, int cy, const char *str); 31 | void M_PrintWhite (int cx, int cy, const char *str); 32 | void M_PrintBig (int cx, int cy, const char *str); 33 | 34 | void M_DrawPic (int x, int y, const mpic_t *pic); 35 | void M_DrawTransPic (int x, int y, const mpic_t *pic); 36 | 37 | #ifdef HEXEN2_SUPPORT 38 | void M_SetScale (qboolean enable); /*** call this before any other M_xxx calls ***/ 39 | void M_DrawSpinningCursor (int x, int y); 40 | 41 | void M_DrawTransPic2 (int x, int y, const mpic_t *pic); 42 | void M_IPrint (int cx, int cy, const char *str); 43 | #endif 44 | 45 | int M_GetParticlePreset (void); 46 | void M_SetParticlePreset (int preset); 47 | void M_OnChange_gl_smoothfont (float newval); 48 | -------------------------------------------------------------------------------- /fmod_errors.h: -------------------------------------------------------------------------------- 1 | #ifndef _FMOD_ERRORS_H 2 | #define _FMOD_ERRORS_H 3 | 4 | static char *FMOD_ErrorString(int errcode) 5 | { 6 | switch (errcode) 7 | { 8 | case FMOD_ERR_NONE: return "No errors"; 9 | case FMOD_ERR_BUSY: return "Cannot call this command after FSOUND_Init. Call FSOUND_Close first."; 10 | case FMOD_ERR_UNINITIALIZED: return "This command failed because FSOUND_Init was not called"; 11 | case FMOD_ERR_PLAY: return "Playing the sound failed."; 12 | case FMOD_ERR_INIT: return "Error initializing output device."; 13 | case FMOD_ERR_ALLOCATED: return "The output device is already in use and cannot be reused."; 14 | case FMOD_ERR_OUTPUT_FORMAT: return "Soundcard does not support the features needed for this soundsystem (16bit stereo output)"; 15 | case FMOD_ERR_COOPERATIVELEVEL: return "Error setting cooperative level for hardware."; 16 | case FMOD_ERR_CREATEBUFFER: return "Error creating hardware sound buffer."; 17 | case FMOD_ERR_FILE_NOTFOUND: return "File not found"; 18 | case FMOD_ERR_FILE_FORMAT: return "Unknown file format"; 19 | case FMOD_ERR_FILE_BAD: return "Error loading file"; 20 | case FMOD_ERR_MEMORY: return "Not enough memory "; 21 | case FMOD_ERR_VERSION: return "The version number of this file format is not supported"; 22 | case FMOD_ERR_INVALID_PARAM: return "An invalid parameter was passed to this function"; 23 | case FMOD_ERR_NO_EAX: return "Tried to use an EAX command on a non EAX enabled channel or output."; 24 | case FMOD_ERR_CHANNEL_ALLOC: return "Failed to allocate a new channel"; 25 | case FMOD_ERR_RECORD: return "Recording not supported on this device"; 26 | case FMOD_ERR_MEDIAPLAYER: return "Required Mediaplayer codec is not installed"; 27 | 28 | default : return "Unknown error"; 29 | }; 30 | } 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /prfields.h: -------------------------------------------------------------------------------- 1 | /* JDH: split off from progdefs.h */ 2 | 3 | float modelindex; 4 | vec3_t absmin; 5 | vec3_t absmax; 6 | float ltime; 7 | float movetype; 8 | float solid; 9 | vec3_t origin; 10 | #ifndef PRFIELDS_BETA 11 | vec3_t oldorigin; // not in beta QC 12 | #endif 13 | vec3_t velocity; 14 | vec3_t angles; 15 | vec3_t avelocity; 16 | vec3_t punchangle; 17 | string_t classname; 18 | string_t model; 19 | float frame; 20 | float skin; 21 | float effects; 22 | vec3_t mins; 23 | vec3_t maxs; 24 | vec3_t size; 25 | func_t touch; 26 | func_t use; 27 | func_t think; 28 | func_t blocked; 29 | float nextthink; 30 | int groundentity; 31 | float health; 32 | float frags; 33 | float weapon; 34 | string_t weaponmodel; 35 | float weaponframe; 36 | float currentammo; 37 | float ammo_shells; 38 | float ammo_nails; 39 | float ammo_rockets; 40 | float ammo_cells; 41 | float items; 42 | float takedamage; 43 | int chain; 44 | float deadflag; 45 | vec3_t view_ofs; 46 | float button0; 47 | float button1; 48 | float button2; 49 | float impulse; 50 | float fixangle; 51 | vec3_t v_angle; 52 | float idealpitch; 53 | string_t netname; 54 | int enemy; 55 | float flags; 56 | float colormap; 57 | float team; 58 | float max_health; 59 | float teleport_time; 60 | float armortype; 61 | float armorvalue; 62 | float waterlevel; 63 | float watertype; 64 | float ideal_yaw; 65 | float yaw_speed; 66 | int aiment; 67 | int goalentity; 68 | float spawnflags; 69 | string_t target; 70 | string_t targetname; 71 | float dmg_take; 72 | float dmg_save; 73 | int dmg_inflictor; 74 | int owner; 75 | vec3_t movedir; 76 | string_t message; 77 | float sounds; 78 | string_t noise; 79 | string_t noise1; 80 | string_t noise2; 81 | string_t noise3; 82 | -------------------------------------------------------------------------------- /net_udp.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | // net_udp.h 21 | 22 | int UDP_Init (void); 23 | void UDP_Shutdown (void); 24 | void UDP_Listen (qboolean state); 25 | int UDP_OpenSocket (int port); 26 | int UDP_CloseSocket (int socket); 27 | int UDP_Connect (int socket, const struct qsockaddr *addr); 28 | int UDP_CheckNewConnections (void); 29 | int UDP_Read (int socket, byte *buf, int len, const struct qsockaddr *addr); 30 | int UDP_Write (int socket, const byte *buf, int len, const struct qsockaddr *addr); 31 | int UDP_Broadcast (int socket, const byte *buf, int len); 32 | const char * UDP_AddrToString (const struct qsockaddr *addr); 33 | int UDP_StringToAddr (const char *string, struct qsockaddr *addr); 34 | int UDP_GetSocketAddr (int socket, struct qsockaddr *addr); 35 | int UDP_GetNameFromAddr (const struct qsockaddr *addr, char *name, int bufsize); 36 | int UDP_GetAddrFromName (const char *name, struct qsockaddr *addr); 37 | int UDP_AddrCompare (const struct qsockaddr *addr1, const struct qsockaddr *addr2); 38 | int UDP_GetSocketPort (const struct qsockaddr *addr); 39 | int UDP_SetSocketPort (struct qsockaddr *addr, int port); 40 | -------------------------------------------------------------------------------- /net_wipx.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | // net_wipx.h 21 | 22 | int WIPX_Init (void); 23 | void WIPX_Shutdown (void); 24 | void WIPX_Listen (qboolean state); 25 | int WIPX_OpenSocket (int port); 26 | int WIPX_CloseSocket (int socket); 27 | int WIPX_Connect (int socket, const struct qsockaddr *addr); 28 | int WIPX_CheckNewConnections (void); 29 | int WIPX_Read (int socket, byte *buf, int len, const struct qsockaddr *addr); 30 | int WIPX_Write (int socket, const byte *buf, int len, const struct qsockaddr *addr); 31 | int WIPX_Broadcast (int socket, const byte *buf, int len); 32 | const char *WIPX_AddrToString (const struct qsockaddr *addr); 33 | int WIPX_StringToAddr (const char *string, struct qsockaddr *addr); 34 | int WIPX_GetSocketAddr (int socket, struct qsockaddr *addr); 35 | int WIPX_GetNameFromAddr (const struct qsockaddr *addr, char *name, int bufsize); 36 | int WIPX_GetAddrFromName (const char *name, struct qsockaddr *addr); 37 | int WIPX_AddrCompare (const struct qsockaddr *addr1, const struct qsockaddr *addr2); 38 | int WIPX_GetSocketPort (const struct qsockaddr *addr); 39 | int WIPX_SetSocketPort (struct qsockaddr *addr, int port); 40 | -------------------------------------------------------------------------------- /net_wins.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | // net_wins.h 21 | 22 | int WINS_Init (void); 23 | void WINS_Shutdown (void); 24 | void WINS_Listen (qboolean state); 25 | int WINS_OpenSocket (int port); 26 | int WINS_CloseSocket (int socket); 27 | int WINS_Connect (int socket, const struct qsockaddr *addr); 28 | int WINS_CheckNewConnections (void); 29 | int WINS_Read (int socket, byte *buf, int len, const struct qsockaddr *addr); 30 | int WINS_Write (int socket, const byte *buf, int len, const struct qsockaddr *addr); 31 | int WINS_Broadcast (int socket, const byte *buf, int len); 32 | const char * WINS_AddrToString (const struct qsockaddr *addr); 33 | int WINS_StringToAddr (const char *string, struct qsockaddr *addr); 34 | int WINS_GetSocketAddr (int socket, struct qsockaddr *addr); 35 | int WINS_GetNameFromAddr (const struct qsockaddr *addr, char *name, int bufsize); 36 | int WINS_GetAddrFromName (const char *name, struct qsockaddr *addr); 37 | int WINS_AddrCompare (const struct qsockaddr *addr1, const struct qsockaddr *addr2); 38 | int WINS_GetSocketPort (const struct qsockaddr *addr); 39 | int WINS_SetSocketPort (struct qsockaddr *addr, int port); 40 | -------------------------------------------------------------------------------- /modelgen.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | // modelgen.h: header file for model generation program 21 | 22 | // ********************************************************* 23 | // * This file must be identical in the modelgen directory * 24 | // * and in the Quake directory, because it's used to * 25 | // * pass data from one to the other via model files. * 26 | // ********************************************************* 27 | 28 | // must match definition in spritegn.h 29 | #ifndef SYNCTYPE_T 30 | #define SYNCTYPE_T 31 | typedef enum {ST_SYNC=0, ST_RAND} synctype_t; 32 | #endif 33 | 34 | 35 | #define DT_FACES_FRONT 0x0010 36 | 37 | // This mirrors trivert_t in trilib.h, is present so Quake knows how to 38 | // load this data 39 | 40 | typedef struct 41 | { 42 | byte v[3]; 43 | byte lightnormalindex; 44 | } trivertx_t; 45 | 46 | typedef struct 47 | { 48 | int onseam; 49 | int s; 50 | int t; 51 | } stvert_t; 52 | 53 | #define IDPOLYHEADER (('O'<<24) + ('P'<<16) + ('D'<<8) + 'I') // little-endian "IDPO" 54 | #define MD2IDHEADER (('2'<<24) + ('P'<<16) + ('D'<<8) + 'I') // little-endian "IDP2" 55 | #define MD3IDHEADER (('3'<<24) + ('P'<<16) + ('D'<<8) + 'I') // little-endian "IDP3" 56 | #define RAPOLYHEADER (('O'<<24) + ('P'<<16) + ('A'<<8) + 'R') // little-endian "RAPO" 57 | -------------------------------------------------------------------------------- /view.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | // view.h 21 | 22 | extern cvar_t v_gamma; 23 | extern cvar_t v_contrast; 24 | 25 | //#ifdef GLQUAKE 26 | extern float v_blend[4]; 27 | void V_AddLightBlend (float r, float g, float b, float a2); 28 | //#endif 29 | 30 | //extern byte gammatable[256]; // palette is sent through this 31 | extern byte current_pal[768]; 32 | extern cvar_t gl_hwblend; 33 | //#ifndef GLQUAKE 34 | //extern cvar_t lcd_x, lcd_yaw; 35 | //#endif 36 | 37 | #ifdef NEWHWBLEND 38 | # define V_WANT_HWBLEND() ((cls.state == ca_disconnected) || !v_blend[3] || ((key_dest == key_game) && !scr_con_current)) 39 | # define V_USING_HWRAMPS() (vid_hwgamma_enabled && ((gl_hwblend.value >= 2) || (gl_hwblend.value && V_WANT_HWBLEND()))) 40 | #else 41 | # define V_USING_HWRAMPS() (vid_hwgamma_enabled && gl_hwblend.value) 42 | #endif 43 | 44 | void V_Init (void); 45 | void V_RenderView (qboolean force_refdef_recalc); 46 | 47 | void V_UpdatePalette (void); 48 | void V_CalcBlend (void); 49 | void V_SetContentsColor (int contents); 50 | void V_ResetCshifts (void); // JDH 51 | void V_CalcRefdef (void); 52 | 53 | void V_StartPitchDrift (void); 54 | void V_StopPitchDrift (void); 55 | float V_CalcRoll (vec3_t angles, vec3_t velocity); 56 | 57 | void V_ParseDamage (qboolean parse_only); 58 | 59 | #ifdef HEXEN2_SUPPORT 60 | void V_DarkFlash_f (cmd_source_t src); 61 | void V_WhiteFlash_f (cmd_source_t src); 62 | #endif 63 | -------------------------------------------------------------------------------- /screen.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | // screen.h 21 | 22 | void SCR_Init (void); 23 | void SCR_ClearWadPics (void); 24 | void SCR_LoadWadPics (void); 25 | 26 | void SCR_UpdateScreen (void); 27 | //void SCR_UpdateWholeScreen (void); 28 | 29 | void SCR_SizeUp (void); 30 | void SCR_SizeDown (void); 31 | void SCR_CenterPrint (const char *str); 32 | 33 | void ApplyGamma (byte *buffer, int size); 34 | 35 | void SCR_BeginLoadingPlaque (const char *caption); 36 | void SCR_EndLoadingPlaque (void); 37 | void SCR_UpdateLoadCaption (const char *caption); 38 | 39 | int SCR_ModalMessage (const char *text, const char *input_keys); 40 | 41 | #ifdef HEXEN2_SUPPORT 42 | void SCR_ShowLoadingSize (void); 43 | void ReformatText (char *text, int width); 44 | #endif 45 | 46 | extern float scr_con_current; 47 | extern float scr_conlines; // lines of console to display 48 | 49 | extern int clearnotify; // set to 0 whenever notify text is drawn 50 | extern qboolean scr_disabled_for_loading; 51 | extern qboolean scr_skipupdate; 52 | 53 | extern cvar_t scr_viewsize; 54 | 55 | // only the refresh window will be updated unless these variables are flagged 56 | //extern int scr_copytop; 57 | //extern int scr_copyeverything; 58 | //extern int scr_fullupdate; // set to 0 to force full redraw 59 | 60 | extern qboolean block_drawing; 61 | 62 | #define SCR_NUM_SSHOT_EXTS 3 63 | extern const char * scr_sshot_exts[SCR_NUM_SSHOT_EXTS]; 64 | 65 | 66 | -------------------------------------------------------------------------------- /console.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // console 22 | extern int con_totallines; 23 | extern int con_numlines; // added by joe 24 | extern int con_backscroll; 25 | extern qboolean con_forcedup; // because no entities to refresh 26 | extern qboolean con_initialized; 27 | extern byte *con_chars; 28 | extern int con_notifylines; // scan lines to clear for notify lines 29 | 30 | void Con_CheckResize (void); 31 | void Con_AdjustHeight (int delta); 32 | void Con_PreInit (void); // JDH 33 | void Con_Init (void); 34 | void Con_Shutdown (void); 35 | void Con_DrawConsole (int lines, qboolean drawinput); 36 | void Con_InsertText (const char *text); 37 | qboolean Con_Print (const char *txt); 38 | qboolean Con_Printf (const char *fmt, ...); 39 | void Con_DPrintf (const char *fmt, ...); 40 | void Con_SafePrintf (const char *fmt, ...); 41 | void Con_DrawNotify (void); 42 | void Con_ClearNotify (void); 43 | void Con_Clear_f (cmd_source_t src); 44 | void Con_ToggleConsole_f (cmd_source_t src); 45 | 46 | void Con_NotifyBox (const char *text); // during startup for sound / cd warnings 47 | 48 | /* JDH: added the following */ 49 | 50 | void Con_PagedOutput_Begin (void); 51 | void Con_PagedOutput_End (void); 52 | void Con_LogCenterPrint (const char *str); 53 | char *Con_Quakebar (int len); 54 | void Con_ColumnPrint (const char *s, int colwidth); 55 | void Con_SaveHistory (void); 56 | void Con_Keydown (int key); 57 | 58 | #ifdef HEXEN2_SUPPORT 59 | void Con_UpdateChars_H2 (qboolean isH2); 60 | #endif 61 | -------------------------------------------------------------------------------- /net_dgrm.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | // net_dgrm.h 21 | 22 | 23 | #ifndef _WIN32 24 | /* 25 | * Internet address (from winsock.h) 26 | */ 27 | struct in_addr { 28 | union { 29 | struct { unsigned char/*u_char*/ s_b1,s_b2,s_b3,s_b4; } S_un_b; 30 | struct { unsigned short/*u_short*/ s_w1,s_w2; } S_un_w; 31 | unsigned long /*u_long*/ S_addr; 32 | } S_un; 33 | #define s_addr S_un.S_addr 34 | /* can be used for most tcp & ip code */ 35 | #define s_host S_un.S_un_b.s_b2 36 | /* host on imp */ 37 | #define s_net S_un.S_un_b.s_b1 38 | /* network */ 39 | #define s_imp S_un.S_un_w.s_w2 40 | /* imp */ 41 | #define s_impno S_un.S_un_b.s_b4 42 | /* imp # */ 43 | #define s_lh S_un.S_un_b.s_b3 44 | /* logical host */ 45 | }; 46 | #endif 47 | 48 | int Datagram_Init (void); 49 | void Datagram_Listen (qboolean state); 50 | void Datagram_SearchForHosts (qboolean xmit); 51 | qsocket_t *Datagram_Connect (const char *host); 52 | qsocket_t *Datagram_CheckNewConnections (void); 53 | int Datagram_GetMessage (qsocket_t *sock); 54 | int Datagram_SendMessage (qsocket_t *sock, sizebuf_t *data); 55 | int Datagram_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data); 56 | qboolean Datagram_CanSendMessage (qsocket_t *sock); 57 | qboolean Datagram_CanSendUnreliableMessage (qsocket_t *sock); 58 | void Datagram_Close (qsocket_t *sock); 59 | void Datagram_Shutdown (void); 60 | 61 | void PrintStats (const qsocket_t *s); 62 | -------------------------------------------------------------------------------- /net_bsd.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | #include "quakedef.h" 21 | 22 | #include "net_loop.h" 23 | #include "net_dgrm.h" 24 | 25 | net_driver_t net_drivers[MAX_NET_DRIVERS] = 26 | { 27 | { 28 | "Loopback", 29 | false, 30 | Loop_Init, 31 | Loop_Listen, 32 | Loop_SearchForHosts, 33 | Loop_Connect, 34 | Loop_CheckNewConnections, 35 | Loop_GetMessage, 36 | Loop_SendMessage, 37 | Loop_SendUnreliableMessage, 38 | Loop_CanSendMessage, 39 | Loop_CanSendUnreliableMessage, 40 | Loop_Close, 41 | Loop_Shutdown 42 | } 43 | , 44 | { 45 | "Datagram", 46 | false, 47 | Datagram_Init, 48 | Datagram_Listen, 49 | Datagram_SearchForHosts, 50 | Datagram_Connect, 51 | Datagram_CheckNewConnections, 52 | Datagram_GetMessage, 53 | Datagram_SendMessage, 54 | Datagram_SendUnreliableMessage, 55 | Datagram_CanSendMessage, 56 | Datagram_CanSendUnreliableMessage, 57 | Datagram_Close, 58 | Datagram_Shutdown 59 | } 60 | }; 61 | 62 | int net_numdrivers = 2; 63 | 64 | #include "net_udp.h" 65 | 66 | net_landriver_t net_landrivers[MAX_NET_DRIVERS] = 67 | { 68 | { 69 | "UDP", 70 | false, 71 | 0, 72 | UDP_Init, 73 | UDP_Shutdown, 74 | UDP_Listen, 75 | UDP_OpenSocket, 76 | UDP_CloseSocket, 77 | UDP_Connect, 78 | UDP_CheckNewConnections, 79 | UDP_Read, 80 | UDP_Write, 81 | UDP_Broadcast, 82 | UDP_AddrToString, 83 | UDP_StringToAddr, 84 | UDP_GetSocketAddr, 85 | UDP_GetNameFromAddr, 86 | UDP_GetAddrFromName, 87 | UDP_AddrCompare, 88 | UDP_GetSocketPort, 89 | UDP_SetSocketPort 90 | } 91 | }; 92 | 93 | int net_numlandrivers = 1; 94 | -------------------------------------------------------------------------------- /version.c: -------------------------------------------------------------------------------- 1 | /* 2 | version.c 3 | 4 | Build number and version strings 5 | 6 | Copyright (C) 1996-1997 Id Software, Inc. 7 | 8 | This program is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU General Public License 10 | as published by the Free Software Foundation; either version 2 11 | of the License, or (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 | 17 | See the GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with this program; if not, write to: 21 | 22 | Free Software Foundation, Inc. 23 | 59 Temple Place - Suite 330 24 | Boston, MA 02111-1307, USA 25 | */ 26 | 27 | #include "quakedef.h" 28 | 29 | static char *date = __DATE__; 30 | static char *mon[12] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; 31 | static char mond[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; 32 | 33 | // returns days since Dec 21 1999 (the day before q1source release) 34 | int build_number (void) 35 | { 36 | int m = 0, d = 0, y = 0; 37 | static int b = 0; 38 | 39 | if (b != 0) 40 | return b; 41 | 42 | for (m=0 ; m<11 ; m++) 43 | { 44 | if (!Q_strncasecmp(&date[0], mon[m], 3)) 45 | break; 46 | d += mond[m]; 47 | } 48 | 49 | d += atoi(&date[4]) - 1; 50 | y = atoi(&date[7]) - 1900; 51 | b = d + (int)((y - 1) * 365.25); 52 | 53 | if (((y % 4) == 0) && m > 1) 54 | b += 1; 55 | 56 | // b -= 36148 + 985; // Dec 21 1999 (Sep 1 2002) 57 | // JT021105 - using set number?.... 58 | 59 | return b; 60 | } 61 | 62 | /* 63 | ======================= 64 | Host_Version_f 65 | ====================== 66 | */ 67 | void Host_Version_f (cmd_source_t src) 68 | { 69 | Con_Printf ("reQuiem version %s\n", VersionString()); 70 | Con_Print ("Exe: "__TIME__" "__DATE__"\n"); 71 | } 72 | 73 | /* 74 | ======================= 75 | VersionString 76 | ====================== 77 | */ 78 | char *VersionString (void) 79 | { 80 | static char str[32]; 81 | 82 | Q_snprintfz (str, sizeof(str), "%s (build %i)", REQUIEM_VERSION, build_number()); 83 | 84 | return str; 85 | } 86 | -------------------------------------------------------------------------------- /sbar.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // the status bar is only redrawn if something has changed, but if anything 22 | // does, the entire thing will be redrawn for the next vid.numpages frames. 23 | 24 | void Sbar_Init (void); 25 | void Sbar_Hipnotic_Init (void); 26 | void Sbar_Rogue_Init (void); 27 | void Sbar_ClearWadPics (void); 28 | void Sbar_LoadWadPics (void); 29 | 30 | void Sbar_Changed (void); 31 | // call whenever any of the client stats represented on the sbar changes 32 | 33 | int Sbar_Height (void); 34 | void Sbar_SetScale (qboolean enable); // JDH 35 | 36 | void Sbar_Draw (void); 37 | // called every frame by screen 38 | 39 | void Sbar_IntermissionOverlay (void); 40 | // called each frame after the level has been completed 41 | 42 | void Sbar_FinaleOverlay (void); 43 | 44 | const char * Sbar_FormatTime (double time, qboolean use_tenths); 45 | 46 | #ifdef HEXEN2_SUPPORT 47 | #define ABILITIES_STR_INDEX 400 48 | 49 | int Sbar_itoa (int num, char *buf); 50 | void Sbar_DeathmatchOverlay (void); 51 | 52 | void Sbar_Hexen2_Init (void); 53 | void Sbar_LoadWadPics_H2 (void); 54 | void Sbar_Draw_H2 (void); 55 | void Sbar_InvReset (void); 56 | void Sbar_InvChanged (void); 57 | void Sbar_ViewSizeChanged (void); 58 | 59 | void Sbar_InvLeft_f (cmd_source_t src); 60 | void Sbar_InvRight_f (cmd_source_t src); 61 | void Sbar_InvUse_f (cmd_source_t src); 62 | void Sbar_InvOff_f (cmd_source_t src); 63 | void Sbar_ShowInfoDown_f (cmd_source_t src); 64 | void Sbar_ShowInfoUp_f (cmd_source_t src); 65 | void Sbar_ShowDMDown_f (cmd_source_t src); 66 | void Sbar_ShowDMUp_f (cmd_source_t src); 67 | void Sbar_ToggleDM_f (cmd_source_t src); 68 | #endif 69 | -------------------------------------------------------------------------------- /sys_x86.s: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | // sys_x86.s 21 | // x86 assembly-language Win-dependent routines. 22 | 23 | #include "asm_i386.h" 24 | #include "quakeasm.h" 25 | 26 | #ifdef id386 27 | .data 28 | 29 | .align 4 30 | fpenv: 31 | .long 0, 0, 0, 0, 0, 0, 0, 0 32 | 33 | .text 34 | 35 | .globl C(MaskExceptions) 36 | C(MaskExceptions): 37 | fnstenv fpenv 38 | orl $0x3F,fpenv 39 | fldenv fpenv 40 | 41 | ret 42 | 43 | /*#if 0 44 | .globl C(unmaskexceptions) 45 | C(unmaskexceptions): 46 | fnstenv fpenv 47 | andl $0xFFFFFFE0,fpenv 48 | fldenv fpenv 49 | 50 | ret 51 | #endif*/ 52 | 53 | .data 54 | 55 | .align 4 56 | .globl ceil_cw, single_cw, full_cw, cw, pushed_cw 57 | ceil_cw: .long 0 58 | single_cw: .long 0 59 | full_cw: .long 0 60 | cw: .long 0 61 | pushed_cw: .long 0 62 | 63 | .text 64 | 65 | .globl C(Sys_LowFPPrecision) 66 | C(Sys_LowFPPrecision): 67 | fldcw single_cw 68 | 69 | ret 70 | 71 | .globl C(Sys_HighFPPrecision) 72 | C(Sys_HighFPPrecision): 73 | fldcw full_cw 74 | 75 | ret 76 | 77 | .globl C(Sys_PushFPCW_SetHigh) 78 | C(Sys_PushFPCW_SetHigh): 79 | fnstcw pushed_cw 80 | fldcw full_cw 81 | 82 | ret 83 | 84 | .globl C(Sys_PopFPCW) 85 | C(Sys_PopFPCW): 86 | fldcw pushed_cw 87 | 88 | ret 89 | 90 | .globl C(Sys_SetFPCW) 91 | C(Sys_SetFPCW): 92 | fnstcw cw 93 | movl cw,%eax 94 | andb $0xF0,%ah 95 | orb $0x03,%ah // round mode, 64-bit precision 96 | movl %eax,full_cw 97 | 98 | andb $0xF0,%ah 99 | orb $0x0C,%ah // chop mode, single precision 100 | movl %eax,single_cw 101 | 102 | andb $0xF0,%ah 103 | orb $0x08,%ah // ceil mode, single precision 104 | movl %eax,ceil_cw 105 | 106 | ret 107 | #endif // id386 108 | -------------------------------------------------------------------------------- /cd_mac.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | // cd_mac.c (UNIMPLEMENTED) 21 | 22 | #include "quakedef.h" 23 | 24 | extern qboolean cdValid; 25 | extern qboolean playing; 26 | extern byte playTrack; 27 | extern qboolean playLooping; 28 | 29 | extern cvar_t bgmvolume; 30 | 31 | 32 | /* 33 | ============ 34 | CDAudio_Eject 35 | ============ 36 | */ 37 | void CDAudio_Eject (void) 38 | { 39 | } 40 | 41 | /* 42 | ============ 43 | CDAudio_CloseDoor 44 | ============ 45 | */ 46 | void CDAudio_CloseDoor (void) 47 | { 48 | } 49 | 50 | /* 51 | ============ 52 | CDAudio_GetNumTracks 53 | ============ 54 | */ 55 | int CDAudio_GetNumTracks (void) 56 | { 57 | return 0; 58 | } 59 | 60 | /* 61 | ============ 62 | CDAudio_GetTrackLength 63 | ============ 64 | */ 65 | int CDAudio_GetTrackLength (byte track) 66 | { 67 | return 0; 68 | } 69 | 70 | /* 71 | ============ 72 | CDAudio_PlayTrack 73 | ============ 74 | */ 75 | qboolean CDAudio_PlayTrack (byte track, int length) 76 | { 77 | return false; 78 | } 79 | 80 | /* 81 | ============ 82 | CDAudio_StopDevice 83 | ============ 84 | */ 85 | qboolean CDAudio_StopDevice (void) 86 | { 87 | return true; 88 | } 89 | 90 | /* 91 | ============ 92 | CDAudio_PauseDevice 93 | ============ 94 | */ 95 | qboolean CDAudio_PauseDevice (void) 96 | { 97 | return true; 98 | } 99 | 100 | /* 101 | ============ 102 | CDAudio_ResumeDevice 103 | ============ 104 | */ 105 | qboolean CDAudio_ResumeDevice (void) 106 | { 107 | return false; 108 | } 109 | 110 | /* 111 | ============ 112 | CDAudio_InitDevice 113 | ============ 114 | */ 115 | qboolean CDAudio_InitDevice (void) 116 | { 117 | return false; 118 | } 119 | 120 | /* 121 | ============ 122 | CDAudio_CloseDevice 123 | ============ 124 | */ 125 | void CDAudio_CloseDevice (void) 126 | { 127 | } 128 | -------------------------------------------------------------------------------- /asm_i386.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | #ifndef __ASM_I386__ 22 | #define __ASM_I386__ 23 | 24 | #ifdef ELF 25 | #define C(label) label 26 | #else 27 | #define C(label) _##label 28 | #endif 29 | 30 | // !!! note that this file must match the corresponding C structures at all 31 | // times !!! 32 | 33 | // plane_t structure 34 | // !!! if this is changed, it must be changed in model.h too !!! 35 | // !!! if the size of this is changed, the array lookup in SV_HullPointContents 36 | // must be changed too !!! 37 | #define pl_normal 0 38 | #define pl_dist 12 39 | #define pl_type 16 40 | #define pl_signbits 17 41 | #define pl_pad 18 42 | #define pl_size 20 43 | 44 | // hull_t structure 45 | // !!! if this is changed, it must be changed in model.h too !!! 46 | #define hu_clipnodes 0 47 | #define hu_planes 4 48 | #define hu_firstclipnode 8 49 | #define hu_lastclipnode 12 50 | #define hu_clip_mins 16 51 | #define hu_clip_maxs 28 52 | #define hu_size 40 53 | 54 | // dnode_t structure 55 | // !!! if this is changed, it must be changed in bspfile.h too !!! 56 | #define nd_planenum 0 57 | #define nd_children 4 58 | #define nd_mins 8 59 | #define nd_maxs 20 60 | #define nd_firstface 32 61 | #define nd_numfaces 36 62 | #define nd_size 40 63 | 64 | // sfxcache_t structure 65 | // !!! if this is changed, it much be changed in sound.h too !!! 66 | #define sfxc_length 0 67 | #define sfxc_loopstart 4 68 | #define sfxc_speed 8 69 | #define sfxc_width 12 70 | #define sfxc_stereo 16 71 | #define sfxc_data 20 72 | 73 | // channel_t structure 74 | // !!! if this is changed, it much be changed in sound.h too !!! 75 | #define ch_sfx 0 76 | #define ch_leftvol 4 77 | #define ch_rightvol 8 78 | #define ch_end 12 79 | #define ch_pos 16 80 | #define ch_looping 20 81 | #define ch_entnum 24 82 | #define ch_entchannel 28 83 | #define ch_origin 32 84 | #define ch_dist_mult 44 85 | #define ch_master_vol 48 86 | #define ch_size 52 87 | 88 | // portable_samplepair_t structure 89 | // !!! if this is changed, it much be changed in sound.h too !!! 90 | #define psp_left 0 91 | #define psp_right 4 92 | #define psp_size 8 93 | 94 | #endif 95 | -------------------------------------------------------------------------------- /chase.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | // chase.c -- chase camera code 21 | 22 | #include "quakedef.h" 23 | 24 | #ifndef RQM_SV_ONLY 25 | 26 | cvar_t chase_back = {"chase_back", "100"}; 27 | cvar_t chase_up = {"chase_up", "16"}; 28 | cvar_t chase_right = {"chase_right", "0"}; 29 | cvar_t chase_active = {"chase_active", "0"}; 30 | 31 | vec3_t chase_pos; 32 | vec3_t chase_angles; 33 | 34 | vec3_t chase_dest; 35 | vec3_t chase_dest_angles; 36 | 37 | 38 | void Chase_Init (void) 39 | { 40 | Cvar_Register (&chase_back); 41 | Cvar_Register (&chase_up); 42 | Cvar_Register (&chase_right); 43 | Cvar_RegisterBool (&chase_active); 44 | } 45 | 46 | void Chase_Reset (void) 47 | { 48 | // for respawning and teleporting 49 | // start position 12 units behind head 50 | } 51 | 52 | void TraceLine (vec3_t start, vec3_t end, vec3_t impact) 53 | { 54 | trace_t trace; 55 | 56 | memset (&trace, 0, sizeof(trace)); 57 | SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1, start, end, &trace); 58 | VectorCopy (trace.endpos, impact); 59 | } 60 | 61 | void Chase_Update (void) 62 | { 63 | int i; 64 | float dist; 65 | vec3_t forward, up, right, dest, stop; 66 | 67 | // if can't see player, reset 68 | AngleVectors (cl.viewangles, forward, right, up); 69 | 70 | // calc exact destination 71 | for (i=0 ; i<3 ; i++) 72 | chase_dest[i] = r_refdef.vieworg[i] - forward[i]*chase_back.value - right[i]*chase_right.value; 73 | chase_dest[2] = r_refdef.vieworg[2] + chase_up.value; 74 | 75 | // find the spot the player is looking at 76 | VectorMA (r_refdef.vieworg, 4096, forward, dest); 77 | TraceLine (r_refdef.vieworg, dest, stop); 78 | 79 | // calculate pitch to look at the same spot from camera 80 | VectorSubtract (stop, r_refdef.vieworg, stop); 81 | dist = max(1, DotProduct(stop, forward)); 82 | r_refdef.viewangles[PITCH] = -atan(stop[2] / dist) / M_PI * 180; // *** BREAKS MAC COMPILER!! *** 83 | 84 | TraceLine (r_refdef.vieworg, chase_dest, stop); 85 | if (stop[0] != 0 || stop[1] != 0 || stop[2] != 0) 86 | VectorCopy (stop, chase_dest); 87 | 88 | // move towards destination 89 | VectorCopy (chase_dest, r_refdef.vieworg); 90 | } 91 | 92 | #endif //#ifndef RQM_SV_ONLY 93 | -------------------------------------------------------------------------------- /spritegn.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | // spritegn.h: header file for sprite generation program 21 | 22 | // ********************************************************** 23 | // * This file must be identical in the spritegen directory * 24 | // * and in the Quake directory, because it's used to * 25 | // * pass data from one to the other via .spr files. * 26 | // ********************************************************** 27 | 28 | //------------------------------------------------------- 29 | // This program generates .spr sprite package files. 30 | // The format of the files is as follows: 31 | // 32 | // dsprite_t file header structure 33 | // 34 | // 35 | // dspriteframe_t frame header structure 36 | // sprite bitmap 37 | // 38 | // dspriteframe_t frame header structure 39 | // sprite bitmap 40 | // 41 | //------------------------------------------------------- 42 | 43 | #define SPRITE_VERSION 1 44 | #define SPRITE32_VERSION 32 45 | 46 | // must match definition in modelgen.h 47 | #ifndef SYNCTYPE_T 48 | #define SYNCTYPE_T 49 | typedef enum {ST_SYNC=0, ST_RAND} synctype_t; 50 | #endif 51 | 52 | // TODO: shorten these? 53 | typedef struct { 54 | int ident; 55 | int version; 56 | int type; 57 | float boundingradius; 58 | int width; 59 | int height; 60 | int numframes; 61 | float beamlength; 62 | synctype_t synctype; 63 | } dsprite_t; 64 | 65 | #define SPR_VP_PARALLEL_UPRIGHT 0 66 | #define SPR_FACING_UPRIGHT 1 67 | #define SPR_VP_PARALLEL 2 68 | #define SPR_ORIENTED 3 69 | #define SPR_VP_PARALLEL_ORIENTED 4 70 | 71 | typedef struct { 72 | int origin[2]; 73 | int width; 74 | int height; 75 | } dspriteframe_t; 76 | 77 | typedef struct { 78 | int numframes; 79 | } dspritegroup_t; 80 | 81 | typedef struct { 82 | float interval; 83 | } dspriteinterval_t; 84 | 85 | typedef enum {SPR_SINGLE=0, SPR_GROUP} spriteframetype_t; 86 | 87 | typedef struct { 88 | spriteframetype_t type; 89 | } dspriteframetype_t; 90 | 91 | #define IDSPRITEHEADER (('P'<<24) + ('S'<<16) + ('D'<<8) + 'I') // little-endian "IDSP" 92 | -------------------------------------------------------------------------------- /net_win.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | #include "quakedef.h" 21 | 22 | #include "net_loop.h" 23 | #include "net_dgrm.h" 24 | //#include "net_ser.h" 25 | 26 | net_driver_t net_drivers[MAX_NET_DRIVERS] = 27 | { 28 | { 29 | "Loopback", 30 | false, 31 | Loop_Init, 32 | Loop_Listen, 33 | Loop_SearchForHosts, 34 | Loop_Connect, 35 | Loop_CheckNewConnections, 36 | Loop_GetMessage, 37 | Loop_SendMessage, 38 | Loop_SendUnreliableMessage, 39 | Loop_CanSendMessage, 40 | Loop_CanSendUnreliableMessage, 41 | Loop_Close, 42 | Loop_Shutdown 43 | } 44 | , 45 | { 46 | "Datagram", 47 | false, 48 | Datagram_Init, 49 | Datagram_Listen, 50 | Datagram_SearchForHosts, 51 | Datagram_Connect, 52 | Datagram_CheckNewConnections, 53 | Datagram_GetMessage, 54 | Datagram_SendMessage, 55 | Datagram_SendUnreliableMessage, 56 | Datagram_CanSendMessage, 57 | Datagram_CanSendUnreliableMessage, 58 | Datagram_Close, 59 | Datagram_Shutdown 60 | } 61 | }; 62 | 63 | int net_numdrivers = 2; 64 | 65 | 66 | #include "net_wins.h" 67 | #include "net_wipx.h" 68 | 69 | net_landriver_t net_landrivers[MAX_NET_DRIVERS] = 70 | { 71 | { 72 | "Winsock TCPIP", 73 | false, 74 | 0, 75 | WINS_Init, 76 | WINS_Shutdown, 77 | WINS_Listen, 78 | WINS_OpenSocket, 79 | WINS_CloseSocket, 80 | WINS_Connect, 81 | WINS_CheckNewConnections, 82 | WINS_Read, 83 | WINS_Write, 84 | WINS_Broadcast, 85 | WINS_AddrToString, 86 | WINS_StringToAddr, 87 | WINS_GetSocketAddr, 88 | WINS_GetNameFromAddr, 89 | WINS_GetAddrFromName, 90 | WINS_AddrCompare, 91 | WINS_GetSocketPort, 92 | WINS_SetSocketPort 93 | }, 94 | { 95 | "Winsock IPX", 96 | false, 97 | 0, 98 | WIPX_Init, 99 | WIPX_Shutdown, 100 | WIPX_Listen, 101 | WIPX_OpenSocket, 102 | WIPX_CloseSocket, 103 | WIPX_Connect, 104 | WIPX_CheckNewConnections, 105 | WIPX_Read, 106 | WIPX_Write, 107 | WIPX_Broadcast, 108 | WIPX_AddrToString, 109 | WIPX_StringToAddr, 110 | WIPX_GetSocketAddr, 111 | WIPX_GetNameFromAddr, 112 | WIPX_GetAddrFromName, 113 | WIPX_AddrCompare, 114 | WIPX_GetSocketPort, 115 | WIPX_SetSocketPort 116 | } 117 | 118 | }; 119 | 120 | int net_numlandrivers = 2; 121 | -------------------------------------------------------------------------------- /sys.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | // sys.h -- non-portable functions 21 | 22 | // file IO 23 | 24 | // returns the file size 25 | // return -1 if file is not present 26 | // the file should be in BINARY mode for stupid OSs that care 27 | /* 28 | int Sys_FileOpenRead (const char *path, int *hndl); 29 | 30 | int Sys_FileOpenWrite (const char *path); 31 | void Sys_FileClose (int handle); 32 | void Sys_FileSeek (int handle, int position); 33 | int Sys_FileRead (int handle, void *dest, int count); 34 | int Sys_FileWrite (int handle, const void *data, int count); 35 | */ 36 | 37 | typedef struct 38 | { 39 | unsigned short wYear; // 0000-20xx 40 | unsigned short wMonth; // 1-12 41 | unsigned short wDayOfWeek; // 0-6 (Sunday=0) 42 | unsigned short wDay; // 1-31 43 | unsigned short wHour; // 0-23 44 | unsigned short wMinute; 45 | unsigned short wSecond; 46 | } qtime_t; 47 | 48 | qtime_t * Sys_FileTime (const char *path); 49 | qboolean Sys_FolderExists (const char *path); 50 | void Sys_mkdir (const char *path); 51 | 52 | //typedef enum {DF_NODIRS, DF_WITHDIRS, DF_ONLYDIRS} dirfilter_t; 53 | 54 | int Sys_ListFilesInDir (const char *path, const searchpath_t *search, qboolean dirs_only, 55 | int *count, FFCALLBACK callproc, unsigned int callparam); 56 | 57 | void *Sys_LoadLibrary (const char *name); 58 | void Sys_UnloadLibrary (void *lib_handle); 59 | 60 | // memory protection 61 | void Sys_MakeCodeWriteable (unsigned long startaddr, unsigned long length); 62 | 63 | // system IO 64 | //void Sys_DebugLog(char *file, char *fmt, ...); 65 | 66 | void Sys_Error (const char *error, ...); 67 | // an error will cause the entire program to exit 68 | 69 | void Sys_Printf (const char *fmt, ...); 70 | // send text to the console 71 | 72 | void Sys_Quit (void); 73 | 74 | double Sys_DoubleTime (void); 75 | 76 | char *Sys_ConsoleInput (void); 77 | 78 | void Sys_Sleep (void); 79 | // called to yield for a little bit so as 80 | // not to hog cpu when paused or debugging 81 | 82 | void Sys_SendKeyEvents (void); 83 | // Perform Key_Event () callbacks until the input que is empty 84 | 85 | void Sys_LowFPPrecision (void); 86 | void Sys_HighFPPrecision (void); 87 | void Sys_SetFPCW (void); 88 | 89 | char *Sys_GetClipboardData (void); 90 | -------------------------------------------------------------------------------- /cl_effect_H2.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef CL_EFFECT_H2 3 | #define CL_EFFECT_H2 4 | 5 | #define MAX_EFFECTS 256 6 | 7 | // Types for various chunks 8 | #define THINGTYPE_GREYSTONE 1 9 | #define THINGTYPE_WOOD 2 10 | #define THINGTYPE_METAL 3 11 | #define THINGTYPE_FLESH 4 12 | #define THINGTYPE_FIRE 5 13 | #define THINGTYPE_CLAY 6 14 | #define THINGTYPE_LEAVES 7 15 | #define THINGTYPE_HAY 8 16 | #define THINGTYPE_BROWNSTONE 9 17 | #define THINGTYPE_CLOTH 10 18 | #define THINGTYPE_WOOD_LEAF 11 19 | #define THINGTYPE_WOOD_METAL 12 20 | #define THINGTYPE_WOOD_STONE 13 21 | #define THINGTYPE_METAL_STONE 14 22 | #define THINGTYPE_METAL_CLOTH 15 23 | #define THINGTYPE_WEBS 16 24 | #define THINGTYPE_GLASS 17 25 | #define THINGTYPE_ICE 18 26 | #define THINGTYPE_CLEARGLASS 19 27 | #define THINGTYPE_REDGLASS 20 28 | #define THINGTYPE_ACID 21 29 | #define THINGTYPE_METEOR 22 30 | #define THINGTYPE_GREENFLESH 23 31 | #define THINGTYPE_BONE 24 32 | 33 | #if defined(_WIN32) && defined(_MSC_VER) 34 | # pragma warning (disable : 4201) 35 | #endif 36 | 37 | struct effect_t 38 | { 39 | int type; 40 | float expire_time; 41 | 42 | union 43 | { 44 | struct 45 | { 46 | vec3_t e_size, dir, min_org, max_org; 47 | float next_time,wait; 48 | int color, count , veer , flags; 49 | } Rain; 50 | struct 51 | { 52 | vec3_t pos,angle,movedir; 53 | vec3_t vforward,vup,vright; 54 | int color,cnt; 55 | } Fountain; 56 | struct 57 | { 58 | vec3_t origin; 59 | float radius; 60 | } Quake; 61 | struct 62 | { 63 | vec3_t origin; 64 | vec3_t velocity; 65 | int entity_index; 66 | float time_amount,framelength,frame; 67 | } Smoke; 68 | struct 69 | { 70 | vec3_t origin; 71 | int entity_index; 72 | float time_amount; 73 | int reverse; // Forward animation has been run, now go backwards 74 | } Flash; 75 | struct 76 | { 77 | vec3_t origin; 78 | int entity_index[13]; 79 | float time_amount; 80 | int stage; 81 | int color; 82 | float lifetime; 83 | } RD; // Rider Death 84 | struct 85 | { 86 | int entity_index[16]; 87 | vec3_t origin; 88 | vec3_t velocity[16]; 89 | float time_amount,framelength; 90 | float skinnum; 91 | } Teleporter; 92 | struct 93 | { 94 | vec3_t angle; 95 | vec3_t origin; 96 | vec3_t avelocity; 97 | vec3_t velocity; 98 | int entity_index; 99 | float time_amount; 100 | } Missile; 101 | struct 102 | { 103 | int entity_index[16]; 104 | vec3_t velocity[16]; 105 | vec3_t avel[3]; 106 | vec3_t origin; 107 | unsigned char type; 108 | vec3_t srcVel; 109 | unsigned char numChunks; 110 | float time_amount; 111 | float aveScale; 112 | }Chunk; 113 | 114 | }; 115 | }; 116 | 117 | void SV_ParseEffect (sizebuf_t *sb); 118 | void SV_UpdateEffects (sizebuf_t *sb); 119 | 120 | void SV_SaveEffects (FILE *FH); 121 | void SV_LoadEffects (FILE *FH); 122 | 123 | void CL_ClearEffects (void); 124 | void CL_UpdateEffects (void); 125 | 126 | #endif 127 | -------------------------------------------------------------------------------- /world.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | // world.h 21 | 22 | typedef struct 23 | { 24 | vec3_t normal; 25 | float dist; 26 | } plane_t; 27 | 28 | typedef struct 29 | { 30 | qboolean allsolid; // if true, plane is not valid 31 | qboolean startsolid; // if true, the initial point was in a solid area 32 | qboolean inopen, inwater; 33 | float fraction; // time completed, 1.0 = didn't hit anything 34 | vec3_t endpos; // final position 35 | plane_t plane; // surface normal at impact 36 | edict_t *ent; // entity the surface is on 37 | } trace_t; 38 | 39 | 40 | #define MOVE_NORMAL 0 41 | #define MOVE_NOMONSTERS 1 42 | #define MOVE_MISSILE 2 43 | 44 | #ifdef HEXEN2_SUPPORT 45 | #define MOVE_WATER 3 46 | #define MOVE_PHASE 4 47 | #endif 48 | 49 | 50 | void SV_ClearWorld (void); 51 | // called after the world model has been loaded, before linking any entities 52 | 53 | void SV_UnlinkEdict (edict_t *ent); 54 | // call before removing an entity, and before trying to move one, 55 | // so it doesn't clip against itself 56 | // flags ent->v.modified 57 | 58 | void SV_LinkEdict (edict_t *ent, qboolean touch_triggers); 59 | // Needs to be called any time an entity changes origin, mins, maxs, or solid 60 | // flags ent->v.modified 61 | // sets ent->v.absmin and ent->v.absmax 62 | // if touchtriggers, calls prog functions for the intersected triggers 63 | 64 | int SV_HullPointContents (const hull_t *hull, int num, const vec3_t p); 65 | int SV_PointContents (const vec3_t p); 66 | // returns the CONTENTS_* value from the world at the given point. 67 | // does not check any entities at all 68 | // the non-true version remaps the water current contents to content_water 69 | 70 | qboolean SV_RecursiveHullCheck (const hull_t *hull, int num, float p1f, float p2f, 71 | const vec3_t p1, const vec3_t p2, trace_t *trace); 72 | edict_t *SV_TestEntityPosition (edict_t *ent); 73 | 74 | trace_t SV_Move (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int type, edict_t *passedict); 75 | // mins and maxs are reletive 76 | 77 | // if the entire move stays in a solid volume, trace.allsolid will be set 78 | 79 | // if the starting point is in a solid, it will be allowed to move out 80 | // to an open area 81 | 82 | // nomonsters is used for line of sight or edge testing, where mosnters 83 | // shouldn't be considered solid objects 84 | 85 | // passedict is explicitly excluded from clipping checks (normally NULL) 86 | -------------------------------------------------------------------------------- /progdefs.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | // progdefs.h 21 | 22 | /* file generated by qcc, do not modify */ 23 | 24 | #define PRGLOBALS_BETA 25 | typedef struct 26 | { 27 | #include "prglobals.h" 28 | } globalvars_beta_t; 29 | #undef PRGLOBALS_BETA 30 | 31 | typedef struct 32 | { 33 | #include "prglobals.h" 34 | } globalvars_t; 35 | 36 | 37 | #define PRFIELDS_BETA 38 | typedef struct 39 | { 40 | #include "prfields.h" 41 | } entvars_beta_t; 42 | #undef PRFIELDS_BETA 43 | 44 | typedef struct 45 | { 46 | #include "prfields.h" 47 | /*----- end of original struct -----*/ 48 | #ifdef HEXEN2_SUPPORT 49 | float scale; 50 | float drawflags; 51 | float abslight; 52 | float hull; 53 | float stats_restored; 54 | float playerclass; 55 | float bluemana; 56 | float greenmana; 57 | float max_mana; 58 | float armor_amulet; 59 | float armor_bracer; 60 | float armor_breastplate; 61 | float armor_helmet; 62 | float level; 63 | float intelligence; 64 | float wisdom; 65 | float dexterity; 66 | float strength; 67 | float experience; 68 | float ring_flight; 69 | float ring_water; 70 | float ring_turning; 71 | float ring_regeneration; 72 | float haste_time; 73 | float tome_time; 74 | string_t puzzle_inv1; 75 | string_t puzzle_inv2; 76 | string_t puzzle_inv3; 77 | string_t puzzle_inv4; 78 | string_t puzzle_inv5; 79 | string_t puzzle_inv6; 80 | string_t puzzle_inv7; 81 | string_t puzzle_inv8; 82 | float idealroll; 83 | float hoverz; 84 | float flags2; 85 | float light_level; 86 | float friction; 87 | float rings_active; 88 | float rings_low; 89 | float artifact_active; 90 | float artifact_low; 91 | float hasted; 92 | float inventory; 93 | float cnt_torch; 94 | float cnt_h_boost; 95 | float cnt_sh_boost; 96 | float cnt_mana_boost; 97 | float cnt_teleport; 98 | float cnt_tome; 99 | float cnt_summon; 100 | float cnt_invisibility; 101 | float cnt_glyph; 102 | float cnt_haste; 103 | float cnt_blast; 104 | float cnt_polymorph; 105 | float cnt_flight; 106 | float cnt_cubeofforce; 107 | float cnt_invincibility; 108 | int cameramode; 109 | int movechain; 110 | func_t chainmoved; 111 | #endif 112 | } entvars_t; 113 | 114 | #define PROGHEADER_CRC 5927 /* 0x00001727 */ 115 | #define PROGHEADER_BETA_CRC 26940 /* 0x0000693C - Quake pre-release/beta3 */ 116 | -------------------------------------------------------------------------------- /vid.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | // vid.h -- video driver defs 21 | 22 | #define VID_CBITS 6 23 | #define VID_GRADES (1< width if displayed in a window 44 | unsigned width; 45 | unsigned height; 46 | // float aspect; // width / height -- < 0 is taller than wide 47 | int numpages; 48 | int recalc_refdef; // if true, recalc vid-based stuff 49 | // pixel_t *conbuffer; 50 | // int conrowbytes; 51 | unsigned conwidth; 52 | unsigned conheight; 53 | int maxwarpwidth; 54 | int maxwarpheight; 55 | // pixel_t *direct; // direct drawing to framebuffer, if not NULL 56 | } viddef_t; 57 | 58 | extern viddef_t vid; // global video state 59 | extern unsigned d_8to24table[256]; 60 | extern qboolean vid_windowedmouse; 61 | 62 | #define GAME_ACTIVE() ((key_dest == key_game) && !cl.paused && cl.worldmodel && (cls.signon == SIGNONS)) 63 | 64 | void VID_SetPalette (unsigned char *palette); 65 | // called at startup and after any gamma correction 66 | 67 | void VID_ShiftPalette (unsigned char *palette); 68 | // called for bonus and pain flashes, and for underwater color changes 69 | 70 | void VID_Init (unsigned char *palette); 71 | // Called at startup to set up translation tables, takes 256 8 bit RGB values 72 | // the palette data will go away after the call, so it must be copied off if 73 | // the video driver will need it again 74 | 75 | void VID_Shutdown (void); 76 | // Called at shutdown 77 | 78 | void VID_Update (vrect_t *rects); 79 | // flushes the given rectangles from the view buffer to the screen 80 | 81 | //void VID_HandlePause (qboolean pause); 82 | // called only on Win32, when pause happens, so the mouse can be released 83 | 84 | //void VID_LockBuffer (void); 85 | //void VID_UnlockBuffer (void); 86 | 87 | // by joe - gamma stuff 88 | void VID_SetDeviceGammaRamp (unsigned short *ramps); 89 | extern qboolean vid_hwgamma_enabled; 90 | -------------------------------------------------------------------------------- /gl_warp_sin.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 0, 0.19633, 0.392541, 0.588517, 0.784137, 0.979285, 1.17384, 1.3677, 21 | 1.56072, 1.75281, 1.94384, 2.1337, 2.32228, 2.50945, 2.69512, 2.87916, 22 | 3.06147, 3.24193, 3.42044, 3.59689, 3.77117, 3.94319, 4.11282, 4.27998, 23 | 4.44456, 4.60647, 4.76559, 4.92185, 5.07515, 5.22538, 5.37247, 5.51632, 24 | 5.65685, 5.79398, 5.92761, 6.05767, 6.18408, 6.30677, 6.42566, 6.54068, 25 | 6.65176, 6.75883, 6.86183, 6.9607, 7.05537, 7.14579, 7.23191, 7.31368, 26 | 7.39104, 7.46394, 7.53235, 7.59623, 7.65552, 7.71021, 7.76025, 7.80562, 27 | 7.84628, 7.88222, 7.91341, 7.93984, 7.96148, 7.97832, 7.99036, 7.99759, 28 | 8, 7.99759, 7.99036, 7.97832, 7.96148, 7.93984, 7.91341, 7.88222, 29 | 7.84628, 7.80562, 7.76025, 7.71021, 7.65552, 7.59623, 7.53235, 7.46394, 30 | 7.39104, 7.31368, 7.23191, 7.14579, 7.05537, 6.9607, 6.86183, 6.75883, 31 | 6.65176, 6.54068, 6.42566, 6.30677, 6.18408, 6.05767, 5.92761, 5.79398, 32 | 5.65685, 5.51632, 5.37247, 5.22538, 5.07515, 4.92185, 4.76559, 4.60647, 33 | 4.44456, 4.27998, 4.11282, 3.94319, 3.77117, 3.59689, 3.42044, 3.24193, 34 | 3.06147, 2.87916, 2.69512, 2.50945, 2.32228, 2.1337, 1.94384, 1.75281, 35 | 1.56072, 1.3677, 1.17384, 0.979285, 0.784137, 0.588517, 0.392541, 0.19633, 36 | 9.79717e-16, -0.19633, -0.392541, -0.588517, -0.784137, -0.979285, -1.17384, -1.3677, 37 | -1.56072, -1.75281, -1.94384, -2.1337, -2.32228, -2.50945, -2.69512, -2.87916, 38 | -3.06147, -3.24193, -3.42044, -3.59689, -3.77117, -3.94319, -4.11282, -4.27998, 39 | -4.44456, -4.60647, -4.76559, -4.92185, -5.07515, -5.22538, -5.37247, -5.51632, 40 | -5.65685, -5.79398, -5.92761, -6.05767, -6.18408, -6.30677, -6.42566, -6.54068, 41 | -6.65176, -6.75883, -6.86183, -6.9607, -7.05537, -7.14579, -7.23191, -7.31368, 42 | -7.39104, -7.46394, -7.53235, -7.59623, -7.65552, -7.71021, -7.76025, -7.80562, 43 | -7.84628, -7.88222, -7.91341, -7.93984, -7.96148, -7.97832, -7.99036, -7.99759, 44 | -8, -7.99759, -7.99036, -7.97832, -7.96148, -7.93984, -7.91341, -7.88222, 45 | -7.84628, -7.80562, -7.76025, -7.71021, -7.65552, -7.59623, -7.53235, -7.46394, 46 | -7.39104, -7.31368, -7.23191, -7.14579, -7.05537, -6.9607, -6.86183, -6.75883, 47 | -6.65176, -6.54068, -6.42566, -6.30677, -6.18408, -6.05767, -5.92761, -5.79398, 48 | -5.65685, -5.51632, -5.37247, -5.22538, -5.07515, -4.92185, -4.76559, -4.60647, 49 | -4.44456, -4.27998, -4.11282, -3.94319, -3.77117, -3.59689, -3.42044, -3.24193, 50 | -3.06147, -2.87916, -2.69512, -2.50945, -2.32228, -2.1337, -1.94384, -1.75281, 51 | -1.56072, -1.3677, -1.17384, -0.979285, -0.784137, -0.588517, -0.392541, -0.19633, 52 | -------------------------------------------------------------------------------- /makefile.linux: -------------------------------------------------------------------------------- 1 | # 2 | # JoeQuake Makefile for Linux 3 | # 4 | # by Slawomir Mazurek 5 | # 6 | # JDH: customized for reQuiem; removed asm code from Linux build 7 | 8 | CC = gcc 9 | 10 | ################ 11 | 12 | default_target: glx 13 | 14 | all: glx 15 | 16 | ################################ 17 | # Directories for object files # 18 | ################################ 19 | 20 | GLX_DIR = release_glx 21 | 22 | ################ 23 | # Binary files # 24 | ################ 25 | 26 | GLX_TARGET = $(GLX_DIR)/reQuiem.glx 27 | 28 | ################ 29 | 30 | C_BUILD = $(CC) -c -o $@ $(_CFLAGS) $< 31 | #S_BUILD = $(CC) -c -o $@ $(_CFLAGS) -DELF -x assembler-with-cpp $< 32 | BUILD = $(CC) -o $@ $(_OBJS) $(_LDFLAGS) 33 | MKDIR = mkdir -p $@ 34 | RM_FILES = rm -f $(_FILES) 35 | RM_DIRS = rm -fr $(_DIRS) 36 | 37 | ################ 38 | 39 | $(GLX_DIR): 40 | $(MKDIR) 41 | 42 | CPU_OPT = -march=pentium 43 | CFLAGS += $(CPU_OPT) 44 | CFLAGS += -O3 -Wall -DNDEBUG -fomit-frame-pointer 45 | CFLAGS += -m32 46 | 47 | LDFLAGS := -lm -ldl -m32 48 | 49 | ####### 50 | # GLX # 51 | ####### 52 | 53 | GLX_C_FILES := \ 54 | cd_common cd_linux chase cl_demo \ 55 | cl_input cl_main cl_parse cl_parse_qw \ 56 | cl_tent cmd common common_file \ 57 | console crc cvar dzip \ 58 | \ 59 | gl_alias gl_brush gl_draw gl_drawalias \ 60 | gl_drawsprite gl_mesh gl_refrag gl_rlight \ 61 | gl_rmain gl_rmisc gl_part gl_rsurf \ 62 | gl_part_qmb \ 63 | gl_screen gl_sky gl_sprite gl_warp \ 64 | gl_fog gl_md2 gl_md3 gl_texture \ 65 | \ 66 | host host_cmd host_saveload image \ 67 | keys mathlib menu model \ 68 | movie movie_avi music \ 69 | nehahra net_bsd net_dgrm net_loop \ 70 | net_main net_udp net_vcr pr_cmds \ 71 | pr_edict pr_exec sbar \ 72 | \ 73 | snd_dma snd_linux snd_mem snd_mix \ 74 | sv_main sv_move sv_phys sv_user \ 75 | sys_linux version vid_common_gl vid_glx \ 76 | view wad world zone \ 77 | \ 78 | hexen2 cl_effect_H2 cl_parse_H2 gl_part_H2 \ 79 | menu_H2 progs_H2 sbar_H2 80 | 81 | #GLX_S_FILES := \ 82 | # math snd_mixa sys_x86 83 | 84 | GLX_C_OBJS := $(addprefix $(GLX_DIR)/, $(addsuffix .o, $(GLX_C_FILES))) 85 | #GLX_S_OBJS := $(addprefix $(GLX_DIR)/, $(addsuffix .o, $(GLX_S_FILES))) 86 | 87 | GLX_CFLAGS := $(CFLAGS) -DGLQUAKE -I/usr/include -I/usr/X11R6/include 88 | 89 | GLX_LDFLAGS := $(LDFLAGS) -lGL -L/usr/X11R6/lib -lX11 -lXext -lXxf86dga -lXxf86vm 90 | # -lpng 91 | # -ljpeg 92 | 93 | glx: _DIR := $(GLX_DIR) 94 | #glx: _OBJS := $(GLX_C_OBJS) $(GLX_S_OBJS) 95 | glx: _OBJS := $(GLX_C_OBJS) 96 | glx: _LDFLAGS := $(GLX_LDFLAGS) 97 | glx: _CFLAGS := $(GLX_CFLAGS) 98 | glx: $(GLX_TARGET) 99 | 100 | #$(GLX_TARGET): $(GLX_DIR) $(GLX_C_OBJS) $(GLX_S_OBJS) 101 | $(GLX_TARGET): $(GLX_DIR) $(GLX_C_OBJS) 102 | $(BUILD) 103 | 104 | $(GLX_C_OBJS): $(GLX_DIR)/%.o: %.c quakedef.h 105 | $(C_BUILD) 106 | 107 | #$(GLX_S_OBJS): $(GLX_DIR)/%.o: %.s 108 | # $(S_BUILD) 109 | 110 | #glxclean: _FILES += $(GLX_C_OBJS) $(GLX_S_OBJS) 111 | glxclean: _FILES += $(GLX_C_OBJS) 112 | glxclean: _DIRS := $(GLX_DIR) 113 | glxclean: 114 | $(RM_FILES) 115 | $(RM_DIRS) 116 | 117 | glxclobber: _FILES := $(GLX_TARGET) 118 | glxclobber: glxclean 119 | 120 | ################# 121 | 122 | clean: glxclean 123 | 124 | clobber: _DIRS := $(GLX_DIR) 125 | clobber: 126 | $(RM_DIRS) 127 | -------------------------------------------------------------------------------- /makefile.mingw: -------------------------------------------------------------------------------- 1 | # 2 | # JoeQuake Makefile for Win32 3 | # 4 | # by Slawomir Mazurek 5 | # TODO: resource file; get rid of console window 6 | 7 | CC := gcc 8 | #_E := @ 9 | _E := 10 | 11 | ################ 12 | 13 | default_target: glx 14 | 15 | all: glx 16 | 17 | ################################ 18 | # Directories for object files # 19 | ################################ 20 | 21 | GLX_DIR := release_glx 22 | 23 | ################ 24 | # Binary files # 25 | ################ 26 | 27 | GLX_TARGET := $(GLX_DIR)/reQuiem.exe 28 | 29 | ################ 30 | 31 | C_BUILD = $(_E)$(CC) -c -o $@ $(_CFLAGS) $< 32 | S_BUILD = $(_E)$(CC) -c -o $@ $(_CFLAGS) -x assembler-with-cpp $< 33 | BUILD = $(_E)$(CC) -o $@ $(_OBJS) $(_LDFLAGS) 34 | MKDIR = $(_E)md $@ 35 | RM_FILES = $(_E)del $(GLX_DIR)\*.o 36 | RM_DIRS = $(_E)rd $(GLX_DIR) 37 | 38 | ################ 39 | 40 | $(GLX_DIR): 41 | $(MKDIR) 42 | 43 | #CFLAGS += -Did386 -funsigned-char -O6 \ 44 | # -D_WIN32 -march=pentiumpro -Wall \ 45 | # -funroll-loops -fomit-frame-pointer -DNDEBUG \ 46 | # -ffast-math -fno-strength-reduce -fexpensive-optimizations 47 | 48 | CFLAGS += -Did386 -funsigned-char -O6 \ 49 | -D_WIN32 -march=pentiumpro \ 50 | -fno-unit-at-a-time -funroll-loops -fomit-frame-pointer -DNDEBUG \ 51 | -ffast-math -fno-strength-reduce -fexpensive-optimizations 52 | LDFLAGS := -lm 53 | 54 | ####### 55 | # GLX # 56 | ####### 57 | 58 | GLX_C_FILES := \ 59 | cd_common cd_win chase cl_demo \ 60 | cl_input cl_main cl_parse cl_parse_qw \ 61 | cl_tent cmd common common_file \ 62 | conproc console crc cvar dzip \ 63 | \ 64 | gl_alias gl_brush gl_draw gl_drawalias \ 65 | gl_drawsprite gl_mesh gl_refrag gl_rlight \ 66 | gl_rmain gl_rmisc gl_rpart gl_rsurf \ 67 | gl_screen gl_sky gl_sprite gl_warp \ 68 | gl_fog gl_md2 gl_md3 gl_texture \ 69 | \ 70 | host host_cmd host_saveload image \ 71 | keys mathlib menu music \ 72 | in_win model movie movie_avi \ 73 | nehahra net_win net_wins net_dgrm net_loop \ 74 | net_main net_vcr net_wipx pr_cmds \ 75 | pr_edict pr_exec r_part sbar \ 76 | \ 77 | snd_dma snd_win snd_mem snd_mix \ 78 | sv_main sv_move sv_phys sv_user \ 79 | sys_win version vid_common_gl vid_wgl \ 80 | view wad world zone \ 81 | \ 82 | hexen2 cl_effect_H2 cl_parse_H2 \ 83 | menu_H2 progs_H2 r_part_H2 sbar_H2 84 | 85 | GLX_S_FILES := \ 86 | math snd_mixa sys_x86 87 | 88 | GLX_C_OBJS := $(addprefix $(GLX_DIR)/, $(addsuffix .o, $(GLX_C_FILES))) 89 | GLX_S_OBJS := $(addprefix $(GLX_DIR)/, $(addsuffix .o, $(GLX_S_FILES))) 90 | 91 | GLX_CFLAGS := $(CFLAGS) \ 92 | -DGLQUAKE -DWIN32 -D_WINDOWS -D_MBCS 93 | 94 | # uncomment following line for static linking of libpng 95 | #GLX_LDFLAGS := -l kernel32 -l user32 -l gdi32 -l dxguid -l opengl32 -l wsock32 -l winmm -l png -l z 96 | GLX_LDFLAGS := -l kernel32 -l user32 -l gdi32 -l dxguid -l opengl32 -l wsock32 -l winmm 97 | 98 | glx: _DIR := $(GLX_DIR) 99 | glx: _OBJS := $(GLX_C_OBJS) $(GLX_S_OBJS) 100 | glx: _LDFLAGS := $(GLX_LDFLAGS) 101 | glx: _CFLAGS := $(GLX_CFLAGS) 102 | glx: $(GLX_TARGET) 103 | 104 | $(GLX_TARGET): $(GLX_DIR) $(GLX_C_OBJS) $(GLX_S_OBJS) 105 | $(BUILD) 106 | 107 | $(GLX_C_OBJS): $(GLX_DIR)/%.o: %.c quakedef.h 108 | $(C_BUILD) 109 | 110 | $(GLX_S_OBJS): $(GLX_DIR)/%.o: %.s 111 | $(S_BUILD) 112 | 113 | glxclean: _FILES += $(GLX_C_OBJS) $(GLX_S_OBJS) 114 | glxclean: _DIRS := $(GLX_DIR) 115 | glxclean: 116 | $(RM_FILES) 117 | $(RM_DIRS) 118 | 119 | glxclobber: _FILES := $(GLX_TARGET) 120 | glxclobber: glxclean 121 | 122 | ################# 123 | 124 | clean: glxclean 125 | 126 | clobber: _DIRS := $(GLX_DIR) 127 | clobber: 128 | $(RM_DIRS) 129 | -------------------------------------------------------------------------------- /crc.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | // crc.c 21 | 22 | #include "quakedef.h" 23 | #include "crc.h" 24 | 25 | // this is a 16 bit, non-reflected CRC using the polynomial 0x1021 26 | // and the initial and final xor values shown below... in other words, the 27 | // CCITT standard CRC used by XMODEM 28 | 29 | #define CRC_INIT_VALUE 0xffff 30 | #define CRC_XOR_VALUE 0x0000 31 | 32 | static unsigned short crctable[256] = 33 | { 34 | 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, 35 | 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, 36 | 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, 37 | 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de, 38 | 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485, 39 | 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, 40 | 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4, 41 | 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, 42 | 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823, 43 | 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b, 44 | 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12, 45 | 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a, 46 | 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41, 47 | 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49, 48 | 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, 49 | 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, 50 | 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f, 51 | 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067, 52 | 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e, 53 | 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256, 54 | 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d, 55 | 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, 56 | 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c, 57 | 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, 58 | 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, 59 | 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3, 60 | 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, 61 | 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92, 62 | 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9, 63 | 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, 64 | 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8, 65 | 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0 66 | }; 67 | 68 | void CRC_Init (unsigned short *crcvalue) 69 | { 70 | *crcvalue = CRC_INIT_VALUE; 71 | } 72 | 73 | void CRC_ProcessByte (unsigned short *crcvalue, byte data) 74 | { 75 | *crcvalue = (*crcvalue << 8) ^ crctable[(*crcvalue >> 8) ^ data]; 76 | } 77 | 78 | unsigned short CRC_Value (unsigned short crcvalue) 79 | { 80 | return crcvalue ^ CRC_XOR_VALUE; 81 | } 82 | 83 | unsigned short CRC_Block (const byte *data, int size) 84 | { 85 | unsigned short crc = CRC_INIT_VALUE; 86 | 87 | while (size--) 88 | crc = (crc << 8) ^ crctable[(crc >> 8) ^ (*data++)]; 89 | 90 | return crc ^ CRC_XOR_VALUE; 91 | } 92 | -------------------------------------------------------------------------------- /zone.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | /* 21 | memory allocation 22 | 23 | 24 | H_??? The hunk manages the entire memory block given to quake. It must be 25 | contiguous. Memory can be allocated from either the low or high end in a 26 | stack fashion. The only way memory is released is by resetting one of the 27 | pointers. 28 | 29 | Hunk allocations should be given a name, so the Hunk_Print () function 30 | can display usage. 31 | 32 | Hunk allocations are guaranteed to be 16 byte aligned. 33 | 34 | The video buffers are allocated high to avoid leaving a hole underneath 35 | server allocations when changing to a higher video mode. 36 | 37 | 38 | Z_??? Zone memory functions used for small, dynamic allocations like text 39 | strings from command input. There is only about 48K for it, allocated at 40 | the very bottom of the hunk. 41 | 42 | Cache_??? Cache memory is for objects that can be dynamically loaded and 43 | can usefully stay persistant between levels. The size of the cache 44 | fluctuates from level to level. 45 | 46 | To allocate a cachable object 47 | 48 | 49 | Temp_??? Temp memory is used for file loading and surface caching. The size 50 | of the cache memory is adjusted so that there is a minimum of 512k remaining 51 | for temp memory. 52 | 53 | 54 | ------ Top of Memory ------- 55 | 56 | high hunk allocations 57 | 58 | <--- high hunk reset point held by vid 59 | 60 | video buffer 61 | 62 | z buffer 63 | 64 | surface cache 65 | 66 | <--- high hunk used 67 | 68 | cachable memory 69 | 70 | <--- low hunk used 71 | 72 | client and server low hunk allocations 73 | 74 | <-- low hunk reset point held by host 75 | 76 | startup hunk allocations 77 | 78 | Zone block 79 | 80 | ----- Bottom of Memory ----- 81 | 82 | 83 | */ 84 | 85 | void Memory_Init (void *buf, size_t size); 86 | 87 | void *Q_malloc (size_t size); // joe 88 | void *Q_calloc (size_t n, size_t size); // 89 | void *Q_realloc (void *ptr, size_t size); // 90 | void *Q_strdup (const char *str); // 91 | 92 | void Z_Free (void *ptr); 93 | void *Z_Malloc (size_t size); // returns 0 filled memory 94 | void *Z_TagMalloc (size_t size, int tag); 95 | 96 | void Z_DumpHeap (void); 97 | void Z_CheckHeap (void); 98 | int Z_FreeMemory (void); 99 | 100 | void *Hunk_Alloc (size_t size); // returns 0 filled memory 101 | void *Hunk_AllocName (size_t size, const char *name); 102 | 103 | void *Hunk_HighAllocName (size_t size, const char *name); 104 | 105 | int Hunk_LowMark (void); 106 | void Hunk_FreeToLowMark (int mark); 107 | 108 | int Hunk_HighMark (void); 109 | void Hunk_FreeToHighMark (int mark); 110 | 111 | void *Hunk_TempAlloc (size_t size); 112 | 113 | void Hunk_Check (void); 114 | 115 | typedef struct cache_user_s 116 | { 117 | void *data; 118 | } cache_user_t; 119 | 120 | void Cache_Flush (cmd_source_t src); 121 | 122 | void *Cache_Check (cache_user_t *c); 123 | // returns the cached data, and moves to the head of the LRU list 124 | // if present, otherwise returns NULL 125 | 126 | void Cache_Free (cache_user_t *c); 127 | 128 | void *Cache_Alloc (cache_user_t *c, size_t size, const char *name); 129 | // Returns NULL if all purgable data was tossed and there still 130 | // wasn't enough room. 131 | 132 | void Cache_Report (void); 133 | -------------------------------------------------------------------------------- /draw.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // draw.h -- these are the only functions outside the refresh allowed 22 | // to touch the vid buffer 23 | 24 | #ifdef GLQUAKE 25 | typedef struct 26 | { 27 | int width, height; 28 | int texnum; 29 | float sl, tl, sh, th; 30 | } mpic_t; 31 | #else 32 | typedef struct 33 | { 34 | int width; 35 | short height; 36 | byte alpha; 37 | byte pad; 38 | byte data[4]; // variable sized 39 | } mpic_t; 40 | #endif 41 | 42 | // indices of special chars from the conchars2 lmp 43 | //typedef enum {CHAR2_SCRUP, CHAR2_SCRDN, CHAR2_ARROWLT, CHAR2_ARROWRT, CHAR2_ARROWUP, CHAR2_ARROWDN}; 44 | 45 | #define DRAW_CHARWIDTH 8 46 | #define DRAW_CHARHEIGHT 8 47 | 48 | #define DRAW_BIGCHARWIDTH 24 49 | #define DRAW_BIGCHARHEIGHT 24 50 | 51 | #ifdef HEXEN2_SUPPORT 52 | # define DRAW_BIGCHARWIDTH_H2 12 53 | # define DRAW_BIGCHARHEIGHT_H2 16 54 | #endif 55 | 56 | // flags for Draw_BigNumString: 57 | #define DRAWNUM_ALIGNRIGHT 0x0001 58 | #define DRAWNUM_TIGHT 0x0002 59 | #define DRAWNUM_ALTCOLOR 0x0080 60 | 61 | extern mpic_t *draw_disc; // also used on sbar 62 | 63 | #define Draw_Character(x, y, num) Draw_Character_Scaled((x), (y), (num), 1.0) 64 | #define Draw_Pic(x, y, pic) Draw_Pic_Scaled((x), (y), (pic), 1.0) 65 | #define Draw_TransPic(x, y, pic) Draw_Pic((x), (y), (pic)) 66 | #define Draw_TransPic_Scaled(x, y, pic, scale) Draw_Pic_Scaled((x), (y), (pic), (scale)) 67 | 68 | void Draw_Init (void); 69 | void Draw_ReloadWadFile (void); 70 | void Draw_Character_Scaled (int x, int y, int num, float scale); 71 | //void Draw_Character2 (int x, int y, int num); 72 | void Draw_DebugChar (char num); 73 | void Draw_SubPic (int x, int y, const mpic_t *pic, int s, int t, int width, int height); 74 | void Draw_Pic_Scaled (int x, int y, const mpic_t *pic, float scale); 75 | //void Draw_TransPic (int x, int y, const mpic_t *pic); 76 | void Draw_TransPicTranslate (int x, int y, mpic_t *pic, const byte *translation, int playertype); 77 | void Draw_ConsoleBackground (int lines); 78 | void Draw_ConbackSolid (void); 79 | void Draw_BeginDisc (void); 80 | void Draw_EndDisc (void); 81 | void Draw_TileClear (int x, int y, int w, int h); 82 | void Draw_Fill (int x, int y, int w, int h, int c); 83 | void Draw_FillRGB (int x, int y, int w, int h, const byte rgb[3]); 84 | void Draw_DimScreen (void); 85 | void Draw_String (int x, int y, const char *str); 86 | void Draw_Alt_String (int x, int y, const char *str); 87 | void Draw_BigString (int x, int y, const char *str); 88 | void Draw_BigNumString (int x, int y, const char *str, int flags); 89 | mpic_t *Draw_PicFromWad (const char *name); 90 | mpic_t *Draw_GetCachePic (const char *path, qboolean crash); 91 | mpic_t * Draw_FindCachePic (const char *filepath); 92 | qpic_t * Draw_LoadCachePic (const char *filepath); 93 | mpic_t * Draw_AddCachePic (const char *filepath, byte *data, int width, int height); 94 | void Draw_CopyPicToPic (const qpic_t *pic_src, qpic_t *pic_dest, int x, int y); 95 | void Draw_Crosshair (void); 96 | void Draw_TextBox (int x, int y, int width, int height); 97 | void GL_SetFontFilter (float filter); 98 | 99 | #ifdef HEXEN2_SUPPORT 100 | void Draw_SmallString(int x, int y, const char *str); 101 | // void Draw_PicCropped(int x, int y, mpic_t *pic); 102 | #endif 103 | -------------------------------------------------------------------------------- /winquake.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | // winquake.h: Win32-specific Quake header file 21 | 22 | #ifdef _WIN32 23 | 24 | #ifdef _MSC_VER 25 | #pragma warning (disable : 4229) // mgraph gets this 26 | #endif 27 | 28 | #include 29 | 30 | #ifndef WM_MOUSEWHEEL 31 | #define WM_MOUSEWHEEL 0x020A 32 | #endif 33 | 34 | #ifndef SERVERONLY 35 | # include 36 | # if defined(_WIN32) && defined(_MSC_VER) 37 | # pragma warning (disable : 4201) // ddraw.h re-enables this 38 | # endif 39 | # include 40 | #endif 41 | 42 | extern HINSTANCE global_hInstance; 43 | extern int global_nCmdShow; 44 | 45 | #ifndef SERVERONLY 46 | 47 | extern LPDIRECTDRAW lpDD; 48 | extern qboolean DDActive; 49 | extern LPDIRECTDRAWSURFACE lpPrimary; 50 | extern LPDIRECTDRAWSURFACE lpFrontBuffer; 51 | extern LPDIRECTDRAWSURFACE lpBackBuffer; 52 | extern LPDIRECTDRAWPALETTE lpDDPal; 53 | 54 | //extern LPDIRECTSOUND pDS; 55 | //extern LPDIRECTSOUNDBUFFER pDSBuf; 56 | //extern DWORD gSndBufSize; 57 | //#define SNDBUFSIZE 65536 58 | 59 | //void VID_LockBuffer (void); 60 | //void VID_UnlockBuffer (void); 61 | 62 | #endif 63 | 64 | typedef enum {MS_WINDOWED, MS_FULLSCREEN, MS_FULLDIB, MS_UNINIT} modestate_t; 65 | 66 | extern modestate_t modestate; 67 | 68 | extern HWND mainwindow; 69 | extern qboolean ActiveApp, Minimized; 70 | 71 | extern qboolean WinNT; 72 | 73 | int VID_ForceUnlockedAndReturnState (void); 74 | void VID_ForceLockState (int lk); 75 | 76 | void IN_ShowMouse (void); 77 | void IN_DeactivateMouse (void); 78 | void IN_HideMouse (void); 79 | void IN_ActivateMouse (void); 80 | void IN_RestoreOriginalMouseState (void); 81 | void IN_SetQuakeMouseState (void); 82 | void IN_MouseEvent (int mstate); 83 | //int IN_MapKey (int key); 84 | int IN_MapKey (WPARAM wParam, LPARAM lParam, int *keyshift); 85 | 86 | extern qboolean winsock_lib_initialized; 87 | 88 | extern int window_center_x, window_center_y; 89 | extern RECT window_rect; 90 | 91 | extern qboolean mouseinitialized; 92 | extern HWND hwnd_dialog; 93 | 94 | extern HANDLE hinput, houtput; 95 | 96 | void IN_UpdateClipCursor (void); 97 | void CenterWindow (HWND hWndCenter, int width, int height, BOOL lefttopjustify); 98 | 99 | void S_BlockSound (void); 100 | void S_UnblockSound (void); 101 | 102 | void VID_SetDefaultMode (void); 103 | 104 | int (PASCAL FAR *pWSAStartup)(WORD wVersionRequired, LPWSADATA lpWSAData); 105 | int (PASCAL FAR *pWSACleanup)(void); 106 | int (PASCAL FAR *pWSAGetLastError)(void); 107 | SOCKET (PASCAL FAR *psocket)(int af, int type, int protocol); 108 | int (PASCAL FAR *pioctlsocket)(SOCKET s, long cmd, u_long FAR *argp); 109 | int (PASCAL FAR *psetsockopt)(SOCKET s, int level, int optname, const char FAR * optval, int optlen); 110 | int (PASCAL FAR *precvfrom)(SOCKET s, char FAR * buf, int len, int flags, struct sockaddr FAR *from, int FAR * fromlen); 111 | int (PASCAL FAR *psendto)(SOCKET s, const char FAR * buf, int len, int flags, const struct sockaddr FAR *to, int tolen); 112 | int (PASCAL FAR *pclosesocket)(SOCKET s); 113 | int (PASCAL FAR *pgethostname)(char FAR * name, int namelen); 114 | struct hostent FAR * (PASCAL FAR *pgethostbyname)(const char FAR * name); 115 | struct hostent FAR * (PASCAL FAR *pgethostbyaddr)(const char FAR * addr, int len, int type); 116 | int (PASCAL FAR *pgetsockname)(SOCKET s, struct sockaddr FAR *name, int FAR * namelen); 117 | 118 | #endif //_WIN32 119 | -------------------------------------------------------------------------------- /fontsize.lmp: -------------------------------------------------------------------------------- 1 |   2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 |  -------------------------------------------------------------------------------- /net_vcr.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | // net_vcr.c 21 | 22 | #include "quakedef.h" 23 | #include "net_vcr.h" 24 | 25 | extern FILE* vcrFile; 26 | 27 | // This is the playback portion of the VCR. It reads the file produced 28 | // by the recorder and plays it back to the host. The recording contains 29 | // everything necessary (events, timestamps, and data) to duplicate the game 30 | // from the viewpoint of everything above the network layer. 31 | 32 | static struct 33 | { 34 | double time; 35 | int op; 36 | long session; 37 | } next; 38 | 39 | int VCR_Init (void) 40 | { 41 | net_drivers[0].Init = VCR_Init; 42 | 43 | net_drivers[0].SearchForHosts = VCR_SearchForHosts; 44 | net_drivers[0].Connect = VCR_Connect; 45 | net_drivers[0].CheckNewConnections = VCR_CheckNewConnections; 46 | net_drivers[0].QGetMessage = VCR_GetMessage; 47 | net_drivers[0].QSendMessage = VCR_SendMessage; 48 | net_drivers[0].CanSendMessage = VCR_CanSendMessage; 49 | net_drivers[0].Close = VCR_Close; 50 | net_drivers[0].Shutdown = VCR_Shutdown; 51 | 52 | fread (&next, 1, sizeof(next), vcrFile); 53 | return 0; 54 | } 55 | 56 | void VCR_ReadNext (void) 57 | { 58 | if (!fread (&next, 1, sizeof(next), vcrFile)) 59 | { 60 | next.op = 255; 61 | Sys_Error ("=== END OF PLAYBACK===\n"); 62 | } 63 | if (next.op < 1 || next.op > VCR_MAX_MESSAGE) 64 | Sys_Error ("VCR_ReadNext: bad op"); 65 | } 66 | 67 | 68 | void VCR_Listen (qboolean state) 69 | { 70 | } 71 | 72 | 73 | void VCR_Shutdown (void) 74 | { 75 | } 76 | 77 | 78 | int VCR_GetMessage (qsocket_t *sock) 79 | { 80 | int ret; 81 | 82 | if (host_time != next.time || next.op != VCR_OP_GETMESSAGE || next.session != *(long *)(&sock->driverdata)) 83 | Sys_Error ("VCR missmatch"); 84 | 85 | fread (&ret, 1, sizeof(int), vcrFile); 86 | if (ret != 1) 87 | { 88 | VCR_ReadNext (); 89 | return ret; 90 | } 91 | 92 | fread (&net_message.cursize, 1, sizeof(int), vcrFile); 93 | fread (net_message.data, 1, net_message.cursize, vcrFile); 94 | 95 | VCR_ReadNext (); 96 | 97 | return 1; 98 | } 99 | 100 | 101 | int VCR_SendMessage (qsocket_t *sock, sizebuf_t *data) 102 | { 103 | int ret; 104 | 105 | if (host_time != next.time || next.op != VCR_OP_SENDMESSAGE || next.session != *(long *)(&sock->driverdata)) 106 | Sys_Error ("VCR missmatch"); 107 | 108 | fread (&ret, 1, sizeof(int), vcrFile); 109 | 110 | VCR_ReadNext (); 111 | 112 | return ret; 113 | } 114 | 115 | 116 | qboolean VCR_CanSendMessage (qsocket_t *sock) 117 | { 118 | qboolean ret; 119 | 120 | if (host_time != next.time || next.op != VCR_OP_CANSENDMESSAGE || next.session != *(long *)(&sock->driverdata)) 121 | Sys_Error ("VCR mismatch"); 122 | 123 | fread (&ret, 1, sizeof(int), vcrFile); 124 | 125 | VCR_ReadNext (); 126 | 127 | return ret; 128 | } 129 | 130 | 131 | void VCR_Close (qsocket_t *sock) 132 | { 133 | } 134 | 135 | 136 | void VCR_SearchForHosts (qboolean xmit) 137 | { 138 | } 139 | 140 | 141 | qsocket_t *VCR_Connect (const char *host) 142 | { 143 | return NULL; 144 | } 145 | 146 | 147 | qsocket_t *VCR_CheckNewConnections (void) 148 | { 149 | qsocket_t *sock; 150 | 151 | if (host_time != next.time || next.op != VCR_OP_CONNECT) 152 | Sys_Error ("VCR missmatch"); 153 | 154 | if (!next.session) 155 | { 156 | VCR_ReadNext (); 157 | return NULL; 158 | } 159 | 160 | sock = NET_NewQSocket (); 161 | *(long *)(&sock->driverdata) = next.session; 162 | 163 | fread (sock->address, 1, NET_NAMELEN, vcrFile); 164 | VCR_ReadNext (); 165 | 166 | return sock; 167 | } 168 | -------------------------------------------------------------------------------- /keys.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | #define MAX_KEYS 256 22 | 23 | // these are the key numbers that should be passed to Key_Event 24 | #define K_TAB 9 25 | #define K_ENTER 13 26 | #define K_ESCAPE 27 27 | #define K_SPACE 32 28 | 29 | // normal keys should be passed as lowercased ascii 30 | 31 | #define K_BACKSPACE 127 32 | #define K_UPARROW 128 33 | #define K_DOWNARROW 129 34 | #define K_LEFTARROW 130 35 | #define K_RIGHTARROW 131 36 | 37 | #define K_ALT 132 38 | #define K_CTRL 133 39 | #define K_SHIFT 134 40 | #define K_F1 135 41 | #define K_F2 136 42 | #define K_F3 137 43 | #define K_F4 138 44 | #define K_F5 139 45 | #define K_F6 140 46 | #define K_F7 141 47 | #define K_F8 142 48 | #define K_F9 143 49 | #define K_F10 144 50 | #define K_F11 145 51 | #define K_F12 146 52 | #define K_INS 147 53 | #define K_DEL 148 54 | #define K_PGDN 149 55 | #define K_PGUP 150 56 | #define K_HOME 151 57 | #define K_END 152 58 | 59 | #define K_CAPSLOCK 153 60 | 61 | // JDH: added next 13 62 | #define K_NUMLOCK 154 63 | #define K_SCRLOCK 155 64 | #define K_PRINTSCR 156 65 | #define K_LALT 157 66 | #define K_RALT 158 67 | #define K_LCTRL 159 68 | #define K_RCTRL 160 69 | #define K_LSHIFT 161 70 | #define K_RSHIFT 162 71 | #define K_WIN 163 72 | #define K_LWIN 164 73 | #define K_RWIN 165 74 | #define K_MENU 166 75 | 76 | // JDH: keyboard scancodes that don't map to Quake-recognized keys are 77 | // given the following names (assigned to the first 8 such scancodes) 78 | #define K_EX1 167 79 | #define K_EX2 168 80 | #define K_EX3 169 81 | #define K_EX4 170 82 | #define K_EX5 171 83 | #define K_EX6 172 84 | #define K_EX7 173 85 | #define K_EX8 174 86 | 87 | #define K_PAUSE 255 88 | 89 | // mouse buttons generate virtual keys 90 | #define K_MOUSE1 200 91 | #define K_MOUSE2 201 92 | #define K_MOUSE3 202 93 | 94 | // joystick buttons 95 | #define K_JOY1 203 96 | #define K_JOY2 204 97 | #define K_JOY3 205 98 | #define K_JOY4 206 99 | 100 | // aux keys are for multi-buttoned joysticks to generate so they can use 101 | // the normal binding process 102 | #define K_AUX1 207 103 | #define K_AUX2 208 104 | #define K_AUX3 209 105 | #define K_AUX4 210 106 | #define K_AUX5 211 107 | #define K_AUX6 212 108 | #define K_AUX7 213 109 | #define K_AUX8 214 110 | #define K_AUX9 215 111 | #define K_AUX10 216 112 | #define K_AUX11 217 113 | #define K_AUX12 218 114 | #define K_AUX13 219 115 | #define K_AUX14 220 116 | #define K_AUX15 221 117 | #define K_AUX16 222 118 | #define K_AUX17 223 119 | #define K_AUX18 224 120 | #define K_AUX19 225 121 | #define K_AUX20 226 122 | #define K_AUX21 227 123 | #define K_AUX22 228 124 | #define K_AUX23 229 125 | #define K_AUX24 230 126 | #define K_AUX25 231 127 | #define K_AUX26 232 128 | #define K_AUX27 233 129 | #define K_AUX28 234 130 | #define K_AUX29 235 131 | #define K_AUX30 236 132 | #define K_AUX31 237 133 | #define K_AUX32 238 134 | 135 | // JACK: Intellimouse(c) Mouse Wheel Support 136 | 137 | #define K_MWHEELUP 239 138 | #define K_MWHEELDOWN 240 139 | 140 | #define MAX_EXKEYS 8 /* K_EX1 to K_EX8 */ 141 | 142 | 143 | #ifndef RQM_SV_ONLY 144 | 145 | #define MAXCMDLINELEN 256 146 | 147 | typedef enum {key_game, key_console, key_message, key_menu} keydest_t; 148 | 149 | extern keydest_t key_dest; 150 | extern int key_repeats[MAX_KEYS]; 151 | extern int key_count; // incremented every key event 152 | extern int key_lastpress; 153 | extern qboolean keydown[256]; 154 | 155 | #define Key_Event(key, down) Key_Event2((key), 0, (down)) 156 | void Key_Event2 (int key, int keyshift, qboolean down); // JDH: added 2nd key param 157 | void Key_Init (void); 158 | void Key_ClearStates (void); 159 | 160 | #endif //#ifndef RQM_SV_ONLY 161 | 162 | 163 | extern char *keybindings[MAX_KEYS]; 164 | 165 | int Key_WriteBindings (FILE *f); 166 | void Key_SetBinding (int keynum, const char *binding); 167 | //char * Key_SwapBinding (int keynum, char *binding); 168 | void Key_Unbindall_f (cmd_source_t src); 169 | void Key_ResetAll (void); 170 | int Key_StringToKeynum (const char *str); 171 | -------------------------------------------------------------------------------- /pr_comp.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // this file is shared by quake and qcc 22 | 23 | typedef int func_t; 24 | typedef int string_t; 25 | 26 | typedef enum {ev_void, ev_string, ev_float, ev_vector, ev_entity, ev_field, ev_function, ev_pointer} etype_t; 27 | 28 | 29 | #define OFS_NULL 0 30 | #define OFS_RETURN 1 31 | #define OFS_PARM0 4 // leave 3 ofs for each parm to hold vectors 32 | #define OFS_PARM1 7 33 | #define OFS_PARM2 10 34 | #define OFS_PARM3 13 35 | #define OFS_PARM4 16 36 | #define OFS_PARM5 19 37 | #define OFS_PARM6 22 38 | #define OFS_PARM7 25 39 | #define RESERVED_OFS 28 40 | 41 | 42 | enum { 43 | OP_DONE, 44 | OP_MUL_F, 45 | OP_MUL_V, 46 | OP_MUL_FV, 47 | OP_MUL_VF, 48 | OP_DIV_F, 49 | OP_ADD_F, 50 | OP_ADD_V, 51 | OP_SUB_F, 52 | OP_SUB_V, 53 | 54 | OP_EQ_F, // 10 55 | OP_EQ_V, 56 | OP_EQ_S, 57 | OP_EQ_E, 58 | OP_EQ_FNC, 59 | 60 | OP_NE_F, // 15 61 | OP_NE_V, 62 | OP_NE_S, 63 | OP_NE_E, 64 | OP_NE_FNC, 65 | 66 | OP_LE, // 20 67 | OP_GE, 68 | OP_LT, 69 | OP_GT, 70 | 71 | OP_LOAD_F, // 24 72 | OP_LOAD_V, 73 | OP_LOAD_S, 74 | OP_LOAD_ENT, 75 | OP_LOAD_FLD, 76 | OP_LOAD_FNC, 77 | 78 | OP_ADDRESS, // 30 79 | 80 | OP_STORE_F, // 31 81 | OP_STORE_V, 82 | OP_STORE_S, 83 | OP_STORE_ENT, 84 | OP_STORE_FLD, 85 | OP_STORE_FNC, 86 | 87 | OP_STOREP_F, // 37 88 | OP_STOREP_V, 89 | OP_STOREP_S, 90 | OP_STOREP_ENT, 91 | OP_STOREP_FLD, 92 | OP_STOREP_FNC, 93 | 94 | OP_RETURN, // 43 95 | OP_NOT_F, 96 | OP_NOT_V, 97 | OP_NOT_S, 98 | OP_NOT_ENT, 99 | OP_NOT_FNC, 100 | OP_IF, // 49 101 | OP_IFNOT, 102 | OP_CALL0, // 51 103 | OP_CALL1, 104 | OP_CALL2, 105 | OP_CALL3, 106 | OP_CALL4, 107 | OP_CALL5, 108 | OP_CALL6, 109 | OP_CALL7, 110 | OP_CALL8, 111 | OP_STATE, // 60 112 | OP_GOTO, 113 | OP_AND, 114 | OP_OR, 115 | 116 | OP_BITAND, // 64 117 | OP_BITOR 118 | 119 | #ifdef HEXEN2_SUPPORT 120 | ,OP_MULSTORE_F, // 66 121 | OP_MULSTORE_V, 122 | OP_MULSTOREP_F, 123 | OP_MULSTOREP_V, 124 | 125 | OP_DIVSTORE_F, // 70 126 | OP_DIVSTOREP_F, 127 | 128 | OP_ADDSTORE_F, // 72 129 | OP_ADDSTORE_V, 130 | OP_ADDSTOREP_F, 131 | OP_ADDSTOREP_V, 132 | 133 | OP_SUBSTORE_F, // 76 134 | OP_SUBSTORE_V, 135 | OP_SUBSTOREP_F, 136 | OP_SUBSTOREP_V, 137 | 138 | OP_FETCH_GBL_F, // 80 139 | OP_FETCH_GBL_V, 140 | OP_FETCH_GBL_S, 141 | OP_FETCH_GBL_E, 142 | OP_FETCH_GBL_FNC, 143 | 144 | OP_CSTATE, // 85 145 | OP_CWSTATE, 146 | 147 | OP_THINKTIME, // 87 148 | 149 | OP_BITSET, // 88 150 | OP_BITSETP, 151 | OP_BITCLR, 152 | OP_BITCLRP, 153 | 154 | OP_RAND0, // 92 155 | OP_RAND1, 156 | OP_RAND2, 157 | OP_RANDV0, 158 | OP_RANDV1, 159 | OP_RANDV2, 160 | 161 | OP_SWITCH_F, // 98 162 | OP_SWITCH_V, 163 | OP_SWITCH_S, 164 | OP_SWITCH_E, 165 | OP_SWITCH_FNC, 166 | 167 | OP_CASE, // 103 168 | OP_CASERANGE 169 | #endif 170 | }; 171 | 172 | 173 | typedef struct statement_s 174 | { 175 | unsigned short op; 176 | short a, b, c; 177 | } dstatement_t; 178 | 179 | typedef struct 180 | { 181 | unsigned short type; // if DEF_SAVEGLOBGAL bit is set 182 | // the variable needs to be saved in savegames 183 | unsigned short ofs; 184 | // JDH: string offset is converted to string ptr at loadtime 185 | //int s_name; 186 | char *s_name; 187 | } ddef_t; 188 | #define DEF_SAVEGLOBAL (1<<15) 189 | 190 | #define MAX_PARMS 8 191 | typedef struct 192 | { 193 | int first_statement; // negative numbers are builtins 194 | int parm_start; 195 | int locals; // total ints of parms + locals 196 | 197 | int profile; // runtime 198 | 199 | // JDH: string offsets converted to string ptrs at loadtime 200 | // int s_name; 201 | // int s_file; // source file defined in 202 | char *s_name; 203 | char *s_file; // source file defined in 204 | 205 | int numparms; 206 | byte parm_size[MAX_PARMS]; 207 | } dfunction_t; 208 | 209 | #define PROG_VERSION 6 210 | typedef struct 211 | { 212 | int version; 213 | int crc; // check of header file 214 | 215 | int ofs_statements; 216 | int numstatements; // statement 0 is an error 217 | 218 | int ofs_globaldefs; 219 | int numglobaldefs; 220 | 221 | int ofs_fielddefs; 222 | int numfielddefs; 223 | 224 | int ofs_functions; 225 | int numfunctions; // function 0 is an empty 226 | 227 | int ofs_strings; 228 | int numstrings; // first string is a null string 229 | 230 | int ofs_globals; 231 | int numglobals; 232 | 233 | int entityfields; 234 | } dprograms_t; 235 | -------------------------------------------------------------------------------- /progdefs_H2.h: -------------------------------------------------------------------------------- 1 | 2 | /* generated by hcc, do not modify */ 3 | 4 | #ifdef HEXEN2_SUPPORT 5 | 6 | typedef struct 7 | { int pad[28]; 8 | int self; 9 | int other; 10 | int world; 11 | float time; 12 | float frametime; 13 | float force_retouch; 14 | string_t mapname; 15 | string_t startspot; 16 | float deathmatch; 17 | float randomclass; 18 | float coop; 19 | float teamplay; 20 | float cl_playerclass; 21 | float serverflags; 22 | float total_secrets; 23 | float total_monsters; 24 | float found_secrets; 25 | float killed_monsters; 26 | float chunk_cnt; 27 | float done_precache; 28 | float parm1; 29 | float parm2; 30 | float parm4; 31 | float parm5; 32 | float parm6; 33 | float parm7; 34 | float parm8; 35 | float parm9; 36 | float parm10; 37 | float parm11; 38 | float parm12; 39 | float parm13; 40 | float parm14; 41 | float parm15; 42 | float parm16; 43 | string_t parm3; 44 | vec3_t v_forward; 45 | vec3_t v_up; 46 | vec3_t v_right; 47 | float trace_allsolid; 48 | float trace_startsolid; 49 | float trace_fraction; 50 | vec3_t trace_endpos; 51 | vec3_t trace_plane_normal; 52 | float trace_plane_dist; 53 | int trace_ent; 54 | float trace_inopen; 55 | float trace_inwater; 56 | int msg_entity; 57 | float cycle_wrapped; 58 | float crouch_cnt; 59 | float modelindex_sheep; 60 | float num_players; 61 | float exp_mult; 62 | func_t main; 63 | func_t StartFrame; 64 | func_t PlayerPreThink; 65 | func_t PlayerPostThink; 66 | func_t ClientKill; 67 | func_t ClientConnect; 68 | func_t PutClientInServer; 69 | func_t ClientReEnter; 70 | func_t ClientDisconnect; 71 | func_t ClassChangeWeapon; 72 | } globalvars_H2_t; 73 | 74 | 75 | 76 | // JDH: merged with Quake's entvars_t 77 | /* 78 | typedef struct 79 | { 80 | float modelindex; 81 | vec3_t absmin; 82 | vec3_t absmax; 83 | float ltime; 84 | float movetype; 85 | float solid; 86 | vec3_t origin; 87 | vec3_t oldorigin; 88 | vec3_t velocity; 89 | vec3_t angles; 90 | vec3_t avelocity; 91 | vec3_t punchangle; 92 | string_t classname; 93 | string_t model; 94 | float frame; 95 | float skin; 96 | float effects; 97 | float scale; 98 | float drawflags; 99 | float abslight; 100 | vec3_t mins; 101 | vec3_t maxs; 102 | vec3_t size; 103 | float hull; 104 | func_t touch; 105 | func_t use; 106 | func_t think; 107 | func_t blocked; 108 | float nextthink; 109 | int groundentity; 110 | float stats_restored; 111 | float frags; 112 | float weapon; 113 | string_t weaponmodel; 114 | float weaponframe; 115 | float health; 116 | float max_health; 117 | float playerclass; 118 | float bluemana; 119 | float greenmana; 120 | float max_mana; 121 | float armor_amulet; 122 | float armor_bracer; 123 | float armor_breastplate; 124 | float armor_helmet; 125 | float level; 126 | float intelligence; 127 | float wisdom; 128 | float dexterity; 129 | float strength; 130 | float experience; 131 | float ring_flight; 132 | float ring_water; 133 | float ring_turning; 134 | float ring_regeneration; 135 | float haste_time; 136 | float tome_time; 137 | string_t puzzle_inv1; 138 | string_t puzzle_inv2; 139 | string_t puzzle_inv3; 140 | string_t puzzle_inv4; 141 | string_t puzzle_inv5; 142 | string_t puzzle_inv6; 143 | string_t puzzle_inv7; 144 | string_t puzzle_inv8; 145 | float experience_value; 146 | float items; 147 | float takedamage; 148 | int chain; 149 | float deadflag; 150 | vec3_t view_ofs; 151 | float button0; 152 | float button1; 153 | float button2; 154 | float impulse; 155 | float fixangle; 156 | vec3_t v_angle; 157 | float idealpitch; 158 | float idealroll; 159 | float hoverz; 160 | string_t netname; 161 | int enemy; 162 | float flags; 163 | float flags2; 164 | float artifact_flags; 165 | float colormap; 166 | float team; 167 | float light_level; 168 | float teleport_time; 169 | float armortype; 170 | float armorvalue; 171 | float waterlevel; 172 | float watertype; 173 | float friction; 174 | float ideal_yaw; 175 | float yaw_speed; 176 | int goalentity; 177 | float spawnflags; 178 | string_t target; 179 | string_t targetname; 180 | float dmg_take; 181 | float dmg_save; 182 | int dmg_inflictor; 183 | int owner; 184 | vec3_t movedir; 185 | float message; 186 | float soundtype; 187 | string_t noise; 188 | string_t noise1; 189 | string_t noise2; 190 | string_t noise3; 191 | float rings; 192 | float rings_active; 193 | float rings_low; 194 | float artifacts; 195 | float artifact_active; 196 | float artifact_low; 197 | float hasted; 198 | float inventory; 199 | float cnt_torch; 200 | float cnt_h_boost; 201 | float cnt_sh_boost; 202 | float cnt_mana_boost; 203 | float cnt_teleport; 204 | float cnt_tome; 205 | float cnt_summon; 206 | float cnt_invisibility; 207 | float cnt_glyph; 208 | float cnt_haste; 209 | float cnt_blast; 210 | float cnt_polymorph; 211 | float cnt_flight; 212 | float cnt_cubeofforce; 213 | float cnt_invincibility; 214 | int cameramode; 215 | int movechain; 216 | func_t chainmoved; 217 | float string_index; 218 | } entvars_t; 219 | */ 220 | #define PROGHEADER_CRC_H2 26905 221 | 222 | #endif 223 | -------------------------------------------------------------------------------- /gl_refrag.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | // r_efrag.c 21 | 22 | #include "quakedef.h" 23 | 24 | #ifndef RQM_SV_ONLY 25 | 26 | extern qboolean scr_update_in_frame; 27 | 28 | mnode_t *r_pefragtopnode; 29 | 30 | 31 | /* 32 | =============================================================================== 33 | 34 | ENTITY FRAGMENT FUNCTIONS 35 | 36 | =============================================================================== 37 | */ 38 | 39 | efrag_t **lastlink; 40 | 41 | vec3_t r_emins, r_emaxs; 42 | 43 | entity_t *r_addent; 44 | 45 | 46 | /* 47 | ================ 48 | R_RemoveEfrags 49 | 50 | Call when removing an object from the world or moving it to another position 51 | ================ 52 | */ 53 | void R_RemoveEfrags (entity_t *ent) 54 | { 55 | efrag_t *ef, *old, *walk, **prev; 56 | 57 | ef = ent->efrag; 58 | 59 | while (ef) 60 | { 61 | prev = &ef->leaf->efrags; 62 | while (1) 63 | { 64 | walk = *prev; 65 | if (!walk) 66 | break; 67 | if (walk == ef) 68 | { // remove this fragment 69 | *prev = ef->leafnext; 70 | break; 71 | } 72 | else 73 | prev = &walk->leafnext; 74 | } 75 | 76 | old = ef; 77 | ef = ef->entnext; 78 | 79 | // put it on the free list 80 | old->entnext = cl.free_efrags; 81 | cl.free_efrags = old; 82 | } 83 | 84 | ent->efrag = NULL; 85 | } 86 | 87 | /* 88 | =================== 89 | R_SplitEntityOnNode 90 | =================== 91 | */ 92 | void R_SplitEntityOnNode (mnode_t *node) 93 | { 94 | efrag_t *ef; 95 | mplane_t *splitplane; 96 | mleaf_t *leaf; 97 | int sides; 98 | 99 | if (node->contents == CONTENTS_SOLID) 100 | return; 101 | 102 | // add an efrag if the node is a leaf 103 | 104 | if ( node->contents < 0) 105 | { 106 | if (!r_pefragtopnode) 107 | r_pefragtopnode = node; 108 | 109 | leaf = (mleaf_t *)node; 110 | 111 | // grab an efrag off the free list 112 | ef = cl.free_efrags; 113 | if (!ef) 114 | { 115 | Con_Print ("Too many efrags!\n"); 116 | return; // no free fragments... 117 | } 118 | cl.free_efrags = cl.free_efrags->entnext; 119 | 120 | ef->entity = r_addent; 121 | 122 | // add the entity link 123 | *lastlink = ef; 124 | lastlink = &ef->entnext; 125 | ef->entnext = NULL; 126 | 127 | // set the leaf links 128 | ef->leaf = leaf; 129 | ef->leafnext = leaf->efrags; 130 | leaf->efrags = ef; 131 | 132 | return; 133 | } 134 | 135 | // NODE_MIXED 136 | 137 | splitplane = node->plane; 138 | sides = BOX_ON_PLANE_SIDE(r_emins, r_emaxs, splitplane); 139 | 140 | if (sides == 3) 141 | { 142 | // split on this plane 143 | // if this is the first splitter of this bmodel, remember it 144 | if (!r_pefragtopnode) 145 | r_pefragtopnode = node; 146 | } 147 | 148 | // recurse down the contacted sides 149 | if (sides & 1) 150 | R_SplitEntityOnNode (node->children[0]); 151 | 152 | if (sides & 2) 153 | R_SplitEntityOnNode (node->children[1]); 154 | } 155 | 156 | /* 157 | =========== 158 | R_AddEfrags 159 | =========== 160 | */ 161 | void R_AddEfrags (entity_t *ent) 162 | { 163 | model_t *entmodel; 164 | int i; 165 | 166 | if (!ent->model) 167 | return; 168 | 169 | #ifdef HEXEN2_SUPPORT 170 | if (ent == cl_entities) 171 | return; // never add the world 172 | #endif 173 | 174 | r_addent = ent; 175 | 176 | lastlink = &ent->efrag; 177 | r_pefragtopnode = NULL; 178 | 179 | entmodel = ent->model; 180 | 181 | for (i=0 ; i<3 ; i++) 182 | { 183 | r_emins[i] = ent->origin[i] + entmodel->mins[i]; 184 | r_emaxs[i] = ent->origin[i] + entmodel->maxs[i]; 185 | } 186 | 187 | R_SplitEntityOnNode (cl.worldmodel->nodes); 188 | 189 | // ent->topnode = r_pefragtopnode; 190 | } 191 | 192 | /* 193 | ================ 194 | R_StoreEfrags 195 | 196 | // FIXME: a lot of this goes away with edge-based 197 | ================ 198 | */ 199 | void R_StoreEfrags (efrag_t **ppefrag) 200 | { 201 | entity_t *pent; 202 | model_t *model; 203 | efrag_t *pefrag; 204 | 205 | for (pefrag = *ppefrag ; pefrag ; pefrag = pefrag->leafnext) 206 | { 207 | pent = pefrag->entity; 208 | model = pent->model; 209 | 210 | switch (model->type) 211 | { 212 | case mod_alias: 213 | case mod_md3: 214 | case mod_brush: 215 | case mod_sprite: 216 | if (scr_update_in_frame && pent->visframe != r_framecount) 217 | { 218 | if (cl_numvisedicts < MAX_VISEDICTS) 219 | cl_visedicts[cl_numvisedicts++] = pent; 220 | 221 | // mark that we've recorded this entity for this frame 222 | pent->visframe = r_framecount; 223 | } 224 | break; 225 | 226 | default: 227 | Sys_Error ("R_StoreEfrags: Bad entity type %d\n", model->type); 228 | } 229 | } 230 | } 231 | 232 | #endif //#ifndef RQM_SV_ONLY 233 | -------------------------------------------------------------------------------- /cvar.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | // cvar.h 21 | 22 | /* 23 | 24 | cvar_t variables are used to hold scalar or string variables that can be changed 25 | or displayed at the console or prog code as well as accessed directly in C code. 26 | 27 | it is sufficient to initialize a cvar_t with just the first two fields, or 28 | you can add a ,true flag for variables that you want saved to the configuration 29 | file when the game is quit: 30 | 31 | cvar_t r_draworder = {"r_draworder","1"}; 32 | cvar_t scr_screensize = {"screensize","1",true}; 33 | 34 | Cvars must be registered before use, or they will have a 0 value instead of the 35 | float interpretation of the string. Generally, all cvar_t declarations should be 36 | registered in the apropriate init function before any console commands are executed: 37 | Cvar_RegisterVariable (&host_framerate); 38 | 39 | C code usually just references a cvar in place: 40 | if (r_draworder.value) 41 | 42 | It could optionally ask for the value to be looked up for a string name: 43 | if (Cvar_VariableValue ("r_draworder")) 44 | 45 | Interpreted prog code can access cvars with the cvar(name) or 46 | cvar_set (name, value) internal functions: 47 | teamplay = cvar("teamplay"); 48 | cvar_set ("registered", "1"); 49 | 50 | The user can access cvars from the console in two ways: 51 | r_draworder prints the current value 52 | r_draworder 0 sets the current value to 0 53 | Cvars are restricted from having the same names as commands to keep this 54 | interface from being ambiguous. 55 | */ 56 | 57 | typedef enum {CVAR_STRING, CVAR_INT, CVAR_FLOAT} cvartype_t; 58 | 59 | #define CVAR_FLAG_ARCHIVE 0x0001 /* if set, var is saved to reQuiem.cfg */ 60 | #define CVAR_FLAG_SERVER 0x0002 /* if set, notifies players when changed */ 61 | #define CVAR_FLAG_NOCASE 0x0004 /* if set, string value is not case-sensitive */ 62 | #define CVAR_FLAG_READONLY 0x0008 63 | 64 | typedef struct cvar_s 65 | { 66 | const char *name; 67 | char *string; 68 | // qboolean archive; 69 | // qboolean server; 70 | int flags; 71 | qboolean (*OnChange)(struct cvar_s *var, const char *value); 72 | float value; 73 | char *defaultvalue; 74 | cvartype_t type; // JDH 75 | float minvalue, maxvalue; // JDH 76 | char *savedvalue; // JDH 77 | struct cvar_s *next; 78 | } cvar_t; 79 | 80 | #define CVAR_UNKNOWN_MAX 0x7FFFFFFF 81 | 82 | /* 83 | registers a cvar that already has the name, string, and optionally the 84 | archive elements set. 85 | Adds a freestanding variable to the variable list. 86 | ============ 87 | */ 88 | void Cvar_RegisterTypeBounds (cvar_t *, cvartype_t, float min, float max); 89 | 90 | #define Cvar_RegisterString(var) Cvar_RegisterTypeBounds((var), CVAR_STRING, 0, 0) 91 | #define Cvar_RegisterBool(var) Cvar_RegisterTypeBounds((var), CVAR_INT, 0, 1) 92 | #define Cvar_RegisterFloat(var, min, max) Cvar_RegisterTypeBounds((var), CVAR_FLOAT, (min), (max)) 93 | #define Cvar_RegisterInt(var, min, max) Cvar_RegisterTypeBounds((var), CVAR_INT, (min), (max)) 94 | 95 | #define Cvar_Register(var) Cvar_RegisterString((var)) 96 | 97 | void Cvar_Unregister (cvar_t *var); 98 | 99 | void Cvar_ResetAll (void); 100 | 101 | // JDH: added SetDirect calls for better performance 102 | qboolean Cvar_SetDirect (cvar_t *cvar, const char *value); 103 | qboolean Cvar_SetValueDirect (cvar_t *cvar, float value); 104 | 105 | qboolean Cvar_Set (const char *var_name, const char *value); 106 | // equivelant to " " typed at the console 107 | 108 | //void Cvar_SetValue (char *var_name, float value); 109 | // expands value to a string and calls Cvar_Set 110 | 111 | qboolean Cvar_CycleValue (cvar_t *var, qboolean reverse, qboolean wrap); 112 | qboolean Cvar_ToggleValue (cvar_t *var); 113 | 114 | float Cvar_VariableValue (const char *var_name); 115 | // returns 0 if not defined or non numeric 116 | 117 | char *Cvar_VariableString (const char *var_name); 118 | // returns an empty string if not defined 119 | 120 | int Cvar_CompleteCountPossible (const char *partial); // by joe 121 | 122 | //char *Cvar_CompleteVariable (const char *partial); 123 | // attempts to match a partial variable name for command line completion 124 | // returns NULL if nothing fits 125 | 126 | qboolean Cvar_Command (void); 127 | // called by Cmd_ExecuteString when Cmd_Argv(0) doesn't match a known 128 | // command. Returns true if the command was a variable reference that 129 | // was handled. (print or change) 130 | 131 | int Cvar_WriteVariables (FILE *f); 132 | // Writes lines containing "set variable value" for all variables 133 | // with the archive flag set to true. 134 | 135 | qboolean Cvar_IsDefaultValue (const cvar_t *var); 136 | 137 | cvar_t *Cvar_FindVar (const char *var_name); 138 | void Cvar_Init (void); 139 | 140 | extern cvar_t *cvar_vars; 141 | -------------------------------------------------------------------------------- /dzlib.h: -------------------------------------------------------------------------------- 1 | 2 | /*********************************************************************************** 3 | dzlib (c) 2009 jdhack@hotmail.com 4 | based on dzip 2.9 5 | 6 | Notes: 7 | - this library is NOT thread-safe 8 | - big-endian support is present, but untested 9 | - zip support is very limited: 10 | - compression method must be either deflate or store 11 | - no passwords, encryption, or zip64 extensions 12 | - DZ_AddFile works only if the DZHANDLE was obtained via DZ_CreateZip 13 | (ie. only if the zip was created by dzlib, and the handle has not been closed) 14 | ***********************************************************************************/ 15 | 16 | 17 | #define DZLIB_VERSION 0x00000904 /* 0.94 */ 18 | 19 | #define DZ_ERR_NONE 0x00000000 20 | #define DZ_ERR_OUTOFMEM 0x00000001 21 | #define DZ_ERR_TOOMANYOPEN 0x00000002 22 | #define DZ_ERR_BADHANDLE 0x00000003 23 | #define DZ_ERR_BADPARAM 0x00000004 24 | #define DZ_ERR_BUFTOOSMALL 0x00000005 25 | #define DZ_ERR_UNSUPPORTED 0x00000006 26 | 27 | #define DZ_ERR_FILENOTFOUND 0x00000010 28 | #define DZ_ERR_FILEWRITE 0x00000011 29 | #define DZ_ERR_FILEREAD 0x00000012 30 | #define DZ_ERR_FILECREATE 0x00000013 31 | #define DZ_ERR_FILETOOBIG 0x00000014 32 | #define DZ_ERR_FILESEEK 0x00000015 33 | 34 | #define DZ_ERR_BADHEADER 0x00000020 35 | #define DZ_ERR_BADTABLE 0x00000021 36 | #define DZ_ERR_BADFILEENTRY 0x00000022 37 | 38 | typedef int DZBOOL; 39 | typedef unsigned int DZUINT; 40 | typedef unsigned int DZHANDLE; 41 | 42 | /* these must match the TYPE_xxxx enums in dzip.h: */ 43 | typedef enum 44 | { 45 | DZ_FTYPE_NORMAL, 46 | DZ_FTYPE_DEMV1, 47 | DZ_FTYPE_TXT, 48 | DZ_FTYPE_PAK, 49 | DZ_FTYPE_DZ, 50 | DZ_FTYPE_DEM, 51 | DZ_FTYPE_NEHAHRA, 52 | DZ_FTYPE_DIR, 53 | DZ_FTYPE_STORE 54 | } DZFTYPE; 55 | 56 | typedef struct 57 | { 58 | unsigned short year; /* full year */ 59 | unsigned short month; /* 1 to 12 */ 60 | unsigned short day; /* 1 to 31 */ 61 | unsigned short hour; /* 0 to 23 */ 62 | unsigned short minute; 63 | unsigned short second; 64 | } DZTIME; 65 | 66 | typedef struct 67 | { 68 | char name[260]; 69 | DZFTYPE type; 70 | DZUINT size; 71 | DZTIME time; 72 | } DZENTRY; 73 | 74 | typedef struct 75 | { 76 | int struct_size; 77 | char name[260]; 78 | DZFTYPE type; 79 | DZUINT size; 80 | DZTIME time; 81 | DZUINT crc; 82 | DZUINT size_compressed; 83 | } DZENTRYEX; 84 | 85 | 86 | #ifndef DZIP_DLL_API 87 | #ifdef _WIN32 88 | #define DZIP_DLL_API __declspec(dllimport) 89 | #else 90 | #define DZIP_DLL_API 91 | #endif 92 | #endif 93 | 94 | /***********************************************************************************/ 95 | /* DZ_GetVersion: the value returned is to be interpreted as follows: */ 96 | /* In hex: 0x00MMmmbb, where MM is the major version, mm is the minor version, */ 97 | /* and bb is the build number. So, for example, 0x00020104 would be v2.1.4 */ 98 | /* */ 99 | /* DZ_GetFileInfoEx: before calling, be sure to set struct_size field of DZENTRYEX */ 100 | /* to sizeof(DZENTRYEX) */ 101 | /***********************************************************************************/ 102 | 103 | 104 | // function prototypes for dynamic loading: 105 | typedef DZHANDLE (*DZ_OPEN_PROC)(const char *); 106 | typedef DZBOOL (*DZ_CLOSE_PROC)(DZHANDLE); 107 | typedef DZBOOL (*DZ_SETFILEPATH_PROC)(DZHANDLE, const char *path); 108 | typedef int (*DZ_GETNUMFILES_PROC)(DZHANDLE); 109 | typedef DZBOOL (*DZ_GETFILEINFO_PROC)(DZHANDLE, DZUINT index, DZENTRY *entry); 110 | typedef DZBOOL (*DZ_GETFILEINFOEX_PROC)(DZHANDLE, DZUINT index, DZENTRYEX *entry); 111 | typedef DZBOOL (*DZ_VERIFY_PROC)(DZHANDLE, DZUINT index); 112 | typedef DZBOOL (*DZ_VERIFYALL_PROC)(DZHANDLE); 113 | typedef DZBOOL (*DZ_EXTRACT_PROC)(DZHANDLE, DZUINT index); 114 | typedef int (*DZ_EXTRACTTEMP_PROC)(DZHANDLE, DZUINT index, char *pathbuf, int bufsize); 115 | typedef DZBOOL (*DZ_EXTRACTALL_PROC)(DZHANDLE); 116 | typedef int (*DZ_GETLASTERROR_PROC)(void); 117 | typedef DZUINT (*DZ_GETVERSION_PROC)(void); 118 | 119 | #ifndef UNDZIP_ONLY 120 | typedef DZHANDLE (*DZ_CREATE_PROC) (const char *filepath); 121 | typedef DZHANDLE (*DZ_CREATEZIP_PROC) (const char *filepath); 122 | typedef DZBOOL (*DZ_ADDFILE_PROC) (DZHANDLE, const char *filepath, DZFTYPE); 123 | #endif 124 | 125 | // function prototypes for static linking: 126 | DZIP_DLL_API DZHANDLE DZ_Open (const char *filepath); 127 | DZIP_DLL_API DZBOOL DZ_Close (DZHANDLE); 128 | DZIP_DLL_API DZBOOL DZ_SetFilePath (DZHANDLE, const char *path); 129 | DZIP_DLL_API int DZ_GetNumFiles (DZHANDLE); 130 | DZIP_DLL_API DZBOOL DZ_GetFileInfo (DZHANDLE, DZUINT index, DZENTRY *entry); 131 | DZIP_DLL_API DZBOOL DZ_GetFileInfoEx (DZHANDLE, DZUINT index, DZENTRYEX *entry); 132 | DZIP_DLL_API DZBOOL DZ_Verify (DZHANDLE, DZUINT index); 133 | DZIP_DLL_API DZBOOL DZ_VerifyAll (DZHANDLE); 134 | DZIP_DLL_API DZBOOL DZ_Extract (DZHANDLE, DZUINT index); 135 | DZIP_DLL_API int DZ_ExtractTemp (DZHANDLE, DZUINT index, char *pathbuf, int bufsize); 136 | DZIP_DLL_API DZBOOL DZ_ExtractAll (DZHANDLE); 137 | DZIP_DLL_API int DZ_GetLastError (void); 138 | DZIP_DLL_API DZUINT DZ_GetVersion (void); 139 | 140 | #ifndef UNDZIP_ONLY 141 | DZIP_DLL_API DZHANDLE DZ_Create (const char *filepath); 142 | DZIP_DLL_API DZHANDLE DZ_CreateZip (const char *filepath); 143 | DZIP_DLL_API DZBOOL DZ_AddFile (DZHANDLE, const char *filepath, DZFTYPE); 144 | #endif 145 | 146 | -------------------------------------------------------------------------------- /wad.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | // wad.c 21 | 22 | #include "quakedef.h" 23 | 24 | #ifndef RQM_SV_ONLY 25 | 26 | //=============== 27 | // TYPES 28 | //=============== 29 | 30 | #define CMP_NONE 0 31 | #define CMP_LZSS 1 32 | 33 | #define TYP_NONE 0 34 | #define TYP_LABEL 1 35 | 36 | #define TYP_LUMPY 64 // 64 + grab command number 37 | #define TYP_PALETTE 64 38 | #define TYP_QTEX 65 39 | #define TYP_QPIC 66 40 | #define TYP_SOUND 67 41 | #define TYP_MIPTEX 68 42 | 43 | 44 | typedef struct 45 | { 46 | char identification[4]; // should be WAD2 or 2DAW 47 | int numlumps; 48 | int infotableofs; 49 | } wadinfo_t; 50 | 51 | typedef struct 52 | { 53 | int filepos; 54 | int disksize; 55 | int size; // uncompressed 56 | char type; 57 | char compression; 58 | char pad1, pad2; 59 | char name[16]; // must be null terminated 60 | } lumpinfo_t; 61 | 62 | 63 | int wad_numlumps; 64 | lumpinfo_t *wad_lumps; 65 | byte *wad_base = NULL; 66 | 67 | void SwapPic (qpic_t *pic); 68 | 69 | /* 70 | ================== 71 | W_CleanupName 72 | 73 | Lowercases name and pads with spaces and a terminating 0 to the length of 74 | lumpinfo_t->name. 75 | Used so lumpname lookups can proceed rapidly by comparing 4 chars at a time 76 | Space padding is so names can be printed nicely in tables. 77 | Can safely be performed in place. 78 | ================== 79 | */ 80 | void W_CleanupName (const char *in, char *out) 81 | { 82 | int i, c; 83 | 84 | for (i=0 ; i<16 ; i++) 85 | { 86 | c = in[i]; 87 | if (!c) 88 | break; 89 | 90 | if (c >= 'A' && c <= 'Z') 91 | c += ('a' - 'A'); 92 | out[i] = c; 93 | } 94 | 95 | for ( ; i< 16 ; i++) 96 | out[i] = 0; 97 | } 98 | 99 | /* 100 | ==================== 101 | W_LoadWadFile 102 | ==================== 103 | */ 104 | qboolean W_LoadWadFile (const char *filename) 105 | { 106 | byte *old_wad; 107 | lumpinfo_t *lump_p; 108 | wadinfo_t *header; 109 | unsigned i; 110 | int infotableofs; 111 | 112 | old_wad = wad_base; // JDH: for gamedir change 113 | 114 | if (!(wad_base = COM_LoadMallocFile(filename, 0))) // JDH: originally loaded to hunk 115 | { 116 | if (old_wad) 117 | { 118 | wad_base = old_wad; 119 | return false; 120 | } 121 | Sys_Error ("W_LoadWadFile: couldn't load %s", filename); 122 | } 123 | 124 | header = (wadinfo_t *)wad_base; 125 | 126 | if (memcmp(header->identification, "WAD2", 4)) 127 | { 128 | if (old_wad) 129 | { 130 | wad_base = old_wad; 131 | return false; 132 | } 133 | Sys_Error ("Wad file %s doesn't have WAD2 id\n", filename); 134 | } 135 | 136 | if (old_wad) 137 | free (old_wad); 138 | 139 | wad_numlumps = LittleLong (header->numlumps); 140 | infotableofs = LittleLong (header->infotableofs); 141 | wad_lumps = (lumpinfo_t *)(wad_base + infotableofs); 142 | 143 | for (i=0, lump_p = wad_lumps ; i < wad_numlumps ; i++, lump_p++) 144 | { 145 | lump_p->filepos = LittleLong (lump_p->filepos); 146 | lump_p->size = LittleLong (lump_p->size); 147 | W_CleanupName (lump_p->name, lump_p->name); 148 | if (lump_p->type == TYP_QPIC) 149 | SwapPic ((qpic_t *)(wad_base + lump_p->filepos)); 150 | } 151 | 152 | return true; 153 | } 154 | 155 | /* 156 | ============= 157 | W_GetLumpinfo 158 | ============= 159 | */ 160 | lumpinfo_t *W_GetLumpinfo (const char *name) 161 | { 162 | int i; 163 | lumpinfo_t *lump_p; 164 | char clean[16]; 165 | 166 | W_CleanupName (name, clean); 167 | 168 | for (lump_p = wad_lumps, i=0 ; iname)) 171 | return lump_p; 172 | } 173 | 174 | Con_Printf ("\x02""WARNING: lump %s not found!\n", name); // JDH: was Sys_Error 175 | return NULL; 176 | } 177 | 178 | void *W_GetLumpByName (const char *name, int *size_out) 179 | { 180 | lumpinfo_t *lump; 181 | 182 | lump = W_GetLumpinfo (name); 183 | if (!lump) 184 | return NULL; 185 | 186 | if (size_out) 187 | *size_out = lump->disksize; 188 | 189 | return (void *)(wad_base + lump->filepos); 190 | } 191 | 192 | /*void *W_GetLumpByNum (int num) 193 | { 194 | lumpinfo_t *lump; 195 | 196 | if (num < 0 || num > wad_numlumps) 197 | Sys_Error ("W_GetLumpByNum: bad number: %i", num); 198 | 199 | lump = wad_lumps + num; 200 | 201 | return (void *)(wad_base + lump->filepos); 202 | } 203 | */ 204 | 205 | byte * Wad_LoadPalette (void) 206 | { 207 | lumpinfo_t *lump; 208 | 209 | lump = W_GetLumpinfo ("palette"); 210 | if (lump && (lump->type == TYP_PALETTE) && (lump->disksize == 768)) 211 | return wad_base + lump->filepos; 212 | 213 | return NULL; 214 | } 215 | 216 | byte * Wad_LoadColormap (void) 217 | { 218 | lumpinfo_t *lump; 219 | 220 | lump = W_GetLumpinfo ("colormap"); 221 | if (lump && (lump->type == TYP_QTEX) && (lump->disksize == 8196)) 222 | return wad_base + lump->filepos; 223 | 224 | return NULL; 225 | } 226 | 227 | /* 228 | ============================================================================= 229 | 230 | automatic byte swapping 231 | 232 | ============================================================================= 233 | */ 234 | 235 | void SwapPic (qpic_t *pic) 236 | { 237 | pic->width = LittleLong (pic->width); 238 | pic->height = LittleLong (pic->height); 239 | } 240 | 241 | #endif //#ifndef RQM_SV_ONLY 242 | -------------------------------------------------------------------------------- /sound.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | // sound.h -- client sound i/o functions 21 | 22 | #ifndef __SOUND__ 23 | #define __SOUND__ 24 | 25 | // !!! if this is changed, it much be changed in asm_i386.h too !!! 26 | typedef struct 27 | { 28 | int left; 29 | int right; 30 | } portable_samplepair_t; 31 | 32 | typedef struct sfx_s 33 | { 34 | char name[MAX_QPATH]; 35 | cache_user_t cache; 36 | } sfx_t; 37 | 38 | // !!! if this is changed, it much be changed in asm_i386.h too !!! 39 | typedef struct 40 | { 41 | int length; 42 | int loopstart; 43 | int speed; 44 | int width; 45 | int stereo; 46 | byte data[1]; // variable sized 47 | } sfxcache_t; 48 | 49 | typedef struct 50 | { 51 | qboolean gamealive; 52 | qboolean soundalive; 53 | qboolean splitbuffer; 54 | int channels; 55 | int samples; // mono samples in buffer 56 | int submission_chunk; // don't mix less than this # 57 | int samplepos; // in mono samples 58 | int samplebits; 59 | int speed; 60 | unsigned char *buffer; 61 | } dma_t; 62 | 63 | // !!! if this is changed, it much be changed in asm_i386.h too !!! 64 | typedef struct 65 | { 66 | sfx_t *sfx; // sfx number 67 | int leftvol; // 0-255 volume 68 | int rightvol; // 0-255 volume 69 | int end; // end time in global paintsamples 70 | int pos; // sample position in sfx 71 | int looping; // where to loop, -1 = no looping 72 | int entnum; // to allow overriding a specific sound 73 | int entchannel; // 74 | vec3_t origin; // origin of sound effect 75 | vec_t dist_mult; // distance multiplier (attenuation/clipK) 76 | int master_vol; // 0-255 master volume 77 | } channel_t; 78 | 79 | typedef struct 80 | { 81 | int rate; 82 | int width; 83 | int channels; 84 | int loopstart; 85 | int samples; 86 | int dataofs; // chunk starts this many bytes from file start 87 | } wavinfo_t; 88 | 89 | void S_Init (void); 90 | void S_Startup (void); 91 | void S_Shutdown (void); 92 | void S_StartSound (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation); 93 | void S_StaticSound (sfx_t *sfx, vec3_t origin, float vol, float attenuation); 94 | void S_StopSound (int entnum, int entchannel); 95 | void S_StopAllSounds(qboolean clear); 96 | void S_ClearBuffer (void); 97 | void S_Update (vec3_t origin, vec3_t v_forward, vec3_t v_right, vec3_t v_up); 98 | void S_ExtraUpdate (void); 99 | int S_GetSoundRate (void); 100 | 101 | /*******JDH-from nehBJP*******/ 102 | void S_ExtraUpdateTime (void); 103 | /*******JDH-from nehBJP*******/ 104 | 105 | sfx_t *S_PrecacheSound (const char *sample); 106 | void S_TouchSound (const char *sample); 107 | void S_ClearPrecache (void); 108 | void S_BeginPrecaching (void); 109 | void S_EndPrecaching (void); 110 | void S_PaintChannels(int endtime); 111 | void S_InitPaintChannels (void); 112 | 113 | // picks a channel based on priorities, empty slots, number of channels 114 | channel_t *SND_PickChannel(int entnum, int entchannel); 115 | 116 | // spatializes a channel 117 | void SND_Spatialize(channel_t *ch); 118 | 119 | // initializes cycling through a DMA buffer and returns information on it 120 | qboolean SNDDMA_Init(void); 121 | 122 | // gets the current DMA position 123 | int SNDDMA_GetDMAPos(void); 124 | 125 | // shutdown the DMA xfer. 126 | void SNDDMA_Shutdown(void); 127 | 128 | // ==================================================================== 129 | // User-setable variables 130 | // ==================================================================== 131 | 132 | #define MAX_DYNAMIC_CHANNELS 64 133 | #define MAX_CHANNELS (MAX_DYNAMIC_CHANNELS+NUM_AMBIENTS+128) 134 | 135 | #define MAX_SFX 1024 136 | 137 | extern channel_t channels[MAX_CHANNELS]; 138 | // 0 to MAX_DYNAMIC_CHANNELS-1 = normal entity sounds 139 | // MAX_DYNAMIC_CHANNELS to MAX_DYNAMIC_CHANNELS + NUM_AMBIENTS -1 = water, etc 140 | // MAX_DYNAMIC_CHANNELS + NUM_AMBIENTS to total_channels = static sounds 141 | 142 | extern int total_channels; 143 | 144 | // 145 | // Fake dma is a synchronous faking of the DMA progress used for 146 | // isolating performance in the renderer. The fakedma_updates is 147 | // number of times S_Update() is called per second. 148 | // 149 | 150 | extern qboolean fakedma; 151 | extern int fakedma_updates; 152 | extern int paintedtime; 153 | extern vec3_t listener_origin; 154 | extern vec3_t listener_forward; 155 | extern vec3_t listener_right; 156 | extern vec3_t listener_up; 157 | extern volatile dma_t *shm; 158 | extern volatile dma_t sn; 159 | extern vec_t sound_nominal_clip_dist; 160 | 161 | extern cvar_t loadas8bit; 162 | extern cvar_t bgmvolume; 163 | extern cvar_t volume; 164 | 165 | extern qboolean snd_initialized; 166 | 167 | extern int snd_blocked; 168 | 169 | void S_LocalSound (const char *s); 170 | sfxcache_t *S_LoadSound (sfx_t *s); 171 | 172 | wavinfo_t GetWavinfo (const char *name, const byte *wav, int wavlength); 173 | 174 | void SND_InitScaletable (void); 175 | byte * SNDDMA_LockBuffer (unsigned *size_out); 176 | void SNDDMA_UnlockBuffer (byte *pbuf, unsigned size); 177 | void SNDDMA_Submit(void); 178 | 179 | void S_AmbientOff (void); 180 | void S_AmbientOn (void); 181 | 182 | #ifdef HEXEN2_SUPPORT 183 | void S_UpdateSoundPos (int entnum, int entchannel, vec3_t origin); 184 | #endif 185 | 186 | #endif 187 | -------------------------------------------------------------------------------- /snd_mixa.s: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | // snd_mixa.s 21 | // x86 assembly-language sound code 22 | 23 | #include "asm_i386.h" 24 | #include "quakeasm.h" 25 | 26 | #ifdef id386 27 | 28 | .text 29 | 30 | .extern C(snd_scaletable) 31 | .extern C(paintbuffer) 32 | .extern C(snd_linear_count) 33 | .extern C(snd_p) 34 | .extern C(snd_vol) 35 | .extern C(snd_out) 36 | 37 | //---------------------------------------------------------------------- 38 | // 8-bit sound-mixing code 39 | //---------------------------------------------------------------------- 40 | 41 | #define ch 4+16 42 | #define sc 8+16 43 | #define count 12+16 44 | 45 | .globl C(SND_PaintChannelFrom8) 46 | C(SND_PaintChannelFrom8): 47 | pushl %esi // preserve register variables 48 | pushl %edi 49 | pushl %ebx 50 | pushl %ebp 51 | 52 | // int data; 53 | // short *lscale, *rscale; 54 | // unsigned char *sfx; 55 | // int i; 56 | 57 | movl ch(%esp),%ebx 58 | movl sc(%esp),%esi 59 | 60 | // if (ch->leftvol > 255) 61 | // ch->leftvol = 255; 62 | // if (ch->rightvol > 255) 63 | // ch->rightvol = 255; 64 | movl ch_leftvol(%ebx),%eax 65 | movl ch_rightvol(%ebx),%edx 66 | cmpl $255,%eax 67 | jna LLeftSet 68 | movl $255,%eax 69 | LLeftSet: 70 | cmpl $255,%edx 71 | jna LRightSet 72 | movl $255,%edx 73 | LRightSet: 74 | 75 | // lscale = snd_scaletable[ch->leftvol >> 3]; 76 | // rscale = snd_scaletable[ch->rightvol >> 3]; 77 | // sfx = (signed char *)sc->data + ch->pos; 78 | // ch->pos += count; 79 | andl $0xF8,%eax 80 | addl $(sfxc_data),%esi 81 | andl $0xF8,%edx 82 | movl ch_pos(%ebx),%edi 83 | movl count(%esp),%ecx 84 | addl %edi,%esi 85 | shll $7,%eax 86 | addl %ecx,%edi 87 | shll $7,%edx 88 | movl %edi,ch_pos(%ebx) 89 | addl $(C(snd_scaletable)),%eax 90 | addl $(C(snd_scaletable)),%edx 91 | subl %ebx,%ebx 92 | movb -1(%esi,%ecx,1),%bl 93 | 94 | testl $1,%ecx 95 | jz LMix8Loop 96 | 97 | movl (%eax,%ebx,4),%edi 98 | movl (%edx,%ebx,4),%ebp 99 | addl C(paintbuffer)+psp_left-psp_size(,%ecx,psp_size),%edi 100 | addl C(paintbuffer)+psp_right-psp_size(,%ecx,psp_size),%ebp 101 | movl %edi,C(paintbuffer)+psp_left-psp_size(,%ecx,psp_size) 102 | movl %ebp,C(paintbuffer)+psp_right-psp_size(,%ecx,psp_size) 103 | movb -2(%esi,%ecx,1),%bl 104 | 105 | decl %ecx 106 | jz LDone 107 | 108 | // for (i=0 ; i>8; 166 | // if (val > 0x7fff) 167 | // snd_out[i] = 0x7fff; 168 | // else if (val < (short)0x8000) 169 | // snd_out[i] = (short)0x8000; 170 | // else 171 | // snd_out[i] = val; 172 | movl -8(%ebx,%ecx,4),%eax 173 | imull %esi,%eax 174 | sarl $8,%eax 175 | cmpl $0x7FFF,%eax 176 | jg LClampHigh 177 | cmpl $0xFFFF8000,%eax 178 | jnl LClampDone 179 | movl $0xFFFF8000,%eax 180 | jmp LClampDone 181 | LClampHigh: 182 | movl $0x7FFF,%eax 183 | LClampDone: 184 | 185 | // val = (snd_p[i+1]*snd_vol)>>8; 186 | // if (val > 0x7fff) 187 | // snd_out[i+1] = 0x7fff; 188 | // else if (val < (short)0x8000) 189 | // snd_out[i+1] = (short)0x8000; 190 | // else 191 | // snd_out[i+1] = val; 192 | movl -4(%ebx,%ecx,4),%edx 193 | imull %esi,%edx 194 | sarl $8,%edx 195 | cmpl $0x7FFF,%edx 196 | jg LClampHigh2 197 | cmpl $0xFFFF8000,%edx 198 | jnl LClampDone2 199 | movl $0xFFFF8000,%edx 200 | jmp LClampDone2 201 | LClampHigh2: 202 | movl $0x7FFF,%edx 203 | LClampDone2: 204 | shll $16,%edx 205 | andl $0xFFFF,%eax 206 | orl %eax,%edx 207 | movl %edx,-4(%edi,%ecx,2) 208 | 209 | // } 210 | subl $2,%ecx 211 | jnz LWLBLoopTop 212 | 213 | // snd_p += snd_linear_count; 214 | 215 | popl %ebx 216 | popl %edi 217 | popl %esi 218 | 219 | ret 220 | 221 | 222 | #endif // id386 223 | 224 | -------------------------------------------------------------------------------- /mathlib.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | // mathlib.h 21 | 22 | typedef float vec_t; 23 | typedef vec_t vec3_t[3]; 24 | typedef vec_t vec5_t[5]; 25 | 26 | typedef int fixed4_t; 27 | typedef int fixed8_t; 28 | typedef int fixed16_t; 29 | 30 | #ifndef M_PI 31 | #define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h 32 | #endif 33 | 34 | struct mplane_s; 35 | 36 | #define DEG2RAD(a) (((a) * M_PI) / 180.0F) 37 | 38 | #define NANMASK (255 << 23) 39 | #define IS_NAN(x) (((*(int *) & x) & NANMASK) == NANMASK) 40 | 41 | #define Q_rint(x) ((x) > 0 ? (int)((x) + 0.5) : (int)((x) - 0.5)) 42 | 43 | #define DotProduct(x, y) ((x)[0] * (y)[0] + (x)[1] * (y)[1] + (x)[2] * (y)[2]) 44 | #define VectorSubtract(a, b, c) ((c)[0] = (a)[0] - (b)[0], (c)[1] = (a)[1] - (b)[1], (c)[2] = (a)[2] - (b)[2]) 45 | #define VectorAdd(a, b, c) ((c)[0] = (a)[0] + (b)[0], (c)[1] = (a)[1] + (b)[1], (c)[2] = (a)[2] + (b)[2]) 46 | #define VectorCopy(a, b) ((b)[0] = (a)[0], (b)[1] = (a)[1], (b)[2] = (a)[2]) 47 | #define VectorClear(a) ((a)[0] = (a)[1] = (a)[2] = 0) 48 | #define VectorNegate(a, b) ((b)[0] = -(a)[0], (b)[1] = -(a)[1], (b)[2] = -(a)[2]) 49 | #define VectorSet(v, x, y, z) ((v)[0] = (x), (v)[1] = (y), (v)[2] = (z)) 50 | #define VectorOffset(v, n) ((v)[0] += (n), (v)[1] += (n), (v)[2] += (n)) 51 | 52 | #define CrossProduct(v1, v2, x) \ 53 | ((x)[0] = (v1)[1] * (v2)[2] - (v1)[2] * (v2)[1], \ 54 | (x)[1] = (v1)[2] * (v2)[0] - (v1)[0] * (v2)[2], \ 55 | (x)[2] = (v1)[0] * (v2)[1] - (v1)[1] * (v2)[0]) 56 | 57 | #define VectorSupCompare(v, w, m) \ 58 | (_mathlib_temp_float1 = m, \ 59 | (v)[0] - (w)[0] > -_mathlib_temp_float1 && (v)[0] - (w)[0] < _mathlib_temp_float1 && \ 60 | (v)[1] - (w)[1] > -_mathlib_temp_float1 && (v)[1] - (w)[1] < _mathlib_temp_float1 && \ 61 | (v)[2] - (w)[2] > -_mathlib_temp_float1 && (v)[2] - (w)[2] < _mathlib_temp_float1) 62 | 63 | #define VectorL2Compare(v, w, m) \ 64 | (_mathlib_temp_float1 = (m) * (m), \ 65 | _mathlib_temp_vec1[0] = (v)[0] - (w)[0], _mathlib_temp_vec1[1] = (v)[1] - (w)[1], _mathlib_temp_vec1[2] = (v)[2] - (w)[2],\ 66 | _mathlib_temp_vec1[0] * _mathlib_temp_vec1[0] + \ 67 | _mathlib_temp_vec1[1] * _mathlib_temp_vec1[1] + \ 68 | _mathlib_temp_vec1[2] * _mathlib_temp_vec1[2] < _mathlib_temp_float1) 69 | 70 | #define VectorCompare(v, w) ((v)[0] == (w)[0] && (v)[1] == (w)[1] && (v)[2] == (w)[2]) 71 | 72 | #define VectorMA(a, _f, b, c) \ 73 | do { \ 74 | _mathlib_temp_float1 = (_f); \ 75 | (c)[0] = (a)[0] + _mathlib_temp_float1 * (b)[0]; \ 76 | (c)[1] = (a)[1] + _mathlib_temp_float1 * (b)[1]; \ 77 | (c)[2] = (a)[2] + _mathlib_temp_float1 * (b)[2]; \ 78 | } while(0) 79 | 80 | #define VectorScale(in, _scale, out) \ 81 | do { \ 82 | float scale = (_scale); \ 83 | (out)[0] = (in)[0] * (scale); (out)[1] = (in)[1] * (scale); (out)[2] = (in)[2] * (scale);\ 84 | } while(0) 85 | 86 | #define anglemod(a) ((360.0 / 65536) * ((int)((a) * (65536 / 360.0)) & 65535)) 87 | 88 | #ifdef _WIN32 89 | #define VectorNormalizeFast(_v) \ 90 | do { \ 91 | _mathlib_temp_float1 = DotProduct((_v), (_v)); \ 92 | if (_mathlib_temp_float1) { \ 93 | _mathlib_temp_float2 = 0.5f * _mathlib_temp_float1; \ 94 | _mathlib_temp_int1 = *((int *)&_mathlib_temp_float1); \ 95 | _mathlib_temp_int1 = 0x5f375a86 - (_mathlib_temp_int1 >> 1); \ 96 | _mathlib_temp_float1 = *((float *)&_mathlib_temp_int1); \ 97 | _mathlib_temp_float1 = _mathlib_temp_float1 * (1.5f - _mathlib_temp_float2 * _mathlib_temp_float1 * _mathlib_temp_float1);\ 98 | VectorScale((_v), _mathlib_temp_float1, (_v)); \ 99 | } \ 100 | } while(0) 101 | #else 102 | #define VectorNormalizeFast VectorNormalize 103 | #endif 104 | 105 | #define BOX_ON_PLANE_SIDE(emins, emaxs, p) \ 106 | (((p)->type < 3)? \ 107 | ( \ 108 | ((p)->dist <= (emins)[(p)->type])? \ 109 | 1 \ 110 | : \ 111 | ( \ 112 | ((p)->dist >= (emaxs)[(p)->type])? \ 113 | 2 \ 114 | : \ 115 | 3 \ 116 | ) \ 117 | ) \ 118 | : \ 119 | BoxOnPlaneSide ((emins), (emaxs), (p))) 120 | 121 | #define PlaneDist(point, plane) ((plane)->type < 3 ? (point)[(plane)->type] : DotProduct((point), (plane)->normal)) 122 | #define PlaneDiff(point, plane) (((plane)->type < 3 ? (point)[(plane)->type] : DotProduct((point), (plane)->normal)) - (plane)->dist) 123 | 124 | void PerpendicularVector (vec3_t dst, const vec3_t src); 125 | void VectorVectors (const vec3_t forward, vec3_t right, vec3_t up); 126 | vec_t VectorLength (const vec3_t v); 127 | float VectorNormalize (vec3_t v); // returns vector length 128 | 129 | void R_ConcatRotations (const float in1[3][3], const float in2[3][3], float out[3][3]); 130 | void R_ConcatTransforms (const float in1[3][4], const float in2[3][4], float out[3][4]); 131 | 132 | void FloorDivMod (double numer, double denom, int *quotient, int *rem); 133 | fixed16_t Invert24To16 (fixed16_t val); 134 | int GreatestCommonDivisor (int i1, int i2); 135 | 136 | void vectoangles (const vec3_t vec, vec3_t ang); 137 | void AngleVectors (const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up); 138 | int BoxOnPlaneSide (const vec3_t emins, const vec3_t emaxs, const struct mplane_s *plane); 139 | 140 | void RotatePointAroundVector (vec3_t dst, const vec3_t dir, const vec3_t point, float degrees); 141 | 142 | extern vec3_t vec3_origin; 143 | extern int _mathlib_temp_int1, _mathlib_temp_int2; 144 | extern float _mathlib_temp_float1, _mathlib_temp_float2; 145 | extern vec3_t _mathlib_temp_vec1; 146 | 147 | #ifdef HEXEN2_SUPPORT 148 | 149 | #if defined(_WIN32) && defined(_MSC_VER) 150 | _inline float fastfabs(float _X) 151 | { 152 | *((long*)&_X) &= 0x7fffffff; 153 | return (_X); 154 | } 155 | #else 156 | // get multiple definitions and warning for above code on gcc 157 | extern float fastfabs(float); 158 | #endif 159 | 160 | 161 | #endif // #ifdef HEXEN2_SUPPORT 162 | -------------------------------------------------------------------------------- /net_loop.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | // net_loop.c 21 | 22 | #include "quakedef.h" 23 | #include "net_loop.h" 24 | 25 | qboolean localconnectpending = false; 26 | qsocket_t *loop_client = NULL; 27 | qsocket_t *loop_server = NULL; 28 | 29 | int Loop_Init (void) 30 | { 31 | #ifndef RQM_SV_ONLY 32 | if (cls.state == ca_dedicated) 33 | return -1; 34 | return 0; 35 | #else 36 | return -1; 37 | #endif 38 | } 39 | 40 | 41 | void Loop_Shutdown (void) 42 | { 43 | } 44 | 45 | 46 | void Loop_Listen (qboolean state) 47 | { 48 | } 49 | 50 | 51 | void Loop_SearchForHosts (qboolean xmit) 52 | { 53 | if (!sv.active) 54 | return; 55 | 56 | hostCacheCount = 1; 57 | if (!strcmp(hostname.string, "UNNAMED")) 58 | Q_strcpy (hostcache[0].name, "local", sizeof(hostcache[0].name)); 59 | else 60 | Q_strcpy (hostcache[0].name, hostname.string, sizeof(hostcache[0].name)); 61 | Q_strcpy (hostcache[0].map, sv.name, sizeof(hostcache[0].map)); 62 | hostcache[0].users = net_activeconnections; 63 | hostcache[0].maxusers = svs.maxclients; 64 | hostcache[0].driver = net_driverlevel; 65 | Q_strcpy (hostcache[0].cname, "local", sizeof(hostcache[0].cname)); 66 | } 67 | 68 | 69 | qsocket_t *Loop_Connect (const char *host) 70 | { 71 | if (Q_strcasecmp (host, "local")) 72 | return NULL; 73 | 74 | localconnectpending = true; 75 | 76 | if (!loop_client) 77 | { 78 | if (!(loop_client = NET_NewQSocket ())) 79 | { 80 | Con_Print("Loop_Connect: no qsocket available\n"); 81 | return NULL; 82 | } 83 | Q_strcpy (loop_client->address, "localhost", sizeof(loop_client->address)); 84 | } 85 | loop_client->receiveMessageLength = 0; 86 | loop_client->sendMessageLength = 0; 87 | loop_client->canSend = true; 88 | loop_client->mod = MOD_JOEQUAKE; 89 | loop_client->client_port = 0; 90 | 91 | if (!loop_server) 92 | { 93 | if (!(loop_server = NET_NewQSocket())) 94 | { 95 | Con_Print("Loop_Connect: no qsocket available\n"); 96 | return NULL; 97 | } 98 | Q_strcpy (loop_server->address, "LOCAL", sizeof(loop_server->address)); 99 | } 100 | loop_server->receiveMessageLength = 0; 101 | loop_server->sendMessageLength = 0; 102 | loop_server->canSend = true; 103 | loop_server->mod = MOD_JOEQUAKE; 104 | loop_server->client_port = 0; 105 | 106 | loop_client->driverdata = (void *)loop_server; 107 | loop_server->driverdata = (void *)loop_client; 108 | 109 | return loop_client; 110 | } 111 | 112 | 113 | qsocket_t *Loop_CheckNewConnections (void) 114 | { 115 | if (!localconnectpending) 116 | return NULL; 117 | 118 | localconnectpending = false; 119 | loop_server->sendMessageLength = 0; 120 | loop_server->receiveMessageLength = 0; 121 | loop_server->canSend = true; 122 | loop_client->sendMessageLength = 0; 123 | loop_client->receiveMessageLength = 0; 124 | loop_client->canSend = true; 125 | 126 | return loop_server; 127 | } 128 | 129 | 130 | static int IntAlign (int value) 131 | { 132 | return (value + (sizeof(int) - 1)) & (~(sizeof(int) - 1)); 133 | } 134 | 135 | 136 | int Loop_GetMessage (qsocket_t *sock) 137 | { 138 | int ret; 139 | int length; 140 | 141 | if (sock->receiveMessageLength == 0) 142 | return 0; 143 | 144 | ret = sock->receiveMessage[0]; 145 | length = sock->receiveMessage[1] + (sock->receiveMessage[2] << 8); 146 | // alignment byte skipped here 147 | SZ_Clear (&net_message); 148 | SZ_Write (&net_message, &sock->receiveMessage[4], length); 149 | 150 | length = IntAlign(length + 4); 151 | sock->receiveMessageLength -= length; 152 | 153 | if (sock->receiveMessageLength) 154 | memcpy (sock->receiveMessage, &sock->receiveMessage[length], sock->receiveMessageLength); 155 | 156 | if (sock->driverdata && ret == 1) 157 | ((qsocket_t *)sock->driverdata)->canSend = true; 158 | 159 | return ret; 160 | } 161 | 162 | 163 | int Loop_SendMessage (qsocket_t *sock, sizebuf_t *data) 164 | { 165 | byte *buffer; 166 | int *bufferLength; 167 | 168 | if (!sock->driverdata) 169 | return -1; 170 | 171 | bufferLength = &((qsocket_t *)sock->driverdata)->receiveMessageLength; 172 | 173 | if ((*bufferLength + data->cursize + 4) > NET_MAXMESSAGE) 174 | Sys_Error("Loop_SendMessage: overflow\n"); 175 | 176 | buffer = ((qsocket_t *)sock->driverdata)->receiveMessage + *bufferLength; 177 | 178 | // message type 179 | *buffer++ = 1; 180 | 181 | // length 182 | *buffer++ = data->cursize & 0xff; 183 | *buffer++ = data->cursize >> 8; 184 | 185 | // align 186 | buffer++; 187 | 188 | // message 189 | memcpy (buffer, data->data, data->cursize); 190 | *bufferLength = IntAlign(*bufferLength + data->cursize + 4); 191 | 192 | sock->canSend = false; 193 | return 1; 194 | } 195 | 196 | 197 | int Loop_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data) 198 | { 199 | byte *buffer; 200 | int *bufferLength; 201 | 202 | if (!sock->driverdata) 203 | return -1; 204 | 205 | bufferLength = &((qsocket_t *)sock->driverdata)->receiveMessageLength; 206 | 207 | if ((*bufferLength + data->cursize + sizeof(byte) + sizeof(short)) > NET_MAXMESSAGE) 208 | return 0; 209 | 210 | buffer = ((qsocket_t *)sock->driverdata)->receiveMessage + *bufferLength; 211 | 212 | // message type 213 | *buffer++ = 2; 214 | 215 | // length 216 | *buffer++ = data->cursize & 0xff; 217 | *buffer++ = data->cursize >> 8; 218 | 219 | // align 220 | buffer++; 221 | 222 | // message 223 | memcpy (buffer, data->data, data->cursize); 224 | *bufferLength = IntAlign (*bufferLength + data->cursize + 4); 225 | return 1; 226 | } 227 | 228 | 229 | qboolean Loop_CanSendMessage (qsocket_t *sock) 230 | { 231 | if (!sock->driverdata) 232 | return false; 233 | return sock->canSend; 234 | } 235 | 236 | 237 | qboolean Loop_CanSendUnreliableMessage (qsocket_t *sock) 238 | { 239 | return true; 240 | } 241 | 242 | 243 | void Loop_Close (qsocket_t *sock) 244 | { 245 | if (sock->driverdata) 246 | ((qsocket_t *)sock->driverdata)->driverdata = NULL; 247 | sock->receiveMessageLength = 0; 248 | sock->sendMessageLength = 0; 249 | sock->canSend = true; 250 | if (sock == loop_client) 251 | loop_client = NULL; 252 | else 253 | loop_server = NULL; 254 | } 255 | -------------------------------------------------------------------------------- /cd_linux.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | // Quake is a trademark of Id Software, Inc., (c) 1996 Id Software, Inc. All 21 | // rights reserved. 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | #include 35 | 36 | #include "quakedef.h" 37 | 38 | extern qboolean playing; 39 | extern qboolean enabled; 40 | extern qboolean playLooping; 41 | extern byte playTrack; 42 | 43 | static int cdfile = -1; 44 | static char cd_dev[64] = "/dev/cdrom"; 45 | static struct cdrom_volctrl cd_initialvol; 46 | 47 | /* 48 | ============ 49 | CDAudio_Eject 50 | ============ 51 | */ 52 | void CDAudio_Eject (void) 53 | { 54 | if (cdfile == -1 || !enabled) 55 | return; // no cd init'd 56 | 57 | if (ioctl(cdfile, CDROMEJECT) == -1) 58 | Con_DPrintf ("ioctl cdromeject failed\n"); 59 | } 60 | 61 | /* 62 | ============ 63 | CDAudio_CloseDoor 64 | ============ 65 | */ 66 | void CDAudio_CloseDoor (void) 67 | { 68 | if (cdfile == -1 || !enabled) 69 | return; // no cd init'd 70 | 71 | if (ioctl(cdfile, CDROMCLOSETRAY) == -1) 72 | Con_DPrintf ("ioctl cdromclosetray failed\n"); 73 | } 74 | 75 | /* 76 | ============ 77 | CDAudio_GetNumTracks 78 | ============ 79 | */ 80 | int CDAudio_GetNumTracks (void) 81 | { 82 | struct cdrom_tochdr tochdr; 83 | 84 | if (ioctl(cdfile, CDROMREADTOCHDR, &tochdr) == -1) 85 | { 86 | Con_DPrintf ("ioctl cdromreadtochdr failed\n"); 87 | return -1; 88 | } 89 | 90 | if (tochdr.cdth_trk0 < 1) 91 | { 92 | Con_DPrintf ("CDAudio: no music tracks\n"); 93 | return -1; 94 | } 95 | 96 | return tochdr.cdth_trk1; 97 | } 98 | 99 | /* 100 | ============ 101 | CDAudio_GetTrackLength 102 | ============ 103 | */ 104 | int CDAudio_GetTrackLength (byte track) 105 | { 106 | struct cdrom_tocentry entry; 107 | 108 | if (cdfile == -1) 109 | return -1; 110 | 111 | entry.cdte_track = track; 112 | entry.cdte_format = CDROM_MSF; 113 | if (ioctl(cdfile, CDROMREADTOCENTRY, &entry) == -1) 114 | { 115 | Con_DPrintf ("ioctl cdromreadtocentry failed\n"); 116 | return -1; 117 | } 118 | if (entry.cdte_ctrl == CDROM_DATA_TRACK) 119 | { 120 | Con_Printf ("CDAudio: track %i is not audio\n", track); 121 | return -1; 122 | } 123 | 124 | return 1; 125 | } 126 | 127 | /* 128 | ============ 129 | CDAudio_PlayTrack 130 | ============ 131 | */ 132 | qboolean CDAudio_PlayTrack (byte track, int length) 133 | { 134 | struct cdrom_ti ti; 135 | 136 | ti.cdti_trk0 = track; 137 | ti.cdti_trk1 = track; 138 | ti.cdti_ind0 = 1; 139 | ti.cdti_ind1 = 99; 140 | 141 | if (ioctl(cdfile, CDROMPLAYTRKIND, &ti) == -1) 142 | { 143 | Con_DPrintf ("ioctl cdromplaytrkind failed\n"); 144 | return false; 145 | } 146 | 147 | if (ioctl(cdfile, CDROMRESUME) == -1) 148 | Con_DPrintf ("ioctl cdromresume failed\n"); 149 | 150 | return true; 151 | } 152 | 153 | /* 154 | ============ 155 | CDAudio_StopDevice 156 | ============ 157 | */ 158 | qboolean CDAudio_StopDevice (void) 159 | { 160 | if (cdfile == -1) 161 | return false; 162 | 163 | if (ioctl(cdfile, CDROMSTOP) == -1) 164 | { 165 | Con_DPrintf ("ioctl cdromstop failed (%d)\n", errno); 166 | return false; 167 | } 168 | 169 | return true; 170 | } 171 | 172 | /* 173 | ============ 174 | CDAudio_PauseDevice 175 | ============ 176 | */ 177 | qboolean CDAudio_PauseDevice (void) 178 | { 179 | if (cdfile == -1) 180 | return false; 181 | 182 | if (ioctl(cdfile, CDROMPAUSE) == -1) 183 | { 184 | Con_DPrintf ("ioctl cdrompause failed\n"); 185 | return false; 186 | } 187 | 188 | return true; 189 | } 190 | 191 | /* 192 | ============ 193 | CDAudio_ResumeDevice 194 | ============ 195 | */ 196 | qboolean CDAudio_ResumeDevice (void) 197 | { 198 | if (cdfile == -1) 199 | return false; 200 | 201 | if (ioctl(cdfile, CDROMRESUME) == -1) 202 | { 203 | Con_DPrintf ("ioctl cdromresume failed\n"); 204 | return false; 205 | } 206 | 207 | return true; 208 | } 209 | 210 | /* 211 | ============ 212 | CDAudio_Update_Linux 213 | ============ 214 | */ 215 | void CDAudio_Update_Linux (void) 216 | { 217 | struct cdrom_subchnl subchnl; 218 | static time_t lastchk; 219 | 220 | if (playing && lastchk < time(NULL)) 221 | { 222 | lastchk = time(NULL) + 2; // two seconds between chks 223 | subchnl.cdsc_format = CDROM_MSF; 224 | if (ioctl(cdfile, CDROMSUBCHNL, &subchnl) == -1) 225 | { 226 | Con_DPrintf ("ioctl cdromsubchnl failed\n"); 227 | playing = false; 228 | return; 229 | } 230 | if (subchnl.cdsc_audiostatus != CDROM_AUDIO_PLAY && subchnl.cdsc_audiostatus != CDROM_AUDIO_PAUSED) 231 | { 232 | playing = false; 233 | if (playLooping) 234 | CDAudio_Play (SRC_COMMAND, playTrack, true); 235 | } 236 | } 237 | } 238 | 239 | /* 240 | ============ 241 | CDAudio_UpdateVolume 242 | ============ 243 | */ 244 | void CDAudio_UpdateVolume (float vol) 245 | { 246 | struct cdrom_volctrl vc; 247 | 248 | if (cdfile == -1) 249 | return; 250 | 251 | vc.channel0 = vc.channel1 = vc.channel2 = vc.channel3 = 255*vol; 252 | 253 | if (ioctl(cdfile, CDROMVOLCTRL, &vc) == -1) 254 | { 255 | Con_DPrintf ("ioctl cdromvolctrl failed\n"); 256 | } 257 | } 258 | 259 | /* 260 | ============ 261 | CDAudio_InitDevice 262 | ============ 263 | */ 264 | qboolean CDAudio_InitDevice (void) 265 | { 266 | int i; 267 | 268 | if ((i = COM_CheckParm("-cddev")) != 0 && i < com_argc - 1) 269 | { 270 | Q_strcpy (cd_dev, com_argv[i + 1], sizeof(cd_dev)); 271 | } 272 | 273 | if ((cdfile = open(cd_dev, O_RDONLY)) == -1) 274 | { 275 | if (errno != ENOMEDIUM) 276 | Con_Printf ("%cCDAudio_Init: open of \"%s\" failed (%i)\n", 2, cd_dev, errno); 277 | cdfile = -1; 278 | return false; 279 | } 280 | 281 | if (ioctl(cdfile, CDROMVOLREAD, &cd_initialvol) == -1) 282 | { 283 | Con_DPrintf ("ioctl cdromvolread failed\n"); 284 | } 285 | 286 | return true; 287 | } 288 | 289 | /* 290 | ============ 291 | CDAudio_CloseDevice 292 | ============ 293 | */ 294 | void CDAudio_CloseDevice (void) 295 | { 296 | // JDH: restore original volume 297 | if (ioctl(cdfile, CDROMVOLCTRL, &cd_initialvol) == -1) 298 | { 299 | Con_DPrintf ("ioctl cdromvolctrl failed\n"); 300 | } 301 | 302 | close (cdfile); 303 | cdfile = -1; 304 | } 305 | 306 | -------------------------------------------------------------------------------- /anorms.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | {-0.525731, 0.000000, 0.850651}, 21 | {-0.442863, 0.238856, 0.864188}, 22 | {-0.295242, 0.000000, 0.955423}, 23 | {-0.309017, 0.500000, 0.809017}, 24 | {-0.162460, 0.262866, 0.951056}, 25 | {0.000000, 0.000000, 1.000000}, 26 | {0.000000, 0.850651, 0.525731}, 27 | {-0.147621, 0.716567, 0.681718}, 28 | {0.147621, 0.716567, 0.681718}, 29 | {0.000000, 0.525731, 0.850651}, 30 | {0.309017, 0.500000, 0.809017}, 31 | {0.525731, 0.000000, 0.850651}, 32 | {0.295242, 0.000000, 0.955423}, 33 | {0.442863, 0.238856, 0.864188}, 34 | {0.162460, 0.262866, 0.951056}, 35 | {-0.681718, 0.147621, 0.716567}, 36 | {-0.809017, 0.309017, 0.500000}, 37 | {-0.587785, 0.425325, 0.688191}, 38 | {-0.850651, 0.525731, 0.000000}, 39 | {-0.864188, 0.442863, 0.238856}, 40 | {-0.716567, 0.681718, 0.147621}, 41 | {-0.688191, 0.587785, 0.425325}, 42 | {-0.500000, 0.809017, 0.309017}, 43 | {-0.238856, 0.864188, 0.442863}, 44 | {-0.425325, 0.688191, 0.587785}, 45 | {-0.716567, 0.681718, -0.147621}, 46 | {-0.500000, 0.809017, -0.309017}, 47 | {-0.525731, 0.850651, 0.000000}, 48 | {0.000000, 0.850651, -0.525731}, 49 | {-0.238856, 0.864188, -0.442863}, 50 | {0.000000, 0.955423, -0.295242}, 51 | {-0.262866, 0.951056, -0.162460}, 52 | {0.000000, 1.000000, 0.000000}, 53 | {0.000000, 0.955423, 0.295242}, 54 | {-0.262866, 0.951056, 0.162460}, 55 | {0.238856, 0.864188, 0.442863}, 56 | {0.262866, 0.951056, 0.162460}, 57 | {0.500000, 0.809017, 0.309017}, 58 | {0.238856, 0.864188, -0.442863}, 59 | {0.262866, 0.951056, -0.162460}, 60 | {0.500000, 0.809017, -0.309017}, 61 | {0.850651, 0.525731, 0.000000}, 62 | {0.716567, 0.681718, 0.147621}, 63 | {0.716567, 0.681718, -0.147621}, 64 | {0.525731, 0.850651, 0.000000}, 65 | {0.425325, 0.688191, 0.587785}, 66 | {0.864188, 0.442863, 0.238856}, 67 | {0.688191, 0.587785, 0.425325}, 68 | {0.809017, 0.309017, 0.500000}, 69 | {0.681718, 0.147621, 0.716567}, 70 | {0.587785, 0.425325, 0.688191}, 71 | {0.955423, 0.295242, 0.000000}, 72 | {1.000000, 0.000000, 0.000000}, 73 | {0.951056, 0.162460, 0.262866}, 74 | {0.850651, -0.525731, 0.000000}, 75 | {0.955423, -0.295242, 0.000000}, 76 | {0.864188, -0.442863, 0.238856}, 77 | {0.951056, -0.162460, 0.262866}, 78 | {0.809017, -0.309017, 0.500000}, 79 | {0.681718, -0.147621, 0.716567}, 80 | {0.850651, 0.000000, 0.525731}, 81 | {0.864188, 0.442863, -0.238856}, 82 | {0.809017, 0.309017, -0.500000}, 83 | {0.951056, 0.162460, -0.262866}, 84 | {0.525731, 0.000000, -0.850651}, 85 | {0.681718, 0.147621, -0.716567}, 86 | {0.681718, -0.147621, -0.716567}, 87 | {0.850651, 0.000000, -0.525731}, 88 | {0.809017, -0.309017, -0.500000}, 89 | {0.864188, -0.442863, -0.238856}, 90 | {0.951056, -0.162460, -0.262866}, 91 | {0.147621, 0.716567, -0.681718}, 92 | {0.309017, 0.500000, -0.809017}, 93 | {0.425325, 0.688191, -0.587785}, 94 | {0.442863, 0.238856, -0.864188}, 95 | {0.587785, 0.425325, -0.688191}, 96 | {0.688191, 0.587785, -0.425325}, 97 | {-0.147621, 0.716567, -0.681718}, 98 | {-0.309017, 0.500000, -0.809017}, 99 | {0.000000, 0.525731, -0.850651}, 100 | {-0.525731, 0.000000, -0.850651}, 101 | {-0.442863, 0.238856, -0.864188}, 102 | {-0.295242, 0.000000, -0.955423}, 103 | {-0.162460, 0.262866, -0.951056}, 104 | {0.000000, 0.000000, -1.000000}, 105 | {0.295242, 0.000000, -0.955423}, 106 | {0.162460, 0.262866, -0.951056}, 107 | {-0.442863, -0.238856, -0.864188}, 108 | {-0.309017, -0.500000, -0.809017}, 109 | {-0.162460, -0.262866, -0.951056}, 110 | {0.000000, -0.850651, -0.525731}, 111 | {-0.147621, -0.716567, -0.681718}, 112 | {0.147621, -0.716567, -0.681718}, 113 | {0.000000, -0.525731, -0.850651}, 114 | {0.309017, -0.500000, -0.809017}, 115 | {0.442863, -0.238856, -0.864188}, 116 | {0.162460, -0.262866, -0.951056}, 117 | {0.238856, -0.864188, -0.442863}, 118 | {0.500000, -0.809017, -0.309017}, 119 | {0.425325, -0.688191, -0.587785}, 120 | {0.716567, -0.681718, -0.147621}, 121 | {0.688191, -0.587785, -0.425325}, 122 | {0.587785, -0.425325, -0.688191}, 123 | {0.000000, -0.955423, -0.295242}, 124 | {0.000000, -1.000000, 0.000000}, 125 | {0.262866, -0.951056, -0.162460}, 126 | {0.000000, -0.850651, 0.525731}, 127 | {0.000000, -0.955423, 0.295242}, 128 | {0.238856, -0.864188, 0.442863}, 129 | {0.262866, -0.951056, 0.162460}, 130 | {0.500000, -0.809017, 0.309017}, 131 | {0.716567, -0.681718, 0.147621}, 132 | {0.525731, -0.850651, 0.000000}, 133 | {-0.238856, -0.864188, -0.442863}, 134 | {-0.500000, -0.809017, -0.309017}, 135 | {-0.262866, -0.951056, -0.162460}, 136 | {-0.850651, -0.525731, 0.000000}, 137 | {-0.716567, -0.681718, -0.147621}, 138 | {-0.716567, -0.681718, 0.147621}, 139 | {-0.525731, -0.850651, 0.000000}, 140 | {-0.500000, -0.809017, 0.309017}, 141 | {-0.238856, -0.864188, 0.442863}, 142 | {-0.262866, -0.951056, 0.162460}, 143 | {-0.864188, -0.442863, 0.238856}, 144 | {-0.809017, -0.309017, 0.500000}, 145 | {-0.688191, -0.587785, 0.425325}, 146 | {-0.681718, -0.147621, 0.716567}, 147 | {-0.442863, -0.238856, 0.864188}, 148 | {-0.587785, -0.425325, 0.688191}, 149 | {-0.309017, -0.500000, 0.809017}, 150 | {-0.147621, -0.716567, 0.681718}, 151 | {-0.425325, -0.688191, 0.587785}, 152 | {-0.162460, -0.262866, 0.951056}, 153 | {0.442863, -0.238856, 0.864188}, 154 | {0.162460, -0.262866, 0.951056}, 155 | {0.309017, -0.500000, 0.809017}, 156 | {0.147621, -0.716567, 0.681718}, 157 | {0.000000, -0.525731, 0.850651}, 158 | {0.425325, -0.688191, 0.587785}, 159 | {0.587785, -0.425325, 0.688191}, 160 | {0.688191, -0.587785, 0.425325}, 161 | {-0.955423, 0.295242, 0.000000}, 162 | {-0.951056, 0.162460, 0.262866}, 163 | {-1.000000, 0.000000, 0.000000}, 164 | {-0.850651, 0.000000, 0.525731}, 165 | {-0.955423, -0.295242, 0.000000}, 166 | {-0.951056, -0.162460, 0.262866}, 167 | {-0.864188, 0.442863, -0.238856}, 168 | {-0.951056, 0.162460, -0.262866}, 169 | {-0.809017, 0.309017, -0.500000}, 170 | {-0.864188, -0.442863, -0.238856}, 171 | {-0.951056, -0.162460, -0.262866}, 172 | {-0.809017, -0.309017, -0.500000}, 173 | {-0.681718, 0.147621, -0.716567}, 174 | {-0.681718, -0.147621, -0.716567}, 175 | {-0.850651, 0.000000, -0.525731}, 176 | {-0.688191, 0.587785, -0.425325}, 177 | {-0.587785, 0.425325, -0.688191}, 178 | {-0.425325, 0.688191, -0.587785}, 179 | {-0.425325, -0.688191, -0.587785}, 180 | {-0.587785, -0.425325, -0.688191}, 181 | {-0.688191, -0.587785, -0.425325}, 182 | -------------------------------------------------------------------------------- /cmd.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | // cmd.h -- Command buffer and command execution 21 | 22 | //=========================================================================== 23 | 24 | /* 25 | 26 | Any number of commands can be added in a frame, from several different sources. 27 | Most commands come from either keybindings or console line input, but remote 28 | servers can also send across commands and entire text files can be execed. 29 | 30 | The + command line options are also added to the command buffer. 31 | 32 | The game starts with a Cbuf_AddText ("exec quake.rc\n"); Cbuf_Execute (); 33 | 34 | */ 35 | 36 | void Cbuf_Init (void); 37 | // allocates an initial text buffer that will grow as needed 38 | 39 | void Cbuf_AddText (const char *text, cmd_source_t); 40 | // as new commands are generated from the console or keybindings, 41 | // the text is added to the end of the command buffer. 42 | 43 | void Cbuf_InsertText (const char *text, cmd_source_t); 44 | // when a command wants to issue other commands immediately, the text is 45 | // inserted at the beginning of the buffer, before any remaining unexecuted 46 | // commands. 47 | 48 | void Cbuf_Execute (void); 49 | // Pulls off \n terminated lines of text from the command buffer and sends 50 | // them through Cmd_ExecuteString. Stops when the buffer is empty. 51 | // Normally called once per frame, but may be explicitly invoked. 52 | // Do not call inside a command function! 53 | 54 | qboolean Cbuf_IsEmpty (void); 55 | 56 | //=========================================================================== 57 | 58 | /* 59 | 60 | Command execution takes a null terminated string, breaks it into tokens, 61 | then searches for a command or variable that matches the first token. 62 | */ 63 | 64 | typedef void (*xcommand_t) (cmd_source_t); 65 | 66 | typedef struct cmd_function_s 67 | { 68 | struct cmd_function_s *next; 69 | const char *name; 70 | xcommand_t function; 71 | int flags; 72 | } cmd_function_t; 73 | 74 | 75 | //extern cmd_source_t cmd_source; 76 | 77 | #define MAX_ARGS 80 78 | #define MAX_ARGBUF 1024 79 | 80 | typedef struct 81 | { 82 | int argc; 83 | char buf[MAX_ARGBUF*2]; // tokenized args, followed by exact copy of original cmd+args 84 | char *argv[MAX_ARGS]; // pointers to within buf 85 | char *cmdline; // pointer to copy of cmd+args in buf 86 | short args_ofs[MAX_ARGS]; // offset (in cmdline) for each arg, in original form 87 | } cmd_arglist_t; 88 | 89 | //extern int pak_files; 90 | //void FindFilesInPak (char *the_arg); 91 | 92 | // flags for Cmd_AddCommand: 93 | #define CMD_TEMPORARY 0x0040 94 | #define CMD_DISABLED 0x8000 95 | 96 | void Cmd_Init (void); 97 | 98 | void Cmd_AddCommand (const char *cmd_name, xcommand_t function, int flags); 99 | // called by the init functions of other parts of the program to 100 | // register commands and functions to call for them. 101 | // The cmd_name is referenced later, so it should not be in temp memory 102 | 103 | #ifdef HEXEN2_SUPPORT 104 | void Cmd_AddGameCommand (const char *cmd_name, xcommand_t function, int flags); 105 | void Cmd_RemoveGameCommand (const char *cmd_name); 106 | #endif 107 | 108 | void Cmd_AddLegacyCommand (const char *oldname, const char *newname); 109 | void Cmd_RemoveLegacyCommand (const char *oldname); 110 | 111 | qboolean Cmd_Exists (const char *cmd_name); 112 | // used by the cvar code to check for cvar / command name overlap 113 | 114 | int Cmd_Argc (void); 115 | const char *Cmd_Argv (int arg); 116 | const char * Cmd_Args (int argstart); 117 | // The functions that execute commands get their parameters with these 118 | // functions. Cmd_Argv () will return an empty string, not a NULL 119 | // if arg > argc, so string operations are always safe. 120 | 121 | int Cmd_CheckParm (const char *parm); 122 | // Returns the position (1 to argc-1) in the command's argument list 123 | // where the given parameter apears, or 0 if not present 124 | 125 | void Cmd_TokenizeString (const char *text, cmd_arglist_t *out); 126 | // Takes a null terminated string. Does not need to be /n terminated. 127 | // breaks the string up into arg tokens. 128 | 129 | void Cmd_ExecuteString (const char *text, cmd_source_t src); 130 | // Parses a single line of text into arguments and tries to execute it. 131 | // The text can come from the command buffer, a remote client, or stdin. 132 | 133 | void Cmd_ForwardToServer (cmd_source_t src); 134 | // adds the current command line as a clc_stringcmd to the client message. 135 | // things like godmode, noclip, etc, are commands directed to the server, 136 | // so when they are typed in at the console, they will need to be forwarded. 137 | 138 | void Cmd_Print (const char *text); 139 | // used by command functions to send output to either the graphics console or 140 | // passed as a print message to the client 141 | 142 | 143 | #define MAX_FILELENGTH 64 144 | 145 | typedef enum {CMD_FTYPE_FILE, CMD_FTYPE_DIR, CMD_FTYPE_CDUP} cmd_ftype_t; 146 | 147 | typedef struct file_entry_s 148 | { 149 | cmd_ftype_t type; 150 | char *name; 151 | int size; 152 | // struct file_entry_s *next; 153 | } file_entry_t; 154 | 155 | extern file_entry_t *filelist; 156 | extern int num_files; 157 | 158 | /* 159 | extern int RDFlags; 160 | 161 | #define RD_MENU_DEMOS 1 // for demos menu printing 162 | #define RD_MENU_DEMOS_MAIN 2 // to avoid printing ".." in the main Quake folder 163 | #define RD_COMPLAIN 4 // to avoid printing "No such file" 164 | #define RD_STRIPEXT 8 // for stripping file's extension 165 | #define RD_NOERASE 16 // to avoid deleting the filelist 166 | #define RD_SKYBOX 32 // for skyboxes 167 | #define RD_GAMEDIR 64 // for the "gamedir" command 168 | 169 | void ReadDir (char *path, char *the_arg); 170 | */ 171 | 172 | #define AFE_NO_NAMESORT 0x0001 173 | #define AFE_NO_TYPESORT 0x0002 174 | #define AFE_KEEPCASE 0x0004 175 | 176 | int Cmd_AddFilelistEntry (const char *fname, cmd_ftype_t ftype, long fsize, int flags); 177 | void Cmd_ClearFilelist (void); 178 | qboolean Cmd_CheckEntryName (const char *ename); 179 | const char * Cmd_FindCommonStart (void); 180 | 181 | const char * Cmd_TabComplete (const char *cmdline, qboolean cycle_rev); 182 | /* 183 | void Cmd_CompleteParameter (char *partial, const char *attachment, qboolean reverse_cycle); 184 | void Cmd_CompleteCmdOrCvar (const char *partial, qboolean reverse_cycle); 185 | 186 | const char *Cmd_CompleteCommand (const char *partial); 187 | */ 188 | // attempts to match a partial command for automatic command line completion 189 | // returns NULL if nothing fits 190 | 191 | -------------------------------------------------------------------------------- /quakeasm.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | // 21 | // quakeasm.h: general asm header file 22 | // 23 | 24 | #if defined(_WIN32) && !defined(WINDED) 25 | #define __i386__ 1 26 | #endif 27 | 28 | #ifdef __i386__ 29 | #define id386 1 30 | #else 31 | #define id386 0 32 | #endif 33 | 34 | // !!! must be kept the same as in d_iface.h !!! 35 | #define TRANSPARENT_COLOR 255 36 | 37 | #ifndef NeXT 38 | #ifndef GLQUAKE 39 | .extern C(d_zistepu) 40 | .extern C(d_pzbuffer) 41 | .extern C(d_zistepv) 42 | .extern C(d_zrowbytes) 43 | .extern C(d_ziorigin) 44 | .extern C(r_turb_s) 45 | .extern C(r_turb_t) 46 | .extern C(r_turb_pdest) 47 | .extern C(r_turb_spancount) 48 | .extern C(r_turb_turb) 49 | .extern C(r_turb_pbase) 50 | .extern C(r_turb_sstep) 51 | .extern C(r_turb_tstep) 52 | .extern C(r_bmodelactive) 53 | .extern C(d_sdivzstepu) 54 | .extern C(d_tdivzstepu) 55 | .extern C(d_sdivzstepv) 56 | .extern C(d_tdivzstepv) 57 | .extern C(d_sdivzorigin) 58 | .extern C(d_tdivzorigin) 59 | .extern C(sadjust) 60 | .extern C(tadjust) 61 | .extern C(bbextents) 62 | .extern C(bbextentt) 63 | .extern C(cacheblock) 64 | .extern C(d_viewbuffer) 65 | .extern C(cachewidth) 66 | .extern C(d_pzbuffer) 67 | .extern C(d_zrowbytes) 68 | .extern C(d_zwidth) 69 | .extern C(d_scantable) 70 | .extern C(r_lightptr) 71 | .extern C(r_numvblocks) 72 | .extern C(prowdestbase) 73 | .extern C(pbasesource) 74 | .extern C(r_lightwidth) 75 | .extern C(lightright) 76 | .extern C(lightrightstep) 77 | .extern C(lightdeltastep) 78 | .extern C(lightdelta) 79 | .extern C(lightright) 80 | .extern C(lightdelta) 81 | .extern C(sourcetstep) 82 | .extern C(surfrowbytes) 83 | .extern C(lightrightstep) 84 | .extern C(lightdeltastep) 85 | .extern C(r_sourcemax) 86 | .extern C(r_stepback) 87 | .extern C(colormap) 88 | .extern C(blocksize) 89 | .extern C(sourcesstep) 90 | .extern C(lightleft) 91 | .extern C(blockdivshift) 92 | .extern C(blockdivmask) 93 | .extern C(lightleftstep) 94 | .extern C(r_origin) 95 | .extern C(r_ppn) 96 | .extern C(r_pup) 97 | .extern C(r_pright) 98 | .extern C(ycenter) 99 | .extern C(xcenter) 100 | .extern C(d_vrectbottom_particle) 101 | .extern C(d_vrectright_particle) 102 | .extern C(d_vrecty) 103 | .extern C(d_vrectx) 104 | .extern C(d_pix_shift) 105 | .extern C(d_pix_min) 106 | .extern C(d_pix_max) 107 | .extern C(d_y_aspect_shift) 108 | .extern C(screenwidth) 109 | .extern C(r_leftclipped) 110 | .extern C(r_leftenter) 111 | .extern C(r_rightclipped) 112 | .extern C(r_rightenter) 113 | .extern C(modelorg) 114 | .extern C(xscale) 115 | .extern C(r_refdef) 116 | .extern C(yscale) 117 | .extern C(r_leftexit) 118 | .extern C(r_rightexit) 119 | .extern C(r_lastvertvalid) 120 | .extern C(cacheoffset) 121 | .extern C(newedges) 122 | .extern C(removeedges) 123 | .extern C(r_pedge) 124 | .extern C(r_framecount) 125 | .extern C(r_u1) 126 | .extern C(r_emitted) 127 | .extern C(edge_p) 128 | .extern C(surface_p) 129 | .extern C(surfaces) 130 | .extern C(r_lzi1) 131 | .extern C(r_v1) 132 | .extern C(r_ceilv1) 133 | .extern C(r_nearzi) 134 | .extern C(r_nearzionly) 135 | .extern C(edge_aftertail) 136 | .extern C(edge_tail) 137 | .extern C(current_iv) 138 | .extern C(edge_head_u_shift20) 139 | .extern C(span_p) 140 | .extern C(edge_head) 141 | .extern C(fv) 142 | .extern C(edge_tail_u_shift20) 143 | .extern C(r_apverts) 144 | .extern C(r_anumverts) 145 | .extern C(aliastransform) 146 | .extern C(r_avertexnormals) 147 | .extern C(r_plightvec) 148 | .extern C(r_ambientlight) 149 | .extern C(r_shadelight) 150 | .extern C(aliasxcenter) 151 | .extern C(aliasycenter) 152 | .extern C(a_sstepxfrac) 153 | .extern C(r_affinetridesc) 154 | .extern C(acolormap) 155 | .extern C(d_pcolormap) 156 | .extern C(r_affinetridesc) 157 | .extern C(d_sfrac) 158 | .extern C(d_ptex) 159 | .extern C(d_pedgespanpackage) 160 | .extern C(d_tfrac) 161 | .extern C(d_light) 162 | .extern C(d_zi) 163 | .extern C(d_pdest) 164 | .extern C(d_pz) 165 | .extern C(d_aspancount) 166 | .extern C(erroradjustup) 167 | .extern C(errorterm) 168 | .extern C(d_xdenom) 169 | .extern C(r_p0) 170 | .extern C(r_p1) 171 | .extern C(r_p2) 172 | .extern C(a_tstepxfrac) 173 | .extern C(r_sstepx) 174 | .extern C(r_tstepx) 175 | .extern C(a_ststepxwhole) 176 | .extern C(zspantable) 177 | .extern C(skintable) 178 | .extern C(r_zistepx) 179 | .extern C(erroradjustdown) 180 | .extern C(d_countextrastep) 181 | .extern C(ubasestep) 182 | .extern C(a_ststepxwhole) 183 | .extern C(a_tstepxfrac) 184 | .extern C(r_lstepx) 185 | .extern C(a_spans) 186 | .extern C(erroradjustdown) 187 | .extern C(d_pdestextrastep) 188 | .extern C(d_pzextrastep) 189 | .extern C(d_sfracextrastep) 190 | .extern C(d_ptexextrastep) 191 | .extern C(d_countextrastep) 192 | .extern C(d_tfracextrastep) 193 | .extern C(d_lightextrastep) 194 | .extern C(d_ziextrastep) 195 | .extern C(d_pdestbasestep) 196 | .extern C(d_pzbasestep) 197 | .extern C(d_sfracbasestep) 198 | .extern C(d_ptexbasestep) 199 | .extern C(ubasestep) 200 | .extern C(d_tfracbasestep) 201 | .extern C(d_lightbasestep) 202 | .extern C(d_zibasestep) 203 | .extern C(zspantable) 204 | .extern C(r_lstepy) 205 | .extern C(r_sstepy) 206 | .extern C(r_tstepy) 207 | .extern C(r_zistepy) 208 | .extern C(D_PolysetSetEdgeTable) 209 | .extern C(D_RasterizeAliasPolySmooth) 210 | 211 | .extern float_point5 212 | .extern Float2ToThe31nd 213 | .extern izistep 214 | .extern izi 215 | .extern FloatMinus2ToThe31nd 216 | .extern float_1 217 | .extern float_particle_z_clip 218 | .extern float_minus_1 219 | .extern float_0 220 | .extern fp_16 221 | .extern fp_64k 222 | .extern fp_1m 223 | .extern fp_1m_minus_1 224 | .extern fp_8 225 | .extern entryvec_table 226 | .extern advancetable 227 | .extern sstep 228 | .extern tstep 229 | .extern pspantemp 230 | .extern counttemp 231 | .extern jumptemp 232 | .extern reciprocal_table 233 | .extern DP_Count 234 | .extern DP_u 235 | .extern DP_v 236 | .extern DP_32768 237 | .extern DP_Color 238 | .extern DP_Pix 239 | .extern DP_EntryTable 240 | .extern pbase 241 | .extern s 242 | .extern t 243 | .extern sfracf 244 | .extern tfracf 245 | .extern snext 246 | .extern tnext 247 | .extern spancountminus1 248 | .extern zi16stepu 249 | .extern sdivz16stepu 250 | .extern tdivz16stepu 251 | .extern zi8stepu 252 | .extern sdivz8stepu 253 | .extern tdivz8stepu 254 | .extern reciprocal_table_16 255 | .extern entryvec_table_16 256 | .extern ceil_cw 257 | .extern single_cw 258 | .extern fp_64kx64k 259 | .extern pz 260 | .extern spr8entryvec_table 261 | #endif 262 | 263 | .extern C(vright) 264 | .extern C(vup) 265 | .extern C(vpn) 266 | 267 | #endif 268 | -------------------------------------------------------------------------------- /menu_H2.c: -------------------------------------------------------------------------------- 1 | 2 | #include "quakedef.h" 3 | 4 | #ifndef RQM_SV_ONLY 5 | 6 | #ifdef HEXEN2_SUPPORT 7 | 8 | #define M_NO_LEVEL_LIST 9 | #include "menu_defs.h" 10 | 11 | #ifndef _WIN32 12 | #include // for toupper() 13 | #endif 14 | 15 | extern qboolean m_entersound, has_portals; 16 | extern int m_save_demonum; 17 | extern menu_t *menu_current, menu_keys, menu_sp; 18 | extern int m_yofs; 19 | extern cvar_t cl_playerclass; 20 | 21 | void M_Menu_Class_f (cmd_source_t src); 22 | void M_Class_Draw (void); 23 | qboolean M_Class_Key (int key, qboolean down); 24 | 25 | void M_Menu_Difficulty_f (cmd_source_t src); 26 | void M_Difficulty_Draw (void); 27 | qboolean M_Difficulty_Key (int key, qboolean down); 28 | 29 | static const char *ClassNamesU[NUM_CLASSES] = 30 | { 31 | "PALADIN", 32 | "CRUSADER", 33 | "NECROMANCER", 34 | "ASSASSIN", 35 | "DEMONESS" 36 | }; 37 | 38 | static const char *DiffNames[NUM_CLASSES][NUM_DIFFLEVELS] = 39 | { 40 | { // Paladin 41 | "APPRENTICE", 42 | "SQUIRE", 43 | "ADEPT", 44 | "LORD" 45 | }, 46 | { // Crusader 47 | "GALLANT", 48 | "HOLY AVENGER", 49 | "DIVINE HERO", 50 | "LEGEND" 51 | }, 52 | { // Necromancer 53 | "SORCERER", 54 | "DARK SERVANT", 55 | "WARLOCK", 56 | "LICH KING" 57 | }, 58 | { // Assassin 59 | "ROGUE", 60 | "CUTTHROAT", 61 | "EXECUTIONER", 62 | "WIDOW MAKER" 63 | }, 64 | { // Demoness 65 | "LARVA", 66 | "SPAWN", 67 | "FIEND", 68 | "SHE BITCH" 69 | } 70 | }; 71 | 72 | 73 | /*menu_t menu_main_H2 = 74 | { 75 | M_TITLE(NULL, "title0"), M_Main_Draw, M_Main_Key, M_Main_Escape, 0, 0, 4, 76 | { 77 | {"SINGLE PLAYER", M_Menu_SinglePlayer_f}, 78 | {"MULTIPLAYER", M_Menu_MultiPlayer_f}, 79 | {"OPTIONS", M_Menu_Options_f}, 80 | // {"HELP", M_Menu_Help_f}, 81 | {"QUIT", M_Menu_Quit_f} 82 | } 83 | }; 84 | 85 | menu_t menu_sp_H2 = 86 | { 87 | M_TITLE(NULL, "title1"), M_SinglePlayer_Draw, M_SinglePlayer_Key, M_Menu_Main_f, 0, 0, 5, 88 | { 89 | {"NEW GAME", M_StartNewGame}, 90 | {"LOAD", M_Menu_Load_f}, 91 | {"SAVE", M_Menu_Save_f}, 92 | {"SELECT MAP", M_Menu_Maps_f}, 93 | {"VIEW DEMO", M_Menu_Demos_f} 94 | // Portals-specific: 95 | // {"OLD MISSION"}, 96 | // {"VIEW INTRO"} 97 | } 98 | }; 99 | 100 | menu_t menu_mp_H2 = 101 | { 102 | M_TITLE(NULL, "title4"), M_MultiPlayer_Draw, M_MultiPlayer_Key, M_Menu_Main_f, 0, 0, 3, 103 | { 104 | {"JOIN A GAME", M_CheckEnter_NetMenu}, 105 | {"NEW GAME", M_CheckEnter_NetMenu}, 106 | {"SETUP", M_Menu_Setup_f} 107 | // {"LOAD"}, 108 | // {"SAVE"} 109 | } 110 | }; 111 | */ 112 | 113 | menu_t menu_class = 114 | { 115 | NULL, "title2", M_Menu_Class_f, M_Class_Draw, M_Class_Key, NULL, &menu_sp, 0, 0, 0, 0 116 | // num_items is set in M_Menu_Class_f 117 | }; 118 | 119 | menu_t menu_difficulty = 120 | { 121 | NULL, "title5", M_Menu_Difficulty_f, M_Difficulty_Draw, M_Difficulty_Key, NULL, &menu_class, 0, 0, 0, NUM_DIFFLEVELS 122 | }; 123 | 124 | int setup_class; 125 | int m_enter_portals; 126 | double introTime = 0.0; 127 | 128 | 129 | void M_IPrint (int cx, int cy, const char *str) 130 | { 131 | cx += (vid.width - 320) / 2; 132 | cy += (vid.height - 200) / 2; 133 | 134 | while (*str) 135 | { 136 | Draw_Character (cx, cy, ((unsigned char)(*str))+256); 137 | str++; 138 | cx += 8; 139 | } 140 | } 141 | 142 | void M_DrawTransPic2 (int x, int y, const mpic_t *pic) 143 | { 144 | // centered H and V 145 | Draw_TransPic (x + ((vid.width - 320) >> 1), y + ((vid.height - 200)>>1), pic); 146 | } 147 | 148 | void M_PrintBig_H2 (int cx, int cy, const char *str) 149 | { 150 | char upr[64]; 151 | int i; 152 | 153 | for (i = 0; i < 64 && str[i]; i++) 154 | upr[i] = toupper (str[i]); 155 | 156 | upr[i] = 0; 157 | M_PrintBig (cx, cy, upr); 158 | } 159 | 160 | void M_DrawTitle_H2 (const char *name) 161 | { 162 | mpic_t *p; 163 | 164 | p = Draw_GetCachePic (va ("gfx/menu/%s.lmp", name), false); 165 | if (p) 166 | // Draw_Pic ((vid.width - p->width)/2, m_yofs - 34 , p); 167 | M_DrawTransPic ((320 - p->width) / 2, -34 , p); 168 | 169 | // if (menu_current != &menu_keys) 170 | if (!(menu_current->flags & M_NO_QUAKELOGO)) 171 | { 172 | p = Draw_GetCachePic ("gfx/menu/hplaque.lmp", false); 173 | // Draw_Pic ((vid.width - 320)/2, m_yofs - 34, p); 174 | M_DrawTransPic (0, -34, p); 175 | } 176 | } 177 | 178 | //============================================================================= 179 | /* DIFFICULTY MENU */ 180 | 181 | void M_Menu_Difficulty_f (cmd_source_t src) 182 | { 183 | key_dest = key_menu; 184 | menu_current = &menu_difficulty; 185 | } 186 | 187 | void M_Difficulty_Draw (void) 188 | { 189 | int i; 190 | 191 | M_DrawTitle_H2 (menu_current->lmp); 192 | 193 | setup_class = cl_playerclass.value; 194 | 195 | if (setup_class < 1 || setup_class > NUM_CLASSES) 196 | setup_class = NUM_CLASSES; 197 | setup_class--; 198 | 199 | for (i = 0; i < NUM_DIFFLEVELS; ++i) 200 | M_PrintBig (72, 39+(i*20), DiffNames[setup_class][i]); 201 | 202 | M_DrawSpinningCursor (43, 39 + menu_current->cursor * 20); 203 | } 204 | 205 | qboolean M_Difficulty_Key (int key, qboolean down) 206 | { 207 | switch (key) 208 | { 209 | /* case K_LEFTARROW: 210 | case K_RIGHTARROW: 211 | break;*/ 212 | 213 | case K_ENTER: 214 | Cvar_SetValueDirect (&skill, menu_current->cursor); 215 | m_entersound = true; 216 | if (m_enter_portals) 217 | { 218 | // Pa3PyX: needed to play intro properly now 219 | introTime = Sys_DoubleTime (); 220 | cl.intermission = 12; 221 | cl.completed_time = cl.time; 222 | key_dest = key_game; 223 | menu_current = NULL; 224 | cls.demonum = m_save_demonum; 225 | } 226 | else 227 | Cbuf_AddText ("map demo1\n", SRC_COMMAND); 228 | return true; 229 | 230 | /* default: 231 | key_dest = key_game; 232 | menu_current = NULL; 233 | break;*/ 234 | } 235 | 236 | return false; 237 | } 238 | 239 | //============================================================================= 240 | /* CHARACTER CLASS MENU */ 241 | 242 | void M_Menu_Class_f (cmd_source_t src) 243 | { 244 | key_dest = key_menu; 245 | menu_current = &menu_class; 246 | // Pa3PyX: non-Portals 247 | menu_class.num_items = (m_enter_portals ? NUM_CLASSES : NUM_CLASSES - 1); 248 | } 249 | 250 | void M_Class_Draw (void) 251 | { 252 | int i; 253 | 254 | M_DrawTitle_H2 (menu_current->lmp); 255 | 256 | /* Pa3PyX: No demoness in non-Portals please, that's against the plot! 257 | Multiplayer only. */ 258 | for (i = 0; i < menu_current->num_items; ++i) 259 | M_PrintBig (72, 39+(i*20), ClassNamesU[i]); 260 | // Pa3PyX: end code 261 | 262 | M_DrawSpinningCursor (43, 39 + menu_current->cursor * 20); 263 | 264 | i = (has_portals ? 43 : 33); 265 | M_DrawPic (263, i + 21, Draw_GetCachePic (va("gfx/cport%d.lmp", menu_current->cursor + 1), true)); 266 | M_DrawTransPic (254, i, Draw_GetCachePic ("gfx/menu/frame.lmp", true)); 267 | } 268 | 269 | qboolean M_Class_Key (int key, qboolean down) 270 | { 271 | switch (key) 272 | { 273 | /* case K_LEFTARROW: 274 | case K_RIGHTARROW: 275 | break;*/ 276 | 277 | case K_ENTER: 278 | Cbuf_AddText (va("playerclass %d\n", menu_current->cursor+1), SRC_COMMAND); 279 | m_entersound = true; 280 | M_Menu_Difficulty_f (SRC_COMMAND); 281 | /*if (!class_flag) 282 | { 283 | M_Menu_Difficulty_f(); 284 | } 285 | else 286 | { 287 | key_dest = key_game; 288 | menu_current = NULL; 289 | }*/ 290 | return true; 291 | /* default: 292 | key_dest = key_game; 293 | menu_current = NULL; 294 | break;*/ 295 | } 296 | 297 | return false; 298 | } 299 | #endif // #ifdef HEXEN2_SUPPORT 300 | 301 | #endif //#ifndef RQM_SV_ONLY 302 | --------------------------------------------------------------------------------