├── gl_rsurface.c ├── net_wso.c ├── resource.h ├── progdefs.h ├── crc.h ├── cdaudio.h ├── in_null.c ├── ReadMe.txt ├── view.h ├── menu.h ├── conproc.h ├── cd_null.c ├── input.h ├── keys.h ├── r_vars.c ├── net_none.c ├── net_loop.h ├── d_zpoint.c ├── net_ser.h ├── sbar.h ├── net_vcr.h ├── net_dgrm.h ├── nonintel.c ├── D3DQuakeX.sln ├── vregset.h ├── draw.h ├── snd_next.c ├── console.h ├── d_vars.c ├── net_bw.h ├── net_ipx.h ├── net_udp.h ├── net_wins.h ├── net_wipx.h ├── net_mp.h ├── screen.h ├── wad.h ├── vregset.c ├── snd_null.c ├── d_fill.c ├── net_bsd.c ├── sys.h ├── vid_null.c ├── chase.c ├── d_modech.c ├── world.h ├── asm_i386.h ├── net_win.c ├── xbox ├── SysInputXbox.h └── xbinput.h ├── vid.h ├── vid_dos.h ├── mathlib.h ├── progdefs.q1 ├── d_ifacea.h ├── gl_warp_sin.h ├── spritegn.h ├── block8.h ├── block16.h ├── d_local.h ├── modelgen.h ├── crc.c ├── cvar.h ├── net_dos.c ├── zone.h ├── d_sky.c ├── pr_comp.h ├── winquake.h ├── d_init.c ├── wad.c ├── gl_test.c ├── cd_sdl.c ├── net_vcr.c ├── snd_sdl.c ├── progs.h ├── d_part.c ├── cmd.h ├── asm_draw.h ├── sys_null.c ├── cvar.c ├── gl_refrag.c ├── snd_sun.c └── protocol.h /gl_rsurface.c: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /net_wso.c: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Developer Studio generated include file. 3 | // Used by winquake.rc 4 | // 5 | #define IDS_STRING1 1 6 | #define IDI_ICON2 1 7 | #define IDD_DIALOG1 108 8 | #define IDD_PROGRESS 109 9 | #define IDC_PROGRESS 1000 10 | 11 | // Next default values for new objects 12 | // 13 | #ifdef APSTUDIO_INVOKED 14 | #ifndef APSTUDIO_READONLY_SYMBOLS 15 | #define _APS_NEXT_RESOURCE_VALUE 111 16 | #define _APS_NEXT_COMMAND_VALUE 40001 17 | #define _APS_NEXT_CONTROL_VALUE 1004 18 | #define _APS_NEXT_SYMED_VALUE 101 19 | #endif 20 | #endif 21 | -------------------------------------------------------------------------------- /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 | #ifdef QUAKE2 21 | #include "progdefs.q2" 22 | #else 23 | #include "progdefs.q1" 24 | #endif 25 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | 21 | int CDAudio_Init(void); 22 | void CDAudio_Play(byte track, qboolean looping); 23 | void CDAudio_Stop(void); 24 | void CDAudio_Pause(void); 25 | void CDAudio_Resume(void); 26 | void CDAudio_Shutdown(void); 27 | void CDAudio_Update(void); 28 | -------------------------------------------------------------------------------- /in_null.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 | // in_null.c -- for systems without a mouse 21 | 22 | #include "quakedef.h" 23 | 24 | void IN_Init (void) 25 | { 26 | } 27 | 28 | void IN_Shutdown (void) 29 | { 30 | } 31 | 32 | void IN_Commands (void) 33 | { 34 | } 35 | 36 | void IN_Move (usercmd_t *cmd) 37 | { 38 | } 39 | 40 | -------------------------------------------------------------------------------- /ReadMe.txt: -------------------------------------------------------------------------------- 1 | D3DQuakeX v1.3 2 | ======================== 3 | This is a port of GLQuake to the original XBox using FakeGL as the XBox has no support for OpenGL. 4 | 5 | Version history: 6 | 7 | v1.0 8 | - Initial release. 9 | 10 | v1.1 11 | - New SDL sound driver. 12 | - Background music working using new sound driver. 13 | - XBox controller buttons black and white can now be bound. 14 | 15 | v1.2 16 | - Fixed lookspring been forced on. 17 | - Fixed some 2D quads not rendering correctly sometimes. 18 | 19 | v1.3 20 | - Fixed support for SD TVs, now works on anything. 21 | 22 | Known bugs (WIP): 23 | 24 | 1.) Sometimes auto fire randomly turns on. 25 | 26 | 3.) Pressing up in the options menu from the first item will highlight an invisible menu item 27 | underneath the last menu item. 28 | 29 | 4.) Look inversion option doesn't work. 30 | 31 | 6.) Controls not sticking. 32 | 33 | Note: SDLx is required to build (used for sound). 34 | 35 | Thanks to: 36 | - Lantus - For the original SDLQuakeX XBox port. 37 | - Freakdave - For his help with the FakeGLx port and fixes. 38 | - FakeGL author (http://dxquake.sourceforge.net/). 39 | - Everyone in this great XBox community on EmuXtras. 40 | -------------------------------------------------------------------------------- /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 | 24 | extern byte gammatable[256]; // palette is sent through this 25 | extern byte ramps[3][256]; 26 | extern float v_blend[4]; 27 | 28 | extern cvar_t lcd_x; 29 | 30 | 31 | void V_Init (void); 32 | void V_RenderView (void); 33 | float V_CalcRoll (vec3_t angles, vec3_t velocity); 34 | void V_UpdatePalette (void); 35 | 36 | -------------------------------------------------------------------------------- /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 | 21 | // 22 | // the net drivers should just set the apropriate bits in m_activenet, 23 | // instead of having the menu code look through their internal tables 24 | // 25 | #define MNET_IPX 1 26 | #define MNET_TCP 2 27 | 28 | extern int m_activenet; 29 | 30 | // 31 | // menus 32 | // 33 | void M_Init (void); 34 | void M_Keydown (int key); 35 | void M_Draw (void); 36 | void M_ToggleMenu_f (void); 37 | 38 | 39 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /cd_null.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 | void CDAudio_Play(byte track, qboolean looping) 23 | { 24 | } 25 | 26 | 27 | void CDAudio_Stop(void) 28 | { 29 | } 30 | 31 | 32 | void CDAudio_Pause(void) 33 | { 34 | } 35 | 36 | 37 | void CDAudio_Resume(void) 38 | { 39 | } 40 | 41 | 42 | void CDAudio_Update(void) 43 | { 44 | } 45 | 46 | 47 | int CDAudio_Init(void) 48 | { 49 | return 0; 50 | } 51 | 52 | 53 | void CDAudio_Shutdown(void) 54 | { 55 | } -------------------------------------------------------------------------------- /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 | #ifdef _XBOX //Marty 23 | #include "xbox\SysInputXbox.h" 24 | #endif 25 | 26 | void IN_Init (void); 27 | 28 | void IN_Shutdown (void); 29 | 30 | void IN_Commands (void); 31 | // oportunity for devices to stick commands on the script buffer 32 | 33 | void IN_Move (usercmd_t *cmd); 34 | // add additional movement on top of the keyboard move cmd 35 | 36 | void IN_ClearStates (void); 37 | // restores all button and position states to defaults 38 | 39 | -------------------------------------------------------------------------------- /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 | #ifdef _XBOX //Marty 22 | #include "xbox\SysInputXbox.h" 23 | #endif 24 | 25 | typedef enum {key_game, key_console, key_message, key_menu} keydest_t; 26 | 27 | extern keydest_t key_dest; 28 | extern char *keybindings[256]; 29 | extern int key_repeats[256]; 30 | extern int key_count; // incremented every key event 31 | extern int key_lastpress; 32 | 33 | void Key_Event (int key, qboolean down); 34 | void Key_Init (void); 35 | void Key_WriteBindings (FILE *f); 36 | void Key_SetBinding (int keynum, char *binding); 37 | void Key_ClearStates (void); -------------------------------------------------------------------------------- /r_vars.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_vars.c: global refresh variables 21 | 22 | #include "quakedef.h" 23 | 24 | #if !id386 25 | 26 | // all global and static refresh variables are collected in a contiguous block 27 | // to avoid cache conflicts. 28 | 29 | //------------------------------------------------------- 30 | // global refresh variables 31 | //------------------------------------------------------- 32 | 33 | // FIXME: make into one big structure, like cl or sv 34 | // FIXME: do separately for refresh engine and driver 35 | 36 | int r_bmodelactive; 37 | 38 | #endif // !id386 39 | 40 | -------------------------------------------------------------------------------- /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 (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 | -------------------------------------------------------------------------------- /d_zpoint.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 | // d_zpoint.c: software driver module for drawing z-buffered points 21 | 22 | #include "quakedef.h" 23 | #include "d_local.h" 24 | 25 | 26 | /* 27 | ===================== 28 | D_DrawZPoint 29 | ===================== 30 | */ 31 | void D_DrawZPoint (void) 32 | { 33 | byte *pdest; 34 | short *pz; 35 | int izi; 36 | 37 | pz = d_pzbuffer + (d_zwidth * r_zpointdesc.v) + r_zpointdesc.u; 38 | pdest = d_viewbuffer + d_scantable[r_zpointdesc.v] + r_zpointdesc.u; 39 | izi = (int)(r_zpointdesc.zi * 0x8000); 40 | 41 | if (*pz <= izi) 42 | { 43 | *pz = izi; 44 | *pdest = r_zpointdesc.color; 45 | } 46 | } 47 | 48 | -------------------------------------------------------------------------------- /net_ser.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_ser.h 21 | 22 | int Serial_Init (void); 23 | void Serial_Listen (qboolean state); 24 | void Serial_SearchForHosts (qboolean xmit); 25 | qsocket_t *Serial_Connect (char *host); 26 | qsocket_t *Serial_CheckNewConnections (void); 27 | int Serial_GetMessage (qsocket_t *sock); 28 | int Serial_SendMessage (qsocket_t *sock, sizebuf_t *data); 29 | int Serial_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data); 30 | qboolean Serial_CanSendMessage (qsocket_t *sock); 31 | qboolean Serial_CanSendUnreliableMessage (qsocket_t *sock); 32 | void Serial_Close (qsocket_t *sock); 33 | void Serial_Shutdown (void); 34 | -------------------------------------------------------------------------------- /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 | #define SBAR_HEIGHT 24 25 | 26 | extern int sb_lines; // scan lines to draw 27 | 28 | void Sbar_Init (void); 29 | 30 | void Sbar_Changed (void); 31 | // call whenever any of the client stats represented on the sbar changes 32 | 33 | void Sbar_Draw (void); 34 | // called every frame by screen 35 | 36 | void Sbar_IntermissionOverlay (void); 37 | // called each frame after the level has been completed 38 | 39 | void Sbar_FinaleOverlay (void); 40 | -------------------------------------------------------------------------------- /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 (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 | -------------------------------------------------------------------------------- /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 | int Datagram_Init (void); 24 | void Datagram_Listen (qboolean state); 25 | void Datagram_SearchForHosts (qboolean xmit); 26 | qsocket_t *Datagram_Connect (char *host); 27 | qsocket_t *Datagram_CheckNewConnections (void); 28 | int Datagram_GetMessage (qsocket_t *sock); 29 | int Datagram_SendMessage (qsocket_t *sock, sizebuf_t *data); 30 | int Datagram_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data); 31 | qboolean Datagram_CanSendMessage (qsocket_t *sock); 32 | qboolean Datagram_CanSendUnreliableMessage (qsocket_t *sock); 33 | void Datagram_Close (qsocket_t *sock); 34 | void Datagram_Shutdown (void); 35 | -------------------------------------------------------------------------------- /nonintel.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 | // nonintel.c: code for non-Intel processors only 22 | // 23 | 24 | #include "quakedef.h" 25 | #include "r_local.h" 26 | #include "d_local.h" 27 | 28 | #if !id386 29 | 30 | /* 31 | ================ 32 | R_Surf8Patch 33 | ================ 34 | */ 35 | void R_Surf8Patch () 36 | { 37 | // we only patch code on Intel 38 | } 39 | 40 | 41 | /* 42 | ================ 43 | R_Surf16Patch 44 | ================ 45 | */ 46 | void R_Surf16Patch () 47 | { 48 | // we only patch code on Intel 49 | } 50 | 51 | 52 | /* 53 | ================ 54 | R_SurfacePatch 55 | ================ 56 | */ 57 | void R_SurfacePatch (void) 58 | { 59 | // we only patch code on Intel 60 | } 61 | 62 | 63 | #endif // !id386 64 | 65 | -------------------------------------------------------------------------------- /D3DQuakeX.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 8.00 2 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "D3DQuakeX", "D3DQuakeX.vcproj", "{AB3749BE-4663-46B8-A18A-87CF13E6B4A8}" 3 | ProjectSection(ProjectDependencies) = postProject 4 | EndProjectSection 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfiguration) = preSolution 8 | Debug = Debug 9 | Profile = Profile 10 | Profile_FastCap = Profile_FastCap 11 | Release = Release 12 | Release_LTCG = Release_LTCG 13 | EndGlobalSection 14 | GlobalSection(ProjectConfiguration) = postSolution 15 | {AB3749BE-4663-46B8-A18A-87CF13E6B4A8}.Debug.ActiveCfg = Release|Xbox 16 | {AB3749BE-4663-46B8-A18A-87CF13E6B4A8}.Debug.Build.0 = Release|Xbox 17 | {AB3749BE-4663-46B8-A18A-87CF13E6B4A8}.Profile.ActiveCfg = Profile|Xbox 18 | {AB3749BE-4663-46B8-A18A-87CF13E6B4A8}.Profile.Build.0 = Profile|Xbox 19 | {AB3749BE-4663-46B8-A18A-87CF13E6B4A8}.Profile_FastCap.ActiveCfg = Profile_FastCap|Xbox 20 | {AB3749BE-4663-46B8-A18A-87CF13E6B4A8}.Profile_FastCap.Build.0 = Profile_FastCap|Xbox 21 | {AB3749BE-4663-46B8-A18A-87CF13E6B4A8}.Release.ActiveCfg = Release|Xbox 22 | {AB3749BE-4663-46B8-A18A-87CF13E6B4A8}.Release.Build.0 = Release|Xbox 23 | {AB3749BE-4663-46B8-A18A-87CF13E6B4A8}.Release_LTCG.ActiveCfg = Release_LTCG|Xbox 24 | {AB3749BE-4663-46B8-A18A-87CF13E6B4A8}.Release_LTCG.Build.0 = Release_LTCG|Xbox 25 | EndGlobalSection 26 | GlobalSection(ExtensibilityGlobals) = postSolution 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityAddIns) = postSolution 29 | EndGlobalSection 30 | EndGlobal 31 | -------------------------------------------------------------------------------- /vregset.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 | // vregset.h: header file for video register-setting interpreter 22 | // 23 | 24 | // 25 | // registers & subregisters 26 | // 27 | #define MISC_OUTPUT 0x3C2 28 | 29 | #define SC_INDEX 0x3C4 30 | #define SC_DATA 0x3C5 31 | #define SYNC_RESET 0 32 | #define MAP_MASK 2 33 | #define MEMORY_MODE 4 34 | 35 | #define GC_INDEX 0x3CE 36 | #define GC_DATA 0x3CF 37 | #define READ_MAP 4 38 | #define GRAPHICS_MODE 5 39 | #define MISCELLANOUS 6 40 | 41 | #define CRTC_INDEX 0x3D4 42 | #define CRTC_DATA 0x3D5 43 | #define MAX_SCAN_LINE 9 44 | #define UNDERLINE 0x14 45 | #define MODE_CONTROL 0x17 46 | 47 | // 48 | // register-set commands 49 | // 50 | #define VRS_END 0 51 | #define VRS_BYTE_OUT 1 52 | #define VRS_BYTE_RMW 2 53 | #define VRS_WORD_OUT 3 54 | 55 | void VideoRegisterSet (int *pregset); 56 | 57 | -------------------------------------------------------------------------------- /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 | extern qpic_t *draw_disc; // also used on sbar 25 | 26 | void Draw_Init (void); 27 | void Draw_Character (int x, int y, int num); 28 | void Draw_DebugChar (char num); 29 | void Draw_Pic (int x, int y, qpic_t *pic); 30 | void Draw_TransPic (int x, int y, qpic_t *pic); 31 | void Draw_TransPicTranslate (int x, int y, qpic_t *pic, byte *translation); 32 | void Draw_ConsoleBackground (int lines); 33 | void Draw_BeginDisc (void); 34 | void Draw_EndDisc (void); 35 | void Draw_TileClear (int x, int y, int w, int h); 36 | void Draw_Fill (int x, int y, int w, int h, int c); 37 | void Draw_FadeScreen (void); 38 | void Draw_String (int x, int y, char *str); 39 | qpic_t *Draw_PicFromWad (char *name); 40 | qpic_t *Draw_CachePic (char *path); 41 | -------------------------------------------------------------------------------- /snd_next.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 | #include "quakedef.h" 22 | 23 | extern int desired_speed; 24 | extern int desired_bits; 25 | 26 | qboolean SNDDMA_Init(void) 27 | { 28 | int size; 29 | 30 | size = 16384 + sizeof(dma_t); 31 | shm = malloc (size); 32 | memset((void*)shm, 0, size); 33 | 34 | shm->buffer = (char*)shm + sizeof(dma_t); 35 | shm->channels = 2; 36 | shm->speed = desired_speed; 37 | shm->samplebits = desired_bits; 38 | shm->samples = 16384 / (desired_bits / 8); 39 | shm->submission_chunk = 1; 40 | 41 | return true; 42 | } 43 | 44 | // return the current sample position (in mono samples read) 45 | // inside the recirculating dma buffer 46 | int SNDDMA_GetDMAPos(void) 47 | { 48 | shm->samplepos = (int)(realtime*shm->speed*shm->channels) & (shm->samples-1); 49 | 50 | return shm->samplepos; 51 | } 52 | 53 | void SNDDMA_Shutdown(void) 54 | { 55 | } 56 | -------------------------------------------------------------------------------- /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 | // 22 | // console 23 | // 24 | extern int con_totallines; 25 | extern int con_backscroll; 26 | extern qboolean con_forcedup; // because no entities to refresh 27 | extern qboolean con_initialized; 28 | extern byte *con_chars; 29 | extern int con_notifylines; // scan lines to clear for notify lines 30 | 31 | void Con_DrawCharacter (int cx, int line, int num); 32 | 33 | void Con_CheckResize (void); 34 | void Con_Init (void); 35 | void Con_DrawConsole (int lines, qboolean drawinput); 36 | void Con_Print (char *txt); 37 | void Con_Printf (char *fmt, ...); 38 | void Con_DPrintf (char *fmt, ...); 39 | void Con_SafePrintf (char *fmt, ...); 40 | void Con_Clear_f (void); 41 | void Con_DrawNotify (void); 42 | void Con_ClearNotify (void); 43 | void Con_ToggleConsole_f (void); 44 | 45 | void Con_NotifyBox (char *text); // during startup for sound / cd warnings 46 | 47 | -------------------------------------------------------------------------------- /d_vars.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_vars.c: global refresh variables 21 | 22 | #if !id386 23 | 24 | #include "quakedef.h" 25 | 26 | // all global and static refresh variables are collected in a contiguous block 27 | // to avoid cache conflicts. 28 | 29 | //------------------------------------------------------- 30 | // global refresh variables 31 | //------------------------------------------------------- 32 | 33 | // FIXME: make into one big structure, like cl or sv 34 | // FIXME: do separately for refresh engine and driver 35 | 36 | float d_sdivzstepu, d_tdivzstepu, d_zistepu; 37 | float d_sdivzstepv, d_tdivzstepv, d_zistepv; 38 | float d_sdivzorigin, d_tdivzorigin, d_ziorigin; 39 | 40 | fixed16_t sadjust, tadjust, bbextents, bbextentt; 41 | 42 | pixel_t *cacheblock; 43 | int cachewidth; 44 | pixel_t *d_viewbuffer; 45 | short *d_pzbuffer; 46 | unsigned int d_zrowbytes; 47 | unsigned int d_zwidth; 48 | 49 | #endif // !id386 50 | 51 | -------------------------------------------------------------------------------- /net_bw.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_bw.h 21 | 22 | int BW_Init (void); 23 | void BW_Shutdown (void); 24 | void BW_Listen (qboolean state); 25 | int BW_OpenSocket (int port); 26 | int BW_CloseSocket (int socket); 27 | int BW_Connect (int socket, struct qsockaddr *addr); 28 | int BW_CheckNewConnections (void); 29 | int BW_Read (int socket, byte *buf, int len, struct qsockaddr *addr); 30 | int BW_Write (int socket, byte *buf, int len, struct qsockaddr *addr); 31 | int BW_Broadcast (int socket, byte *buf, int len); 32 | char *BW_AddrToString (struct qsockaddr *addr); 33 | int BW_StringToAddr (char *string, struct qsockaddr *addr); 34 | int BW_GetSocketAddr (int socket, struct qsockaddr *addr); 35 | int BW_GetNameFromAddr (struct qsockaddr *addr, char *name); 36 | int BW_GetAddrFromName (char *name, struct qsockaddr *addr); 37 | int BW_AddrCompare (struct qsockaddr *addr1, struct qsockaddr *addr2); 38 | int BW_GetSocketPort (struct qsockaddr *addr); 39 | int BW_SetSocketPort (struct qsockaddr *addr, int port); 40 | -------------------------------------------------------------------------------- /net_ipx.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_ipx.h 21 | 22 | int IPX_Init (void); 23 | void IPX_Shutdown (void); 24 | void IPX_Listen (qboolean state); 25 | int IPX_OpenSocket (int port); 26 | int IPX_CloseSocket (int socket); 27 | int IPX_Connect (int socket, struct qsockaddr *addr); 28 | int IPX_CheckNewConnections (void); 29 | int IPX_Read (int socket, byte *buf, int len, struct qsockaddr *addr); 30 | int IPX_Write (int socket, byte *buf, int len, struct qsockaddr *addr); 31 | int IPX_Broadcast (int socket, byte *buf, int len); 32 | char *IPX_AddrToString (struct qsockaddr *addr); 33 | int IPX_StringToAddr (char *string, struct qsockaddr *addr); 34 | int IPX_GetSocketAddr (int socket, struct qsockaddr *addr); 35 | int IPX_GetNameFromAddr (struct qsockaddr *addr, char *name); 36 | int IPX_GetAddrFromName (char *name, struct qsockaddr *addr); 37 | int IPX_AddrCompare (struct qsockaddr *addr1, struct qsockaddr *addr2); 38 | int IPX_GetSocketPort (struct qsockaddr *addr); 39 | int IPX_SetSocketPort (struct qsockaddr *addr, int port); 40 | -------------------------------------------------------------------------------- /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, struct qsockaddr *addr); 28 | int UDP_CheckNewConnections (void); 29 | int UDP_Read (int socket, byte *buf, int len, struct qsockaddr *addr); 30 | int UDP_Write (int socket, byte *buf, int len, struct qsockaddr *addr); 31 | int UDP_Broadcast (int socket, byte *buf, int len); 32 | char *UDP_AddrToString (struct qsockaddr *addr); 33 | int UDP_StringToAddr (char *string, struct qsockaddr *addr); 34 | int UDP_GetSocketAddr (int socket, struct qsockaddr *addr); 35 | int UDP_GetNameFromAddr (struct qsockaddr *addr, char *name); 36 | int UDP_GetAddrFromName (char *name, struct qsockaddr *addr); 37 | int UDP_AddrCompare (struct qsockaddr *addr1, struct qsockaddr *addr2); 38 | int UDP_GetSocketPort (struct qsockaddr *addr); 39 | int UDP_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, struct qsockaddr *addr); 28 | int WINS_CheckNewConnections (void); 29 | int WINS_Read (int socket, byte *buf, int len, struct qsockaddr *addr); 30 | int WINS_Write (int socket, byte *buf, int len, struct qsockaddr *addr); 31 | int WINS_Broadcast (int socket, byte *buf, int len); 32 | char *WINS_AddrToString (struct qsockaddr *addr); 33 | int WINS_StringToAddr (char *string, struct qsockaddr *addr); 34 | int WINS_GetSocketAddr (int socket, struct qsockaddr *addr); 35 | int WINS_GetNameFromAddr (struct qsockaddr *addr, char *name); 36 | int WINS_GetAddrFromName (char *name, struct qsockaddr *addr); 37 | int WINS_AddrCompare (struct qsockaddr *addr1, struct qsockaddr *addr2); 38 | int WINS_GetSocketPort (struct qsockaddr *addr); 39 | int WINS_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, struct qsockaddr *addr); 28 | int WIPX_CheckNewConnections (void); 29 | int WIPX_Read (int socket, byte *buf, int len, struct qsockaddr *addr); 30 | int WIPX_Write (int socket, byte *buf, int len, struct qsockaddr *addr); 31 | int WIPX_Broadcast (int socket, byte *buf, int len); 32 | char *WIPX_AddrToString (struct qsockaddr *addr); 33 | int WIPX_StringToAddr (char *string, struct qsockaddr *addr); 34 | int WIPX_GetSocketAddr (int socket, struct qsockaddr *addr); 35 | int WIPX_GetNameFromAddr (struct qsockaddr *addr, char *name); 36 | int WIPX_GetAddrFromName (char *name, struct qsockaddr *addr); 37 | int WIPX_AddrCompare (struct qsockaddr *addr1, struct qsockaddr *addr2); 38 | int WIPX_GetSocketPort (struct qsockaddr *addr); 39 | int WIPX_SetSocketPort (struct qsockaddr *addr, int port); 40 | -------------------------------------------------------------------------------- /net_mp.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_mpath.h 21 | 22 | int MPATH_Init (void); 23 | void MPATH_Shutdown (void); 24 | void MPATH_Listen (qboolean state); 25 | int MPATH_OpenSocket (int port); 26 | int MPATH_CloseSocket (int socket); 27 | int MPATH_Connect (int socket, struct qsockaddr *addr); 28 | int MPATH_CheckNewConnections (void); 29 | int MPATH_Read (int socket, byte *buf, int len, struct qsockaddr *addr); 30 | int MPATH_Write (int socket, byte *buf, int len, struct qsockaddr *addr); 31 | int MPATH_Broadcast (int socket, byte *buf, int len); 32 | char *MPATH_AddrToString (struct qsockaddr *addr); 33 | int MPATH_StringToAddr (char *string, struct qsockaddr *addr); 34 | int MPATH_GetSocketAddr (int socket, struct qsockaddr *addr); 35 | int MPATH_GetNameFromAddr (struct qsockaddr *addr, char *name); 36 | int MPATH_GetAddrFromName (char *name, struct qsockaddr *addr); 37 | int MPATH_AddrCompare (struct qsockaddr *addr1, struct qsockaddr *addr2); 38 | int MPATH_GetSocketPort (struct qsockaddr *addr); 39 | int MPATH_SetSocketPort (struct qsockaddr *addr, int port); 40 | -------------------------------------------------------------------------------- /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 | 24 | void SCR_UpdateScreen (void); 25 | 26 | 27 | void SCR_SizeUp (void); 28 | void SCR_SizeDown (void); 29 | void SCR_BringDownConsole (void); 30 | void SCR_CenterPrint (char *str); 31 | 32 | void SCR_BeginLoadingPlaque (void); 33 | void SCR_EndLoadingPlaque (void); 34 | 35 | int SCR_ModalMessage (char *text); 36 | 37 | extern float scr_con_current; 38 | extern float scr_conlines; // lines of console to display 39 | 40 | extern int scr_fullupdate; // set to 0 to force full redraw 41 | extern int sb_lines; 42 | 43 | extern int clearnotify; // set to 0 whenever notify text is drawn 44 | extern qboolean scr_disabled_for_loading; 45 | extern qboolean scr_skipupdate; 46 | 47 | extern cvar_t scr_viewsize; 48 | 49 | extern cvar_t scr_viewsize; 50 | 51 | // only the refresh window will be updated unless these variables are flagged 52 | extern int scr_copytop; 53 | extern int scr_copyeverything; 54 | 55 | extern qboolean block_drawing; 56 | 57 | void SCR_UpdateWholeScreen (void); 58 | -------------------------------------------------------------------------------- /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 | //=============== 23 | // TYPES 24 | //=============== 25 | 26 | #define CMP_NONE 0 27 | #define CMP_LZSS 1 28 | 29 | #define TYP_NONE 0 30 | #define TYP_LABEL 1 31 | 32 | #define TYP_LUMPY 64 // 64 + grab command number 33 | #define TYP_PALETTE 64 34 | #define TYP_QTEX 65 35 | #define TYP_QPIC 66 36 | #define TYP_SOUND 67 37 | #define TYP_MIPTEX 68 38 | 39 | typedef struct 40 | { 41 | int width, height; 42 | byte data[4]; // variably sized 43 | } qpic_t; 44 | 45 | 46 | 47 | typedef struct 48 | { 49 | char identification[4]; // should be WAD2 or 2DAW 50 | int numlumps; 51 | int infotableofs; 52 | } wadinfo_t; 53 | 54 | typedef struct 55 | { 56 | int filepos; 57 | int disksize; 58 | int size; // uncompressed 59 | char type; 60 | char compression; 61 | char pad1, pad2; 62 | char name[16]; // must be null terminated 63 | } lumpinfo_t; 64 | 65 | extern int wad_numlumps; 66 | extern lumpinfo_t *wad_lumps; 67 | extern byte *wad_base; 68 | 69 | void W_LoadWadFile (char *filename); 70 | void W_CleanupName (char *in, char *out); 71 | lumpinfo_t *W_GetLumpinfo (char *name); 72 | void *W_GetLumpName (char *name); 73 | void *W_GetLumpNum (int num); 74 | 75 | void SwapPic (qpic_t *pic); 76 | -------------------------------------------------------------------------------- /vregset.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 | // vregset.c: video register-setting interpreter 22 | // 23 | 24 | #include 25 | #include 26 | 27 | #include "quakedef.h" 28 | #include "vregset.h" 29 | 30 | //#define outportb loutportb 31 | 32 | void loutportb (int port, int val) 33 | { 34 | printf ("port, val: %x %x\n", port, val); 35 | getch (); 36 | } 37 | 38 | /* 39 | ================ 40 | VideoRegisterSet 41 | ================ 42 | */ 43 | void VideoRegisterSet (int *pregset) 44 | { 45 | int port, temp0, temp1, temp2; 46 | 47 | for ( ;; ) 48 | { 49 | switch (*pregset++) 50 | { 51 | case VRS_END: 52 | return; 53 | 54 | case VRS_BYTE_OUT: 55 | port = *pregset++; 56 | outportb (port, *pregset++); 57 | break; 58 | 59 | case VRS_BYTE_RMW: 60 | port = *pregset++; 61 | temp0 = *pregset++; 62 | temp1 = *pregset++; 63 | temp2 = inportb (port); 64 | temp2 &= temp0; 65 | temp2 |= temp1; 66 | outportb (port, temp2); 67 | break; 68 | 69 | case VRS_WORD_OUT: 70 | port = *pregset++; 71 | outportb (port, *pregset & 0xFF); 72 | outportb (port+1, *pregset >> 8); 73 | pregset++; 74 | break; 75 | 76 | default: 77 | Sys_Error ("VideoRegisterSet: Invalid command\n"); 78 | } 79 | } 80 | } 81 | 82 | -------------------------------------------------------------------------------- /snd_null.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 | // snd_null.c -- include this instead of all the other snd_* files to have 21 | // no sound code whatsoever 22 | 23 | #include "quakedef.h" 24 | 25 | cvar_t bgmvolume = {"bgmvolume", "1", true}; 26 | cvar_t volume = {"volume", "0.7", true}; 27 | 28 | 29 | void S_Init (void) 30 | { 31 | } 32 | 33 | void S_AmbientOff (void) 34 | { 35 | } 36 | 37 | void S_AmbientOn (void) 38 | { 39 | } 40 | 41 | void S_Shutdown (void) 42 | { 43 | } 44 | 45 | void S_TouchSound (char *sample) 46 | { 47 | } 48 | 49 | void S_ClearBuffer (void) 50 | { 51 | } 52 | 53 | void S_StaticSound (sfx_t *sfx, vec3_t origin, float vol, float attenuation) 54 | { 55 | } 56 | 57 | void S_StartSound (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation) 58 | { 59 | } 60 | 61 | void S_StopSound (int entnum, int entchannel) 62 | { 63 | } 64 | 65 | sfx_t *S_PrecacheSound (char *sample) 66 | { 67 | return NULL; 68 | } 69 | 70 | void S_ClearPrecache (void) 71 | { 72 | } 73 | 74 | void S_Update (vec3_t origin, vec3_t v_forward, vec3_t v_right, vec3_t v_up) 75 | { 76 | } 77 | 78 | void S_StopAllSounds (qboolean clear) 79 | { 80 | } 81 | 82 | void S_BeginPrecaching (void) 83 | { 84 | } 85 | 86 | void S_EndPrecaching (void) 87 | { 88 | } 89 | 90 | void S_ExtraUpdate (void) 91 | { 92 | } 93 | 94 | void S_LocalSound (char *s) 95 | { 96 | } 97 | 98 | -------------------------------------------------------------------------------- /d_fill.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 | // d_clear: clears a specified rectangle to the specified color 21 | 22 | #include "quakedef.h" 23 | 24 | 25 | /* 26 | ================ 27 | D_FillRect 28 | ================ 29 | */ 30 | void D_FillRect (vrect_t *rect, int color) 31 | { 32 | int rx, ry, rwidth, rheight; 33 | unsigned char *dest; 34 | unsigned *ldest; 35 | 36 | rx = rect->x; 37 | ry = rect->y; 38 | rwidth = rect->width; 39 | rheight = rect->height; 40 | 41 | if (rx < 0) 42 | { 43 | rwidth += rx; 44 | rx = 0; 45 | } 46 | if (ry < 0) 47 | { 48 | rheight += ry; 49 | ry = 0; 50 | } 51 | if (rx+rwidth > vid.width) 52 | rwidth = vid.width - rx; 53 | if (ry+rheight > vid.height) 54 | rheight = vid.height - rx; 55 | 56 | if (rwidth < 1 || rheight < 1) 57 | return; 58 | 59 | dest = ((byte *)vid.buffer + ry*vid.rowbytes + rx); 60 | 61 | if (((rwidth & 0x03) == 0) && (((long)dest & 0x03) == 0)) 62 | { 63 | // faster aligned dword clear 64 | ldest = (unsigned *)dest; 65 | color += color << 16; 66 | 67 | rwidth >>= 2; 68 | color += color << 8; 69 | 70 | for (ry=0 ; ryhulls, 0, 0, 1, start, end, &trace); 56 | 57 | VectorCopy (trace.endpos, impact); 58 | } 59 | 60 | void Chase_Update (void) 61 | { 62 | int i; 63 | float dist; 64 | vec3_t forward, up, right; 65 | vec3_t dest, stop; 66 | 67 | 68 | // if can't see player, reset 69 | AngleVectors (cl.viewangles, forward, right, up); 70 | 71 | // calc exact destination 72 | for (i=0 ; i<3 ; i++) 73 | chase_dest[i] = r_refdef.vieworg[i] 74 | - forward[i]*chase_back.value 75 | - right[i]*chase_right.value; 76 | chase_dest[2] = r_refdef.vieworg[2] + chase_up.value; 77 | 78 | // find the spot the player is looking at 79 | VectorMA (r_refdef.vieworg, 4096, forward, dest); 80 | TraceLine (r_refdef.vieworg, dest, stop); 81 | 82 | // calculate pitch to look at the same spot from camera 83 | VectorSubtract (stop, r_refdef.vieworg, stop); 84 | dist = DotProduct (stop, forward); 85 | if (dist < 1) 86 | dist = 1; 87 | r_refdef.viewangles[PITCH] = -atan(stop[2] / dist) / M_PI * 180; 88 | 89 | // move towards destination 90 | VectorCopy (chase_dest, r_refdef.vieworg); 91 | } 92 | 93 | -------------------------------------------------------------------------------- /d_modech.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 | // d_modech.c: called when mode has just changed 21 | 22 | #include "quakedef.h" 23 | #include "d_local.h" 24 | 25 | int d_vrectx, d_vrecty, d_vrectright_particle, d_vrectbottom_particle; 26 | 27 | int d_y_aspect_shift, d_pix_min, d_pix_max, d_pix_shift; 28 | 29 | int d_scantable[MAXHEIGHT]; 30 | short *zspantable[MAXHEIGHT]; 31 | 32 | /* 33 | ================ 34 | D_Patch 35 | ================ 36 | */ 37 | void D_Patch (void) 38 | { 39 | #if id386 40 | 41 | static qboolean protectset8 = false; 42 | 43 | if (!protectset8) 44 | { 45 | Sys_MakeCodeWriteable ((int)D_PolysetAff8Start, 46 | (int)D_PolysetAff8End - (int)D_PolysetAff8Start); 47 | protectset8 = true; 48 | } 49 | 50 | #endif // id386 51 | } 52 | 53 | 54 | /* 55 | ================ 56 | D_ViewChanged 57 | ================ 58 | */ 59 | void D_ViewChanged (void) 60 | { 61 | int rowbytes; 62 | 63 | if (r_dowarp) 64 | rowbytes = WARP_WIDTH; 65 | else 66 | rowbytes = vid.rowbytes; 67 | 68 | scale_for_mip = xscale; 69 | if (yscale > xscale) 70 | scale_for_mip = yscale; 71 | 72 | d_zrowbytes = vid.width * 2; 73 | d_zwidth = vid.width; 74 | 75 | d_pix_min = r_refdef.vrect.width / 320; 76 | if (d_pix_min < 1) 77 | d_pix_min = 1; 78 | 79 | d_pix_max = (int)((float)r_refdef.vrect.width / (320.0 / 4.0) + 0.5); 80 | d_pix_shift = 8 - (int)((float)r_refdef.vrect.width / 320.0 + 0.5); 81 | if (d_pix_max < 1) 82 | d_pix_max = 1; 83 | 84 | if (pixelAspect > 1.4) 85 | d_y_aspect_shift = 1; 86 | else 87 | d_y_aspect_shift = 0; 88 | 89 | d_vrectx = r_refdef.vrect.x; 90 | d_vrecty = r_refdef.vrect.y; 91 | d_vrectright_particle = r_refdef.vrectright - d_pix_max; 92 | d_vrectbottom_particle = 93 | r_refdef.vrectbottom - (d_pix_max << d_y_aspect_shift); 94 | 95 | { 96 | int i; 97 | 98 | for (i=0 ; iv.modified 52 | 53 | void SV_LinkEdict (edict_t *ent, qboolean touch_triggers); 54 | // Needs to be called any time an entity changes origin, mins, maxs, or solid 55 | // flags ent->v.modified 56 | // sets ent->v.absmin and ent->v.absmax 57 | // if touchtriggers, calls prog functions for the intersected triggers 58 | 59 | int SV_PointContents (vec3_t p); 60 | int SV_TruePointContents (vec3_t p); 61 | // returns the CONTENTS_* value from the world at the given point. 62 | // does not check any entities at all 63 | // the non-true version remaps the water current contents to content_water 64 | 65 | edict_t *SV_TestEntityPosition (edict_t *ent); 66 | 67 | trace_t SV_Move (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int type, edict_t *passedict); 68 | // mins and maxs are reletive 69 | 70 | // if the entire move stays in a solid volume, trace.allsolid will be set 71 | 72 | // if the starting point is in a solid, it will be allowed to move out 73 | // to an open area 74 | 75 | // nomonsters is used for line of sight or edge testing, where mosnters 76 | // shouldn't be considered solid objects 77 | 78 | // passedict is explicitly excluded from clipping checks (normally NULL) 79 | -------------------------------------------------------------------------------- /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 | // 31 | // !!! note that this file must match the corresponding C structures at all 32 | // times !!! 33 | // 34 | 35 | // plane_t structure 36 | // !!! if this is changed, it must be changed in model.h too !!! 37 | // !!! if the size of this is changed, the array lookup in SV_HullPointContents 38 | // must be changed too !!! 39 | #define pl_normal 0 40 | #define pl_dist 12 41 | #define pl_type 16 42 | #define pl_signbits 17 43 | #define pl_pad 18 44 | #define pl_size 20 45 | 46 | // hull_t structure 47 | // !!! if this is changed, it must be changed in model.h too !!! 48 | #define hu_clipnodes 0 49 | #define hu_planes 4 50 | #define hu_firstclipnode 8 51 | #define hu_lastclipnode 12 52 | #define hu_clip_mins 16 53 | #define hu_clip_maxs 28 54 | #define hu_size 40 55 | 56 | // dnode_t structure 57 | // !!! if this is changed, it must be changed in bspfile.h too !!! 58 | #define nd_planenum 0 59 | #define nd_children 4 60 | #define nd_mins 8 61 | #define nd_maxs 20 62 | #define nd_firstface 32 63 | #define nd_numfaces 36 64 | #define nd_size 40 65 | 66 | // sfxcache_t structure 67 | // !!! if this is changed, it much be changed in sound.h too !!! 68 | #define sfxc_length 0 69 | #define sfxc_loopstart 4 70 | #define sfxc_speed 8 71 | #define sfxc_width 12 72 | #define sfxc_stereo 16 73 | #define sfxc_data 20 74 | 75 | // channel_t structure 76 | // !!! if this is changed, it much be changed in sound.h too !!! 77 | #define ch_sfx 0 78 | #define ch_leftvol 4 79 | #define ch_rightvol 8 80 | #define ch_end 12 81 | #define ch_pos 16 82 | #define ch_looping 20 83 | #define ch_entnum 24 84 | #define ch_entchannel 28 85 | #define ch_origin 32 86 | #define ch_dist_mult 44 87 | #define ch_master_vol 48 88 | #define ch_size 52 89 | 90 | // portable_samplepair_t structure 91 | // !!! if this is changed, it much be changed in sound.h too !!! 92 | #define psp_left 0 93 | #define psp_right 4 94 | #define psp_size 8 95 | 96 | #endif 97 | 98 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /xbox/SysInputXbox.h: -------------------------------------------------------------------------------- 1 | #ifndef H_SYSXBOXINPUT 2 | #define H_SYSXBOXINPUT 3 | 4 | // 5 | // these are the key numbers that should be passed to Key_Event 6 | // 7 | #define K_TAB 9 8 | #define K_ENTER 13 9 | #define K_ESCAPE 27 10 | #define K_SPACE 32 11 | 12 | // normal keys should be passed as lowercased ascii 13 | 14 | #define K_BACKSPACE 127 15 | #define K_UPARROW 128 16 | #define K_DOWNARROW 129 17 | #define K_LEFTARROW 130 18 | #define K_RIGHTARROW 131 19 | 20 | #define K_ALT 132 21 | #define K_CTRL 133 22 | #define K_SHIFT 134 23 | #define K_F1 135 24 | #define K_F2 136 25 | #define K_F3 137 26 | #define K_F4 138 27 | #define K_F5 139 28 | #define K_F6 140 29 | #define K_F7 141 30 | #define K_F8 142 31 | #define K_F9 143 32 | #define K_F10 144 33 | #define K_F11 145 34 | #define K_F12 146 35 | #define K_INS 147 36 | #define K_DEL 148 37 | #define K_PGDN 149 38 | #define K_PGUP 150 39 | #define K_HOME 151 40 | #define K_END 152 41 | 42 | #define K_PAUSE 255 43 | 44 | // 45 | // mouse buttons generate virtual keys 46 | // 47 | #define K_MOUSE1 200 48 | #define K_MOUSE2 201 49 | #define K_MOUSE3 202 50 | 51 | // 52 | // joystick buttons 53 | // 54 | #define K_JOY1 203 55 | #define K_JOY2 204 56 | #define K_JOY3 205 57 | #define K_JOY4 206 58 | #define K_AUX1 207 59 | // 60 | // aux keys are for multi-buttoned joysticks to generate so they can use 61 | // the normal binding process 62 | // 63 | #define K_XBOX_A 207 64 | #define K_XBOX_B 208 65 | #define K_XBOX_X 209 66 | #define K_XBOX_Y 210 67 | #define K_XBOX_BACK 211 68 | #define K_XBOX_START 212 69 | #define K_DPAD_UP 213 70 | #define K_DPAD_DOWN 214 71 | #define K_DPAD_LEFT 215 72 | #define K_DPAD_RIGHT 216 73 | #define K_XBOX_LTRIG 217 74 | #define K_XBOX_RTRIG 218 75 | #define K_XBOX_QCOMBO 219 76 | #define K_AUX13 220 77 | #define K_AUX14 221 78 | #define K_AUX15 222 79 | #define K_AUX16 223 80 | #define K_AUX17 224 81 | #define K_AUX18 225 82 | #define K_AUX19 226 83 | #define K_AUX20 227 84 | #define K_AUX21 228 85 | #define K_AUX22 229 86 | #define K_AUX23 230 87 | #define K_AUX24 231 88 | #define K_AUX25 232 89 | #define K_AUX26 233 90 | #define K_AUX27 234 91 | #define K_AUX28 235 92 | #define K_AUX29 236 93 | #define K_AUX30 237 94 | #define K_AUX31 238 95 | #define K_AUX32 239 96 | 97 | // JACK: Intellimouse(c) Mouse Wheel Support 98 | 99 | #define K_MWHEELUP 239 100 | #define K_MWHEELDOWN 240 101 | 102 | //============================================ 103 | 104 | #ifdef __cplusplus 105 | extern "C" 106 | { 107 | #endif 108 | 109 | typedef struct XBGamepadInfo 110 | { 111 | //Buttons 112 | int iKey; 113 | int iButtonDown; 114 | 115 | //Thumbsticks 116 | float fThumbLX; 117 | float fThumbLY; 118 | float fThumbRX; 119 | float fThumbRY; 120 | } sXBGamepadInfo; 121 | 122 | int UpdateGamepad(sXBGamepadInfo *pGamepadInfo); 123 | 124 | #ifdef __cplusplus 125 | } 126 | #endif 127 | 128 | #endif -------------------------------------------------------------------------------- /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 << VID_CBITS) 24 | 25 | // a pixel can be one, two, or four bytes 26 | typedef byte pixel_t; 27 | 28 | typedef struct vrect_s 29 | { 30 | int x,y,width,height; 31 | struct vrect_s *pnext; 32 | } vrect_t; 33 | 34 | typedef struct 35 | { 36 | pixel_t *buffer; // invisible buffer 37 | pixel_t *colormap; // 256 * VID_GRADES size 38 | unsigned short *colormap16; // 256 * VID_GRADES size 39 | int fullbright; // index of first fullbright color 40 | unsigned rowbytes; // may be > width if displayed in a window 41 | unsigned width; 42 | unsigned height; 43 | float aspect; // width / height -- < 0 is taller than wide 44 | int numpages; 45 | int recalc_refdef; // if true, recalc vid-based stuff 46 | pixel_t *conbuffer; 47 | int conrowbytes; 48 | unsigned conwidth; 49 | unsigned conheight; 50 | int maxwarpwidth; 51 | int maxwarpheight; 52 | pixel_t *direct; // direct drawing to framebuffer, if not 53 | // NULL 54 | } viddef_t; 55 | 56 | extern viddef_t vid; // global video state 57 | extern unsigned short d_8to16table[256]; 58 | extern unsigned d_8to24table[256]; 59 | extern void (*vid_menudrawfn)(void); 60 | extern void (*vid_menukeyfn)(int key); 61 | 62 | void VID_SetPalette (unsigned char *palette); 63 | // called at startup and after any gamma correction 64 | 65 | void VID_ShiftPalette (unsigned char *palette); 66 | // called for bonus and pain flashes, and for underwater color changes 67 | 68 | void VID_Init (unsigned char *palette); 69 | // Called at startup to set up translation tables, takes 256 8 bit RGB values 70 | // the palette data will go away after the call, so it must be copied off if 71 | // the video driver will need it again 72 | 73 | void VID_Shutdown (void); 74 | // Called at shutdown 75 | 76 | void VID_Update (vrect_t *rects); 77 | // flushes the given rectangles from the view buffer to the screen 78 | 79 | int VID_SetMode (int modenum, unsigned char *palette); 80 | // sets the mode; only used by the Quake engine for resetting to mode 0 (the 81 | // base mode) on memory allocation failures 82 | 83 | void VID_HandlePause (qboolean pause); 84 | // called only on Win32, when pause happens, so the mouse can be released 85 | 86 | #ifdef GLQUAKE 87 | qboolean VID_Is8bit(void); 88 | #endif -------------------------------------------------------------------------------- /vid_dos.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_dos.h: header file for DOS-specific video stuff 21 | 22 | typedef struct vmode_s { 23 | struct vmode_s *pnext; 24 | char *name; 25 | char *header; 26 | unsigned width; 27 | unsigned height; 28 | float aspect; 29 | unsigned rowbytes; 30 | int planar; 31 | int numpages; 32 | void *pextradata; 33 | int (*setmode)(viddef_t *vid, struct vmode_s *pcurrentmode); 34 | void (*swapbuffers)(viddef_t *vid, struct vmode_s *pcurrentmode, 35 | vrect_t *rects); 36 | void (*setpalette)(viddef_t *vid, struct vmode_s *pcurrentmode, 37 | unsigned char *palette); 38 | void (*begindirectrect)(viddef_t *vid, struct vmode_s *pcurrentmode, 39 | int x, int y, byte *pbitmap, int width, 40 | int height); 41 | void (*enddirectrect)(viddef_t *vid, struct vmode_s *pcurrentmode, 42 | int x, int y, int width, int height); 43 | } vmode_t; 44 | 45 | // vid_wait settings 46 | #define VID_WAIT_NONE 0 47 | #define VID_WAIT_VSYNC 1 48 | #define VID_WAIT_DISPLAY_ENABLE 2 49 | 50 | extern int numvidmodes; 51 | extern vmode_t *pvidmodes; 52 | 53 | extern int VGA_width, VGA_height, VGA_rowbytes, VGA_bufferrowbytes; 54 | extern byte *VGA_pagebase; 55 | extern vmode_t *VGA_pcurmode; 56 | 57 | extern cvar_t vid_wait; 58 | extern cvar_t vid_nopageflip; 59 | extern cvar_t _vid_wait_override; 60 | 61 | extern unsigned char colormap256[32][256]; 62 | 63 | extern void *vid_surfcache; 64 | extern int vid_surfcachesize; 65 | 66 | void VGA_Init (void); 67 | void VID_InitVESA (void); 68 | void VID_InitExtra (void); 69 | void VGA_WaitVsync (void); 70 | void VGA_ClearVideoMem (int planar); 71 | void VGA_SetPalette(viddef_t *vid, vmode_t *pcurrentmode, unsigned char *pal); 72 | void VGA_SwapBuffersCopy (viddef_t *vid, vmode_t *pcurrentmode, 73 | vrect_t *rects); 74 | qboolean VGA_FreeAndAllocVidbuffer (viddef_t *vid, int allocnewbuffer); 75 | qboolean VGA_CheckAdequateMem (int width, int height, int rowbytes, 76 | int allocnewbuffer); 77 | void VGA_BeginDirectRect (viddef_t *vid, struct vmode_s *pcurrentmode, int x, 78 | int y, byte *pbitmap, int width, int height); 79 | void VGA_EndDirectRect (viddef_t *vid, struct vmode_s *pcurrentmode, int x, 80 | int y, int width, int height); 81 | void VGA_UpdateLinearScreen (void *srcptr, void *destptr, int width, 82 | int height, int srcrowbytes, int destrowbytes); 83 | 84 | -------------------------------------------------------------------------------- /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 | extern vec3_t vec3_origin; 37 | extern int nanmask; 38 | 39 | #define IS_NAN(x) (((*(int *)&x)&nanmask)==nanmask) 40 | 41 | #define DotProduct(x,y) (x[0]*y[0]+x[1]*y[1]+x[2]*y[2]) 42 | #define VectorSubtract(a,b,c) {c[0]=a[0]-b[0];c[1]=a[1]-b[1];c[2]=a[2]-b[2];} 43 | #define VectorAdd(a,b,c) {c[0]=a[0]+b[0];c[1]=a[1]+b[1];c[2]=a[2]+b[2];} 44 | #define VectorCopy(a,b) {b[0]=a[0];b[1]=a[1];b[2]=a[2];} 45 | 46 | void VectorMA (vec3_t veca, float scale, vec3_t vecb, vec3_t vecc); 47 | 48 | vec_t _DotProduct (vec3_t v1, vec3_t v2); 49 | void _VectorSubtract (vec3_t veca, vec3_t vecb, vec3_t out); 50 | void _VectorAdd (vec3_t veca, vec3_t vecb, vec3_t out); 51 | void _VectorCopy (vec3_t in, vec3_t out); 52 | 53 | int VectorCompare (vec3_t v1, vec3_t v2); 54 | vec_t Length (vec3_t v); 55 | void CrossProduct (vec3_t v1, vec3_t v2, vec3_t cross); 56 | float VectorNormalize (vec3_t v); // returns vector length 57 | void VectorInverse (vec3_t v); 58 | void VectorScale (vec3_t in, vec_t scale, vec3_t out); 59 | int Q_log2(int val); 60 | 61 | void R_ConcatRotations (float in1[3][3], float in2[3][3], float out[3][3]); 62 | void R_ConcatTransforms (float in1[3][4], float in2[3][4], float out[3][4]); 63 | 64 | void FloorDivMod (double numer, double denom, int *quotient, 65 | int *rem); 66 | fixed16_t Invert24To16(fixed16_t val); 67 | int GreatestCommonDivisor (int i1, int i2); 68 | 69 | void AngleVectors (vec3_t angles, vec3_t forward, vec3_t right, vec3_t up); 70 | int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, struct mplane_s *plane); 71 | float anglemod(float a); 72 | 73 | void RotatePointAroundVector( vec3_t dst, const vec3_t dir, const vec3_t point, float degrees ); 74 | 75 | #define BOX_ON_PLANE_SIDE(emins, emaxs, p) \ 76 | (((p)->type < 3)? \ 77 | ( \ 78 | ((p)->dist <= (emins)[(p)->type])? \ 79 | 1 \ 80 | : \ 81 | ( \ 82 | ((p)->dist >= (emaxs)[(p)->type])?\ 83 | 2 \ 84 | : \ 85 | 3 \ 86 | ) \ 87 | ) \ 88 | : \ 89 | BoxOnPlaneSide( (emins), (emaxs), (p))) 90 | -------------------------------------------------------------------------------- /progdefs.q1: -------------------------------------------------------------------------------- 1 | 2 | /* file generated by qcc, do not modify */ 3 | 4 | typedef struct 5 | { int pad[28]; 6 | int self; 7 | int other; 8 | int world; 9 | float time; 10 | float frametime; 11 | float force_retouch; 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 | int msg_entity; 50 | func_t main; 51 | func_t StartFrame; 52 | func_t PlayerPreThink; 53 | func_t PlayerPostThink; 54 | func_t ClientKill; 55 | func_t ClientConnect; 56 | func_t PutClientInServer; 57 | func_t ClientDisconnect; 58 | func_t SetNewParms; 59 | func_t SetChangeParms; 60 | } globalvars_t; 61 | 62 | typedef struct 63 | { 64 | float modelindex; 65 | vec3_t absmin; 66 | vec3_t absmax; 67 | float ltime; 68 | float movetype; 69 | float solid; 70 | vec3_t origin; 71 | vec3_t oldorigin; 72 | vec3_t velocity; 73 | vec3_t angles; 74 | vec3_t avelocity; 75 | vec3_t punchangle; 76 | string_t classname; 77 | string_t model; 78 | float frame; 79 | float skin; 80 | float effects; 81 | vec3_t mins; 82 | vec3_t maxs; 83 | vec3_t size; 84 | func_t touch; 85 | func_t use; 86 | func_t think; 87 | func_t blocked; 88 | float nextthink; 89 | int groundentity; 90 | float health; 91 | float frags; 92 | float weapon; 93 | string_t weaponmodel; 94 | float weaponframe; 95 | float currentammo; 96 | float ammo_shells; 97 | float ammo_nails; 98 | float ammo_rockets; 99 | float ammo_cells; 100 | float items; 101 | float takedamage; 102 | int chain; 103 | float deadflag; 104 | vec3_t view_ofs; 105 | float button0; 106 | float button1; 107 | float button2; 108 | float impulse; 109 | float fixangle; 110 | vec3_t v_angle; 111 | float idealpitch; 112 | string_t netname; 113 | int enemy; 114 | float flags; 115 | float colormap; 116 | float team; 117 | float max_health; 118 | float teleport_time; 119 | float armortype; 120 | float armorvalue; 121 | float waterlevel; 122 | float watertype; 123 | float ideal_yaw; 124 | float yaw_speed; 125 | int aiment; 126 | int goalentity; 127 | float spawnflags; 128 | string_t target; 129 | string_t targetname; 130 | float dmg_take; 131 | float dmg_save; 132 | int dmg_inflictor; 133 | int owner; 134 | vec3_t movedir; 135 | string_t message; 136 | float sounds; 137 | string_t noise; 138 | string_t noise1; 139 | string_t noise2; 140 | string_t noise3; 141 | } entvars_t; 142 | 143 | #define PROGHEADER_CRC 5927 144 | -------------------------------------------------------------------------------- /d_ifacea.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 | // d_ifacea.h 22 | // 23 | // Include file for asm driver interface. 24 | // 25 | 26 | // 27 | // !!! note that this file must match the corresponding C structures in 28 | // d_iface.h at all times !!! 29 | // 30 | 31 | // !!! if this is changed, it must be changed in r_shared.h too !!! 32 | #define ALIAS_ONSEAM 0x0020 33 | 34 | // !!! if this is changed, it must be changed in d_iface.h too !!! 35 | #define TURB_TEX_SIZE 64 // base turbulent texture size 36 | 37 | // !!! if this is changed, it must be changed in d_iface.h too !!! 38 | #define CYCLE 128 39 | 40 | // !!! if this is changed, it must be changed in r_shared.h too !!! 41 | #define MAXHEIGHT 1024 42 | 43 | // !!! if this is changed, it must be changed in quakedef.h too !!! 44 | #define CACHE_SIZE 32 // used to align key data structures 45 | 46 | // particle_t structure 47 | // !!! if this is changed, it must be changed in d_iface.h too !!! 48 | // driver-usable fields 49 | #define pt_org 0 50 | #define pt_color 12 51 | // drivers never touch the following fields 52 | #define pt_next 16 53 | #define pt_vel 20 54 | #define pt_ramp 32 55 | #define pt_die 36 56 | #define pt_type 40 57 | #define pt_size 44 58 | 59 | #define PARTICLE_Z_CLIP 8.0 60 | 61 | // finalvert_t structure 62 | // !!! if this is changed, it must be changed in d_iface.h too !!! 63 | #define fv_v 0 // !!! if this is moved, cases where the !!! 64 | // !!! address of this field is pushed in !!! 65 | // !!! d_polysa.s must be changed !!! 66 | #define fv_flags 24 67 | #define fv_reserved 28 68 | #define fv_size 32 69 | #define fv_shift 5 70 | 71 | 72 | // stvert_t structure 73 | // !!! if this is changed, it must be changed in modelgen.h too !!! 74 | #define stv_onseam 0 75 | #define stv_s 4 76 | #define stv_t 8 77 | #define stv_size 12 78 | 79 | 80 | // trivertx_t structure 81 | // !!! if this is changed, it must be changed in modelgen.h too !!! 82 | #define tv_v 0 83 | #define tv_lightnormalindex 3 84 | #define tv_size 4 85 | 86 | // affinetridesc_t structure 87 | // !!! if this is changed, it must be changed in d_iface.h too !!! 88 | #define atd_pskin 0 89 | #define atd_pskindesc 4 90 | #define atd_skinwidth 8 91 | #define atd_skinheight 12 92 | #define atd_ptriangles 16 93 | #define atd_pfinalverts 20 94 | #define atd_numtriangles 24 95 | #define atd_drawtype 28 96 | #define atd_seamfixupX16 32 97 | #define atd_size 36 98 | 99 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | // 21 | // spritegn.h: header file for sprite generation program 22 | // 23 | 24 | // ********************************************************** 25 | // * This file must be identical in the spritegen directory * 26 | // * and in the Quake directory, because it's used to * 27 | // * pass data from one to the other via .spr files. * 28 | // ********************************************************** 29 | 30 | //------------------------------------------------------- 31 | // This program generates .spr sprite package files. 32 | // The format of the files is as follows: 33 | // 34 | // dsprite_t file header structure 35 | // 36 | // 37 | // dspriteframe_t frame header structure 38 | // sprite bitmap 39 | // 40 | // dspriteframe_t frame header structure 41 | // sprite bitmap 42 | // 43 | //------------------------------------------------------- 44 | 45 | #ifdef INCLUDELIBS 46 | 47 | #include 48 | #include 49 | #include 50 | #include 51 | 52 | #include "cmdlib.h" 53 | #include "scriplib.h" 54 | #include "dictlib.h" 55 | #include "trilib.h" 56 | #include "lbmlib.h" 57 | #include "mathlib.h" 58 | 59 | #endif 60 | 61 | #define SPRITE_VERSION 1 62 | 63 | // must match definition in modelgen.h 64 | #ifndef SYNCTYPE_T 65 | #define SYNCTYPE_T 66 | typedef enum {ST_SYNC=0, ST_RAND } synctype_t; 67 | #endif 68 | 69 | // TODO: shorten these? 70 | typedef struct { 71 | int ident; 72 | int version; 73 | int type; 74 | float boundingradius; 75 | int width; 76 | int height; 77 | int numframes; 78 | float beamlength; 79 | synctype_t synctype; 80 | } dsprite_t; 81 | 82 | #define SPR_VP_PARALLEL_UPRIGHT 0 83 | #define SPR_FACING_UPRIGHT 1 84 | #define SPR_VP_PARALLEL 2 85 | #define SPR_ORIENTED 3 86 | #define SPR_VP_PARALLEL_ORIENTED 4 87 | 88 | typedef struct { 89 | int origin[2]; 90 | int width; 91 | int height; 92 | } dspriteframe_t; 93 | 94 | typedef struct { 95 | int numframes; 96 | } dspritegroup_t; 97 | 98 | typedef struct { 99 | float interval; 100 | } dspriteinterval_t; 101 | 102 | typedef enum { SPR_SINGLE=0, SPR_GROUP } spriteframetype_t; 103 | 104 | typedef struct { 105 | spriteframetype_t type; 106 | } dspriteframetype_t; 107 | 108 | #define IDSPRITEHEADER (('P'<<24)+('S'<<16)+('D'<<8)+'I') 109 | // little-endian "IDSP" 110 | 111 | -------------------------------------------------------------------------------- /block8.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 | LEnter16_8: 21 | movb (%esi),%al 22 | movb (%esi,%ebx,),%cl 23 | movb %dh,%ah 24 | addl %ebp,%edx 25 | movb %dh,%ch 26 | leal (%esi,%ebx,2),%esi 27 | movb 0x12345678(%eax),%al 28 | LBPatch0: 29 | addl %ebp,%edx 30 | movb %al,(%edi) 31 | movb 0x12345678(%ecx),%cl 32 | LBPatch1: 33 | movb %cl,1(%edi) 34 | addl $0x2,%edi 35 | 36 | movb (%esi),%al 37 | movb (%esi,%ebx,),%cl 38 | movb %dh,%ah 39 | addl %ebp,%edx 40 | movb %dh,%ch 41 | leal (%esi,%ebx,2),%esi 42 | movb 0x12345678(%eax),%al 43 | LBPatch2: 44 | addl %ebp,%edx 45 | movb %al,(%edi) 46 | movb 0x12345678(%ecx),%cl 47 | LBPatch3: 48 | movb %cl,1(%edi) 49 | addl $0x2,%edi 50 | 51 | movb (%esi),%al 52 | movb (%esi,%ebx,),%cl 53 | movb %dh,%ah 54 | addl %ebp,%edx 55 | movb %dh,%ch 56 | leal (%esi,%ebx,2),%esi 57 | movb 0x12345678(%eax),%al 58 | LBPatch4: 59 | addl %ebp,%edx 60 | movb %al,(%edi) 61 | movb 0x12345678(%ecx),%cl 62 | LBPatch5: 63 | movb %cl,1(%edi) 64 | addl $0x2,%edi 65 | 66 | movb (%esi),%al 67 | movb (%esi,%ebx,),%cl 68 | movb %dh,%ah 69 | addl %ebp,%edx 70 | movb %dh,%ch 71 | leal (%esi,%ebx,2),%esi 72 | movb 0x12345678(%eax),%al 73 | LBPatch6: 74 | addl %ebp,%edx 75 | movb %al,(%edi) 76 | movb 0x12345678(%ecx),%cl 77 | LBPatch7: 78 | movb %cl,1(%edi) 79 | addl $0x2,%edi 80 | 81 | LEnter8_8: 82 | movb (%esi),%al 83 | movb (%esi,%ebx,),%cl 84 | movb %dh,%ah 85 | addl %ebp,%edx 86 | movb %dh,%ch 87 | leal (%esi,%ebx,2),%esi 88 | movb 0x12345678(%eax),%al 89 | LBPatch8: 90 | addl %ebp,%edx 91 | movb %al,(%edi) 92 | movb 0x12345678(%ecx),%cl 93 | LBPatch9: 94 | movb %cl,1(%edi) 95 | addl $0x2,%edi 96 | 97 | movb (%esi),%al 98 | movb (%esi,%ebx,),%cl 99 | movb %dh,%ah 100 | addl %ebp,%edx 101 | movb %dh,%ch 102 | leal (%esi,%ebx,2),%esi 103 | movb 0x12345678(%eax),%al 104 | LBPatch10: 105 | addl %ebp,%edx 106 | movb %al,(%edi) 107 | movb 0x12345678(%ecx),%cl 108 | LBPatch11: 109 | movb %cl,1(%edi) 110 | addl $0x2,%edi 111 | 112 | LEnter4_8: 113 | movb (%esi),%al 114 | movb (%esi,%ebx,),%cl 115 | movb %dh,%ah 116 | addl %ebp,%edx 117 | movb %dh,%ch 118 | leal (%esi,%ebx,2),%esi 119 | movb 0x12345678(%eax),%al 120 | LBPatch12: 121 | addl %ebp,%edx 122 | movb %al,(%edi) 123 | movb 0x12345678(%ecx),%cl 124 | LBPatch13: 125 | movb %cl,1(%edi) 126 | addl $0x2,%edi 127 | 128 | LEnter2_8: 129 | movb (%esi),%al 130 | movb (%esi,%ebx,),%cl 131 | movb %dh,%ah 132 | addl %ebp,%edx 133 | movb %dh,%ch 134 | leal (%esi,%ebx,2),%esi 135 | movb 0x12345678(%eax),%al 136 | LBPatch14: 137 | addl %ebp,%edx 138 | movb %al,(%edi) 139 | movb 0x12345678(%ecx),%cl 140 | LBPatch15: 141 | movb %cl,1(%edi) 142 | addl $0x2,%edi 143 | 144 | -------------------------------------------------------------------------------- /block16.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 | LEnter16_16: 21 | movb (%esi),%al 22 | movb (%esi,%ebx,),%cl 23 | movb %dh,%ah 24 | addl %ebp,%edx 25 | movb %dh,%ch 26 | leal (%esi,%ebx,2),%esi 27 | movw 0x12345678(,%eax,2),%ax 28 | LBPatch0: 29 | addl %ebp,%edx 30 | movw %ax,(%edi) 31 | movw 0x12345678(,%ecx,2),%cx 32 | LBPatch1: 33 | movw %cx,2(%edi) 34 | addl $0x4,%edi 35 | 36 | movb (%esi),%al 37 | movb (%esi,%ebx,),%cl 38 | movb %dh,%ah 39 | addl %ebp,%edx 40 | movb %dh,%ch 41 | leal (%esi,%ebx,2),%esi 42 | movw 0x12345678(,%eax,2),%ax 43 | LBPatch2: 44 | addl %ebp,%edx 45 | movw %ax,(%edi) 46 | movw 0x12345678(,%ecx,2),%cx 47 | LBPatch3: 48 | movw %cx,2(%edi) 49 | addl $0x4,%edi 50 | 51 | movb (%esi),%al 52 | movb (%esi,%ebx,),%cl 53 | movb %dh,%ah 54 | addl %ebp,%edx 55 | movb %dh,%ch 56 | leal (%esi,%ebx,2),%esi 57 | movw 0x12345678(,%eax,2),%ax 58 | LBPatch4: 59 | addl %ebp,%edx 60 | movw %ax,(%edi) 61 | movw 0x12345678(,%ecx,2),%cx 62 | LBPatch5: 63 | movw %cx,2(%edi) 64 | addl $0x4,%edi 65 | 66 | movb (%esi),%al 67 | movb (%esi,%ebx,),%cl 68 | movb %dh,%ah 69 | addl %ebp,%edx 70 | movb %dh,%ch 71 | leal (%esi,%ebx,2),%esi 72 | movw 0x12345678(,%eax,2),%ax 73 | LBPatch6: 74 | addl %ebp,%edx 75 | movw %ax,(%edi) 76 | movw 0x12345678(,%ecx,2),%cx 77 | LBPatch7: 78 | movw %cx,2(%edi) 79 | addl $0x4,%edi 80 | 81 | LEnter8_16: 82 | movb (%esi),%al 83 | movb (%esi,%ebx,),%cl 84 | movb %dh,%ah 85 | addl %ebp,%edx 86 | movb %dh,%ch 87 | leal (%esi,%ebx,2),%esi 88 | movw 0x12345678(,%eax,2),%ax 89 | LBPatch8: 90 | addl %ebp,%edx 91 | movw %ax,(%edi) 92 | movw 0x12345678(,%ecx,2),%cx 93 | LBPatch9: 94 | movw %cx,2(%edi) 95 | addl $0x4,%edi 96 | 97 | movb (%esi),%al 98 | movb (%esi,%ebx,),%cl 99 | movb %dh,%ah 100 | addl %ebp,%edx 101 | movb %dh,%ch 102 | leal (%esi,%ebx,2),%esi 103 | movw 0x12345678(,%eax,2),%ax 104 | LBPatch10: 105 | addl %ebp,%edx 106 | movw %ax,(%edi) 107 | movw 0x12345678(,%ecx,2),%cx 108 | LBPatch11: 109 | movw %cx,2(%edi) 110 | addl $0x4,%edi 111 | 112 | LEnter4_16: 113 | movb (%esi),%al 114 | movb (%esi,%ebx,),%cl 115 | movb %dh,%ah 116 | addl %ebp,%edx 117 | movb %dh,%ch 118 | leal (%esi,%ebx,2),%esi 119 | movw 0x12345678(,%eax,2),%ax 120 | LBPatch12: 121 | addl %ebp,%edx 122 | movw %ax,(%edi) 123 | movw 0x12345678(,%ecx,2),%cx 124 | LBPatch13: 125 | movw %cx,2(%edi) 126 | addl $0x4,%edi 127 | 128 | LEnter2_16: 129 | movb (%esi),%al 130 | movb (%esi,%ebx,),%cl 131 | movb %dh,%ah 132 | addl %ebp,%edx 133 | movb %dh,%ch 134 | leal (%esi,%ebx,2),%esi 135 | movw 0x12345678(,%eax,2),%ax 136 | LBPatch14: 137 | addl %ebp,%edx 138 | movw %ax,(%edi) 139 | movw 0x12345678(,%ecx,2),%cx 140 | LBPatch15: 141 | movw %cx,2(%edi) 142 | addl $0x4,%edi 143 | -------------------------------------------------------------------------------- /d_local.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 | // d_local.h: private rasterization driver defs 21 | 22 | #include "r_shared.h" 23 | 24 | // 25 | // TODO: fine-tune this; it's based on providing some overage even if there 26 | // is a 2k-wide scan, with subdivision every 8, for 256 spans of 12 bytes each 27 | // 28 | #define SCANBUFFERPAD 0x1000 29 | 30 | #define R_SKY_SMASK 0x007F0000 31 | #define R_SKY_TMASK 0x007F0000 32 | 33 | #define DS_SPAN_LIST_END -128 34 | 35 | #define SURFCACHE_SIZE_AT_320X200 600*1024 36 | 37 | typedef struct surfcache_s 38 | { 39 | struct surfcache_s *next; 40 | struct surfcache_s **owner; // NULL is an empty chunk of memory 41 | int lightadj[MAXLIGHTMAPS]; // checked for strobe flush 42 | int dlight; 43 | int size; // including header 44 | unsigned width; 45 | unsigned height; // DEBUG only needed for debug 46 | float mipscale; 47 | struct texture_s *texture; // checked for animating textures 48 | byte data[4]; // width*height elements 49 | } surfcache_t; 50 | 51 | // !!! if this is changed, it must be changed in asm_draw.h too !!! 52 | typedef struct sspan_s 53 | { 54 | int u, v, count; 55 | } sspan_t; 56 | 57 | extern cvar_t d_subdiv16; 58 | 59 | extern float scale_for_mip; 60 | 61 | extern qboolean d_roverwrapped; 62 | extern surfcache_t *sc_rover; 63 | extern surfcache_t *d_initial_rover; 64 | 65 | extern float d_sdivzstepu, d_tdivzstepu, d_zistepu; 66 | extern float d_sdivzstepv, d_tdivzstepv, d_zistepv; 67 | extern float d_sdivzorigin, d_tdivzorigin, d_ziorigin; 68 | 69 | fixed16_t sadjust, tadjust; 70 | fixed16_t bbextents, bbextentt; 71 | 72 | 73 | void D_DrawSpans8 (espan_t *pspans); 74 | void D_DrawSpans16 (espan_t *pspans); 75 | void D_DrawZSpans (espan_t *pspans); 76 | void Turbulent8 (espan_t *pspan); 77 | void D_SpriteDrawSpans (sspan_t *pspan); 78 | 79 | void D_DrawSkyScans8 (espan_t *pspan); 80 | void D_DrawSkyScans16 (espan_t *pspan); 81 | 82 | void R_ShowSubDiv (void); 83 | void (*prealspandrawer)(void); 84 | surfcache_t *D_CacheSurface (msurface_t *surface, int miplevel); 85 | 86 | extern int D_MipLevelForScale (float scale); 87 | 88 | #if id386 89 | extern void D_PolysetAff8Start (void); 90 | extern void D_PolysetAff8End (void); 91 | #endif 92 | 93 | extern short *d_pzbuffer; 94 | extern unsigned int d_zrowbytes, d_zwidth; 95 | 96 | extern int *d_pscantable; 97 | extern int d_scantable[MAXHEIGHT]; 98 | 99 | extern int d_vrectx, d_vrecty, d_vrectright_particle, d_vrectbottom_particle; 100 | 101 | extern int d_y_aspect_shift, d_pix_min, d_pix_max, d_pix_shift; 102 | 103 | extern pixel_t *d_viewbuffer; 104 | 105 | extern short *zspantable[MAXHEIGHT]; 106 | 107 | extern int d_minmip; 108 | extern float d_scalemip[3]; 109 | 110 | extern void (*d_drawspans) (espan_t *pspan); 111 | 112 | -------------------------------------------------------------------------------- /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 | // 21 | // modelgen.h: header file for model generation program 22 | // 23 | 24 | // ********************************************************* 25 | // * This file must be identical in the modelgen directory * 26 | // * and in the Quake directory, because it's used to * 27 | // * pass data from one to the other via model files. * 28 | // ********************************************************* 29 | 30 | #ifdef INCLUDELIBS 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | #include "cmdlib.h" 38 | #include "scriplib.h" 39 | #include "trilib.h" 40 | #include "lbmlib.h" 41 | #include "mathlib.h" 42 | 43 | #endif 44 | 45 | #define ALIAS_VERSION 6 46 | 47 | #define ALIAS_ONSEAM 0x0020 48 | 49 | // must match definition in spritegn.h 50 | #ifndef SYNCTYPE_T 51 | #define SYNCTYPE_T 52 | typedef enum {ST_SYNC=0, ST_RAND } synctype_t; 53 | #endif 54 | 55 | typedef enum { ALIAS_SINGLE=0, ALIAS_GROUP } aliasframetype_t; 56 | 57 | typedef enum { ALIAS_SKIN_SINGLE=0, ALIAS_SKIN_GROUP } aliasskintype_t; 58 | 59 | typedef struct { 60 | int ident; 61 | int version; 62 | vec3_t scale; 63 | vec3_t scale_origin; 64 | float boundingradius; 65 | vec3_t eyeposition; 66 | int numskins; 67 | int skinwidth; 68 | int skinheight; 69 | int numverts; 70 | int numtris; 71 | int numframes; 72 | synctype_t synctype; 73 | int flags; 74 | float size; 75 | } mdl_t; 76 | 77 | // TODO: could be shorts 78 | 79 | typedef struct { 80 | int onseam; 81 | int s; 82 | int t; 83 | } stvert_t; 84 | 85 | typedef struct dtriangle_s { 86 | int facesfront; 87 | int vertindex[3]; 88 | } dtriangle_t; 89 | 90 | #define DT_FACES_FRONT 0x0010 91 | 92 | // This mirrors trivert_t in trilib.h, is present so Quake knows how to 93 | // load this data 94 | 95 | typedef struct { 96 | byte v[3]; 97 | byte lightnormalindex; 98 | } trivertx_t; 99 | 100 | typedef struct { 101 | trivertx_t bboxmin; // lightnormal isn't used 102 | trivertx_t bboxmax; // lightnormal isn't used 103 | char name[16]; // frame name from grabbing 104 | } daliasframe_t; 105 | 106 | typedef struct { 107 | int numframes; 108 | trivertx_t bboxmin; // lightnormal isn't used 109 | trivertx_t bboxmax; // lightnormal isn't used 110 | } daliasgroup_t; 111 | 112 | typedef struct { 113 | int numskins; 114 | } daliasskingroup_t; 115 | 116 | typedef struct { 117 | float interval; 118 | } daliasinterval_t; 119 | 120 | typedef struct { 121 | float interval; 122 | } daliasskininterval_t; 123 | 124 | typedef struct { 125 | aliasframetype_t type; 126 | } daliasframetype_t; 127 | 128 | typedef struct { 129 | aliasskintype_t type; 130 | } daliasskintype_t; 131 | 132 | #define IDPOLYHEADER (('O'<<24)+('P'<<16)+('D'<<8)+'I') 133 | // little-endian "IDPO" 134 | 135 | -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /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 or displayed at the console or prog code as well as accessed directly 25 | 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 float interpretation of the string. Generally, all cvar_t declarations should be registered in the apropriate init function before any console commands are executed: 35 | Cvar_RegisterVariable (&host_framerate); 36 | 37 | 38 | C code usually just references a cvar in place: 39 | if ( r_draworder.value ) 40 | 41 | It could optionally ask for the value to be looked up for a string name: 42 | if (Cvar_VariableValue ("r_draworder")) 43 | 44 | Interpreted prog code can access cvars with the cvar(name) or 45 | cvar_set (name, value) internal functions: 46 | teamplay = cvar("teamplay"); 47 | cvar_set ("registered", "1"); 48 | 49 | The user can access cvars from the console in two ways: 50 | r_draworder prints the current value 51 | r_draworder 0 sets the current value to 0 52 | Cvars are restricted from having the same names as commands to keep this 53 | interface from being ambiguous. 54 | */ 55 | 56 | typedef struct cvar_s 57 | { 58 | char *name; 59 | char *string; 60 | qboolean archive; // set to true to cause it to be saved to vars.rc 61 | qboolean server; // notifies players when changed 62 | float value; 63 | struct cvar_s *next; 64 | } cvar_t; 65 | 66 | void Cvar_RegisterVariable (cvar_t *variable); 67 | // registers a cvar that allready has the name, string, and optionally the 68 | // archive elements set. 69 | 70 | void Cvar_Set (char *var_name, char *value); 71 | // equivelant to " " typed at the console 72 | 73 | void Cvar_SetValue (char *var_name, float value); 74 | // expands value to a string and calls Cvar_Set 75 | 76 | float Cvar_VariableValue (char *var_name); 77 | // returns 0 if not defined or non numeric 78 | 79 | char *Cvar_VariableString (char *var_name); 80 | // returns an empty string if not defined 81 | 82 | char *Cvar_CompleteVariable (char *partial); 83 | // attempts to match a partial variable name for command line completion 84 | // returns NULL if nothing fits 85 | 86 | qboolean Cvar_Command (void); 87 | // called by Cmd_ExecuteString when Cmd_Argv(0) doesn't match a known 88 | // command. Returns true if the command was a variable reference that 89 | // was handled. (print or change) 90 | 91 | void Cvar_WriteVariables (FILE *f); 92 | // Writes lines containing "set variable value" for all variables 93 | // with the archive flag set to true. 94 | 95 | cvar_t *Cvar_FindVar (char *var_name); 96 | 97 | extern cvar_t *cvar_vars; 98 | -------------------------------------------------------------------------------- /net_dos.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 | "Serial", 64 | false, 65 | Serial_Init, 66 | Serial_Listen, 67 | Serial_SearchForHosts, 68 | Serial_Connect, 69 | Serial_CheckNewConnections, 70 | Serial_GetMessage, 71 | Serial_SendMessage, 72 | Serial_SendUnreliableMessage, 73 | Serial_CanSendMessage, 74 | Serial_CanSendUnreliableMessage, 75 | Serial_Close, 76 | Serial_Shutdown 77 | } 78 | }; 79 | 80 | int net_numdrivers = 3; 81 | 82 | 83 | #include "net_bw.h" 84 | #include "net_ipx.h" 85 | #include "net_mp.h" 86 | 87 | net_landriver_t net_landrivers[MAX_NET_DRIVERS] = 88 | { 89 | { 90 | "Beame & Whiteside TCP/IP", 91 | false, 92 | 0, 93 | BW_Init, 94 | BW_Shutdown, 95 | BW_Listen, 96 | BW_OpenSocket, 97 | BW_CloseSocket, 98 | BW_Connect, 99 | BW_CheckNewConnections, 100 | BW_Read, 101 | BW_Write, 102 | BW_Broadcast, 103 | BW_AddrToString, 104 | BW_StringToAddr, 105 | BW_GetSocketAddr, 106 | BW_GetNameFromAddr, 107 | BW_GetAddrFromName, 108 | BW_AddrCompare, 109 | BW_GetSocketPort, 110 | BW_SetSocketPort 111 | } 112 | , 113 | { 114 | "IPX", 115 | false, 116 | 0, 117 | IPX_Init, 118 | IPX_Shutdown, 119 | IPX_Listen, 120 | IPX_OpenSocket, 121 | IPX_CloseSocket, 122 | IPX_Connect, 123 | IPX_CheckNewConnections, 124 | IPX_Read, 125 | IPX_Write, 126 | IPX_Broadcast, 127 | IPX_AddrToString, 128 | IPX_StringToAddr, 129 | IPX_GetSocketAddr, 130 | IPX_GetNameFromAddr, 131 | IPX_GetAddrFromName, 132 | IPX_AddrCompare, 133 | IPX_GetSocketPort, 134 | IPX_SetSocketPort 135 | } 136 | , 137 | { 138 | "Win95 TCP/IP", 139 | false, 140 | 0, 141 | MPATH_Init, 142 | MPATH_Shutdown, 143 | MPATH_Listen, 144 | MPATH_OpenSocket, 145 | MPATH_CloseSocket, 146 | MPATH_Connect, 147 | MPATH_CheckNewConnections, 148 | MPATH_Read, 149 | MPATH_Write, 150 | MPATH_Broadcast, 151 | MPATH_AddrToString, 152 | MPATH_StringToAddr, 153 | MPATH_GetSocketAddr, 154 | MPATH_GetNameFromAddr, 155 | MPATH_GetAddrFromName, 156 | MPATH_AddrCompare, 157 | MPATH_GetSocketPort, 158 | MPATH_SetSocketPort 159 | } 160 | }; 161 | 162 | int net_numlandrivers = 3; 163 | -------------------------------------------------------------------------------- /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 | 86 | void Memory_Init (void *buf, int size); 87 | 88 | void Z_Free (void *ptr); 89 | void *Z_Malloc (int size); // returns 0 filled memory 90 | void *Z_TagMalloc (int size, int tag); 91 | 92 | void Z_DumpHeap (void); 93 | void Z_CheckHeap (void); 94 | int Z_FreeMemory (void); 95 | 96 | void *Hunk_Alloc (int size); // returns 0 filled memory 97 | void *Hunk_AllocName (int size, char *name); 98 | 99 | void *Hunk_HighAllocName (int size, char *name); 100 | 101 | int Hunk_LowMark (void); 102 | void Hunk_FreeToLowMark (int mark); 103 | 104 | int Hunk_HighMark (void); 105 | void Hunk_FreeToHighMark (int mark); 106 | 107 | void *Hunk_TempAlloc (int size); 108 | 109 | void Hunk_Check (void); 110 | 111 | typedef struct cache_user_s 112 | { 113 | void *data; 114 | } cache_user_t; 115 | 116 | void Cache_Flush (void); 117 | 118 | void *Cache_Check (cache_user_t *c); 119 | // returns the cached data, and moves to the head of the LRU list 120 | // if present, otherwise returns NULL 121 | 122 | void Cache_Free (cache_user_t *c); 123 | 124 | void *Cache_Alloc (cache_user_t *c, int size, char *name); 125 | // Returns NULL if all purgable data was tossed and there still 126 | // wasn't enough room. 127 | 128 | void Cache_Report (void); 129 | 130 | 131 | 132 | -------------------------------------------------------------------------------- /d_sky.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 | // d_sky.c 21 | 22 | #include "quakedef.h" 23 | #include "r_local.h" 24 | #include "d_local.h" 25 | 26 | #define SKY_SPAN_SHIFT 5 27 | #define SKY_SPAN_MAX (1 << SKY_SPAN_SHIFT) 28 | 29 | 30 | /* 31 | ================= 32 | D_Sky_uv_To_st 33 | ================= 34 | */ 35 | void D_Sky_uv_To_st (int u, int v, fixed16_t *s, fixed16_t *t) 36 | { 37 | float wu, wv, temp; 38 | vec3_t end; 39 | 40 | if (r_refdef.vrect.width >= r_refdef.vrect.height) 41 | temp = (float)r_refdef.vrect.width; 42 | else 43 | temp = (float)r_refdef.vrect.height; 44 | 45 | wu = 8192.0 * (float)(u-((int)vid.width>>1)) / temp; 46 | wv = 8192.0 * (float)(((int)vid.height>>1)-v) / temp; 47 | 48 | end[0] = 4096*vpn[0] + wu*vright[0] + wv*vup[0]; 49 | end[1] = 4096*vpn[1] + wu*vright[1] + wv*vup[1]; 50 | end[2] = 4096*vpn[2] + wu*vright[2] + wv*vup[2]; 51 | end[2] *= 3; 52 | VectorNormalize (end); 53 | 54 | temp = skytime*skyspeed; // TODO: add D_SetupFrame & set this there 55 | *s = (int)((temp + 6*(SKYSIZE/2-1)*end[0]) * 0x10000); 56 | *t = (int)((temp + 6*(SKYSIZE/2-1)*end[1]) * 0x10000); 57 | } 58 | 59 | 60 | /* 61 | ================= 62 | D_DrawSkyScans8 63 | ================= 64 | */ 65 | void D_DrawSkyScans8 (espan_t *pspan) 66 | { 67 | int count, spancount, u, v; 68 | unsigned char *pdest; 69 | fixed16_t s, t, snext, tnext, sstep, tstep; 70 | int spancountminus1; 71 | 72 | sstep = 0; // keep compiler happy 73 | tstep = 0; // ditto 74 | 75 | do 76 | { 77 | pdest = (unsigned char *)((byte *)d_viewbuffer + 78 | (screenwidth * pspan->v) + pspan->u); 79 | 80 | count = pspan->count; 81 | 82 | // calculate the initial s & t 83 | u = pspan->u; 84 | v = pspan->v; 85 | D_Sky_uv_To_st (u, v, &s, &t); 86 | 87 | do 88 | { 89 | if (count >= SKY_SPAN_MAX) 90 | spancount = SKY_SPAN_MAX; 91 | else 92 | spancount = count; 93 | 94 | count -= spancount; 95 | 96 | if (count) 97 | { 98 | u += spancount; 99 | 100 | // calculate s and t at far end of span, 101 | // calculate s and t steps across span by shifting 102 | D_Sky_uv_To_st (u, v, &snext, &tnext); 103 | 104 | sstep = (snext - s) >> SKY_SPAN_SHIFT; 105 | tstep = (tnext - t) >> SKY_SPAN_SHIFT; 106 | } 107 | else 108 | { 109 | // calculate s and t at last pixel in span, 110 | // calculate s and t steps across span by division 111 | spancountminus1 = (float)(spancount - 1); 112 | 113 | if (spancountminus1 > 0) 114 | { 115 | u += spancountminus1; 116 | D_Sky_uv_To_st (u, v, &snext, &tnext); 117 | 118 | sstep = (snext - s) / spancountminus1; 119 | tstep = (tnext - t) / spancountminus1; 120 | } 121 | } 122 | 123 | do 124 | { 125 | *pdest++ = r_skysource[((t & R_SKY_TMASK) >> 8) + 126 | ((s & R_SKY_SMASK) >> 16)]; 127 | s += sstep; 128 | t += tstep; 129 | } while (--spancount > 0); 130 | 131 | s = snext; 132 | t = tnext; 133 | 134 | } while (count > 0); 135 | 136 | } while ((pspan = pspan->pnext) != NULL); 137 | } 138 | 139 | -------------------------------------------------------------------------------- /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, 55 | OP_EQ_V, 56 | OP_EQ_S, 57 | OP_EQ_E, 58 | OP_EQ_FNC, 59 | 60 | OP_NE_F, 61 | OP_NE_V, 62 | OP_NE_S, 63 | OP_NE_E, 64 | OP_NE_FNC, 65 | 66 | OP_LE, 67 | OP_GE, 68 | OP_LT, 69 | OP_GT, 70 | 71 | OP_LOAD_F, 72 | OP_LOAD_V, 73 | OP_LOAD_S, 74 | OP_LOAD_ENT, 75 | OP_LOAD_FLD, 76 | OP_LOAD_FNC, 77 | 78 | OP_ADDRESS, 79 | 80 | OP_STORE_F, 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, 88 | OP_STOREP_V, 89 | OP_STOREP_S, 90 | OP_STOREP_ENT, 91 | OP_STOREP_FLD, 92 | OP_STOREP_FNC, 93 | 94 | OP_RETURN, 95 | OP_NOT_F, 96 | OP_NOT_V, 97 | OP_NOT_S, 98 | OP_NOT_ENT, 99 | OP_NOT_FNC, 100 | OP_IF, 101 | OP_IFNOT, 102 | OP_CALL0, 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, 112 | OP_GOTO, 113 | OP_AND, 114 | OP_OR, 115 | 116 | OP_BITAND, 117 | OP_BITOR 118 | }; 119 | 120 | 121 | typedef struct statement_s 122 | { 123 | unsigned short op; 124 | short a,b,c; 125 | } dstatement_t; 126 | 127 | typedef struct 128 | { 129 | unsigned short type; // if DEF_SAVEGLOBGAL bit is set 130 | // the variable needs to be saved in savegames 131 | unsigned short ofs; 132 | int s_name; 133 | } ddef_t; 134 | #define DEF_SAVEGLOBAL (1<<15) 135 | 136 | #define MAX_PARMS 8 137 | 138 | typedef struct 139 | { 140 | int first_statement; // negative numbers are builtins 141 | int parm_start; 142 | int locals; // total ints of parms + locals 143 | 144 | int profile; // runtime 145 | 146 | int s_name; 147 | int s_file; // source file defined in 148 | 149 | int numparms; 150 | byte parm_size[MAX_PARMS]; 151 | } dfunction_t; 152 | 153 | 154 | #define PROG_VERSION 6 155 | typedef struct 156 | { 157 | int version; 158 | int crc; // check of header file 159 | 160 | int ofs_statements; 161 | int numstatements; // statement 0 is an error 162 | 163 | int ofs_globaldefs; 164 | int numglobaldefs; 165 | 166 | int ofs_fielddefs; 167 | int numfielddefs; 168 | 169 | int ofs_functions; 170 | int numfunctions; // function 0 is an empty 171 | 172 | int ofs_strings; 173 | int numstrings; // first string is a null string 174 | 175 | int ofs_globals; 176 | int numglobals; 177 | 178 | int entityfields; 179 | } dprograms_t; 180 | 181 | -------------------------------------------------------------------------------- /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 | #pragma warning( disable : 4229 ) // mgraph gets this 23 | 24 | #include 25 | #define WM_MOUSEWHEEL 0x020A 26 | 27 | #ifndef SERVERONLY 28 | #include 29 | #include 30 | #ifndef GLQUAKE 31 | #include 32 | #endif 33 | #endif 34 | 35 | extern HINSTANCE global_hInstance; 36 | extern int global_nCmdShow; 37 | 38 | #ifndef SERVERONLY 39 | 40 | extern LPDIRECTDRAW lpDD; 41 | extern qboolean DDActive; 42 | extern LPDIRECTDRAWSURFACE lpPrimary; 43 | extern LPDIRECTDRAWSURFACE lpFrontBuffer; 44 | extern LPDIRECTDRAWSURFACE lpBackBuffer; 45 | extern LPDIRECTDRAWPALETTE lpDDPal; 46 | extern LPDIRECTSOUND pDS; 47 | extern LPDIRECTSOUNDBUFFER pDSBuf; 48 | 49 | extern DWORD gSndBufSize; 50 | //#define SNDBUFSIZE 65536 51 | 52 | void VID_LockBuffer (void); 53 | void VID_UnlockBuffer (void); 54 | 55 | #endif 56 | 57 | typedef enum {MS_WINDOWED, MS_FULLSCREEN, MS_FULLDIB, MS_UNINIT} modestate_t; 58 | 59 | extern modestate_t modestate; 60 | 61 | extern HWND mainwindow; 62 | extern qboolean ActiveApp, Minimized; 63 | 64 | extern qboolean WinNT; 65 | 66 | int VID_ForceUnlockedAndReturnState (void); 67 | void VID_ForceLockState (int lk); 68 | 69 | void IN_ShowMouse (void); 70 | void IN_DeactivateMouse (void); 71 | void IN_HideMouse (void); 72 | void IN_ActivateMouse (void); 73 | void IN_RestoreOriginalMouseState (void); 74 | void IN_SetQuakeMouseState (void); 75 | void IN_MouseEvent (int mstate); 76 | 77 | extern qboolean winsock_lib_initialized; 78 | 79 | extern cvar_t _windowed_mouse; 80 | 81 | extern int window_center_x, window_center_y; 82 | extern RECT window_rect; 83 | 84 | extern qboolean mouseinitialized; 85 | extern HWND hwnd_dialog; 86 | 87 | extern HANDLE hinput, houtput; 88 | 89 | void IN_UpdateClipCursor (void); 90 | void CenterWindow(HWND hWndCenter, int width, int height, BOOL lefttopjustify); 91 | 92 | void S_BlockSound (void); 93 | void S_UnblockSound (void); 94 | 95 | void VID_SetDefaultMode (void); 96 | 97 | int (PASCAL FAR *pWSAStartup)(WORD wVersionRequired, LPWSADATA lpWSAData); 98 | int (PASCAL FAR *pWSACleanup)(void); 99 | int (PASCAL FAR *pWSAGetLastError)(void); 100 | SOCKET (PASCAL FAR *psocket)(int af, int type, int protocol); 101 | int (PASCAL FAR *pioctlsocket)(SOCKET s, long cmd, u_long FAR *argp); 102 | int (PASCAL FAR *psetsockopt)(SOCKET s, int level, int optname, 103 | const char FAR * optval, int optlen); 104 | int (PASCAL FAR *precvfrom)(SOCKET s, char FAR * buf, int len, int flags, 105 | struct sockaddr FAR *from, int FAR * fromlen); 106 | int (PASCAL FAR *psendto)(SOCKET s, const char FAR * buf, int len, int flags, 107 | const struct sockaddr FAR *to, int tolen); 108 | int (PASCAL FAR *pclosesocket)(SOCKET s); 109 | int (PASCAL FAR *pgethostname)(char FAR * name, int namelen); 110 | struct hostent FAR * (PASCAL FAR *pgethostbyname)(const char FAR * name); 111 | struct hostent FAR * (PASCAL FAR *pgethostbyaddr)(const char FAR * addr, 112 | int len, int type); 113 | int (PASCAL FAR *pgetsockname)(SOCKET s, struct sockaddr FAR *name, 114 | int FAR * namelen); 115 | -------------------------------------------------------------------------------- /d_init.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 | // d_init.c: rasterization driver initialization 21 | 22 | #include "quakedef.h" 23 | #include "d_local.h" 24 | 25 | #define NUM_MIPS 4 26 | 27 | cvar_t d_subdiv16 = {"d_subdiv16", "1"}; 28 | cvar_t d_mipcap = {"d_mipcap", "0"}; 29 | cvar_t d_mipscale = {"d_mipscale", "1"}; 30 | 31 | surfcache_t *d_initial_rover; 32 | qboolean d_roverwrapped; 33 | int d_minmip; 34 | float d_scalemip[NUM_MIPS-1]; 35 | 36 | static float basemip[NUM_MIPS-1] = {1.0, 0.5*0.8, 0.25*0.8}; 37 | 38 | extern int d_aflatcolor; 39 | 40 | void (*d_drawspans) (espan_t *pspan); 41 | 42 | 43 | /* 44 | =============== 45 | D_Init 46 | =============== 47 | */ 48 | void D_Init (void) 49 | { 50 | 51 | r_skydirect = 1; 52 | 53 | Cvar_RegisterVariable (&d_subdiv16); 54 | Cvar_RegisterVariable (&d_mipcap); 55 | Cvar_RegisterVariable (&d_mipscale); 56 | 57 | r_drawpolys = false; 58 | r_worldpolysbacktofront = false; 59 | r_recursiveaffinetriangles = true; 60 | r_pixbytes = 1; 61 | r_aliasuvscale = 1.0; 62 | } 63 | 64 | 65 | /* 66 | =============== 67 | D_CopyRects 68 | =============== 69 | */ 70 | void D_CopyRects (vrect_t *prects, int transparent) 71 | { 72 | 73 | // this function is only required if the CPU doesn't have direct access to the 74 | // back buffer, and there's some driver interface function that the driver 75 | // doesn't support and requires Quake to do in software (such as drawing the 76 | // console); Quake will then draw into wherever the driver points vid.buffer 77 | // and will call this function before swapping buffers 78 | 79 | UNUSED(prects); 80 | UNUSED(transparent); 81 | } 82 | 83 | 84 | /* 85 | =============== 86 | D_EnableBackBufferAccess 87 | =============== 88 | */ 89 | void D_EnableBackBufferAccess (void) 90 | { 91 | VID_LockBuffer (); 92 | } 93 | 94 | 95 | /* 96 | =============== 97 | D_TurnZOn 98 | =============== 99 | */ 100 | void D_TurnZOn (void) 101 | { 102 | // not needed for software version 103 | } 104 | 105 | 106 | /* 107 | =============== 108 | D_DisableBackBufferAccess 109 | =============== 110 | */ 111 | void D_DisableBackBufferAccess (void) 112 | { 113 | VID_UnlockBuffer (); 114 | } 115 | 116 | 117 | /* 118 | =============== 119 | D_SetupFrame 120 | =============== 121 | */ 122 | void D_SetupFrame (void) 123 | { 124 | int i; 125 | 126 | if (r_dowarp) 127 | d_viewbuffer = r_warpbuffer; 128 | else 129 | d_viewbuffer = (void *)(byte *)vid.buffer; 130 | 131 | if (r_dowarp) 132 | screenwidth = WARP_WIDTH; 133 | else 134 | screenwidth = vid.rowbytes; 135 | 136 | d_roverwrapped = false; 137 | d_initial_rover = sc_rover; 138 | 139 | d_minmip = d_mipcap.value; 140 | if (d_minmip > 3) 141 | d_minmip = 3; 142 | else if (d_minmip < 0) 143 | d_minmip = 0; 144 | 145 | for (i=0 ; i<(NUM_MIPS-1) ; i++) 146 | d_scalemip[i] = basemip[i] * d_mipscale.value; 147 | 148 | #if id386 149 | if (d_subdiv16.value) 150 | d_drawspans = D_DrawSpans16; 151 | else 152 | d_drawspans = D_DrawSpans8; 153 | #else 154 | d_drawspans = D_DrawSpans8; 155 | #endif 156 | 157 | d_aflatcolor = 0; 158 | } 159 | 160 | 161 | /* 162 | =============== 163 | D_UpdateRects 164 | =============== 165 | */ 166 | void D_UpdateRects (vrect_t *prect) 167 | { 168 | 169 | // the software driver draws these directly to the vid buffer 170 | 171 | UNUSED(prect); 172 | } 173 | 174 | -------------------------------------------------------------------------------- /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 | int wad_numlumps; 25 | lumpinfo_t *wad_lumps; 26 | byte *wad_base; 27 | 28 | void SwapPic (qpic_t *pic); 29 | 30 | /* 31 | ================== 32 | W_CleanupName 33 | 34 | Lowercases name and pads with spaces and a terminating 0 to the length of 35 | lumpinfo_t->name. 36 | Used so lumpname lookups can proceed rapidly by comparing 4 chars at a time 37 | Space padding is so names can be printed nicely in tables. 38 | Can safely be performed in place. 39 | ================== 40 | */ 41 | void W_CleanupName (char *in, char *out) 42 | { 43 | int i; 44 | int c; 45 | 46 | for (i=0 ; i<16 ; i++ ) 47 | { 48 | c = in[i]; 49 | if (!c) 50 | break; 51 | 52 | if (c >= 'A' && c <= 'Z') 53 | c += ('a' - 'A'); 54 | out[i] = c; 55 | } 56 | 57 | for ( ; i< 16 ; i++ ) 58 | out[i] = 0; 59 | } 60 | 61 | 62 | 63 | /* 64 | ==================== 65 | W_LoadWadFile 66 | ==================== 67 | */ 68 | void W_LoadWadFile (char *filename) 69 | { 70 | lumpinfo_t *lump_p; 71 | wadinfo_t *header; 72 | unsigned i; 73 | int infotableofs; 74 | 75 | wad_base = COM_LoadHunkFile (filename); 76 | if (!wad_base) 77 | Sys_Error ("W_LoadWadFile: couldn't load %s", filename); 78 | 79 | header = (wadinfo_t *)wad_base; 80 | 81 | if (header->identification[0] != 'W' 82 | || header->identification[1] != 'A' 83 | || header->identification[2] != 'D' 84 | || header->identification[3] != '2') 85 | Sys_Error ("Wad file %s doesn't have WAD2 id\n",filename); 86 | 87 | wad_numlumps = LittleLong(header->numlumps); 88 | infotableofs = LittleLong(header->infotableofs); 89 | wad_lumps = (lumpinfo_t *)(wad_base + infotableofs); 90 | 91 | for (i=0, lump_p = wad_lumps ; ifilepos = LittleLong(lump_p->filepos); 94 | lump_p->size = LittleLong(lump_p->size); 95 | W_CleanupName (lump_p->name, lump_p->name); 96 | if (lump_p->type == TYP_QPIC) 97 | SwapPic ( (qpic_t *)(wad_base + lump_p->filepos)); 98 | } 99 | } 100 | 101 | 102 | /* 103 | ============= 104 | W_GetLumpinfo 105 | ============= 106 | */ 107 | lumpinfo_t *W_GetLumpinfo (char *name) 108 | { 109 | int i; 110 | lumpinfo_t *lump_p; 111 | char clean[16]; 112 | 113 | W_CleanupName (name, clean); 114 | 115 | for (lump_p=wad_lumps, i=0 ; iname)) 118 | return lump_p; 119 | } 120 | 121 | Sys_Error ("W_GetLumpinfo: %s not found", name); 122 | return NULL; 123 | } 124 | 125 | void *W_GetLumpName (char *name) 126 | { 127 | lumpinfo_t *lump; 128 | 129 | lump = W_GetLumpinfo (name); 130 | 131 | return (void *)(wad_base + lump->filepos); 132 | } 133 | 134 | void *W_GetLumpNum (int num) 135 | { 136 | lumpinfo_t *lump; 137 | 138 | if (num < 0 || num > wad_numlumps) 139 | Sys_Error ("W_GetLumpNum: bad number: %i", num); 140 | 141 | lump = wad_lumps + num; 142 | 143 | return (void *)(wad_base + lump->filepos); 144 | } 145 | 146 | /* 147 | ============================================================================= 148 | 149 | automatic byte swapping 150 | 151 | ============================================================================= 152 | */ 153 | 154 | void SwapPic (qpic_t *pic) 155 | { 156 | pic->width = LittleLong(pic->width); 157 | pic->height = LittleLong(pic->height); 158 | } 159 | -------------------------------------------------------------------------------- /gl_test.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 | #include "quakedef.h" 22 | 23 | #ifdef GLTEST 24 | 25 | typedef struct 26 | { 27 | plane_t *plane; 28 | vec3_t origin; 29 | vec3_t normal; 30 | vec3_t up; 31 | vec3_t right; 32 | vec3_t reflect; 33 | float length; 34 | } puff_t; 35 | 36 | #define MAX_PUFFS 64 37 | 38 | puff_t puffs[MAX_PUFFS]; 39 | 40 | 41 | void Test_Init (void) 42 | { 43 | } 44 | 45 | 46 | 47 | plane_t junk; 48 | plane_t *HitPlane (vec3_t start, vec3_t end) 49 | { 50 | trace_t trace; 51 | 52 | // fill in a default trace 53 | memset (&trace, 0, sizeof(trace_t)); 54 | trace.fraction = 1; 55 | trace.allsolid = true; 56 | VectorCopy (end, trace.endpos); 57 | 58 | SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1, start, end, &trace); 59 | 60 | junk = trace.plane; 61 | return &junk; 62 | } 63 | 64 | void Test_Spawn (vec3_t origin) 65 | { 66 | int i; 67 | puff_t *p; 68 | vec3_t temp; 69 | vec3_t normal; 70 | vec3_t incoming; 71 | plane_t *plane; 72 | float d; 73 | 74 | for (i=0,p=puffs ; ilength <= 0) 77 | break; 78 | } 79 | if (i == MAX_PUFFS) 80 | return; 81 | 82 | VectorSubtract (r_refdef.vieworg, origin, incoming); 83 | VectorSubtract (origin, incoming, temp); 84 | plane = HitPlane (r_refdef.vieworg, temp); 85 | 86 | VectorNormalize (incoming); 87 | d = DotProduct (incoming, plane->normal); 88 | VectorSubtract (vec3_origin, incoming, p->reflect); 89 | VectorMA (p->reflect, d*2, plane->normal, p->reflect); 90 | 91 | VectorCopy (origin, p->origin); 92 | VectorCopy (plane->normal, p->normal); 93 | 94 | CrossProduct (incoming, p->normal, p->up); 95 | 96 | CrossProduct (p->up, p->normal, p->right); 97 | 98 | p->length = 8; 99 | } 100 | 101 | void DrawPuff (puff_t *p) 102 | { 103 | vec3_t pts[2][3]; 104 | int i, j; 105 | float s, d; 106 | 107 | for (i=0 ; i<2 ; i++) 108 | { 109 | if (i == 1) 110 | { 111 | s = 6; 112 | d = p->length; 113 | } 114 | else 115 | { 116 | s = 2; 117 | d = 0; 118 | } 119 | 120 | for (j=0 ; j<3 ; j++) 121 | { 122 | pts[i][0][j] = p->origin[j] + p->up[j]*s + p->reflect[j]*d; 123 | pts[i][1][j] = p->origin[j] + p->right[j]*s + p->reflect[j]*d; 124 | pts[i][2][j] = p->origin[j] + -p->right[j]*s + p->reflect[j]*d; 125 | } 126 | } 127 | 128 | glColor3f (1, 0, 0); 129 | 130 | #if 0 131 | glBegin (GL_LINES); 132 | glVertex3fv (p->origin); 133 | glVertex3f (p->origin[0] + p->length*p->reflect[0], 134 | p->origin[1] + p->length*p->reflect[1], 135 | p->origin[2] + p->length*p->reflect[2]); 136 | 137 | glVertex3fv (pts[0][0]); 138 | glVertex3fv (pts[1][0]); 139 | 140 | glVertex3fv (pts[0][1]); 141 | glVertex3fv (pts[1][1]); 142 | 143 | glVertex3fv (pts[0][2]); 144 | glVertex3fv (pts[1][2]); 145 | 146 | glEnd (); 147 | #endif 148 | 149 | glBegin (GL_QUADS); 150 | for (i=0 ; i<3 ; i++) 151 | { 152 | j = (i+1)%3; 153 | glVertex3fv (pts[0][j]); 154 | glVertex3fv (pts[1][j]); 155 | glVertex3fv (pts[1][i]); 156 | glVertex3fv (pts[0][i]); 157 | } 158 | glEnd (); 159 | 160 | glBegin (GL_TRIANGLES); 161 | glVertex3fv (pts[1][0]); 162 | glVertex3fv (pts[1][1]); 163 | glVertex3fv (pts[1][2]); 164 | glEnd (); 165 | 166 | p->length -= host_frametime*2; 167 | } 168 | 169 | 170 | void Test_Draw (void) 171 | { 172 | int i; 173 | puff_t *p; 174 | 175 | for (i=0, p=puffs ; ilength > 0) 178 | DrawPuff (p); 179 | } 180 | } 181 | 182 | #endif 183 | -------------------------------------------------------------------------------- /cd_sdl.c: -------------------------------------------------------------------------------- 1 | /* 2 | cd_sdl.c 3 | $Id: cd_sdl.c,v 1.7 2006/03/24 15:45:22 sezero Exp $ 4 | Copyright (C) 2001 Mark Baker 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation; either version 2 9 | of the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 14 | 15 | See the GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program; if not, write to: 19 | 20 | Free Software Foundation, Inc. 21 | 59 Temple Place - Suite 330 22 | Boston, MA 02111-1307, USA 23 | */ 24 | 25 | #ifdef _USE_SDL_CDROM 26 | 27 | #ifndef H_SDL_CDROM 28 | #define H_SDL_CDROM 29 | 30 | #include "quakedef.h" 31 | #include "sdl.h" 32 | #include "sdl_mixer.h" 33 | 34 | static qboolean cdValid = false; 35 | static qboolean initialized = false; 36 | static qboolean enabled = true; 37 | static qboolean playLooping = false; 38 | 39 | Mix_Music *current_music = NULL; 40 | 41 | static void CDAudio_Eject(void) 42 | { 43 | } 44 | 45 | void music_done() 46 | { 47 | Mix_FreeMusic(current_music); 48 | current_music = NULL; 49 | } 50 | 51 | void CDAudio_Play(byte track, qboolean looping) 52 | { 53 | char track_name[32]; 54 | int fade_msec = 500; 55 | 56 | looping *= -1; 57 | 58 | sprintf(track_name, "D:\\music\\track%02d.ogg", track); // MARTY 59 | 60 | current_music = Mix_LoadMUS(track_name); 61 | 62 | if (current_music) 63 | { 64 | if (Mix_PlayingMusic()) 65 | { 66 | // Fade-in effect sounds cleaner if we're already playing something 67 | Mix_FadeInMusic(current_music, looping, fade_msec); 68 | } 69 | else 70 | { 71 | Mix_PlayMusic(current_music, looping); 72 | } 73 | 74 | Mix_HookMusicFinished((void*)music_done); 75 | printf("Now playing: %s\n", track_name); 76 | } 77 | else 78 | { 79 | printf("Music %s could not be loaded\n", track_name); 80 | return; 81 | } 82 | 83 | playLooping = looping; 84 | } 85 | 86 | 87 | void CDAudio_Stop(void) 88 | { 89 | Mix_HaltMusic(); 90 | } 91 | 92 | void CDAudio_Pause(void) 93 | { 94 | Mix_PauseMusic(); 95 | } 96 | 97 | 98 | void CDAudio_Resume(void) 99 | { 100 | Mix_ResumeMusic(); 101 | } 102 | 103 | static void CD_f (void) 104 | { 105 | char *command; 106 | 107 | if (Cmd_Argc() < 2) 108 | { 109 | Con_Printf("commands:"); 110 | Con_Printf("on, off, play, stop, \n"); 111 | Con_Printf("loop, pause, resume\n"); 112 | Con_Printf("eject, close, info\n"); 113 | return; 114 | } 115 | 116 | command = Cmd_Argv (1); 117 | 118 | if (Q_strcasecmp(command, "on") == 0) 119 | { 120 | enabled = true; 121 | return; 122 | } 123 | 124 | if (Q_strcasecmp(command, "off") == 0) 125 | { 126 | return; 127 | } 128 | 129 | if (Q_strcasecmp(command, "play") == 0) 130 | { 131 | CDAudio_Play((byte)atoi(Cmd_Argv (2)), false); 132 | return; 133 | } 134 | 135 | if (Q_strcasecmp(command, "loop") == 0) 136 | { 137 | CDAudio_Play((byte)atoi(Cmd_Argv (2)), true); 138 | return; 139 | } 140 | 141 | if (Q_strcasecmp(command, "stop") == 0) 142 | { 143 | CDAudio_Stop(); 144 | return; 145 | } 146 | 147 | if (Q_strcasecmp(command, "pause") == 0) 148 | { 149 | CDAudio_Pause(); 150 | return; 151 | } 152 | 153 | if (Q_strcasecmp(command, "resume") == 0) 154 | { 155 | CDAudio_Resume(); 156 | return; 157 | } 158 | 159 | if (Q_strcasecmp(command, "eject") == 0) 160 | { 161 | CDAudio_Eject(); 162 | cdValid = false; 163 | return; 164 | } 165 | 166 | if (Q_strcasecmp(command, "info") == 0) 167 | { 168 | return; 169 | } 170 | } 171 | 172 | void CDAudio_Update(void) 173 | { 174 | } 175 | 176 | int CDAudio_Init(void) 177 | { 178 | initialized = true; 179 | enabled = true; 180 | cdValid = true; 181 | 182 | Con_Printf("CDAudio initialized (using SDL)\n"); 183 | 184 | Cmd_AddCommand ("cd", CD_f); 185 | 186 | return 0; 187 | } 188 | 189 | void CDAudio_Shutdown(void) 190 | { 191 | } 192 | 193 | #endif //H_SDL_CDROM 194 | #endif //_USE_SDL_CDROM -------------------------------------------------------------------------------- /xbox/xbinput.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // File: XBInput.h 3 | // 4 | // Desc: Input helper functions for the XBox samples 5 | // 6 | // Hist: 12.15.00 - Separated from XBUtil.h for December XDK release 7 | // 01.03.00 - Made changes for real Xbox controller 8 | // 9 | // Copyright (c) Microsoft Corporation. All rights reserved. 10 | //----------------------------------------------------------------------------- 11 | #ifndef XBINPUT_H 12 | #define XBINPUT_H 13 | 14 | 15 | 16 | 17 | //----------------------------------------------------------------------------- 18 | // Name: enum XBGAMEPAD_EVENT 19 | // Desc: Cooked event codes for gamepad button presses 20 | //----------------------------------------------------------------------------- 21 | enum XBGAMEPAD_EVENT 22 | { 23 | XBGAMEPAD_NONE = 0, 24 | XBGAMEPAD_START, 25 | XBGAMEPAD_BACK, 26 | XBGAMEPAD_A, 27 | XBGAMEPAD_B, 28 | XBGAMEPAD_X, 29 | XBGAMEPAD_Y, 30 | XBGAMEPAD_BLACK, 31 | XBGAMEPAD_WHITE, 32 | XBGAMEPAD_DPAD_UP, 33 | XBGAMEPAD_DPAD_DOWN, 34 | XBGAMEPAD_DPAD_LEFT, 35 | XBGAMEPAD_DPAD_RIGHT, 36 | XBGAMEPAD_LEFT_TRIGGER, 37 | XBGAMEPAD_RIGHT_TRIGGER, 38 | }; 39 | 40 | 41 | 42 | 43 | //----------------------------------------------------------------------------- 44 | // Name: struct XBGAMEPAD 45 | // Desc: structure for holding Game pad data 46 | //----------------------------------------------------------------------------- 47 | struct XBGAMEPAD : public XINPUT_GAMEPAD 48 | { 49 | // The following members are inherited from XINPUT_GAMEPAD: 50 | // WORD wButtons; 51 | // BYTE bAnalogButtons[8]; 52 | // SHORT sThumbLX; 53 | // SHORT sThumbLY; 54 | // SHORT sThumbRX; 55 | // SHORT sThumbRY; 56 | 57 | // Thumb stick values converted to range [-1,+1] 58 | FLOAT fX1; 59 | FLOAT fY1; 60 | FLOAT fX2; 61 | FLOAT fY2; 62 | 63 | // State of buttons tracked since last poll 64 | WORD wLastButtons; 65 | BOOL bLastAnalogButtons[8]; 66 | WORD wPressedButtons; 67 | BOOL bPressedAnalogButtons[8]; 68 | 69 | // A cooked event, useful for UI navigation 70 | XBGAMEPAD_EVENT Event; 71 | 72 | // Rumble properties 73 | XINPUT_RUMBLE Rumble; 74 | XINPUT_FEEDBACK Feedback; 75 | 76 | // Device properties 77 | XINPUT_CAPABILITIES caps; 78 | HANDLE hDevice; 79 | 80 | // Flags for whether game pad was just inserted or removed 81 | BOOL bInserted; 82 | BOOL bRemoved; 83 | }; 84 | 85 | 86 | 87 | 88 | //----------------------------------------------------------------------------- 89 | // Global variables 90 | //----------------------------------------------------------------------------- 91 | // Global access to polling parameters 92 | extern XINPUT_POLLING_PARAMETERS g_PollingParameters; 93 | 94 | // Global access to input states 95 | extern XINPUT_STATE g_InputStates[4]; 96 | 97 | // Global access to gamepad devices 98 | extern XBGAMEPAD g_Gamepads[4]; 99 | 100 | 101 | 102 | 103 | //----------------------------------------------------------------------------- 104 | // Name: XBInput_CreateGamepads() 105 | // Desc: Creates the game pad devices 106 | //----------------------------------------------------------------------------- 107 | HRESULT XBInput_CreateGamepads( XBGAMEPAD** ppGamepads = NULL ); 108 | 109 | 110 | 111 | 112 | //----------------------------------------------------------------------------- 113 | // Name: XBInput_RefreshDeviceList() 114 | // Desc: Check for device removals and insertions 115 | //----------------------------------------------------------------------------- 116 | VOID XBInput_RefreshDeviceList( XBGAMEPAD* pGamepads = NULL ); 117 | 118 | 119 | 120 | 121 | //----------------------------------------------------------------------------- 122 | // Name: XBInput_GetInput() 123 | // Desc: Processes input from the game pad 124 | //----------------------------------------------------------------------------- 125 | VOID XBInput_GetInput( XBGAMEPAD* pGamepads = NULL ); 126 | 127 | 128 | 129 | 130 | #endif // XBINPUT_H 131 | -------------------------------------------------------------------------------- /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 int 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 | Sys_FileRead(vcrFile, &next, sizeof(next)); 53 | return 0; 54 | } 55 | 56 | void VCR_ReadNext (void) 57 | { 58 | if (Sys_FileRead(vcrFile, &next, sizeof(next)) == 0) 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 | Sys_FileRead(vcrFile, &ret, sizeof(int)); 86 | if (ret != 1) 87 | { 88 | VCR_ReadNext (); 89 | return ret; 90 | } 91 | 92 | Sys_FileRead(vcrFile, &net_message.cursize, sizeof(int)); 93 | Sys_FileRead(vcrFile, net_message.data, net_message.cursize); 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 | Sys_FileRead(vcrFile, &ret, sizeof(int)); 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 missmatch"); 122 | 123 | Sys_FileRead(vcrFile, &ret, sizeof(int)); 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 (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 | Sys_FileRead (vcrFile, sock->address, NET_NAMELEN); 164 | VCR_ReadNext (); 165 | 166 | return sock; 167 | } 168 | -------------------------------------------------------------------------------- /snd_sdl.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "sdl.h" 3 | #include "quakedef.h" 4 | #include "sdl_mixer.h" 5 | 6 | static dma_t the_shm; 7 | static int snd_inited; 8 | 9 | extern int desired_speed; 10 | extern int desired_bits; 11 | 12 | static void paint_audio(void *unused, Uint8 *stream, int len) 13 | { 14 | if ( shm ) { 15 | shm->buffer = stream; 16 | shm->samplepos += len/(shm->samplebits/8)/2; 17 | // Check for samplepos overflow? 18 | S_PaintChannels (shm->samplepos); 19 | } 20 | } 21 | 22 | qboolean SNDDMA_Init(void) 23 | { 24 | SDL_AudioSpec desired, obtained; 25 | char drivername[128]; 26 | 27 | snd_inited = 0; 28 | 29 | if (SDL_InitSubSystem (SDL_INIT_AUDIO) < 0) 30 | { 31 | Con_Printf("Couldn't init SDL audio: %s\n", SDL_GetError()); 32 | return 0; 33 | } 34 | 35 | /* Set up the desired format */ 36 | desired.freq = desired_speed; 37 | switch (desired_bits) 38 | { 39 | case 8: 40 | desired.format = AUDIO_U8; 41 | break; 42 | case 16: 43 | if ( SDL_BYTEORDER == SDL_BIG_ENDIAN ) 44 | desired.format = AUDIO_S16MSB; 45 | else 46 | desired.format = AUDIO_S16LSB; 47 | break; 48 | } 49 | 50 | desired.channels = 2; 51 | desired.samples = 1024; // previously 512 S.A. 52 | desired.callback = paint_audio; 53 | desired.userdata = NULL; 54 | 55 | /* Open the audio device */ 56 | if (Mix_OpenAudio(desired.freq, desired.format, desired.channels, desired.samples) == - 1){ 57 | printf("La cagamos"); 58 | return 0; 59 | } 60 | 61 | #if 0 62 | if ( SDL_OpenAudio(&desired, &obtained) < 0 ) 63 | { 64 | Con_Printf("Couldn't open SDL audio: %s\n", SDL_GetError()); 65 | return 0; 66 | } 67 | #endif 68 | 69 | /* Make sure we can support the audio format */ 70 | switch (desired.format) 71 | { 72 | case AUDIO_U8: 73 | /* Supported */ 74 | break; 75 | case AUDIO_S16LSB: 76 | case AUDIO_S16MSB: 77 | if ( ((desired.format == AUDIO_S16LSB) && (SDL_BYTEORDER == SDL_LIL_ENDIAN)) || 78 | ((desired.format == AUDIO_S16MSB) && (SDL_BYTEORDER == SDL_BIG_ENDIAN)) ) 79 | break; /* Supported */ 80 | else 81 | Con_Printf ("Warning: sound format / endianness mismatch\n"); 82 | default: 83 | /* Not supported -- force SDL to do our bidding */ 84 | Con_Printf ("Warning: unsupported audio format received\n"); 85 | Con_Printf ("Warning: will try forcing sdl audio\n"); 86 | SDL_CloseAudio(); 87 | if ( SDL_OpenAudio(&desired, NULL) < 0 ) 88 | { 89 | Con_Printf("Couldn't open SDL audio: %s\n", SDL_GetError()); 90 | return 0; 91 | } 92 | memcpy(&obtained, &desired, sizeof(desired)); 93 | break; 94 | } 95 | 96 | /* Fill the audio DMA information block */ 97 | shm = &sn; 98 | shm->splitbuffer = 0; 99 | shm->samplebits = (desired.format & 0xFF); // first byte of format is bits 100 | // if (obtained.freq != desired_speed) 101 | // Con_Printf ("Warning: Rate set (%i) didn't match requested rate (%i)!\n", obtained.freq, desired_speed); 102 | shm->speed = desired.freq; 103 | shm->channels = desired.channels; 104 | shm->samples = desired.samples*shm->channels; 105 | shm->samplepos = 0; 106 | shm->submission_chunk = 1; 107 | 108 | shm->buffer = NULL; 109 | 110 | Mix_SetPostMix(desired.callback, NULL); 111 | 112 | if (SDL_AudioDriverName(drivername, sizeof (drivername)) == NULL) 113 | strcpy(drivername, "(UNKNOWN)"); 114 | 115 | snd_inited = 1; 116 | SDL_PauseAudio(0); 117 | 118 | Con_Printf("Audio Subsystem initialized in SDL mode.\n"); 119 | Con_Printf ("SDL audio driver: %s\n", drivername); 120 | Con_Printf ("%5d stereo\n", shm->channels - 1); 121 | Con_Printf ("%5d samples\n", shm->samples); 122 | Con_Printf ("%5d samplepos\n", shm->samplepos); 123 | Con_Printf ("%5d samplebits\n", shm->samplebits); 124 | Con_Printf ("%5d submission_chunk\n", shm->submission_chunk); 125 | Con_Printf ("%5d speed\n", shm->speed); 126 | Con_Printf ("0x%x dma buffer address\n", (int) shm->buffer); 127 | Con_Printf ("%5d total_channels\n", total_channels); 128 | return 1; 129 | } 130 | 131 | int SNDDMA_GetDMAPos(void) 132 | { 133 | return shm->samplepos; 134 | } 135 | 136 | void SNDDMA_Shutdown(void) 137 | { 138 | if (snd_inited) 139 | { 140 | Con_Printf ("Shutting down SDL sound\n"); 141 | snd_inited = 0; 142 | // SDL_PauseAudio (1); 143 | SDL_CloseAudio(); 144 | SDL_QuitSubSystem(SDL_INIT_AUDIO); 145 | } 146 | } 147 | 148 | void SNDDMA_Submit(void) 149 | { 150 | } -------------------------------------------------------------------------------- /progs.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 | #include "pr_comp.h" // defs shared with qcc 22 | #include "progdefs.h" // generated by program cdefs 23 | 24 | typedef union eval_s 25 | { 26 | string_t string; 27 | float _float; 28 | float vector[3]; 29 | func_t function; 30 | int _int; 31 | int edict; 32 | } eval_t; 33 | 34 | #define MAX_ENT_LEAFS 16 35 | typedef struct edict_s 36 | { 37 | qboolean free; 38 | link_t area; // linked to a division node or leaf 39 | 40 | int num_leafs; 41 | short leafnums[MAX_ENT_LEAFS]; 42 | 43 | entity_state_t baseline; 44 | 45 | float freetime; // sv.time when the object was freed 46 | entvars_t v; // C exported fields from progs 47 | // other fields from progs come immediately after 48 | } edict_t; 49 | #define EDICT_FROM_AREA(l) STRUCT_FROM_LINK(l,edict_t,area) 50 | 51 | //============================================================================ 52 | 53 | extern dprograms_t *progs; 54 | extern dfunction_t *pr_functions; 55 | extern char *pr_strings; 56 | extern ddef_t *pr_globaldefs; 57 | extern ddef_t *pr_fielddefs; 58 | extern dstatement_t *pr_statements; 59 | extern globalvars_t *pr_global_struct; 60 | extern float *pr_globals; // same as pr_global_struct 61 | 62 | extern int pr_edict_size; // in bytes 63 | 64 | //============================================================================ 65 | 66 | void PR_Init (void); 67 | 68 | void PR_ExecuteProgram (func_t fnum); 69 | void PR_LoadProgs (void); 70 | 71 | void PR_Profile_f (void); 72 | 73 | edict_t *ED_Alloc (void); 74 | void ED_Free (edict_t *ed); 75 | 76 | char *ED_NewString (char *string); 77 | // returns a copy of the string allocated from the server's string heap 78 | 79 | void ED_Print (edict_t *ed); 80 | void ED_Write (FILE *f, edict_t *ed); 81 | char *ED_ParseEdict (char *data, edict_t *ent); 82 | 83 | void ED_WriteGlobals (FILE *f); 84 | void ED_ParseGlobals (char *data); 85 | 86 | void ED_LoadFromFile (char *data); 87 | 88 | //define EDICT_NUM(n) ((edict_t *)(sv.edicts+ (n)*pr_edict_size)) 89 | //define NUM_FOR_EDICT(e) (((byte *)(e) - sv.edicts)/pr_edict_size) 90 | 91 | edict_t *EDICT_NUM(int n); 92 | int NUM_FOR_EDICT(edict_t *e); 93 | 94 | #define NEXT_EDICT(e) ((edict_t *)( (byte *)e + pr_edict_size)) 95 | 96 | #define EDICT_TO_PROG(e) ((byte *)e - (byte *)sv.edicts) 97 | #define PROG_TO_EDICT(e) ((edict_t *)((byte *)sv.edicts + e)) 98 | 99 | //============================================================================ 100 | 101 | #define G_FLOAT(o) (pr_globals[o]) 102 | #define G_INT(o) (*(int *)&pr_globals[o]) 103 | #define G_EDICT(o) ((edict_t *)((byte *)sv.edicts+ *(int *)&pr_globals[o])) 104 | #define G_EDICTNUM(o) NUM_FOR_EDICT(G_EDICT(o)) 105 | #define G_VECTOR(o) (&pr_globals[o]) 106 | #define G_STRING(o) (pr_strings + *(string_t *)&pr_globals[o]) 107 | #define G_FUNCTION(o) (*(func_t *)&pr_globals[o]) 108 | 109 | #define E_FLOAT(e,o) (((float*)&e->v)[o]) 110 | #define E_INT(e,o) (*(int *)&((float*)&e->v)[o]) 111 | #define E_VECTOR(e,o) (&((float*)&e->v)[o]) 112 | #define E_STRING(e,o) (pr_strings + *(string_t *)&((float*)&e->v)[o]) 113 | 114 | extern int type_size[8]; 115 | 116 | typedef void (*builtin_t) (void); 117 | extern builtin_t *pr_builtins; 118 | extern int pr_numbuiltins; 119 | 120 | extern int pr_argc; 121 | 122 | extern qboolean pr_trace; 123 | extern dfunction_t *pr_xfunction; 124 | extern int pr_xstatement; 125 | 126 | extern unsigned short pr_crc; 127 | 128 | void PR_RunError (char *error, ...); 129 | 130 | void ED_PrintEdicts (void); 131 | void ED_PrintNum (int ent); 132 | 133 | eval_t *GetEdictFieldValue(edict_t *ed, char *field); 134 | 135 | -------------------------------------------------------------------------------- /d_part.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 | // d_part.c: software driver module for drawing particles 21 | 22 | #include "quakedef.h" 23 | #include "d_local.h" 24 | 25 | 26 | /* 27 | ============== 28 | D_EndParticles 29 | ============== 30 | */ 31 | void D_EndParticles (void) 32 | { 33 | // not used by software driver 34 | } 35 | 36 | 37 | /* 38 | ============== 39 | D_StartParticles 40 | ============== 41 | */ 42 | void D_StartParticles (void) 43 | { 44 | // not used by software driver 45 | } 46 | 47 | 48 | #if !id386 49 | 50 | /* 51 | ============== 52 | D_DrawParticle 53 | ============== 54 | */ 55 | void D_DrawParticle (particle_t *pparticle) 56 | { 57 | vec3_t local, transformed; 58 | float zi; 59 | byte *pdest; 60 | short *pz; 61 | int i, izi, pix, count, u, v; 62 | 63 | // transform point 64 | VectorSubtract (pparticle->org, r_origin, local); 65 | 66 | transformed[0] = DotProduct(local, r_pright); 67 | transformed[1] = DotProduct(local, r_pup); 68 | transformed[2] = DotProduct(local, r_ppn); 69 | 70 | if (transformed[2] < PARTICLE_Z_CLIP) 71 | return; 72 | 73 | // project the point 74 | // FIXME: preadjust xcenter and ycenter 75 | zi = 1.0 / transformed[2]; 76 | u = (int)(xcenter + zi * transformed[0] + 0.5); 77 | v = (int)(ycenter - zi * transformed[1] + 0.5); 78 | 79 | if ((v > d_vrectbottom_particle) || 80 | (u > d_vrectright_particle) || 81 | (v < d_vrecty) || 82 | (u < d_vrectx)) 83 | { 84 | return; 85 | } 86 | 87 | pz = d_pzbuffer + (d_zwidth * v) + u; 88 | pdest = d_viewbuffer + d_scantable[v] + u; 89 | izi = (int)(zi * 0x8000); 90 | 91 | pix = izi >> d_pix_shift; 92 | 93 | if (pix < d_pix_min) 94 | pix = d_pix_min; 95 | else if (pix > d_pix_max) 96 | pix = d_pix_max; 97 | 98 | switch (pix) 99 | { 100 | case 1: 101 | count = 1 << d_y_aspect_shift; 102 | 103 | for ( ; count ; count--, pz += d_zwidth, pdest += screenwidth) 104 | { 105 | if (pz[0] <= izi) 106 | { 107 | pz[0] = izi; 108 | pdest[0] = pparticle->color; 109 | } 110 | } 111 | break; 112 | 113 | case 2: 114 | count = 2 << d_y_aspect_shift; 115 | 116 | for ( ; count ; count--, pz += d_zwidth, pdest += screenwidth) 117 | { 118 | if (pz[0] <= izi) 119 | { 120 | pz[0] = izi; 121 | pdest[0] = pparticle->color; 122 | } 123 | 124 | if (pz[1] <= izi) 125 | { 126 | pz[1] = izi; 127 | pdest[1] = pparticle->color; 128 | } 129 | } 130 | break; 131 | 132 | case 3: 133 | count = 3 << d_y_aspect_shift; 134 | 135 | for ( ; count ; count--, pz += d_zwidth, pdest += screenwidth) 136 | { 137 | if (pz[0] <= izi) 138 | { 139 | pz[0] = izi; 140 | pdest[0] = pparticle->color; 141 | } 142 | 143 | if (pz[1] <= izi) 144 | { 145 | pz[1] = izi; 146 | pdest[1] = pparticle->color; 147 | } 148 | 149 | if (pz[2] <= izi) 150 | { 151 | pz[2] = izi; 152 | pdest[2] = pparticle->color; 153 | } 154 | } 155 | break; 156 | 157 | case 4: 158 | count = 4 << d_y_aspect_shift; 159 | 160 | for ( ; count ; count--, pz += d_zwidth, pdest += screenwidth) 161 | { 162 | if (pz[0] <= izi) 163 | { 164 | pz[0] = izi; 165 | pdest[0] = pparticle->color; 166 | } 167 | 168 | if (pz[1] <= izi) 169 | { 170 | pz[1] = izi; 171 | pdest[1] = pparticle->color; 172 | } 173 | 174 | if (pz[2] <= izi) 175 | { 176 | pz[2] = izi; 177 | pdest[2] = pparticle->color; 178 | } 179 | 180 | if (pz[3] <= izi) 181 | { 182 | pz[3] = izi; 183 | pdest[3] = pparticle->color; 184 | } 185 | } 186 | break; 187 | 188 | default: 189 | count = pix << d_y_aspect_shift; 190 | 191 | for ( ; count ; count--, pz += d_zwidth, pdest += screenwidth) 192 | { 193 | for (i=0 ; icolor; 199 | } 200 | } 201 | } 202 | break; 203 | } 204 | } 205 | 206 | #endif // !id386 207 | 208 | -------------------------------------------------------------------------------- /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 | 21 | // cmd.h -- Command buffer and command execution 22 | 23 | //=========================================================================== 24 | 25 | /* 26 | 27 | Any number of commands can be added in a frame, from several different sources. 28 | Most commands come from either keybindings or console line input, but remote 29 | servers can also send across commands and entire text files can be execed. 30 | 31 | The + command line options are also added to the command buffer. 32 | 33 | The game starts with a Cbuf_AddText ("exec quake.rc\n"); Cbuf_Execute (); 34 | 35 | */ 36 | 37 | 38 | void Cbuf_Init (void); 39 | // allocates an initial text buffer that will grow as needed 40 | 41 | void Cbuf_AddText (char *text); 42 | // as new commands are generated from the console or keybindings, 43 | // the text is added to the end of the command buffer. 44 | 45 | void Cbuf_InsertText (char *text); 46 | // when a command wants to issue other commands immediately, the text is 47 | // inserted at the beginning of the buffer, before any remaining unexecuted 48 | // commands. 49 | 50 | void Cbuf_Execute (void); 51 | // Pulls off \n terminated lines of text from the command buffer and sends 52 | // them through Cmd_ExecuteString. Stops when the buffer is empty. 53 | // Normally called once per frame, but may be explicitly invoked. 54 | // Do not call inside a command function! 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 | Commands can come from three sources, but the handler functions may choose 64 | to dissallow the action or forward it to a remote server if the source is 65 | not apropriate. 66 | 67 | */ 68 | 69 | typedef void (*xcommand_t) (void); 70 | 71 | typedef enum 72 | { 73 | src_client, // came in over a net connection as a clc_stringcmd 74 | // host_client will be valid during this state. 75 | src_command // from the command buffer 76 | } cmd_source_t; 77 | 78 | extern cmd_source_t cmd_source; 79 | 80 | void Cmd_Init (void); 81 | 82 | void Cmd_AddCommand (char *cmd_name, xcommand_t function); 83 | // called by the init functions of other parts of the program to 84 | // register commands and functions to call for them. 85 | // The cmd_name is referenced later, so it should not be in temp memory 86 | 87 | qboolean Cmd_Exists (char *cmd_name); 88 | // used by the cvar code to check for cvar / command name overlap 89 | 90 | char *Cmd_CompleteCommand (char *partial); 91 | // attempts to match a partial command for automatic command line completion 92 | // returns NULL if nothing fits 93 | 94 | int Cmd_Argc (void); 95 | char *Cmd_Argv (int arg); 96 | char *Cmd_Args (void); 97 | // The functions that execute commands get their parameters with these 98 | // functions. Cmd_Argv () will return an empty string, not a NULL 99 | // if arg > argc, so string operations are allways safe. 100 | 101 | int Cmd_CheckParm (char *parm); 102 | // Returns the position (1 to argc-1) in the command's argument list 103 | // where the given parameter apears, or 0 if not present 104 | 105 | void Cmd_TokenizeString (char *text); 106 | // Takes a null terminated string. Does not need to be /n terminated. 107 | // breaks the string up into arg tokens. 108 | 109 | void Cmd_ExecuteString (char *text, cmd_source_t src); 110 | // Parses a single line of text into arguments and tries to execute it. 111 | // The text can come from the command buffer, a remote client, or stdin. 112 | 113 | void Cmd_ForwardToServer (void); 114 | // adds the current command line as a clc_stringcmd to the client message. 115 | // things like godmode, noclip, etc, are commands directed to the server, 116 | // so when they are typed in at the console, they will need to be forwarded. 117 | 118 | void Cmd_Print (char *text); 119 | // used by command functions to send output to either the graphics console or 120 | // passed as a print message to the client 121 | 122 | -------------------------------------------------------------------------------- /asm_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 | // asm_draw.h 22 | // 23 | // Include file for asm drawing routines. 24 | // 25 | 26 | // 27 | // !!! note that this file must match the corresponding C structures at all 28 | // times !!! 29 | // 30 | 31 | // !!! if this is changed, it must be changed in r_local.h too !!! 32 | #define NEAR_CLIP 0.01 33 | 34 | // !!! if this is changed, it must be changed in r_local.h too !!! 35 | #define CYCLE 128 36 | 37 | // espan_t structure 38 | // !!! if this is changed, it must be changed in r_shared.h too !!! 39 | #define espan_t_u 0 40 | #define espan_t_v 4 41 | #define espan_t_count 8 42 | #define espan_t_pnext 12 43 | #define espan_t_size 16 44 | 45 | // sspan_t structure 46 | // !!! if this is changed, it must be changed in d_local.h too !!! 47 | #define sspan_t_u 0 48 | #define sspan_t_v 4 49 | #define sspan_t_count 8 50 | #define sspan_t_size 12 51 | 52 | // spanpackage_t structure 53 | // !!! if this is changed, it must be changed in d_polyset.c too !!! 54 | #define spanpackage_t_pdest 0 55 | #define spanpackage_t_pz 4 56 | #define spanpackage_t_count 8 57 | #define spanpackage_t_ptex 12 58 | #define spanpackage_t_sfrac 16 59 | #define spanpackage_t_tfrac 20 60 | #define spanpackage_t_light 24 61 | #define spanpackage_t_zi 28 62 | #define spanpackage_t_size 32 63 | 64 | // edge_t structure 65 | // !!! if this is changed, it must be changed in r_shared.h too !!! 66 | #define et_u 0 67 | #define et_u_step 4 68 | #define et_prev 8 69 | #define et_next 12 70 | #define et_surfs 16 71 | #define et_nextremove 20 72 | #define et_nearzi 24 73 | #define et_owner 28 74 | #define et_size 32 75 | 76 | // surf_t structure 77 | // !!! if this is changed, it must be changed in r_shared.h too !!! 78 | #define SURF_T_SHIFT 6 79 | #define st_next 0 80 | #define st_prev 4 81 | #define st_spans 8 82 | #define st_key 12 83 | #define st_last_u 16 84 | #define st_spanstate 20 85 | #define st_flags 24 86 | #define st_data 28 87 | #define st_entity 32 88 | #define st_nearzi 36 89 | #define st_insubmodel 40 90 | #define st_d_ziorigin 44 91 | #define st_d_zistepu 48 92 | #define st_d_zistepv 52 93 | #define st_pad 56 94 | #define st_size 64 95 | 96 | // clipplane_t structure 97 | // !!! if this is changed, it must be changed in r_local.h too !!! 98 | #define cp_normal 0 99 | #define cp_dist 12 100 | #define cp_next 16 101 | #define cp_leftedge 20 102 | #define cp_rightedge 21 103 | #define cp_reserved 22 104 | #define cp_size 24 105 | 106 | // medge_t structure 107 | // !!! if this is changed, it must be changed in model.h too !!! 108 | #define me_v 0 109 | #define me_cachededgeoffset 4 110 | #define me_size 8 111 | 112 | // mvertex_t structure 113 | // !!! if this is changed, it must be changed in model.h too !!! 114 | #define mv_position 0 115 | #define mv_size 12 116 | 117 | // refdef_t structure 118 | // !!! if this is changed, it must be changed in render.h too !!! 119 | #define rd_vrect 0 120 | #define rd_aliasvrect 20 121 | #define rd_vrectright 40 122 | #define rd_vrectbottom 44 123 | #define rd_aliasvrectright 48 124 | #define rd_aliasvrectbottom 52 125 | #define rd_vrectrightedge 56 126 | #define rd_fvrectx 60 127 | #define rd_fvrecty 64 128 | #define rd_fvrectx_adj 68 129 | #define rd_fvrecty_adj 72 130 | #define rd_vrect_x_adj_shift20 76 131 | #define rd_vrectright_adj_shift20 80 132 | #define rd_fvrectright_adj 84 133 | #define rd_fvrectbottom_adj 88 134 | #define rd_fvrectright 92 135 | #define rd_fvrectbottom 96 136 | #define rd_horizontalFieldOfView 100 137 | #define rd_xOrigin 104 138 | #define rd_yOrigin 108 139 | #define rd_vieworg 112 140 | #define rd_viewangles 124 141 | #define rd_ambientlight 136 142 | #define rd_size 140 143 | 144 | // mtriangle_t structure 145 | // !!! if this is changed, it must be changed in model.h too !!! 146 | #define mtri_facesfront 0 147 | #define mtri_vertindex 4 148 | #define mtri_size 16 // !!! if this changes, array indexing in !!! 149 | // !!! d_polysa.s must be changed to match !!! 150 | #define mtri_shift 4 151 | 152 | -------------------------------------------------------------------------------- /sys_null.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 | // sys_null.h -- null system driver to aid porting efforts 21 | 22 | #include "quakedef.h" 23 | #include "errno.h" 24 | 25 | /* 26 | =============================================================================== 27 | 28 | FILE IO 29 | 30 | =============================================================================== 31 | */ 32 | 33 | #define MAX_HANDLES 10 34 | FILE *sys_handles[MAX_HANDLES]; 35 | 36 | int findhandle (void) 37 | { 38 | int i; 39 | 40 | for (i=1 ; inext) 37 | if (!Q_strcmp (var_name, var->name)) 38 | return var; 39 | 40 | return NULL; 41 | } 42 | 43 | /* 44 | ============ 45 | Cvar_VariableValue 46 | ============ 47 | */ 48 | float Cvar_VariableValue (char *var_name) 49 | { 50 | cvar_t *var; 51 | 52 | var = Cvar_FindVar (var_name); 53 | if (!var) 54 | return 0; 55 | return Q_atof (var->string); 56 | } 57 | 58 | 59 | /* 60 | ============ 61 | Cvar_VariableString 62 | ============ 63 | */ 64 | char *Cvar_VariableString (char *var_name) 65 | { 66 | cvar_t *var; 67 | 68 | var = Cvar_FindVar (var_name); 69 | if (!var) 70 | return cvar_null_string; 71 | return var->string; 72 | } 73 | 74 | 75 | /* 76 | ============ 77 | Cvar_CompleteVariable 78 | ============ 79 | */ 80 | char *Cvar_CompleteVariable (char *partial) 81 | { 82 | cvar_t *cvar; 83 | int len; 84 | 85 | len = Q_strlen(partial); 86 | 87 | if (!len) 88 | return NULL; 89 | 90 | // check functions 91 | for (cvar=cvar_vars ; cvar ; cvar=cvar->next) 92 | if (!Q_strncmp (partial,cvar->name, len)) 93 | return cvar->name; 94 | 95 | return NULL; 96 | } 97 | 98 | 99 | /* 100 | ============ 101 | Cvar_Set 102 | ============ 103 | */ 104 | void Cvar_Set (char *var_name, char *value) 105 | { 106 | cvar_t *var; 107 | qboolean changed; 108 | 109 | var = Cvar_FindVar (var_name); 110 | if (!var) 111 | { // there is an error in C code if this happens 112 | Con_Printf ("Cvar_Set: variable %s not found\n", var_name); 113 | return; 114 | } 115 | 116 | changed = Q_strcmp(var->string, value); 117 | 118 | Z_Free (var->string); // free the old value string 119 | 120 | var->string = Z_Malloc (Q_strlen(value)+1); 121 | Q_strcpy (var->string, value); 122 | var->value = Q_atof (var->string); 123 | if (var->server && changed) 124 | { 125 | if (sv.active) 126 | SV_BroadcastPrintf ("\"%s\" changed to \"%s\"\n", var->name, var->string); 127 | } 128 | } 129 | 130 | /* 131 | ============ 132 | Cvar_SetValue 133 | ============ 134 | */ 135 | void Cvar_SetValue (char *var_name, float value) 136 | { 137 | char val[32]; 138 | 139 | sprintf (val, "%f",value); 140 | Cvar_Set (var_name, val); 141 | } 142 | 143 | 144 | /* 145 | ============ 146 | Cvar_RegisterVariable 147 | 148 | Adds a freestanding variable to the variable list. 149 | ============ 150 | */ 151 | void Cvar_RegisterVariable (cvar_t *variable) 152 | { 153 | char *oldstr; 154 | 155 | // first check to see if it has allready been defined 156 | if (Cvar_FindVar (variable->name)) 157 | { 158 | Con_Printf ("Can't register variable %s, allready defined\n", variable->name); 159 | return; 160 | } 161 | 162 | // check for overlap with a command 163 | if (Cmd_Exists (variable->name)) 164 | { 165 | Con_Printf ("Cvar_RegisterVariable: %s is a command\n", variable->name); 166 | return; 167 | } 168 | 169 | // copy the value off, because future sets will Z_Free it 170 | oldstr = variable->string; 171 | variable->string = Z_Malloc (Q_strlen(variable->string)+1); 172 | Q_strcpy (variable->string, oldstr); 173 | variable->value = Q_atof (variable->string); 174 | 175 | // link the variable in 176 | variable->next = cvar_vars; 177 | cvar_vars = variable; 178 | } 179 | 180 | /* 181 | ============ 182 | Cvar_Command 183 | 184 | Handles variable inspection and changing from the console 185 | ============ 186 | */ 187 | qboolean Cvar_Command (void) 188 | { 189 | cvar_t *v; 190 | 191 | // check variables 192 | v = Cvar_FindVar (Cmd_Argv(0)); 193 | if (!v) 194 | return false; 195 | 196 | // perform a variable print or set 197 | if (Cmd_Argc() == 1) 198 | { 199 | Con_Printf ("\"%s\" is \"%s\"\n", v->name, v->string); 200 | return true; 201 | } 202 | 203 | Cvar_Set (v->name, Cmd_Argv(1)); 204 | return true; 205 | } 206 | 207 | 208 | /* 209 | ============ 210 | Cvar_WriteVariables 211 | 212 | Writes lines containing "set variable value" for all variables 213 | with the archive flag set to true. 214 | ============ 215 | */ 216 | void Cvar_WriteVariables (FILE *f) 217 | { 218 | cvar_t *var; 219 | 220 | for (var = cvar_vars ; var ; var = var->next) 221 | if (var->archive) 222 | fprintf (f, "%s \"%s\"\n", var->name, var->string); 223 | } 224 | 225 | -------------------------------------------------------------------------------- /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 | mnode_t *r_pefragtopnode; 25 | 26 | 27 | //=========================================================================== 28 | 29 | /* 30 | =============================================================================== 31 | 32 | ENTITY FRAGMENT FUNCTIONS 33 | 34 | =============================================================================== 35 | */ 36 | 37 | efrag_t **lastlink; 38 | 39 | vec3_t r_emins, r_emaxs; 40 | 41 | entity_t *r_addent; 42 | 43 | 44 | /* 45 | ================ 46 | R_RemoveEfrags 47 | 48 | Call when removing an object from the world or moving it to another position 49 | ================ 50 | */ 51 | void R_RemoveEfrags (entity_t *ent) 52 | { 53 | efrag_t *ef, *old, *walk, **prev; 54 | 55 | ef = ent->efrag; 56 | 57 | while (ef) 58 | { 59 | prev = &ef->leaf->efrags; 60 | while (1) 61 | { 62 | walk = *prev; 63 | if (!walk) 64 | break; 65 | if (walk == ef) 66 | { // remove this fragment 67 | *prev = ef->leafnext; 68 | break; 69 | } 70 | else 71 | prev = &walk->leafnext; 72 | } 73 | 74 | old = ef; 75 | ef = ef->entnext; 76 | 77 | // put it on the free list 78 | old->entnext = cl.free_efrags; 79 | cl.free_efrags = old; 80 | } 81 | 82 | ent->efrag = NULL; 83 | } 84 | 85 | /* 86 | =================== 87 | R_SplitEntityOnNode 88 | =================== 89 | */ 90 | void R_SplitEntityOnNode (mnode_t *node) 91 | { 92 | efrag_t *ef; 93 | mplane_t *splitplane; 94 | mleaf_t *leaf; 95 | int sides; 96 | 97 | if (node->contents == CONTENTS_SOLID) 98 | { 99 | return; 100 | } 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_Printf ("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 | /* 159 | =========== 160 | R_AddEfrags 161 | =========== 162 | */ 163 | void R_AddEfrags (entity_t *ent) 164 | { 165 | model_t *entmodel; 166 | int i; 167 | 168 | if (!ent->model) 169 | return; 170 | 171 | r_addent = ent; 172 | 173 | lastlink = &ent->efrag; 174 | r_pefragtopnode = NULL; 175 | 176 | entmodel = ent->model; 177 | 178 | for (i=0 ; i<3 ; i++) 179 | { 180 | r_emins[i] = ent->origin[i] + entmodel->mins[i]; 181 | r_emaxs[i] = ent->origin[i] + entmodel->maxs[i]; 182 | } 183 | 184 | R_SplitEntityOnNode (cl.worldmodel->nodes); 185 | 186 | ent->topnode = r_pefragtopnode; 187 | } 188 | 189 | 190 | /* 191 | ================ 192 | R_StoreEfrags 193 | 194 | // FIXME: a lot of this goes away with edge-based 195 | ================ 196 | */ 197 | void R_StoreEfrags (efrag_t **ppefrag) 198 | { 199 | entity_t *pent; 200 | model_t *clmodel; 201 | efrag_t *pefrag; 202 | 203 | 204 | while ((pefrag = *ppefrag) != NULL) 205 | { 206 | pent = pefrag->entity; 207 | clmodel = pent->model; 208 | 209 | switch (clmodel->type) 210 | { 211 | case mod_alias: 212 | case mod_brush: 213 | case mod_sprite: 214 | pent = pefrag->entity; 215 | 216 | if ((pent->visframe != r_framecount) && 217 | (cl_numvisedicts < MAX_VISEDICTS)) 218 | { 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 | 225 | ppefrag = &pefrag->leafnext; 226 | break; 227 | 228 | default: 229 | Sys_Error ("R_StoreEfrags: Bad entity type %d\n", clmodel->type); 230 | } 231 | } 232 | } 233 | 234 | 235 | -------------------------------------------------------------------------------- /snd_sun.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 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include "quakedef.h" 32 | 33 | int audio_fd; 34 | int snd_inited; 35 | 36 | static int bufpos; 37 | static int wbufp; 38 | static audio_info_t info; 39 | 40 | #define BUFFER_SIZE 8192 41 | 42 | unsigned char dma_buffer[BUFFER_SIZE]; 43 | unsigned char pend_buffer[BUFFER_SIZE]; 44 | int pending; 45 | 46 | static int lastwrite = 0; 47 | 48 | qboolean SNDDMA_Init(void) 49 | { 50 | int rc; 51 | int fmt; 52 | int tmp; 53 | int i; 54 | char *s; 55 | int caps; 56 | 57 | if (snd_inited) { 58 | printf("Sound already init'd\n"); 59 | return; 60 | } 61 | 62 | shm = &sn; 63 | shm->splitbuffer = 0; 64 | 65 | audio_fd = open("/dev/audio", O_WRONLY|O_NDELAY); 66 | 67 | if (audio_fd < 0) { 68 | if (errno == EBUSY) { 69 | Con_Printf("Audio device is being used by another process\n"); 70 | } 71 | perror("/dev/audio"); 72 | Con_Printf("Could not open /dev/audio\n"); 73 | return (0); 74 | } 75 | 76 | if (ioctl(audio_fd, AUDIO_GETINFO, &info) < 0) { 77 | perror("/dev/audio"); 78 | Con_Printf("Could not communicate with audio device.\n"); 79 | close(audio_fd); 80 | return 0; 81 | } 82 | 83 | // 84 | // set to nonblock 85 | // 86 | if (fcntl(audio_fd, F_SETFL, O_NONBLOCK) < 0) { 87 | perror("/dev/audio"); 88 | close(audio_fd); 89 | return 0; 90 | } 91 | 92 | AUDIO_INITINFO(&info); 93 | 94 | shm->speed = 11025; 95 | 96 | // try 16 bit stereo 97 | info.play.encoding = AUDIO_ENCODING_LINEAR; 98 | info.play.sample_rate = 11025; 99 | info.play.channels = 2; 100 | info.play.precision = 16; 101 | 102 | if (ioctl(audio_fd, AUDIO_SETINFO, &info) < 0) { 103 | info.play.encoding = AUDIO_ENCODING_LINEAR; 104 | info.play.sample_rate = 11025; 105 | info.play.channels = 1; 106 | info.play.precision = 16; 107 | if (ioctl(audio_fd, AUDIO_SETINFO, &info) < 0) { 108 | Con_Printf("Incapable sound hardware.\n"); 109 | close(audio_fd); 110 | return 0; 111 | } 112 | Con_Printf("16 bit mono sound initialized\n"); 113 | shm->samplebits = 16; 114 | shm->channels = 1; 115 | } else { // 16 bit stereo 116 | Con_Printf("16 bit stereo sound initialized\n"); 117 | shm->samplebits = 16; 118 | shm->channels = 2; 119 | } 120 | 121 | shm->soundalive = true; 122 | shm->samples = sizeof(dma_buffer) / (shm->samplebits/8); 123 | shm->samplepos = 0; 124 | shm->submission_chunk = 1; 125 | shm->buffer = (unsigned char *)dma_buffer; 126 | 127 | snd_inited = 1; 128 | 129 | return 1; 130 | } 131 | 132 | int SNDDMA_GetDMAPos(void) 133 | { 134 | if (!snd_inited) 135 | return (0); 136 | 137 | if (ioctl(audio_fd, AUDIO_GETINFO, &info) < 0) { 138 | perror("/dev/audio"); 139 | Con_Printf("Could not communicate with audio device.\n"); 140 | close(audio_fd); 141 | snd_inited = 0; 142 | return (0); 143 | } 144 | 145 | return ((info.play.samples*shm->channels) % shm->samples); 146 | } 147 | 148 | int SNDDMA_GetSamples(void) 149 | { 150 | if (!snd_inited) 151 | return (0); 152 | 153 | if (ioctl(audio_fd, AUDIO_GETINFO, &info) < 0) { 154 | perror("/dev/audio"); 155 | Con_Printf("Could not communicate with audio device.\n"); 156 | close(audio_fd); 157 | snd_inited = 0; 158 | return (0); 159 | } 160 | 161 | return info.play.samples; 162 | } 163 | 164 | void SNDDMA_Shutdown(void) 165 | { 166 | if (snd_inited) { 167 | close(audio_fd); 168 | snd_inited = 0; 169 | } 170 | } 171 | 172 | /* 173 | ============== 174 | SNDDMA_Submit 175 | 176 | Send sound to device if buffer isn't really the dma buffer 177 | =============== 178 | */ 179 | void SNDDMA_Submit(void) 180 | { 181 | int samps; 182 | int bsize; 183 | int bytes, b; 184 | static unsigned char writebuf[1024]; 185 | unsigned char *p; 186 | int idx; 187 | int stop = paintedtime; 188 | extern int soundtime; 189 | 190 | if (paintedtime < wbufp) 191 | wbufp = 0; // reset 192 | 193 | bsize = shm->channels * (shm->samplebits/8); 194 | bytes = (paintedtime - wbufp) * bsize; 195 | 196 | if (!bytes) 197 | return; 198 | 199 | if (bytes > sizeof(writebuf)) { 200 | bytes = sizeof(writebuf); 201 | stop = wbufp + bytes/bsize; 202 | } 203 | 204 | p = writebuf; 205 | idx = (wbufp*bsize) & (BUFFER_SIZE - 1); 206 | 207 | for (b = bytes; b; b--) { 208 | *p++ = dma_buffer[idx]; 209 | idx = (idx + 1) & (BUFFER_SIZE - 1); 210 | } 211 | 212 | wbufp = stop; 213 | 214 | if (write(audio_fd, writebuf, bytes) < bytes) 215 | printf("audio can't keep up!\n"); 216 | 217 | } 218 | 219 | -------------------------------------------------------------------------------- /protocol.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 | // protocol.h -- communications protocols 21 | 22 | #define PROTOCOL_VERSION 15 23 | 24 | // if the high bit of the servercmd is set, the low bits are fast update flags: 25 | #define U_MOREBITS (1<<0) 26 | #define U_ORIGIN1 (1<<1) 27 | #define U_ORIGIN2 (1<<2) 28 | #define U_ORIGIN3 (1<<3) 29 | #define U_ANGLE2 (1<<4) 30 | #define U_NOLERP (1<<5) // don't interpolate movement 31 | #define U_FRAME (1<<6) 32 | #define U_SIGNAL (1<<7) // just differentiates from other updates 33 | 34 | // svc_update can pass all of the fast update bits, plus more 35 | #define U_ANGLE1 (1<<8) 36 | #define U_ANGLE3 (1<<9) 37 | #define U_MODEL (1<<10) 38 | #define U_COLORMAP (1<<11) 39 | #define U_SKIN (1<<12) 40 | #define U_EFFECTS (1<<13) 41 | #define U_LONGENTITY (1<<14) 42 | 43 | 44 | #define SU_VIEWHEIGHT (1<<0) 45 | #define SU_IDEALPITCH (1<<1) 46 | #define SU_PUNCH1 (1<<2) 47 | #define SU_PUNCH2 (1<<3) 48 | #define SU_PUNCH3 (1<<4) 49 | #define SU_VELOCITY1 (1<<5) 50 | #define SU_VELOCITY2 (1<<6) 51 | #define SU_VELOCITY3 (1<<7) 52 | //define SU_AIMENT (1<<8) AVAILABLE BIT 53 | #define SU_ITEMS (1<<9) 54 | #define SU_ONGROUND (1<<10) // no data follows, the bit is it 55 | #define SU_INWATER (1<<11) // no data follows, the bit is it 56 | #define SU_WEAPONFRAME (1<<12) 57 | #define SU_ARMOR (1<<13) 58 | #define SU_WEAPON (1<<14) 59 | 60 | // a sound with no channel is a local only sound 61 | #define SND_VOLUME (1<<0) // a byte 62 | #define SND_ATTENUATION (1<<1) // a byte 63 | #define SND_LOOPING (1<<2) // a long 64 | 65 | 66 | // defaults for clientinfo messages 67 | #define DEFAULT_VIEWHEIGHT 22 68 | 69 | 70 | // game types sent by serverinfo 71 | // these determine which intermission screen plays 72 | #define GAME_COOP 0 73 | #define GAME_DEATHMATCH 1 74 | 75 | //================== 76 | // note that there are some defs.qc that mirror to these numbers 77 | // also related to svc_strings[] in cl_parse 78 | //================== 79 | 80 | // 81 | // server to client 82 | // 83 | #define svc_bad 0 84 | #define svc_nop 1 85 | #define svc_disconnect 2 86 | #define svc_updatestat 3 // [byte] [long] 87 | #define svc_version 4 // [long] server version 88 | #define svc_setview 5 // [short] entity number 89 | #define svc_sound 6 // 90 | #define svc_time 7 // [float] server time 91 | #define svc_print 8 // [string] null terminated string 92 | #define svc_stufftext 9 // [string] stuffed into client's console buffer 93 | // the string should be \n terminated 94 | #define svc_setangle 10 // [angle3] set the view angle to this absolute value 95 | 96 | #define svc_serverinfo 11 // [long] version 97 | // [string] signon string 98 | // [string]..[0]model cache 99 | // [string]...[0]sounds cache 100 | #define svc_lightstyle 12 // [byte] [string] 101 | #define svc_updatename 13 // [byte] [string] 102 | #define svc_updatefrags 14 // [byte] [short] 103 | #define svc_clientdata 15 // 104 | #define svc_stopsound 16 // 105 | #define svc_updatecolors 17 // [byte] [byte] 106 | #define svc_particle 18 // [vec3] 107 | #define svc_damage 19 108 | 109 | #define svc_spawnstatic 20 110 | // svc_spawnbinary 21 111 | #define svc_spawnbaseline 22 112 | 113 | #define svc_temp_entity 23 114 | 115 | #define svc_setpause 24 // [byte] on / off 116 | #define svc_signonnum 25 // [byte] used for the signon sequence 117 | 118 | #define svc_centerprint 26 // [string] to put in center of the screen 119 | 120 | #define svc_killedmonster 27 121 | #define svc_foundsecret 28 122 | 123 | #define svc_spawnstaticsound 29 // [coord3] [byte] samp [byte] vol [byte] aten 124 | 125 | #define svc_intermission 30 // [string] music 126 | #define svc_finale 31 // [string] music [string] text 127 | 128 | #define svc_cdtrack 32 // [byte] track [byte] looptrack 129 | #define svc_sellscreen 33 130 | 131 | #define svc_cutscene 34 132 | 133 | // 134 | // client to server 135 | // 136 | #define clc_bad 0 137 | #define clc_nop 1 138 | #define clc_disconnect 2 139 | #define clc_move 3 // [usercmd_t] 140 | #define clc_stringcmd 4 // [string] message 141 | 142 | 143 | // 144 | // temp entity events 145 | // 146 | #define TE_SPIKE 0 147 | #define TE_SUPERSPIKE 1 148 | #define TE_GUNSHOT 2 149 | #define TE_EXPLOSION 3 150 | #define TE_TAREXPLOSION 4 151 | #define TE_LIGHTNING1 5 152 | #define TE_LIGHTNING2 6 153 | #define TE_WIZSPIKE 7 154 | #define TE_KNIGHTSPIKE 8 155 | #define TE_LIGHTNING3 9 156 | #define TE_LAVASPLASH 10 157 | #define TE_TELEPORT 11 158 | #define TE_EXPLOSION2 12 159 | 160 | // PGM 01/21/97 161 | #define TE_BEAM 13 162 | // PGM 01/21/97 163 | 164 | #ifdef QUAKE2 165 | #define TE_IMPLOSION 14 166 | #define TE_RAILTRAIL 15 167 | #endif 168 | --------------------------------------------------------------------------------