├── .gitignore ├── 3.15_Changes.txt ├── 3.16_Changes.txt ├── 3.17_Changes.txt ├── 3.18_changes.txt ├── 3.19_Changes.txt ├── 3.20_Changes.txt ├── 3.21_Changes.txt ├── QIIDXXII.cap ├── QUAKE2DATA ├── dx32 │ ├── dxcompiler.dll │ └── dxil.dll └── dx64 │ ├── dxcompiler.dll │ └── dxil.dll ├── QuakeIIDXXII.png ├── QuakeIIDXXII.sln ├── README.md ├── changes.txt ├── client ├── adivtab.h ├── anorms.h ├── asm_i386.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 └── x86.c ├── ctf ├── ctf.def ├── ctf.dsp ├── ctf.vcxproj ├── ctf.vcxproj.filters ├── 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 ├── 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.def ├── game.dsp ├── game.h ├── game.vcxproj ├── game.vcxproj.filters ├── 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 ├── gamepostbuild.bat ├── gnu.txt ├── irix ├── Makefile.txt ├── cd_irix.c ├── glw_imp.c ├── q_shirix.c ├── qgl_irix.c ├── snd_irix.c ├── sys_irix.c ├── vid_menu.c └── vid_so.c ├── joystick.txt ├── linux ├── Makefile ├── README ├── README-3.21-RELEASE ├── README.AXP ├── block16.h ├── block8.h ├── cd_linux.c ├── d_copy.s ├── d_ifacea.h ├── d_polysa.s ├── gl_fxmesa.c ├── gl_glx.c ├── glob.c ├── glob.h ├── glw_linux.h ├── in_linux.c ├── math.s ├── net_udp.c ├── q_shlinux.c ├── qasm.h ├── qgl_linux.c ├── quake2.3dfxgl ├── quake2.axp.spec.sh ├── quake2.gif ├── r_aclipa.s ├── r_draw16.s ├── r_drawa.s ├── r_edgea.s ├── r_scana.s ├── r_spr8.s ├── r_surf8.s ├── r_varsa.s ├── rw_in_svgalib.c ├── rw_linux.h ├── rw_svgalib.c ├── rw_x11.c ├── snd_linux.c ├── snd_mixa.s ├── sys_dosa.s ├── sys_linux.c ├── vid_menu.c └── vid_so.c ├── makefile ├── null ├── cd_null.c ├── cl_null.c ├── glimp_null.c ├── in_null.c ├── snddma_null.c ├── swimp_null.c ├── sys_null.c └── vid_null.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.dsp ├── quake2.dsw ├── quake2.vcxproj ├── quake2.vcxproj.filters ├── quake2.vcxproj.user ├── readme.txt ├── ref_dx12 ├── .gitattributes ├── Dx12Device.cpp ├── Dx12Device.h ├── Dx12Math.h ├── Dx12RayTracing.cpp ├── Dx12RayTracing.h ├── Dx12Utilities.cpp ├── Dx12Utilities.h ├── Shaders │ ├── ImageDrawShader.hlsl │ ├── ParticleDrawShader.hlsl │ ├── SkyShader.hlsl │ ├── StaticSamplers.hlsl │ └── WorldMeshDrawShader.hlsl ├── anorms.h ├── anormtab.h ├── d3dx12.h ├── dllmain.cpp ├── dx_draw.cpp ├── dx_gl_light.cpp ├── dx_gl_mesh.cpp ├── dx_gl_model.cpp ├── dx_gl_model.h ├── dx_gl_rsurf.cpp ├── dx_image.cpp ├── dx_lightmap.cpp ├── dx_local.h ├── dx_renderparticle.cpp ├── dx_renderview.cpp ├── dx_shader.cpp ├── dx_sky.cpp ├── dx_state.cpp ├── packages.config ├── ref_dx12.cpp ├── ref_dx12.def ├── ref_dx12.vcxproj ├── ref_dx12.vcxproj.filters ├── stdafx.cpp ├── stdafx.h └── targetver.h ├── ref_dx12postbuild_x64.bat ├── ref_dx12postbuild_x86.bat ├── 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 ├── ref_gl.def ├── ref_gl.dsp ├── ref_gl.vcxproj ├── ref_gl.vcxproj.filters └── warpsin.h ├── ref_soft ├── adivtab.h ├── anorms.h ├── asm_draw.h ├── block16.inc ├── block8.inc ├── d_if.inc ├── d_ifacea.h ├── qasm.inc ├── r_aclip.c ├── r_aclipa.asm ├── r_alias.c ├── r_bsp.c ├── r_draw.c ├── r_draw16.asm ├── r_drawa.asm ├── r_edge.c ├── r_edgea.asm ├── 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_polysa.asm ├── r_polyse.c ├── r_rast.c ├── r_scan.c ├── r_scana.asm ├── r_spr8.asm ├── r_sprite.c ├── r_surf.c ├── r_surf8.asm ├── r_varsa.asm ├── rand1k.h ├── ref_soft.def ├── ref_soft.dsp ├── ref_soft.vcxproj └── ref_soft.vcxproj.filters ├── rhapsody ├── in_next.m ├── notes.txt ├── pb.project ├── quake2.iconheader ├── quake2.tiff ├── r_next.m ├── rhapqw.txt ├── snd_next.m ├── swimp_rhap.m ├── sys_rhap.m └── vid_next.m ├── 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 ├── solaris ├── Makefile.Solaris ├── g_so.c ├── glob.c ├── glob.h ├── net_udp.c ├── q_shsolaris.c ├── readme.solaris └── sys_solaris.c └── win32 ├── cd_win.c ├── conproc.c ├── conproc.h ├── glw_imp.c ├── glw_win.h ├── in_win.c ├── net_wins.c ├── q2.ico ├── q2.rc ├── q_shwin.c ├── qe3.ico ├── qgl_win.c ├── resource.h ├── rw_ddraw.c ├── rw_dib.c ├── rw_imp.c ├── rw_win.h ├── snd_win.c ├── sys_win.c ├── vid_dll.c ├── vid_menu.c ├── winquake.h └── winquake.rc /3.18_changes.txt: -------------------------------------------------------------------------------- 1 | 3.18 Changes 2 | 3 | - "Water surfing" that was present in 3.17 has been fixed (holding jump while 4 | on the surface of water let you swim at full speed). 5 | - Environment maps (env) are now autodownloaded (if allow_download_maps is set). 6 | - Spectator support added. A new cvar is built into the client, "spectator" 7 | Setting it to value other than "0" will allow you join a game as a spectator. 8 | While in spectator mode, you can press the attack button to enter a chasecam 9 | mode and follow other players. Using the inventory keys (by default the 10 | left and right square brackets) you can switch between players in the game 11 | while using the chasecam. 12 | You may enter and leave spectator mode while connected. Doing so resets 13 | your score to zero. 14 | ***The new spectator support requires a new game.dll and may not work for 15 | user mods until they update their code. The default game.dll that comes 16 | with 3.18 supports chasecam as well as the new included Xatrix game.dll. 17 | - Fixed it so that when a model defaults to male/grunt (don't have the 18 | necessary model or skin for the player), VWep support is still enabled. 19 | - New console command for players, "playerlist". This will cause the server 20 | to give you a text list of the players on the server, including their 21 | connect time, score, ping and spectator status. This is handy if not 22 | everyone fits on the scoreboard on busy servers. 23 | - New cvar for the game.dll: spectator_password. If set to a value (other 24 | than "none"), users must set their spectator variable to this value in order 25 | to join the server as a spectator. This password is independant of the 26 | normal user password. 27 | - New cvar for the game.dll: maxspectators (defaults to 4). This value is 28 | not seperate from maxclients (a spectator is still a client). 29 | - New cvar for the game.dll: sv_maplist. This can be set to a list of map 30 | names that the server should autorotate through, rather than using the 31 | nextmap set in the actual map files themselves. 32 | For example: set sv_maplist "base1 q2dm1 q2dm3 fact3" will cause the server 33 | to rotate through those maps. 34 | ***This requires a game.dll update and will not work with user mods until 35 | they update their code. 36 | - A new facility has been added to ClientConnect() in the game.dll to allow 37 | the game.dll to pass a message back to the user for the reason of disallowing 38 | a connection. It is done by setting a key of "rejmsg" in the passed userinfo. 39 | For example: 40 | Info_SetValueforKey(userinfo, "rejmsg", "Password required or incorrect."); 41 | - The server cvar, password, may be set to "none" to clear the password. This 42 | is needed because rcon can not set a blank password. 43 | - New server cvar: sv_airaccelerate. This controls the optional air 44 | acceleration facility. The default value is 0, which disables air control. 45 | The usual value to replicate the air control seen in the original Quake and 46 | later versions of Quakeworld is 10. 10 allows for much more 47 | air control (as was seen in 3.15). This value is ignored in single player 48 | and coop. 49 | - Fixed NoSuchFrame/BAD_MODELTYPE errors when doing a vid_restart while 50 | connected. 51 | - NoSuchFrame errors now include model name to assist in debugging user mods. 52 | - Fixed the remote status query response (ServerInfo) to not include error 53 | messages and be more consistent. 54 | -------------------------------------------------------------------------------- /3.19_Changes.txt: -------------------------------------------------------------------------------- 1 | Changes since v3.17 2 | ------------------- 3 | 4 | - Updated VWEP models 5 | - Fixed sound config strings getting out of sync on loadgame. This caused 6 | the wrong sound to be played. 7 | - Fixed a bug in ref_soft that caused the menu system's bottom of screen 8 | help text not to be displayed 9 | - Added a missing Rogue DM option 10 | - "Water surfing" that was present in 3.17 has been fixed (holding jump while 11 | on the surface of water let you swim at full speed). 12 | - Environment maps (env) are now autodownloaded (if allow_download_maps is set). 13 | - Spectator support added. A new cvar is built into the client, "spectator" 14 | Setting it to value other than "0" will allow you join a game as a spectator. 15 | While in spectator mode, you can press the attack button to enter a chasecam 16 | mode and follow other players. Using the inventory keys (by default the 17 | left and right square brackets) you can switch between players in the game 18 | while using the chasecam. 19 | You may enter and leave spectator mode while connected. Doing so resets 20 | your score to zero. 21 | ***The new spectator support requires a new game.dll and may not work for 22 | user mods until they update their code. The default game.dll that comes 23 | with 3.19 supports chasecam as well as the new included Xatrix game.dll. 24 | - Fixed it so that when a model defaults to male/grunt (don't have the 25 | necessary model or skin for the player), VWep support is still enabled. 26 | - New console command for players, "playerlist". This will cause the server 27 | to give you a text list of the players on the server, including their 28 | connect time, score, ping and spectator status. This is handy if not 29 | everyone fits on the scoreboard on busy servers. 30 | - New cvar for the game.dll: spectator_password. If set to a value (other 31 | than "none"), users must set their spectator variable to this value in order 32 | to join the server as a spectator. This password is independant of the 33 | normal user password. 34 | - New cvar for the game.dll: maxspectators (defaults to 4). This value is 35 | not seperate from maxclients (a spectator is still a client). 36 | - New cvar for the game.dll: sv_maplist. This can be set to a list of map 37 | names that the server should autorotate through, rather than using the 38 | nextmap set in the actual map files themselves. 39 | For example: set sv_maplist "base1 q2dm1 q2dm3 fact3" will cause the server 40 | to rotate through those maps. 41 | ***This requires a game.dll update and will not work with user mods until 42 | they update their code. 43 | - A new facility has been added to ClientConnect() in the game.dll to allow 44 | the game.dll to pass a message back to the user for the reason of disallowing 45 | a connection. It is done by setting a key of "rejmsg" in the passed userinfo. 46 | For example: 47 | Info_SetValueforKey(userinfo, "rejmsg", "Password required or incorrect."); 48 | - The server cvar, password, may be set to "none" to clear the password. This 49 | is needed because rcon can not set a blank password. 50 | - New server cvar: sv_airaccelerate. This controls the optional air 51 | acceleration facility. The default value is 0, which disables air control. 52 | The usual value to replicate the air control seen in the original Quake and 53 | later versions of Quakeworld is 10. 10 allows for much more 54 | air control (as was seen in 3.15). This value is ignored in single player 55 | and coop. 56 | - Fixed NoSuchFrame/BAD_MODELTYPE errors when doing a vid_restart while 57 | connected. 58 | - NoSuchFrame errors now include model name to assist in debugging user mods. 59 | - Fixed the remote status query response (ServerInfo) to not include error 60 | messages and be more consistent. 61 | -------------------------------------------------------------------------------- /3.20_Changes.txt: -------------------------------------------------------------------------------- 1 | 3.20 Changes: 2 | - Fixed a network problem where and oversize packet could cause a client 3 | crash. 4 | - Fixed the long standing Quake2 bug of where you would occasionally spawn 5 | or teleport and find yourself either looking straight at the ceiling or 6 | down at the floor. 7 | - Changed it so that the function keys (F1 through F12) now get executed when 8 | depressed during demo playback or attract modes. This allows you to take 9 | screen shots (F12) during demos and other features. An example of other 10 | features is a fast forward for demos: 11 | alias +ff "timedemo 1" 12 | alias -ff "timedemo 0" 13 | bind f7 +ff 14 | This binding will cause the current demo playing to zip into timedemo mode 15 | while F7 is depressed, effectively acting like a fast forward key. 16 | - Wrong packaging of 3.19 patch. The Rogue CD has a 45k pak2 and vwep .md2 17 | files in baseq2/players, but the 3.19 x86 patch we released has a 2.7MB 18 | pak2. 3.20 has a 45k pak2 and the vwep models go in baseq2/players. 19 | - VWep code has been added to Xatrix dll, new VWep models for the Xatrix 20 | specific weapons (Ion Ripper and Phalanx) have been included. 21 | - Rogue Linux game library was wrong version and had some unlinked symbols, 22 | this has been corrected. 23 | - Occasional error of: "D_SCAlloc: bad cache width 16384" in software renderer. 24 | This had to do with surfaces to SURF_FLOWING and were transparent. This 25 | has been fixed in the refs now so flowing transparent textures now works. 26 | - [Unix] Net_ErrorToString calls were wrong, was using %i and not %s resulting 27 | in random numbers being printed for error messages. 28 | - Color shell mixing restored to the same blends as previous versions. This 29 | was changed in 3.19 for the new color shells the Rogue mission pack 30 | introduced. 31 | - Fixed a possible server crash in the new "playerlist" command. 32 | - Fixed a case where a person joining a server could be invisible (left over 33 | setting of SVF_NOCLIENT from previous spectator). 34 | - Invalid pak files no longer cause a crash and are just ignored 35 | - Fixed a 3.19 bug where linked models (modelindex2) who's modelindex was 36 | greater than 0x7f causes the wrong model to be drawn (in some cases, the 37 | world would be drawn twice). This was the cause of many of the "extreme" 38 | frame lag people were seeing in 3.19 on servers using old-style VWep code. 39 | - Linux: Complete rewrite of the OpenGL library handling. This was needed 40 | to cleanly integrate OpenGL extension checking. Linux now supports 41 | extensions such as multitexture and better dynamic loading of libraries. 42 | It's cleaner now in that you don't have to preload hack stuff to use the 43 | 3DFX Miniport rather than libMesa3D. The Linux version now uses the 44 | gl_driver to specify the 3D library to dynamically load. For example, to 45 | use the lib3dfxgl.so miniport, one would now use: 46 | ./quake2 +set vid_ref gl +set gl_driver lib3dfxgl.so 47 | This change fixes several bugs that were apparant in the older method, such 48 | as a segfault occasionally when connecting to a server with a different game 49 | directory. 50 | The vid menu in the Linux version has been changed to reflect the new 51 | options, the current list of supported video drivers are now: software, 52 | software X11, Mesa 3-D 3DFX, 3DFXGL Miniport, OpenGL glX, and Mesa 3-D glX, 53 | - Railgun shots now go through gibs as well as other players. 54 | - New server variable, "needpass" that can been seen with server browser 55 | tools such as GameSpy. This variable indicates whether a password or 56 | spectator password is needed to get onto a server. Bit 0 is password and 57 | bit 1 is spectator password. 58 | - Quake2 will no longer look for gamex86.dll in the main Quake2 directory. 59 | It will always load out of the game directory first. 60 | - Players joining a server during an intermission are now moved to the 61 | intermission position. 62 | - The "logfile" cvar has been extended with the following values: 63 | 0 - don't log (default) 64 | 1 - overwrite qconsole.log and use buffered writes 65 | 2 - overwrite qconsole.log and flush write every line 66 | 3 - append to existing qconsole.log and flush write every line 67 | - Several minor bug fixes to the Rogue mission pack gamex86.dll 68 | - Linux: Rebuild of Rogue mission pack shared library to correct some 69 | dynamic symbol errors (is NAN errors). 70 | -------------------------------------------------------------------------------- /3.21_Changes.txt: -------------------------------------------------------------------------------- 1 | 12-22-2001, for source release under GPL licensing: 2 | - Tweaked linux/Makefile for easier build 3 | added linux/README-3.21-RELEASE 4 | 5 | 3.21 Changes: 6 | - Support for GL_ARB_multitexture added. This supports the new multitexture 7 | extensions and deprecates GL_SGIS_multitexture. 8 | - Linux OpenGL X11 handling completely rewritten. Support for XF86DGA Mouse 9 | and fullscreen resolution support added. Please see the README file for 10 | Linux about the new features of this handling. 11 | 12 | 3.20 Changes: 13 | - Fixed a network problem where and oversize packet could cause a client 14 | crash. 15 | - Fixed the long standing Quake2 bug of where you would occasionally spawn 16 | or teleport and find yourself either looking straight at the ceiling or 17 | down at the floor. 18 | - Changed it so that the function keys (F1 through F12) now get executed when 19 | depressed during demo playback or attract modes. This allows you to take 20 | screen shots (F12) during demos and other features. An example of other 21 | features is a fast forward for demos: 22 | alias +ff "timedemo 1" 23 | alias -ff "timedemo 0" 24 | bind f7 +ff 25 | This binding will cause the current demo playing to zip into timedemo mode 26 | while F7 is depressed, effectively acting like a fast forward key. 27 | - Wrong packaging of 3.19 patch. The Rogue CD has a 45k pak2 and vwep .md2 28 | files in baseq2/players, but the 3.19 x86 patch we released has a 2.7MB 29 | pak2. 3.20 has a 45k pak2 and the vwep models go in baseq2/players. 30 | - VWep code has been added to Xatrix dll, new VWep models for the Xatrix 31 | specific weapons (Ion Ripper and Phalanx) have been included. 32 | - Rogue Linux game library was wrong version and had some unlinked symbols, 33 | this has been corrected. 34 | - Occasional error of: "D_SCAlloc: bad cache width 16384" in software renderer. 35 | This had to do with surfaces to SURF_FLOWING and were transparent. This 36 | has been fixed in the refs now so flowing transparent textures now works. 37 | - [Unix] Net_ErrorToString calls were wrong, was using %i and not %s resulting 38 | in random numbers being printed for error messages. 39 | - Color shell mixing restored to the same blends as previous versions. This 40 | was changed in 3.19 for the new color shells the Rogue mission pack 41 | introduced. 42 | - Fixed a possible server crash in the new "playerlist" command. 43 | - Fixed a case where a person joining a server could be invisible (left over 44 | setting of SVF_NOCLIENT from previous spectator). 45 | - Invalid pak files no longer cause a crash and are just ignored 46 | - Fixed a 3.19 bug where linked models (modelindex2) who's modelindex was 47 | greater than 0x7f causes the wrong model to be drawn (in some cases, the 48 | world would be drawn twice). This was the cause of many of the "extreme" 49 | frame lag people were seeing in 3.19 on servers using old-style VWep code. 50 | - Linux: Complete rewrite of the OpenGL library handling. This was needed 51 | to cleanly integrate OpenGL extension checking. Linux now supports 52 | extensions such as multitexture and better dynamic loading of libraries. 53 | It's cleaner now in that you don't have to preload hack stuff to use the 54 | 3DFX Miniport rather than libMesa3D. The Linux version now uses the 55 | gl_driver to specify the 3D library to dynamically load. For example, to 56 | use the lib3dfxgl.so miniport, one would now use: 57 | ./quake2 +set vid_ref gl +set gl_driver lib3dfxgl.so 58 | This change fixes several bugs that were apparant in the older method, such 59 | as a segfault occasionally when connecting to a server with a different game 60 | directory. 61 | The vid menu in the Linux version has been changed to reflect the new 62 | options, the current list of supported video drivers are now: software, 63 | software X11, Mesa 3-D 3DFX, 3DFXGL Miniport, OpenGL glX, and Mesa 3-D glX, 64 | - Railgun shots now go through gibs as well as other players. 65 | - New server variable, "needpass" that can been seen with server browser 66 | tools such as GameSpy. This variable indicates whether a password or 67 | spectator password is needed to get onto a server. Bit 0 is password and 68 | bit 1 is spectator password. 69 | - Quake2 will no longer look for gamex86.dll in the main Quake2 directory. 70 | It will always load out of the game directory first. 71 | - Players joining a server during an intermission are now moved to the 72 | intermission position. 73 | - The "logfile" cvar has been extended with the following values: 74 | 0 - don't log (default) 75 | 1 - overwrite qconsole.log and use buffered writes 76 | 2 - overwrite qconsole.log and flush write every line 77 | 3 - append to existing qconsole.log and flush write every line 78 | - Several minor bug fixes to the Rogue mission pack gamex86.dll 79 | - Linux: Rebuild of Rogue mission pack shared library to correct some 80 | dynamic symbol errors (is NAN errors). 81 | -------------------------------------------------------------------------------- /QIIDXXII.cap: -------------------------------------------------------------------------------- 1 | { 2 | "rdocCaptureSettings": 1, 3 | "settings": { 4 | "autoStart": false, 5 | "commandLine": "", 6 | "environment": [ 7 | ], 8 | "executable": "D:\\Projects\\Git\\QuakeIIDXXII\\debug\\quake2.exe", 9 | "inject": false, 10 | "numQueuedFrames": 0, 11 | "options": { 12 | "allowFullscreen": true, 13 | "allowVSync": true, 14 | "apiValidation": false, 15 | "captureAllCmdLists": false, 16 | "captureCallstacks": false, 17 | "captureCallstacksOnlyDraws": false, 18 | "debugOutputMute": true, 19 | "delayForDebugger": 0, 20 | "hookIntoChildren": true, 21 | "refAllResources": false, 22 | "verifyBufferAccess": false 23 | }, 24 | "queuedFrameCap": 0, 25 | "workingDir": "D:/Apps/Steam/steamapps/common/Quake 2" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /QUAKE2DATA/dx32/dxcompiler.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sebh/QuakeIIDXXII/52b83821fa02d9a8b662805bad1a9b9c59bd716f/QUAKE2DATA/dx32/dxcompiler.dll -------------------------------------------------------------------------------- /QUAKE2DATA/dx32/dxil.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sebh/QuakeIIDXXII/52b83821fa02d9a8b662805bad1a9b9c59bd716f/QUAKE2DATA/dx32/dxil.dll -------------------------------------------------------------------------------- /QUAKE2DATA/dx64/dxcompiler.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sebh/QuakeIIDXXII/52b83821fa02d9a8b662805bad1a9b9c59bd716f/QUAKE2DATA/dx64/dxcompiler.dll -------------------------------------------------------------------------------- /QUAKE2DATA/dx64/dxil.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sebh/QuakeIIDXXII/52b83821fa02d9a8b662805bad1a9b9c59bd716f/QUAKE2DATA/dx64/dxil.dll -------------------------------------------------------------------------------- /QuakeIIDXXII.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sebh/QuakeIIDXXII/52b83821fa02d9a8b662805bad1a9b9c59bd716f/QuakeIIDXXII.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # QuakeIIDXXII 2 | 3 | ![dx12appscreenshot](QuakeIIDXXII.png) 4 | 5 | Quake II on Dx12. It has been tarted from [https://github.com/oraoto/quake2-vs2015](https://github.com/oraoto/quake2-vs2015) because it is the original code and it was compiling out of the box. 6 | 7 | The goal of this project was to verify that my [Dx12 basic thin abstraction layer](https://github.com/sebh/Dx12Base) could work is such a use case. And I always wanted to put my nose in Quake2's code for fun! The dx12 implementation is far from perfect and lots could be improved (especially around data upload to GPU and batching). But it works :) 8 | 9 | QuakeIIDXII looks similar to the original Quake 2 but there are likely missing things and bugs. I will not provide any support but I welcome bug fixes or suggestions that I will process when I have the time. 10 | Only the win32 platform compiles and run correctly for now. In this case, dx12 is limited to 4GB of GPU video memory and no ray tracing is available. 11 | 12 | Main modifications done to the renderer as compared to OpenGL: 13 | - Drawing is no longer done inline: drawcalls are recorded while updating vertex buffers. All draw call are issued at the end of the frame. More could be done such as preparing static vertex buffers for the world but it does not seem necessary. 14 | - Mesh triangle list, fan and polys are batched in as few draw calls as possible if contiguous drawcall have the same state/parameterisation. Batches are triangle list only now. 15 | - Lightmap upload is also no longer done inline&interleaved with draw calls for subparts of textures. Static/dynamic Lightmaps are maintained CPU side and only the one receiving dynamic lighting are uploaded to GPU memory before the world is finally drawn using them. 16 | 17 | New cvars: 18 | - *dx_batchworldtriangles*: whether or not to batch meshes tris list/fan and polys according to render state. 1 by default because it result in less batches and it is a lot faster (roughly at least 4x less drawcalls). 19 | - *dx_showworldbatches*: show drawcalls/batches with single colors. This reveal the impact of *dx_batchworldtriangles* on draw call count. 20 | - *dx_showlightmaps*: show used lightmaps on screen and highlight in green the one being uploaded this frame due to dynamic lighting. 21 | 22 | 23 | Build the solution 24 | 1. Open the solution in Visual Studio 25 | 2. Make sure you select a windows SDK and platform toolset you have locally for each projects 26 | 3. Select Quake2 as the startup project 27 | 4. Select the _x86_ (or _x64_) platform and either _Debug_ or _Release_ configuration. 28 | 5. Change in _Quake 2_ project properties, the _Application_ project _Working Directory_ from `$(ProjectDir)` to the folder containing the game data, for instance: D:\Projects\Git\QuakeIIDXXII\QUAKE2DATA 29 | 6. Open *dx_shader.cpp* and update the full path to the shader file. (this really needs to be fixed) 30 | 7. Hit F5 31 | 32 | Note: 33 | - When switching between x86 and x64, a full rebuild of the solution is required. 34 | - QUAKE2DATA in the main data folder. It must contain baseq2 copied from where you hgave installed the game. 35 | - When building thje solution, gamex86.dll will be copied into QUAKE2DATA.The appropriate dx dlls will also be copied in QUAKE2DATA. 36 | 37 | Seb 38 | -------------------------------------------------------------------------------- /client/asm_i386.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __ASM_I386__ 3 | #define __ASM_I386__ 4 | 5 | #ifdef ELF 6 | #define C(label) label 7 | #else 8 | #define C(label) _##label 9 | #endif 10 | 11 | // 12 | // !!! note that this file must match the corresponding C structures at all 13 | // times !!! 14 | // 15 | 16 | // plane_t structure 17 | // !!! if this is changed, it must be changed in model.h too !!! 18 | // !!! if the size of this is changed, the array lookup in SV_HullPointContents 19 | // must be changed too !!! 20 | #define pl_normal 0 21 | #define pl_dist 12 22 | #define pl_type 16 23 | #define pl_signbits 17 24 | #define pl_pad 18 25 | #define pl_size 20 26 | 27 | // hull_t structure 28 | // !!! if this is changed, it must be changed in model.h too !!! 29 | #define hu_clipnodes 0 30 | #define hu_planes 4 31 | #define hu_firstclipnode 8 32 | #define hu_lastclipnode 12 33 | #define hu_clip_mins 16 34 | #define hu_clip_maxs 28 35 | #define hu_size 40 36 | 37 | // dnode_t structure 38 | // !!! if this is changed, it must be changed in bspfile.h too !!! 39 | #define nd_planenum 0 40 | #define nd_children 4 41 | #define nd_mins 8 42 | #define nd_maxs 20 43 | #define nd_firstface 32 44 | #define nd_numfaces 36 45 | #define nd_size 40 46 | 47 | // sfxcache_t structure 48 | // !!! if this is changed, it much be changed in sound.h too !!! 49 | #define sfxc_length 0 50 | #define sfxc_loopstart 4 51 | #define sfxc_speed 8 52 | #define sfxc_width 12 53 | #define sfxc_stereo 16 54 | #define sfxc_data 20 55 | 56 | // channel_t structure 57 | // !!! if this is changed, it much be changed in sound.h too !!! 58 | #define ch_sfx 0 59 | #define ch_leftvol 4 60 | #define ch_rightvol 8 61 | #define ch_end 12 62 | #define ch_pos 16 63 | #define ch_looping 20 64 | #define ch_entnum 24 65 | #define ch_entchannel 28 66 | #define ch_origin 32 67 | #define ch_dist_mult 44 68 | #define ch_master_vol 48 69 | #define ch_size 52 70 | 71 | // portable_samplepair_t structure 72 | // !!! if this is changed, it much be changed in sound.h too !!! 73 | #define psp_left 0 74 | #define psp_right 4 75 | #define psp_size 8 76 | 77 | // !!! must be kept the same as in d_iface.h !!! 78 | #define TRANSPARENT_COLOR 255 79 | 80 | #endif 81 | 82 | -------------------------------------------------------------------------------- /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 ; i 21 | #include "client.h" 22 | 23 | #if id386 24 | 25 | static unsigned long bias; 26 | static unsigned long *histogram; 27 | static unsigned long start, range; 28 | static unsigned long bias; 29 | 30 | __declspec( naked ) void x86_TimerStart( void ) 31 | { 32 | __asm _emit 0fh 33 | __asm _emit 31h 34 | __asm mov start, eax 35 | __asm ret 36 | } 37 | 38 | __declspec( naked ) void x86_TimerStop( void ) 39 | { 40 | __asm push edi 41 | __asm mov edi, histogram 42 | __asm _emit 0fh 43 | __asm _emit 31h 44 | __asm sub eax, start 45 | __asm sub eax, bias 46 | __asm js discard 47 | __asm cmp eax, range 48 | __asm jge discard 49 | __asm lea edi, [edi + eax*4] 50 | __asm inc dword ptr [edi] 51 | discard: 52 | __asm pop edi 53 | __asm ret 54 | } 55 | 56 | #pragma warning( disable: 4035 ) 57 | static __declspec( naked ) unsigned long x86_TimerStopBias( void ) 58 | { 59 | __asm push edi 60 | __asm mov edi, histogram 61 | __asm _emit 0fh 62 | __asm _emit 31h 63 | __asm sub eax, start 64 | __asm pop edi 65 | __asm ret 66 | } 67 | #pragma warning( default:4035 ) 68 | 69 | void x86_TimerInit( unsigned long smallest, unsigned length ) 70 | { 71 | int i; 72 | unsigned long biastable[100]; 73 | 74 | range = length; 75 | bias = 10000; 76 | 77 | for ( i = 0; i < 100; i++ ) 78 | { 79 | x86_TimerStart(); 80 | biastable[i] = x86_TimerStopBias(); 81 | 82 | if ( bias > biastable[i] ) 83 | bias = biastable[i]; 84 | } 85 | 86 | bias += smallest; 87 | histogram = Z_Malloc( range * sizeof( unsigned long ) ); 88 | } 89 | 90 | unsigned long *x86_TimerGetHistogram( void ) 91 | { 92 | return histogram; 93 | } 94 | 95 | #endif 96 | -------------------------------------------------------------------------------- /ctf/ctf.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | GetGameAPI 3 | -------------------------------------------------------------------------------- /ctf/ctf.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {5cc5a3ca-15aa-4ea8-8868-417584e00f9b} 6 | *.c 7 | 8 | 9 | {3848241d-a076-4af6-bafd-cf260ff15a7f} 10 | *.h 11 | 12 | 13 | {e5254192-c18e-4cda-8296-dc3a3685013e} 14 | *.def,*.res 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | Source Files 35 | 36 | 37 | Source Files 38 | 39 | 40 | Source Files 41 | 42 | 43 | Source Files 44 | 45 | 46 | Source Files 47 | 48 | 49 | Source Files 50 | 51 | 52 | Source Files 53 | 54 | 55 | Source Files 56 | 57 | 58 | Source Files 59 | 60 | 61 | Source Files 62 | 63 | 64 | Source Files 65 | 66 | 67 | Source Files 68 | 69 | 70 | Source Files 71 | 72 | 73 | Source Files 74 | 75 | 76 | Source Files 77 | 78 | 79 | Source Files 80 | 81 | 82 | Source Files 83 | 84 | 85 | Source Files 86 | 87 | 88 | Source Files 89 | 90 | 91 | Source Files 92 | 93 | 94 | Source Files 95 | 96 | 97 | 98 | 99 | Header Files 100 | 101 | 102 | Header Files 103 | 104 | 105 | Header Files 106 | 107 | 108 | Header Files 109 | 110 | 111 | Header Files 112 | 113 | 114 | Header Files 115 | 116 | 117 | 118 | 119 | Resource Files 120 | 121 | 122 | -------------------------------------------------------------------------------- /ctf/docs/admin.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sebh/QuakeIIDXXII/52b83821fa02d9a8b662805bad1a9b9c59bd716f/ctf/docs/admin.gif -------------------------------------------------------------------------------- /ctf/docs/adminset.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sebh/QuakeIIDXXII/52b83821fa02d9a8b662805bad1a9b9c59bd716f/ctf/docs/adminset.gif -------------------------------------------------------------------------------- /ctf/docs/automac.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sebh/QuakeIIDXXII/52b83821fa02d9a8b662805bad1a9b9c59bd716f/ctf/docs/automac.gif -------------------------------------------------------------------------------- /ctf/docs/ghost.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sebh/QuakeIIDXXII/52b83821fa02d9a8b662805bad1a9b9c59bd716f/ctf/docs/ghost.jpg -------------------------------------------------------------------------------- /ctf/docs/grapple.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sebh/QuakeIIDXXII/52b83821fa02d9a8b662805bad1a9b9c59bd716f/ctf/docs/grapple.jpg -------------------------------------------------------------------------------- /ctf/docs/layout.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sebh/QuakeIIDXXII/52b83821fa02d9a8b662805bad1a9b9c59bd716f/ctf/docs/layout.jpg -------------------------------------------------------------------------------- /ctf/docs/mainctf_back.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sebh/QuakeIIDXXII/52b83821fa02d9a8b662805bad1a9b9c59bd716f/ctf/docs/mainctf_back.jpg -------------------------------------------------------------------------------- /ctf/docs/menu.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sebh/QuakeIIDXXII/52b83821fa02d9a8b662805bad1a9b9c59bd716f/ctf/docs/menu.gif -------------------------------------------------------------------------------- /ctf/docs/q2ctf.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sebh/QuakeIIDXXII/52b83821fa02d9a8b662805bad1a9b9c59bd716f/ctf/docs/q2ctf.html -------------------------------------------------------------------------------- /ctf/docs/say_team.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sebh/QuakeIIDXXII/52b83821fa02d9a8b662805bad1a9b9c59bd716f/ctf/docs/say_team.gif -------------------------------------------------------------------------------- /ctf/docs/stats.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sebh/QuakeIIDXXII/52b83821fa02d9a8b662805bad1a9b9c59bd716f/ctf/docs/stats.jpg -------------------------------------------------------------------------------- /ctf/docs/tech1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sebh/QuakeIIDXXII/52b83821fa02d9a8b662805bad1a9b9c59bd716f/ctf/docs/tech1.gif -------------------------------------------------------------------------------- /ctf/docs/tech2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sebh/QuakeIIDXXII/52b83821fa02d9a8b662805bad1a9b9c59bd716f/ctf/docs/tech2.gif -------------------------------------------------------------------------------- /ctf/docs/tech3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sebh/QuakeIIDXXII/52b83821fa02d9a8b662805bad1a9b9c59bd716f/ctf/docs/tech3.gif -------------------------------------------------------------------------------- /ctf/docs/tech4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sebh/QuakeIIDXXII/52b83821fa02d9a8b662805bad1a9b9c59bd716f/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/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/game.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | GetGameAPI 3 | -------------------------------------------------------------------------------- /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_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_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 | -------------------------------------------------------------------------------- /gamepostbuild.bat: -------------------------------------------------------------------------------- 1 | XCOPY "..\debug\gamex86.dll" "..\QUAKE2DATA\baseq2\" /-y /y /v 2 | -------------------------------------------------------------------------------- /irix/cd_irix.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 21 | #include 22 | 23 | #include "../client/client.h" 24 | 25 | void CDAudio_Play(int track, qboolean looping) 26 | { 27 | Com_Printf("XXX - CDAudio_Play %i (%i)\n", track, looping); 28 | } 29 | 30 | 31 | void CDAudio_Stop(void) 32 | { 33 | Com_Printf("XXX - CDAudio_Stop\n"); 34 | } 35 | 36 | 37 | void CDAudio_Resume(void) 38 | { 39 | Com_Printf("XXX - CDAudio_Resume\n"); 40 | } 41 | 42 | 43 | void CDAudio_Update(void) 44 | { 45 | /* Com_Printf("XXX - CDAudio_Update\n"); */ 46 | } 47 | 48 | 49 | int CDAudio_Init(void) 50 | { 51 | Com_Printf("XXX - CDAudio_Init\n"); 52 | return 0; 53 | } 54 | 55 | 56 | void CDAudio_Shutdown(void) 57 | { 58 | Com_Printf("XXX - CDAudio_Shutdown\n"); 59 | } 60 | -------------------------------------------------------------------------------- /linux/README-3.21-RELEASE: -------------------------------------------------------------------------------- 1 | 12-22-2001 2 | 3 | Some notes about this release on linux: 4 | 5 | #1: it is recommended that you have a working Quake2 installation already 6 | (i.e. download precompiled binaries and stuff, have /usr/local/games/quake2 7 | with all the files etc.) 8 | 9 | #2: it builds in debug, only ref_glx.so has been tested 10 | 11 | once compiled, you need to create baseq2/ directory, 12 | and symlink the pak, symlink debugi386-glibc/gamei386.so 13 | 14 | then to start Q2, in debugi386-glibc: 15 | ln -s /usr/local/games/quake2/baseq2 16 | ./quake2 +set vid_ref glx +set gl_driver /usr/lib/libGL.so 17 | 18 | you will need to edit /etc/quake2.conf, make it point to the right place 19 | for loading of ref_glx.so 20 | (I just put '.' in my quake2.conf to rely on current dir) 21 | 22 | TTimo (ttimo@idsoftware.com) 23 | 24 | -------------------------------------------------------------------------------- /linux/README.AXP: -------------------------------------------------------------------------------- 1 | Quake2 Dedicated 3.18 For Linux AXP 2 | ----------------------------------- 3 | 4 | Please see the readme.txt file included for general information about the 5 | game. This file contains Linux/AXP specific information. 6 | 7 | Requirements 8 | ------------ 9 | 10 | Linux Alpha kernel 2.0.30 or later, Redhat 5.0 (glibc) or later. 11 | 12 | Installation 13 | ------------ 14 | 15 | To install the Quake2 data files, mount your Quake2 CD and copy 16 | the directory install/data to the location where you want Quake2. You 17 | can also symlink it, but I don't recommend that. Around 200MB of disk 18 | space is required for a full installation. 19 | 20 | For example: 21 | cp -r /mnt/cdrom/install/data/* /usr/games/quake2 22 | 23 | This binary only runs as a dedicated server and requires no special 24 | user permissions. 25 | 26 | You can also set dmflags, timelimit, etc. in a config file, like so: 27 | set timelimit 20 28 | set fraglimit 25 29 | set dmflags 532 30 | map fact3 31 | 32 | Then exec that config file on load, like so: 33 | 34 | ./q2ded +exec server.cfg 35 | 36 | If you use a config file, you must put a 'map' command in it or the 37 | server won't load a map. 38 | 39 | To run a dedicated server in the background, use this; 40 | 41 | nohup ./q2ded +exec server.cfg & 42 | 43 | A better way is to run Quake2 on a tty via screen. screen can be found 44 | at ftp://prep.ai.mit.edu/pub/gnu/screen-3.7.4.tar.gz. 45 | 46 | ----------------------------------------------------------------------------- 47 | 48 | Linux Quake2 is an unsupported product. Usage of this product is bound by 49 | the legal notice found on the distribution Quake2 CDROM. 50 | 51 | /// Zoid 52 | zoid@idsoftware.com 53 | 54 | -------------------------------------------------------------------------------- /linux/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 | -------------------------------------------------------------------------------- /linux/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 | -------------------------------------------------------------------------------- /linux/d_copy.s: -------------------------------------------------------------------------------- 1 | / 2 | // d_copy.s 3 | // x86 assembly-language screen copying code. 4 | // 5 | 6 | #include "qasm.h" 7 | 8 | .data 9 | 10 | LCopyWidth: .long 0 11 | LBlockSrcStep: .long 0 12 | LBlockDestStep: .long 0 13 | LSrcDelta: .long 0 14 | LDestDelta: .long 0 15 | 16 | #define bufptr 4+16 17 | 18 | // copies 16 rows per plane at a pop; idea is that 16*512 = 8k, and since 19 | // no Mode X mode is wider than 360, all the data should fit in the cache for 20 | // the passes for the next 3 planes 21 | 22 | .text 23 | 24 | .globl C(VGA_UpdatePlanarScreen) 25 | C(VGA_UpdatePlanarScreen): 26 | pushl %ebp // preserve caller's stack frame 27 | pushl %edi 28 | pushl %esi // preserve register variables 29 | pushl %ebx 30 | 31 | movl C(VGA_bufferrowbytes),%eax 32 | shll $1,%eax 33 | movl %eax,LBlockSrcStep 34 | movl C(VGA_rowbytes),%eax 35 | shll $1,%eax 36 | movl %eax,LBlockDestStep 37 | 38 | movl $0x3C4,%edx 39 | movb $2,%al 40 | outb %al,%dx // point the SC to the Map Mask 41 | incl %edx 42 | 43 | movl bufptr(%esp),%esi 44 | movl C(VGA_pagebase),%edi 45 | movl C(VGA_height),%ebp 46 | shrl $1,%ebp 47 | 48 | movl C(VGA_width),%ecx 49 | movl C(VGA_bufferrowbytes),%eax 50 | subl %ecx,%eax 51 | movl %eax,LSrcDelta 52 | movl C(VGA_rowbytes),%eax 53 | shll $2,%eax 54 | subl %ecx,%eax 55 | movl %eax,LDestDelta 56 | shrl $4,%ecx 57 | movl %ecx,LCopyWidth 58 | 59 | LRowLoop: 60 | movb $1,%al 61 | 62 | LPlaneLoop: 63 | outb %al,%dx 64 | movb $2,%ah 65 | 66 | pushl %esi 67 | pushl %edi 68 | LRowSetLoop: 69 | movl LCopyWidth,%ecx 70 | LColumnLoop: 71 | movb 12(%esi),%bh 72 | movb 8(%esi),%bl 73 | shll $16,%ebx 74 | movb 4(%esi),%bh 75 | movb (%esi),%bl 76 | movl %ebx,(%edi) 77 | addl $16,%esi 78 | addl $4,%edi 79 | decl %ecx 80 | jnz LColumnLoop 81 | 82 | addl LDestDelta,%edi 83 | addl LSrcDelta,%esi 84 | decb %ah 85 | jnz LRowSetLoop 86 | 87 | popl %edi 88 | popl %esi 89 | incl %esi 90 | 91 | shlb $1,%al 92 | cmpb $16,%al 93 | jnz LPlaneLoop 94 | 95 | subl $4,%esi 96 | addl LBlockSrcStep,%esi 97 | addl LBlockDestStep,%edi 98 | decl %ebp 99 | jnz LRowLoop 100 | 101 | popl %ebx // restore register variables 102 | popl %esi 103 | popl %edi 104 | popl %ebp // restore the caller's stack frame 105 | 106 | ret 107 | 108 | 109 | #define srcptr 4+16 110 | #define destptr 8+16 111 | #define width 12+16 112 | #define height 16+16 113 | #define srcrowbytes 20+16 114 | #define destrowbytes 24+16 115 | 116 | .globl C(VGA_UpdateLinearScreen) 117 | C(VGA_UpdateLinearScreen): 118 | pushl %ebp // preserve caller's stack frame 119 | pushl %edi 120 | pushl %esi // preserve register variables 121 | pushl %ebx 122 | 123 | cld 124 | movl srcptr(%esp),%esi 125 | movl destptr(%esp),%edi 126 | movl width(%esp),%ebx 127 | movl srcrowbytes(%esp),%eax 128 | subl %ebx,%eax 129 | movl destrowbytes(%esp),%edx 130 | subl %ebx,%edx 131 | shrl $2,%ebx 132 | movl height(%esp),%ebp 133 | LLRowLoop: 134 | movl %ebx,%ecx 135 | rep/movsl (%esi),(%edi) 136 | addl %eax,%esi 137 | addl %edx,%edi 138 | decl %ebp 139 | jnz LLRowLoop 140 | 141 | popl %ebx // restore register variables 142 | popl %esi 143 | popl %edi 144 | popl %ebp // restore the caller's stack frame 145 | 146 | ret 147 | 148 | -------------------------------------------------------------------------------- /linux/d_ifacea.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 | // d_ifacea.h 22 | // 23 | // Include file for asm driver interface. 24 | // 25 | 26 | // 27 | // !!! note that this file must match the corresponding C structures in 28 | // d_iface.h at all times !!! 29 | // 30 | 31 | // !!! if this is changed, it must be changed in r_shared.h too !!! 32 | #define ALIAS_ONSEAM 0x0020 33 | 34 | // !!! if this is changed, it must be changed in d_iface.h too !!! 35 | #define TURB_TEX_SIZE 64 // base turbulent texture size 36 | 37 | // !!! if this is changed, it must be changed in d_iface.h too !!! 38 | #define CYCLE 128 39 | 40 | // !!! if this is changed, it must be changed in r_shared.h too !!! 41 | #define MAXHEIGHT 1024 42 | 43 | // !!! if this is changed, it must be changed in quakedef.h too !!! 44 | #define CACHE_SIZE 32 // used to align key data structures 45 | 46 | // particle_t structure 47 | // !!! if this is changed, it must be changed in d_iface.h too !!! 48 | // driver-usable fields 49 | #define pt_org 0 50 | #define pt_color 12 51 | // drivers never touch the following fields 52 | #define pt_next 16 53 | #define pt_vel 20 54 | #define pt_ramp 32 55 | #define pt_die 36 56 | #define pt_type 40 57 | #define pt_size 44 58 | 59 | #define PARTICLE_Z_CLIP 8.0 60 | 61 | // finalvert_t structure 62 | // !!! if this is changed, it must be changed in d_iface.h too !!! 63 | #define fv_v 0 // !!! if this is moved, cases where the !!! 64 | // !!! address of this field is pushed in !!! 65 | // !!! d_polysa.s must be changed !!! 66 | #define fv_flags 24 67 | #define fv_reserved 28 68 | #define fv_size 32 69 | #define fv_shift 5 70 | 71 | 72 | // stvert_t structure 73 | // !!! if this is changed, it must be changed in modelgen.h too !!! 74 | #define stv_onseam 0 75 | #define stv_s 4 76 | #define stv_t 8 77 | #define stv_size 12 78 | 79 | 80 | // trivertx_t structure 81 | // !!! if this is changed, it must be changed in modelgen.h too !!! 82 | #define tv_v 0 83 | #define tv_lightnormalindex 3 84 | #define tv_size 4 85 | 86 | // affinetridesc_t structure 87 | // !!! if this is changed, it must be changed in d_iface.h too !!! 88 | #define atd_pskin 0 89 | #define atd_pskindesc 4 90 | #define atd_skinwidth 8 91 | #define atd_skinheight 12 92 | #define atd_ptriangles 16 93 | #define atd_pfinalverts 20 94 | #define atd_numtriangles 24 95 | #define atd_drawtype 28 96 | #define atd_seamfixupX16 32 97 | #define atd_size 36 98 | 99 | -------------------------------------------------------------------------------- /linux/glob.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 22 | #include "../linux/glob.h" 23 | 24 | /* Like glob_match, but match PATTERN against any final segment of TEXT. */ 25 | static int glob_match_after_star(char *pattern, char *text) 26 | { 27 | register char *p = pattern, *t = text; 28 | register char c, c1; 29 | 30 | while ((c = *p++) == '?' || c == '*') 31 | if (c == '?' && *t++ == '\0') 32 | return 0; 33 | 34 | if (c == '\0') 35 | return 1; 36 | 37 | if (c == '\\') 38 | c1 = *p; 39 | else 40 | c1 = c; 41 | 42 | while (1) { 43 | if ((c == '[' || *t == c1) && glob_match(p - 1, t)) 44 | return 1; 45 | if (*t++ == '\0') 46 | return 0; 47 | } 48 | } 49 | 50 | /* Return nonzero if PATTERN has any special globbing chars in it. */ 51 | static int glob_pattern_p(char *pattern) 52 | { 53 | register char *p = pattern; 54 | register char c; 55 | int open = 0; 56 | 57 | while ((c = *p++) != '\0') 58 | switch (c) { 59 | case '?': 60 | case '*': 61 | return 1; 62 | 63 | case '[': /* Only accept an open brace if there is a close */ 64 | open++; /* brace to match it. Bracket expressions must be */ 65 | continue; /* complete, according to Posix.2 */ 66 | case ']': 67 | if (open) 68 | return 1; 69 | continue; 70 | 71 | case '\\': 72 | if (*p++ == '\0') 73 | return 0; 74 | } 75 | 76 | return 0; 77 | } 78 | 79 | /* Match the pattern PATTERN against the string TEXT; 80 | return 1 if it matches, 0 otherwise. 81 | 82 | A match means the entire string TEXT is used up in matching. 83 | 84 | In the pattern string, `*' matches any sequence of characters, 85 | `?' matches any character, [SET] matches any character in the specified set, 86 | [!SET] matches any character not in the specified set. 87 | 88 | A set is composed of characters or ranges; a range looks like 89 | character hyphen character (as in 0-9 or A-Z). 90 | [0-9a-zA-Z_] is the set of characters allowed in C identifiers. 91 | Any other character in the pattern must be matched exactly. 92 | 93 | To suppress the special syntactic significance of any of `[]*?!-\', 94 | and match the character exactly, precede it with a `\'. 95 | */ 96 | 97 | int glob_match(char *pattern, char *text) 98 | { 99 | register char *p = pattern, *t = text; 100 | register char c; 101 | 102 | while ((c = *p++) != '\0') 103 | switch (c) { 104 | case '?': 105 | if (*t == '\0') 106 | return 0; 107 | else 108 | ++t; 109 | break; 110 | 111 | case '\\': 112 | if (*p++ != *t++) 113 | return 0; 114 | break; 115 | 116 | case '*': 117 | return glob_match_after_star(p, t); 118 | 119 | case '[': 120 | { 121 | register char c1 = *t++; 122 | int invert; 123 | 124 | if (!c1) 125 | return (0); 126 | 127 | invert = ((*p == '!') || (*p == '^')); 128 | if (invert) 129 | p++; 130 | 131 | c = *p++; 132 | while (1) { 133 | register char cstart = c, cend = c; 134 | 135 | if (c == '\\') { 136 | cstart = *p++; 137 | cend = cstart; 138 | } 139 | if (c == '\0') 140 | return 0; 141 | 142 | c = *p++; 143 | if (c == '-' && *p != ']') { 144 | cend = *p++; 145 | if (cend == '\\') 146 | cend = *p++; 147 | if (cend == '\0') 148 | return 0; 149 | c = *p++; 150 | } 151 | if (c1 >= cstart && c1 <= cend) 152 | goto match; 153 | if (c == ']') 154 | break; 155 | } 156 | if (!invert) 157 | return 0; 158 | break; 159 | 160 | match: 161 | /* Skip the rest of the [...] construct that already matched. */ 162 | while (c != ']') { 163 | if (c == '\0') 164 | return 0; 165 | c = *p++; 166 | if (c == '\0') 167 | return 0; 168 | else if (c == '\\') 169 | ++p; 170 | } 171 | if (invert) 172 | return 0; 173 | break; 174 | } 175 | 176 | default: 177 | if (c != *t++) 178 | return 0; 179 | } 180 | 181 | return *t == '\0'; 182 | } 183 | 184 | -------------------------------------------------------------------------------- /linux/glob.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 | int glob_match(char *pattern, char *text); 21 | -------------------------------------------------------------------------------- /linux/glw_linux.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 | #ifndef __linux__ 21 | #error You shouldnt be including this file on non-Linux platforms 22 | #endif 23 | 24 | #ifndef __GLW_LINUX_H__ 25 | #define __GLW_LINUX_H__ 26 | 27 | typedef struct 28 | { 29 | void *OpenGLLib; // instance of OpenGL library 30 | 31 | FILE *log_fp; 32 | } glwstate_t; 33 | 34 | extern glwstate_t glw_state; 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /linux/in_linux.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 | // in_null.c -- for systems without a mouse 21 | 22 | #include "../client/client.h" 23 | 24 | cvar_t *in_mouse; 25 | cvar_t *in_joystick; 26 | 27 | void IN_Init (void) 28 | { 29 | in_mouse = Cvar_Get ("in_mouse", "1", CVAR_ARCHIVE); 30 | in_joystick = Cvar_Get ("in_joystick", "0", CVAR_ARCHIVE); 31 | } 32 | 33 | void IN_Shutdown (void) 34 | { 35 | } 36 | 37 | void IN_Commands (void) 38 | { 39 | } 40 | 41 | void IN_Move (usercmd_t *cmd) 42 | { 43 | } 44 | 45 | void IN_Activate (qboolean active) 46 | { 47 | } 48 | 49 | -------------------------------------------------------------------------------- /linux/quake2.3dfxgl: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | LD_PRELOAD="./lib3dfxgl.so /usr/lib/libglide2x.so" ./quake2 +set vid_ref gl $* 3 | -------------------------------------------------------------------------------- /linux/quake2.axp.spec.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Generate q2ded.spec 3 | # $1 is version 4 | # $2 is release 5 | # $3 is arch 6 | # $4 is install dir (assumed to be in /var/tmp) 7 | cat < 18 | URL: http://www.idsoftware.com/ 19 | Source: q2ded-%{version}.tar.gz 20 | Group: Games 21 | Copyright: Restricted 22 | Icon: quake2.gif 23 | BuildRoot: /var/tmp/%{name}-%{version} 24 | Summary: Quake2 Dedicated Server for Linux 25 | 26 | %description 27 | 28 | Quake2 29 | 30 | Shortly after landing on an alien surface you learn that hundreds of your men 31 | have been reduced to just a few. Now you must fight your way through heavily 32 | fortified military installations, lower the city's defenses and shut down 33 | the enemy's war machine. Only then will the fate of humanity be known. 34 | 35 | LARGER, MISSION-BASED LEVELS 36 | 37 | You have a series of complex missions, what you do in one level could affect 38 | another. One false move and you could alert security, flood an entire 39 | passageway, or worse. 40 | 41 | SUPERIOR ARTIFICIAL INTELLIGENCE 42 | 43 | This time the enemy has IQs the size of their appetites. The can evade your 44 | attack, strategically position themselves for an ambush and hunt your ass 45 | down. 46 | 47 | IN-YOUR-FACE SOUND AND GRAPHICS 48 | 49 | hear distant combat explosions and rockets whizzing past your head. And with 50 | a compatible 3-D graphics accelerator, experience smoother 16-bit graphics and 51 | real-time lighting effects. 52 | 53 | WICKED MULTIPLAYER CAPABILITIES 54 | 55 | More than 32 players, friends or foes, can do at it in a bloody deathmatch via 56 | LAN and over the internet. 57 | 58 | ---- 59 | 60 | This archive contains a Quake2 dedicated server for Linux Alpha based systems. 61 | 62 | %install 63 | 64 | %files 65 | 66 | %attr(644,root,root) $4/README 67 | %attr(644,root,root) $4/readme.txt 68 | %attr(644,root,root) $4/3.20_Changes.txt 69 | %attr(755,root,root) $4/q2ded 70 | %attr(755,root,root) $4/baseq2/game%{arch}.so 71 | # %attr(755,root,root) $4/ctf/game%{arch}.so 72 | %attr(755,root,root) $4/xatrix/game%{arch}.so 73 | %attr(755,root,root) $4/rogue/game%{arch}.so 74 | EOF 75 | 76 | -------------------------------------------------------------------------------- /linux/quake2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sebh/QuakeIIDXXII/52b83821fa02d9a8b662805bad1a9b9c59bd716f/linux/quake2.gif -------------------------------------------------------------------------------- /linux/r_scana.s: -------------------------------------------------------------------------------- 1 | // 2 | // d_scana.s 3 | // x86 assembly-language turbulent texture mapping code 4 | // 5 | 6 | #include "qasm.h" 7 | #include "d_ifacea.h" 8 | 9 | #if id386 10 | 11 | .data 12 | 13 | .text 14 | 15 | //---------------------------------------------------------------------- 16 | // turbulent texture mapping code 17 | //---------------------------------------------------------------------- 18 | 19 | .align 4 20 | .globl C(D_DrawTurbulent8Span) 21 | C(D_DrawTurbulent8Span): 22 | pushl %ebp // preserve caller's stack frame pointer 23 | pushl %esi // preserve register variables 24 | pushl %edi 25 | pushl %ebx 26 | 27 | movl C(r_turb_s),%esi 28 | movl C(r_turb_t),%ecx 29 | movl C(r_turb_pdest),%edi 30 | movl C(r_turb_spancount),%ebx 31 | 32 | Llp: 33 | movl %ecx,%eax 34 | movl %esi,%edx 35 | sarl $16,%eax 36 | movl C(r_turb_turb),%ebp 37 | sarl $16,%edx 38 | andl $(CYCLE-1),%eax 39 | andl $(CYCLE-1),%edx 40 | movl (%ebp,%eax,4),%eax 41 | movl (%ebp,%edx,4),%edx 42 | addl %esi,%eax 43 | sarl $16,%eax 44 | addl %ecx,%edx 45 | sarl $16,%edx 46 | andl $(TURB_TEX_SIZE-1),%eax 47 | andl $(TURB_TEX_SIZE-1),%edx 48 | shll $6,%edx 49 | movl C(r_turb_pbase),%ebp 50 | addl %eax,%edx 51 | incl %edi 52 | addl C(r_turb_sstep),%esi 53 | addl C(r_turb_tstep),%ecx 54 | movb (%ebp,%edx,1),%dl 55 | decl %ebx 56 | movb %dl,-1(%edi) 57 | jnz Llp 58 | 59 | movl %edi,C(r_turb_pdest) 60 | 61 | popl %ebx // restore register variables 62 | popl %edi 63 | popl %esi 64 | popl %ebp // restore caller's stack frame pointer 65 | ret 66 | 67 | #endif // id386 68 | 69 | -------------------------------------------------------------------------------- /linux/rw_linux.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 | typedef void (*Key_Event_fp_t)(int key, qboolean down); 23 | 24 | extern void (*KBD_Update_fp)(void); 25 | extern void (*KBD_Init_fp)(Key_Event_fp_t fp); 26 | extern void (*KBD_Close_fp)(void); 27 | 28 | typedef struct in_state { 29 | // Pointers to functions back in client, set by vid_so 30 | void (*IN_CenterView_fp)(void); 31 | Key_Event_fp_t Key_Event_fp; 32 | vec_t *viewangles; 33 | int *in_strafe_state; 34 | } in_state_t; 35 | 36 | -------------------------------------------------------------------------------- /linux/sys_dosa.s: -------------------------------------------------------------------------------- 1 | // 2 | // sys_dosa.s 3 | // x86 assembly-language DOS-dependent routines. 4 | 5 | #include "qasm.h" 6 | 7 | 8 | .data 9 | 10 | .align 4 11 | fpenv: 12 | .long 0, 0, 0, 0, 0, 0, 0, 0 13 | 14 | .text 15 | 16 | .globl C(MaskExceptions) 17 | C(MaskExceptions): 18 | fnstenv fpenv 19 | orl $0x3F,fpenv 20 | fldenv fpenv 21 | 22 | ret 23 | 24 | #if 0 25 | .globl C(unmaskexceptions) 26 | C(unmaskexceptions): 27 | fnstenv fpenv 28 | andl $0xFFFFFFE0,fpenv 29 | fldenv fpenv 30 | 31 | ret 32 | #endif 33 | 34 | .data 35 | 36 | .align 4 37 | .globl ceil_cw, single_cw, full_cw, cw, pushed_cw 38 | ceil_cw: .long 0 39 | single_cw: .long 0 40 | full_cw: .long 0 41 | cw: .long 0 42 | pushed_cw: .long 0 43 | 44 | .text 45 | 46 | .globl C(Sys_LowFPPrecision) 47 | C(Sys_LowFPPrecision): 48 | fldcw single_cw 49 | 50 | ret 51 | 52 | .globl C(Sys_HighFPPrecision) 53 | C(Sys_HighFPPrecision): 54 | fldcw full_cw 55 | 56 | ret 57 | 58 | .globl C(Sys_PushFPCW_SetHigh) 59 | C(Sys_PushFPCW_SetHigh): 60 | fnstcw pushed_cw 61 | fldcw full_cw 62 | 63 | ret 64 | 65 | .globl C(Sys_PopFPCW) 66 | C(Sys_PopFPCW): 67 | fldcw pushed_cw 68 | 69 | ret 70 | 71 | .globl C(Sys_SetFPCW) 72 | C(Sys_SetFPCW): 73 | fnstcw cw 74 | movl cw,%eax 75 | #if id386 76 | andb $0xF0,%ah 77 | orb $0x03,%ah // round mode, 64-bit precision 78 | #endif 79 | movl %eax,full_cw 80 | 81 | #if id386 82 | andb $0xF0,%ah 83 | orb $0x0C,%ah // chop mode, single precision 84 | #endif 85 | movl %eax,single_cw 86 | 87 | #if id386 88 | andb $0xF0,%ah 89 | orb $0x08,%ah // ceil mode, single precision 90 | #endif 91 | movl %eax,ceil_cw 92 | 93 | ret 94 | 95 | -------------------------------------------------------------------------------- /null/cd_null.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 "../client/client.h" 21 | 22 | void CDAudio_Play(int track, qboolean looping) 23 | { 24 | } 25 | 26 | 27 | void CDAudio_Stop(void) 28 | { 29 | } 30 | 31 | 32 | void CDAudio_Resume(void) 33 | { 34 | } 35 | 36 | 37 | void CDAudio_Update(void) 38 | { 39 | } 40 | 41 | 42 | int CDAudio_Init(void) 43 | { 44 | return 0; 45 | } 46 | 47 | 48 | void CDAudio_Shutdown(void) 49 | { 50 | } 51 | -------------------------------------------------------------------------------- /null/cl_null.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 | // cl_null.c -- this file can stub out the entire client system 22 | // for pure dedicated servers 23 | 24 | #include "../qcommon/qcommon.h" 25 | 26 | void Key_Bind_Null_f(void) 27 | { 28 | } 29 | 30 | void CL_Init (void) 31 | { 32 | } 33 | 34 | void CL_Drop (void) 35 | { 36 | } 37 | 38 | void CL_Shutdown (void) 39 | { 40 | } 41 | 42 | void CL_Frame (int msec) 43 | { 44 | } 45 | 46 | void Con_Print (char *text) 47 | { 48 | } 49 | 50 | void Cmd_ForwardToServer (void) 51 | { 52 | char *cmd; 53 | 54 | cmd = Cmd_Argv(0); 55 | Com_Printf ("Unknown command \"%s\"\n", cmd); 56 | } 57 | 58 | void SCR_DebugGraph (float value, int color) 59 | { 60 | } 61 | 62 | void SCR_BeginLoadingPlaque (void) 63 | { 64 | } 65 | 66 | void SCR_EndLoadingPlaque (void) 67 | { 68 | } 69 | 70 | void Key_Init (void) 71 | { 72 | Cmd_AddCommand ("bind", Key_Bind_Null_f); 73 | } 74 | 75 | -------------------------------------------------------------------------------- /null/glimp_null.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 "../ref_gl/gl_local.h" 21 | 22 | void GLimp_BeginFrame( float camera_separation ) 23 | { 24 | } 25 | 26 | void GLimp_EndFrame( void ) 27 | { 28 | } 29 | 30 | int GLimp_Init( void *hinstance, void *hWnd ) 31 | { 32 | } 33 | 34 | void GLimp_Shutdown( void ) 35 | { 36 | } 37 | 38 | int GLimp_SetMode( int *pwidth, int *pheight, int mode, qboolean fullscreen ) 39 | { 40 | } 41 | 42 | void GLimp_AppActivate( qboolean active ) 43 | { 44 | } 45 | 46 | void GLimp_EnableLogging( qboolean enable ) 47 | { 48 | } 49 | 50 | void GLimp_LogNewFrame( void ) 51 | { 52 | } 53 | 54 | -------------------------------------------------------------------------------- /null/in_null.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 | // in_null.c -- for systems without a mouse 21 | 22 | #include "../client/client.h" 23 | 24 | void IN_Init (void) 25 | { 26 | } 27 | 28 | void IN_Shutdown (void) 29 | { 30 | } 31 | 32 | void IN_Commands (void) 33 | { 34 | } 35 | 36 | void IN_Frame (void) 37 | { 38 | } 39 | 40 | void IN_Move (usercmd_t *cmd) 41 | { 42 | } 43 | 44 | void IN_Activate (qboolean active) 45 | { 46 | } 47 | 48 | void IN_ActivateMouse (void) 49 | { 50 | } 51 | 52 | void IN_DeactivateMouse (void) 53 | { 54 | } 55 | 56 | -------------------------------------------------------------------------------- /null/snddma_null.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 | // snddma_null.c 22 | // all other sound mixing is portable 23 | 24 | #include "../client/client.h" 25 | #include "../client/snd_loc.h" 26 | 27 | qboolean SNDDMA_Init(void) 28 | { 29 | return false; 30 | } 31 | 32 | int SNDDMA_GetDMAPos(void) 33 | { 34 | return 0; 35 | } 36 | 37 | void SNDDMA_Shutdown(void) 38 | { 39 | } 40 | 41 | void SNDDMA_BeginPainting (void) 42 | { 43 | } 44 | 45 | void SNDDMA_Submit(void) 46 | { 47 | } 48 | -------------------------------------------------------------------------------- /null/swimp_null.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 "../ref_soft/r_local.h" 21 | 22 | void SWimp_BeginFrame( float camera_separation ) 23 | { 24 | } 25 | 26 | void SWimp_EndFrame (void) 27 | { 28 | } 29 | 30 | int SWimp_Init( void *hInstance, void *wndProc ) 31 | { 32 | } 33 | 34 | void SWimp_SetPalette( const unsigned char *palette) 35 | { 36 | } 37 | 38 | void SWimp_Shutdown( void ) 39 | { 40 | } 41 | 42 | rserr_t SWimp_SetMode( int *pwidth, int *pheight, int mode, qboolean fullscreen ) 43 | { 44 | } 45 | 46 | void SWimp_AppActivate( qboolean active ) 47 | { 48 | } 49 | 50 | -------------------------------------------------------------------------------- /null/sys_null.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 | // sys_null.h -- null system driver to aid porting efforts 21 | 22 | #include "../qcommon/qcommon.h" 23 | #include "errno.h" 24 | 25 | int curtime; 26 | 27 | unsigned sys_frame_time; 28 | 29 | 30 | void Sys_mkdir (char *path) 31 | { 32 | } 33 | 34 | void Sys_Error (char *error, ...) 35 | { 36 | va_list argptr; 37 | 38 | printf ("Sys_Error: "); 39 | va_start (argptr,error); 40 | vprintf (error,argptr); 41 | va_end (argptr); 42 | printf ("\n"); 43 | 44 | exit (1); 45 | } 46 | 47 | void Sys_Quit (void) 48 | { 49 | exit (0); 50 | } 51 | 52 | void Sys_UnloadGame (void) 53 | { 54 | } 55 | 56 | void *Sys_GetGameAPI (void *parms) 57 | { 58 | return NULL; 59 | } 60 | 61 | char *Sys_ConsoleInput (void) 62 | { 63 | return NULL; 64 | } 65 | 66 | void Sys_ConsoleOutput (char *string) 67 | { 68 | } 69 | 70 | void Sys_SendKeyEvents (void) 71 | { 72 | } 73 | 74 | void Sys_AppActivate (void) 75 | { 76 | } 77 | 78 | void Sys_CopyProtect (void) 79 | { 80 | } 81 | 82 | char *Sys_GetClipboardData( void ) 83 | { 84 | return NULL; 85 | } 86 | 87 | void *Hunk_Begin (int maxsize) 88 | { 89 | return NULL; 90 | } 91 | 92 | void *Hunk_Alloc (int size) 93 | { 94 | return NULL; 95 | } 96 | 97 | void Hunk_Free (void *buf) 98 | { 99 | } 100 | 101 | int Hunk_End (void) 102 | { 103 | return 0; 104 | } 105 | 106 | int Sys_Milliseconds (void) 107 | { 108 | return 0; 109 | } 110 | 111 | void Sys_Mkdir (char *path) 112 | { 113 | } 114 | 115 | char *Sys_FindFirst (char *path, unsigned musthave, unsigned canthave) 116 | { 117 | return NULL; 118 | } 119 | 120 | char *Sys_FindNext (unsigned musthave, unsigned canthave) 121 | { 122 | return NULL; 123 | } 124 | 125 | void Sys_FindClose (void) 126 | { 127 | } 128 | 129 | void Sys_Init (void) 130 | { 131 | } 132 | 133 | 134 | //============================================================================= 135 | 136 | void main (int argc, char **argv) 137 | { 138 | Qcommon_Init (argc, argv); 139 | 140 | while (1) 141 | { 142 | Qcommon_Frame (0.1); 143 | } 144 | } 145 | 146 | 147 | -------------------------------------------------------------------------------- /null/vid_null.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 | // vid_null.c -- null video driver to aid porting efforts 21 | // this assumes that one of the refs is statically linked to the executable 22 | 23 | #include "../client/client.h" 24 | 25 | viddef_t viddef; // global video state 26 | 27 | refexport_t re; 28 | 29 | refexport_t GetRefAPI (refimport_t rimp); 30 | 31 | /* 32 | ========================================================================== 33 | 34 | DIRECT LINK GLUE 35 | 36 | ========================================================================== 37 | */ 38 | 39 | #define MAXPRINTMSG 4096 40 | void VID_Printf (int print_level, char *fmt, ...) 41 | { 42 | va_list argptr; 43 | char msg[MAXPRINTMSG]; 44 | 45 | va_start (argptr,fmt); 46 | vsprintf (msg,fmt,argptr); 47 | va_end (argptr); 48 | 49 | if (print_level == PRINT_ALL) 50 | Com_Printf ("%s", msg); 51 | else 52 | Com_DPrintf ("%s", msg); 53 | } 54 | 55 | void VID_Error (int err_level, char *fmt, ...) 56 | { 57 | va_list argptr; 58 | char msg[MAXPRINTMSG]; 59 | 60 | va_start (argptr,fmt); 61 | vsprintf (msg,fmt,argptr); 62 | va_end (argptr); 63 | 64 | Com_Error (err_level, "%s", msg); 65 | } 66 | 67 | void VID_NewWindow (int width, int height) 68 | { 69 | viddef.width = width; 70 | viddef.height = height; 71 | } 72 | 73 | /* 74 | ** VID_GetModeInfo 75 | */ 76 | typedef struct vidmode_s 77 | { 78 | const char *description; 79 | int width, height; 80 | int mode; 81 | } vidmode_t; 82 | 83 | vidmode_t vid_modes[] = 84 | { 85 | { "Mode 0: 320x240", 320, 240, 0 }, 86 | { "Mode 1: 400x300", 400, 300, 1 }, 87 | { "Mode 2: 512x384", 512, 384, 2 }, 88 | { "Mode 3: 640x480", 640, 480, 3 }, 89 | { "Mode 4: 800x600", 800, 600, 4 }, 90 | { "Mode 5: 960x720", 960, 720, 5 }, 91 | { "Mode 6: 1024x768", 1024, 768, 6 }, 92 | { "Mode 7: 1152x864", 1152, 864, 7 }, 93 | { "Mode 8: 1280x960", 1280, 960, 8 }, 94 | { "Mode 9: 1600x1200", 1600, 1200, 9 }, 95 | { "Mode 10: 2048x1536", 2048, 1536, 10 } 96 | }; 97 | #define VID_NUM_MODES ( sizeof( vid_modes ) / sizeof( vid_modes[0] ) ) 98 | 99 | qboolean VID_GetModeInfo( int *width, int *height, int mode ) 100 | { 101 | if ( mode < 0 || mode >= VID_NUM_MODES ) 102 | return false; 103 | 104 | *width = vid_modes[mode].width; 105 | *height = vid_modes[mode].height; 106 | 107 | return true; 108 | } 109 | 110 | 111 | void VID_Init (void) 112 | { 113 | refimport_t ri; 114 | 115 | viddef.width = 320; 116 | viddef.height = 240; 117 | 118 | ri.Cmd_AddCommand = Cmd_AddCommand; 119 | ri.Cmd_RemoveCommand = Cmd_RemoveCommand; 120 | ri.Cmd_Argc = Cmd_Argc; 121 | ri.Cmd_Argv = Cmd_Argv; 122 | ri.Cmd_ExecuteText = Cbuf_ExecuteText; 123 | ri.Con_Printf = VID_Printf; 124 | ri.Sys_Error = VID_Error; 125 | ri.FS_LoadFile = FS_LoadFile; 126 | ri.FS_FreeFile = FS_FreeFile; 127 | ri.FS_Gamedir = FS_Gamedir; 128 | ri.Vid_NewWindow = VID_NewWindow; 129 | ri.Cvar_Get = Cvar_Get; 130 | ri.Cvar_Set = Cvar_Set; 131 | ri.Cvar_SetValue = Cvar_SetValue; 132 | ri.Vid_GetModeInfo = VID_GetModeInfo; 133 | 134 | re = GetRefAPI(ri); 135 | 136 | if (re.api_version != API_VERSION) 137 | Com_Error (ERR_FATAL, "Re has incompatible api_version"); 138 | 139 | // call the init function 140 | if (re.Init (NULL, NULL) == -1) 141 | Com_Error (ERR_FATAL, "Couldn't start refresh"); 142 | } 143 | 144 | void VID_Shutdown (void) 145 | { 146 | if (re.Shutdown) 147 | re.Shutdown (); 148 | } 149 | 150 | void VID_CheckChanges (void) 151 | { 152 | } 153 | 154 | void VID_MenuInit (void) 155 | { 156 | } 157 | 158 | void VID_MenuDraw (void) 159 | { 160 | } 161 | 162 | const char *VID_MenuKey( int k) 163 | { 164 | return NULL; 165 | } 166 | -------------------------------------------------------------------------------- /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 | /* 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.h */ 21 | 22 | void CRC_Init(unsigned short *crcvalue); 23 | void CRC_ProcessByte(unsigned short *crcvalue, byte data); 24 | unsigned short CRC_Value(unsigned short crcvalue); 25 | unsigned short CRC_Block (byte *start, int count); 26 | -------------------------------------------------------------------------------- /quake2.dsw: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 6.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | 4 | ############################################################################### 5 | 6 | Project: "ctf"=.\ctf\ctf.dsp - Package Owner=<4> 7 | 8 | Package=<5> 9 | {{{ 10 | }}} 11 | 12 | Package=<4> 13 | {{{ 14 | }}} 15 | 16 | ############################################################################### 17 | 18 | Project: "game"=.\game\game.dsp - Package Owner=<4> 19 | 20 | Package=<5> 21 | {{{ 22 | }}} 23 | 24 | Package=<4> 25 | {{{ 26 | }}} 27 | 28 | ############################################################################### 29 | 30 | Project: "quake2"=.\quake2.dsp - Package Owner=<4> 31 | 32 | Package=<5> 33 | {{{ 34 | }}} 35 | 36 | Package=<4> 37 | {{{ 38 | Begin Project Dependency 39 | Project_Dep_Name ctf 40 | End Project Dependency 41 | Begin Project Dependency 42 | Project_Dep_Name game 43 | End Project Dependency 44 | Begin Project Dependency 45 | Project_Dep_Name ref_gl 46 | End Project Dependency 47 | }}} 48 | 49 | ############################################################################### 50 | 51 | Project: "ref_gl"=.\ref_gl\ref_gl.dsp - Package Owner=<4> 52 | 53 | Package=<5> 54 | {{{ 55 | }}} 56 | 57 | Package=<4> 58 | {{{ 59 | }}} 60 | 61 | ############################################################################### 62 | 63 | Project: "ref_soft"=.\ref_soft\ref_soft.dsp - Package Owner=<4> 64 | 65 | Package=<5> 66 | {{{ 67 | }}} 68 | 69 | Package=<4> 70 | {{{ 71 | }}} 72 | 73 | ############################################################################### 74 | 75 | Global: 76 | 77 | Package=<5> 78 | {{{ 79 | }}} 80 | 81 | Package=<3> 82 | {{{ 83 | }}} 84 | 85 | ############################################################################### 86 | 87 | -------------------------------------------------------------------------------- /quake2.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | D:\Projects\Git\QuakeIIDXXII\QUAKE2DATA 5 | WindowsLocalDebugger 6 | 7 | 8 | D:\Projects\Git\QuakeIIDXXII\QUAKE2DATA 9 | WindowsLocalDebugger 10 | 11 | 12 | D:\Projects\Git\QuakeIIDXXII\QUAKE2DATA 13 | WindowsLocalDebugger 14 | 15 | 16 | D:\Projects\Git\QuakeIIDXXII\QUAKE2DATA 17 | WindowsLocalDebugger 18 | 19 | 20 | D:\Projects\Git\QuakeIIDXXII\QUAKE2DATA 21 | WindowsLocalDebugger 22 | 23 | 24 | D:\Projects\Git\QuakeIIDXXII\QUAKE2DATA 25 | WindowsLocalDebugger 26 | 27 | 28 | D:\Projects\Git\QuakeIIDXXII\QUAKE2DATA 29 | WindowsLocalDebugger 30 | 31 | 32 | D:\Projects\Git\QuakeIIDXXII\QUAKE2DATA 33 | WindowsLocalDebugger 34 | 35 | 36 | D:\Projects\Git\QuakeIIDXXII\QUAKE2DATA 37 | WindowsLocalDebugger 38 | 39 | 40 | D:\Projects\Git\QuakeIIDXXII\QUAKE2DATA 41 | WindowsLocalDebugger 42 | 43 | -------------------------------------------------------------------------------- /readme.txt: -------------------------------------------------------------------------------- 1 | 2 | This is the complete source code for Quake 2, version 3.21, 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_dx12/.gitattributes: -------------------------------------------------------------------------------- 1 | *.cpp diff 2 | *.h diff 3 | *.md diff -------------------------------------------------------------------------------- /ref_dx12/Dx12Math.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "DirectXMath.h" 4 | using namespace DirectX; 5 | 6 | 7 | 8 | typedef signed char s8; 9 | typedef unsigned char u8; 10 | //typedef unsigned char byte; 11 | 12 | typedef unsigned int uint; 13 | typedef int sint; 14 | 15 | typedef UINT64 uint64; 16 | typedef INT64 sint64; 17 | 18 | typedef short word; 19 | typedef uint dword; 20 | 21 | typedef XMMATRIX float4x4; 22 | typedef XMVECTOR float4; 23 | 24 | 25 | 26 | const float Pi = 3.14159265359f; 27 | 28 | 29 | 30 | template 31 | inline T Clamp(T x, T MinX, T MaxX) 32 | { 33 | return x > MaxX ? MaxX : (x < MinX ? MinX : x); 34 | } 35 | 36 | template 37 | inline T Sqr(T x) { return x * x; } 38 | 39 | inline float Saturate(float x) 40 | { 41 | return x > 1.0f ? 1.0f : (x < 0.0f ? 0.0f : x); 42 | } 43 | 44 | inline float Lerp(float a, float b, float x) 45 | { 46 | return a + Saturate(x) * (b - a); 47 | } 48 | 49 | inline float DegToRad(float deg) 50 | { 51 | return deg / 180.0f * Pi; 52 | } 53 | 54 | inline float RadToDeg(float rad) 55 | { 56 | return rad * 180.0f / Pi; 57 | } 58 | 59 | inline uint RoundUp(uint Value, uint Alignement) 60 | { 61 | uint Var = Value + Alignement - 1; 62 | return Alignement * (Var / Alignement); 63 | } 64 | 65 | inline uint64 RoundUp(uint64 Value, uint64 Alignement) 66 | { 67 | uint64 Var = Value + Alignement - 1; 68 | return Alignement * (Var / Alignement); 69 | } 70 | 71 | 72 | -------------------------------------------------------------------------------- /ref_dx12/Dx12Utilities.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Dx12Device.h" 4 | 5 | 6 | 7 | 8 | class RenderBufferGenericDynamic 9 | { 10 | public: 11 | RenderBufferGenericDynamic( 12 | uint64 TotalSizeInBytes, D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE); 13 | virtual ~RenderBufferGenericDynamic(); 14 | 15 | void* Map(); 16 | void UnmapAndUpload(); 17 | 18 | RenderBufferGeneric& getRenderBuffer() { return mRenderBuffer; } 19 | 20 | protected: 21 | 22 | private: 23 | RenderBufferGenericDynamic(); 24 | RenderBufferGenericDynamic(RenderBufferGenericDynamic&); 25 | 26 | RenderBufferGeneric* mFrameUploadBuffers[frameBufferCount]; 27 | RenderBufferGeneric mRenderBuffer; 28 | }; 29 | 30 | 31 | 32 | 33 | //////////////////////////////////////////////////////////////////////////////////////////////////// 34 | //////////////////////////////////////////////////////////////////////////////////////////////////// 35 | //////////////////////////////////////////////////////////////////////////////////////////////////// 36 | 37 | 38 | 39 | 40 | class RenderTextureDynamic 41 | { 42 | public: 43 | RenderTextureDynamic( 44 | unsigned int width, unsigned int height, 45 | unsigned int depth, DXGI_FORMAT format, 46 | D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE); 47 | virtual ~RenderTextureDynamic(); 48 | 49 | // Map and Unmpap have not been tested so far 50 | void* Map(); 51 | void UnmapAndUpload(); 52 | 53 | void Upload(void* DataPtr, unsigned int RowPitchByte, unsigned int SlicePitchByte); 54 | 55 | UINT64 getWidth() { return mRenderTexture.getD3D12Resource()->GetDesc().Width; } 56 | UINT64 getHeight() { return mRenderTexture.getD3D12Resource()->GetDesc().Height; } 57 | RenderTexture& getRenderTexture() { return mRenderTexture; } 58 | 59 | protected: 60 | 61 | private: 62 | RenderTextureDynamic(); 63 | RenderTextureDynamic(RenderTextureDynamic&); 64 | 65 | unsigned int mInitDataCopySizeByte = 0; 66 | unsigned int mRowPitchByte = 0; 67 | unsigned int mSlicePitchByte = 0; 68 | 69 | ID3D12Resource* mFrameUploadTextures[frameBufferCount]; 70 | RenderTexture mRenderTexture; 71 | }; 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /ref_dx12/Shaders/ImageDrawShader.hlsl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #include "StaticSamplers.hlsl" 5 | 6 | 7 | 8 | #if TESTSHADER 9 | 10 | struct VertexOutput 11 | { 12 | float4 position : SV_POSITION; 13 | float2 uv : TEXCOORD0; 14 | }; 15 | 16 | VertexOutput FullScreenTriangleVertexShader(uint VertexID : SV_VertexID) 17 | { 18 | VertexOutput output; // TODO init to 0 19 | 20 | output.position = float4(VertexID == 2 ? 3.0 : -1.0, VertexID == 1 ? 3.0 : -1.0, 0.1, 1.0); 21 | output.uv = (output.position.xy + 1.0) * 0.25; 22 | 23 | return output; 24 | } 25 | 26 | float4 UvPixelShader(VertexOutput input) : SV_TARGET 27 | { 28 | return float4(input.uv, 0, 0); 29 | } 30 | 31 | #endif // TESTSHADER 32 | 33 | 34 | 35 | #if COLORDRAWSHADER 36 | 37 | cbuffer ImageDrawConstantBuffer : register(b0) 38 | { 39 | float4 ColorAlpha; 40 | } 41 | 42 | float4 ColorDrawPixelShader() : SV_TARGET 43 | { 44 | return ColorAlpha; 45 | } 46 | 47 | #endif // DRAW2DSHADER 48 | 49 | 50 | 51 | #if DRAWIMAGESHADER 52 | 53 | cbuffer ImageConstantBuffer : register(b0) 54 | { 55 | float2 OutputWidthAndInv; 56 | float2 OutputHeightAndInv; 57 | } 58 | 59 | 60 | 61 | struct VertexInput 62 | { 63 | float2 Position : POSITION; 64 | float2 SurfaceUV : TEXCOORD0; 65 | float4 ColorAlpha : TEXCOORD1; 66 | }; 67 | 68 | struct VertexOutput 69 | { 70 | float4 Position : SV_POSITION; 71 | float2 SurfaceUV : TEXCOORD0; 72 | float4 ColorAlpha : TEXCOORD2; 73 | }; 74 | 75 | Texture2D SurfaceTexture : register(t0); 76 | 77 | 78 | 79 | VertexOutput ColoredImageVertexShader(VertexInput Input, uint VertexID : SV_VertexID) 80 | { 81 | VertexOutput output; 82 | 83 | output.Position = float4(Input.Position * float2(OutputWidthAndInv.y, OutputHeightAndInv.y) * float2(2.0f, -2.0f) + float2(-1.0, 1.0), 0.1, 1.0); 84 | output.SurfaceUV = Input.SurfaceUV; 85 | output.ColorAlpha = Input.ColorAlpha; 86 | 87 | return output; 88 | } 89 | 90 | float4 ColoredImagePixelShader(VertexOutput Input) : SV_TARGET 91 | { 92 | return Input.ColorAlpha * SurfaceTexture.Sample(SamplerLinearRepeat, Input.SurfaceUV); 93 | } 94 | 95 | #endif // DRAWIMAGESHADER 96 | -------------------------------------------------------------------------------- /ref_dx12/Shaders/ParticleDrawShader.hlsl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #include "StaticSamplers.hlsl" 5 | 6 | 7 | 8 | cbuffer ParticleConstantBuffer : register(b0) 9 | { 10 | float4x4 ViewProjectionMatrix; 11 | float4 ViewRight; 12 | float4 ViewUp; 13 | float ParticleSize; 14 | float Pad0[3]; 15 | } 16 | 17 | 18 | 19 | struct VertexInput 20 | { 21 | float3 Position : POSITION; 22 | float4 ColorAlpha : TEXCOORD0; 23 | }; 24 | 25 | struct VertexOutput 26 | { 27 | float4 Position : SV_POSITION; 28 | float4 ColorAlpha : TEXCOORD0; 29 | float2 UV : TEXCOORD1; 30 | }; 31 | 32 | 33 | VertexOutput ParticleVertexShader(VertexInput Input, uint VertexID : SV_VertexID) 34 | { 35 | VertexOutput Output; 36 | 37 | float2 Norm2d = float2((VertexID == 1 || VertexID == 4 || VertexID == 5) ? 1.0 : 0.0, (VertexID == 2 || VertexID == 3 || VertexID == 5) ? 1.0 : 0.0) * 2.0f - 1.0f; 38 | const float3 PosOffset = ParticleSize * 0.5 * (Norm2d.x * ViewRight.xyz + Norm2d.y * ViewUp.xyz); 39 | 40 | Output.Position = mul(ViewProjectionMatrix, float4(Input.Position.xyz + PosOffset, 1.0f)); 41 | Output.ColorAlpha = Input.ColorAlpha; 42 | Output.UV = Norm2d; 43 | 44 | return Output; 45 | } 46 | 47 | float4 ParticlePixelShader(VertexOutput Input) : SV_TARGET 48 | { 49 | const float Gradient = dot(Input.UV,Input.UV); 50 | return float4(Input.ColorAlpha.rgb, Input.ColorAlpha.a * (Gradient > 1.0f ? 0.0f : saturate((1.0 - Gradient)*3.0f))); 51 | } 52 | 53 | 54 | -------------------------------------------------------------------------------- /ref_dx12/Shaders/SkyShader.hlsl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #include "StaticSamplers.hlsl" 5 | 6 | 7 | 8 | cbuffer SkyConstantBuffer : register(b0) 9 | { 10 | //float4x4 MeshWorldMatrix; 11 | float4x4 ViewProjectionMatrix; 12 | uint Face; 13 | uint3 pad0; 14 | } 15 | 16 | Texture2D SkyFaceTexture : register(t0); 17 | 18 | struct VertexOutput 19 | { 20 | float4 position : SV_POSITION; 21 | float2 uv : TEXCOORD0; 22 | }; 23 | 24 | VertexOutput SkyVertexShader(uint VertexID : SV_VertexID) 25 | { 26 | VertexOutput output; // TODO init to 0 27 | 28 | float2 Norm2d = float2((VertexID == 1 || VertexID == 3) ? 1.0 : -1.0, (VertexID == 2 || VertexID == 3) ? 1.0 : -1.0); 29 | 30 | // static char* suf[6] = { "rt", "bk", "lf", "ft", "up", "dn" }; 31 | float3 WorldPos = 0.0f; 32 | if (Face == 0) // right 33 | { 34 | WorldPos = float3(1.0, Norm2d.x, -Norm2d.y); 35 | } 36 | else if (Face == 1) // back 37 | { 38 | WorldPos = float3(Norm2d.x, -1.0, -Norm2d.y); 39 | } 40 | else if (Face == 2) // left 41 | { 42 | WorldPos = float3(-1.0, -Norm2d.x, -Norm2d.y); 43 | } 44 | else if (Face == 3) // front 45 | { 46 | WorldPos = float3(-Norm2d.x, 1.0, -Norm2d.y); 47 | } 48 | else if (Face == 4) // Top 49 | { 50 | WorldPos = float3(Norm2d.y, Norm2d.x, 1.0); 51 | } 52 | else if (Face == 5) // Bottom 53 | { 54 | WorldPos = float3(-Norm2d.y, Norm2d.x, -1.0); 55 | } 56 | WorldPos *= 10000.0f; // scale 57 | 58 | //output.position = mul(ViewProjectionMatrix, mul(MeshWorldMatrix, float4(WorldPos, 1.0))); 59 | output.position = mul(ViewProjectionMatrix, float4(WorldPos, 1.0)); 60 | output.uv = Norm2d * 0.5f + 0.5f; 61 | 62 | return output; 63 | } 64 | 65 | float4 SkyPixelShader(VertexOutput input) : SV_TARGET 66 | { 67 | return SkyFaceTexture.Sample(SamplerLinearClamp, float2(input.uv)); 68 | } 69 | 70 | 71 | -------------------------------------------------------------------------------- /ref_dx12/Shaders/StaticSamplers.hlsl: -------------------------------------------------------------------------------- 1 | 2 | // Dx12 common static samplers 3 | // More can be added in RootSignature::RootSignature in Dx12Device.cpp 4 | 5 | 6 | 7 | SamplerState SamplerPointClamp : register(s0); 8 | SamplerState SamplerLinearClamp : register(s1); 9 | 10 | SamplerState SamplerPointRepeat : register(s2); 11 | SamplerState SamplerLinearRepeat : register(s3); 12 | 13 | 14 | -------------------------------------------------------------------------------- /ref_dx12/Shaders/WorldMeshDrawShader.hlsl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #include "StaticSamplers.hlsl" 5 | 6 | 7 | 8 | cbuffer MeshConstantBuffer : register(b0) 9 | { 10 | float4x4 MeshWorldMatrix; 11 | float4x4 ViewProjectionMatrix; 12 | float4 BatchDebugColor; 13 | } 14 | 15 | 16 | 17 | struct VertexInput 18 | { 19 | float3 Position : POSITION; 20 | float2 SurfaceUV : TEXCOORD0; 21 | float2 LightmapUV : TEXCOORD1; 22 | float4 ColorAlpha : TEXCOORD2; 23 | }; 24 | 25 | struct VertexOutput 26 | { 27 | float4 Position : SV_POSITION; 28 | float2 SurfaceUV : TEXCOORD0; 29 | float2 LightmapUV : TEXCOORD1; 30 | float4 ColorAlpha : TEXCOORD2; 31 | }; 32 | 33 | 34 | Texture2D SurfaceTexture : register(t0); 35 | Texture2D LightmapTexture : register(t1); 36 | 37 | 38 | VertexOutput MeshVertexShader(VertexInput Input, uint VertexID : SV_VertexID) 39 | { 40 | VertexOutput Output; 41 | 42 | Output.Position = mul(ViewProjectionMatrix, mul(MeshWorldMatrix, float4(Input.Position, 1.0))); 43 | Output.SurfaceUV = Input.SurfaceUV; 44 | Output.LightmapUV = Input.LightmapUV; 45 | Output.ColorAlpha = Input.ColorAlpha; 46 | 47 | return Output; 48 | } 49 | 50 | float4 MeshDebugPixelShader(VertexOutput Input) : SV_TARGET 51 | { 52 | return float4(1.0, 0.5, 0.25, 1.0); 53 | } 54 | 55 | float4 MeshColorPixelShader(VertexOutput Input) : SV_TARGET 56 | { 57 | return lerp( 58 | Input.ColorAlpha, 59 | BatchDebugColor, BatchDebugColor.a); 60 | } 61 | 62 | float4 MeshLightmapSurfacePixelShader(VertexOutput Input) : SV_TARGET 63 | { 64 | return lerp( 65 | //float4(LightmapTexture.Sample(SamplerPointClamp, Input.LightmapUV).rgb, 1.0f), // lightmap only 66 | //SurfaceTexture.Sample(SamplerLinearRepeat, Input.SurfaceUV), // surface texture only 67 | float4(LightmapTexture.Sample(SamplerLinearClamp, Input.LightmapUV).rgb, 1.0f) * SurfaceTexture.Sample(SamplerLinearRepeat, Input.SurfaceUV), 68 | BatchDebugColor, BatchDebugColor.a); 69 | } 70 | 71 | float4 MeshColoredSurfacePixelShader(VertexOutput Input) : SV_TARGET 72 | { 73 | return lerp( 74 | Input.ColorAlpha * SurfaceTexture.Sample(SamplerLinearRepeat, Input.SurfaceUV), 75 | BatchDebugColor, BatchDebugColor.a); 76 | } 77 | 78 | 79 | -------------------------------------------------------------------------------- /ref_dx12/dllmain.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sebh/QuakeIIDXXII/52b83821fa02d9a8b662805bad1a9b9c59bd716f/ref_dx12/dllmain.cpp -------------------------------------------------------------------------------- /ref_dx12/dx_shader.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "dx_local.h" 3 | 4 | 5 | 6 | VertexShader* FullScreenTriangleVertexShader = nullptr; 7 | PixelShader* UvPixelShader = nullptr; 8 | 9 | PixelShader* ColorDrawPixelShader = nullptr; 10 | 11 | VertexShader* SkyVertexShader = nullptr; 12 | PixelShader* SkyPixelShader = nullptr; 13 | 14 | VertexShader* MeshVertexShader = nullptr; 15 | PixelShader* MeshDebugPixelShader = nullptr; 16 | PixelShader* MeshColorPixelShader = nullptr; 17 | PixelShader* MeshLightmapSurfacePixelShader = nullptr; 18 | PixelShader* MeshColoredSurfacePixelShader = nullptr; 19 | 20 | VertexShader* ColoredImageVertexShader = nullptr; 21 | PixelShader* ColoredImagePixelShader = nullptr; 22 | 23 | 24 | VertexShader* ParticleVertexShader = nullptr; 25 | PixelShader* ParticlePixelShader = nullptr; 26 | 27 | void LoadAllShaders() 28 | { 29 | // D:\\Projects\\Git\\QuakeIIDXXII\\ref_dx12\\Shaders 30 | // C:\\Users\\Sebastien\\Projects\\QuakeIIDXXII\\ref_dx12\\Shaders 31 | { 32 | Macros Macros; 33 | Macros.push_back({L"TESTSHADER", L"1"}); 34 | FullScreenTriangleVertexShader = new VertexShader(L"D:\\Projects\\Git\\QuakeIIDXXII\\ref_dx12\\Shaders\\ImageDrawShader.hlsl", L"FullScreenTriangleVertexShader", &Macros); 35 | UvPixelShader = new PixelShader(L"D:\\Projects\\Git\\QuakeIIDXXII\\ref_dx12\\Shaders\\ImageDrawShader.hlsl", L"UvPixelShader", &Macros); 36 | } 37 | { 38 | Macros Macros; 39 | Macros.push_back({ L"COLORDRAWSHADER", L"1" }); 40 | ColorDrawPixelShader = new PixelShader(L"D:\\Projects\\Git\\QuakeIIDXXII\\ref_dx12\\Shaders\\ImageDrawShader.hlsl", L"ColorDrawPixelShader", &Macros); 41 | } 42 | { 43 | Macros Macros; 44 | SkyVertexShader = new VertexShader(L"D:\\Projects\\Git\\QuakeIIDXXII\\ref_dx12\\Shaders\\SkyShader.hlsl", L"SkyVertexShader", &Macros); 45 | SkyPixelShader = new PixelShader(L"D:\\Projects\\Git\\QuakeIIDXXII\\ref_dx12\\Shaders\\SkyShader.hlsl", L"SkyPixelShader", &Macros); 46 | } 47 | { 48 | Macros Macros; 49 | MeshVertexShader = new VertexShader(L"D:\\Projects\\Git\\QuakeIIDXXII\\ref_dx12\\Shaders\\WorldMeshDrawShader.hlsl", L"MeshVertexShader", &Macros); 50 | MeshDebugPixelShader = new PixelShader(L"D:\\Projects\\Git\\QuakeIIDXXII\\ref_dx12\\Shaders\\WorldMeshDrawShader.hlsl", L"MeshDebugPixelShader", &Macros); 51 | MeshColorPixelShader = new PixelShader(L"D:\\Projects\\Git\\QuakeIIDXXII\\ref_dx12\\Shaders\\WorldMeshDrawShader.hlsl", L"MeshColorPixelShader", &Macros); 52 | MeshLightmapSurfacePixelShader = new PixelShader(L"D:\\Projects\\Git\\QuakeIIDXXII\\ref_dx12\\Shaders\\WorldMeshDrawShader.hlsl", L"MeshLightmapSurfacePixelShader", &Macros); 53 | MeshColoredSurfacePixelShader = new PixelShader(L"D:\\Projects\\Git\\QuakeIIDXXII\\ref_dx12\\Shaders\\WorldMeshDrawShader.hlsl", L"MeshColoredSurfacePixelShader", &Macros); 54 | } 55 | { 56 | Macros Macros; 57 | Macros.push_back({ L"DRAWIMAGESHADER", L"1" }); 58 | ColoredImageVertexShader = new VertexShader(L"D:\\Projects\\Git\\QuakeIIDXXII\\ref_dx12\\Shaders\\ImageDrawShader.hlsl", L"ColoredImageVertexShader", &Macros); 59 | ColoredImagePixelShader = new PixelShader(L"D:\\Projects\\Git\\QuakeIIDXXII\\ref_dx12\\Shaders\\ImageDrawShader.hlsl", L"ColoredImagePixelShader", &Macros); 60 | } 61 | { 62 | Macros Macros; 63 | ParticleVertexShader = new VertexShader(L"D:\\Projects\\Git\\QuakeIIDXXII\\ref_dx12\\Shaders\\ParticleDrawShader.hlsl", L"ParticleVertexShader", &Macros); 64 | ParticlePixelShader = new PixelShader(L"D:\\Projects\\Git\\QuakeIIDXXII\\ref_dx12\\Shaders\\ParticleDrawShader.hlsl", L"ParticlePixelShader", &Macros); 65 | } 66 | } 67 | 68 | void UnloadAllShaders() 69 | { 70 | delete FullScreenTriangleVertexShader; 71 | delete UvPixelShader; 72 | 73 | delete ColorDrawPixelShader; 74 | 75 | delete SkyVertexShader; 76 | delete SkyPixelShader; 77 | 78 | delete MeshVertexShader; 79 | delete MeshDebugPixelShader; 80 | delete MeshColorPixelShader; 81 | delete MeshLightmapSurfacePixelShader; 82 | delete MeshColoredSurfacePixelShader; 83 | 84 | delete ColoredImageVertexShader; 85 | delete ColoredImagePixelShader; 86 | 87 | delete ParticleVertexShader; 88 | delete ParticlePixelShader; 89 | } 90 | 91 | 92 | -------------------------------------------------------------------------------- /ref_dx12/dx_sky.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "dx_local.h" 3 | 4 | 5 | static char skyname[MAX_QPATH]; 6 | static float skyrotate; 7 | static vec3_t skyaxis; 8 | static image_t* sky_images[6] = { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr }; 9 | 10 | static char* suf[6] = { "rt", "bk", "lf", "ft", "up", "dn" }; 11 | 12 | 13 | void SkyRegisterTexture(char* name, float rotate, vec3_t axis) 14 | { 15 | int i; 16 | char pathname[MAX_QPATH]; 17 | 18 | strncpy(skyname, name, sizeof(skyname) - 1); 19 | skyrotate = rotate; 20 | VectorCopy(axis, skyaxis); 21 | 22 | for (i = 0; i < 6; i++) 23 | { 24 | Com_sprintf(pathname, sizeof(pathname), "env/%s%s.tga", skyname, suf[i]); 25 | 26 | sky_images[i] = FindImage(pathname, it_sky); 27 | if (!sky_images[i]) 28 | sky_images[i] = r_notexture; 29 | } 30 | } 31 | 32 | void SkyUnregisterTexture() 33 | { 34 | sky_images[0] = sky_images[1] = sky_images[2] = sky_images[3] = sky_images[4] = sky_images[5] = nullptr; 35 | } 36 | 37 | void SkyRender() 38 | { 39 | if (sky_images[0]) 40 | { 41 | FrameConstantBuffers& ConstantBuffers = g_dx12Device->getFrameConstantBuffers(); 42 | DispatchDrawCallCpuDescriptorHeap& DrawDispatchCallCpuDescriptorHeap = g_dx12Device->getDispatchDrawCallCpuDescriptorHeap(); 43 | 44 | ID3D12GraphicsCommandList* CommandList = g_dx12Device->getFrameCommandList(); 45 | ID3D12Resource* BackBuffer = g_dx12Device->getBackBuffer(); 46 | D3D12_CPU_DESCRIPTOR_HANDLE BackBufferDescriptor = g_dx12Device->getBackBufferDescriptor(); 47 | 48 | IndexBufferQuadTris->resourceTransitionBarrier(D3D12_RESOURCE_STATE_INDEX_BUFFER); 49 | D3D12_INDEX_BUFFER_VIEW QuadIndexBufferView = IndexBufferQuadTris->getIndexBufferView(DXGI_FORMAT_R32_UINT); 50 | 51 | // Set defaults graphic and compute root signatures 52 | CommandList->SetGraphicsRootSignature(g_dx12Device->GetDefaultGraphicRootSignature().getRootsignature()); 53 | CommandList->SetComputeRootSignature(g_dx12Device->GetDefaultComputeRootSignature().getRootsignature()); 54 | 55 | // Set the common descriptor heap 56 | std::vector descriptorHeaps; 57 | descriptorHeaps.push_back(g_dx12Device->getFrameDispatchDrawCallGpuDescriptorHeap()->getHeap()); 58 | CommandList->SetDescriptorHeaps(uint(descriptorHeaps.size()), descriptorHeaps.data()); 59 | 60 | ViewData vd = GetViewData(); 61 | for (int i = 0; i < 6; i++) 62 | { 63 | CachedRasterPsoDesc PSODesc; 64 | PSODesc.mRootSign = &g_dx12Device->GetDefaultGraphicRootSignature(); 65 | PSODesc.mVS = SkyVertexShader; 66 | PSODesc.mPS = SkyPixelShader; 67 | PSODesc.mLayout = nullptr; 68 | PSODesc.mDepthStencilState = &getDepthStencilState_ReadOnly(); 69 | PSODesc.mRasterizerState = &getRasterizerState_DefaultNoCulling(); 70 | PSODesc.mBlendState = &getBlendState_Default(); 71 | PSODesc.mRenderTargetCount = 1; 72 | PSODesc.mRenderTargetDescriptors[0] = BackBufferDescriptor; 73 | PSODesc.mRenderTargetFormats[0] = DXGI_FORMAT_R8G8B8A8_UNORM; 74 | PSODesc.mDepthTextureDescriptor = DepthTexture->getDSVCPUHandle(); 75 | PSODesc.mDepthTextureFormat = DepthTexture->getClearColor().Format; 76 | g_CachedPSOManager->SetPipelineState(CommandList, PSODesc); 77 | 78 | FrameConstantBuffers::FrameConstantBuffer CB = ConstantBuffers.AllocateFrameConstantBuffer(sizeof(SkyConstantBuffer)); 79 | SkyConstantBuffer* CBData = (SkyConstantBuffer*)CB.getCPUMemory(); 80 | CBData->ViewProjectionMatrix = vd.ViewProjectionMatrix; 81 | CBData->Face = i; 82 | 83 | DispatchDrawCallCpuDescriptorHeap::Call CallDescriptors = DrawDispatchCallCpuDescriptorHeap.AllocateCall(g_dx12Device->GetDefaultGraphicRootSignature()); 84 | CallDescriptors.SetSRV(0, *sky_images[i]->RenderTexture); 85 | CommandList->SetGraphicsRootDescriptorTable(RootParameterIndex_DescriptorTable0, CallDescriptors.getRootDescriptorTableGpuHandle()); 86 | 87 | CommandList->SetGraphicsRootConstantBufferView(RootParameterIndex_CBV0, CB.getGPUVirtualAddress()); 88 | 89 | CommandList->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST); // set the primitive topology 90 | CommandList->IASetIndexBuffer(&QuadIndexBufferView); 91 | 92 | CommandList->DrawIndexedInstanced(6, 1, 0, 0, 0); 93 | } 94 | } 95 | } 96 | 97 | 98 | -------------------------------------------------------------------------------- /ref_dx12/dx_state.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "dx_local.h" 3 | 4 | static bool bAllStatesCreated = false; 5 | 6 | RenderBufferGeneric* IndexBufferSingleTri = nullptr; 7 | RenderBufferGeneric* IndexBufferQuadTris = nullptr; 8 | 9 | RenderTextureDynamic* MovieTextureDynamic = nullptr; 10 | 11 | bool AreAllStatesCreated() 12 | { 13 | return bAllStatesCreated; 14 | } 15 | 16 | void CreateAllStates() 17 | { 18 | { 19 | uint Indices[3]; 20 | Indices[0] = 0; 21 | Indices[1] = 1; 22 | Indices[2] = 2; 23 | IndexBufferSingleTri = new RenderBufferGeneric(3 * sizeof(uint), Indices); 24 | IndexBufferSingleTri->setDebugName(L"TriangleIndexBuffer"); 25 | } 26 | { 27 | uint Indices[6]; 28 | Indices[0] = 0; 29 | Indices[1] = 1; 30 | Indices[2] = 2; 31 | Indices[3] = 2; 32 | Indices[4] = 1; 33 | Indices[5] = 3; 34 | IndexBufferQuadTris = new RenderBufferGeneric(6 * sizeof(uint), Indices); 35 | IndexBufferQuadTris->setDebugName(L"QuadTrisIndexBuffer"); 36 | } 37 | 38 | bAllStatesCreated = true; 39 | } 40 | 41 | 42 | void ReleaseAllStates() 43 | { 44 | if (!bAllStatesCreated) 45 | return; 46 | 47 | delete IndexBufferSingleTri; 48 | delete IndexBufferQuadTris; 49 | 50 | if (MovieTextureDynamic) 51 | { 52 | delete MovieTextureDynamic; 53 | } 54 | } 55 | 56 | 57 | 58 | //////////////////////////////////////////////////////////////////////////////////////////////////// 59 | 60 | ViewData GetViewData() 61 | { 62 | float AspectRatioXOverY = float(r_newrefdef.width) / float(r_newrefdef.height); 63 | 64 | ViewData View; 65 | 66 | const float4 Up = XMVectorSet(0.0f, 0.0f, 1.0f, 0.0f); 67 | const float4 Pos = XMVectorSet(r_newrefdef.vieworg[0], r_newrefdef.vieworg[1], r_newrefdef.vieworg[2], 1.0f); 68 | 69 | AngleVectors(r_newrefdef.viewangles, View.forward, View.right, View.up); 70 | const float4 LookAtPos = XMVectorSet(r_newrefdef.vieworg[0] + View.forward[0], r_newrefdef.vieworg[1] + View.forward[1], r_newrefdef.vieworg[2] + View.forward[2], 1.0f); 71 | 72 | #if 0 73 | View.ViewMatrix = XMMatrixLookAtLH(Pos, LookAtPos, Up); // missing space conversion 74 | #else 75 | 76 | // Convert Q2 to D3d space 77 | float4x4 D3dMat0 = XMMatrixScaling(1.0f, 1.0f, -1.0f); 78 | float4x4 D3dMat1 = XMMatrixRotationX(DegToRad(-90.0f)); 79 | float4x4 D3dMat2 = XMMatrixRotationZ(DegToRad( 90.0f)); 80 | // Q2 camera transform 81 | float4x4 RotXMat = XMMatrixRotationX(DegToRad(-r_newrefdef.viewangles[2])); 82 | float4x4 RotYMat = XMMatrixRotationY(DegToRad(-r_newrefdef.viewangles[0])); 83 | float4x4 RotZMat = XMMatrixRotationZ(DegToRad(-r_newrefdef.viewangles[1])); 84 | float4x4 TranMat = XMMatrixTranslation(-r_newrefdef.vieworg[0], -r_newrefdef.vieworg[1], -r_newrefdef.vieworg[2]); 85 | 86 | View.ViewMatrix = XMMatrixMultiply(D3dMat1, D3dMat0); 87 | View.ViewMatrix = XMMatrixMultiply(D3dMat2, View.ViewMatrix); 88 | View.ViewMatrix = XMMatrixMultiply(RotXMat, View.ViewMatrix); 89 | View.ViewMatrix = XMMatrixMultiply(RotYMat, View.ViewMatrix); 90 | View.ViewMatrix = XMMatrixMultiply(RotZMat, View.ViewMatrix); 91 | View.ViewMatrix = XMMatrixMultiply(TranMat, View.ViewMatrix); 92 | #endif 93 | 94 | float4 ViewViewMatrixDet = XMMatrixDeterminant(View.ViewMatrix); 95 | View.ViewMatrixInv = XMMatrixInverse(&ViewViewMatrixDet, View.ViewMatrix); 96 | 97 | View.ProjectionMatrix = XMMatrixPerspectiveFovLH(DegToRad(r_newrefdef.fov_y), AspectRatioXOverY, 0.1f, 20000.0f); 98 | float4 ViewProjectionMatrixDet = XMMatrixDeterminant(View.ProjectionMatrix); 99 | View.ProjectionMatrixInv = XMMatrixInverse(&ViewProjectionMatrixDet, View.ProjectionMatrix); 100 | 101 | 102 | View.ViewProjectionMatrix = XMMatrixMultiply(View.ViewMatrix, View.ProjectionMatrix); 103 | float4 ViewViewProjectionMatrixDet = XMMatrixDeterminant(View.ViewProjectionMatrix); 104 | View.ViewProjectionMatrixInv = XMMatrixInverse(&ViewViewProjectionMatrixDet, View.ViewProjectionMatrix); 105 | 106 | return View; 107 | } 108 | 109 | 110 | 111 | //////////////////////////////////////////////////////////////////////////////////////////////////// 112 | 113 | void ErrorExit(char* Text) 114 | { 115 | OutputDebugStringA(Text); 116 | ri.Sys_Error(ERR_DROP, Text); 117 | } 118 | 119 | 120 | -------------------------------------------------------------------------------- /ref_dx12/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /ref_dx12/ref_dx12.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | GetRefAPI 3 | -------------------------------------------------------------------------------- /ref_dx12/stdafx.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sebh/QuakeIIDXXII/52b83821fa02d9a8b662805bad1a9b9c59bd716f/ref_dx12/stdafx.cpp -------------------------------------------------------------------------------- /ref_dx12/stdafx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sebh/QuakeIIDXXII/52b83821fa02d9a8b662805bad1a9b9c59bd716f/ref_dx12/stdafx.h -------------------------------------------------------------------------------- /ref_dx12/targetver.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sebh/QuakeIIDXXII/52b83821fa02d9a8b662805bad1a9b9c59bd716f/ref_dx12/targetver.h -------------------------------------------------------------------------------- /ref_dx12postbuild_x64.bat: -------------------------------------------------------------------------------- 1 | XCOPY "..\QUAKE2DATA\dx64\dxil.dll" "..\QUAKE2DATA\" /-y /y /v 2 | XCOPY "..\QUAKE2DATA\dx64\dxcompiler.dll" "..\QUAKE2DATA\" /-y /y /v 3 | -------------------------------------------------------------------------------- /ref_dx12postbuild_x86.bat: -------------------------------------------------------------------------------- 1 | XCOPY "..\QUAKE2DATA\dx32\dxil.dll" "..\QUAKE2DATA\" /-y /y /v 2 | XCOPY "..\QUAKE2DATA\dx32\dxcompiler.dll" "..\QUAKE2DATA\" /-y /y /v 3 | -------------------------------------------------------------------------------- /ref_gl/ref_gl.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | GetRefAPI 3 | -------------------------------------------------------------------------------- /ref_gl/ref_gl.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {990a6b22-d0ef-4895-adfc-bfda09a1b7fd} 6 | cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90 7 | 8 | 9 | {92d5f4d5-d847-4ff9-a61c-3051d97d1be3} 10 | h;hpp;hxx;hm;inl;fi;fd 11 | 12 | 13 | {3a7e4964-96be-4923-9b8f-2bf9f8592094} 14 | ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | Source Files 35 | 36 | 37 | Source Files 38 | 39 | 40 | Source Files 41 | 42 | 43 | Source Files 44 | 45 | 46 | Source Files 47 | 48 | 49 | Source Files 50 | 51 | 52 | Source Files 53 | 54 | 55 | Source Files 56 | 57 | 58 | 59 | 60 | Header Files 61 | 62 | 63 | Header Files 64 | 65 | 66 | Header Files 67 | 68 | 69 | Header Files 70 | 71 | 72 | Header Files 73 | 74 | 75 | Header Files 76 | 77 | 78 | Header Files 79 | 80 | 81 | Header Files 82 | 83 | 84 | Header Files 85 | 86 | 87 | Header Files 88 | 89 | 90 | Header Files 91 | 92 | 93 | Header Files 94 | 95 | 96 | Header Files 97 | 98 | 99 | Header Files 100 | 101 | 102 | 103 | 104 | Resource Files 105 | 106 | 107 | -------------------------------------------------------------------------------- /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/asm_draw.h: -------------------------------------------------------------------------------- 1 | // 2 | // asm_draw.h 3 | // 4 | // Include file for asm drawing routines. 5 | // 6 | 7 | // 8 | // !!! note that this file must match the corresponding C structures at all 9 | // times !!! 10 | // 11 | 12 | // !!! if this is changed, it must be changed in r_local.h too !!! 13 | #define NEAR_CLIP 0.01 14 | 15 | // !!! if this is changed, it must be changed in r_local.h too !!! 16 | #define CYCLE 128 17 | 18 | // espan_t structure 19 | // !!! if this is changed, it must be changed in r_shared.h too !!! 20 | #define espan_t_u 0 21 | #define espan_t_v 4 22 | #define espan_t_count 8 23 | #define espan_t_pnext 12 24 | #define espan_t_size 16 25 | 26 | // sspan_t structure 27 | // !!! if this is changed, it must be changed in d_local.h too !!! 28 | #define sspan_t_u 0 29 | #define sspan_t_v 4 30 | #define sspan_t_count 8 31 | #define sspan_t_pnext 12 32 | #define sspan_t_size 16 33 | 34 | // edge_t structure 35 | // !!! if this is changed, it must be changed in r_shared.h too !!! 36 | #define et_u 0 37 | #define et_u_step 4 38 | #define et_prev 8 39 | #define et_next 12 40 | #define et_surfs 16 41 | #define et_nextremove 20 42 | #define et_nearzi 24 43 | #define et_owner 28 44 | #define et_size 32 45 | 46 | // surf_t structure 47 | // !!! if this is changed, it must be changed in r_shared.h too !!! 48 | #define SURF_T_SHIFT 6 49 | #define st_next 0 50 | #define st_prev 4 51 | #define st_spans 8 52 | #define st_key 12 53 | #define st_last_u 16 54 | #define st_spanstate 20 55 | #define st_flags 24 56 | #define st_data 28 57 | #define st_entity 32 58 | #define st_nearzi 36 59 | #define st_insubmodel 40 60 | #define st_d_ziorigin 44 61 | #define st_d_zistepu 48 62 | #define st_d_zistepv 52 63 | #define st_pad 56 64 | #define st_size 64 65 | 66 | // clipplane_t structure 67 | // !!! if this is changed, it must be changed in r_local.h too !!! 68 | #define cp_normal 0 69 | #define cp_dist 12 70 | #define cp_next 16 71 | #define cp_leftedge 20 72 | #define cp_rightedge 21 73 | #define cp_reserved 22 74 | #define cp_size 24 75 | 76 | // medge_t structure 77 | // !!! if this is changed, it must be changed in model.h too !!! 78 | #define me_v 0 79 | #define me_cachededgeoffset 4 80 | #define me_size 8 81 | 82 | // mvertex_t structure 83 | // !!! if this is changed, it must be changed in model.h too !!! 84 | #define mv_position 0 85 | #define mv_size 12 86 | 87 | // refdef_t structure 88 | // !!! if this is changed, it must be changed in render.h too !!! 89 | #define rd_vrect 0 90 | #define rd_aliasvrect 20 91 | #define rd_vrectright 40 92 | #define rd_vrectbottom 44 93 | #define rd_aliasvrectright 48 94 | #define rd_aliasvrectbottom 52 95 | #define rd_vrectrightedge 56 96 | #define rd_fvrectx 60 97 | #define rd_fvrecty 64 98 | #define rd_fvrectx_adj 68 99 | #define rd_fvrecty_adj 72 100 | #define rd_vrect_x_adj_shift20 76 101 | #define rd_vrectright_adj_shift20 80 102 | #define rd_fvrectright_adj 84 103 | #define rd_fvrectbottom_adj 88 104 | #define rd_fvrectright 92 105 | #define rd_fvrectbottom 96 106 | #define rd_horizontalFieldOfView 100 107 | #define rd_xOrigin 104 108 | #define rd_yOrigin 108 109 | #define rd_vieworg 112 110 | #define rd_viewangles 124 111 | #define rd_ambientlight 136 112 | #define rd_size 140 113 | 114 | // mtriangle_t structure 115 | // !!! if this is changed, it must be changed in model.h too !!! 116 | #define mtri_facesfront 0 117 | #define mtri_vertindex 4 118 | #define mtri_size 16 // !!! if this changes, array indexing in !!! 119 | // !!! d_polysa.s must be changed to match !!! 120 | #define mtri_shift 4 121 | 122 | -------------------------------------------------------------------------------- /ref_soft/block16.inc: -------------------------------------------------------------------------------- 1 | LEnter16_16: 2 | mov al,ds:byte ptr[esi] 3 | mov cl,ds:byte ptr[esi+ebx] 4 | mov ah,dh 5 | add edx,ebp 6 | mov ch,dh 7 | lea esi,ds:dword ptr[esi+ebx*2] 8 | mov ax,ds:word ptr[12345678h+eax*2] 9 | LBPatch0: 10 | add edx,ebp 11 | mov ds:word ptr[edi],ax 12 | mov cx,ds:word ptr[12345678h+ecx*2] 13 | LBPatch1: 14 | mov ds:word ptr[2+edi],cx 15 | add edi,04h 16 | mov al,ds:byte ptr[esi] 17 | mov cl,ds:byte ptr[esi+ebx] 18 | mov ah,dh 19 | add edx,ebp 20 | mov ch,dh 21 | lea esi,ds:dword ptr[esi+ebx*2] 22 | mov ax,ds:word ptr[12345678h+eax*2] 23 | LBPatch2: 24 | add edx,ebp 25 | mov ds:word ptr[edi],ax 26 | mov cx,ds:word ptr[12345678h+ecx*2] 27 | LBPatch3: 28 | mov ds:word ptr[2+edi],cx 29 | add edi,04h 30 | mov al,ds:byte ptr[esi] 31 | mov cl,ds:byte ptr[esi+ebx] 32 | mov ah,dh 33 | add edx,ebp 34 | mov ch,dh 35 | lea esi,ds:dword ptr[esi+ebx*2] 36 | mov ax,ds:word ptr[12345678h+eax*2] 37 | LBPatch4: 38 | add edx,ebp 39 | mov ds:word ptr[edi],ax 40 | mov cx,ds:word ptr[12345678h+ecx*2] 41 | LBPatch5: 42 | mov ds:word ptr[2+edi],cx 43 | add edi,04h 44 | mov al,ds:byte ptr[esi] 45 | mov cl,ds:byte ptr[esi+ebx] 46 | mov ah,dh 47 | add edx,ebp 48 | mov ch,dh 49 | lea esi,ds:dword ptr[esi+ebx*2] 50 | mov ax,ds:word ptr[12345678h+eax*2] 51 | LBPatch6: 52 | add edx,ebp 53 | mov ds:word ptr[edi],ax 54 | mov cx,ds:word ptr[12345678h+ecx*2] 55 | LBPatch7: 56 | mov ds:word ptr[2+edi],cx 57 | add edi,04h 58 | LEnter8_16: 59 | mov al,ds:byte ptr[esi] 60 | mov cl,ds:byte ptr[esi+ebx] 61 | mov ah,dh 62 | add edx,ebp 63 | mov ch,dh 64 | lea esi,ds:dword ptr[esi+ebx*2] 65 | mov ax,ds:word ptr[12345678h+eax*2] 66 | LBPatch8: 67 | add edx,ebp 68 | mov ds:word ptr[edi],ax 69 | mov cx,ds:word ptr[12345678h+ecx*2] 70 | LBPatch9: 71 | mov ds:word ptr[2+edi],cx 72 | add edi,04h 73 | mov al,ds:byte ptr[esi] 74 | mov cl,ds:byte ptr[esi+ebx] 75 | mov ah,dh 76 | add edx,ebp 77 | mov ch,dh 78 | lea esi,ds:dword ptr[esi+ebx*2] 79 | mov ax,ds:word ptr[12345678h+eax*2] 80 | LBPatch10: 81 | add edx,ebp 82 | mov ds:word ptr[edi],ax 83 | mov cx,ds:word ptr[12345678h+ecx*2] 84 | LBPatch11: 85 | mov ds:word ptr[2+edi],cx 86 | add edi,04h 87 | LEnter4_16: 88 | mov al,ds:byte ptr[esi] 89 | mov cl,ds:byte ptr[esi+ebx] 90 | mov ah,dh 91 | add edx,ebp 92 | mov ch,dh 93 | lea esi,ds:dword ptr[esi+ebx*2] 94 | mov ax,ds:word ptr[12345678h+eax*2] 95 | LBPatch12: 96 | add edx,ebp 97 | mov ds:word ptr[edi],ax 98 | mov cx,ds:word ptr[12345678h+ecx*2] 99 | LBPatch13: 100 | mov ds:word ptr[2+edi],cx 101 | add edi,04h 102 | LEnter2_16: 103 | mov al,ds:byte ptr[esi] 104 | mov cl,ds:byte ptr[esi+ebx] 105 | mov ah,dh 106 | add edx,ebp 107 | mov ch,dh 108 | lea esi,ds:dword ptr[esi+ebx*2] 109 | mov ax,ds:word ptr[12345678h+eax*2] 110 | LBPatch14: 111 | add edx,ebp 112 | mov ds:word ptr[edi],ax 113 | mov cx,ds:word ptr[12345678h+ecx*2] 114 | LBPatch15: 115 | mov ds:word ptr[2+edi],cx 116 | add edi,04h 117 | -------------------------------------------------------------------------------- /ref_soft/block8.inc: -------------------------------------------------------------------------------- 1 | LEnter16_16: 2 | mov al,ds:byte ptr[esi] 3 | mov cl,ds:byte ptr[esi+ebx] 4 | mov ah,dh 5 | add edx,ebp 6 | mov ch,dh 7 | lea esi,ds:dword ptr[esi+ebx*2] 8 | mov ax,ds:word ptr[12345678h+eax*2] 9 | LBPatch0: 10 | add edx,ebp 11 | mov ds:word ptr[edi],ax 12 | mov cx,ds:word ptr[12345678h+ecx*2] 13 | LBPatch1: 14 | mov ds:word ptr[2+edi],cx 15 | add edi,04h 16 | mov al,ds:byte ptr[esi] 17 | mov cl,ds:byte ptr[esi+ebx] 18 | mov ah,dh 19 | add edx,ebp 20 | mov ch,dh 21 | lea esi,ds:dword ptr[esi+ebx*2] 22 | mov ax,ds:word ptr[12345678h+eax*2] 23 | LBPatch2: 24 | add edx,ebp 25 | mov ds:word ptr[edi],ax 26 | mov cx,ds:word ptr[12345678h+ecx*2] 27 | LBPatch3: 28 | mov ds:word ptr[2+edi],cx 29 | add edi,04h 30 | mov al,ds:byte ptr[esi] 31 | mov cl,ds:byte ptr[esi+ebx] 32 | mov ah,dh 33 | add edx,ebp 34 | mov ch,dh 35 | lea esi,ds:dword ptr[esi+ebx*2] 36 | mov ax,ds:word ptr[12345678h+eax*2] 37 | LBPatch4: 38 | add edx,ebp 39 | mov ds:word ptr[edi],ax 40 | mov cx,ds:word ptr[12345678h+ecx*2] 41 | LBPatch5: 42 | mov ds:word ptr[2+edi],cx 43 | add edi,04h 44 | mov al,ds:byte ptr[esi] 45 | mov cl,ds:byte ptr[esi+ebx] 46 | mov ah,dh 47 | add edx,ebp 48 | mov ch,dh 49 | lea esi,ds:dword ptr[esi+ebx*2] 50 | mov ax,ds:word ptr[12345678h+eax*2] 51 | LBPatch6: 52 | add edx,ebp 53 | mov ds:word ptr[edi],ax 54 | mov cx,ds:word ptr[12345678h+ecx*2] 55 | LBPatch7: 56 | mov ds:word ptr[2+edi],cx 57 | add edi,04h 58 | LEnter8_16: 59 | mov al,ds:byte ptr[esi] 60 | mov cl,ds:byte ptr[esi+ebx] 61 | mov ah,dh 62 | add edx,ebp 63 | mov ch,dh 64 | lea esi,ds:dword ptr[esi+ebx*2] 65 | mov ax,ds:word ptr[12345678h+eax*2] 66 | LBPatch8: 67 | add edx,ebp 68 | mov ds:word ptr[edi],ax 69 | mov cx,ds:word ptr[12345678h+ecx*2] 70 | LBPatch9: 71 | mov ds:word ptr[2+edi],cx 72 | add edi,04h 73 | mov al,ds:byte ptr[esi] 74 | mov cl,ds:byte ptr[esi+ebx] 75 | mov ah,dh 76 | add edx,ebp 77 | mov ch,dh 78 | lea esi,ds:dword ptr[esi+ebx*2] 79 | mov ax,ds:word ptr[12345678h+eax*2] 80 | LBPatch10: 81 | add edx,ebp 82 | mov ds:word ptr[edi],ax 83 | mov cx,ds:word ptr[12345678h+ecx*2] 84 | LBPatch11: 85 | mov ds:word ptr[2+edi],cx 86 | add edi,04h 87 | LEnter4_16: 88 | mov al,ds:byte ptr[esi] 89 | mov cl,ds:byte ptr[esi+ebx] 90 | mov ah,dh 91 | add edx,ebp 92 | mov ch,dh 93 | lea esi,ds:dword ptr[esi+ebx*2] 94 | mov ax,ds:word ptr[12345678h+eax*2] 95 | LBPatch12: 96 | add edx,ebp 97 | mov ds:word ptr[edi],ax 98 | mov cx,ds:word ptr[12345678h+ecx*2] 99 | LBPatch13: 100 | mov ds:word ptr[2+edi],cx 101 | add edi,04h 102 | LEnter2_16: 103 | mov al,ds:byte ptr[esi] 104 | mov cl,ds:byte ptr[esi+ebx] 105 | mov ah,dh 106 | add edx,ebp 107 | mov ch,dh 108 | lea esi,ds:dword ptr[esi+ebx*2] 109 | mov ax,ds:word ptr[12345678h+eax*2] 110 | LBPatch14: 111 | add edx,ebp 112 | mov ds:word ptr[edi],ax 113 | mov cx,ds:word ptr[12345678h+ecx*2] 114 | LBPatch15: 115 | mov ds:word ptr[2+edi],cx 116 | add edi,04h 117 | -------------------------------------------------------------------------------- /ref_soft/d_if.inc: -------------------------------------------------------------------------------- 1 | ; 2 | ; d_ifacea.h 3 | ; 4 | ; Include file for asm driver interface. 5 | ; 6 | 7 | ; 8 | ; !!! note that this file must match the corresponding C structures in 9 | ; d_iface.h at all times !!! 10 | ; 11 | 12 | ; !!! if this is changed, it must be changed in r_shared.h too !!! 13 | ALIAS_ONSEAM equ 00020h 14 | 15 | ; !!! if this is changed, it must be changed in d_iface.h too !!! 16 | TURB_TEX_SIZE equ 64 17 | 18 | ; !!! if this is changed, it must be changed in d_iface.h too !!! 19 | CYCLE equ 128 20 | 21 | ; !!! if this is changed, it must be changed in r_shared.h too !!! 22 | MAXHEIGHT equ 1024 23 | 24 | ; !!! if this is changed, it must be changed in quakedef.h too !!! 25 | CACHE_SIZE equ 32 26 | 27 | ; particle_t structure 28 | ; !!! if this is changed, it must be changed in d_iface.h too !!! 29 | ; driver-usable fields 30 | pt_org equ 0 31 | pt_color equ 12 32 | ; drivers never touch the following fields 33 | pt_next equ 16 34 | pt_vel equ 20 35 | pt_ramp equ 32 36 | pt_die equ 36 37 | pt_type equ 40 38 | pt_size equ 44 39 | 40 | PARTICLE_Z_CLIP equ 8.0 41 | 42 | ; finalvert_t structure 43 | ; !!! if this is changed, it must be changed in d_iface.h too !!! 44 | fv_v equ 0 ; !!! if this is moved, cases where the !!! 45 | ; !!! address of this field is pushed in !!! 46 | ; !!! d_polysa.s must be changed !!! 47 | fv_flags equ 24 48 | fv_reserved equ 28 49 | fv_size equ 32 50 | fv_shift equ 5 51 | 52 | 53 | ; stvert_t structure 54 | ; !!! if this is changed, it must be changed in modelgen.h too !!! 55 | stv_onseam equ 0 56 | stv_s equ 4 57 | stv_t equ 8 58 | stv_size equ 12 59 | 60 | 61 | ; trivertx_t structure 62 | ; !!! if this is changed, it must be changed in modelgen.h too !!! 63 | tv_v equ 0 64 | tv_lightnormalindex equ 3 65 | tv_size equ 4 66 | 67 | ; affinetridesc_t structure 68 | ; !!! if this is changed, it must be changed in d_iface.h too !!! 69 | atd_pskin equ 0 70 | atd_pskindesc equ 4 71 | atd_skinwidth equ 8 72 | atd_skinheight equ 12 73 | atd_ptriangles equ 16 74 | atd_pfinalverts equ 20 75 | atd_numtriangles equ 24 76 | atd_drawtype equ 28 77 | atd_seamfixupX16 equ 32 78 | atd_do_vis_thresh equ 36 79 | atd_vis_thresh equ 40 80 | atd_size equ 44 81 | 82 | -------------------------------------------------------------------------------- /ref_soft/d_ifacea.h: -------------------------------------------------------------------------------- 1 | // 2 | // d_ifacea.h 3 | // 4 | // Include file for asm driver interface. 5 | // 6 | 7 | // 8 | // !!! note that this file must match the corresponding C structures in 9 | // d_iface.h at all times !!! 10 | // 11 | 12 | // !!! if this is changed, it must be changed in d_iface.h too !!! 13 | #define TURB_TEX_SIZE 64 // base turbulent texture size 14 | 15 | // !!! if this is changed, it must be changed in d_iface.h too !!! 16 | #define CYCLE 128 17 | 18 | // !!! if this is changed, it must be changed in r_shared.h too !!! 19 | #define MAXHEIGHT 1200 20 | 21 | // !!! if this is changed, it must be changed in qcommon.h too !!! 22 | #define CACHE_SIZE 32 // used to align key data structures 23 | 24 | // particle_t structure 25 | // !!! if this is changed, it must be changed in d_iface.h too !!! 26 | // driver-usable fields 27 | #define pt_org 0 28 | #define pt_color 12 29 | // drivers never touch the following fields 30 | #define pt_next 16 31 | #define pt_vel 20 32 | #define pt_ramp 32 33 | #define pt_die 36 34 | #define pt_type 40 35 | #define pt_size 44 36 | 37 | #define PARTICLE_Z_CLIP 8.0 38 | 39 | // finalvert_t structure 40 | // !!! if this is changed, it must be changed in d_iface.h too !!! 41 | #define fv_v 0 // !!! if this is moved, cases where the !!! 42 | // !!! address of this field is pushed in !!! 43 | // !!! d_polysa.s must be changed !!! 44 | #define fv_flags 24 45 | #define fv_reserved 28 46 | #define fv_size 32 47 | #define fv_shift 5 48 | 49 | 50 | // stvert_t structure 51 | // !!! if this is changed, it must be changed in modelgen.h too !!! 52 | #define stv_onseam 0 53 | #define stv_s 4 54 | #define stv_t 8 55 | #define stv_size 12 56 | 57 | 58 | // trivertx_t structure 59 | // !!! if this is changed, it must be changed in modelgen.h too !!! 60 | #define tv_v 0 61 | #define tv_lightnormalindex 3 62 | #define tv_size 4 63 | 64 | // affinetridesc_t structure 65 | // !!! if this is changed, it must be changed in d_iface.h too !!! 66 | #define atd_pskin 0 67 | #define atd_pskindesc 4 68 | #define atd_skinwidth 8 69 | #define atd_skinheight 12 70 | #define atd_ptriangles 16 71 | #define atd_pfinalverts 20 72 | #define atd_numtriangles 24 73 | #define atd_drawtype 28 74 | #define atd_seamfixupX16 32 75 | #define atd_size 36 76 | 77 | -------------------------------------------------------------------------------- /ref_soft/r_scana.asm: -------------------------------------------------------------------------------- 1 | .386P 2 | .model FLAT 3 | ; 4 | ; d_scana.s 5 | ; x86 assembly-language turbulent texture mapping code 6 | ; 7 | 8 | include qasm.inc 9 | include d_if.inc 10 | 11 | if id386 12 | 13 | _DATA SEGMENT 14 | 15 | _DATA ENDS 16 | _TEXT SEGMENT 17 | 18 | ;---------------------------------------------------------------------- 19 | ; turbulent texture mapping code 20 | ;---------------------------------------------------------------------- 21 | 22 | align 4 23 | public _D_DrawTurbulent8Span 24 | _D_DrawTurbulent8Span: 25 | push ebp ; preserve caller's stack frame pointer 26 | push esi ; preserve register variables 27 | push edi 28 | push ebx 29 | 30 | mov esi,ds:dword ptr[_r_turb_s] 31 | mov ecx,ds:dword ptr[_r_turb_t] 32 | mov edi,ds:dword ptr[_r_turb_pdest] 33 | mov ebx,ds:dword ptr[_r_turb_spancount] 34 | 35 | Llp: 36 | mov eax,ecx 37 | mov edx,esi 38 | sar eax,16 39 | mov ebp,ds:dword ptr[_r_turb_turb] 40 | sar edx,16 41 | and eax,offset CYCLE-1 42 | and edx,offset CYCLE-1 43 | mov eax,ds:dword ptr[ebp+eax*4] 44 | mov edx,ds:dword ptr[ebp+edx*4] 45 | add eax,esi 46 | sar eax,16 47 | add edx,ecx 48 | sar edx,16 49 | and eax,offset TURB_TEX_SIZE-1 50 | and edx,offset TURB_TEX_SIZE-1 51 | shl edx,6 52 | mov ebp,ds:dword ptr[_r_turb_pbase] 53 | add edx,eax 54 | inc edi 55 | add esi,ds:dword ptr[_r_turb_sstep] 56 | add ecx,ds:dword ptr[_r_turb_tstep] 57 | mov dl,ds:byte ptr[ebp+edx*1] 58 | dec ebx 59 | mov ds:byte ptr[-1+edi],dl 60 | jnz Llp 61 | 62 | mov ds:dword ptr[_r_turb_pdest],edi 63 | 64 | pop ebx ; restore register variables 65 | pop edi 66 | pop esi 67 | pop ebp ; restore caller's stack frame pointer 68 | ret 69 | 70 | 71 | _TEXT ENDS 72 | endif ;id386 73 | END 74 | -------------------------------------------------------------------------------- /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/ref_soft.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | GetRefAPI 3 | -------------------------------------------------------------------------------- /rhapsody/notes.txt: -------------------------------------------------------------------------------- 1 | f1 2 | 3 | not calling back to set vid size after sw_mode change? 4 | 5 | do vid_xpos / ypos creep because of frames? 6 | 7 | fix fullscreen fallback bug 8 | 9 | nsping 10 | 11 | icon 12 | 13 | don't make sys_error varargs 14 | 15 | cvar_stvalue in ref???? 16 | 17 | subframe event timing information 18 | 19 | swimp init / swimp_initgraphics? 20 | 21 | SWimp_SetMode shouldn't call 22 | R_GammaCorrectAndSetPalette( ( const unsigned char * ) d_8to24table ); 23 | 24 | subclass window instead of view? 25 | 26 | /* 27 | ** SWimp_SetPalette 28 | ** 29 | ** System specific palette setting routine. A NULL palette means 30 | ** to use the existing palette. The palette is expected to be in 31 | ** a padded 4-byte xRGB format. 32 | */ 33 | 34 | do we ever pass a NULL palette? 35 | -------------------------------------------------------------------------------- /rhapsody/pb.project: -------------------------------------------------------------------------------- 1 | { 2 | DYNAMIC_CODE_GEN = YES; 3 | FILESTABLE = { 4 | FRAMEWORKS = (Foundation.framework); 5 | OTHER_LINKED = (QuakeWorld_main.m); 6 | OTHER_SOURCES = (Makefile.preamble, Makefile, Makefile.postamble, m.template, h.template); 7 | }; 8 | LANGUAGE = English; 9 | LOCALIZABLE_FILES = {}; 10 | MAKEFILEDIR = "$(NEXT_ROOT)/NextDeveloper/Makefiles/pb_makefiles"; 11 | NEXTSTEP_BUILDTOOL = /bin/gnumake; 12 | PDO_UNIX_BUILDTOOL = $NEXT_ROOT/NextDeveloper/bin/make; 13 | PROJECTNAME = QuakeWorld; 14 | PROJECTTYPE = Tool; 15 | PROJECTVERSION = 2.6; 16 | WINDOWS_BUILDTOOL = $NEXT_ROOT/NextDeveloper/Executables/make; 17 | } 18 | -------------------------------------------------------------------------------- /rhapsody/quake2.iconheader: -------------------------------------------------------------------------------- 1 | F test.app test app 2 | F test test app 3 | -------------------------------------------------------------------------------- /rhapsody/quake2.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sebh/QuakeIIDXXII/52b83821fa02d9a8b662805bad1a9b9c59bd716f/rhapsody/quake2.tiff -------------------------------------------------------------------------------- /rhapsody/rhapqw.txt: -------------------------------------------------------------------------------- 1 | Put this QuakeWorld executable in a directory with the registered quake and QuakeWorld files. You should be able to launch it from the workspace or the command line. 2 | 3 | The sound is a bit lagged and will likely drift on longer games, because I am using the system timer to calculate sample position. This will need to be fixed at some point. 4 | 5 | There is no assembly language in yet, and it is still just using DPS to draw, so it isn't real fast yet. Run it on a ppro with a write combining video driver. 6 | 7 | If you ever lose your mouse cursor inapropriately due to the game messing up, if you can restart QuakeWorld, you can type "showmouse" to bump the visibility counter by one. 8 | 9 | You should eb able to connect to any QuakeWorld server, but you will have to do it with manual connect commands at the console, because we don't have either qspy or a browser plugin (yet) for openstep to find servers. 10 | 11 | Because the configuration ranges are different than windows, things like sensitivity and volume will need to be specified at the console. 12 | 13 | Some typical values (all of these should be saved automatically in the config file): 14 | 15 | vid_mode 1 16 | Sets 320*240 resolution. 320*200 (vid_mode 0) is somewhat faster, but looks scrunched at some desktop resolutions. 17 | 18 | vid_stretched 1 19 | Sets pixel doubling. Slower, of cource. 20 | 21 | snd_mixahead 0.2 22 | Because this isn't very fast yet, you probably want to increase the mixahead from 0.1 so the sound doesn't break up. 23 | 24 | volume 0.15 25 | The default 0.7 is VERY loud on my system. I don't know what it will be like on other systems. 26 | 27 | gamma 1.4 28 | Because openstep desktops are typically gamma corrected, the game will look washed out with default settings. Geater than 1.0 gets darker, less than gets brighter. 29 | 30 | sensitivity 20 31 | The normal slider range probably doesn't give enough speed for most people. 32 | 33 | in_mouse 0 34 | The mouse is normally grabbed for controlling the game. Setting this to 0 will give the mouse back to the desktop. 35 | 36 | 37 | -------------------------------------------------------------------------------- /server/sv_null.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 | // sv_null.c -- this file can stub out the entire server system 21 | // for pure net-only clients 22 | 23 | void SV_Init (void) 24 | { 25 | } 26 | 27 | void SV_Shutdown (char *finalmsg, qboolean reconnect) 28 | { 29 | } 30 | 31 | void SV_Frame (float time) 32 | { 33 | } 34 | 35 | -------------------------------------------------------------------------------- /solaris/g_so.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 | int main(int argc, char *argv) 21 | { 22 | } 23 | -------------------------------------------------------------------------------- /solaris/glob.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 22 | #include "../linux/glob.h" 23 | 24 | /* Like glob_match, but match PATTERN against any final segment of TEXT. */ 25 | static int glob_match_after_star(char *pattern, char *text) 26 | { 27 | register char *p = pattern, *t = text; 28 | register char c, c1; 29 | 30 | while ((c = *p++) == '?' || c == '*') 31 | if (c == '?' && *t++ == '\0') 32 | return 0; 33 | 34 | if (c == '\0') 35 | return 1; 36 | 37 | if (c == '\\') 38 | c1 = *p; 39 | else 40 | c1 = c; 41 | 42 | while (1) { 43 | if ((c == '[' || *t == c1) && glob_match(p - 1, t)) 44 | return 1; 45 | if (*t++ == '\0') 46 | return 0; 47 | } 48 | } 49 | 50 | /* Return nonzero if PATTERN has any special globbing chars in it. */ 51 | static int glob_pattern_p(char *pattern) 52 | { 53 | register char *p = pattern; 54 | register char c; 55 | int open = 0; 56 | 57 | while ((c = *p++) != '\0') 58 | switch (c) { 59 | case '?': 60 | case '*': 61 | return 1; 62 | 63 | case '[': /* Only accept an open brace if there is a close */ 64 | open++; /* brace to match it. Bracket expressions must be */ 65 | continue; /* complete, according to Posix.2 */ 66 | case ']': 67 | if (open) 68 | return 1; 69 | continue; 70 | 71 | case '\\': 72 | if (*p++ == '\0') 73 | return 0; 74 | } 75 | 76 | return 0; 77 | } 78 | 79 | /* Match the pattern PATTERN against the string TEXT; 80 | return 1 if it matches, 0 otherwise. 81 | 82 | A match means the entire string TEXT is used up in matching. 83 | 84 | In the pattern string, `*' matches any sequence of characters, 85 | `?' matches any character, [SET] matches any character in the specified set, 86 | [!SET] matches any character not in the specified set. 87 | 88 | A set is composed of characters or ranges; a range looks like 89 | character hyphen character (as in 0-9 or A-Z). 90 | [0-9a-zA-Z_] is the set of characters allowed in C identifiers. 91 | Any other character in the pattern must be matched exactly. 92 | 93 | To suppress the special syntactic significance of any of `[]*?!-\', 94 | and match the character exactly, precede it with a `\'. 95 | */ 96 | 97 | int glob_match(char *pattern, char *text) 98 | { 99 | register char *p = pattern, *t = text; 100 | register char c; 101 | 102 | while ((c = *p++) != '\0') 103 | switch (c) { 104 | case '?': 105 | if (*t == '\0') 106 | return 0; 107 | else 108 | ++t; 109 | break; 110 | 111 | case '\\': 112 | if (*p++ != *t++) 113 | return 0; 114 | break; 115 | 116 | case '*': 117 | return glob_match_after_star(p, t); 118 | 119 | case '[': 120 | { 121 | register char c1 = *t++; 122 | int invert; 123 | 124 | if (!c1) 125 | return (0); 126 | 127 | invert = ((*p == '!') || (*p == '^')); 128 | if (invert) 129 | p++; 130 | 131 | c = *p++; 132 | while (1) { 133 | register char cstart = c, cend = c; 134 | 135 | if (c == '\\') { 136 | cstart = *p++; 137 | cend = cstart; 138 | } 139 | if (c == '\0') 140 | return 0; 141 | 142 | c = *p++; 143 | if (c == '-' && *p != ']') { 144 | cend = *p++; 145 | if (cend == '\\') 146 | cend = *p++; 147 | if (cend == '\0') 148 | return 0; 149 | c = *p++; 150 | } 151 | if (c1 >= cstart && c1 <= cend) 152 | goto match; 153 | if (c == ']') 154 | break; 155 | } 156 | if (!invert) 157 | return 0; 158 | break; 159 | 160 | match: 161 | /* Skip the rest of the [...] construct that already matched. */ 162 | while (c != ']') { 163 | if (c == '\0') 164 | return 0; 165 | c = *p++; 166 | if (c == '\0') 167 | return 0; 168 | else if (c == '\\') 169 | ++p; 170 | } 171 | if (invert) 172 | return 0; 173 | break; 174 | } 175 | 176 | default: 177 | if (c != *t++) 178 | return 0; 179 | } 180 | 181 | return *t == '\0'; 182 | } 183 | 184 | -------------------------------------------------------------------------------- /solaris/glob.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 | int glob_match(char *pattern, char *text); 21 | -------------------------------------------------------------------------------- /solaris/readme.solaris: -------------------------------------------------------------------------------- 1 | Quake2 Dedicated 3.20 For Sun Solaris (x86 and Sparc) 2 | ----------------------------------------------------- 3 | 4 | Please see the readme.txt file included for general information about the 5 | game. This file contains Solaris specific information. 6 | 7 | Requirements 8 | ------------ 9 | 10 | Solaris x86 2.5.1 or later, Sun Solaris Sparc 2.5.1 or later. 11 | 12 | Installation 13 | ------------ 14 | 15 | To install the Quake2 data files, mount your Quake2 CD and copy 16 | the directory install/data to the location where you want Quake2. You 17 | can also symlink it, but I don't recommend that. Around 200MB of disk 18 | space is required for a full installation. 19 | 20 | For example: 21 | cp -r /mnt/cdrom/install/data/* /usr/games/quake2 22 | 23 | This binary only runs as a dedicated server and requires no special 24 | user permissions. 25 | 26 | You can also set dmflags, timelimit, etc. in a config file, like so: 27 | set timelimit 20 28 | set fraglimit 25 29 | set dmflags 532 30 | map fact3 31 | 32 | Then exec that config file on load, like so: 33 | 34 | ./q2ded +exec server.cfg 35 | 36 | If you use a config file, you must put a 'map' command in it or the 37 | server won't load a map. 38 | 39 | To run a dedicated server in the background, use this; 40 | 41 | nohup ./q2ded +exec server.cfg & 42 | 43 | A better way is to run Quake2 on a tty via screen. screen can be found 44 | at ftp://prep.ai.mit.edu/pub/gnu/screen-3.7.4.tar.gz. 45 | 46 | ----------------------------------------------------------------------------- 47 | 48 | Solaris Quake2 is an unsupported product. Usage of this product is bound by 49 | the legal notice found on the distribution Quake2 CDROM. 50 | 51 | /// Zoid 52 | zoid@idsoftware.com 53 | 54 | -------------------------------------------------------------------------------- /win32/conproc.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 | // conproc.h -- support for qhost 21 | 22 | void InitConProc (int argc, char **argv); 23 | void DeinitConProc (void); 24 | 25 | -------------------------------------------------------------------------------- /win32/glw_win.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 | #ifndef _WIN32 21 | # error You should not be including this file on this platform 22 | #endif 23 | 24 | #ifndef __GLW_WIN_H__ 25 | #define __GLW_WIN_H__ 26 | 27 | typedef struct 28 | { 29 | HINSTANCE hInstance; 30 | void *wndproc; 31 | 32 | HDC hDC; // handle to device context 33 | HWND hWnd; // handle to window 34 | HGLRC hGLRC; // handle to GL rendering context 35 | 36 | HINSTANCE hinstOpenGL; // HINSTANCE for the OpenGL library 37 | 38 | qboolean minidriver; 39 | qboolean allowdisplaydepthchange; 40 | qboolean mcd_accelerated; 41 | 42 | FILE *log_fp; 43 | } glwstate_t; 44 | 45 | extern glwstate_t glw_state; 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /win32/q2.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sebh/QuakeIIDXXII/52b83821fa02d9a8b662805bad1a9b9c59bd716f/win32/q2.ico -------------------------------------------------------------------------------- /win32/q2.rc: -------------------------------------------------------------------------------- 1 | //Microsoft Developer Studio generated resource script. 2 | // 3 | #include "resource.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #include "afxres.h" 11 | // If the above generates a compilation error, it means you have not installed MFC with visual studio. 12 | // Instead, you can include windows.h. 13 | //#include "windows.h" 14 | 15 | ///////////////////////////////////////////////////////////////////////////// 16 | #undef APSTUDIO_READONLY_SYMBOLS 17 | 18 | ///////////////////////////////////////////////////////////////////////////// 19 | // English (U.S.) resources 20 | 21 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 22 | #ifdef _WIN32 23 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 24 | #pragma code_page(1252) 25 | #endif //_WIN32 26 | 27 | #ifdef APSTUDIO_INVOKED 28 | ///////////////////////////////////////////////////////////////////////////// 29 | // 30 | // TEXTINCLUDE 31 | // 32 | 33 | 1 TEXTINCLUDE DISCARDABLE 34 | BEGIN 35 | "resource.h\0" 36 | END 37 | 38 | 2 TEXTINCLUDE DISCARDABLE 39 | BEGIN 40 | "#include ""afxres.h""\r\n" 41 | "\0" 42 | END 43 | 44 | 3 TEXTINCLUDE DISCARDABLE 45 | BEGIN 46 | "\r\n" 47 | "\0" 48 | END 49 | 50 | #endif // APSTUDIO_INVOKED 51 | 52 | 53 | ///////////////////////////////////////////////////////////////////////////// 54 | // 55 | // Icon 56 | // 57 | 58 | // Icon with lowest ID value placed first to ensure application icon 59 | // remains consistent on all systems. 60 | IDI_ICON1 ICON DISCARDABLE "q2.ico" 61 | #endif // English (U.S.) resources 62 | ///////////////////////////////////////////////////////////////////////////// 63 | 64 | 65 | 66 | #ifndef APSTUDIO_INVOKED 67 | ///////////////////////////////////////////////////////////////////////////// 68 | // 69 | // Generated from the TEXTINCLUDE 3 resource. 70 | // 71 | 72 | 73 | ///////////////////////////////////////////////////////////////////////////// 74 | #endif // not APSTUDIO_INVOKED 75 | 76 | -------------------------------------------------------------------------------- /win32/qe3.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sebh/QuakeIIDXXII/52b83821fa02d9a8b662805bad1a9b9c59bd716f/win32/qe3.ico -------------------------------------------------------------------------------- /win32/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Developer Studio generated include file. 3 | // Used by q2.rc 4 | // 5 | #define IDI_ICON1 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 103 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1000 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /win32/rw_win.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 | #ifndef __RW_WIN_H__ 21 | #define __RW_WIN_H__ 22 | 23 | #include 24 | #include 25 | 26 | typedef struct 27 | { 28 | HINSTANCE hInstance; 29 | void *wndproc; 30 | HDC hDC; // global DC we're using 31 | HWND hWnd; // HWND of parent window 32 | 33 | HDC hdcDIBSection; // DC compatible with DIB section 34 | HBITMAP hDIBSection; // DIB section 35 | unsigned char *pDIBBase; // DIB base pointer, NOT used directly for rendering! 36 | 37 | HPALETTE hPal; // palette we're using 38 | HPALETTE hpalOld; // original system palette 39 | COLORREF oldsyscolors[20]; // original system colors 40 | 41 | HINSTANCE hinstDDRAW; // library instance for DDRAW.DLL 42 | LPDIRECTDRAW lpDirectDraw; // pointer to DirectDraw object 43 | 44 | LPDIRECTDRAWSURFACE lpddsFrontBuffer; // video card display memory front buffer 45 | LPDIRECTDRAWSURFACE lpddsBackBuffer; // system memory backbuffer 46 | LPDIRECTDRAWSURFACE lpddsOffScreenBuffer; // system memory backbuffer 47 | LPDIRECTDRAWPALETTE lpddpPalette; // DirectDraw palette 48 | 49 | qboolean palettized; // true if desktop is paletted 50 | qboolean modex; 51 | 52 | qboolean initializing; 53 | } swwstate_t; 54 | 55 | extern swwstate_t sww_state; 56 | 57 | /* 58 | ** DIB code 59 | */ 60 | qboolean DIB_Init( unsigned char **ppbuffer, int *ppitch ); 61 | void DIB_Shutdown( void ); 62 | void DIB_SetPalette( const unsigned char *palette ); 63 | 64 | qboolean DDRAW_Init( unsigned char **ppbuffer, int *ppitch ); 65 | void DDRAW_Shutdown( void ); 66 | void DDRAW_SetPalette( const unsigned char *palette ); 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /win32/winquake.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 | // winquake.h: Win32-specific Quake header file 21 | 22 | #pragma warning( disable : 4229 ) // mgraph gets this 23 | 24 | #include 25 | 26 | #include 27 | 28 | #define WINDOW_STYLE (WS_OVERLAPPED|WS_BORDER|WS_CAPTION|WS_VISIBLE) 29 | 30 | extern HINSTANCE global_hInstance; 31 | 32 | extern LPDIRECTSOUND pDS; 33 | extern LPDIRECTSOUNDBUFFER pDSBuf; 34 | 35 | extern DWORD gSndBufSize; 36 | 37 | extern HWND cl_hwnd; 38 | extern qboolean ActiveApp, Minimized; 39 | 40 | void IN_Activate (qboolean active); 41 | void IN_MouseEvent (int mstate); 42 | 43 | extern int window_center_x, window_center_y; 44 | extern RECT window_rect; 45 | -------------------------------------------------------------------------------- /win32/winquake.rc: -------------------------------------------------------------------------------- 1 | //Microsoft Developer Studio generated resource script. 2 | // 3 | #include "resource.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #include "afxres.h" 11 | 12 | ///////////////////////////////////////////////////////////////////////////// 13 | #undef APSTUDIO_READONLY_SYMBOLS 14 | 15 | ///////////////////////////////////////////////////////////////////////////// 16 | // English (U.S.) resources 17 | 18 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 19 | #ifdef _WIN32 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | #pragma code_page(1252) 22 | #endif //_WIN32 23 | 24 | #ifdef APSTUDIO_INVOKED 25 | ///////////////////////////////////////////////////////////////////////////// 26 | // 27 | // TEXTINCLUDE 28 | // 29 | 30 | 1 TEXTINCLUDE DISCARDABLE 31 | BEGIN 32 | "resource.h\0" 33 | END 34 | 35 | 2 TEXTINCLUDE DISCARDABLE 36 | BEGIN 37 | "#include ""afxres.h""\r\n" 38 | "\0" 39 | END 40 | 41 | 3 TEXTINCLUDE DISCARDABLE 42 | BEGIN 43 | "\r\n" 44 | "\0" 45 | END 46 | 47 | #endif // APSTUDIO_INVOKED 48 | 49 | 50 | ///////////////////////////////////////////////////////////////////////////// 51 | // 52 | // Icon 53 | // 54 | 55 | // Icon with lowest ID value placed first to ensure application icon 56 | // remains consistent on all systems. 57 | IDI_ICON1 ICON DISCARDABLE "q2.ico" 58 | 59 | ///////////////////////////////////////////////////////////////////////////// 60 | // 61 | // Dialog 62 | // 63 | 64 | IDD_DIALOG1 DIALOGEX 0, 0, 62, 21 65 | STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | WS_POPUP | 66 | WS_VISIBLE 67 | EXSTYLE WS_EX_TOOLWINDOW | WS_EX_CLIENTEDGE 68 | FONT 16, "Times New Roman", 0, 0, 0x1 69 | BEGIN 70 | CTEXT "Starting QW...",IDC_STATIC,4,6,54,8 71 | END 72 | 73 | 74 | ///////////////////////////////////////////////////////////////////////////// 75 | // 76 | // String Table 77 | // 78 | 79 | STRINGTABLE DISCARDABLE 80 | BEGIN 81 | IDS_STRING1 "WinQuake" 82 | END 83 | 84 | #endif // English (U.S.) resources 85 | ///////////////////////////////////////////////////////////////////////////// 86 | 87 | 88 | 89 | #ifndef APSTUDIO_INVOKED 90 | ///////////////////////////////////////////////////////////////////////////// 91 | // 92 | // Generated from the TEXTINCLUDE 3 resource. 93 | // 94 | 95 | 96 | ///////////////////////////////////////////////////////////////////////////// 97 | #endif // not APSTUDIO_INVOKED 98 | 99 | --------------------------------------------------------------------------------