├── .gitignore ├── LICENSE ├── Makefile ├── Makefile-soso ├── README.md ├── client ├── adivtab.h ├── anorms.h ├── block16.h ├── block8.h ├── cdaudio.h ├── cl_cin.c ├── cl_ents.c ├── cl_fx.c ├── cl_input.c ├── cl_inv.c ├── cl_main.c ├── cl_newfx.c ├── cl_parse.c ├── cl_pred.c ├── cl_scrn.c ├── cl_tent.c ├── cl_view.c ├── client.h ├── console.c ├── console.h ├── input.h ├── keys.c ├── keys.h ├── menu.c ├── qmenu.c ├── qmenu.h ├── ref.h ├── screen.h ├── snd_dma.c ├── snd_loc.h ├── snd_mem.c ├── snd_mix.c ├── sound.h └── vid.h ├── ctf ├── 2do.txt ├── Makefile.Linux.i386 ├── ctf.001 ├── ctf.def ├── ctf.dsp ├── ctf.plg ├── docs │ ├── admin.gif │ ├── adminset.gif │ ├── automac.gif │ ├── ghost.jpg │ ├── grapple.jpg │ ├── layout.jpg │ ├── mainctf_back.jpg │ ├── menu.gif │ ├── q2ctf.html │ ├── say_team.gif │ ├── stats.jpg │ ├── tech1.gif │ ├── tech2.gif │ ├── tech3.gif │ └── tech4.gif ├── g_ai.c ├── g_chase.c ├── g_cmds.c ├── g_combat.c ├── g_ctf.c ├── g_ctf.h ├── g_func.c ├── g_items.c ├── g_local.h ├── g_main.c ├── g_misc.c ├── g_monster.c ├── g_phys.c ├── g_save.c ├── g_spawn.c ├── g_svcmds.c ├── g_target.c ├── g_trigger.c ├── g_utils.c ├── g_weapon.c ├── game.h ├── layout.txt ├── m_move.c ├── m_player.h ├── p_client.c ├── p_hud.c ├── p_menu.c ├── p_menu.h ├── p_trail.c ├── p_view.c ├── p_weapon.c ├── q_shared.c └── q_shared.h ├── game ├── g_ai.c ├── g_chase.c ├── g_cmds.c ├── g_combat.c ├── g_func.c ├── g_items.c ├── g_local.h ├── g_main.c ├── g_misc.c ├── g_monster.c ├── g_phys.c ├── g_save.c ├── g_spawn.c ├── g_svcmds.c ├── g_target.c ├── g_trigger.c ├── g_turret.c ├── g_utils.c ├── g_weapon.c ├── game.001 ├── game.def ├── game.dsp ├── game.h ├── game.plg ├── m_actor.c ├── m_actor.h ├── m_berserk.c ├── m_berserk.h ├── m_boss2.c ├── m_boss2.h ├── m_boss3.c ├── m_boss31.c ├── m_boss31.h ├── m_boss32.c ├── m_boss32.h ├── m_brain.c ├── m_brain.h ├── m_chick.c ├── m_chick.h ├── m_flash.c ├── m_flipper.c ├── m_flipper.h ├── m_float.c ├── m_float.h ├── m_flyer.c ├── m_flyer.h ├── m_gladiator.c ├── m_gladiator.h ├── m_gunner.c ├── m_gunner.h ├── m_hover.c ├── m_hover.h ├── m_infantry.c ├── m_infantry.h ├── m_insane.c ├── m_insane.h ├── m_medic.c ├── m_medic.h ├── m_move.c ├── m_mutant.c ├── m_mutant.h ├── m_parasite.c ├── m_parasite.h ├── m_player.h ├── m_rider.h ├── m_soldier.c ├── m_soldier.h ├── m_supertank.c ├── m_supertank.h ├── m_tank.c ├── m_tank.h ├── p_client.c ├── p_hud.c ├── p_trail.c ├── p_view.c ├── p_weapon.c ├── q_shared.c └── q_shared.h ├── gnu.txt ├── net ├── net_loopback.c ├── net_unix.c └── net_win.c ├── null ├── cd_null.c ├── cl_null.c ├── glimp_null.c ├── in_null.c ├── swimp_null.c ├── sys_null.c └── vid_null.c ├── other ├── glob.c ├── glob.h ├── q_hunk.c ├── q_system.c ├── snd_linux.c ├── vid_lib.c └── vid_menu.c ├── port_gl_sdl.c ├── port_platform_unix.c ├── port_platform_win.c ├── port_soft_gdi.c ├── port_soft_sdl.c ├── port_soft_sosofb.c ├── qcommon ├── cmd.c ├── cmodel.c ├── common.c ├── crc.c ├── crc.h ├── cvar.c ├── files.c ├── md4.c ├── net_chan.c ├── pmove.c ├── qcommon.h └── qfiles.h ├── quake2.h ├── quakegeneric.h ├── readme.txt ├── ref_gl ├── anorms.h ├── anormtab.h ├── gl_draw.c ├── gl_image.c ├── gl_light.c ├── gl_local.h ├── gl_mesh.c ├── gl_model.c ├── gl_model.h ├── gl_rmain.c ├── gl_rmisc.c ├── gl_rsurf.c ├── gl_warp.c ├── qgl.h ├── qgl_system.c ├── ref_gl.001 ├── ref_gl.def ├── ref_gl.dsp ├── ref_gl.plg └── warpsin.h ├── ref_soft ├── adivtab.h ├── anorms.h ├── r_aclip.c ├── r_alias.c ├── r_bsp.c ├── r_draw.c ├── r_edge.c ├── r_image.c ├── r_light.c ├── r_local.h ├── r_main.c ├── r_misc.c ├── r_model.c ├── r_model.h ├── r_part.c ├── r_poly.c ├── r_polyse.c ├── r_rast.c ├── r_scan.c ├── r_sprite.c ├── r_surf.c ├── rand1k.h ├── ref_soft.001 ├── ref_soft.def ├── ref_soft.dsp └── ref_soft.plg ├── screenshots ├── gl.png ├── gl2.png └── soft.png ├── server ├── server.h ├── sv_ccmds.c ├── sv_ents.c ├── sv_game.c ├── sv_init.c ├── sv_main.c ├── sv_null.c ├── sv_send.c ├── sv_user.c └── sv_world.c ├── sound ├── snd_sdl.c └── snddma_null.c └── visualstudio ├── q2-gl-sdl.vcxproj ├── q2-soft-gdi.vcxproj ├── q2-soft-sdl.vcxproj └── quake2.sln /.gitignore: -------------------------------------------------------------------------------- 1 | *.DS_Store 2 | .vscode 3 | build/ 4 | .vs 5 | baseq2* 6 | x64 7 | Debug 8 | Release 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # quake2generic 2 | The purpose of Quake 2 generic is to make porting Quake 2 easier. 3 | Now it is possible with just a few functions to port Quake 2 in a single file. 4 | 5 | To try it, you will need a baseq2 directory (game data). 6 | 7 | If you don't own the game, shareware version is freely available. You can search it q2-314-demo-x86.exe. That is a zip file that you can unzip and get the data. Place baseq2/pak0.pak file and you are ready! 8 | Note that q2_test data is not compatible! 9 | 10 | Original game loads both game and renderer library dynamically to support different mods and rendering engines. 11 | This port embeds these libraries to make porting easier. Because many toy operating systems don't support dynamically loadable libraries (for example: .dll, .so, .dylib). 12 | 13 | # porting 14 | Implement these functions to suit your platform as well as renderer frame functions. 15 | 16 | * QG_Milliseconds 17 | * QG_GetMouseDiff 18 | * QG_CaptureMouse 19 | * QG_ReleaseMouse 20 | * QG_Mkdir 21 | 22 | |Functions |Description| 23 | |---------------------|-----------| 24 | |QG_Milliseconds |Measure ticks in milliseconds. 25 | |QG_GetMouseDiff |If you support mouse, return x and y mouse difference from previous frame. 26 | |QG_CaptureMouse |If you support mouse, this is used for capturing mouse so that cursor cannot go outside the window. 27 | |QG_ReleaseMouse |If you support mouse, this is used for releasing mouse when going to menu. 28 | |QG_Mkdir |Save game depends on this. If you don't implement this, the game still runs. 29 | 30 | ## renderer - software or gl 31 | Choose a renderer. Software renderer does not have any dependencies and runs everywhere. It is in ref_soft folder. 32 | If your porting target has OpenGL, you can use gl renderer in ref_gl folder. 33 | 34 | ### software renderer 35 | Implement functions beginning with name SWimp_ (look at port_soft_sdl.c for SDL port). 36 | ![software renderer](screenshots/soft.png) 37 | 38 | ### gl renderer 39 | Implement functions beginning with name GLimp_ (look at port_gl_sdl.c for SDL port). 40 | ![gl renderer](screenshots/gl2.png) 41 | 42 | ### main loop 43 | At start, call Quake2_Init(). 44 | 45 | In a loop, call Quake2_Frame(). 46 | 47 | Send key events with Quake2_SendKey(). 48 | 49 | In simplest form: 50 | ``` 51 | int main(int argc, char **argv) 52 | { 53 | int time, oldtime, newtime; 54 | Quake2_Init(argc, argv); 55 | oldtime = Quake2_Milliseconds (); 56 | while (1) 57 | { 58 | HandleInput(); 59 | 60 | do { 61 | newtime = Quake2_Milliseconds (); 62 | time = newtime - oldtime; 63 | } while (time < 1); 64 | Quake2_Frame(time); 65 | oldtime = newtime; 66 | } 67 | return 0; 68 | } 69 | ``` 70 | 71 | # sound 72 | Null sound is used in Makefile. You can use sound/snd_sdl.c instead of sound/snddma_null.c for SDL port. 73 | 74 | # net 75 | Networking works in both unix environment and Windows. There are implementations in net folder. 76 | For systems lacking network support, you can compile net/net_loopback.c. 77 | 78 | # platforms 79 | Ported platforms include Windows GDI, SDL (both software and gl),. Just look at (port_soft_gdi.c, port_soft_sdl.c, port_gl_sdl.c). 80 | Provided Makefile works for unix (MacOS and Linux tested). Visual Studio solution is also provided. 81 | -------------------------------------------------------------------------------- /client/anorms.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | {-0.525731, 0.000000, 0.850651}, 21 | {-0.442863, 0.238856, 0.864188}, 22 | {-0.295242, 0.000000, 0.955423}, 23 | {-0.309017, 0.500000, 0.809017}, 24 | {-0.162460, 0.262866, 0.951056}, 25 | {0.000000, 0.000000, 1.000000}, 26 | {0.000000, 0.850651, 0.525731}, 27 | {-0.147621, 0.716567, 0.681718}, 28 | {0.147621, 0.716567, 0.681718}, 29 | {0.000000, 0.525731, 0.850651}, 30 | {0.309017, 0.500000, 0.809017}, 31 | {0.525731, 0.000000, 0.850651}, 32 | {0.295242, 0.000000, 0.955423}, 33 | {0.442863, 0.238856, 0.864188}, 34 | {0.162460, 0.262866, 0.951056}, 35 | {-0.681718, 0.147621, 0.716567}, 36 | {-0.809017, 0.309017, 0.500000}, 37 | {-0.587785, 0.425325, 0.688191}, 38 | {-0.850651, 0.525731, 0.000000}, 39 | {-0.864188, 0.442863, 0.238856}, 40 | {-0.716567, 0.681718, 0.147621}, 41 | {-0.688191, 0.587785, 0.425325}, 42 | {-0.500000, 0.809017, 0.309017}, 43 | {-0.238856, 0.864188, 0.442863}, 44 | {-0.425325, 0.688191, 0.587785}, 45 | {-0.716567, 0.681718, -0.147621}, 46 | {-0.500000, 0.809017, -0.309017}, 47 | {-0.525731, 0.850651, 0.000000}, 48 | {0.000000, 0.850651, -0.525731}, 49 | {-0.238856, 0.864188, -0.442863}, 50 | {0.000000, 0.955423, -0.295242}, 51 | {-0.262866, 0.951056, -0.162460}, 52 | {0.000000, 1.000000, 0.000000}, 53 | {0.000000, 0.955423, 0.295242}, 54 | {-0.262866, 0.951056, 0.162460}, 55 | {0.238856, 0.864188, 0.442863}, 56 | {0.262866, 0.951056, 0.162460}, 57 | {0.500000, 0.809017, 0.309017}, 58 | {0.238856, 0.864188, -0.442863}, 59 | {0.262866, 0.951056, -0.162460}, 60 | {0.500000, 0.809017, -0.309017}, 61 | {0.850651, 0.525731, 0.000000}, 62 | {0.716567, 0.681718, 0.147621}, 63 | {0.716567, 0.681718, -0.147621}, 64 | {0.525731, 0.850651, 0.000000}, 65 | {0.425325, 0.688191, 0.587785}, 66 | {0.864188, 0.442863, 0.238856}, 67 | {0.688191, 0.587785, 0.425325}, 68 | {0.809017, 0.309017, 0.500000}, 69 | {0.681718, 0.147621, 0.716567}, 70 | {0.587785, 0.425325, 0.688191}, 71 | {0.955423, 0.295242, 0.000000}, 72 | {1.000000, 0.000000, 0.000000}, 73 | {0.951056, 0.162460, 0.262866}, 74 | {0.850651, -0.525731, 0.000000}, 75 | {0.955423, -0.295242, 0.000000}, 76 | {0.864188, -0.442863, 0.238856}, 77 | {0.951056, -0.162460, 0.262866}, 78 | {0.809017, -0.309017, 0.500000}, 79 | {0.681718, -0.147621, 0.716567}, 80 | {0.850651, 0.000000, 0.525731}, 81 | {0.864188, 0.442863, -0.238856}, 82 | {0.809017, 0.309017, -0.500000}, 83 | {0.951056, 0.162460, -0.262866}, 84 | {0.525731, 0.000000, -0.850651}, 85 | {0.681718, 0.147621, -0.716567}, 86 | {0.681718, -0.147621, -0.716567}, 87 | {0.850651, 0.000000, -0.525731}, 88 | {0.809017, -0.309017, -0.500000}, 89 | {0.864188, -0.442863, -0.238856}, 90 | {0.951056, -0.162460, -0.262866}, 91 | {0.147621, 0.716567, -0.681718}, 92 | {0.309017, 0.500000, -0.809017}, 93 | {0.425325, 0.688191, -0.587785}, 94 | {0.442863, 0.238856, -0.864188}, 95 | {0.587785, 0.425325, -0.688191}, 96 | {0.688191, 0.587785, -0.425325}, 97 | {-0.147621, 0.716567, -0.681718}, 98 | {-0.309017, 0.500000, -0.809017}, 99 | {0.000000, 0.525731, -0.850651}, 100 | {-0.525731, 0.000000, -0.850651}, 101 | {-0.442863, 0.238856, -0.864188}, 102 | {-0.295242, 0.000000, -0.955423}, 103 | {-0.162460, 0.262866, -0.951056}, 104 | {0.000000, 0.000000, -1.000000}, 105 | {0.295242, 0.000000, -0.955423}, 106 | {0.162460, 0.262866, -0.951056}, 107 | {-0.442863, -0.238856, -0.864188}, 108 | {-0.309017, -0.500000, -0.809017}, 109 | {-0.162460, -0.262866, -0.951056}, 110 | {0.000000, -0.850651, -0.525731}, 111 | {-0.147621, -0.716567, -0.681718}, 112 | {0.147621, -0.716567, -0.681718}, 113 | {0.000000, -0.525731, -0.850651}, 114 | {0.309017, -0.500000, -0.809017}, 115 | {0.442863, -0.238856, -0.864188}, 116 | {0.162460, -0.262866, -0.951056}, 117 | {0.238856, -0.864188, -0.442863}, 118 | {0.500000, -0.809017, -0.309017}, 119 | {0.425325, -0.688191, -0.587785}, 120 | {0.716567, -0.681718, -0.147621}, 121 | {0.688191, -0.587785, -0.425325}, 122 | {0.587785, -0.425325, -0.688191}, 123 | {0.000000, -0.955423, -0.295242}, 124 | {0.000000, -1.000000, 0.000000}, 125 | {0.262866, -0.951056, -0.162460}, 126 | {0.000000, -0.850651, 0.525731}, 127 | {0.000000, -0.955423, 0.295242}, 128 | {0.238856, -0.864188, 0.442863}, 129 | {0.262866, -0.951056, 0.162460}, 130 | {0.500000, -0.809017, 0.309017}, 131 | {0.716567, -0.681718, 0.147621}, 132 | {0.525731, -0.850651, 0.000000}, 133 | {-0.238856, -0.864188, -0.442863}, 134 | {-0.500000, -0.809017, -0.309017}, 135 | {-0.262866, -0.951056, -0.162460}, 136 | {-0.850651, -0.525731, 0.000000}, 137 | {-0.716567, -0.681718, -0.147621}, 138 | {-0.716567, -0.681718, 0.147621}, 139 | {-0.525731, -0.850651, 0.000000}, 140 | {-0.500000, -0.809017, 0.309017}, 141 | {-0.238856, -0.864188, 0.442863}, 142 | {-0.262866, -0.951056, 0.162460}, 143 | {-0.864188, -0.442863, 0.238856}, 144 | {-0.809017, -0.309017, 0.500000}, 145 | {-0.688191, -0.587785, 0.425325}, 146 | {-0.681718, -0.147621, 0.716567}, 147 | {-0.442863, -0.238856, 0.864188}, 148 | {-0.587785, -0.425325, 0.688191}, 149 | {-0.309017, -0.500000, 0.809017}, 150 | {-0.147621, -0.716567, 0.681718}, 151 | {-0.425325, -0.688191, 0.587785}, 152 | {-0.162460, -0.262866, 0.951056}, 153 | {0.442863, -0.238856, 0.864188}, 154 | {0.162460, -0.262866, 0.951056}, 155 | {0.309017, -0.500000, 0.809017}, 156 | {0.147621, -0.716567, 0.681718}, 157 | {0.000000, -0.525731, 0.850651}, 158 | {0.425325, -0.688191, 0.587785}, 159 | {0.587785, -0.425325, 0.688191}, 160 | {0.688191, -0.587785, 0.425325}, 161 | {-0.955423, 0.295242, 0.000000}, 162 | {-0.951056, 0.162460, 0.262866}, 163 | {-1.000000, 0.000000, 0.000000}, 164 | {-0.850651, 0.000000, 0.525731}, 165 | {-0.955423, -0.295242, 0.000000}, 166 | {-0.951056, -0.162460, 0.262866}, 167 | {-0.864188, 0.442863, -0.238856}, 168 | {-0.951056, 0.162460, -0.262866}, 169 | {-0.809017, 0.309017, -0.500000}, 170 | {-0.864188, -0.442863, -0.238856}, 171 | {-0.951056, -0.162460, -0.262866}, 172 | {-0.809017, -0.309017, -0.500000}, 173 | {-0.681718, 0.147621, -0.716567}, 174 | {-0.681718, -0.147621, -0.716567}, 175 | {-0.850651, 0.000000, -0.525731}, 176 | {-0.688191, 0.587785, -0.425325}, 177 | {-0.587785, 0.425325, -0.688191}, 178 | {-0.425325, 0.688191, -0.587785}, 179 | {-0.425325, -0.688191, -0.587785}, 180 | {-0.587785, -0.425325, -0.688191}, 181 | {-0.688191, -0.587785, -0.425325}, 182 | -------------------------------------------------------------------------------- /client/block16.h: -------------------------------------------------------------------------------- 1 | LEnter16_16: 2 | movb (%esi),%al 3 | movb (%esi,%ebx,),%cl 4 | movb %dh,%ah 5 | addl %ebp,%edx 6 | movb %dh,%ch 7 | leal (%esi,%ebx,2),%esi 8 | movw 0x12345678(,%eax,2),%ax 9 | LBPatch0: 10 | addl %ebp,%edx 11 | movw %ax,(%edi) 12 | movw 0x12345678(,%ecx,2),%cx 13 | LBPatch1: 14 | movw %cx,2(%edi) 15 | addl $0x4,%edi 16 | 17 | movb (%esi),%al 18 | movb (%esi,%ebx,),%cl 19 | movb %dh,%ah 20 | addl %ebp,%edx 21 | movb %dh,%ch 22 | leal (%esi,%ebx,2),%esi 23 | movw 0x12345678(,%eax,2),%ax 24 | LBPatch2: 25 | addl %ebp,%edx 26 | movw %ax,(%edi) 27 | movw 0x12345678(,%ecx,2),%cx 28 | LBPatch3: 29 | movw %cx,2(%edi) 30 | addl $0x4,%edi 31 | 32 | movb (%esi),%al 33 | movb (%esi,%ebx,),%cl 34 | movb %dh,%ah 35 | addl %ebp,%edx 36 | movb %dh,%ch 37 | leal (%esi,%ebx,2),%esi 38 | movw 0x12345678(,%eax,2),%ax 39 | LBPatch4: 40 | addl %ebp,%edx 41 | movw %ax,(%edi) 42 | movw 0x12345678(,%ecx,2),%cx 43 | LBPatch5: 44 | movw %cx,2(%edi) 45 | addl $0x4,%edi 46 | 47 | movb (%esi),%al 48 | movb (%esi,%ebx,),%cl 49 | movb %dh,%ah 50 | addl %ebp,%edx 51 | movb %dh,%ch 52 | leal (%esi,%ebx,2),%esi 53 | movw 0x12345678(,%eax,2),%ax 54 | LBPatch6: 55 | addl %ebp,%edx 56 | movw %ax,(%edi) 57 | movw 0x12345678(,%ecx,2),%cx 58 | LBPatch7: 59 | movw %cx,2(%edi) 60 | addl $0x4,%edi 61 | 62 | LEnter8_16: 63 | movb (%esi),%al 64 | movb (%esi,%ebx,),%cl 65 | movb %dh,%ah 66 | addl %ebp,%edx 67 | movb %dh,%ch 68 | leal (%esi,%ebx,2),%esi 69 | movw 0x12345678(,%eax,2),%ax 70 | LBPatch8: 71 | addl %ebp,%edx 72 | movw %ax,(%edi) 73 | movw 0x12345678(,%ecx,2),%cx 74 | LBPatch9: 75 | movw %cx,2(%edi) 76 | addl $0x4,%edi 77 | 78 | movb (%esi),%al 79 | movb (%esi,%ebx,),%cl 80 | movb %dh,%ah 81 | addl %ebp,%edx 82 | movb %dh,%ch 83 | leal (%esi,%ebx,2),%esi 84 | movw 0x12345678(,%eax,2),%ax 85 | LBPatch10: 86 | addl %ebp,%edx 87 | movw %ax,(%edi) 88 | movw 0x12345678(,%ecx,2),%cx 89 | LBPatch11: 90 | movw %cx,2(%edi) 91 | addl $0x4,%edi 92 | 93 | LEnter4_16: 94 | movb (%esi),%al 95 | movb (%esi,%ebx,),%cl 96 | movb %dh,%ah 97 | addl %ebp,%edx 98 | movb %dh,%ch 99 | leal (%esi,%ebx,2),%esi 100 | movw 0x12345678(,%eax,2),%ax 101 | LBPatch12: 102 | addl %ebp,%edx 103 | movw %ax,(%edi) 104 | movw 0x12345678(,%ecx,2),%cx 105 | LBPatch13: 106 | movw %cx,2(%edi) 107 | addl $0x4,%edi 108 | 109 | LEnter2_16: 110 | movb (%esi),%al 111 | movb (%esi,%ebx,),%cl 112 | movb %dh,%ah 113 | addl %ebp,%edx 114 | movb %dh,%ch 115 | leal (%esi,%ebx,2),%esi 116 | movw 0x12345678(,%eax,2),%ax 117 | LBPatch14: 118 | addl %ebp,%edx 119 | movw %ax,(%edi) 120 | movw 0x12345678(,%ecx,2),%cx 121 | LBPatch15: 122 | movw %cx,2(%edi) 123 | addl $0x4,%edi 124 | -------------------------------------------------------------------------------- /client/block8.h: -------------------------------------------------------------------------------- 1 | LEnter16_8: 2 | movb (%esi),%al 3 | movb (%esi,%ebx,),%cl 4 | movb %dh,%ah 5 | addl %ebp,%edx 6 | movb %dh,%ch 7 | leal (%esi,%ebx,2),%esi 8 | movb 0x12345678(%eax),%al 9 | LBPatch0: 10 | addl %ebp,%edx 11 | movb %al,(%edi) 12 | movb 0x12345678(%ecx),%cl 13 | LBPatch1: 14 | movb %cl,1(%edi) 15 | addl $0x2,%edi 16 | 17 | movb (%esi),%al 18 | movb (%esi,%ebx,),%cl 19 | movb %dh,%ah 20 | addl %ebp,%edx 21 | movb %dh,%ch 22 | leal (%esi,%ebx,2),%esi 23 | movb 0x12345678(%eax),%al 24 | LBPatch2: 25 | addl %ebp,%edx 26 | movb %al,(%edi) 27 | movb 0x12345678(%ecx),%cl 28 | LBPatch3: 29 | movb %cl,1(%edi) 30 | addl $0x2,%edi 31 | 32 | movb (%esi),%al 33 | movb (%esi,%ebx,),%cl 34 | movb %dh,%ah 35 | addl %ebp,%edx 36 | movb %dh,%ch 37 | leal (%esi,%ebx,2),%esi 38 | movb 0x12345678(%eax),%al 39 | LBPatch4: 40 | addl %ebp,%edx 41 | movb %al,(%edi) 42 | movb 0x12345678(%ecx),%cl 43 | LBPatch5: 44 | movb %cl,1(%edi) 45 | addl $0x2,%edi 46 | 47 | movb (%esi),%al 48 | movb (%esi,%ebx,),%cl 49 | movb %dh,%ah 50 | addl %ebp,%edx 51 | movb %dh,%ch 52 | leal (%esi,%ebx,2),%esi 53 | movb 0x12345678(%eax),%al 54 | LBPatch6: 55 | addl %ebp,%edx 56 | movb %al,(%edi) 57 | movb 0x12345678(%ecx),%cl 58 | LBPatch7: 59 | movb %cl,1(%edi) 60 | addl $0x2,%edi 61 | 62 | LEnter8_8: 63 | movb (%esi),%al 64 | movb (%esi,%ebx,),%cl 65 | movb %dh,%ah 66 | addl %ebp,%edx 67 | movb %dh,%ch 68 | leal (%esi,%ebx,2),%esi 69 | movb 0x12345678(%eax),%al 70 | LBPatch8: 71 | addl %ebp,%edx 72 | movb %al,(%edi) 73 | movb 0x12345678(%ecx),%cl 74 | LBPatch9: 75 | movb %cl,1(%edi) 76 | addl $0x2,%edi 77 | 78 | movb (%esi),%al 79 | movb (%esi,%ebx,),%cl 80 | movb %dh,%ah 81 | addl %ebp,%edx 82 | movb %dh,%ch 83 | leal (%esi,%ebx,2),%esi 84 | movb 0x12345678(%eax),%al 85 | LBPatch10: 86 | addl %ebp,%edx 87 | movb %al,(%edi) 88 | movb 0x12345678(%ecx),%cl 89 | LBPatch11: 90 | movb %cl,1(%edi) 91 | addl $0x2,%edi 92 | 93 | LEnter4_8: 94 | movb (%esi),%al 95 | movb (%esi,%ebx,),%cl 96 | movb %dh,%ah 97 | addl %ebp,%edx 98 | movb %dh,%ch 99 | leal (%esi,%ebx,2),%esi 100 | movb 0x12345678(%eax),%al 101 | LBPatch12: 102 | addl %ebp,%edx 103 | movb %al,(%edi) 104 | movb 0x12345678(%ecx),%cl 105 | LBPatch13: 106 | movb %cl,1(%edi) 107 | addl $0x2,%edi 108 | 109 | LEnter2_8: 110 | movb (%esi),%al 111 | movb (%esi,%ebx,),%cl 112 | movb %dh,%ah 113 | addl %ebp,%edx 114 | movb %dh,%ch 115 | leal (%esi,%ebx,2),%esi 116 | movb 0x12345678(%eax),%al 117 | LBPatch14: 118 | addl %ebp,%edx 119 | movb %al,(%edi) 120 | movb 0x12345678(%ecx),%cl 121 | LBPatch15: 122 | movb %cl,1(%edi) 123 | addl $0x2,%edi 124 | 125 | -------------------------------------------------------------------------------- /client/cdaudio.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 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_Shutdown(void); 23 | void CDAudio_Play(int track, qboolean looping); 24 | void CDAudio_Stop(void); 25 | void CDAudio_Update(void); 26 | void CDAudio_Activate (qboolean active); 27 | -------------------------------------------------------------------------------- /client/cl_inv.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 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 | // cl_inv.c -- client inventory screen 21 | 22 | #include "client.h" 23 | 24 | /* 25 | ================ 26 | CL_ParseInventory 27 | ================ 28 | */ 29 | void CL_ParseInventory (void) 30 | { 31 | int i; 32 | 33 | for (i=0 ; ibegin, the playsound will 49 | // be assigned to a channel 50 | typedef struct playsound_s 51 | { 52 | struct playsound_s *prev, *next; 53 | sfx_t *sfx; 54 | float volume; 55 | float attenuation; 56 | int entnum; 57 | int entchannel; 58 | qboolean fixed_origin; // use origin field instead of entnum's origin 59 | vec3_t origin; 60 | unsigned begin; // begin on this sample 61 | } playsound_t; 62 | 63 | typedef struct 64 | { 65 | int channels; 66 | int samples; // mono samples in buffer 67 | int submission_chunk; // don't mix less than this # 68 | int samplepos; // in mono samples 69 | int samplebits; 70 | int speed; 71 | byte *buffer; 72 | } dma_t; 73 | 74 | // !!! if this is changed, the asm code must change !!! 75 | typedef struct 76 | { 77 | sfx_t *sfx; // sfx number 78 | int leftvol; // 0-255 volume 79 | int rightvol; // 0-255 volume 80 | int end; // end time in global paintsamples 81 | int pos; // sample position in sfx 82 | int looping; // where to loop, -1 = no looping OBSOLETE? 83 | int entnum; // to allow overriding a specific sound 84 | int entchannel; // 85 | vec3_t origin; // only use if fixed_origin is set 86 | vec_t dist_mult; // distance multiplier (attenuation/clipK) 87 | int master_vol; // 0-255 master volume 88 | qboolean fixed_origin; // use origin instead of fetching entnum's origin 89 | qboolean autosound; // from an entity->sound, cleared each frame 90 | } channel_t; 91 | 92 | typedef struct 93 | { 94 | int rate; 95 | int width; 96 | int channels; 97 | int loopstart; 98 | int samples; 99 | int dataofs; // chunk starts this many bytes from file start 100 | } wavinfo_t; 101 | 102 | 103 | /* 104 | ==================================================================== 105 | 106 | SYSTEM SPECIFIC FUNCTIONS 107 | 108 | ==================================================================== 109 | */ 110 | 111 | // initializes cycling through a DMA buffer and returns information on it 112 | qboolean SNDDMA_Init(void); 113 | 114 | // gets the current DMA position 115 | int SNDDMA_GetDMAPos(void); 116 | 117 | // shutdown the DMA xfer. 118 | void SNDDMA_Shutdown(void); 119 | 120 | void SNDDMA_BeginPainting (void); 121 | 122 | void SNDDMA_Submit(void); 123 | 124 | //==================================================================== 125 | 126 | #define MAX_CHANNELS 32 127 | extern channel_t channels[MAX_CHANNELS]; 128 | 129 | extern int paintedtime; 130 | extern int s_rawend; 131 | extern vec3_t listener_origin; 132 | extern vec3_t listener_forward; 133 | extern vec3_t listener_right; 134 | extern vec3_t listener_up; 135 | extern dma_t dma; 136 | extern playsound_t s_pendingplays; 137 | 138 | #define MAX_RAW_SAMPLES 8192 139 | extern portable_samplepair_t s_rawsamples[MAX_RAW_SAMPLES]; 140 | 141 | extern cvar_t *s_volume; 142 | extern cvar_t *s_nosound; 143 | extern cvar_t *s_loadas8bit; 144 | extern cvar_t *s_khz; 145 | extern cvar_t *s_show; 146 | extern cvar_t *s_mixahead; 147 | extern cvar_t *s_testsound; 148 | extern cvar_t *s_primary; 149 | 150 | wavinfo_t GetWavinfo (char *name, byte *wav, int wavlength); 151 | 152 | void S_InitScaletable (void); 153 | 154 | sfxcache_t *S_LoadSound (sfx_t *s); 155 | 156 | void S_IssuePlaysound (playsound_t *ps); 157 | 158 | void S_PaintChannels(int endtime); 159 | 160 | // picks a channel based on priorities, empty slots, number of channels 161 | channel_t *S_PickChannel(int entnum, int entchannel); 162 | 163 | // spatializes a channel 164 | void S_Spatialize(channel_t *ch); 165 | -------------------------------------------------------------------------------- /client/sound.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 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 | struct sfx_s; 22 | 23 | void S_Init (void); 24 | void S_Shutdown (void); 25 | 26 | // if origin is NULL, the sound will be dynamically sourced from the entity 27 | void S_StartSound (vec3_t origin, int entnum, int entchannel, struct sfx_s *sfx, float fvol, float attenuation, float timeofs); 28 | void S_StartLocalSound (char *s); 29 | 30 | void S_RawSamples (int samples, int rate, int width, int channels, byte *data); 31 | 32 | void S_StopAllSounds(void); 33 | void S_Update (vec3_t origin, vec3_t v_forward, vec3_t v_right, vec3_t v_up); 34 | 35 | void S_Activate (qboolean active); 36 | 37 | void S_BeginRegistration (void); 38 | struct sfx_s *S_RegisterSound (char *sample); 39 | void S_EndRegistration (void); 40 | 41 | struct sfx_s *S_FindName (char *name, qboolean create); 42 | 43 | // the sound code makes callbacks to the client for entitiy position 44 | // information, so entities can be dynamically re-spatialized 45 | void CL_GetEntitySoundOrigin (int ent, vec3_t org); 46 | -------------------------------------------------------------------------------- /client/vid.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 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 | typedef struct vrect_s 23 | { 24 | int x,y,width,height; 25 | } vrect_t; 26 | 27 | typedef struct 28 | { 29 | int width; 30 | int height; 31 | } viddef_t; 32 | 33 | extern viddef_t viddef; // global video state 34 | 35 | // Video module initialisation etc 36 | void VID_Init (void); 37 | void VID_Shutdown (void); 38 | void VID_CheckChanges (void); 39 | 40 | void VID_MenuInit( void ); 41 | void VID_MenuDraw( void ); 42 | const char *VID_MenuKey( int ); 43 | -------------------------------------------------------------------------------- /ctf/2do.txt: -------------------------------------------------------------------------------- 1 | 2 | switching teams during setup should clear ready 3 | center stuff should be left aligned on admin 4 | match command for ingame match request 5 | admin kick option (menu) 6 | can't join team when match PREGAME (menu was still open) 7 | server pause in 3.15? 8 | 9 | *time changes are broken 10 | *ghosting in makes you invisible (svf_noclient?) 11 | *ghost doesn't restore frags 12 | *resetall needs to clear grapple (and match start) 13 | *reset all techs at match start 14 | *'and admin' 15 | *timelimit/fraglimit disabled in match mode 16 | *telefrags at start of match [needs tested] 17 | -------------------------------------------------------------------------------- /ctf/Makefile.Linux.i386: -------------------------------------------------------------------------------- 1 | # 2 | # Quake2 gamei386.so Makefile for Linux 2.0 3 | # 4 | # Jan '98 by Zoid 5 | # 6 | # ELF only 7 | # 8 | # Probably requires GNU make 9 | # 10 | # This builds the gamei386.so for Linux based on the q2source_12_11.zip 11 | # release. 12 | # Put his Makefile in the game subdirectory you get when you unzip 13 | # q2source_12_11.zip. 14 | # 15 | # There are two compiler errors you'll get, the following fixes 16 | # are necessary: 17 | # 18 | # In g_local.h (around line 828), you must change the 19 | # typedef struct g_client_s { ... } gclient_t; 20 | # to just: 21 | # struct g_client_s { ... }; 22 | # The typedef is already defined elsewhere (seems to compile fine under 23 | # MSCV++ for Win32 for some reason). 24 | # 25 | # m_player.h has a Ctrl-Z at the end (damn DOS editors). Remove it or 26 | # gcc complains. 27 | # 28 | # Note that the source in q2source_12_11.zip is for version 3.05. To 29 | # get it to run with Linux 3.10, change the following in game.h: 30 | # #define GAME_API_VERSION 1 31 | # change it to: 32 | # #define GAME_API_VERSION 2 33 | 34 | ARCH=i386 35 | CC=gcc 36 | BASE_CFLAGS=-Dstricmp=strcasecmp 37 | 38 | #use these cflags to optimize it 39 | CFLAGS=$(BASE_CFLAGS) -m486 -O6 -ffast-math -funroll-loops \ 40 | -fomit-frame-pointer -fexpensive-optimizations -malign-loops=2 \ 41 | -malign-jumps=2 -malign-functions=2 42 | #use these when debugging 43 | #CFLAGS=$(BASE_CFLAGS) -g 44 | 45 | OBJDIR=linux 46 | 47 | LDFLAGS=-ldl -lm 48 | SHLIBEXT=so 49 | SHLIBCFLAGS=-fPIC 50 | SHLIBLDFLAGS=-shared 51 | 52 | DO_CC=$(CC) $(CFLAGS) $(SHLIBCFLAGS) -o $@ -c $< 53 | 54 | ############################################################################# 55 | # SETUP AND BUILD 56 | # GAME 57 | ############################################################################# 58 | 59 | GAME_OBJS = \ 60 | $(OBJDIR)/g_ai.o $(OBJDIR)/p_client.o $(OBJDIR)/g_svcmds.o $(OBJDIR)/g_cmds.o \ 61 | $(OBJDIR)/g_combat.o $(OBJDIR)/g_func.o $(OBJDIR)/g_items.o \ 62 | $(OBJDIR)/g_main.o $(OBJDIR)/g_misc.o $(OBJDIR)/g_monster.o $(OBJDIR)/g_phys.o \ 63 | $(OBJDIR)/g_save.o $(OBJDIR)/g_spawn.o \ 64 | $(OBJDIR)/g_target.o $(OBJDIR)/g_trigger.o $(OBJDIR)/g_utils.o $(OBJDIR)/g_weapon.o \ 65 | $(OBJDIR)/m_move.o \ 66 | $(OBJDIR)/p_hud.o $(OBJDIR)/p_trail.o $(OBJDIR)/p_view.o $(OBJDIR)/p_weapon.o \ 67 | $(OBJDIR)/q_shared.o $(OBJDIR)/g_ctf.o $(OBJDIR)/p_menu.o $(OBJDIR)/g_chase.o 68 | 69 | game$(ARCH).$(SHLIBEXT) : $(GAME_OBJS) 70 | $(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(GAME_OBJS) 71 | 72 | $(OBJDIR)/g_ai.o : g_ai.c 73 | $(DO_CC) 74 | 75 | $(OBJDIR)/p_client.o : p_client.c 76 | $(DO_CC) 77 | 78 | $(OBJDIR)/g_svcmds.o : g_svcmds.c 79 | $(DO_CC) 80 | 81 | $(OBJDIR)/g_cmds.o : g_cmds.c 82 | $(DO_CC) 83 | 84 | $(OBJDIR)/g_combat.o : g_combat.c 85 | $(DO_CC) 86 | 87 | $(OBJDIR)/g_func.o : g_func.c 88 | $(DO_CC) 89 | 90 | $(OBJDIR)/g_items.o : g_items.c 91 | $(DO_CC) 92 | 93 | $(OBJDIR)/g_main.o : g_main.c 94 | $(DO_CC) 95 | 96 | $(OBJDIR)/g_misc.o : g_misc.c 97 | $(DO_CC) 98 | 99 | $(OBJDIR)/g_monster.o : g_monster.c 100 | $(DO_CC) 101 | 102 | $(OBJDIR)/g_phys.o : g_phys.c 103 | $(DO_CC) 104 | 105 | $(OBJDIR)/g_save.o : g_save.c 106 | $(DO_CC) 107 | 108 | $(OBJDIR)/g_spawn.o : g_spawn.c 109 | $(DO_CC) 110 | 111 | $(OBJDIR)/g_target.o : g_target.c 112 | $(DO_CC) 113 | 114 | $(OBJDIR)/g_trigger.o : g_trigger.c 115 | $(DO_CC) 116 | 117 | $(OBJDIR)/g_utils.o : g_utils.c 118 | $(DO_CC) 119 | 120 | $(OBJDIR)/g_weapon.o : g_weapon.c 121 | $(DO_CC) 122 | 123 | $(OBJDIR)/m_move.o : m_move.c 124 | $(DO_CC) 125 | 126 | $(OBJDIR)/p_hud.o : p_hud.c 127 | $(DO_CC) 128 | 129 | $(OBJDIR)/p_trail.o : p_trail.c 130 | $(DO_CC) 131 | 132 | $(OBJDIR)/p_view.o : p_view.c 133 | $(DO_CC) 134 | 135 | $(OBJDIR)/p_weapon.o : p_weapon.c 136 | $(DO_CC) 137 | 138 | $(OBJDIR)/q_shared.o : q_shared.c 139 | $(DO_CC) 140 | 141 | $(OBJDIR)/g_ctf.o : g_ctf.c 142 | $(DO_CC) 143 | 144 | $(OBJDIR)/p_menu.o : p_menu.c 145 | $(DO_CC) 146 | 147 | $(OBJDIR)/g_chase.o : g_chase.c 148 | $(DO_CC) 149 | 150 | ############################################################################# 151 | # MISC 152 | ############################################################################# 153 | 154 | clean: 155 | -rm -f $(GAME_OBJS) 156 | 157 | depend: 158 | gcc -MM $(GAME_OBJS:.o=.c) 159 | 160 | -------------------------------------------------------------------------------- /ctf/ctf.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | GetGameAPI 3 | -------------------------------------------------------------------------------- /ctf/ctf.plg: -------------------------------------------------------------------------------- 1 | --------------------Configuration: ctf - Win32 Debug Alpha-------------------- 2 | Begining build with project "G:\quake2\code\ctf\ctf.dsp", at root. 3 | Active configuration is Win32 (ALPHA) Dynamic-Link Library (based on Win32 (ALPHA) Dynamic-Link Library) 4 | 5 | Project's tools are: 6 | "OLE Type Library Maker" with flags "/nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 " 7 | "C/C++ Compiler for Alpha" with flags "/nologo /MTd /Gt0 /W3 /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR".\DebugAXP/" /Fp".\DebugAXP/ctf.pch" /YX /Fo".\DebugAXP/" /Fd".\DebugAXP/" /FD /c " 8 | "Win32 Resource Compiler" with flags "/l 0x409 /d "_DEBUG" " 9 | "Browser Database Maker" with flags "/nologo /o"..\DebugAXP/ctf.bsc" " 10 | "COFF Linker for Alpha" with flags "winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"..\DebugAXP/gameaxp.pdb" /map:".\DebugAXP/gameaxp.map" /debug /machine:ALPHA /def:".\ctf.def" /out:".\debugAXP\gameaxp.dll" /implib:"..\DebugAXP/gameaxp.lib" /pdbtype:sept " 11 | "Custom Build" with flags "" 12 | "" with flags "" 13 | 14 | 15 | 16 | 17 | gameaxp.dll - 0 error(s), 0 warning(s) 18 | -------------------------------------------------------------------------------- /ctf/docs/admin.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozkl/quake2generic/8fcad56e8f8a1eb167dd1b6563e7732c89da32ee/ctf/docs/admin.gif -------------------------------------------------------------------------------- /ctf/docs/adminset.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozkl/quake2generic/8fcad56e8f8a1eb167dd1b6563e7732c89da32ee/ctf/docs/adminset.gif -------------------------------------------------------------------------------- /ctf/docs/automac.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozkl/quake2generic/8fcad56e8f8a1eb167dd1b6563e7732c89da32ee/ctf/docs/automac.gif -------------------------------------------------------------------------------- /ctf/docs/ghost.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozkl/quake2generic/8fcad56e8f8a1eb167dd1b6563e7732c89da32ee/ctf/docs/ghost.jpg -------------------------------------------------------------------------------- /ctf/docs/grapple.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozkl/quake2generic/8fcad56e8f8a1eb167dd1b6563e7732c89da32ee/ctf/docs/grapple.jpg -------------------------------------------------------------------------------- /ctf/docs/layout.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozkl/quake2generic/8fcad56e8f8a1eb167dd1b6563e7732c89da32ee/ctf/docs/layout.jpg -------------------------------------------------------------------------------- /ctf/docs/mainctf_back.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozkl/quake2generic/8fcad56e8f8a1eb167dd1b6563e7732c89da32ee/ctf/docs/mainctf_back.jpg -------------------------------------------------------------------------------- /ctf/docs/menu.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozkl/quake2generic/8fcad56e8f8a1eb167dd1b6563e7732c89da32ee/ctf/docs/menu.gif -------------------------------------------------------------------------------- /ctf/docs/q2ctf.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozkl/quake2generic/8fcad56e8f8a1eb167dd1b6563e7732c89da32ee/ctf/docs/q2ctf.html -------------------------------------------------------------------------------- /ctf/docs/say_team.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozkl/quake2generic/8fcad56e8f8a1eb167dd1b6563e7732c89da32ee/ctf/docs/say_team.gif -------------------------------------------------------------------------------- /ctf/docs/stats.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozkl/quake2generic/8fcad56e8f8a1eb167dd1b6563e7732c89da32ee/ctf/docs/stats.jpg -------------------------------------------------------------------------------- /ctf/docs/tech1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozkl/quake2generic/8fcad56e8f8a1eb167dd1b6563e7732c89da32ee/ctf/docs/tech1.gif -------------------------------------------------------------------------------- /ctf/docs/tech2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozkl/quake2generic/8fcad56e8f8a1eb167dd1b6563e7732c89da32ee/ctf/docs/tech2.gif -------------------------------------------------------------------------------- /ctf/docs/tech3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozkl/quake2generic/8fcad56e8f8a1eb167dd1b6563e7732c89da32ee/ctf/docs/tech3.gif -------------------------------------------------------------------------------- /ctf/docs/tech4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozkl/quake2generic/8fcad56e8f8a1eb167dd1b6563e7732c89da32ee/ctf/docs/tech4.gif -------------------------------------------------------------------------------- /ctf/g_chase.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 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 "g_local.h" 21 | 22 | 23 | void UpdateChaseCam(edict_t *ent) 24 | { 25 | vec3_t o, ownerv, goal; 26 | edict_t *targ; 27 | vec3_t forward, right; 28 | trace_t trace; 29 | int i; 30 | vec3_t oldgoal; 31 | vec3_t angles; 32 | 33 | // is our chase target gone? 34 | if (!ent->client->chase_target->inuse) { 35 | ent->client->chase_target = NULL; 36 | return; 37 | } 38 | 39 | targ = ent->client->chase_target; 40 | 41 | VectorCopy(targ->s.origin, ownerv); 42 | VectorCopy(ent->s.origin, oldgoal); 43 | 44 | ownerv[2] += targ->viewheight; 45 | 46 | VectorCopy(targ->client->v_angle, angles); 47 | if (angles[PITCH] > 56) 48 | angles[PITCH] = 56; 49 | AngleVectors (angles, forward, right, NULL); 50 | VectorNormalize(forward); 51 | VectorMA(ownerv, -30, forward, o); 52 | 53 | if (o[2] < targ->s.origin[2] + 20) 54 | o[2] = targ->s.origin[2] + 20; 55 | 56 | // jump animation lifts 57 | if (!targ->groundentity) 58 | o[2] += 16; 59 | 60 | trace = gi.trace(ownerv, vec3_origin, vec3_origin, o, targ, MASK_SOLID); 61 | 62 | VectorCopy(trace.endpos, goal); 63 | 64 | VectorMA(goal, 2, forward, goal); 65 | 66 | // pad for floors and ceilings 67 | VectorCopy(goal, o); 68 | o[2] += 6; 69 | trace = gi.trace(goal, vec3_origin, vec3_origin, o, targ, MASK_SOLID); 70 | if (trace.fraction < 1) { 71 | VectorCopy(trace.endpos, goal); 72 | goal[2] -= 6; 73 | } 74 | 75 | VectorCopy(goal, o); 76 | o[2] -= 6; 77 | trace = gi.trace(goal, vec3_origin, vec3_origin, o, targ, MASK_SOLID); 78 | if (trace.fraction < 1) { 79 | VectorCopy(trace.endpos, goal); 80 | goal[2] += 6; 81 | } 82 | 83 | ent->client->ps.pmove.pm_type = PM_FREEZE; 84 | 85 | VectorCopy(goal, ent->s.origin); 86 | for (i=0 ; i<3 ; i++) 87 | ent->client->ps.pmove.delta_angles[i] = ANGLE2SHORT(targ->client->v_angle[i] - ent->client->resp.cmd_angles[i]); 88 | 89 | VectorCopy(targ->client->v_angle, ent->client->ps.viewangles); 90 | VectorCopy(targ->client->v_angle, ent->client->v_angle); 91 | 92 | ent->viewheight = 0; 93 | ent->client->ps.pmove.pm_flags |= PMF_NO_PREDICTION; 94 | gi.linkentity(ent); 95 | 96 | if ((!ent->client->showscores && !ent->client->menu && 97 | !ent->client->showinventory && !ent->client->showhelp && 98 | !(level.framenum & 31)) || ent->client->update_chase) { 99 | char s[1024]; 100 | 101 | ent->client->update_chase = false; 102 | sprintf(s, "xv 0 yb -68 string2 \"Chasing %s\"", 103 | targ->client->pers.netname); 104 | gi.WriteByte (svc_layout); 105 | gi.WriteString (s); 106 | gi.unicast(ent, false); 107 | } 108 | 109 | } 110 | 111 | void ChaseNext(edict_t *ent) 112 | { 113 | int i; 114 | edict_t *e; 115 | 116 | if (!ent->client->chase_target) 117 | return; 118 | 119 | i = ent->client->chase_target - g_edicts; 120 | do { 121 | i++; 122 | if (i > maxclients->value) 123 | i = 1; 124 | e = g_edicts + i; 125 | if (!e->inuse) 126 | continue; 127 | if (e->solid != SOLID_NOT) 128 | break; 129 | } while (e != ent->client->chase_target); 130 | 131 | ent->client->chase_target = e; 132 | ent->client->update_chase = true; 133 | } 134 | 135 | void ChasePrev(edict_t *ent) 136 | { 137 | int i; 138 | edict_t *e; 139 | 140 | if (!ent->client->chase_target) 141 | return; 142 | 143 | i = ent->client->chase_target - g_edicts; 144 | do { 145 | i--; 146 | if (i < 1) 147 | i = maxclients->value; 148 | e = g_edicts + i; 149 | if (!e->inuse) 150 | continue; 151 | if (e->solid != SOLID_NOT) 152 | break; 153 | } while (e != ent->client->chase_target); 154 | 155 | ent->client->chase_target = e; 156 | ent->client->update_chase = true; 157 | } 158 | -------------------------------------------------------------------------------- /ctf/g_ctf.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | #define CTF_VERSION 1.09b 22 | #define CTF_VSTRING2(x) #x 23 | #define CTF_VSTRING(x) CTF_VSTRING2(x) 24 | #define CTF_STRING_VERSION CTF_VSTRING(CTF_VERSION) 25 | 26 | #define STAT_CTF_TEAM1_PIC 17 27 | #define STAT_CTF_TEAM1_CAPS 18 28 | #define STAT_CTF_TEAM2_PIC 19 29 | #define STAT_CTF_TEAM2_CAPS 20 30 | #define STAT_CTF_FLAG_PIC 21 31 | #define STAT_CTF_JOINED_TEAM1_PIC 22 32 | #define STAT_CTF_JOINED_TEAM2_PIC 23 33 | #define STAT_CTF_TEAM1_HEADER 24 34 | #define STAT_CTF_TEAM2_HEADER 25 35 | #define STAT_CTF_TECH 26 36 | #define STAT_CTF_ID_VIEW 27 37 | #define STAT_CTF_MATCH 28 38 | 39 | #define CONFIG_CTF_MATCH (CS_MAXCLIENTS-1) 40 | 41 | typedef enum { 42 | CTF_NOTEAM, 43 | CTF_TEAM1, 44 | CTF_TEAM2 45 | } ctfteam_t; 46 | 47 | typedef enum { 48 | CTF_GRAPPLE_STATE_FLY, 49 | CTF_GRAPPLE_STATE_PULL, 50 | CTF_GRAPPLE_STATE_HANG 51 | } ctfgrapplestate_t; 52 | 53 | typedef struct ghost_s { 54 | char netname[16]; 55 | int number; 56 | 57 | // stats 58 | int deaths; 59 | int kills; 60 | int caps; 61 | int basedef; 62 | int carrierdef; 63 | 64 | int code; // ghost code 65 | int team; // team 66 | int score; // frags at time of disconnect 67 | edict_t *ent; 68 | } ghost_t; 69 | 70 | extern cvar_t *ctf; 71 | 72 | #define CTF_TEAM1_SKIN "ctf_r" 73 | #define CTF_TEAM2_SKIN "ctf_b" 74 | 75 | #define DF_CTF_FORCEJOIN 131072 76 | #define DF_ARMOR_PROTECT 262144 77 | #define DF_CTF_NO_TECH 524288 78 | 79 | #define CTF_CAPTURE_BONUS 15 // what you get for capture 80 | #define CTF_TEAM_BONUS 10 // what your team gets for capture 81 | #define CTF_RECOVERY_BONUS 1 // what you get for recovery 82 | #define CTF_FLAG_BONUS 0 // what you get for picking up enemy flag 83 | #define CTF_FRAG_CARRIER_BONUS 2 // what you get for fragging enemy flag carrier 84 | #define CTF_FLAG_RETURN_TIME 40 // seconds until auto return 85 | 86 | #define CTF_CARRIER_DANGER_PROTECT_BONUS 2 // bonus for fraggin someone who has recently hurt your flag carrier 87 | #define CTF_CARRIER_PROTECT_BONUS 1 // bonus for fraggin someone while either you or your target are near your flag carrier 88 | #define CTF_FLAG_DEFENSE_BONUS 1 // bonus for fraggin someone while either you or your target are near your flag 89 | #define CTF_RETURN_FLAG_ASSIST_BONUS 1 // awarded for returning a flag that causes a capture to happen almost immediately 90 | #define CTF_FRAG_CARRIER_ASSIST_BONUS 2 // award for fragging a flag carrier if a capture happens almost immediately 91 | 92 | #define CTF_TARGET_PROTECT_RADIUS 400 // the radius around an object being defended where a target will be worth extra frags 93 | #define CTF_ATTACKER_PROTECT_RADIUS 400 // the radius around an object being defended where an attacker will get extra frags when making kills 94 | 95 | #define CTF_CARRIER_DANGER_PROTECT_TIMEOUT 8 96 | #define CTF_FRAG_CARRIER_ASSIST_TIMEOUT 10 97 | #define CTF_RETURN_FLAG_ASSIST_TIMEOUT 10 98 | 99 | #define CTF_AUTO_FLAG_RETURN_TIMEOUT 30 // number of seconds before dropped flag auto-returns 100 | 101 | #define CTF_TECH_TIMEOUT 60 // seconds before techs spawn again 102 | 103 | #define CTF_GRAPPLE_SPEED 650 // speed of grapple in flight 104 | #define CTF_GRAPPLE_PULL_SPEED 650 // speed player is pulled at 105 | 106 | void CTFInit(void); 107 | void CTFSpawn(void); 108 | 109 | void SP_info_player_team1(edict_t *self); 110 | void SP_info_player_team2(edict_t *self); 111 | 112 | char *CTFTeamName(int team); 113 | char *CTFOtherTeamName(int team); 114 | void CTFAssignSkin(edict_t *ent, char *s); 115 | void CTFAssignTeam(gclient_t *who); 116 | edict_t *SelectCTFSpawnPoint (edict_t *ent); 117 | qboolean CTFPickup_Flag(edict_t *ent, edict_t *other); 118 | qboolean CTFDrop_Flag(edict_t *ent, gitem_t *item); 119 | void CTFEffects(edict_t *player); 120 | void CTFCalcScores(void); 121 | void SetCTFStats(edict_t *ent); 122 | void CTFDeadDropFlag(edict_t *self); 123 | void CTFScoreboardMessage (edict_t *ent, edict_t *killer); 124 | void CTFTeam_f (edict_t *ent); 125 | void CTFID_f (edict_t *ent); 126 | void CTFSay_Team(edict_t *who, char *msg); 127 | void CTFFlagSetup (edict_t *ent); 128 | void CTFResetFlag(int ctf_team); 129 | void CTFFragBonuses(edict_t *targ, edict_t *inflictor, edict_t *attacker); 130 | void CTFCheckHurtCarrier(edict_t *targ, edict_t *attacker); 131 | 132 | // GRAPPLE 133 | void CTFWeapon_Grapple (edict_t *ent); 134 | void CTFPlayerResetGrapple(edict_t *ent); 135 | void CTFGrapplePull(edict_t *self); 136 | void CTFResetGrapple(edict_t *self); 137 | 138 | //TECH 139 | gitem_t *CTFWhat_Tech(edict_t *ent); 140 | qboolean CTFPickup_Tech (edict_t *ent, edict_t *other); 141 | void CTFDrop_Tech(edict_t *ent, gitem_t *item); 142 | void CTFDeadDropTech(edict_t *ent); 143 | void CTFSetupTechSpawn(void); 144 | int CTFApplyResistance(edict_t *ent, int dmg); 145 | int CTFApplyStrength(edict_t *ent, int dmg); 146 | qboolean CTFApplyStrengthSound(edict_t *ent); 147 | qboolean CTFApplyHaste(edict_t *ent); 148 | void CTFApplyHasteSound(edict_t *ent); 149 | void CTFApplyRegeneration(edict_t *ent); 150 | qboolean CTFHasRegeneration(edict_t *ent); 151 | void CTFRespawnTech(edict_t *ent); 152 | void CTFResetTech(void); 153 | 154 | void CTFOpenJoinMenu(edict_t *ent); 155 | qboolean CTFStartClient(edict_t *ent); 156 | void CTFVoteYes(edict_t *ent); 157 | void CTFVoteNo(edict_t *ent); 158 | void CTFReady(edict_t *ent); 159 | void CTFNotReady(edict_t *ent); 160 | qboolean CTFNextMap(void); 161 | qboolean CTFMatchSetup(void); 162 | qboolean CTFMatchOn(void); 163 | void CTFGhost(edict_t *ent); 164 | void CTFAdmin(edict_t *ent); 165 | qboolean CTFInMatch(void); 166 | void CTFStats(edict_t *ent); 167 | void CTFWarp(edict_t *ent); 168 | void CTFBoot(edict_t *ent); 169 | void CTFPlayerList(edict_t *ent); 170 | 171 | qboolean CTFCheckRules(void); 172 | 173 | void SP_misc_ctf_banner (edict_t *ent); 174 | void SP_misc_ctf_small_banner (edict_t *ent); 175 | 176 | extern char *ctf_statusbar; 177 | 178 | void UpdateChaseCam(edict_t *ent); 179 | void ChaseNext(edict_t *ent); 180 | void ChasePrev(edict_t *ent); 181 | 182 | void CTFObserver(edict_t *ent); 183 | 184 | void SP_trigger_teleport (edict_t *ent); 185 | void SP_info_teleport_destination (edict_t *ent); 186 | -------------------------------------------------------------------------------- /ctf/g_svcmds.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 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 "g_local.h" 22 | 23 | 24 | void Svcmd_Test_f (void) 25 | { 26 | gi.cprintf (NULL, PRINT_HIGH, "Svcmd_Test_f()\n"); 27 | } 28 | 29 | /* 30 | ================= 31 | ServerCommand 32 | 33 | ServerCommand will be called when an "sv" command is issued. 34 | The game can issue gi.argc() / gi.argv() commands to get the rest 35 | of the parameters 36 | ================= 37 | */ 38 | void ServerCommand (void) 39 | { 40 | char *cmd; 41 | 42 | cmd = gi.argv(1); 43 | if (Q_stricmp (cmd, "test") == 0) 44 | Svcmd_Test_f (); 45 | else 46 | gi.cprintf (NULL, PRINT_HIGH, "Unknown server command \"%s\"\n", cmd); 47 | } 48 | 49 | -------------------------------------------------------------------------------- /ctf/layout.txt: -------------------------------------------------------------------------------- 1 | 01234567890123456789012345678901234567890123456789012345678901234567890123456789 2 | 3 | Name Score Kills Deaths BaseDef CarrierDef Efficiency 4 | 0123456789012345 01234 01234 012345 0123456 0123456789 0123456789 5 | >BC>Zoid 110 40 10 5 10 75% 6 | 7 | Name |Score|Kills|Deaths|BaseDef|CarrierDef|Efficiency| 8 | ----------------+-----+-----+------+-------+----------+----------+ 9 | 0123456789012345|01234|01234|012345|0123456|0123456789|0123456789| 10 | >BC>Zoid | 110| 40| 10| 5| 10| 75%| 11 | 12 | %-16.16s|%5d|%5d|%6d|%7d|%10d|%10d| 13 | -------------------------------------------------------------------------------- /ctf/p_menu.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 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 "g_local.h" 21 | 22 | // Note that the pmenu entries are duplicated 23 | // this is so that a static set of pmenu entries can be used 24 | // for multiple clients and changed without interference 25 | // note that arg will be freed when the menu is closed, it must be allocated memory 26 | pmenuhnd_t *PMenu_Open(edict_t *ent, pmenu_t *entries, int cur, int num, void *arg) 27 | { 28 | pmenuhnd_t *hnd; 29 | pmenu_t *p; 30 | int i; 31 | 32 | if (!ent->client) 33 | return NULL; 34 | 35 | if (ent->client->menu) { 36 | gi.dprintf("warning, ent already has a menu\n"); 37 | PMenu_Close(ent); 38 | } 39 | 40 | hnd = malloc(sizeof(*hnd)); 41 | 42 | hnd->arg = arg; 43 | hnd->entries = malloc(sizeof(pmenu_t) * num); 44 | memcpy(hnd->entries, entries, sizeof(pmenu_t) * num); 45 | // duplicate the strings since they may be from static memory 46 | for (i = 0; i < num; i++) 47 | if (entries[i].text) 48 | hnd->entries[i].text = strdup(entries[i].text); 49 | 50 | hnd->num = num; 51 | 52 | if (cur < 0 || !entries[cur].SelectFunc) { 53 | for (i = 0, p = entries; i < num; i++, p++) 54 | if (p->SelectFunc) 55 | break; 56 | } else 57 | i = cur; 58 | 59 | if (i >= num) 60 | hnd->cur = -1; 61 | else 62 | hnd->cur = i; 63 | 64 | ent->client->showscores = true; 65 | ent->client->inmenu = true; 66 | ent->client->menu = hnd; 67 | 68 | PMenu_Do_Update(ent); 69 | gi.unicast (ent, true); 70 | 71 | return hnd; 72 | } 73 | 74 | void PMenu_Close(edict_t *ent) 75 | { 76 | int i; 77 | pmenuhnd_t *hnd; 78 | 79 | if (!ent->client->menu) 80 | return; 81 | 82 | hnd = ent->client->menu; 83 | for (i = 0; i < hnd->num; i++) 84 | if (hnd->entries[i].text) 85 | free(hnd->entries[i].text); 86 | free(hnd->entries); 87 | if (hnd->arg) 88 | free(hnd->arg); 89 | free(hnd); 90 | ent->client->menu = NULL; 91 | ent->client->showscores = false; 92 | } 93 | 94 | // only use on pmenu's that have been called with PMenu_Open 95 | void PMenu_UpdateEntry(pmenu_t *entry, const char *text, int align, SelectFunc_t SelectFunc) 96 | { 97 | if (entry->text) 98 | free(entry->text); 99 | entry->text = strdup(text); 100 | entry->align = align; 101 | entry->SelectFunc = SelectFunc; 102 | } 103 | 104 | void PMenu_Do_Update(edict_t *ent) 105 | { 106 | char string[1400]; 107 | int i; 108 | pmenu_t *p; 109 | int x; 110 | pmenuhnd_t *hnd; 111 | char *t; 112 | qboolean alt = false; 113 | 114 | if (!ent->client->menu) { 115 | gi.dprintf("warning: ent has no menu\n"); 116 | return; 117 | } 118 | 119 | hnd = ent->client->menu; 120 | 121 | strcpy(string, "xv 32 yv 8 picn inventory "); 122 | 123 | for (i = 0, p = hnd->entries; i < hnd->num; i++, p++) { 124 | if (!p->text || !*(p->text)) 125 | continue; // blank line 126 | t = p->text; 127 | if (*t == '*') { 128 | alt = true; 129 | t++; 130 | } 131 | sprintf(string + strlen(string), "yv %d ", 32 + i * 8); 132 | if (p->align == PMENU_ALIGN_CENTER) 133 | x = 196/2 - strlen(t)*4 + 64; 134 | else if (p->align == PMENU_ALIGN_RIGHT) 135 | x = 64 + (196 - strlen(t)*8); 136 | else 137 | x = 64; 138 | 139 | sprintf(string + strlen(string), "xv %d ", 140 | x - ((hnd->cur == i) ? 8 : 0)); 141 | 142 | if (hnd->cur == i) 143 | sprintf(string + strlen(string), "string2 \"\x0d%s\" ", t); 144 | else if (alt) 145 | sprintf(string + strlen(string), "string2 \"%s\" ", t); 146 | else 147 | sprintf(string + strlen(string), "string \"%s\" ", t); 148 | alt = false; 149 | } 150 | 151 | gi.WriteByte (svc_layout); 152 | gi.WriteString (string); 153 | } 154 | 155 | void PMenu_Update(edict_t *ent) 156 | { 157 | if (!ent->client->menu) { 158 | gi.dprintf("warning: ent has no menu\n"); 159 | return; 160 | } 161 | 162 | if (level.time - ent->client->menutime >= 1.0) { 163 | // been a second or more since last update, update now 164 | PMenu_Do_Update(ent); 165 | gi.unicast (ent, true); 166 | ent->client->menutime = level.time; 167 | ent->client->menudirty = false; 168 | } 169 | ent->client->menutime = level.time + 0.2; 170 | ent->client->menudirty = true; 171 | } 172 | 173 | void PMenu_Next(edict_t *ent) 174 | { 175 | pmenuhnd_t *hnd; 176 | int i; 177 | pmenu_t *p; 178 | 179 | if (!ent->client->menu) { 180 | gi.dprintf("warning: ent has no menu\n"); 181 | return; 182 | } 183 | 184 | hnd = ent->client->menu; 185 | 186 | if (hnd->cur < 0) 187 | return; // no selectable entries 188 | 189 | i = hnd->cur; 190 | p = hnd->entries + hnd->cur; 191 | do { 192 | i++, p++; 193 | if (i == hnd->num) 194 | i = 0, p = hnd->entries; 195 | if (p->SelectFunc) 196 | break; 197 | } while (i != hnd->cur); 198 | 199 | hnd->cur = i; 200 | 201 | PMenu_Update(ent); 202 | } 203 | 204 | void PMenu_Prev(edict_t *ent) 205 | { 206 | pmenuhnd_t *hnd; 207 | int i; 208 | pmenu_t *p; 209 | 210 | if (!ent->client->menu) { 211 | gi.dprintf("warning: ent has no menu\n"); 212 | return; 213 | } 214 | 215 | hnd = ent->client->menu; 216 | 217 | if (hnd->cur < 0) 218 | return; // no selectable entries 219 | 220 | i = hnd->cur; 221 | p = hnd->entries + hnd->cur; 222 | do { 223 | if (i == 0) { 224 | i = hnd->num - 1; 225 | p = hnd->entries + i; 226 | } else 227 | i--, p--; 228 | if (p->SelectFunc) 229 | break; 230 | } while (i != hnd->cur); 231 | 232 | hnd->cur = i; 233 | 234 | PMenu_Update(ent); 235 | } 236 | 237 | void PMenu_Select(edict_t *ent) 238 | { 239 | pmenuhnd_t *hnd; 240 | pmenu_t *p; 241 | 242 | if (!ent->client->menu) { 243 | gi.dprintf("warning: ent has no menu\n"); 244 | return; 245 | } 246 | 247 | hnd = ent->client->menu; 248 | 249 | if (hnd->cur < 0) 250 | return; // no selectable entries 251 | 252 | p = hnd->entries + hnd->cur; 253 | 254 | if (p->SelectFunc) 255 | p->SelectFunc(ent, hnd); 256 | } 257 | -------------------------------------------------------------------------------- /ctf/p_menu.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 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 | enum { 22 | PMENU_ALIGN_LEFT, 23 | PMENU_ALIGN_CENTER, 24 | PMENU_ALIGN_RIGHT 25 | }; 26 | 27 | typedef struct pmenuhnd_s { 28 | struct pmenu_s *entries; 29 | int cur; 30 | int num; 31 | void *arg; 32 | } pmenuhnd_t; 33 | 34 | typedef void (*SelectFunc_t)(edict_t *ent, pmenuhnd_t *hnd); 35 | 36 | typedef struct pmenu_s { 37 | char *text; 38 | int align; 39 | SelectFunc_t SelectFunc; 40 | } pmenu_t; 41 | 42 | pmenuhnd_t *PMenu_Open(edict_t *ent, pmenu_t *entries, int cur, int num, void *arg); 43 | void PMenu_Close(edict_t *ent); 44 | void PMenu_UpdateEntry(pmenu_t *entry, const char *text, int align, SelectFunc_t SelectFunc); 45 | void PMenu_Do_Update(edict_t *ent); 46 | void PMenu_Update(edict_t *ent); 47 | void PMenu_Next(edict_t *ent); 48 | void PMenu_Prev(edict_t *ent); 49 | void PMenu_Select(edict_t *ent); 50 | -------------------------------------------------------------------------------- /ctf/p_trail.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 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 "g_local.h" 21 | 22 | 23 | /* 24 | ============================================================================== 25 | 26 | PLAYER TRAIL 27 | 28 | ============================================================================== 29 | 30 | This is a circular list containing the a list of points of where 31 | the player has been recently. It is used by monsters for pursuit. 32 | 33 | .origin the spot 34 | .owner forward link 35 | .aiment backward link 36 | */ 37 | 38 | 39 | #define TRAIL_LENGTH 8 40 | 41 | edict_t *trail[TRAIL_LENGTH]; 42 | int trail_head; 43 | qboolean trail_active = false; 44 | 45 | #define NEXT(n) (((n) + 1) & (TRAIL_LENGTH - 1)) 46 | #define PREV(n) (((n) - 1) & (TRAIL_LENGTH - 1)) 47 | 48 | 49 | void PlayerTrail_Init (void) 50 | { 51 | int n; 52 | 53 | if (deathmatch->value /* FIXME || coop */) 54 | return; 55 | 56 | for (n = 0; n < TRAIL_LENGTH; n++) 57 | { 58 | trail[n] = G_Spawn(); 59 | trail[n]->classname = "player_trail"; 60 | } 61 | 62 | trail_head = 0; 63 | trail_active = true; 64 | } 65 | 66 | 67 | void PlayerTrail_Add (vec3_t spot) 68 | { 69 | vec3_t temp; 70 | 71 | if (!trail_active) 72 | return; 73 | 74 | VectorCopy (spot, trail[trail_head]->s.origin); 75 | 76 | trail[trail_head]->timestamp = level.time; 77 | 78 | VectorSubtract (spot, trail[PREV(trail_head)]->s.origin, temp); 79 | trail[trail_head]->s.angles[1] = vectoyaw (temp); 80 | 81 | trail_head = NEXT(trail_head); 82 | } 83 | 84 | 85 | void PlayerTrail_New (vec3_t spot) 86 | { 87 | if (!trail_active) 88 | return; 89 | 90 | PlayerTrail_Init (); 91 | PlayerTrail_Add (spot); 92 | } 93 | 94 | 95 | edict_t *PlayerTrail_PickFirst (edict_t *self) 96 | { 97 | int marker; 98 | int n; 99 | 100 | if (!trail_active) 101 | return NULL; 102 | 103 | for (marker = trail_head, n = TRAIL_LENGTH; n; n--) 104 | { 105 | if(trail[marker]->timestamp <= self->monsterinfo.trail_time) 106 | marker = NEXT(marker); 107 | else 108 | break; 109 | } 110 | 111 | if (visible(self, trail[marker])) 112 | { 113 | return trail[marker]; 114 | } 115 | 116 | if (visible(self, trail[PREV(marker)])) 117 | { 118 | return trail[PREV(marker)]; 119 | } 120 | 121 | return trail[marker]; 122 | } 123 | 124 | edict_t *PlayerTrail_PickNext (edict_t *self) 125 | { 126 | int marker; 127 | int n; 128 | 129 | if (!trail_active) 130 | return NULL; 131 | 132 | for (marker = trail_head, n = TRAIL_LENGTH; n; n--) 133 | { 134 | if(trail[marker]->timestamp <= self->monsterinfo.trail_time) 135 | marker = NEXT(marker); 136 | else 137 | break; 138 | } 139 | 140 | return trail[marker]; 141 | } 142 | 143 | edict_t *PlayerTrail_LastSpot (void) 144 | { 145 | return trail[PREV(trail_head)]; 146 | } 147 | -------------------------------------------------------------------------------- /game/g_chase.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 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 "g_local.h" 21 | 22 | void UpdateChaseCam(edict_t *ent) 23 | { 24 | vec3_t o, ownerv, goal; 25 | edict_t *targ; 26 | vec3_t forward, right; 27 | trace_t trace; 28 | int i; 29 | vec3_t oldgoal; 30 | vec3_t angles; 31 | 32 | // is our chase target gone? 33 | if (!ent->client->chase_target->inuse 34 | || ent->client->chase_target->client->resp.spectator) { 35 | edict_t *old = ent->client->chase_target; 36 | ChaseNext(ent); 37 | if (ent->client->chase_target == old) { 38 | ent->client->chase_target = NULL; 39 | ent->client->ps.pmove.pm_flags &= ~PMF_NO_PREDICTION; 40 | return; 41 | } 42 | } 43 | 44 | targ = ent->client->chase_target; 45 | 46 | VectorCopy(targ->s.origin, ownerv); 47 | VectorCopy(ent->s.origin, oldgoal); 48 | 49 | ownerv[2] += targ->viewheight; 50 | 51 | VectorCopy(targ->client->v_angle, angles); 52 | if (angles[PITCH] > 56) 53 | angles[PITCH] = 56; 54 | AngleVectors (angles, forward, right, NULL); 55 | VectorNormalize(forward); 56 | VectorMA(ownerv, -30, forward, o); 57 | 58 | if (o[2] < targ->s.origin[2] + 20) 59 | o[2] = targ->s.origin[2] + 20; 60 | 61 | // jump animation lifts 62 | if (!targ->groundentity) 63 | o[2] += 16; 64 | 65 | trace = gi.trace(ownerv, vec3_origin, vec3_origin, o, targ, MASK_SOLID); 66 | 67 | VectorCopy(trace.endpos, goal); 68 | 69 | VectorMA(goal, 2, forward, goal); 70 | 71 | // pad for floors and ceilings 72 | VectorCopy(goal, o); 73 | o[2] += 6; 74 | trace = gi.trace(goal, vec3_origin, vec3_origin, o, targ, MASK_SOLID); 75 | if (trace.fraction < 1) { 76 | VectorCopy(trace.endpos, goal); 77 | goal[2] -= 6; 78 | } 79 | 80 | VectorCopy(goal, o); 81 | o[2] -= 6; 82 | trace = gi.trace(goal, vec3_origin, vec3_origin, o, targ, MASK_SOLID); 83 | if (trace.fraction < 1) { 84 | VectorCopy(trace.endpos, goal); 85 | goal[2] += 6; 86 | } 87 | 88 | if (targ->deadflag) 89 | ent->client->ps.pmove.pm_type = PM_DEAD; 90 | else 91 | ent->client->ps.pmove.pm_type = PM_FREEZE; 92 | 93 | VectorCopy(goal, ent->s.origin); 94 | for (i=0 ; i<3 ; i++) 95 | ent->client->ps.pmove.delta_angles[i] = ANGLE2SHORT(targ->client->v_angle[i] - ent->client->resp.cmd_angles[i]); 96 | 97 | if (targ->deadflag) { 98 | ent->client->ps.viewangles[ROLL] = 40; 99 | ent->client->ps.viewangles[PITCH] = -15; 100 | ent->client->ps.viewangles[YAW] = targ->client->killer_yaw; 101 | } else { 102 | VectorCopy(targ->client->v_angle, ent->client->ps.viewangles); 103 | VectorCopy(targ->client->v_angle, ent->client->v_angle); 104 | } 105 | 106 | ent->viewheight = 0; 107 | ent->client->ps.pmove.pm_flags |= PMF_NO_PREDICTION; 108 | gi.linkentity(ent); 109 | } 110 | 111 | void ChaseNext(edict_t *ent) 112 | { 113 | int i; 114 | edict_t *e; 115 | 116 | if (!ent->client->chase_target) 117 | return; 118 | 119 | i = ent->client->chase_target - g_edicts; 120 | do { 121 | i++; 122 | if (i > maxclients->value) 123 | i = 1; 124 | e = g_edicts + i; 125 | if (!e->inuse) 126 | continue; 127 | if (!e->client->resp.spectator) 128 | break; 129 | } while (e != ent->client->chase_target); 130 | 131 | ent->client->chase_target = e; 132 | ent->client->update_chase = true; 133 | } 134 | 135 | void ChasePrev(edict_t *ent) 136 | { 137 | int i; 138 | edict_t *e; 139 | 140 | if (!ent->client->chase_target) 141 | return; 142 | 143 | i = ent->client->chase_target - g_edicts; 144 | do { 145 | i--; 146 | if (i < 1) 147 | i = maxclients->value; 148 | e = g_edicts + i; 149 | if (!e->inuse) 150 | continue; 151 | if (!e->client->resp.spectator) 152 | break; 153 | } while (e != ent->client->chase_target); 154 | 155 | ent->client->chase_target = e; 156 | ent->client->update_chase = true; 157 | } 158 | 159 | void GetChaseTarget(edict_t *ent) 160 | { 161 | int i; 162 | edict_t *other; 163 | 164 | for (i = 1; i <= maxclients->value; i++) { 165 | other = g_edicts + i; 166 | if (other->inuse && !other->client->resp.spectator) { 167 | ent->client->chase_target = other; 168 | ent->client->update_chase = true; 169 | UpdateChaseCam(ent); 170 | return; 171 | } 172 | } 173 | gi.centerprintf(ent, "No other players to chase."); 174 | } 175 | 176 | -------------------------------------------------------------------------------- /game/game.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | GetGameAPI 3 | -------------------------------------------------------------------------------- /game/game.plg: -------------------------------------------------------------------------------- 1 | --------------------Configuration: game - Win32 Release Alpha-------------------- 2 | Begining build with project "G:\quake2\code\game\game.dsp", at root. 3 | Active configuration is Win32 (ALPHA) Dynamic-Link Library (based on Win32 (ALPHA) Dynamic-Link Library) 4 | 5 | Project's tools are: 6 | "OLE Type Library Maker" with flags "/nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 " 7 | "C/C++ Compiler for Alpha" with flags "/nologo /QA21164 /MT /Gt0 /W3 /GX /Zi /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "C_ONLY" /Fp".\ReleaseAXP/game.pch" /YX /Fo".\ReleaseAXP/" /Fd".\ReleaseAXP/" /FD /c " 8 | "Win32 Resource Compiler" with flags "/l 0x409 /d "NDEBUG" " 9 | "Browser Database Maker" with flags "/nologo /o"..\ReleaseAXP/game.bsc" " 10 | "COFF Linker for Alpha" with flags "kernel32.lib user32.lib gdi32.lib /nologo /base:"0x20000000" /subsystem:windows /dll /incremental:no /pdb:"..\ReleaseAXP/gameaxp.pdb" /debug /machine:ALPHA /def:".\game.def" /out:"..\ReleaseAXP/gameaxp.dll" /implib:"..\ReleaseAXP/gameaxp.lib" " 11 | "Custom Build" with flags "" 12 | "" with flags "" 13 | 14 | Creating temp file "C:\TEMP\RSPA6.tmp" with contents 17 | Creating command line "cl.exe @C:\TEMP\RSPA6.tmp" 18 | Creating temp file "C:\TEMP\RSPA7.tmp" with contents 67 | Creating command line "link.exe @C:\TEMP\RSPA7.tmp" 68 | Compiling... 69 | p_weapon.c 70 | Linking... 71 | Creating library ..\ReleaseAXP/gameaxp.lib and object ..\ReleaseAXP/gameaxp.exp 72 | 73 | 74 | 75 | gameaxp.dll - 0 error(s), 0 warning(s) 76 | -------------------------------------------------------------------------------- /game/m_boss3.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 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 | 23 | boss3 24 | 25 | ============================================================================== 26 | */ 27 | 28 | #include "g_local.h" 29 | #include "m_boss32.h" 30 | 31 | void Use_Boss3 (edict_t *ent, edict_t *other, edict_t *activator) 32 | { 33 | gi.WriteByte (svc_temp_entity); 34 | gi.WriteByte (TE_BOSSTPORT); 35 | gi.WritePosition (ent->s.origin); 36 | gi.multicast (ent->s.origin, MULTICAST_PVS); 37 | G_FreeEdict (ent); 38 | } 39 | 40 | void Think_Boss3Stand (edict_t *ent) 41 | { 42 | if (ent->s.frame == FRAME_stand260) 43 | ent->s.frame = FRAME_stand201; 44 | else 45 | ent->s.frame++; 46 | ent->nextthink = level.time + FRAMETIME; 47 | } 48 | 49 | /*QUAKED monster_boss3_stand (1 .5 0) (-32 -32 0) (32 32 90) 50 | 51 | Just stands and cycles in one place until targeted, then teleports away. 52 | */ 53 | void SP_monster_boss3_stand (edict_t *self) 54 | { 55 | if (deathmatch->value) 56 | { 57 | G_FreeEdict (self); 58 | return; 59 | } 60 | 61 | self->movetype = MOVETYPE_STEP; 62 | self->solid = SOLID_BBOX; 63 | self->model = "models/monsters/boss3/rider/tris.md2"; 64 | self->s.modelindex = gi.modelindex (self->model); 65 | self->s.frame = FRAME_stand201; 66 | 67 | gi.soundindex ("misc/bigtele.wav"); 68 | 69 | VectorSet (self->mins, -32, -32, 0); 70 | VectorSet (self->maxs, 32, 32, 90); 71 | 72 | self->use = Use_Boss3; 73 | self->think = Think_Boss3Stand; 74 | self->nextthink = level.time + FRAMETIME; 75 | gi.linkentity (self); 76 | } 77 | -------------------------------------------------------------------------------- /game/m_flipper.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 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 | // G:\quake2\baseq2\models/monsters/flipper 21 | 22 | // This file generated by ModelGen - Do NOT Modify 23 | 24 | #define FRAME_flpbit01 0 25 | #define FRAME_flpbit02 1 26 | #define FRAME_flpbit03 2 27 | #define FRAME_flpbit04 3 28 | #define FRAME_flpbit05 4 29 | #define FRAME_flpbit06 5 30 | #define FRAME_flpbit07 6 31 | #define FRAME_flpbit08 7 32 | #define FRAME_flpbit09 8 33 | #define FRAME_flpbit10 9 34 | #define FRAME_flpbit11 10 35 | #define FRAME_flpbit12 11 36 | #define FRAME_flpbit13 12 37 | #define FRAME_flpbit14 13 38 | #define FRAME_flpbit15 14 39 | #define FRAME_flpbit16 15 40 | #define FRAME_flpbit17 16 41 | #define FRAME_flpbit18 17 42 | #define FRAME_flpbit19 18 43 | #define FRAME_flpbit20 19 44 | #define FRAME_flptal01 20 45 | #define FRAME_flptal02 21 46 | #define FRAME_flptal03 22 47 | #define FRAME_flptal04 23 48 | #define FRAME_flptal05 24 49 | #define FRAME_flptal06 25 50 | #define FRAME_flptal07 26 51 | #define FRAME_flptal08 27 52 | #define FRAME_flptal09 28 53 | #define FRAME_flptal10 29 54 | #define FRAME_flptal11 30 55 | #define FRAME_flptal12 31 56 | #define FRAME_flptal13 32 57 | #define FRAME_flptal14 33 58 | #define FRAME_flptal15 34 59 | #define FRAME_flptal16 35 60 | #define FRAME_flptal17 36 61 | #define FRAME_flptal18 37 62 | #define FRAME_flptal19 38 63 | #define FRAME_flptal20 39 64 | #define FRAME_flptal21 40 65 | #define FRAME_flphor01 41 66 | #define FRAME_flphor02 42 67 | #define FRAME_flphor03 43 68 | #define FRAME_flphor04 44 69 | #define FRAME_flphor05 45 70 | #define FRAME_flphor06 46 71 | #define FRAME_flphor07 47 72 | #define FRAME_flphor08 48 73 | #define FRAME_flphor09 49 74 | #define FRAME_flphor10 50 75 | #define FRAME_flphor11 51 76 | #define FRAME_flphor12 52 77 | #define FRAME_flphor13 53 78 | #define FRAME_flphor14 54 79 | #define FRAME_flphor15 55 80 | #define FRAME_flphor16 56 81 | #define FRAME_flphor17 57 82 | #define FRAME_flphor18 58 83 | #define FRAME_flphor19 59 84 | #define FRAME_flphor20 60 85 | #define FRAME_flphor21 61 86 | #define FRAME_flphor22 62 87 | #define FRAME_flphor23 63 88 | #define FRAME_flphor24 64 89 | #define FRAME_flpver01 65 90 | #define FRAME_flpver02 66 91 | #define FRAME_flpver03 67 92 | #define FRAME_flpver04 68 93 | #define FRAME_flpver05 69 94 | #define FRAME_flpver06 70 95 | #define FRAME_flpver07 71 96 | #define FRAME_flpver08 72 97 | #define FRAME_flpver09 73 98 | #define FRAME_flpver10 74 99 | #define FRAME_flpver11 75 100 | #define FRAME_flpver12 76 101 | #define FRAME_flpver13 77 102 | #define FRAME_flpver14 78 103 | #define FRAME_flpver15 79 104 | #define FRAME_flpver16 80 105 | #define FRAME_flpver17 81 106 | #define FRAME_flpver18 82 107 | #define FRAME_flpver19 83 108 | #define FRAME_flpver20 84 109 | #define FRAME_flpver21 85 110 | #define FRAME_flpver22 86 111 | #define FRAME_flpver23 87 112 | #define FRAME_flpver24 88 113 | #define FRAME_flpver25 89 114 | #define FRAME_flpver26 90 115 | #define FRAME_flpver27 91 116 | #define FRAME_flpver28 92 117 | #define FRAME_flpver29 93 118 | #define FRAME_flppn101 94 119 | #define FRAME_flppn102 95 120 | #define FRAME_flppn103 96 121 | #define FRAME_flppn104 97 122 | #define FRAME_flppn105 98 123 | #define FRAME_flppn201 99 124 | #define FRAME_flppn202 100 125 | #define FRAME_flppn203 101 126 | #define FRAME_flppn204 102 127 | #define FRAME_flppn205 103 128 | #define FRAME_flpdth01 104 129 | #define FRAME_flpdth02 105 130 | #define FRAME_flpdth03 106 131 | #define FRAME_flpdth04 107 132 | #define FRAME_flpdth05 108 133 | #define FRAME_flpdth06 109 134 | #define FRAME_flpdth07 110 135 | #define FRAME_flpdth08 111 136 | #define FRAME_flpdth09 112 137 | #define FRAME_flpdth10 113 138 | #define FRAME_flpdth11 114 139 | #define FRAME_flpdth12 115 140 | #define FRAME_flpdth13 116 141 | #define FRAME_flpdth14 117 142 | #define FRAME_flpdth15 118 143 | #define FRAME_flpdth16 119 144 | #define FRAME_flpdth17 120 145 | #define FRAME_flpdth18 121 146 | #define FRAME_flpdth19 122 147 | #define FRAME_flpdth20 123 148 | #define FRAME_flpdth21 124 149 | #define FRAME_flpdth22 125 150 | #define FRAME_flpdth23 126 151 | #define FRAME_flpdth24 127 152 | #define FRAME_flpdth25 128 153 | #define FRAME_flpdth26 129 154 | #define FRAME_flpdth27 130 155 | #define FRAME_flpdth28 131 156 | #define FRAME_flpdth29 132 157 | #define FRAME_flpdth30 133 158 | #define FRAME_flpdth31 134 159 | #define FRAME_flpdth32 135 160 | #define FRAME_flpdth33 136 161 | #define FRAME_flpdth34 137 162 | #define FRAME_flpdth35 138 163 | #define FRAME_flpdth36 139 164 | #define FRAME_flpdth37 140 165 | #define FRAME_flpdth38 141 166 | #define FRAME_flpdth39 142 167 | #define FRAME_flpdth40 143 168 | #define FRAME_flpdth41 144 169 | #define FRAME_flpdth42 145 170 | #define FRAME_flpdth43 146 171 | #define FRAME_flpdth44 147 172 | #define FRAME_flpdth45 148 173 | #define FRAME_flpdth46 149 174 | #define FRAME_flpdth47 150 175 | #define FRAME_flpdth48 151 176 | #define FRAME_flpdth49 152 177 | #define FRAME_flpdth50 153 178 | #define FRAME_flpdth51 154 179 | #define FRAME_flpdth52 155 180 | #define FRAME_flpdth53 156 181 | #define FRAME_flpdth54 157 182 | #define FRAME_flpdth55 158 183 | #define FRAME_flpdth56 159 184 | 185 | #define MODEL_SCALE 1.000000 186 | -------------------------------------------------------------------------------- /game/m_flyer.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 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 | // G:\quake2\baseq2\models/monsters/flyer 21 | 22 | // This file generated by ModelGen - Do NOT Modify 23 | 24 | #define ACTION_nothing 0 25 | #define ACTION_attack1 1 26 | #define ACTION_attack2 2 27 | #define ACTION_run 3 28 | #define ACTION_walk 4 29 | 30 | #define FRAME_start01 0 31 | #define FRAME_start02 1 32 | #define FRAME_start03 2 33 | #define FRAME_start04 3 34 | #define FRAME_start05 4 35 | #define FRAME_start06 5 36 | #define FRAME_stop01 6 37 | #define FRAME_stop02 7 38 | #define FRAME_stop03 8 39 | #define FRAME_stop04 9 40 | #define FRAME_stop05 10 41 | #define FRAME_stop06 11 42 | #define FRAME_stop07 12 43 | #define FRAME_stand01 13 44 | #define FRAME_stand02 14 45 | #define FRAME_stand03 15 46 | #define FRAME_stand04 16 47 | #define FRAME_stand05 17 48 | #define FRAME_stand06 18 49 | #define FRAME_stand07 19 50 | #define FRAME_stand08 20 51 | #define FRAME_stand09 21 52 | #define FRAME_stand10 22 53 | #define FRAME_stand11 23 54 | #define FRAME_stand12 24 55 | #define FRAME_stand13 25 56 | #define FRAME_stand14 26 57 | #define FRAME_stand15 27 58 | #define FRAME_stand16 28 59 | #define FRAME_stand17 29 60 | #define FRAME_stand18 30 61 | #define FRAME_stand19 31 62 | #define FRAME_stand20 32 63 | #define FRAME_stand21 33 64 | #define FRAME_stand22 34 65 | #define FRAME_stand23 35 66 | #define FRAME_stand24 36 67 | #define FRAME_stand25 37 68 | #define FRAME_stand26 38 69 | #define FRAME_stand27 39 70 | #define FRAME_stand28 40 71 | #define FRAME_stand29 41 72 | #define FRAME_stand30 42 73 | #define FRAME_stand31 43 74 | #define FRAME_stand32 44 75 | #define FRAME_stand33 45 76 | #define FRAME_stand34 46 77 | #define FRAME_stand35 47 78 | #define FRAME_stand36 48 79 | #define FRAME_stand37 49 80 | #define FRAME_stand38 50 81 | #define FRAME_stand39 51 82 | #define FRAME_stand40 52 83 | #define FRAME_stand41 53 84 | #define FRAME_stand42 54 85 | #define FRAME_stand43 55 86 | #define FRAME_stand44 56 87 | #define FRAME_stand45 57 88 | #define FRAME_attak101 58 89 | #define FRAME_attak102 59 90 | #define FRAME_attak103 60 91 | #define FRAME_attak104 61 92 | #define FRAME_attak105 62 93 | #define FRAME_attak106 63 94 | #define FRAME_attak107 64 95 | #define FRAME_attak108 65 96 | #define FRAME_attak109 66 97 | #define FRAME_attak110 67 98 | #define FRAME_attak111 68 99 | #define FRAME_attak112 69 100 | #define FRAME_attak113 70 101 | #define FRAME_attak114 71 102 | #define FRAME_attak115 72 103 | #define FRAME_attak116 73 104 | #define FRAME_attak117 74 105 | #define FRAME_attak118 75 106 | #define FRAME_attak119 76 107 | #define FRAME_attak120 77 108 | #define FRAME_attak121 78 109 | #define FRAME_attak201 79 110 | #define FRAME_attak202 80 111 | #define FRAME_attak203 81 112 | #define FRAME_attak204 82 113 | #define FRAME_attak205 83 114 | #define FRAME_attak206 84 115 | #define FRAME_attak207 85 116 | #define FRAME_attak208 86 117 | #define FRAME_attak209 87 118 | #define FRAME_attak210 88 119 | #define FRAME_attak211 89 120 | #define FRAME_attak212 90 121 | #define FRAME_attak213 91 122 | #define FRAME_attak214 92 123 | #define FRAME_attak215 93 124 | #define FRAME_attak216 94 125 | #define FRAME_attak217 95 126 | #define FRAME_bankl01 96 127 | #define FRAME_bankl02 97 128 | #define FRAME_bankl03 98 129 | #define FRAME_bankl04 99 130 | #define FRAME_bankl05 100 131 | #define FRAME_bankl06 101 132 | #define FRAME_bankl07 102 133 | #define FRAME_bankr01 103 134 | #define FRAME_bankr02 104 135 | #define FRAME_bankr03 105 136 | #define FRAME_bankr04 106 137 | #define FRAME_bankr05 107 138 | #define FRAME_bankr06 108 139 | #define FRAME_bankr07 109 140 | #define FRAME_rollf01 110 141 | #define FRAME_rollf02 111 142 | #define FRAME_rollf03 112 143 | #define FRAME_rollf04 113 144 | #define FRAME_rollf05 114 145 | #define FRAME_rollf06 115 146 | #define FRAME_rollf07 116 147 | #define FRAME_rollf08 117 148 | #define FRAME_rollf09 118 149 | #define FRAME_rollr01 119 150 | #define FRAME_rollr02 120 151 | #define FRAME_rollr03 121 152 | #define FRAME_rollr04 122 153 | #define FRAME_rollr05 123 154 | #define FRAME_rollr06 124 155 | #define FRAME_rollr07 125 156 | #define FRAME_rollr08 126 157 | #define FRAME_rollr09 127 158 | #define FRAME_defens01 128 159 | #define FRAME_defens02 129 160 | #define FRAME_defens03 130 161 | #define FRAME_defens04 131 162 | #define FRAME_defens05 132 163 | #define FRAME_defens06 133 164 | #define FRAME_pain101 134 165 | #define FRAME_pain102 135 166 | #define FRAME_pain103 136 167 | #define FRAME_pain104 137 168 | #define FRAME_pain105 138 169 | #define FRAME_pain106 139 170 | #define FRAME_pain107 140 171 | #define FRAME_pain108 141 172 | #define FRAME_pain109 142 173 | #define FRAME_pain201 143 174 | #define FRAME_pain202 144 175 | #define FRAME_pain203 145 176 | #define FRAME_pain204 146 177 | #define FRAME_pain301 147 178 | #define FRAME_pain302 148 179 | #define FRAME_pain303 149 180 | #define FRAME_pain304 150 181 | 182 | #define MODEL_SCALE 1.000000 183 | -------------------------------------------------------------------------------- /game/m_gladiator.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 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 | // G:\quake2\baseq2\models/monsters/gladiatr 21 | 22 | // This file generated by ModelGen - Do NOT Modify 23 | 24 | #define FRAME_stand1 0 25 | #define FRAME_stand2 1 26 | #define FRAME_stand3 2 27 | #define FRAME_stand4 3 28 | #define FRAME_stand5 4 29 | #define FRAME_stand6 5 30 | #define FRAME_stand7 6 31 | #define FRAME_walk1 7 32 | #define FRAME_walk2 8 33 | #define FRAME_walk3 9 34 | #define FRAME_walk4 10 35 | #define FRAME_walk5 11 36 | #define FRAME_walk6 12 37 | #define FRAME_walk7 13 38 | #define FRAME_walk8 14 39 | #define FRAME_walk9 15 40 | #define FRAME_walk10 16 41 | #define FRAME_walk11 17 42 | #define FRAME_walk12 18 43 | #define FRAME_walk13 19 44 | #define FRAME_walk14 20 45 | #define FRAME_walk15 21 46 | #define FRAME_walk16 22 47 | #define FRAME_run1 23 48 | #define FRAME_run2 24 49 | #define FRAME_run3 25 50 | #define FRAME_run4 26 51 | #define FRAME_run5 27 52 | #define FRAME_run6 28 53 | #define FRAME_melee1 29 54 | #define FRAME_melee2 30 55 | #define FRAME_melee3 31 56 | #define FRAME_melee4 32 57 | #define FRAME_melee5 33 58 | #define FRAME_melee6 34 59 | #define FRAME_melee7 35 60 | #define FRAME_melee8 36 61 | #define FRAME_melee9 37 62 | #define FRAME_melee10 38 63 | #define FRAME_melee11 39 64 | #define FRAME_melee12 40 65 | #define FRAME_melee13 41 66 | #define FRAME_melee14 42 67 | #define FRAME_melee15 43 68 | #define FRAME_melee16 44 69 | #define FRAME_melee17 45 70 | #define FRAME_attack1 46 71 | #define FRAME_attack2 47 72 | #define FRAME_attack3 48 73 | #define FRAME_attack4 49 74 | #define FRAME_attack5 50 75 | #define FRAME_attack6 51 76 | #define FRAME_attack7 52 77 | #define FRAME_attack8 53 78 | #define FRAME_attack9 54 79 | #define FRAME_pain1 55 80 | #define FRAME_pain2 56 81 | #define FRAME_pain3 57 82 | #define FRAME_pain4 58 83 | #define FRAME_pain5 59 84 | #define FRAME_pain6 60 85 | #define FRAME_death1 61 86 | #define FRAME_death2 62 87 | #define FRAME_death3 63 88 | #define FRAME_death4 64 89 | #define FRAME_death5 65 90 | #define FRAME_death6 66 91 | #define FRAME_death7 67 92 | #define FRAME_death8 68 93 | #define FRAME_death9 69 94 | #define FRAME_death10 70 95 | #define FRAME_death11 71 96 | #define FRAME_death12 72 97 | #define FRAME_death13 73 98 | #define FRAME_death14 74 99 | #define FRAME_death15 75 100 | #define FRAME_death16 76 101 | #define FRAME_death17 77 102 | #define FRAME_death18 78 103 | #define FRAME_death19 79 104 | #define FRAME_death20 80 105 | #define FRAME_death21 81 106 | #define FRAME_death22 82 107 | #define FRAME_painup1 83 108 | #define FRAME_painup2 84 109 | #define FRAME_painup3 85 110 | #define FRAME_painup4 86 111 | #define FRAME_painup5 87 112 | #define FRAME_painup6 88 113 | #define FRAME_painup7 89 114 | 115 | #define MODEL_SCALE 1.000000 116 | -------------------------------------------------------------------------------- /game/m_mutant.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 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 | // G:\quake2\baseq2\models/monsters/mutant 21 | 22 | // This file generated by ModelGen - Do NOT Modify 23 | 24 | #define FRAME_attack01 0 25 | #define FRAME_attack02 1 26 | #define FRAME_attack03 2 27 | #define FRAME_attack04 3 28 | #define FRAME_attack05 4 29 | #define FRAME_attack06 5 30 | #define FRAME_attack07 6 31 | #define FRAME_attack08 7 32 | #define FRAME_attack09 8 33 | #define FRAME_attack10 9 34 | #define FRAME_attack11 10 35 | #define FRAME_attack12 11 36 | #define FRAME_attack13 12 37 | #define FRAME_attack14 13 38 | #define FRAME_attack15 14 39 | #define FRAME_death101 15 40 | #define FRAME_death102 16 41 | #define FRAME_death103 17 42 | #define FRAME_death104 18 43 | #define FRAME_death105 19 44 | #define FRAME_death106 20 45 | #define FRAME_death107 21 46 | #define FRAME_death108 22 47 | #define FRAME_death109 23 48 | #define FRAME_death201 24 49 | #define FRAME_death202 25 50 | #define FRAME_death203 26 51 | #define FRAME_death204 27 52 | #define FRAME_death205 28 53 | #define FRAME_death206 29 54 | #define FRAME_death207 30 55 | #define FRAME_death208 31 56 | #define FRAME_death209 32 57 | #define FRAME_death210 33 58 | #define FRAME_pain101 34 59 | #define FRAME_pain102 35 60 | #define FRAME_pain103 36 61 | #define FRAME_pain104 37 62 | #define FRAME_pain105 38 63 | #define FRAME_pain201 39 64 | #define FRAME_pain202 40 65 | #define FRAME_pain203 41 66 | #define FRAME_pain204 42 67 | #define FRAME_pain205 43 68 | #define FRAME_pain206 44 69 | #define FRAME_pain301 45 70 | #define FRAME_pain302 46 71 | #define FRAME_pain303 47 72 | #define FRAME_pain304 48 73 | #define FRAME_pain305 49 74 | #define FRAME_pain306 50 75 | #define FRAME_pain307 51 76 | #define FRAME_pain308 52 77 | #define FRAME_pain309 53 78 | #define FRAME_pain310 54 79 | #define FRAME_pain311 55 80 | #define FRAME_run03 56 81 | #define FRAME_run04 57 82 | #define FRAME_run05 58 83 | #define FRAME_run06 59 84 | #define FRAME_run07 60 85 | #define FRAME_run08 61 86 | #define FRAME_stand101 62 87 | #define FRAME_stand102 63 88 | #define FRAME_stand103 64 89 | #define FRAME_stand104 65 90 | #define FRAME_stand105 66 91 | #define FRAME_stand106 67 92 | #define FRAME_stand107 68 93 | #define FRAME_stand108 69 94 | #define FRAME_stand109 70 95 | #define FRAME_stand110 71 96 | #define FRAME_stand111 72 97 | #define FRAME_stand112 73 98 | #define FRAME_stand113 74 99 | #define FRAME_stand114 75 100 | #define FRAME_stand115 76 101 | #define FRAME_stand116 77 102 | #define FRAME_stand117 78 103 | #define FRAME_stand118 79 104 | #define FRAME_stand119 80 105 | #define FRAME_stand120 81 106 | #define FRAME_stand121 82 107 | #define FRAME_stand122 83 108 | #define FRAME_stand123 84 109 | #define FRAME_stand124 85 110 | #define FRAME_stand125 86 111 | #define FRAME_stand126 87 112 | #define FRAME_stand127 88 113 | #define FRAME_stand128 89 114 | #define FRAME_stand129 90 115 | #define FRAME_stand130 91 116 | #define FRAME_stand131 92 117 | #define FRAME_stand132 93 118 | #define FRAME_stand133 94 119 | #define FRAME_stand134 95 120 | #define FRAME_stand135 96 121 | #define FRAME_stand136 97 122 | #define FRAME_stand137 98 123 | #define FRAME_stand138 99 124 | #define FRAME_stand139 100 125 | #define FRAME_stand140 101 126 | #define FRAME_stand141 102 127 | #define FRAME_stand142 103 128 | #define FRAME_stand143 104 129 | #define FRAME_stand144 105 130 | #define FRAME_stand145 106 131 | #define FRAME_stand146 107 132 | #define FRAME_stand147 108 133 | #define FRAME_stand148 109 134 | #define FRAME_stand149 110 135 | #define FRAME_stand150 111 136 | #define FRAME_stand151 112 137 | #define FRAME_stand152 113 138 | #define FRAME_stand153 114 139 | #define FRAME_stand154 115 140 | #define FRAME_stand155 116 141 | #define FRAME_stand156 117 142 | #define FRAME_stand157 118 143 | #define FRAME_stand158 119 144 | #define FRAME_stand159 120 145 | #define FRAME_stand160 121 146 | #define FRAME_stand161 122 147 | #define FRAME_stand162 123 148 | #define FRAME_stand163 124 149 | #define FRAME_stand164 125 150 | #define FRAME_walk01 126 151 | #define FRAME_walk02 127 152 | #define FRAME_walk03 128 153 | #define FRAME_walk04 129 154 | #define FRAME_walk05 130 155 | #define FRAME_walk06 131 156 | #define FRAME_walk07 132 157 | #define FRAME_walk08 133 158 | #define FRAME_walk09 134 159 | #define FRAME_walk10 135 160 | #define FRAME_walk11 136 161 | #define FRAME_walk12 137 162 | #define FRAME_walk13 138 163 | #define FRAME_walk14 139 164 | #define FRAME_walk15 140 165 | #define FRAME_walk16 141 166 | #define FRAME_walk17 142 167 | #define FRAME_walk18 143 168 | #define FRAME_walk19 144 169 | #define FRAME_walk20 145 170 | #define FRAME_walk21 146 171 | #define FRAME_walk22 147 172 | #define FRAME_walk23 148 173 | 174 | #define MODEL_SCALE 1.000000 175 | -------------------------------------------------------------------------------- /game/m_parasite.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 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 | // G:\quake2\baseq2\models/monsters/parasite 21 | 22 | // This file generated by ModelGen - Do NOT Modify 23 | 24 | #define FRAME_break01 0 25 | #define FRAME_break02 1 26 | #define FRAME_break03 2 27 | #define FRAME_break04 3 28 | #define FRAME_break05 4 29 | #define FRAME_break06 5 30 | #define FRAME_break07 6 31 | #define FRAME_break08 7 32 | #define FRAME_break09 8 33 | #define FRAME_break10 9 34 | #define FRAME_break11 10 35 | #define FRAME_break12 11 36 | #define FRAME_break13 12 37 | #define FRAME_break14 13 38 | #define FRAME_break15 14 39 | #define FRAME_break16 15 40 | #define FRAME_break17 16 41 | #define FRAME_break18 17 42 | #define FRAME_break19 18 43 | #define FRAME_break20 19 44 | #define FRAME_break21 20 45 | #define FRAME_break22 21 46 | #define FRAME_break23 22 47 | #define FRAME_break24 23 48 | #define FRAME_break25 24 49 | #define FRAME_break26 25 50 | #define FRAME_break27 26 51 | #define FRAME_break28 27 52 | #define FRAME_break29 28 53 | #define FRAME_break30 29 54 | #define FRAME_break31 30 55 | #define FRAME_break32 31 56 | #define FRAME_death101 32 57 | #define FRAME_death102 33 58 | #define FRAME_death103 34 59 | #define FRAME_death104 35 60 | #define FRAME_death105 36 61 | #define FRAME_death106 37 62 | #define FRAME_death107 38 63 | #define FRAME_drain01 39 64 | #define FRAME_drain02 40 65 | #define FRAME_drain03 41 66 | #define FRAME_drain04 42 67 | #define FRAME_drain05 43 68 | #define FRAME_drain06 44 69 | #define FRAME_drain07 45 70 | #define FRAME_drain08 46 71 | #define FRAME_drain09 47 72 | #define FRAME_drain10 48 73 | #define FRAME_drain11 49 74 | #define FRAME_drain12 50 75 | #define FRAME_drain13 51 76 | #define FRAME_drain14 52 77 | #define FRAME_drain15 53 78 | #define FRAME_drain16 54 79 | #define FRAME_drain17 55 80 | #define FRAME_drain18 56 81 | #define FRAME_pain101 57 82 | #define FRAME_pain102 58 83 | #define FRAME_pain103 59 84 | #define FRAME_pain104 60 85 | #define FRAME_pain105 61 86 | #define FRAME_pain106 62 87 | #define FRAME_pain107 63 88 | #define FRAME_pain108 64 89 | #define FRAME_pain109 65 90 | #define FRAME_pain110 66 91 | #define FRAME_pain111 67 92 | #define FRAME_run01 68 93 | #define FRAME_run02 69 94 | #define FRAME_run03 70 95 | #define FRAME_run04 71 96 | #define FRAME_run05 72 97 | #define FRAME_run06 73 98 | #define FRAME_run07 74 99 | #define FRAME_run08 75 100 | #define FRAME_run09 76 101 | #define FRAME_run10 77 102 | #define FRAME_run11 78 103 | #define FRAME_run12 79 104 | #define FRAME_run13 80 105 | #define FRAME_run14 81 106 | #define FRAME_run15 82 107 | #define FRAME_stand01 83 108 | #define FRAME_stand02 84 109 | #define FRAME_stand03 85 110 | #define FRAME_stand04 86 111 | #define FRAME_stand05 87 112 | #define FRAME_stand06 88 113 | #define FRAME_stand07 89 114 | #define FRAME_stand08 90 115 | #define FRAME_stand09 91 116 | #define FRAME_stand10 92 117 | #define FRAME_stand11 93 118 | #define FRAME_stand12 94 119 | #define FRAME_stand13 95 120 | #define FRAME_stand14 96 121 | #define FRAME_stand15 97 122 | #define FRAME_stand16 98 123 | #define FRAME_stand17 99 124 | #define FRAME_stand18 100 125 | #define FRAME_stand19 101 126 | #define FRAME_stand20 102 127 | #define FRAME_stand21 103 128 | #define FRAME_stand22 104 129 | #define FRAME_stand23 105 130 | #define FRAME_stand24 106 131 | #define FRAME_stand25 107 132 | #define FRAME_stand26 108 133 | #define FRAME_stand27 109 134 | #define FRAME_stand28 110 135 | #define FRAME_stand29 111 136 | #define FRAME_stand30 112 137 | #define FRAME_stand31 113 138 | #define FRAME_stand32 114 139 | #define FRAME_stand33 115 140 | #define FRAME_stand34 116 141 | #define FRAME_stand35 117 142 | 143 | #define MODEL_SCALE 1.000000 144 | -------------------------------------------------------------------------------- /game/m_rider.h: -------------------------------------------------------------------------------- 1 | // G:\quake2\baseq2\models/monsters/boss3/rider 2 | 3 | // This file generated by ModelGen - Do NOT Modify 4 | 5 | #define FRAME_stand201 0 6 | #define FRAME_stand202 1 7 | #define FRAME_stand203 2 8 | #define FRAME_stand204 3 9 | #define FRAME_stand205 4 10 | #define FRAME_stand206 5 11 | #define FRAME_stand207 6 12 | #define FRAME_stand208 7 13 | #define FRAME_stand209 8 14 | #define FRAME_stand210 9 15 | #define FRAME_stand211 10 16 | #define FRAME_stand212 11 17 | #define FRAME_stand213 12 18 | #define FRAME_stand214 13 19 | #define FRAME_stand215 14 20 | #define FRAME_stand216 15 21 | #define FRAME_stand217 16 22 | #define FRAME_stand218 17 23 | #define FRAME_stand219 18 24 | #define FRAME_stand220 19 25 | #define FRAME_stand221 20 26 | #define FRAME_stand222 21 27 | #define FRAME_stand223 22 28 | #define FRAME_stand224 23 29 | #define FRAME_stand225 24 30 | #define FRAME_stand226 25 31 | #define FRAME_stand227 26 32 | #define FRAME_stand228 27 33 | #define FRAME_stand229 28 34 | #define FRAME_stand230 29 35 | #define FRAME_stand231 30 36 | #define FRAME_stand232 31 37 | #define FRAME_stand233 32 38 | #define FRAME_stand234 33 39 | #define FRAME_stand235 34 40 | #define FRAME_stand236 35 41 | #define FRAME_stand237 36 42 | #define FRAME_stand238 37 43 | #define FRAME_stand239 38 44 | #define FRAME_stand240 39 45 | #define FRAME_stand241 40 46 | #define FRAME_stand242 41 47 | #define FRAME_stand243 42 48 | #define FRAME_stand244 43 49 | #define FRAME_stand245 44 50 | #define FRAME_stand246 45 51 | #define FRAME_stand247 46 52 | #define FRAME_stand248 47 53 | #define FRAME_stand249 48 54 | #define FRAME_stand250 49 55 | #define FRAME_stand251 50 56 | #define FRAME_stand252 51 57 | #define FRAME_stand253 52 58 | #define FRAME_stand254 53 59 | #define FRAME_stand255 54 60 | #define FRAME_stand256 55 61 | #define FRAME_stand257 56 62 | #define FRAME_stand258 57 63 | #define FRAME_stand259 58 64 | #define FRAME_stand260 59 65 | 66 | #define MODEL_SCALE 1.000000 67 | -------------------------------------------------------------------------------- /game/p_trail.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 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 "g_local.h" 21 | 22 | 23 | /* 24 | ============================================================================== 25 | 26 | PLAYER TRAIL 27 | 28 | ============================================================================== 29 | 30 | This is a circular list containing the a list of points of where 31 | the player has been recently. It is used by monsters for pursuit. 32 | 33 | .origin the spot 34 | .owner forward link 35 | .aiment backward link 36 | */ 37 | 38 | 39 | #define TRAIL_LENGTH 8 40 | 41 | edict_t *trail[TRAIL_LENGTH]; 42 | int trail_head; 43 | qboolean trail_active = false; 44 | 45 | #define NEXT(n) (((n) + 1) & (TRAIL_LENGTH - 1)) 46 | #define PREV(n) (((n) - 1) & (TRAIL_LENGTH - 1)) 47 | 48 | 49 | void PlayerTrail_Init (void) 50 | { 51 | int n; 52 | 53 | if (deathmatch->value /* FIXME || coop */) 54 | return; 55 | 56 | for (n = 0; n < TRAIL_LENGTH; n++) 57 | { 58 | trail[n] = G_Spawn(); 59 | trail[n]->classname = "player_trail"; 60 | } 61 | 62 | trail_head = 0; 63 | trail_active = true; 64 | } 65 | 66 | 67 | void PlayerTrail_Add (vec3_t spot) 68 | { 69 | vec3_t temp; 70 | 71 | if (!trail_active) 72 | return; 73 | 74 | VectorCopy (spot, trail[trail_head]->s.origin); 75 | 76 | trail[trail_head]->timestamp = level.time; 77 | 78 | VectorSubtract (spot, trail[PREV(trail_head)]->s.origin, temp); 79 | trail[trail_head]->s.angles[1] = vectoyaw (temp); 80 | 81 | trail_head = NEXT(trail_head); 82 | } 83 | 84 | 85 | void PlayerTrail_New (vec3_t spot) 86 | { 87 | if (!trail_active) 88 | return; 89 | 90 | PlayerTrail_Init (); 91 | PlayerTrail_Add (spot); 92 | } 93 | 94 | 95 | edict_t *PlayerTrail_PickFirst (edict_t *self) 96 | { 97 | int marker; 98 | int n; 99 | 100 | if (!trail_active) 101 | return NULL; 102 | 103 | for (marker = trail_head, n = TRAIL_LENGTH; n; n--) 104 | { 105 | if(trail[marker]->timestamp <= self->monsterinfo.trail_time) 106 | marker = NEXT(marker); 107 | else 108 | break; 109 | } 110 | 111 | if (visible(self, trail[marker])) 112 | { 113 | return trail[marker]; 114 | } 115 | 116 | if (visible(self, trail[PREV(marker)])) 117 | { 118 | return trail[PREV(marker)]; 119 | } 120 | 121 | return trail[marker]; 122 | } 123 | 124 | edict_t *PlayerTrail_PickNext (edict_t *self) 125 | { 126 | int marker; 127 | int n; 128 | 129 | if (!trail_active) 130 | return NULL; 131 | 132 | for (marker = trail_head, n = TRAIL_LENGTH; n; n--) 133 | { 134 | if(trail[marker]->timestamp <= self->monsterinfo.trail_time) 135 | marker = NEXT(marker); 136 | else 137 | break; 138 | } 139 | 140 | return trail[marker]; 141 | } 142 | 143 | edict_t *PlayerTrail_LastSpot (void) 144 | { 145 | return trail[PREV(trail_head)]; 146 | } 147 | -------------------------------------------------------------------------------- /net/net_loopback.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "../qcommon/qcommon.h" 4 | 5 | /* 6 | ============================================================================= 7 | 8 | LOOPBACK BUFFERS FOR LOCAL PLAYER 9 | 10 | ============================================================================= 11 | */ 12 | 13 | 14 | 15 | #define MAX_LOOPBACK 4 16 | 17 | typedef struct 18 | { 19 | byte data[MAX_MSGLEN]; 20 | int datalen; 21 | } loopmsg_t; 22 | 23 | typedef struct 24 | { 25 | loopmsg_t msgs[MAX_LOOPBACK]; 26 | int get, send; 27 | } loopback_t; 28 | 29 | netadr_t net_local_adr; 30 | loopback_t loopbacks[2]; 31 | 32 | qboolean NET_GetLoopPacket(netsrc_t sock, netadr_t* net_from, sizebuf_t* net_message) 33 | { 34 | int i; 35 | loopback_t* loop; 36 | 37 | loop = &loopbacks[sock]; 38 | 39 | if (loop->send - loop->get > MAX_LOOPBACK) 40 | loop->get = loop->send - MAX_LOOPBACK; 41 | 42 | if (loop->get >= loop->send) 43 | return false; 44 | 45 | i = loop->get & (MAX_LOOPBACK - 1); 46 | loop->get++; 47 | 48 | memcpy(net_message->data, loop->msgs[i].data, loop->msgs[i].datalen); 49 | net_message->cursize = loop->msgs[i].datalen; 50 | *net_from = net_local_adr; 51 | return true; 52 | 53 | } 54 | 55 | 56 | void NET_SendLoopPacket(netsrc_t sock, int length, void* data, netadr_t to) 57 | { 58 | int i; 59 | loopback_t* loop; 60 | 61 | loop = &loopbacks[sock ^ 1]; 62 | 63 | i = loop->send & (MAX_LOOPBACK - 1); 64 | loop->send++; 65 | 66 | memcpy(loop->msgs[i].data, data, length); 67 | loop->msgs[i].datalen = length; 68 | } 69 | 70 | // ------------- 71 | 72 | void NET_Init(void) 73 | { 74 | memset(&net_local_adr, 0, sizeof(netadr_t)); 75 | memset(loopbacks, 0, sizeof(loopback_t)); 76 | } 77 | 78 | void NET_Shutdown(void) 79 | { 80 | 81 | } 82 | 83 | void NET_Config(qboolean multiplayer) 84 | { 85 | 86 | } 87 | 88 | qboolean NET_GetPacket(netsrc_t sock, netadr_t* net_from, sizebuf_t* net_message) 89 | { 90 | if (NET_GetLoopPacket(sock, net_from, net_message)) 91 | return true; 92 | 93 | return false; 94 | } 95 | 96 | void NET_SendPacket(netsrc_t sock, int length, void* data, netadr_t to) 97 | { 98 | if (to.type == NA_LOOPBACK) 99 | { 100 | NET_SendLoopPacket(sock, length, data, to); 101 | return; 102 | } 103 | 104 | Com_Printf("Unknown network type: %d\n", to.type); 105 | } 106 | 107 | qboolean NET_CompareAdr(netadr_t a, netadr_t b) 108 | { 109 | if (a.ip[0] == b.ip[0] && a.ip[1] == b.ip[1] && a.ip[2] == b.ip[2] && a.ip[3] == b.ip[3] && a.port == b.port) 110 | return true; 111 | return false; 112 | } 113 | 114 | qboolean NET_CompareBaseAdr(netadr_t a, netadr_t b) 115 | { 116 | if (a.type != b.type) 117 | return false; 118 | 119 | if (a.type == NA_LOOPBACK) 120 | return true; 121 | 122 | if (a.type == NA_IP) 123 | { 124 | if (a.ip[0] == b.ip[0] && a.ip[1] == b.ip[1] && a.ip[2] == b.ip[2] && a.ip[3] == b.ip[3]) 125 | return true; 126 | } 127 | 128 | return false; 129 | } 130 | 131 | qboolean NET_IsLocalAddress(netadr_t adr) 132 | { 133 | return adr.type == NA_LOOPBACK; 134 | } 135 | 136 | char* NET_AdrToString(netadr_t a) 137 | { 138 | static char s[64]; 139 | 140 | if (a.type == NA_LOOPBACK) 141 | Com_sprintf(s, sizeof(s), "loopback"); 142 | 143 | return s; 144 | } 145 | 146 | qboolean NET_StringToAdr(char* s, netadr_t* a) 147 | { 148 | if (!strcmp(s, "localhost")) 149 | { 150 | memset(a, 0, sizeof(*a)); 151 | a->type = NA_LOOPBACK; 152 | return true; 153 | } 154 | 155 | return false; 156 | } 157 | 158 | void NET_Sleep(int msec) 159 | { 160 | 161 | } 162 | -------------------------------------------------------------------------------- /null/cd_null.c: -------------------------------------------------------------------------------- 1 | #include "../client/client.h" 2 | 3 | void CDAudio_Play(int track, qboolean looping) 4 | { 5 | } 6 | 7 | 8 | void CDAudio_Stop(void) 9 | { 10 | } 11 | 12 | 13 | void CDAudio_Resume(void) 14 | { 15 | } 16 | 17 | 18 | void CDAudio_Update(void) 19 | { 20 | } 21 | 22 | 23 | int CDAudio_Init(void) 24 | { 25 | return 0; 26 | } 27 | 28 | 29 | void CDAudio_Shutdown(void) 30 | { 31 | } 32 | -------------------------------------------------------------------------------- /null/cl_null.c: -------------------------------------------------------------------------------- 1 | 2 | // cl_null.c -- this file can stub out the entire client system 3 | // for pure dedicated servers 4 | 5 | #include "../qcommon/qcommon.h" 6 | 7 | void Key_Bind_Null_f(void) 8 | { 9 | } 10 | 11 | void CL_Init (void) 12 | { 13 | } 14 | 15 | void CL_Drop (void) 16 | { 17 | } 18 | 19 | void CL_Shutdown (void) 20 | { 21 | } 22 | 23 | void CL_Frame (int msec) 24 | { 25 | } 26 | 27 | void Con_Print (char *text) 28 | { 29 | } 30 | 31 | void Cmd_ForwardToServer (void) 32 | { 33 | char *cmd; 34 | 35 | cmd = Cmd_Argv(0); 36 | Com_Printf ("Unknown command \"%s\"\n", cmd); 37 | } 38 | 39 | void SCR_DebugGraph (float value, int color) 40 | { 41 | } 42 | 43 | void SCR_BeginLoadingPlaque (void) 44 | { 45 | } 46 | 47 | void SCR_EndLoadingPlaque (void) 48 | { 49 | } 50 | 51 | void Key_Init (void) 52 | { 53 | Cmd_AddCommand ("bind", Key_Bind_Null_f); 54 | } 55 | 56 | -------------------------------------------------------------------------------- /null/glimp_null.c: -------------------------------------------------------------------------------- 1 | #include "../ref_gl/gl_local.h" 2 | 3 | void GLimp_BeginFrame( float camera_separation ) 4 | { 5 | } 6 | 7 | void GLimp_EndFrame( void ) 8 | { 9 | } 10 | 11 | int GLimp_Init( void *hinstance, void *hWnd ) 12 | { 13 | } 14 | 15 | void GLimp_Shutdown( void ) 16 | { 17 | } 18 | 19 | int GLimp_SetMode( int *pwidth, int *pheight, int mode, qboolean fullscreen ) 20 | { 21 | } 22 | 23 | void GLimp_AppActivate( qboolean active ) 24 | { 25 | } 26 | 27 | void GLimp_EnableLogging( qboolean enable ) 28 | { 29 | } 30 | 31 | void GLimp_LogNewFrame( void ) 32 | { 33 | } 34 | 35 | -------------------------------------------------------------------------------- /null/in_null.c: -------------------------------------------------------------------------------- 1 | // in_null.c -- for systems without a mouse 2 | 3 | #include "../client/client.h" 4 | 5 | void IN_Init (void) 6 | { 7 | } 8 | 9 | void IN_Shutdown (void) 10 | { 11 | } 12 | 13 | void IN_Commands (void) 14 | { 15 | } 16 | 17 | void IN_Frame (void) 18 | { 19 | } 20 | 21 | void IN_Move (usercmd_t *cmd) 22 | { 23 | } 24 | 25 | void IN_Activate (qboolean active) 26 | { 27 | } 28 | 29 | void IN_ActivateMouse (void) 30 | { 31 | } 32 | 33 | void IN_DeactivateMouse (void) 34 | { 35 | } 36 | 37 | -------------------------------------------------------------------------------- /null/swimp_null.c: -------------------------------------------------------------------------------- 1 | #include "../ref_soft/r_local.h" 2 | 3 | void SWimp_BeginFrame( float camera_separation ) 4 | { 5 | } 6 | 7 | void SWimp_EndFrame (void) 8 | { 9 | } 10 | 11 | int SWimp_Init( void *hInstance, void *wndProc ) 12 | { 13 | } 14 | 15 | void SWimp_SetPalette( const unsigned char *palette) 16 | { 17 | } 18 | 19 | void SWimp_Shutdown( void ) 20 | { 21 | } 22 | 23 | rserr_t SWimp_SetMode( int *pwidth, int *pheight, int mode, qboolean fullscreen ) 24 | { 25 | } 26 | 27 | void SWimp_AppActivate( qboolean active ) 28 | { 29 | } 30 | 31 | -------------------------------------------------------------------------------- /null/sys_null.c: -------------------------------------------------------------------------------- 1 | // sys_null.h -- null system driver to aid porting efforts 2 | 3 | #include "../qcommon/qcommon.h" 4 | #include "errno.h" 5 | 6 | int curtime; 7 | 8 | unsigned sys_frame_time; 9 | 10 | 11 | void Sys_Error (char *error, ...) 12 | { 13 | va_list argptr; 14 | 15 | printf ("Sys_Error: "); 16 | va_start (argptr,error); 17 | vprintf (error,argptr); 18 | va_end (argptr); 19 | printf ("\n"); 20 | 21 | exit (1); 22 | } 23 | 24 | void Sys_Quit (void) 25 | { 26 | exit (0); 27 | } 28 | 29 | void Sys_UnloadGame (void) 30 | { 31 | } 32 | 33 | void *Sys_GetGameAPI (void *parms) 34 | { 35 | return NULL; 36 | } 37 | 38 | char *Sys_ConsoleInput (void) 39 | { 40 | return NULL; 41 | } 42 | 43 | void Sys_ConsoleOutput (char *string) 44 | { 45 | } 46 | 47 | void Sys_SendKeyEvents (void) 48 | { 49 | } 50 | 51 | void Sys_AppActivate (void) 52 | { 53 | } 54 | 55 | void Sys_CopyProtect (void) 56 | { 57 | } 58 | 59 | char *Sys_GetClipboardData( void ) 60 | { 61 | return NULL; 62 | } 63 | 64 | void *Hunk_Begin (int maxsize) 65 | { 66 | return NULL; 67 | } 68 | 69 | void *Hunk_Alloc (int size) 70 | { 71 | return NULL; 72 | } 73 | 74 | void Hunk_Free (void *buf) 75 | { 76 | } 77 | 78 | int Hunk_End (void) 79 | { 80 | return 0; 81 | } 82 | 83 | int Sys_Milliseconds (void) 84 | { 85 | return 0; 86 | } 87 | 88 | void Sys_Mkdir (char *path) 89 | { 90 | } 91 | 92 | char *Sys_FindFirst (char *path, unsigned musthave, unsigned canthave) 93 | { 94 | return NULL; 95 | } 96 | 97 | char *Sys_FindNext (unsigned musthave, unsigned canthave) 98 | { 99 | return NULL; 100 | } 101 | 102 | void Sys_FindClose (void) 103 | { 104 | } 105 | 106 | void Sys_Init (void) 107 | { 108 | } 109 | 110 | 111 | //============================================================================= 112 | 113 | void main (int argc, char **argv) 114 | { 115 | Qcommon_Init (argc, argv); 116 | 117 | while (1) 118 | { 119 | Qcommon_Frame (0.1); 120 | } 121 | } 122 | 123 | 124 | -------------------------------------------------------------------------------- /null/vid_null.c: -------------------------------------------------------------------------------- 1 | // vid_null.c -- null video driver to aid porting efforts 2 | // this assumes that one of the refs is statically linked to the executable 3 | 4 | #include "../client/client.h" 5 | 6 | viddef_t viddef; // global video state 7 | 8 | refexport_t re; 9 | 10 | refexport_t GetRefAPI (refimport_t rimp); 11 | 12 | /* 13 | ========================================================================== 14 | 15 | DIRECT LINK GLUE 16 | 17 | ========================================================================== 18 | */ 19 | 20 | #define MAXPRINTMSG 4096 21 | void VID_Printf (int print_level, char *fmt, ...) 22 | { 23 | va_list argptr; 24 | char msg[MAXPRINTMSG]; 25 | 26 | va_start (argptr,fmt); 27 | vsprintf (msg,fmt,argptr); 28 | va_end (argptr); 29 | 30 | if (print_level == PRINT_ALL) 31 | Com_Printf ("%s", msg); 32 | else 33 | Com_DPrintf ("%s", msg); 34 | } 35 | 36 | void VID_Error (int err_level, char *fmt, ...) 37 | { 38 | va_list argptr; 39 | char msg[MAXPRINTMSG]; 40 | 41 | va_start (argptr,fmt); 42 | vsprintf (msg,fmt,argptr); 43 | va_end (argptr); 44 | 45 | Com_Error (err_level, "%s", msg); 46 | } 47 | 48 | void VID_NewWindow (int width, int height) 49 | { 50 | viddef.width = width; 51 | viddef.height = height; 52 | } 53 | 54 | /* 55 | ** VID_GetModeInfo 56 | */ 57 | typedef struct vidmode_s 58 | { 59 | const char *description; 60 | int width, height; 61 | int mode; 62 | } vidmode_t; 63 | 64 | vidmode_t vid_modes[] = 65 | { 66 | { "Mode 0: 320x240", 320, 240, 0 }, 67 | { "Mode 1: 400x300", 400, 300, 1 }, 68 | { "Mode 2: 512x384", 512, 384, 2 }, 69 | { "Mode 3: 640x480", 640, 480, 3 }, 70 | { "Mode 4: 800x600", 800, 600, 4 }, 71 | { "Mode 5: 960x720", 960, 720, 5 }, 72 | { "Mode 6: 1024x768", 1024, 768, 6 }, 73 | { "Mode 7: 1152x864", 1152, 864, 7 }, 74 | { "Mode 8: 1280x960", 1280, 960, 8 }, 75 | { "Mode 9: 1600x1200", 1600, 1200, 9 } 76 | }; 77 | #define VID_NUM_MODES ( sizeof( vid_modes ) / sizeof( vid_modes[0] ) ) 78 | 79 | qboolean VID_GetModeInfo( int *width, int *height, int mode ) 80 | { 81 | if ( mode < 0 || mode >= VID_NUM_MODES ) 82 | return false; 83 | 84 | *width = vid_modes[mode].width; 85 | *height = vid_modes[mode].height; 86 | 87 | return true; 88 | } 89 | 90 | 91 | void VID_Init (void) 92 | { 93 | refimport_t ri; 94 | 95 | viddef.width = 320; 96 | viddef.height = 240; 97 | 98 | ri.Cmd_AddCommand = Cmd_AddCommand; 99 | ri.Cmd_RemoveCommand = Cmd_RemoveCommand; 100 | ri.Cmd_Argc = Cmd_Argc; 101 | ri.Cmd_Argv = Cmd_Argv; 102 | ri.Cmd_ExecuteText = Cbuf_ExecuteText; 103 | ri.Con_Printf = VID_Printf; 104 | ri.Sys_Error = VID_Error; 105 | ri.FS_LoadFile = FS_LoadFile; 106 | ri.FS_FreeFile = FS_FreeFile; 107 | ri.FS_Gamedir = FS_Gamedir; 108 | ri.Vid_NewWindow = VID_NewWindow; 109 | ri.Cvar_Get = Cvar_Get; 110 | ri.Cvar_Set = Cvar_Set; 111 | ri.Cvar_SetValue = Cvar_SetValue; 112 | ri.Vid_GetModeInfo = VID_GetModeInfo; 113 | 114 | re = GetRefAPI(ri); 115 | 116 | if (re.api_version != API_VERSION) 117 | Com_Error (ERR_FATAL, "Re has incompatible api_version"); 118 | 119 | // call the init function 120 | if (re.Init (NULL, NULL) == -1) 121 | Com_Error (ERR_FATAL, "Couldn't start refresh"); 122 | } 123 | 124 | void VID_Shutdown (void) 125 | { 126 | if (re.Shutdown) 127 | re.Shutdown (); 128 | } 129 | 130 | void VID_CheckChanges (void) 131 | { 132 | } 133 | 134 | void VID_MenuInit (void) 135 | { 136 | } 137 | 138 | void VID_MenuDraw (void) 139 | { 140 | } 141 | 142 | const char *VID_MenuKey( int k) 143 | { 144 | return NULL; 145 | } 146 | -------------------------------------------------------------------------------- /other/glob.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include "../other/glob.h" 4 | 5 | /* Like glob_match, but match PATTERN against any final segment of TEXT. */ 6 | static int glob_match_after_star(char *pattern, char *text) 7 | { 8 | register char *p = pattern, *t = text; 9 | register char c, c1; 10 | 11 | while ((c = *p++) == '?' || c == '*') 12 | if (c == '?' && *t++ == '\0') 13 | return 0; 14 | 15 | if (c == '\0') 16 | return 1; 17 | 18 | if (c == '\\') 19 | c1 = *p; 20 | else 21 | c1 = c; 22 | 23 | while (1) { 24 | if ((c == '[' || *t == c1) && glob_match(p - 1, t)) 25 | return 1; 26 | if (*t++ == '\0') 27 | return 0; 28 | } 29 | } 30 | 31 | /* Return nonzero if PATTERN has any special globbing chars in it. */ 32 | static int glob_pattern_p(char *pattern) 33 | { 34 | register char *p = pattern; 35 | register char c; 36 | int open = 0; 37 | 38 | while ((c = *p++) != '\0') 39 | switch (c) { 40 | case '?': 41 | case '*': 42 | return 1; 43 | 44 | case '[': /* Only accept an open brace if there is a close */ 45 | open++; /* brace to match it. Bracket expressions must be */ 46 | continue; /* complete, according to Posix.2 */ 47 | case ']': 48 | if (open) 49 | return 1; 50 | continue; 51 | 52 | case '\\': 53 | if (*p++ == '\0') 54 | return 0; 55 | } 56 | 57 | return 0; 58 | } 59 | 60 | /* Match the pattern PATTERN against the string TEXT; 61 | return 1 if it matches, 0 otherwise. 62 | 63 | A match means the entire string TEXT is used up in matching. 64 | 65 | In the pattern string, `*' matches any sequence of characters, 66 | `?' matches any character, [SET] matches any character in the specified set, 67 | [!SET] matches any character not in the specified set. 68 | 69 | A set is composed of characters or ranges; a range looks like 70 | character hyphen character (as in 0-9 or A-Z). 71 | [0-9a-zA-Z_] is the set of characters allowed in C identifiers. 72 | Any other character in the pattern must be matched exactly. 73 | 74 | To suppress the special syntactic significance of any of `[]*?!-\', 75 | and match the character exactly, precede it with a `\'. 76 | */ 77 | 78 | int glob_match(char *pattern, char *text) 79 | { 80 | register char *p = pattern, *t = text; 81 | register char c; 82 | 83 | while ((c = *p++) != '\0') 84 | switch (c) { 85 | case '?': 86 | if (*t == '\0') 87 | return 0; 88 | else 89 | ++t; 90 | break; 91 | 92 | case '\\': 93 | if (*p++ != *t++) 94 | return 0; 95 | break; 96 | 97 | case '*': 98 | return glob_match_after_star(p, t); 99 | 100 | case '[': 101 | { 102 | register char c1 = *t++; 103 | int invert; 104 | 105 | if (!c1) 106 | return (0); 107 | 108 | invert = ((*p == '!') || (*p == '^')); 109 | if (invert) 110 | p++; 111 | 112 | c = *p++; 113 | while (1) { 114 | register char cstart = c, cend = c; 115 | 116 | if (c == '\\') { 117 | cstart = *p++; 118 | cend = cstart; 119 | } 120 | if (c == '\0') 121 | return 0; 122 | 123 | c = *p++; 124 | if (c == '-' && *p != ']') { 125 | cend = *p++; 126 | if (cend == '\\') 127 | cend = *p++; 128 | if (cend == '\0') 129 | return 0; 130 | c = *p++; 131 | } 132 | if (c1 >= cstart && c1 <= cend) 133 | goto match; 134 | if (c == ']') 135 | break; 136 | } 137 | if (!invert) 138 | return 0; 139 | break; 140 | 141 | match: 142 | /* Skip the rest of the [...] construct that already matched. */ 143 | while (c != ']') { 144 | if (c == '\0') 145 | return 0; 146 | c = *p++; 147 | if (c == '\0') 148 | return 0; 149 | else if (c == '\\') 150 | ++p; 151 | } 152 | if (invert) 153 | return 0; 154 | break; 155 | } 156 | 157 | default: 158 | if (c != *t++) 159 | return 0; 160 | } 161 | 162 | return *t == '\0'; 163 | } 164 | 165 | -------------------------------------------------------------------------------- /other/glob.h: -------------------------------------------------------------------------------- 1 | int glob_match(char *pattern, char *text); 2 | -------------------------------------------------------------------------------- /other/q_hunk.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "../qcommon/qcommon.h" 5 | 6 | //=============================================================================== 7 | 8 | int hunkcount; 9 | 10 | 11 | byte *membase; 12 | int hunkmaxsize; 13 | int cursize; 14 | 15 | void *Hunk_Begin (int maxsize) 16 | { 17 | // reserve a huge chunk of memory, but don't commit any yet 18 | cursize = 0; 19 | hunkmaxsize = maxsize; 20 | 21 | membase = malloc (maxsize); 22 | memset (membase, 0, maxsize); 23 | 24 | if (!membase) 25 | Sys_Error ("reserve failed"); 26 | return (void *)membase; 27 | } 28 | 29 | void *Hunk_Alloc (int size) 30 | { 31 | // round to cacheline 32 | size = (size+31)&~31; 33 | 34 | cursize += size; 35 | if (cursize > hunkmaxsize) 36 | Sys_Error ("Hunk_Alloc overflow"); 37 | 38 | return (void *)(membase+cursize-size); 39 | } 40 | 41 | int Hunk_End (void) 42 | { 43 | hunkcount++; 44 | //Com_Printf ("hunkcount: %i\n", hunkcount); 45 | return cursize; 46 | } 47 | 48 | void Hunk_Free (void *base) 49 | { 50 | if ( base ) 51 | free (base); 52 | 53 | hunkcount--; 54 | } 55 | 56 | 57 | 58 | //============================================ 59 | 60 | -------------------------------------------------------------------------------- /other/q_system.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | 10 | #include "../qcommon/qcommon.h" 11 | #include "../client/keys.h" 12 | 13 | #include "../quakegeneric.h" 14 | 15 | 16 | #define K_LAST 256 17 | static unsigned char KeyStates[K_LAST]; 18 | 19 | void ProcessKeyEvent(int key, qboolean down); 20 | 21 | struct 22 | { 23 | int key; 24 | int down; 25 | } keyq[64]; 26 | 27 | int keyq_head = 0; 28 | int keyq_tail = 0; 29 | 30 | cvar_t *nostdout = NULL; 31 | 32 | extern cvar_t *vid_fullscreen; 33 | 34 | 35 | unsigned sys_frame_time; 36 | 37 | qboolean stdin_active = false; 38 | 39 | // ======================================================================= 40 | // General routines 41 | // ======================================================================= 42 | 43 | void Sys_ConsoleOutput (char *string) 44 | { 45 | if (nostdout && nostdout->value) 46 | return; 47 | 48 | fputs(string, stdout); 49 | } 50 | 51 | void Sys_Printf (char *fmt, ...) 52 | { 53 | va_list argptr; 54 | char text[1024]; 55 | unsigned char *p; 56 | 57 | va_start (argptr,fmt); 58 | vsprintf (text,fmt,argptr); 59 | va_end (argptr); 60 | 61 | if (strlen(text) > sizeof(text)) 62 | Sys_Error("memory overwrite in Sys_Printf"); 63 | 64 | if (nostdout && nostdout->value) 65 | return; 66 | 67 | for (p = (unsigned char *)text; *p; p++) { 68 | *p &= 0x7f; 69 | if ((*p > 128 || *p < 32) && *p != 10 && *p != 13 && *p != 9) 70 | printf("[%02x]", *p); 71 | else 72 | putc(*p, stdout); 73 | } 74 | } 75 | 76 | void Sys_Quit (void) 77 | { 78 | CL_Shutdown (); 79 | Qcommon_Shutdown (); 80 | //fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~FNDELAY); 81 | _Exit(0); 82 | } 83 | 84 | void Sys_Init(void) 85 | { 86 | memset(KeyStates, 0, sizeof(KeyStates)); 87 | 88 | #if id386 89 | // Sys_SetFPCW(); 90 | #endif 91 | } 92 | 93 | void Sys_Error (char *error, ...) 94 | { 95 | va_list argptr; 96 | char string[1024]; 97 | 98 | // change stdin to non blocking 99 | //fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~FNDELAY); 100 | 101 | CL_Shutdown (); 102 | Qcommon_Shutdown (); 103 | 104 | va_start (argptr,error); 105 | vsprintf (string,error,argptr); 106 | va_end (argptr); 107 | fprintf(stderr, "Error: %s\n", string); 108 | 109 | _Exit (1); 110 | 111 | } 112 | 113 | void Sys_Warn (char *warning, ...) 114 | { 115 | va_list argptr; 116 | char string[1024]; 117 | 118 | va_start (argptr,warning); 119 | vsprintf (string,warning,argptr); 120 | va_end (argptr); 121 | fprintf(stderr, "Warning: %s", string); 122 | } 123 | 124 | 125 | char *Sys_ConsoleInput(void) 126 | { 127 | return NULL; 128 | } 129 | 130 | /*****************************************************************************/ 131 | 132 | 133 | /* 134 | ================= 135 | Sys_UnloadGame 136 | ================= 137 | */ 138 | void Sys_UnloadGame (void) 139 | { 140 | 141 | } 142 | 143 | /* 144 | ================= 145 | Sys_GetGameAPI 146 | 147 | Loads the game dll 148 | ================= 149 | */ 150 | void *Sys_GetGameAPI (void *parms) 151 | { 152 | extern void * GetGameAPI(void*); 153 | return GetGameAPI(parms); 154 | } 155 | 156 | /*****************************************************************************/ 157 | 158 | void Sys_AppActivate (void) 159 | { 160 | } 161 | 162 | void Sys_SendKeyEvents (void) 163 | { 164 | #ifndef DEDICATED_ONLY 165 | static int reenterGuard = 0; 166 | 167 | if (reenterGuard == 0) 168 | { 169 | reenterGuard = 1; 170 | 171 | //Consume key queue 172 | while (keyq_head != keyq_tail) { 173 | ProcessKeyEvent(keyq[keyq_tail].key, keyq[keyq_tail].down); 174 | keyq_tail = (keyq_tail + 1) & 63; 175 | } 176 | 177 | reenterGuard = 0; 178 | } 179 | #endif 180 | 181 | // grab frame time 182 | sys_frame_time = Sys_Milliseconds(); 183 | } 184 | 185 | /*****************************************************************************/ 186 | 187 | 188 | char *Sys_GetClipboardData(void) 189 | { 190 | return NULL; 191 | } 192 | 193 | 194 | void Sys_CopyProtect(void) 195 | { 196 | } 197 | 198 | 199 | int curtime; 200 | int Sys_Milliseconds(void) 201 | { 202 | curtime = QG_Milliseconds(); 203 | return curtime; 204 | } 205 | 206 | void Sys_Mkdir(char *path) 207 | { 208 | QG_Mkdir(path); 209 | } 210 | 211 | char * Sys_FindFirst(char *path, unsigned musthave, unsigned canhave) 212 | { 213 | return NULL; 214 | } 215 | 216 | char * Sys_FindNext(unsigned musthave, unsigned canhave) 217 | { 218 | return NULL; 219 | } 220 | 221 | void Sys_FindClose(void) 222 | { 223 | 224 | } 225 | 226 | void ProcessKeyEvent(int key, qboolean down) 227 | { 228 | if (key >= 0 && key < K_LAST) 229 | { 230 | KeyStates[key] = down ? 1 : 0; 231 | } 232 | 233 | Key_Event(key, down, Sys_Milliseconds()); 234 | 235 | if (KeyStates[K_ALT] && key == K_ENTER && down) 236 | { 237 | Cvar_SetValue("vid_fullscreen", vid_fullscreen->value ? 0 : 1); 238 | } 239 | } 240 | 241 | void Quake2_Init(int argc, char **argv) 242 | { 243 | keyq_head = 0; 244 | keyq_tail = 0; 245 | memset(keyq, 0, sizeof(keyq)); 246 | 247 | Qcommon_Init(argc, argv); 248 | 249 | nostdout = Cvar_Get("nostdout", "0", 0); 250 | } 251 | 252 | void Quake2_Frame(int msec) 253 | { 254 | Qcommon_Frame(msec); 255 | } 256 | 257 | int Quake2_Milliseconds() 258 | { 259 | return Sys_Milliseconds(); 260 | } 261 | 262 | void Quake2_SendKey(int key, int down) 263 | { 264 | keyq[keyq_head].key = key; 265 | keyq[keyq_head].down = down; 266 | keyq_head = (keyq_head + 1) & 63; 267 | } -------------------------------------------------------------------------------- /other/snd_linux.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #include "../client/client.h" 13 | #include "../client/snd_loc.h" 14 | 15 | int audio_fd; 16 | int snd_inited; 17 | 18 | cvar_t *sndbits; 19 | cvar_t *sndspeed; 20 | cvar_t *sndchannels; 21 | cvar_t *snddevice; 22 | 23 | static int tryrates[] = { 11025, 22051, 44100, 8000 }; 24 | 25 | qboolean SNDDMA_Init(void) 26 | { 27 | 28 | int rc; 29 | int fmt; 30 | int tmp; 31 | int i; 32 | char *s; 33 | struct audio_buf_info info; 34 | int caps; 35 | extern uid_t saved_euid; 36 | 37 | if (snd_inited) 38 | return; 39 | 40 | if (!snddevice) { 41 | sndbits = Cvar_Get("sndbits", "16", CVAR_ARCHIVE); 42 | sndspeed = Cvar_Get("sndspeed", "0", CVAR_ARCHIVE); 43 | sndchannels = Cvar_Get("sndchannels", "2", CVAR_ARCHIVE); 44 | snddevice = Cvar_Get("snddevice", "/dev/dsp", CVAR_ARCHIVE); 45 | } 46 | 47 | // open /dev/dsp, confirm capability to mmap, and get size of dma buffer 48 | 49 | if (!audio_fd) { 50 | //(saved_euid); 51 | 52 | audio_fd = open(snddevice->string, O_RDWR); 53 | 54 | //seteuid(getuid()); 55 | 56 | if (audio_fd < 0) 57 | { 58 | perror(snddevice->string); 59 | Com_Printf("Could not open %s\n", snddevice->string); 60 | return 0; 61 | } 62 | } 63 | 64 | rc = ioctl(audio_fd, SNDCTL_DSP_RESET, 0); 65 | if (rc < 0) 66 | { 67 | perror(snddevice->string); 68 | Com_Printf("Could not reset %s\n", snddevice->string); 69 | close(audio_fd); 70 | return 0; 71 | } 72 | 73 | if (ioctl(audio_fd, SNDCTL_DSP_GETCAPS, &caps)==-1) 74 | { 75 | perror(snddevice->string); 76 | Com_Printf("Sound driver too old\n"); 77 | close(audio_fd); 78 | return 0; 79 | } 80 | 81 | if (!(caps & DSP_CAP_TRIGGER) || !(caps & DSP_CAP_MMAP)) 82 | { 83 | Com_Printf("Sorry but your soundcard can't do this\n"); 84 | close(audio_fd); 85 | return 0; 86 | } 87 | 88 | if (ioctl(audio_fd, SNDCTL_DSP_GETOSPACE, &info)==-1) 89 | { 90 | perror("GETOSPACE"); 91 | Com_Printf("Um, can't do GETOSPACE?\n"); 92 | close(audio_fd); 93 | return 0; 94 | } 95 | 96 | // set sample bits & speed 97 | 98 | dma.samplebits = (int)sndbits->value; 99 | if (dma.samplebits != 16 && dma.samplebits != 8) 100 | { 101 | ioctl(audio_fd, SNDCTL_DSP_GETFMTS, &fmt); 102 | if (fmt & AFMT_S16_LE) dma.samplebits = 16; 103 | else if (fmt & AFMT_U8) dma.samplebits = 8; 104 | } 105 | 106 | dma.speed = (int)sndspeed->value; 107 | if (!dma.speed) { 108 | for (i=0 ; ivalue; 114 | if (dma.channels < 1 || dma.channels > 2) 115 | dma.channels = 2; 116 | 117 | dma.samples = info.fragstotal * info.fragsize / (dma.samplebits/8); 118 | dma.submission_chunk = 1; 119 | 120 | // memory map the dma buffer 121 | 122 | if (!dma.buffer) 123 | dma.buffer = (unsigned char *) mmap(NULL, info.fragstotal 124 | * info.fragsize, PROT_WRITE, MAP_FILE|MAP_SHARED, audio_fd, 0); 125 | if (!dma.buffer) 126 | { 127 | perror(snddevice->string); 128 | Com_Printf("Could not mmap %s\n", snddevice->string); 129 | close(audio_fd); 130 | return 0; 131 | } 132 | 133 | tmp = 0; 134 | if (dma.channels == 2) 135 | tmp = 1; 136 | rc = ioctl(audio_fd, SNDCTL_DSP_STEREO, &tmp); 137 | if (rc < 0) 138 | { 139 | perror(snddevice->string); 140 | Com_Printf("Could not set %s to stereo=%d", snddevice->string, dma.channels); 141 | close(audio_fd); 142 | return 0; 143 | } 144 | if (tmp) 145 | dma.channels = 2; 146 | else 147 | dma.channels = 1; 148 | 149 | rc = ioctl(audio_fd, SNDCTL_DSP_SPEED, &dma.speed); 150 | if (rc < 0) 151 | { 152 | perror(snddevice->string); 153 | Com_Printf("Could not set %s speed to %d", snddevice->string, dma.speed); 154 | close(audio_fd); 155 | return 0; 156 | } 157 | 158 | if (dma.samplebits == 16) 159 | { 160 | rc = AFMT_S16_LE; 161 | rc = ioctl(audio_fd, SNDCTL_DSP_SETFMT, &rc); 162 | if (rc < 0) 163 | { 164 | perror(snddevice->string); 165 | Com_Printf("Could not support 16-bit data. Try 8-bit.\n"); 166 | close(audio_fd); 167 | return 0; 168 | } 169 | } 170 | else if (dma.samplebits == 8) 171 | { 172 | rc = AFMT_U8; 173 | rc = ioctl(audio_fd, SNDCTL_DSP_SETFMT, &rc); 174 | if (rc < 0) 175 | { 176 | perror(snddevice->string); 177 | Com_Printf("Could not support 8-bit data.\n"); 178 | close(audio_fd); 179 | return 0; 180 | } 181 | } 182 | else 183 | { 184 | perror(snddevice->string); 185 | Com_Printf("%d-bit sound not supported.", dma.samplebits); 186 | close(audio_fd); 187 | return 0; 188 | } 189 | 190 | // toggle the trigger & start her up 191 | 192 | tmp = 0; 193 | rc = ioctl(audio_fd, SNDCTL_DSP_SETTRIGGER, &tmp); 194 | if (rc < 0) 195 | { 196 | perror(snddevice->string); 197 | Com_Printf("Could not toggle.\n"); 198 | close(audio_fd); 199 | return 0; 200 | } 201 | tmp = PCM_ENABLE_OUTPUT; 202 | rc = ioctl(audio_fd, SNDCTL_DSP_SETTRIGGER, &tmp); 203 | if (rc < 0) 204 | { 205 | perror(snddevice->string); 206 | Com_Printf("Could not toggle.\n"); 207 | close(audio_fd); 208 | return 0; 209 | } 210 | 211 | dma.samplepos = 0; 212 | 213 | snd_inited = 1; 214 | return 1; 215 | 216 | } 217 | 218 | int SNDDMA_GetDMAPos(void) 219 | { 220 | 221 | struct count_info count; 222 | 223 | if (!snd_inited) return 0; 224 | 225 | if (ioctl(audio_fd, SNDCTL_DSP_GETOPTR, &count)==-1) 226 | { 227 | perror(snddevice->string); 228 | Com_Printf("Uh, sound dead.\n"); 229 | close(audio_fd); 230 | snd_inited = 0; 231 | return 0; 232 | } 233 | // dma.samplepos = (count.bytes / (dma.samplebits / 8)) & (dma.samples-1); 234 | // fprintf(stderr, "%d \r", count.ptr); 235 | dma.samplepos = count.ptr / (dma.samplebits / 8); 236 | 237 | return dma.samplepos; 238 | 239 | } 240 | 241 | void SNDDMA_Shutdown(void) 242 | { 243 | #if 0 244 | if (snd_inited) 245 | { 246 | close(audio_fd); 247 | snd_inited = 0; 248 | } 249 | #endif 250 | } 251 | 252 | /* 253 | ============== 254 | SNDDMA_Submit 255 | 256 | Send sound to device if buffer isn't really the dma buffer 257 | =============== 258 | */ 259 | void SNDDMA_Submit(void) 260 | { 261 | } 262 | 263 | void SNDDMA_BeginPainting (void) 264 | { 265 | } 266 | 267 | -------------------------------------------------------------------------------- /port_platform_unix.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "other/glob.h" 4 | #include "game/q_shared.h" 5 | 6 | #include "quake2.h" 7 | 8 | 9 | void QG_Mkdir(const char * path) 10 | { 11 | mkdir(path, 0777); 12 | } 13 | 14 | -------------------------------------------------------------------------------- /port_platform_win.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | 6 | #include "other/glob.h" 7 | #include "game/q_shared.h" 8 | 9 | #include "quake2.h" 10 | 11 | 12 | void QG_Mkdir(const char *path) 13 | { 14 | _mkdir(path); 15 | } 16 | -------------------------------------------------------------------------------- /qcommon/crc.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 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 "qcommon.h" 23 | 24 | // this is a 16 bit, non-reflected CRC using the polynomial 0x1021 25 | // and the initial and final xor values shown below... in other words, the 26 | // CCITT standard CRC used by XMODEM 27 | 28 | #define CRC_INIT_VALUE 0xffff 29 | #define CRC_XOR_VALUE 0x0000 30 | 31 | static unsigned short crctable[256] = 32 | { 33 | 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, 34 | 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, 35 | 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, 36 | 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de, 37 | 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485, 38 | 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, 39 | 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4, 40 | 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, 41 | 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823, 42 | 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b, 43 | 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12, 44 | 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a, 45 | 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41, 46 | 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49, 47 | 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, 48 | 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, 49 | 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f, 50 | 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067, 51 | 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e, 52 | 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256, 53 | 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d, 54 | 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, 55 | 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c, 56 | 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, 57 | 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, 58 | 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3, 59 | 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, 60 | 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92, 61 | 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9, 62 | 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, 63 | 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8, 64 | 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0 65 | }; 66 | 67 | void CRC_Init(unsigned short *crcvalue) 68 | { 69 | *crcvalue = CRC_INIT_VALUE; 70 | } 71 | 72 | void CRC_ProcessByte(unsigned short *crcvalue, byte data) 73 | { 74 | *crcvalue = (*crcvalue << 8) ^ crctable[(*crcvalue >> 8) ^ data]; 75 | } 76 | 77 | unsigned short CRC_Value(unsigned short crcvalue) 78 | { 79 | return crcvalue ^ CRC_XOR_VALUE; 80 | } 81 | 82 | unsigned short CRC_Block (byte *start, int count) 83 | { 84 | unsigned short crc; 85 | 86 | CRC_Init (&crc); 87 | while (count--) 88 | crc = (crc << 8) ^ crctable[(crc >> 8) ^ *start++]; 89 | 90 | return crc; 91 | } 92 | 93 | -------------------------------------------------------------------------------- /qcommon/crc.h: -------------------------------------------------------------------------------- 1 | /* crc.h */ 2 | 3 | void CRC_Init(unsigned short *crcvalue); 4 | void CRC_ProcessByte(unsigned short *crcvalue, byte data); 5 | unsigned short CRC_Value(unsigned short crcvalue); 6 | unsigned short CRC_Block (byte *start, int count); 7 | -------------------------------------------------------------------------------- /quake2.h: -------------------------------------------------------------------------------- 1 | #ifndef QUAKE2_H 2 | #define QUAKE2_H 3 | 4 | #include "game/q_shared.h" 5 | 6 | void Quake2_Init(int argc, char **argv); 7 | void Quake2_Frame(int msec); 8 | int Quake2_Milliseconds(); 9 | void Quake2_SendKey(int key, qboolean down); 10 | 11 | #endif //QUAKE2_H -------------------------------------------------------------------------------- /quakegeneric.h: -------------------------------------------------------------------------------- 1 | #ifndef QUAKEGENERIC_H 2 | #define QUAKEGENERIC_H 3 | 4 | 5 | int QG_Milliseconds(void); 6 | void QG_GetMouseDiff(int* dx, int* dy); 7 | void QG_CaptureMouse(void); 8 | void QG_ReleaseMouse(void); 9 | 10 | void QG_Mkdir(const char* path); 11 | 12 | #endif -------------------------------------------------------------------------------- /readme.txt: -------------------------------------------------------------------------------- 1 | 2 | This is the complete source code for Quake 2, version 3.19, buildable with 3 | visual C++ 6.0. The linux version should be buildable, but we haven't 4 | tested it for the release. 5 | 6 | The code is all licensed under the terms of the GPL (gnu public license). 7 | You should read the entire license, but the gist of it is that you can do 8 | anything you want with the code, including sell your new version. The catch 9 | is that if you distribute new binary versions, you are required to make the 10 | entire source code available for free to everyone. 11 | 12 | The primary intent of this release is for entertainment and educational 13 | purposes, but the GPL does allow commercial exploitation if you obey the 14 | full license. If you want to do something commercial and you just can't bear 15 | to have your source changes released, we could still negotiate a separate 16 | license agreement (for $$$), but I would encourage you to just live with the 17 | GPL. 18 | 19 | All of the Q2 data files remain copyrighted and licensed under the 20 | original terms, so you cannot redistribute data from the original game, but if 21 | you do a true total conversion, you can create a standalone game based on 22 | this code. 23 | 24 | Thanks to Robert Duffy for doing the grunt work of building this release. 25 | 26 | John Carmack 27 | Id Software 28 | 29 | 30 | -------------------------------------------------------------------------------- /ref_gl/anorms.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | {-0.525731, 0.000000, 0.850651}, 21 | {-0.442863, 0.238856, 0.864188}, 22 | {-0.295242, 0.000000, 0.955423}, 23 | {-0.309017, 0.500000, 0.809017}, 24 | {-0.162460, 0.262866, 0.951056}, 25 | {0.000000, 0.000000, 1.000000}, 26 | {0.000000, 0.850651, 0.525731}, 27 | {-0.147621, 0.716567, 0.681718}, 28 | {0.147621, 0.716567, 0.681718}, 29 | {0.000000, 0.525731, 0.850651}, 30 | {0.309017, 0.500000, 0.809017}, 31 | {0.525731, 0.000000, 0.850651}, 32 | {0.295242, 0.000000, 0.955423}, 33 | {0.442863, 0.238856, 0.864188}, 34 | {0.162460, 0.262866, 0.951056}, 35 | {-0.681718, 0.147621, 0.716567}, 36 | {-0.809017, 0.309017, 0.500000}, 37 | {-0.587785, 0.425325, 0.688191}, 38 | {-0.850651, 0.525731, 0.000000}, 39 | {-0.864188, 0.442863, 0.238856}, 40 | {-0.716567, 0.681718, 0.147621}, 41 | {-0.688191, 0.587785, 0.425325}, 42 | {-0.500000, 0.809017, 0.309017}, 43 | {-0.238856, 0.864188, 0.442863}, 44 | {-0.425325, 0.688191, 0.587785}, 45 | {-0.716567, 0.681718, -0.147621}, 46 | {-0.500000, 0.809017, -0.309017}, 47 | {-0.525731, 0.850651, 0.000000}, 48 | {0.000000, 0.850651, -0.525731}, 49 | {-0.238856, 0.864188, -0.442863}, 50 | {0.000000, 0.955423, -0.295242}, 51 | {-0.262866, 0.951056, -0.162460}, 52 | {0.000000, 1.000000, 0.000000}, 53 | {0.000000, 0.955423, 0.295242}, 54 | {-0.262866, 0.951056, 0.162460}, 55 | {0.238856, 0.864188, 0.442863}, 56 | {0.262866, 0.951056, 0.162460}, 57 | {0.500000, 0.809017, 0.309017}, 58 | {0.238856, 0.864188, -0.442863}, 59 | {0.262866, 0.951056, -0.162460}, 60 | {0.500000, 0.809017, -0.309017}, 61 | {0.850651, 0.525731, 0.000000}, 62 | {0.716567, 0.681718, 0.147621}, 63 | {0.716567, 0.681718, -0.147621}, 64 | {0.525731, 0.850651, 0.000000}, 65 | {0.425325, 0.688191, 0.587785}, 66 | {0.864188, 0.442863, 0.238856}, 67 | {0.688191, 0.587785, 0.425325}, 68 | {0.809017, 0.309017, 0.500000}, 69 | {0.681718, 0.147621, 0.716567}, 70 | {0.587785, 0.425325, 0.688191}, 71 | {0.955423, 0.295242, 0.000000}, 72 | {1.000000, 0.000000, 0.000000}, 73 | {0.951056, 0.162460, 0.262866}, 74 | {0.850651, -0.525731, 0.000000}, 75 | {0.955423, -0.295242, 0.000000}, 76 | {0.864188, -0.442863, 0.238856}, 77 | {0.951056, -0.162460, 0.262866}, 78 | {0.809017, -0.309017, 0.500000}, 79 | {0.681718, -0.147621, 0.716567}, 80 | {0.850651, 0.000000, 0.525731}, 81 | {0.864188, 0.442863, -0.238856}, 82 | {0.809017, 0.309017, -0.500000}, 83 | {0.951056, 0.162460, -0.262866}, 84 | {0.525731, 0.000000, -0.850651}, 85 | {0.681718, 0.147621, -0.716567}, 86 | {0.681718, -0.147621, -0.716567}, 87 | {0.850651, 0.000000, -0.525731}, 88 | {0.809017, -0.309017, -0.500000}, 89 | {0.864188, -0.442863, -0.238856}, 90 | {0.951056, -0.162460, -0.262866}, 91 | {0.147621, 0.716567, -0.681718}, 92 | {0.309017, 0.500000, -0.809017}, 93 | {0.425325, 0.688191, -0.587785}, 94 | {0.442863, 0.238856, -0.864188}, 95 | {0.587785, 0.425325, -0.688191}, 96 | {0.688191, 0.587785, -0.425325}, 97 | {-0.147621, 0.716567, -0.681718}, 98 | {-0.309017, 0.500000, -0.809017}, 99 | {0.000000, 0.525731, -0.850651}, 100 | {-0.525731, 0.000000, -0.850651}, 101 | {-0.442863, 0.238856, -0.864188}, 102 | {-0.295242, 0.000000, -0.955423}, 103 | {-0.162460, 0.262866, -0.951056}, 104 | {0.000000, 0.000000, -1.000000}, 105 | {0.295242, 0.000000, -0.955423}, 106 | {0.162460, 0.262866, -0.951056}, 107 | {-0.442863, -0.238856, -0.864188}, 108 | {-0.309017, -0.500000, -0.809017}, 109 | {-0.162460, -0.262866, -0.951056}, 110 | {0.000000, -0.850651, -0.525731}, 111 | {-0.147621, -0.716567, -0.681718}, 112 | {0.147621, -0.716567, -0.681718}, 113 | {0.000000, -0.525731, -0.850651}, 114 | {0.309017, -0.500000, -0.809017}, 115 | {0.442863, -0.238856, -0.864188}, 116 | {0.162460, -0.262866, -0.951056}, 117 | {0.238856, -0.864188, -0.442863}, 118 | {0.500000, -0.809017, -0.309017}, 119 | {0.425325, -0.688191, -0.587785}, 120 | {0.716567, -0.681718, -0.147621}, 121 | {0.688191, -0.587785, -0.425325}, 122 | {0.587785, -0.425325, -0.688191}, 123 | {0.000000, -0.955423, -0.295242}, 124 | {0.000000, -1.000000, 0.000000}, 125 | {0.262866, -0.951056, -0.162460}, 126 | {0.000000, -0.850651, 0.525731}, 127 | {0.000000, -0.955423, 0.295242}, 128 | {0.238856, -0.864188, 0.442863}, 129 | {0.262866, -0.951056, 0.162460}, 130 | {0.500000, -0.809017, 0.309017}, 131 | {0.716567, -0.681718, 0.147621}, 132 | {0.525731, -0.850651, 0.000000}, 133 | {-0.238856, -0.864188, -0.442863}, 134 | {-0.500000, -0.809017, -0.309017}, 135 | {-0.262866, -0.951056, -0.162460}, 136 | {-0.850651, -0.525731, 0.000000}, 137 | {-0.716567, -0.681718, -0.147621}, 138 | {-0.716567, -0.681718, 0.147621}, 139 | {-0.525731, -0.850651, 0.000000}, 140 | {-0.500000, -0.809017, 0.309017}, 141 | {-0.238856, -0.864188, 0.442863}, 142 | {-0.262866, -0.951056, 0.162460}, 143 | {-0.864188, -0.442863, 0.238856}, 144 | {-0.809017, -0.309017, 0.500000}, 145 | {-0.688191, -0.587785, 0.425325}, 146 | {-0.681718, -0.147621, 0.716567}, 147 | {-0.442863, -0.238856, 0.864188}, 148 | {-0.587785, -0.425325, 0.688191}, 149 | {-0.309017, -0.500000, 0.809017}, 150 | {-0.147621, -0.716567, 0.681718}, 151 | {-0.425325, -0.688191, 0.587785}, 152 | {-0.162460, -0.262866, 0.951056}, 153 | {0.442863, -0.238856, 0.864188}, 154 | {0.162460, -0.262866, 0.951056}, 155 | {0.309017, -0.500000, 0.809017}, 156 | {0.147621, -0.716567, 0.681718}, 157 | {0.000000, -0.525731, 0.850651}, 158 | {0.425325, -0.688191, 0.587785}, 159 | {0.587785, -0.425325, 0.688191}, 160 | {0.688191, -0.587785, 0.425325}, 161 | {-0.955423, 0.295242, 0.000000}, 162 | {-0.951056, 0.162460, 0.262866}, 163 | {-1.000000, 0.000000, 0.000000}, 164 | {-0.850651, 0.000000, 0.525731}, 165 | {-0.955423, -0.295242, 0.000000}, 166 | {-0.951056, -0.162460, 0.262866}, 167 | {-0.864188, 0.442863, -0.238856}, 168 | {-0.951056, 0.162460, -0.262866}, 169 | {-0.809017, 0.309017, -0.500000}, 170 | {-0.864188, -0.442863, -0.238856}, 171 | {-0.951056, -0.162460, -0.262866}, 172 | {-0.809017, -0.309017, -0.500000}, 173 | {-0.681718, 0.147621, -0.716567}, 174 | {-0.681718, -0.147621, -0.716567}, 175 | {-0.850651, 0.000000, -0.525731}, 176 | {-0.688191, 0.587785, -0.425325}, 177 | {-0.587785, 0.425325, -0.688191}, 178 | {-0.425325, 0.688191, -0.587785}, 179 | {-0.425325, -0.688191, -0.587785}, 180 | {-0.587785, -0.425325, -0.688191}, 181 | {-0.688191, -0.587785, -0.425325}, 182 | -------------------------------------------------------------------------------- /ref_gl/gl_model.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 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 | 23 | d*_t structures are on-disk representations 24 | m*_t structures are in-memory 25 | 26 | */ 27 | 28 | /* 29 | ============================================================================== 30 | 31 | BRUSH MODELS 32 | 33 | ============================================================================== 34 | */ 35 | 36 | 37 | // 38 | // in memory representation 39 | // 40 | // !!! if this is changed, it must be changed in asm_draw.h too !!! 41 | typedef struct 42 | { 43 | vec3_t position; 44 | } mvertex_t; 45 | 46 | typedef struct 47 | { 48 | vec3_t mins, maxs; 49 | vec3_t origin; // for sounds or lights 50 | float radius; 51 | int headnode; 52 | int visleafs; // not including the solid leaf 0 53 | int firstface, numfaces; 54 | } mmodel_t; 55 | 56 | 57 | #define SIDE_FRONT 0 58 | #define SIDE_BACK 1 59 | #define SIDE_ON 2 60 | 61 | 62 | #define SURF_PLANEBACK 2 63 | #define SURF_DRAWSKY 4 64 | #define SURF_DRAWTURB 0x10 65 | #define SURF_DRAWBACKGROUND 0x40 66 | #define SURF_UNDERWATER 0x80 67 | 68 | // !!! if this is changed, it must be changed in asm_draw.h too !!! 69 | typedef struct 70 | { 71 | unsigned short v[2]; 72 | unsigned int cachededgeoffset; 73 | } medge_t; 74 | 75 | typedef struct mtexinfo_s 76 | { 77 | float vecs[2][4]; 78 | int flags; 79 | int numframes; 80 | struct mtexinfo_s *next; // animation chain 81 | image_t *image; 82 | } mtexinfo_t; 83 | 84 | #define VERTEXSIZE 7 85 | 86 | typedef struct glpoly_s 87 | { 88 | struct glpoly_s *next; 89 | struct glpoly_s *chain; 90 | int numverts; 91 | int flags; // for SURF_UNDERWATER (not needed anymore?) 92 | float verts[4][VERTEXSIZE]; // variable sized (xyz s1t1 s2t2) 93 | } glpoly_t; 94 | 95 | typedef struct msurface_s 96 | { 97 | int visframe; // should be drawn when node is crossed 98 | 99 | cplane_t *plane; 100 | int flags; 101 | 102 | int firstedge; // look up in model->surfedges[], negative numbers 103 | int numedges; // are backwards edges 104 | 105 | short texturemins[2]; 106 | short extents[2]; 107 | 108 | int light_s, light_t; // gl lightmap coordinates 109 | int dlight_s, dlight_t; // gl lightmap coordinates for dynamic lightmaps 110 | 111 | glpoly_t *polys; // multiple if warped 112 | struct msurface_s *texturechain; 113 | struct msurface_s *lightmapchain; 114 | 115 | mtexinfo_t *texinfo; 116 | 117 | // lighting info 118 | int dlightframe; 119 | int dlightbits; 120 | 121 | int lightmaptexturenum; 122 | byte styles[MAXLIGHTMAPS]; 123 | float cached_light[MAXLIGHTMAPS]; // values currently used in lightmap 124 | byte *samples; // [numstyles*surfsize] 125 | } msurface_t; 126 | 127 | typedef struct mnode_s 128 | { 129 | // common with leaf 130 | int contents; // -1, to differentiate from leafs 131 | int visframe; // node needs to be traversed if current 132 | 133 | float minmaxs[6]; // for bounding box culling 134 | 135 | struct mnode_s *parent; 136 | 137 | // node specific 138 | cplane_t *plane; 139 | struct mnode_s *children[2]; 140 | 141 | unsigned short firstsurface; 142 | unsigned short numsurfaces; 143 | } mnode_t; 144 | 145 | 146 | 147 | typedef struct mleaf_s 148 | { 149 | // common with node 150 | int contents; // wil be a negative contents number 151 | int visframe; // node needs to be traversed if current 152 | 153 | float minmaxs[6]; // for bounding box culling 154 | 155 | struct mnode_s *parent; 156 | 157 | // leaf specific 158 | int cluster; 159 | int area; 160 | 161 | msurface_t **firstmarksurface; 162 | int nummarksurfaces; 163 | } mleaf_t; 164 | 165 | 166 | //=================================================================== 167 | 168 | // 169 | // Whole model 170 | // 171 | 172 | typedef enum {mod_bad, mod_brush, mod_sprite, mod_alias } modtype_t; 173 | 174 | typedef struct model_s 175 | { 176 | char name[MAX_QPATH]; 177 | 178 | int registration_sequence; 179 | 180 | modtype_t type; 181 | int numframes; 182 | 183 | int flags; 184 | 185 | // 186 | // volume occupied by the model graphics 187 | // 188 | vec3_t mins, maxs; 189 | float radius; 190 | 191 | // 192 | // solid volume for clipping 193 | // 194 | qboolean clipbox; 195 | vec3_t clipmins, clipmaxs; 196 | 197 | // 198 | // brush model 199 | // 200 | int firstmodelsurface, nummodelsurfaces; 201 | int lightmap; // only for submodels 202 | 203 | int numsubmodels; 204 | mmodel_t *submodels; 205 | 206 | int numplanes; 207 | cplane_t *planes; 208 | 209 | int numleafs; // number of visible leafs, not counting 0 210 | mleaf_t *leafs; 211 | 212 | int numvertexes; 213 | mvertex_t *vertexes; 214 | 215 | int numedges; 216 | medge_t *edges; 217 | 218 | int numnodes; 219 | int firstnode; 220 | mnode_t *nodes; 221 | 222 | int numtexinfo; 223 | mtexinfo_t *texinfo; 224 | 225 | int numsurfaces; 226 | msurface_t *surfaces; 227 | 228 | int numsurfedges; 229 | int *surfedges; 230 | 231 | int nummarksurfaces; 232 | msurface_t **marksurfaces; 233 | 234 | dvis_t *vis; 235 | 236 | byte *lightdata; 237 | 238 | // for alias models and skins 239 | image_t *skins[MAX_MD2SKINS]; 240 | 241 | int extradatasize; 242 | void *extradata; 243 | } model_t; 244 | 245 | //============================================================================ 246 | 247 | void Mod_Init (void); 248 | void Mod_ClearAll (void); 249 | model_t *Mod_ForName (char *name, qboolean crash); 250 | mleaf_t *Mod_PointInLeaf (float *p, model_t *model); 251 | byte *Mod_ClusterPVS (int cluster, model_t *model); 252 | 253 | void Mod_Modellist_f (void); 254 | 255 | void *Hunk_Begin (int maxsize); 256 | void *Hunk_Alloc (int size); 257 | int Hunk_End (void); 258 | void Hunk_Free (void *base); 259 | 260 | void Mod_FreeAll (void); 261 | void Mod_Free (model_t *mod); 262 | -------------------------------------------------------------------------------- /ref_gl/gl_rmisc.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 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_misc.c 21 | 22 | #include "gl_local.h" 23 | 24 | /* 25 | ================== 26 | R_InitParticleTexture 27 | ================== 28 | */ 29 | byte dottexture[8][8] = 30 | { 31 | {0,0,0,0,0,0,0,0}, 32 | {0,0,1,1,0,0,0,0}, 33 | {0,1,1,1,1,0,0,0}, 34 | {0,1,1,1,1,0,0,0}, 35 | {0,0,1,1,0,0,0,0}, 36 | {0,0,0,0,0,0,0,0}, 37 | {0,0,0,0,0,0,0,0}, 38 | {0,0,0,0,0,0,0,0}, 39 | }; 40 | 41 | void R_InitParticleTexture (void) 42 | { 43 | int x,y; 44 | byte data[8][8][4]; 45 | 46 | // 47 | // particle texture 48 | // 49 | for (x=0 ; x<8 ; x++) 50 | { 51 | for (y=0 ; y<8 ; y++) 52 | { 53 | data[y][x][0] = 255; 54 | data[y][x][1] = 255; 55 | data[y][x][2] = 255; 56 | data[y][x][3] = dottexture[x][y]*255; 57 | } 58 | } 59 | r_particletexture = GL_LoadPic ("***particle***", (byte *)data, 8, 8, it_sprite, 32); 60 | 61 | // 62 | // also use this for bad textures, but without alpha 63 | // 64 | for (x=0 ; x<8 ; x++) 65 | { 66 | for (y=0 ; y<8 ; y++) 67 | { 68 | data[y][x][0] = dottexture[x&3][y&3]*255; 69 | data[y][x][1] = 0; // dottexture[x&3][y&3]*255; 70 | data[y][x][2] = 0; //dottexture[x&3][y&3]*255; 71 | data[y][x][3] = 255; 72 | } 73 | } 74 | r_notexture = GL_LoadPic ("***r_notexture***", (byte *)data, 8, 8, it_wall, 32); 75 | } 76 | 77 | 78 | /* 79 | ============================================================================== 80 | 81 | SCREEN SHOTS 82 | 83 | ============================================================================== 84 | */ 85 | 86 | typedef struct _TargaHeader { 87 | unsigned char id_length, colormap_type, image_type; 88 | unsigned short colormap_index, colormap_length; 89 | unsigned char colormap_size; 90 | unsigned short x_origin, y_origin, width, height; 91 | unsigned char pixel_size, attributes; 92 | } TargaHeader; 93 | 94 | 95 | /* 96 | ================== 97 | GL_ScreenShot_f 98 | ================== 99 | */ 100 | void GL_ScreenShot_f (void) 101 | { 102 | byte *buffer; 103 | char picname[80]; 104 | char checkname[MAX_OSPATH]; 105 | int i, c, temp; 106 | FILE *f; 107 | 108 | // create the scrnshots directory if it doesn't exist 109 | Com_sprintf (checkname, sizeof(checkname), "%s/scrnshot", ri.FS_Gamedir()); 110 | Sys_Mkdir (checkname); 111 | 112 | // 113 | // find a file name to save it to 114 | // 115 | strcpy(picname,"quake00.tga"); 116 | 117 | for (i=0 ; i<=99 ; i++) 118 | { 119 | picname[5] = i/10 + '0'; 120 | picname[6] = i%10 + '0'; 121 | Com_sprintf (checkname, sizeof(checkname), "%s/scrnshot/%s", ri.FS_Gamedir(), picname); 122 | f = fopen (checkname, "rb"); 123 | if (!f) 124 | break; // file doesn't exist 125 | fclose (f); 126 | } 127 | if (i==100) 128 | { 129 | ri.Con_Printf (PRINT_ALL, "SCR_ScreenShot_f: Couldn't create a file\n"); 130 | return; 131 | } 132 | 133 | 134 | buffer = malloc(vid.width*vid.height*3 + 18); 135 | memset (buffer, 0, 18); 136 | buffer[2] = 2; // uncompressed type 137 | buffer[12] = vid.width&255; 138 | buffer[13] = vid.width>>8; 139 | buffer[14] = vid.height&255; 140 | buffer[15] = vid.height>>8; 141 | buffer[16] = 24; // pixel size 142 | 143 | qglReadPixels (0, 0, vid.width, vid.height, GL_RGB, GL_UNSIGNED_BYTE, buffer+18 ); 144 | 145 | // swap rgb to bgr 146 | c = 18+vid.width*vid.height*3; 147 | for (i=18 ; istring ); 195 | GL_TextureAlphaMode( gl_texturealphamode->string ); 196 | GL_TextureSolidMode( gl_texturesolidmode->string ); 197 | 198 | qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min); 199 | qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max); 200 | 201 | qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); 202 | qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); 203 | 204 | qglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 205 | 206 | GL_TexEnv( GL_REPLACE ); 207 | 208 | if ( qglPointParameterfEXT ) 209 | { 210 | float attenuations[3]; 211 | 212 | attenuations[0] = gl_particle_att_a->value; 213 | attenuations[1] = gl_particle_att_b->value; 214 | attenuations[2] = gl_particle_att_c->value; 215 | 216 | qglEnable( GL_POINT_SMOOTH ); 217 | qglPointParameterfEXT( GL_POINT_SIZE_MIN_EXT, gl_particle_min_size->value ); 218 | qglPointParameterfEXT( GL_POINT_SIZE_MAX_EXT, gl_particle_max_size->value ); 219 | qglPointParameterfvEXT( GL_DISTANCE_ATTENUATION_EXT, attenuations ); 220 | } 221 | 222 | if ( qglColorTableEXT && gl_ext_palettedtexture->value ) 223 | { 224 | qglEnable( GL_SHARED_TEXTURE_PALETTE_EXT ); 225 | 226 | GL_SetTexturePalette( d_8to24table ); 227 | } 228 | 229 | GL_UpdateSwapInterval(); 230 | } 231 | 232 | void GL_UpdateSwapInterval( void ) 233 | { 234 | if ( gl_swapinterval->modified ) 235 | { 236 | gl_swapinterval->modified = false; 237 | 238 | if ( !gl_state.stereo_enabled ) 239 | { 240 | #ifdef _WIN32 241 | //if ( qwglSwapIntervalEXT ) 242 | // qwglSwapIntervalEXT( gl_swapinterval->value ); 243 | #endif 244 | } 245 | } 246 | } -------------------------------------------------------------------------------- /ref_gl/ref_gl.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | GetRefAPI 3 | -------------------------------------------------------------------------------- /ref_gl/ref_gl.plg: -------------------------------------------------------------------------------- 1 | --------------------Configuration: ref_gl - Win32 Release Alpha-------------------- 2 | Begining build with project "G:\quake2\code\ref_gl\ref_gl.dsp", at root. 3 | Active configuration is Win32 (ALPHA) Dynamic-Link Library (based on Win32 (ALPHA) Dynamic-Link Library) 4 | 5 | Project's tools are: 6 | "OLE Type Library Maker" with flags "/nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 " 7 | "C/C++ Compiler for Alpha" with flags "/nologo /QA21164 /MT /Gt0 /W3 /GX /Zi /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "C_ONLY" /Fp".\ReleaseAXP/ref_gl.pch" /YX /Fo".\ReleaseAXP/" /Fd".\ReleaseAXP/" /FD /QAieee1 /c " 8 | "Win32 Resource Compiler" with flags "/l 0x409 /d "NDEBUG" " 9 | "Browser Database Maker" with flags "/nologo /o"..\ReleaseAXP/ref_gl.bsc" " 10 | "COFF Linker for Alpha" with flags "kernel32.lib user32.lib gdi32.lib winmm.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"..\ReleaseAXP/ref_gl.pdb" /debug /machine:ALPHA /def:".\ref_gl.def" /out:"..\ReleaseAXP/ref_gl.dll" /implib:"..\ReleaseAXP/ref_gl.lib" " 11 | "Custom Build" with flags "" 12 | "" with flags "" 13 | 14 | 15 | 16 | 17 | ref_gl.dll - 0 error(s), 0 warning(s) 18 | -------------------------------------------------------------------------------- /ref_gl/warpsin.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 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 | -------------------------------------------------------------------------------- /ref_soft/anorms.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | {-0.525731, 0.000000, 0.850651}, 21 | {-0.442863, 0.238856, 0.864188}, 22 | {-0.295242, 0.000000, 0.955423}, 23 | {-0.309017, 0.500000, 0.809017}, 24 | {-0.162460, 0.262866, 0.951056}, 25 | {0.000000, 0.000000, 1.000000}, 26 | {0.000000, 0.850651, 0.525731}, 27 | {-0.147621, 0.716567, 0.681718}, 28 | {0.147621, 0.716567, 0.681718}, 29 | {0.000000, 0.525731, 0.850651}, 30 | {0.309017, 0.500000, 0.809017}, 31 | {0.525731, 0.000000, 0.850651}, 32 | {0.295242, 0.000000, 0.955423}, 33 | {0.442863, 0.238856, 0.864188}, 34 | {0.162460, 0.262866, 0.951056}, 35 | {-0.681718, 0.147621, 0.716567}, 36 | {-0.809017, 0.309017, 0.500000}, 37 | {-0.587785, 0.425325, 0.688191}, 38 | {-0.850651, 0.525731, 0.000000}, 39 | {-0.864188, 0.442863, 0.238856}, 40 | {-0.716567, 0.681718, 0.147621}, 41 | {-0.688191, 0.587785, 0.425325}, 42 | {-0.500000, 0.809017, 0.309017}, 43 | {-0.238856, 0.864188, 0.442863}, 44 | {-0.425325, 0.688191, 0.587785}, 45 | {-0.716567, 0.681718, -0.147621}, 46 | {-0.500000, 0.809017, -0.309017}, 47 | {-0.525731, 0.850651, 0.000000}, 48 | {0.000000, 0.850651, -0.525731}, 49 | {-0.238856, 0.864188, -0.442863}, 50 | {0.000000, 0.955423, -0.295242}, 51 | {-0.262866, 0.951056, -0.162460}, 52 | {0.000000, 1.000000, 0.000000}, 53 | {0.000000, 0.955423, 0.295242}, 54 | {-0.262866, 0.951056, 0.162460}, 55 | {0.238856, 0.864188, 0.442863}, 56 | {0.262866, 0.951056, 0.162460}, 57 | {0.500000, 0.809017, 0.309017}, 58 | {0.238856, 0.864188, -0.442863}, 59 | {0.262866, 0.951056, -0.162460}, 60 | {0.500000, 0.809017, -0.309017}, 61 | {0.850651, 0.525731, 0.000000}, 62 | {0.716567, 0.681718, 0.147621}, 63 | {0.716567, 0.681718, -0.147621}, 64 | {0.525731, 0.850651, 0.000000}, 65 | {0.425325, 0.688191, 0.587785}, 66 | {0.864188, 0.442863, 0.238856}, 67 | {0.688191, 0.587785, 0.425325}, 68 | {0.809017, 0.309017, 0.500000}, 69 | {0.681718, 0.147621, 0.716567}, 70 | {0.587785, 0.425325, 0.688191}, 71 | {0.955423, 0.295242, 0.000000}, 72 | {1.000000, 0.000000, 0.000000}, 73 | {0.951056, 0.162460, 0.262866}, 74 | {0.850651, -0.525731, 0.000000}, 75 | {0.955423, -0.295242, 0.000000}, 76 | {0.864188, -0.442863, 0.238856}, 77 | {0.951056, -0.162460, 0.262866}, 78 | {0.809017, -0.309017, 0.500000}, 79 | {0.681718, -0.147621, 0.716567}, 80 | {0.850651, 0.000000, 0.525731}, 81 | {0.864188, 0.442863, -0.238856}, 82 | {0.809017, 0.309017, -0.500000}, 83 | {0.951056, 0.162460, -0.262866}, 84 | {0.525731, 0.000000, -0.850651}, 85 | {0.681718, 0.147621, -0.716567}, 86 | {0.681718, -0.147621, -0.716567}, 87 | {0.850651, 0.000000, -0.525731}, 88 | {0.809017, -0.309017, -0.500000}, 89 | {0.864188, -0.442863, -0.238856}, 90 | {0.951056, -0.162460, -0.262866}, 91 | {0.147621, 0.716567, -0.681718}, 92 | {0.309017, 0.500000, -0.809017}, 93 | {0.425325, 0.688191, -0.587785}, 94 | {0.442863, 0.238856, -0.864188}, 95 | {0.587785, 0.425325, -0.688191}, 96 | {0.688191, 0.587785, -0.425325}, 97 | {-0.147621, 0.716567, -0.681718}, 98 | {-0.309017, 0.500000, -0.809017}, 99 | {0.000000, 0.525731, -0.850651}, 100 | {-0.525731, 0.000000, -0.850651}, 101 | {-0.442863, 0.238856, -0.864188}, 102 | {-0.295242, 0.000000, -0.955423}, 103 | {-0.162460, 0.262866, -0.951056}, 104 | {0.000000, 0.000000, -1.000000}, 105 | {0.295242, 0.000000, -0.955423}, 106 | {0.162460, 0.262866, -0.951056}, 107 | {-0.442863, -0.238856, -0.864188}, 108 | {-0.309017, -0.500000, -0.809017}, 109 | {-0.162460, -0.262866, -0.951056}, 110 | {0.000000, -0.850651, -0.525731}, 111 | {-0.147621, -0.716567, -0.681718}, 112 | {0.147621, -0.716567, -0.681718}, 113 | {0.000000, -0.525731, -0.850651}, 114 | {0.309017, -0.500000, -0.809017}, 115 | {0.442863, -0.238856, -0.864188}, 116 | {0.162460, -0.262866, -0.951056}, 117 | {0.238856, -0.864188, -0.442863}, 118 | {0.500000, -0.809017, -0.309017}, 119 | {0.425325, -0.688191, -0.587785}, 120 | {0.716567, -0.681718, -0.147621}, 121 | {0.688191, -0.587785, -0.425325}, 122 | {0.587785, -0.425325, -0.688191}, 123 | {0.000000, -0.955423, -0.295242}, 124 | {0.000000, -1.000000, 0.000000}, 125 | {0.262866, -0.951056, -0.162460}, 126 | {0.000000, -0.850651, 0.525731}, 127 | {0.000000, -0.955423, 0.295242}, 128 | {0.238856, -0.864188, 0.442863}, 129 | {0.262866, -0.951056, 0.162460}, 130 | {0.500000, -0.809017, 0.309017}, 131 | {0.716567, -0.681718, 0.147621}, 132 | {0.525731, -0.850651, 0.000000}, 133 | {-0.238856, -0.864188, -0.442863}, 134 | {-0.500000, -0.809017, -0.309017}, 135 | {-0.262866, -0.951056, -0.162460}, 136 | {-0.850651, -0.525731, 0.000000}, 137 | {-0.716567, -0.681718, -0.147621}, 138 | {-0.716567, -0.681718, 0.147621}, 139 | {-0.525731, -0.850651, 0.000000}, 140 | {-0.500000, -0.809017, 0.309017}, 141 | {-0.238856, -0.864188, 0.442863}, 142 | {-0.262866, -0.951056, 0.162460}, 143 | {-0.864188, -0.442863, 0.238856}, 144 | {-0.809017, -0.309017, 0.500000}, 145 | {-0.688191, -0.587785, 0.425325}, 146 | {-0.681718, -0.147621, 0.716567}, 147 | {-0.442863, -0.238856, 0.864188}, 148 | {-0.587785, -0.425325, 0.688191}, 149 | {-0.309017, -0.500000, 0.809017}, 150 | {-0.147621, -0.716567, 0.681718}, 151 | {-0.425325, -0.688191, 0.587785}, 152 | {-0.162460, -0.262866, 0.951056}, 153 | {0.442863, -0.238856, 0.864188}, 154 | {0.162460, -0.262866, 0.951056}, 155 | {0.309017, -0.500000, 0.809017}, 156 | {0.147621, -0.716567, 0.681718}, 157 | {0.000000, -0.525731, 0.850651}, 158 | {0.425325, -0.688191, 0.587785}, 159 | {0.587785, -0.425325, 0.688191}, 160 | {0.688191, -0.587785, 0.425325}, 161 | {-0.955423, 0.295242, 0.000000}, 162 | {-0.951056, 0.162460, 0.262866}, 163 | {-1.000000, 0.000000, 0.000000}, 164 | {-0.850651, 0.000000, 0.525731}, 165 | {-0.955423, -0.295242, 0.000000}, 166 | {-0.951056, -0.162460, 0.262866}, 167 | {-0.864188, 0.442863, -0.238856}, 168 | {-0.951056, 0.162460, -0.262866}, 169 | {-0.809017, 0.309017, -0.500000}, 170 | {-0.864188, -0.442863, -0.238856}, 171 | {-0.951056, -0.162460, -0.262866}, 172 | {-0.809017, -0.309017, -0.500000}, 173 | {-0.681718, 0.147621, -0.716567}, 174 | {-0.681718, -0.147621, -0.716567}, 175 | {-0.850651, 0.000000, -0.525731}, 176 | {-0.688191, 0.587785, -0.425325}, 177 | {-0.587785, 0.425325, -0.688191}, 178 | {-0.425325, 0.688191, -0.587785}, 179 | {-0.425325, -0.688191, -0.587785}, 180 | {-0.587785, -0.425325, -0.688191}, 181 | {-0.688191, -0.587785, -0.425325}, 182 | -------------------------------------------------------------------------------- /ref_soft/r_model.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 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 __MODEL__ 22 | #define __MODEL__ 23 | 24 | /* 25 | 26 | d*_t structures are on-disk representations 27 | m*_t structures are in-memory 28 | 29 | */ 30 | 31 | 32 | /* 33 | ============================================================================== 34 | 35 | BRUSH MODELS 36 | 37 | ============================================================================== 38 | */ 39 | 40 | 41 | // 42 | // in memory representation 43 | // 44 | // !!! if this is changed, it must be changed in asm_draw.h too !!! 45 | typedef struct 46 | { 47 | vec3_t position; 48 | } mvertex_t; 49 | 50 | #define SIDE_FRONT 0 51 | #define SIDE_BACK 1 52 | #define SIDE_ON 2 53 | 54 | 55 | // plane_t structure 56 | // !!! if this is changed, it must be changed in asm_i386.h too !!! 57 | typedef struct mplane_s 58 | { 59 | vec3_t normal; 60 | float dist; 61 | byte type; // for texture axis selection and fast side tests 62 | byte signbits; // signx + signy<<1 + signz<<1 63 | byte pad[2]; 64 | } mplane_t; 65 | 66 | 67 | // FIXME: differentiate from texinfo SURF_ flags 68 | #define SURF_PLANEBACK 2 69 | #define SURF_DRAWSKY 4 // sky brush face 70 | #define SURF_DRAWTURB 0x10 71 | #define SURF_DRAWBACKGROUND 0x40 72 | #define SURF_DRAWSKYBOX 0x80 // sky box 73 | 74 | #define SURF_FLOW 0x100 //PGM 75 | 76 | // !!! if this is changed, it must be changed in asm_draw.h too !!! 77 | typedef struct 78 | { 79 | unsigned short v[2]; 80 | unsigned int cachededgeoffset; 81 | } medge_t; 82 | 83 | typedef struct mtexinfo_s 84 | { 85 | float vecs[2][4]; 86 | float mipadjust; 87 | image_t *image; 88 | int flags; 89 | int numframes; 90 | struct mtexinfo_s *next; // animation chain 91 | } mtexinfo_t; 92 | 93 | typedef struct msurface_s 94 | { 95 | int visframe; // should be drawn when node is crossed 96 | 97 | int dlightframe; 98 | int dlightbits; 99 | 100 | mplane_t *plane; 101 | int flags; 102 | 103 | int firstedge; // look up in model->surfedges[], negative numbers 104 | int numedges; // are backwards edges 105 | 106 | // surface generation data 107 | struct surfcache_s *cachespots[MIPLEVELS]; 108 | 109 | short texturemins[2]; 110 | short extents[2]; 111 | 112 | mtexinfo_t *texinfo; 113 | 114 | // lighting info 115 | byte styles[MAXLIGHTMAPS]; 116 | byte *samples; // [numstyles*surfsize] 117 | 118 | struct msurface_s *nextalphasurface; 119 | } msurface_t; 120 | 121 | 122 | #define CONTENTS_NODE -1 123 | typedef struct mnode_s 124 | { 125 | // common with leaf 126 | int contents; // CONTENTS_NODE, to differentiate from leafs 127 | int visframe; // node needs to be traversed if current 128 | 129 | short minmaxs[6]; // for bounding box culling 130 | 131 | struct mnode_s *parent; 132 | 133 | // node specific 134 | mplane_t *plane; 135 | struct mnode_s *children[2]; 136 | 137 | unsigned short firstsurface; 138 | unsigned short numsurfaces; 139 | } mnode_t; 140 | 141 | 142 | 143 | typedef struct mleaf_s 144 | { 145 | // common with node 146 | int contents; // wil be something other than CONTENTS_NODE 147 | int visframe; // node needs to be traversed if current 148 | 149 | short minmaxs[6]; // for bounding box culling 150 | 151 | struct mnode_s *parent; 152 | 153 | // leaf specific 154 | int cluster; 155 | int area; 156 | 157 | msurface_t **firstmarksurface; 158 | int nummarksurfaces; 159 | int key; // BSP sequence number for leaf's contents 160 | } mleaf_t; 161 | 162 | 163 | //=================================================================== 164 | 165 | // 166 | // Whole model 167 | // 168 | 169 | typedef enum {mod_bad, mod_brush, mod_sprite, mod_alias } modtype_t; 170 | 171 | typedef struct model_s 172 | { 173 | char name[MAX_QPATH]; 174 | 175 | int registration_sequence; 176 | 177 | modtype_t type; 178 | int numframes; 179 | 180 | int flags; 181 | 182 | // 183 | // volume occupied by the model graphics 184 | // 185 | vec3_t mins, maxs; 186 | 187 | // 188 | // solid volume for clipping (sent from server) 189 | // 190 | qboolean clipbox; 191 | vec3_t clipmins, clipmaxs; 192 | 193 | // 194 | // brush model 195 | // 196 | int firstmodelsurface, nummodelsurfaces; 197 | 198 | int numsubmodels; 199 | dmodel_t *submodels; 200 | 201 | int numplanes; 202 | mplane_t *planes; 203 | 204 | int numleafs; // number of visible leafs, not counting 0 205 | mleaf_t *leafs; 206 | 207 | int numvertexes; 208 | mvertex_t *vertexes; 209 | 210 | int numedges; 211 | medge_t *edges; 212 | 213 | int numnodes; 214 | int firstnode; 215 | mnode_t *nodes; 216 | 217 | int numtexinfo; 218 | mtexinfo_t *texinfo; 219 | 220 | int numsurfaces; 221 | msurface_t *surfaces; 222 | 223 | int numsurfedges; 224 | int *surfedges; 225 | 226 | int nummarksurfaces; 227 | msurface_t **marksurfaces; 228 | 229 | dvis_t *vis; 230 | 231 | byte *lightdata; 232 | 233 | // for alias models and sprites 234 | image_t *skins[MAX_MD2SKINS]; 235 | void *extradata; 236 | int extradatasize; 237 | } model_t; 238 | 239 | //============================================================================ 240 | 241 | void Mod_Init (void); 242 | void Mod_ClearAll (void); 243 | model_t *Mod_ForName (char *name, qboolean crash); 244 | void *Mod_Extradata (model_t *mod); // handles caching 245 | void Mod_TouchModel (char *name); 246 | 247 | mleaf_t *Mod_PointInLeaf (float *p, model_t *model); 248 | byte *Mod_ClusterPVS (int cluster, model_t *model); 249 | 250 | void Mod_Modellist_f (void); 251 | void Mod_FreeAll (void); 252 | void Mod_Free (model_t *mod); 253 | 254 | extern int registration_sequence; 255 | 256 | #endif // __MODEL__ 257 | -------------------------------------------------------------------------------- /ref_soft/r_sprite.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 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_sprite.c 21 | #include "r_local.h" 22 | 23 | extern polydesc_t r_polydesc; 24 | 25 | void R_BuildPolygonFromSurface(msurface_t *fa); 26 | void R_PolygonCalculateGradients (void); 27 | 28 | extern void R_PolyChooseSpanletRoutine( float alpha, qboolean isturbulent ); 29 | 30 | extern vec5_t r_clip_verts[2][MAXWORKINGVERTS+2]; 31 | 32 | extern void R_ClipAndDrawPoly( float alpha, qboolean isturbulent, qboolean textured ); 33 | 34 | /* 35 | ** R_DrawSprite 36 | ** 37 | ** Draw currententity / currentmodel as a single texture 38 | ** mapped polygon 39 | */ 40 | void R_DrawSprite (void) 41 | { 42 | vec5_t *pverts; 43 | vec3_t left, up, right, down; 44 | dsprite_t *s_psprite; 45 | dsprframe_t *s_psprframe; 46 | 47 | 48 | s_psprite = (dsprite_t *)currentmodel->extradata; 49 | #if 0 50 | if (currententity->frame >= s_psprite->numframes 51 | || currententity->frame < 0) 52 | { 53 | ri.Con_Printf (PRINT_ALL, "No such sprite frame %i\n", 54 | currententity->frame); 55 | currententity->frame = 0; 56 | } 57 | #endif 58 | currententity->frame %= s_psprite->numframes; 59 | 60 | s_psprframe = &s_psprite->frames[currententity->frame]; 61 | 62 | r_polydesc.pixels = currentmodel->skins[currententity->frame]->pixels[0]; 63 | r_polydesc.pixel_width = s_psprframe->width; 64 | r_polydesc.pixel_height = s_psprframe->height; 65 | r_polydesc.dist = 0; 66 | 67 | // generate the sprite's axes, completely parallel to the viewplane. 68 | VectorCopy (vup, r_polydesc.vup); 69 | VectorCopy (vright, r_polydesc.vright); 70 | VectorCopy (vpn, r_polydesc.vpn); 71 | 72 | // build the sprite poster in worldspace 73 | VectorScale (r_polydesc.vright, 74 | s_psprframe->width - s_psprframe->origin_x, right); 75 | VectorScale (r_polydesc.vup, 76 | s_psprframe->height - s_psprframe->origin_y, up); 77 | VectorScale (r_polydesc.vright, 78 | -s_psprframe->origin_x, left); 79 | VectorScale (r_polydesc.vup, 80 | -s_psprframe->origin_y, down); 81 | 82 | // invert UP vector for sprites 83 | VectorInverse( r_polydesc.vup ); 84 | 85 | pverts = r_clip_verts[0]; 86 | 87 | pverts[0][0] = r_entorigin[0] + up[0] + left[0]; 88 | pverts[0][1] = r_entorigin[1] + up[1] + left[1]; 89 | pverts[0][2] = r_entorigin[2] + up[2] + left[2]; 90 | pverts[0][3] = 0; 91 | pverts[0][4] = 0; 92 | 93 | pverts[1][0] = r_entorigin[0] + up[0] + right[0]; 94 | pverts[1][1] = r_entorigin[1] + up[1] + right[1]; 95 | pverts[1][2] = r_entorigin[2] + up[2] + right[2]; 96 | pverts[1][3] = s_psprframe->width; 97 | pverts[1][4] = 0; 98 | 99 | pverts[2][0] = r_entorigin[0] + down[0] + right[0]; 100 | pverts[2][1] = r_entorigin[1] + down[1] + right[1]; 101 | pverts[2][2] = r_entorigin[2] + down[2] + right[2]; 102 | pverts[2][3] = s_psprframe->width; 103 | pverts[2][4] = s_psprframe->height; 104 | 105 | pverts[3][0] = r_entorigin[0] + down[0] + left[0]; 106 | pverts[3][1] = r_entorigin[1] + down[1] + left[1]; 107 | pverts[3][2] = r_entorigin[2] + down[2] + left[2]; 108 | pverts[3][3] = 0; 109 | pverts[3][4] = s_psprframe->height; 110 | 111 | r_polydesc.nump = 4; 112 | r_polydesc.s_offset = ( r_polydesc.pixel_width >> 1); 113 | r_polydesc.t_offset = ( r_polydesc.pixel_height >> 1); 114 | VectorCopy( modelorg, r_polydesc.viewer_position ); 115 | 116 | r_polydesc.stipple_parity = 1; 117 | if ( currententity->flags & RF_TRANSLUCENT ) 118 | R_ClipAndDrawPoly ( currententity->alpha, false, true ); 119 | else 120 | R_ClipAndDrawPoly ( 1.0F, false, true ); 121 | r_polydesc.stipple_parity = 0; 122 | } 123 | 124 | -------------------------------------------------------------------------------- /ref_soft/rand1k.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 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 | // 1K random numbers in the range 0-255 21 | 0, 144, 49, 207, 149, 122, 89, 229, 210, 191, 22 | 44, 219, 181, 131, 77, 3, 23, 93, 37, 42, 23 | 253, 114, 30, 1, 2, 96, 136, 146, 154, 155, 24 | 42, 169, 115, 90, 14, 155, 200, 205, 133, 77, 25 | 224, 186, 244, 236, 138, 36, 118, 60, 220, 53, 26 | 199, 215, 255, 255, 156, 100, 68, 76, 215, 6, 27 | 96, 23, 173, 14, 2, 235, 70, 69, 150, 176, 28 | 214, 185, 124, 52, 190, 119, 117, 242, 190, 27, 29 | 153, 98, 188, 155, 146, 92, 38, 57, 108, 205, 30 | 132, 253, 192, 88, 43, 168, 125, 16, 179, 129, 31 | 37, 243, 36, 231, 177, 77, 109, 18, 247, 174, 32 | 39, 224, 210, 149, 48, 45, 209, 121, 39, 129, 33 | 187, 103, 71, 145, 174, 193, 184, 121, 31, 94, 34 | 213, 8, 132, 169, 109, 26, 243, 235, 140, 88, 35 | 120, 95, 216, 81, 116, 69, 251, 76, 189, 145, 36 | 50, 194, 214, 101, 128, 227, 7, 254, 146, 12, 37 | 136, 49, 215, 160, 168, 50, 215, 31, 28, 190, 38 | 80, 240, 73, 86, 35, 187, 213, 181, 153, 191, 39 | 64, 36, 0, 15, 206, 218, 53, 29, 141, 3, 40 | 29, 116, 192, 175, 139, 18, 111, 51, 178, 74, 41 | 111, 59, 147, 136, 160, 41, 129, 246, 178, 236, 42 | 48, 86, 45, 254, 117, 255, 24, 160, 24, 112, 43 | 238, 12, 229, 74, 58, 196, 105, 51, 160, 154, 44 | 115, 119, 153, 162, 218, 212, 159, 184, 144, 96, 45 | 47, 188, 142, 231, 62, 48, 154, 178, 149, 89, 46 | 126, 20, 189, 156, 158, 176, 205, 38, 147, 222, 47 | 233, 157, 186, 11, 170, 249, 80, 145, 78, 44, 48 | 27, 222, 217, 190, 39, 83, 20, 19, 164, 209, 49 | 139, 114, 104, 76, 119, 128, 39, 82, 188, 80, 50 | 211, 245, 223, 185, 76, 241, 32, 16, 200, 134, 51 | 156, 244, 18, 224, 167, 82, 26, 129, 58, 74, 52 | 235, 141, 169, 29, 126, 97, 127, 203, 130, 97, 53 | 176, 136, 155, 101, 1, 181, 25, 159, 220, 125, 54 | 191, 127, 97, 201, 141, 91, 244, 161, 45, 95, 55 | 33, 190, 243, 156, 7, 84, 14, 163, 33, 216, 56 | 221, 152, 184, 218, 3, 32, 181, 157, 55, 16, 57 | 43, 159, 87, 81, 94, 169, 205, 206, 134, 156, 58 | 204, 230, 37, 161, 103, 64, 34, 218, 16, 109, 59 | 146, 77, 140, 57, 79, 28, 206, 34, 72, 201, 60 | 229, 202, 190, 157, 92, 219, 58, 221, 58, 63, 61 | 138, 252, 13, 20, 134, 109, 24, 66, 228, 59, 62 | 37, 32, 238, 20, 12, 15, 86, 234, 102, 110, 63 | 242, 214, 136, 215, 177, 101, 66, 1, 134, 244, 64 | 102, 61, 149, 65, 175, 241, 111, 227, 1, 240, 65 | 153, 201, 147, 36, 56, 98, 1, 106, 21, 168, 66 | 218, 16, 207, 169, 177, 205, 135, 175, 36, 176, 67 | 186, 199, 7, 222, 164, 180, 21, 141, 242, 15, 68 | 70, 37, 251, 158, 74, 236, 94, 177, 55, 39, 69 | 61, 133, 230, 27, 231, 113, 20, 200, 43, 249, 70 | 198, 222, 53, 116, 0, 192, 29, 103, 79, 254, 71 | 9, 64, 48, 63, 39, 158, 226, 240, 50, 199, 72 | 165, 168, 232, 116, 235, 170, 38, 162, 145, 108, 73 | 241, 138, 148, 137, 65, 101, 89, 9, 203, 50, 74 | 17, 99, 151, 18, 50, 39, 164, 116, 154, 178, 75 | 112, 175, 101, 213, 151, 51, 243, 224, 100, 252, 76 | 47, 229, 147, 113, 160, 181, 12, 73, 66, 104, 77 | 229, 181, 186, 229, 100, 101, 231, 79, 99, 146, 78 | 90, 187, 190, 188, 189, 35, 51, 69, 174, 233, 79 | 94, 132, 28, 232, 51, 132, 167, 112, 176, 23, 80 | 20, 19, 7, 90, 78, 178, 36, 101, 17, 172, 81 | 185, 50, 177, 157, 167, 139, 25, 139, 12, 249, 82 | 118, 248, 186, 135, 174, 177, 95, 99, 12, 207, 83 | 43, 15, 79, 200, 54, 82, 124, 2, 112, 130, 84 | 155, 194, 102, 89, 215, 241, 159, 255, 13, 144, 85 | 221, 99, 78, 72, 6, 156, 100, 4, 7, 116, 86 | 219, 239, 102, 186, 156, 206, 224, 149, 152, 20, 87 | 203, 118, 151, 150, 145, 208, 172, 87, 2, 68, 88 | 87, 59, 197, 95, 222, 29, 185, 161, 228, 46, 89 | 137, 230, 199, 247, 50, 230, 204, 244, 217, 227, 90 | 160, 47, 157, 67, 64, 187, 201, 43, 182, 123, 91 | 20, 206, 218, 31, 78, 146, 121, 195, 49, 186, 92 | 254, 3, 165, 177, 44, 18, 70, 173, 214, 142, 93 | 95, 199, 59, 163, 59, 52, 248, 72, 5, 196, 94 | 38, 12, 2, 89, 164, 87, 106, 106, 23, 139, 95 | 179, 86, 168, 224, 137, 145, 13, 119, 66, 109, 96 | 221, 124, 22, 144, 181, 199, 221, 217, 75, 221, 97 | 165, 191, 212, 195, 223, 232, 233, 133, 112, 27, 98 | 90, 210, 109, 43, 0, 168, 198, 16, 22, 98, 99 | 175, 206, 39, 36, 12, 88, 4, 250, 165, 13, 100 | 234, 163, 110, 5, 62, 100, 167, 200, 5, 211, 101 | 35, 162, 140, 251, 118, 54, 76, 200, 87, 123, 102 | 155, 26, 252, 193, 38, 116, 182, 255, 198, 164, 103 | 159, 242, 176, 74, 145, 74, 140, 182, 63, 139, 104 | 126, 243, 171, 195, 159, 114, 204, 190, 253, 52, 105 | 161, 232, 151, 235, 129, 125, 115, 227, 240, 46, 106 | 64, 51, 187, 240, 160, 10, 164, 8, 142, 139, 107 | 114, 15, 254, 32, 153, 12, 44, 169, 85, 80, 108 | 167, 105, 109, 56, 173, 42, 127, 129, 205, 111, 109 | 1, 86, 96, 32, 211, 187, 228, 164, 166, 131, 110 | 187, 188, 245, 119, 92, 28, 231, 210, 116, 27, 111 | 222, 194, 10, 106, 239, 17, 42, 54, 29, 151, 112 | 30, 158, 148, 176, 187, 234, 171, 76, 207, 96, 113 | 255, 197, 52, 43, 99, 46, 148, 50, 245, 48, 114 | 97, 77, 30, 50, 11, 197, 194, 225, 0, 114, 115 | 109, 205, 118, 126, 191, 61, 143, 23, 236, 228, 116 | 219, 15, 125, 161, 191, 193, 65, 232, 202, 51, 117 | 141, 13, 133, 202, 180, 6, 187, 141, 234, 224, 118 | 204, 78, 101, 123, 13, 166, 0, 196, 193, 56, 119 | 39, 14, 171, 8, 88, 178, 204, 111, 251, 162, 120 | 75, 122, 223, 20, 25, 36, 36, 235, 79, 95, 121 | 208, 11, 208, 61, 229, 65, 68, 53, 58, 216, 122 | 223, 227, 216, 155, 10, 44, 47, 91, 115, 47, 123 | 228, 159, 139, 233 124 | -------------------------------------------------------------------------------- /ref_soft/ref_soft.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | GetRefAPI 3 | -------------------------------------------------------------------------------- /ref_soft/ref_soft.plg: -------------------------------------------------------------------------------- 1 | --------------------Configuration: ref_soft - Win32 Release Alpha-------------------- 2 | Begining build with project "G:\quake2\code\ref_soft\ref_soft.dsp", at root. 3 | Active configuration is Win32 (ALPHA) Dynamic-Link Library (based on Win32 (ALPHA) Dynamic-Link Library) 4 | 5 | Project's tools are: 6 | "OLE Type Library Maker" with flags "/nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 " 7 | "C/C++ Compiler for Alpha" with flags "/nologo /QA21164 /MT /Gt0 /W3 /GX /Zi /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "C_ONLY" /Fp".\ReleaseAXP/ref_soft.pch" /YX /Fo".\ReleaseAXP/" /Fd".\ReleaseAXP/" /FD /QAieee1 /c " 8 | "Win32 Resource Compiler" with flags "/l 0x409 /d "NDEBUG" " 9 | "Browser Database Maker" with flags "/nologo /o"..\ReleaseAXP/ref_soft.bsc" " 10 | "COFF Linker for Alpha" with flags "kernel32.lib user32.lib gdi32.lib winmm.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"..\ReleaseAXP/ref_soft.pdb" /debug /machine:ALPHA /def:".\ref_soft.def" /out:"..\ReleaseAXP/ref_soft.dll" /implib:"..\ReleaseAXP/ref_soft.lib" " 11 | "Custom Build" with flags "" 12 | "" with flags "" 13 | 14 | 15 | 16 | 17 | ref_soft.dll - 0 error(s), 0 warning(s) 18 | -------------------------------------------------------------------------------- /screenshots/gl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozkl/quake2generic/8fcad56e8f8a1eb167dd1b6563e7732c89da32ee/screenshots/gl.png -------------------------------------------------------------------------------- /screenshots/gl2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozkl/quake2generic/8fcad56e8f8a1eb167dd1b6563e7732c89da32ee/screenshots/gl2.png -------------------------------------------------------------------------------- /screenshots/soft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozkl/quake2generic/8fcad56e8f8a1eb167dd1b6563e7732c89da32ee/screenshots/soft.png -------------------------------------------------------------------------------- /server/sv_null.c: -------------------------------------------------------------------------------- 1 | // sv_null.c -- this file can stub out the entire server system 2 | // for pure net-only clients 3 | 4 | void SV_Init (void) 5 | { 6 | } 7 | 8 | void SV_Shutdown (char *finalmsg, qboolean reconnect) 9 | { 10 | } 11 | 12 | void SV_Frame (float time) 13 | { 14 | } 15 | 16 | -------------------------------------------------------------------------------- /sound/snd_sdl.c: -------------------------------------------------------------------------------- 1 | /* 2 | snd_sdl.c 3 | 4 | Sound code taken from SDLQuake and modified to work with Quake2 5 | Robert B�uml 2001-12-25 6 | 7 | This program is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to: 20 | 21 | Free Software Foundation, Inc. 22 | 59 Temple Place - Suite 330 23 | Boston, MA 02111-1307, USA 24 | 25 | $Id$ 26 | */ 27 | 28 | #include 29 | 30 | #include "../client/client.h" 31 | #include "../client/snd_loc.h" 32 | 33 | static int snd_inited = 0; 34 | static dma_t *shm; 35 | 36 | static void 37 | paint_audio (void *unused, Uint8 * stream, int len) 38 | { 39 | if (shm && 0 != shm->samplebits) { 40 | shm->buffer = stream; 41 | shm->samplepos += len / (shm->samplebits / 4); 42 | // Check for samplepos overflow? 43 | S_PaintChannels (shm->samplepos); 44 | } 45 | } 46 | 47 | qboolean 48 | SNDDMA_Init (void) 49 | { 50 | SDL_AudioSpec desired, obtained; 51 | int desired_bits, freq; 52 | 53 | if (SDL_WasInit(SDL_INIT_EVERYTHING) == 0) { 54 | if (SDL_Init(SDL_INIT_AUDIO) < 0) { 55 | Com_Printf ("Couldn't init SDL audio: %s\n", SDL_GetError ()); 56 | return 0; 57 | } 58 | } else if (SDL_WasInit(SDL_INIT_AUDIO) == 0) { 59 | if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) { 60 | Com_Printf ("Couldn't init SDL audio: %s\n", SDL_GetError ()); 61 | return 0; 62 | } 63 | } 64 | 65 | snd_inited = 0; 66 | desired_bits = (Cvar_Get("sndbits", "16", CVAR_ARCHIVE))->value; 67 | 68 | /* Set up the desired format */ 69 | freq = (Cvar_Get("s_khz", "0", CVAR_ARCHIVE))->value; 70 | if (freq == 44) 71 | desired.freq = 44100; 72 | else if (freq == 22) 73 | desired.freq = 22050; 74 | else 75 | desired.freq = 11025; 76 | 77 | switch (desired_bits) { 78 | case 8: 79 | desired.format = AUDIO_U8; 80 | break; 81 | case 16: 82 | if (SDL_BYTEORDER == SDL_BIG_ENDIAN) 83 | desired.format = AUDIO_S16MSB; 84 | else 85 | desired.format = AUDIO_S16LSB; 86 | break; 87 | default: 88 | Com_Printf ("Unknown number of audio bits: %d\n", desired_bits); 89 | return 0; 90 | } 91 | desired.channels = (Cvar_Get("sndchannels", "2", CVAR_ARCHIVE))->value; 92 | 93 | if (desired.freq == 44100) 94 | desired.samples = 2048; 95 | else if (desired.freq == 22050) 96 | desired.samples = 1024; 97 | else 98 | desired.samples = 512; 99 | 100 | desired.callback = paint_audio; 101 | 102 | /* Open the audio device */ 103 | if (SDL_OpenAudio (&desired, &obtained) < 0) { 104 | Com_Printf ("Couldn't open SDL audio: %s\n", SDL_GetError ()); 105 | return 0; 106 | } 107 | 108 | /* Make sure we can support the audio format */ 109 | switch (obtained.format) { 110 | case AUDIO_U8: 111 | /* Supported */ 112 | break; 113 | case AUDIO_S16LSB: 114 | case AUDIO_S16MSB: 115 | if (((obtained.format == AUDIO_S16LSB) && 116 | (SDL_BYTEORDER == SDL_LIL_ENDIAN)) || 117 | ((obtained.format == AUDIO_S16MSB) && 118 | (SDL_BYTEORDER == SDL_BIG_ENDIAN))) { 119 | /* Supported */ 120 | break; 121 | } 122 | /* Unsupported, fall through */ ; 123 | default: 124 | /* Not supported -- force SDL to do our bidding */ 125 | SDL_CloseAudio (); 126 | if (SDL_OpenAudio (&desired, NULL) < 0) { 127 | Com_Printf ("Couldn't open SDL audio: %s\n", SDL_GetError ()); 128 | return 0; 129 | } 130 | memcpy (&obtained, &desired, sizeof (desired)); 131 | break; 132 | } 133 | SDL_PauseAudio (0); 134 | 135 | /* Fill the audio DMA information block */ 136 | shm = &dma; 137 | shm->samplebits = (obtained.format & 0xFF); 138 | shm->speed = obtained.freq; 139 | shm->channels = obtained.channels; 140 | shm->samples = obtained.samples * shm->channels; 141 | shm->samplepos = 0; 142 | shm->submission_chunk = 1; 143 | shm->buffer = NULL; 144 | 145 | snd_inited = 1; 146 | return 1; 147 | } 148 | 149 | int 150 | SNDDMA_GetDMAPos (void) 151 | { 152 | return shm->samplepos; 153 | } 154 | 155 | void 156 | SNDDMA_Shutdown (void) 157 | { 158 | if (snd_inited) { 159 | SDL_CloseAudio (); 160 | snd_inited = 0; 161 | } 162 | 163 | if (SDL_WasInit(SDL_INIT_EVERYTHING) == SDL_INIT_AUDIO) 164 | SDL_Quit(); 165 | else 166 | SDL_QuitSubSystem(SDL_INIT_AUDIO); 167 | } 168 | 169 | /* 170 | 171 | SNDDMA_Submit 172 | 173 | Send sound to device if buffer isn't really the dma buffer 174 | 175 | */ 176 | void 177 | SNDDMA_Submit (void) 178 | { 179 | } 180 | 181 | 182 | void SNDDMA_BeginPainting(void) 183 | { 184 | } 185 | -------------------------------------------------------------------------------- /sound/snddma_null.c: -------------------------------------------------------------------------------- 1 | 2 | // snddma_null.c 3 | // all other sound mixing is portable 4 | 5 | #include "../client/client.h" 6 | #include "../client/snd_loc.h" 7 | 8 | qboolean SNDDMA_Init(void) 9 | { 10 | return false; 11 | } 12 | 13 | int SNDDMA_GetDMAPos(void) 14 | { 15 | return 0; 16 | } 17 | 18 | void SNDDMA_Shutdown(void) 19 | { 20 | } 21 | 22 | void SNDDMA_BeginPainting (void) 23 | { 24 | } 25 | 26 | void SNDDMA_Submit(void) 27 | { 28 | } 29 | -------------------------------------------------------------------------------- /visualstudio/quake2.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.6.33815.320 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "quake2-soft-sdl", "q2-soft-sdl.vcxproj", "{B47D7D9B-5A7F-46D4-9DB5-74DBE53CCF4D}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "quake2-gl-sdl", "q2-gl-sdl.vcxproj", "{2611A7D8-97E3-4EB7-882B-C264268FC361}" 9 | EndProject 10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "quake2-soft-gdi", "q2-soft-gdi.vcxproj", "{2DA0A020-6D6C-48CD-9EAF-77411F99B0A2}" 11 | EndProject 12 | Global 13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 14 | Debug|x64 = Debug|x64 15 | Debug|x86 = Debug|x86 16 | Release|x64 = Release|x64 17 | Release|x86 = Release|x86 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {B47D7D9B-5A7F-46D4-9DB5-74DBE53CCF4D}.Debug|x64.ActiveCfg = Debug|x64 21 | {B47D7D9B-5A7F-46D4-9DB5-74DBE53CCF4D}.Debug|x64.Build.0 = Debug|x64 22 | {B47D7D9B-5A7F-46D4-9DB5-74DBE53CCF4D}.Debug|x86.ActiveCfg = Debug|Win32 23 | {B47D7D9B-5A7F-46D4-9DB5-74DBE53CCF4D}.Debug|x86.Build.0 = Debug|Win32 24 | {B47D7D9B-5A7F-46D4-9DB5-74DBE53CCF4D}.Release|x64.ActiveCfg = Release|x64 25 | {B47D7D9B-5A7F-46D4-9DB5-74DBE53CCF4D}.Release|x64.Build.0 = Release|x64 26 | {B47D7D9B-5A7F-46D4-9DB5-74DBE53CCF4D}.Release|x86.ActiveCfg = Release|Win32 27 | {B47D7D9B-5A7F-46D4-9DB5-74DBE53CCF4D}.Release|x86.Build.0 = Release|Win32 28 | {2611A7D8-97E3-4EB7-882B-C264268FC361}.Debug|x64.ActiveCfg = Debug|x64 29 | {2611A7D8-97E3-4EB7-882B-C264268FC361}.Debug|x64.Build.0 = Debug|x64 30 | {2611A7D8-97E3-4EB7-882B-C264268FC361}.Debug|x86.ActiveCfg = Debug|Win32 31 | {2611A7D8-97E3-4EB7-882B-C264268FC361}.Debug|x86.Build.0 = Debug|Win32 32 | {2611A7D8-97E3-4EB7-882B-C264268FC361}.Release|x64.ActiveCfg = Release|x64 33 | {2611A7D8-97E3-4EB7-882B-C264268FC361}.Release|x64.Build.0 = Release|x64 34 | {2611A7D8-97E3-4EB7-882B-C264268FC361}.Release|x86.ActiveCfg = Release|Win32 35 | {2611A7D8-97E3-4EB7-882B-C264268FC361}.Release|x86.Build.0 = Release|Win32 36 | {2DA0A020-6D6C-48CD-9EAF-77411F99B0A2}.Debug|x64.ActiveCfg = Debug|x64 37 | {2DA0A020-6D6C-48CD-9EAF-77411F99B0A2}.Debug|x64.Build.0 = Debug|x64 38 | {2DA0A020-6D6C-48CD-9EAF-77411F99B0A2}.Debug|x86.ActiveCfg = Debug|Win32 39 | {2DA0A020-6D6C-48CD-9EAF-77411F99B0A2}.Debug|x86.Build.0 = Debug|Win32 40 | {2DA0A020-6D6C-48CD-9EAF-77411F99B0A2}.Release|x64.ActiveCfg = Release|x64 41 | {2DA0A020-6D6C-48CD-9EAF-77411F99B0A2}.Release|x64.Build.0 = Release|x64 42 | {2DA0A020-6D6C-48CD-9EAF-77411F99B0A2}.Release|x86.ActiveCfg = Release|Win32 43 | {2DA0A020-6D6C-48CD-9EAF-77411F99B0A2}.Release|x86.Build.0 = Release|Win32 44 | EndGlobalSection 45 | GlobalSection(SolutionProperties) = preSolution 46 | HideSolutionNode = FALSE 47 | EndGlobalSection 48 | GlobalSection(ExtensibilityGlobals) = postSolution 49 | SolutionGuid = {CD4E34C6-5D8D-4245-9049-D4EE7F8A780B} 50 | EndGlobalSection 51 | EndGlobal 52 | --------------------------------------------------------------------------------