├── 3.15_Changes.txt ├── 3.16_Changes.txt ├── 3.17_Changes.txt ├── 3.18_changes.txt ├── baseq2 ├── config.cfg └── save │ └── save0 │ ├── game.ssv │ └── server.ssv ├── 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 ├── 2do.txt ├── Makefile.Linux.i386 ├── ctf.001 ├── ctf.def ├── ctf.dsp ├── ctf.plg ├── docs │ ├── admin.gif │ ├── adminset.gif │ ├── automac.gif │ ├── ghost.jpg │ ├── grapple.jpg │ ├── layout.jpg │ ├── mainctf_back.jpg │ ├── menu.gif │ ├── q2ctf.html │ ├── say_team.gif │ ├── stats.jpg │ ├── tech1.gif │ ├── tech2.gif │ ├── tech3.gif │ └── tech4.gif ├── g_ai.c ├── g_chase.c ├── g_cmds.c ├── g_combat.c ├── g_ctf.c ├── g_ctf.h ├── g_func.c ├── g_items.c ├── g_local.h ├── g_main.c ├── g_misc.c ├── g_monster.c ├── g_phys.c ├── g_save.c ├── g_spawn.c ├── g_svcmds.c ├── g_target.c ├── g_trigger.c ├── g_utils.c ├── g_weapon.c ├── game.h ├── layout.txt ├── m_move.c ├── m_player.h ├── p_client.c ├── p_hud.c ├── p_menu.c ├── p_menu.h ├── p_trail.c ├── p_view.c ├── p_weapon.c ├── q_shared.c └── q_shared.h ├── game ├── g_ai.c ├── g_chase.c ├── g_cmds.c ├── g_combat.c ├── g_func.c ├── g_items.c ├── g_local.h ├── g_main.c ├── g_misc.c ├── g_monster.c ├── g_phys.c ├── g_save.c ├── g_spawn.c ├── g_svcmds.c ├── g_target.c ├── g_trigger.c ├── g_turret.c ├── g_utils.c ├── g_weapon.c ├── game.001 ├── game.def ├── game.dsp ├── game.h ├── game.plg ├── m_actor.c ├── m_actor.h ├── m_berserk.c ├── m_berserk.h ├── m_boss2.c ├── m_boss2.h ├── m_boss3.c ├── m_boss31.c ├── m_boss31.h ├── m_boss32.c ├── m_boss32.h ├── m_brain.c ├── m_brain.h ├── m_chick.c ├── m_chick.h ├── m_flash.c ├── m_flipper.c ├── m_flipper.h ├── m_float.c ├── m_float.h ├── m_flyer.c ├── m_flyer.h ├── m_gladiator.c ├── m_gladiator.h ├── m_gunner.c ├── m_gunner.h ├── m_hover.c ├── m_hover.h ├── m_infantry.c ├── m_infantry.h ├── m_insane.c ├── m_insane.h ├── m_medic.c ├── m_medic.h ├── m_move.c ├── m_mutant.c ├── m_mutant.h ├── m_parasite.c ├── m_parasite.h ├── m_player.h ├── m_rider.h ├── m_soldier.c ├── m_soldier.h ├── m_supertank.c ├── m_supertank.h ├── m_tank.c ├── m_tank.h ├── p_client.c ├── p_hud.c ├── p_trail.c ├── p_view.c ├── p_weapon.c ├── q_shared.c └── q_shared.h ├── gnu.txt ├── irix ├── 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.AXP ├── Makefile.i386 ├── block16.h ├── block8.h ├── cd_linux.c ├── d_copy.s ├── d_ifacea.h ├── d_polysa.s ├── gl_fxmesa.c ├── glob.c ├── glob.h ├── in_linux.c ├── math.s ├── net_udp.c ├── q_shlinux.c ├── qasm.h ├── qgl_linux.c ├── 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 ├── makezip ├── makezip.bat ├── 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.001 ├── quake2.bce ├── quake2.bcp ├── quake2.dsp ├── quake2.dsw ├── quake2.mak ├── quake2.opt ├── quake2.plg ├── readme.txt ├── ref_gl ├── anorms.h ├── anormtab.h ├── gl_draw.c ├── gl_image.c ├── gl_light.c ├── gl_local.h ├── gl_mesh.c ├── gl_model.c ├── gl_model.h ├── gl_rmain.c ├── gl_rmisc.c ├── gl_rsurf.c ├── gl_warp.c ├── qgl.h ├── ref_gl.001 ├── ref_gl.def ├── ref_gl.dsp ├── ref_gl.plg └── 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.001 ├── ref_soft.def ├── ref_soft.dsp └── ref_soft.plg ├── rhapsody ├── in_next.m ├── makefile.bak ├── 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.OLD ├── Makefile.Solaris ├── g_so.c ├── glob.c ├── glob.h ├── net_udp.c ├── q_shsolaris.c └── sys_solaris.c ├── unix ├── makefile ├── makefile_old └── next │ └── sv_ccmds.o └── win32 ├── cd_win.c ├── conproc.c ├── conproc.h ├── glw_imp.c ├── glw_win.h ├── in_win.c ├── net_wins.c ├── q2.aps ├── 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.aps ├── winquake.h └── winquake.rc /3.15_Changes.txt: -------------------------------------------------------------------------------- 1 | 2 | Quake2 3.15 Upgrade 3 | ------------------- 4 | 5 | This upgrade addresses several features, including security, playability, and 6 | enhancements. 7 | 8 | A new map is also included (in baseq2\pak3.pak) called match1, Reckless 9 | Abandon. This map is designed for one on one deathmatch play. It was built 10 | by American McGee and Dave "Zoid" Kirsch. 11 | 12 | This patch replaces the following files: 13 | 14 | quake2.exe 15 | 3dfxgl.dll 16 | pvrgl.dll 17 | ref_gl.dll 18 | ref_soft.dll 19 | baseq2\gamex86.dll 20 | 21 | Changes 22 | ------- 23 | 24 | - Added visible weapons support. This is precached with a special symbol, i.e. 25 | gi.modelindex("#w_shotgun.md2") which causes the client to autobind it to 26 | the players current weapon model. Plug in player models can optionally 27 | support the visible weapons. Any that do not support it will use their 28 | default weapon.md2 files automatically. 29 | Visible weapons files for plug in player models are not downloaded 30 | automatically--only the default weapon.md2 (and skin) is. 31 | The Visible weapon models themselves are not included. They can be 32 | downloaded from http://www.telefragged.com/vwep/ 33 | - Rewrote the some of the net code to use optimized network packets for 34 | projectiles. This is transparent to the game code, but improves netplay 35 | substancially. The hyperblaster doesn't flood modem players anymore. 36 | - Rewrote the packet checksum code to be more portable and defeat proxy bots 37 | yet again. 38 | - Autodownload support is in. The following items will be automatcally 39 | downloaded as needed: 40 | - world map (and textures) 41 | - models 42 | - sounds (precached ones) 43 | - plug in player model, skin, skin_i and weapon.md2 44 | downloads go to a temp file (maps/blah.tmp for example) and get renamed 45 | when done. autoresume is supported (if you lose connect during the 46 | download, just reconnect and resume). Server has fine control over 47 | the downloads with the following new cvars: 48 | allow_download - global download on/off 49 | allow_download_players - players download on/off 50 | allow_download_models - models download on/off 51 | allow_download_sounds - sounds download on/off 52 | allow_download_maps - maps download on/off 53 | maps that are in pak files will _not_ autodownload from the server, this 54 | is for copyright considerations. 55 | The QuakeWorld bug of the server map changing while download a map has 56 | been fixed. 57 | - New option in the Multiplayer/Player Setup menu for setting your connection 58 | speed. This sets a default rate for the player and can improve net 59 | performance for modem connections. 60 | - Rewrote some of the save game code to make it more portable. I wanted to 61 | completely rewrite the entire save game system and make it portable across 62 | versions and operating systems, but this would require an enormous amount 63 | of work. 64 | - Added another 512 configure strings for general usage for mod makers. 65 | This gives lots of room for general string displays on the HUD and in other 66 | data. 67 | - Player movement code re-written to be similiar to that of NetQuake and 68 | later versions of QuakeWorld. Player has more control in the air and 69 | gets a boost in vertical speed when jumping off the top of ramps. 70 | - Fixed up serverrecord so that it works correctly with the later versions. 71 | serverrecord lets the server do a recording of the current game that 72 | demo editors can use to make demos from any PVS in the level. Server 73 | recorded demos are BIG. Will look at using delta compression in them 74 | to cut down the size. 75 | - Copy protection CD check has been removed. 76 | - Quake2 3.15 has changed the protocol (so old servers will not run) but 77 | all existing game dlls can run on the new version (albiet without the 78 | new features such as visible weapons). 79 | - Added flood protection. Controlled from the following cvars: 80 | flood_msgs - maximum number of messages allowed in the time period 81 | specified by flood_persecond 82 | flood_persecond - time period that a maximum of flood_msgs messages are 83 | permitted 84 | flood_waitdelay - amount of time a client gets muzzled for flooding 85 | - fixed it so blaster/hyperblaster shots aren't treated as solid when 86 | predicting--you aren't clipped against them now. 87 | - gender support is now in. The userinfo cvar "gender" can be set to 88 | male/female/none (none for neutral messages). This doesn't affect sounds 89 | but does affect death messages in the game. The models male and cyborg 90 | default to gender male, and female and crackhor default to female. 91 | Everything else defaults to none, but you can set it by typing 92 | "gender male" or "gender female" as appropriate. 93 | - IP banning support ala QW. It's built into the game dll as 'sv' console 94 | commands. This list is: 95 | sv addip - adds an ip to the ban list 96 | sv listip - removes an ip from the ban list 97 | sv writeip - writes the ban list to /listip.cfg. You can 98 | exec this on a server load to load the list on subsequent server runs. 99 | like so: quake2 +set dedicated 1 +exec listip.cfg 100 | sv removeip - remove an ip from the list 101 | the ip list is a simple mask system. Adding 192.168 to the list 102 | would block out everyone in the 192.168.*.* net block. You get 1024 bans, 103 | if you need more, recompile the game dll. :) 104 | A new cvar is also supported called 'filterban'. It defaults to one which 105 | means "allow everyone to connect _except_ those matching in the ban list." 106 | If you set it to zero, the meaning reverses like so, "don't allow anyone 107 | to connect unless they are in the list." 108 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /baseq2/config.cfg: -------------------------------------------------------------------------------- 1 | // generated by quake, do not modify 2 | bind TAB "inven" 3 | bind ENTER "invuse" 4 | bind ESCAPE "togglemenu" 5 | bind SPACE "+moveup" 6 | bind ' "inven_drop" 7 | bind + "sizeup" 8 | bind , "+moveleft" 9 | bind - "sizedown" 10 | bind . "+moveright" 11 | bind / "weapnext" 12 | bind 0 "use BFG10K" 13 | bind 1 "use Blaster" 14 | bind 2 "use Shotgun" 15 | bind 3 "use Super Shotgun" 16 | bind 4 "use Machinegun" 17 | bind 5 "use Chaingun" 18 | bind 6 "use Grenade Launcher" 19 | bind 7 "use Rocket Launcher" 20 | bind 8 "use HyperBlaster" 21 | bind 9 "use Railgun" 22 | bind = "sizeup" 23 | bind [ "invprev" 24 | bind \ "+mlook" 25 | bind ] "invnext" 26 | bind ` "toggleconsole" 27 | bind a "+moveleft" 28 | bind b "use rebreather" 29 | bind c "+movedown" 30 | bind d "+moveright" 31 | bind e "weapnext" 32 | bind g "use grenades" 33 | bind h "wave 0" 34 | bind i "use invulnerability" 35 | bind j "wave 1" 36 | bind k "wave 2" 37 | bind l "wave 3" 38 | bind p "use shield" 39 | bind q "invprev" 40 | bind r "invuse" 41 | bind s "+back" 42 | bind t "messagemode" 43 | bind u "wave 4" 44 | bind w "+forward" 45 | bind x "centerview" 46 | bind z "+movedown" 47 | bind ~ "toggleconsole" 48 | bind BACKSPACE "invdrop" 49 | bind UPARROW "+forward" 50 | bind DOWNARROW "+back" 51 | bind LEFTARROW "+left" 52 | bind RIGHTARROW "+right" 53 | bind ALT "+strafe" 54 | bind CTRL "+attack" 55 | bind SHIFT "+speed" 56 | bind F1 "cmd help" 57 | bind F2 "menu_savegame" 58 | bind F3 "menu_loadgame" 59 | bind F4 "give ammo" 60 | bind F5 "give weapons" 61 | bind F6 "r_speeds 0" 62 | bind F7 "r_speeds 1" 63 | bind F8 "notarget" 64 | bind F9 "noclip" 65 | bind F10 "god" 66 | bind F11 "screenshot" 67 | bind F12 "quit" 68 | bind INS "+klook" 69 | bind DEL "+lookdown" 70 | bind PGDN "+lookup" 71 | bind PGUP "+lookup" 72 | bind END "centerview" 73 | bind MOUSE1 "+attack" 74 | bind MOUSE2 "+strafe" 75 | bind MOUSE3 "+mlook" 76 | bind PAUSE "pause" 77 | set gl_3dlabs_broken "1" 78 | set gl_swapinterval "1" 79 | set gl_ext_compiled_vertex_array "1" 80 | set gl_ext_pointparameters "1" 81 | set gl_ext_multitexture "1" 82 | set gl_ext_palettedtexture "1" 83 | set gl_ext_swapinterval "1" 84 | set gl_vertex_arrays "0" 85 | set gl_texturesolidmode "default" 86 | set gl_texturealphamode "default" 87 | set gl_texturemode "GL_LINEAR_MIPMAP_NEAREST" 88 | set gl_driver "opengl32" 89 | set gl_finish "0" 90 | set gl_shadows "0" 91 | set gl_mode "3" 92 | set gl_modulate "1" 93 | set gl_particle_att_c "0.01" 94 | set gl_particle_att_b "0.0" 95 | set gl_particle_att_a "0.01" 96 | set gl_particle_size "40" 97 | set gl_particle_max_size "40" 98 | set gl_particle_min_size "2" 99 | set g_select_empty "0" 100 | set in_joystick "0" 101 | set in_mouse "1" 102 | set cl_vwep "1" 103 | set gender_auto "1" 104 | set gender "male" 105 | set fov "90" 106 | set msg "1" 107 | set rate "25000" 108 | set freelook "0" 109 | set cl_stereo_separation "0.4" 110 | set adr8 "" 111 | set adr7 "" 112 | set adr6 "" 113 | set adr5 "" 114 | set adr4 "" 115 | set adr3 "" 116 | set adr2 "" 117 | set adr1 "" 118 | set adr0 "" 119 | set cd_nocd "0" 120 | set s_primary "0" 121 | set s_mixahead "0.2" 122 | set s_loadas8bit "1" 123 | set s_khz "11" 124 | set s_volume "0.7" 125 | set sw_mode "0" 126 | set sw_stipplealpha "0" 127 | set sw_allow_modex "1" 128 | set vid_gamma "1" 129 | set vid_ypos "32" 130 | set vid_xpos "115" 131 | set vid_ref "gl" 132 | set sv_reconnect_limit "3" 133 | set allow_download_maps "1" 134 | set allow_download_sounds "1" 135 | set allow_download_models "1" 136 | set allow_download_players "0" 137 | set allow_download "0" 138 | set hostname "noname" 139 | set skin "male/grunt" 140 | set name "hook" 141 | set lookstrafe "0" 142 | set lookspring "1" 143 | set m_pitch "-0.022000" 144 | set hand "2" 145 | set cl_run "0" 146 | set crosshair "1" 147 | set sensitivity "9.000000" 148 | set win_noalttab "0" 149 | set vid_fullscreen "0" 150 | set viewsize "100" 151 | -------------------------------------------------------------------------------- /baseq2/save/save0/game.ssv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/id-Software/Quake-2/372afde46e7defc9dd2d719a1732b8ace1fa096e/baseq2/save/save0/game.ssv -------------------------------------------------------------------------------- /baseq2/save/save0/server.ssv: -------------------------------------------------------------------------------- 1 | ENTERING Outer Basebase1maxentities1024gamedateAug 29 1998gamenamebaseq2sv_airaccelerate0maxclients8cheats1coop0deathmatch1skill1game -------------------------------------------------------------------------------- /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 ; ibegin, the playsound will 49 | // be assigned to a channel 50 | typedef struct playsound_s 51 | { 52 | struct playsound_s *prev, *next; 53 | sfx_t *sfx; 54 | float volume; 55 | float attenuation; 56 | int entnum; 57 | int entchannel; 58 | qboolean fixed_origin; // use origin field instead of entnum's origin 59 | vec3_t origin; 60 | unsigned begin; // begin on this sample 61 | } playsound_t; 62 | 63 | typedef struct 64 | { 65 | int channels; 66 | int samples; // mono samples in buffer 67 | int submission_chunk; // don't mix less than this # 68 | int samplepos; // in mono samples 69 | int samplebits; 70 | int speed; 71 | byte *buffer; 72 | } dma_t; 73 | 74 | // !!! if this is changed, the asm code must change !!! 75 | typedef struct 76 | { 77 | sfx_t *sfx; // sfx number 78 | int leftvol; // 0-255 volume 79 | int rightvol; // 0-255 volume 80 | int end; // end time in global paintsamples 81 | int pos; // sample position in sfx 82 | int looping; // where to loop, -1 = no looping OBSOLETE? 83 | int entnum; // to allow overriding a specific sound 84 | int entchannel; // 85 | vec3_t origin; // only use if fixed_origin is set 86 | vec_t dist_mult; // distance multiplier (attenuation/clipK) 87 | int master_vol; // 0-255 master volume 88 | qboolean fixed_origin; // use origin instead of fetching entnum's origin 89 | qboolean autosound; // from an entity->sound, cleared each frame 90 | } channel_t; 91 | 92 | typedef struct 93 | { 94 | int rate; 95 | int width; 96 | int channels; 97 | int loopstart; 98 | int samples; 99 | int dataofs; // chunk starts this many bytes from file start 100 | } wavinfo_t; 101 | 102 | 103 | /* 104 | ==================================================================== 105 | 106 | SYSTEM SPECIFIC FUNCTIONS 107 | 108 | ==================================================================== 109 | */ 110 | 111 | // initializes cycling through a DMA buffer and returns information on it 112 | qboolean SNDDMA_Init(void); 113 | 114 | // gets the current DMA position 115 | int SNDDMA_GetDMAPos(void); 116 | 117 | // shutdown the DMA xfer. 118 | void SNDDMA_Shutdown(void); 119 | 120 | void SNDDMA_BeginPainting (void); 121 | 122 | void SNDDMA_Submit(void); 123 | 124 | //==================================================================== 125 | 126 | #define MAX_CHANNELS 32 127 | extern channel_t channels[MAX_CHANNELS]; 128 | 129 | extern int paintedtime; 130 | extern int s_rawend; 131 | extern vec3_t listener_origin; 132 | extern vec3_t listener_forward; 133 | extern vec3_t listener_right; 134 | extern vec3_t listener_up; 135 | extern dma_t dma; 136 | extern playsound_t s_pendingplays; 137 | 138 | #define MAX_RAW_SAMPLES 8192 139 | extern portable_samplepair_t s_rawsamples[MAX_RAW_SAMPLES]; 140 | 141 | extern cvar_t *s_volume; 142 | extern cvar_t *s_nosound; 143 | extern cvar_t *s_loadas8bit; 144 | extern cvar_t *s_khz; 145 | extern cvar_t *s_show; 146 | extern cvar_t *s_mixahead; 147 | extern cvar_t *s_testsound; 148 | extern cvar_t *s_primary; 149 | 150 | wavinfo_t GetWavinfo (char *name, byte *wav, int wavlength); 151 | 152 | void S_InitScaletable (void); 153 | 154 | sfxcache_t *S_LoadSound (sfx_t *s); 155 | 156 | void S_IssuePlaysound (playsound_t *ps); 157 | 158 | void S_PaintChannels(int endtime); 159 | 160 | // picks a channel based on priorities, empty slots, number of channels 161 | channel_t *S_PickChannel(int entnum, int entchannel); 162 | 163 | // spatializes a channel 164 | void S_Spatialize(channel_t *ch); 165 | -------------------------------------------------------------------------------- /client/sound.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | struct sfx_s; 22 | 23 | void S_Init (void); 24 | void S_Shutdown (void); 25 | 26 | // if origin is NULL, the sound will be dynamically sourced from the entity 27 | void S_StartSound (vec3_t origin, int entnum, int entchannel, struct sfx_s *sfx, float fvol, float attenuation, float timeofs); 28 | void S_StartLocalSound (char *s); 29 | 30 | void S_RawSamples (int samples, int rate, int width, int channels, byte *data); 31 | 32 | void S_StopAllSounds(void); 33 | void S_Update (vec3_t origin, vec3_t v_forward, vec3_t v_right, vec3_t v_up); 34 | 35 | void S_Activate (qboolean active); 36 | 37 | void S_BeginRegistration (void); 38 | struct sfx_s *S_RegisterSound (char *sample); 39 | void S_EndRegistration (void); 40 | 41 | struct sfx_s *S_FindName (char *name, qboolean create); 42 | 43 | // the sound code makes callbacks to the client for entitiy position 44 | // information, so entities can be dynamically re-spatialized 45 | void CL_GetEntitySoundOrigin (int ent, vec3_t org); 46 | -------------------------------------------------------------------------------- /client/vid.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | // vid.h -- video driver defs 21 | 22 | typedef struct vrect_s 23 | { 24 | int x,y,width,height; 25 | } vrect_t; 26 | 27 | typedef struct 28 | { 29 | int width; 30 | int height; 31 | } viddef_t; 32 | 33 | extern viddef_t viddef; // global video state 34 | 35 | // Video module initialisation etc 36 | void VID_Init (void); 37 | void VID_Shutdown (void); 38 | void VID_CheckChanges (void); 39 | 40 | void VID_MenuInit( void ); 41 | void VID_MenuDraw( void ); 42 | const char *VID_MenuKey( int ); 43 | -------------------------------------------------------------------------------- /client/x86.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 "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/2do.txt: -------------------------------------------------------------------------------- 1 | 2 | switching teams during setup should clear ready 3 | center stuff should be left aligned on admin 4 | match command for ingame match request 5 | admin kick option (menu) 6 | can't join team when match PREGAME (menu was still open) 7 | server pause in 3.15? 8 | 9 | *time changes are broken 10 | *ghosting in makes you invisible (svf_noclient?) 11 | *ghost doesn't restore frags 12 | *resetall needs to clear grapple (and match start) 13 | *reset all techs at match start 14 | *'and admin' 15 | *timelimit/fraglimit disabled in match mode 16 | *telefrags at start of match [needs tested] 17 | -------------------------------------------------------------------------------- /ctf/Makefile.Linux.i386: -------------------------------------------------------------------------------- 1 | # 2 | # Quake2 gamei386.so Makefile for Linux 2.0 3 | # 4 | # Jan '98 by Zoid 5 | # 6 | # ELF only 7 | # 8 | # Probably requires GNU make 9 | # 10 | # This builds the gamei386.so for Linux based on the q2source_12_11.zip 11 | # release. 12 | # Put his Makefile in the game subdirectory you get when you unzip 13 | # q2source_12_11.zip. 14 | # 15 | # There are two compiler errors you'll get, the following fixes 16 | # are necessary: 17 | # 18 | # In g_local.h (around line 828), you must change the 19 | # typedef struct g_client_s { ... } gclient_t; 20 | # to just: 21 | # struct g_client_s { ... }; 22 | # The typedef is already defined elsewhere (seems to compile fine under 23 | # MSCV++ for Win32 for some reason). 24 | # 25 | # m_player.h has a Ctrl-Z at the end (damn DOS editors). Remove it or 26 | # gcc complains. 27 | # 28 | # Note that the source in q2source_12_11.zip is for version 3.05. To 29 | # get it to run with Linux 3.10, change the following in game.h: 30 | # #define GAME_API_VERSION 1 31 | # change it to: 32 | # #define GAME_API_VERSION 2 33 | 34 | ARCH=i386 35 | CC=gcc 36 | BASE_CFLAGS=-Dstricmp=strcasecmp 37 | 38 | #use these cflags to optimize it 39 | CFLAGS=$(BASE_CFLAGS) -m486 -O6 -ffast-math -funroll-loops \ 40 | -fomit-frame-pointer -fexpensive-optimizations -malign-loops=2 \ 41 | -malign-jumps=2 -malign-functions=2 42 | #use these when debugging 43 | #CFLAGS=$(BASE_CFLAGS) -g 44 | 45 | OBJDIR=linux 46 | 47 | LDFLAGS=-ldl -lm 48 | SHLIBEXT=so 49 | SHLIBCFLAGS=-fPIC 50 | SHLIBLDFLAGS=-shared 51 | 52 | DO_CC=$(CC) $(CFLAGS) $(SHLIBCFLAGS) -o $@ -c $< 53 | 54 | ############################################################################# 55 | # SETUP AND BUILD 56 | # GAME 57 | ############################################################################# 58 | 59 | GAME_OBJS = \ 60 | $(OBJDIR)/g_ai.o $(OBJDIR)/p_client.o $(OBJDIR)/g_svcmds.o $(OBJDIR)/g_cmds.o \ 61 | $(OBJDIR)/g_combat.o $(OBJDIR)/g_func.o $(OBJDIR)/g_items.o \ 62 | $(OBJDIR)/g_main.o $(OBJDIR)/g_misc.o $(OBJDIR)/g_monster.o $(OBJDIR)/g_phys.o \ 63 | $(OBJDIR)/g_save.o $(OBJDIR)/g_spawn.o \ 64 | $(OBJDIR)/g_target.o $(OBJDIR)/g_trigger.o $(OBJDIR)/g_utils.o $(OBJDIR)/g_weapon.o \ 65 | $(OBJDIR)/m_move.o \ 66 | $(OBJDIR)/p_hud.o $(OBJDIR)/p_trail.o $(OBJDIR)/p_view.o $(OBJDIR)/p_weapon.o \ 67 | $(OBJDIR)/q_shared.o $(OBJDIR)/g_ctf.o $(OBJDIR)/p_menu.o $(OBJDIR)/g_chase.o 68 | 69 | game$(ARCH).$(SHLIBEXT) : $(GAME_OBJS) 70 | $(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(GAME_OBJS) 71 | 72 | $(OBJDIR)/g_ai.o : g_ai.c 73 | $(DO_CC) 74 | 75 | $(OBJDIR)/p_client.o : p_client.c 76 | $(DO_CC) 77 | 78 | $(OBJDIR)/g_svcmds.o : g_svcmds.c 79 | $(DO_CC) 80 | 81 | $(OBJDIR)/g_cmds.o : g_cmds.c 82 | $(DO_CC) 83 | 84 | $(OBJDIR)/g_combat.o : g_combat.c 85 | $(DO_CC) 86 | 87 | $(OBJDIR)/g_func.o : g_func.c 88 | $(DO_CC) 89 | 90 | $(OBJDIR)/g_items.o : g_items.c 91 | $(DO_CC) 92 | 93 | $(OBJDIR)/g_main.o : g_main.c 94 | $(DO_CC) 95 | 96 | $(OBJDIR)/g_misc.o : g_misc.c 97 | $(DO_CC) 98 | 99 | $(OBJDIR)/g_monster.o : g_monster.c 100 | $(DO_CC) 101 | 102 | $(OBJDIR)/g_phys.o : g_phys.c 103 | $(DO_CC) 104 | 105 | $(OBJDIR)/g_save.o : g_save.c 106 | $(DO_CC) 107 | 108 | $(OBJDIR)/g_spawn.o : g_spawn.c 109 | $(DO_CC) 110 | 111 | $(OBJDIR)/g_target.o : g_target.c 112 | $(DO_CC) 113 | 114 | $(OBJDIR)/g_trigger.o : g_trigger.c 115 | $(DO_CC) 116 | 117 | $(OBJDIR)/g_utils.o : g_utils.c 118 | $(DO_CC) 119 | 120 | $(OBJDIR)/g_weapon.o : g_weapon.c 121 | $(DO_CC) 122 | 123 | $(OBJDIR)/m_move.o : m_move.c 124 | $(DO_CC) 125 | 126 | $(OBJDIR)/p_hud.o : p_hud.c 127 | $(DO_CC) 128 | 129 | $(OBJDIR)/p_trail.o : p_trail.c 130 | $(DO_CC) 131 | 132 | $(OBJDIR)/p_view.o : p_view.c 133 | $(DO_CC) 134 | 135 | $(OBJDIR)/p_weapon.o : p_weapon.c 136 | $(DO_CC) 137 | 138 | $(OBJDIR)/q_shared.o : q_shared.c 139 | $(DO_CC) 140 | 141 | $(OBJDIR)/g_ctf.o : g_ctf.c 142 | $(DO_CC) 143 | 144 | $(OBJDIR)/p_menu.o : p_menu.c 145 | $(DO_CC) 146 | 147 | $(OBJDIR)/g_chase.o : g_chase.c 148 | $(DO_CC) 149 | 150 | ############################################################################# 151 | # MISC 152 | ############################################################################# 153 | 154 | clean: 155 | -rm -f $(GAME_OBJS) 156 | 157 | depend: 158 | gcc -MM $(GAME_OBJS:.o=.c) 159 | 160 | -------------------------------------------------------------------------------- /ctf/ctf.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | GetGameAPI 3 | -------------------------------------------------------------------------------- /ctf/ctf.plg: -------------------------------------------------------------------------------- 1 | --------------------Configuration: ctf - Win32 Debug Alpha-------------------- 2 | Begining build with project "G:\quake2\code\ctf\ctf.dsp", at root. 3 | Active configuration is Win32 (ALPHA) Dynamic-Link Library (based on Win32 (ALPHA) Dynamic-Link Library) 4 | 5 | Project's tools are: 6 | "OLE Type Library Maker" with flags "/nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 " 7 | "C/C++ Compiler for Alpha" with flags "/nologo /MTd /Gt0 /W3 /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR".\DebugAXP/" /Fp".\DebugAXP/ctf.pch" /YX /Fo".\DebugAXP/" /Fd".\DebugAXP/" /FD /c " 8 | "Win32 Resource Compiler" with flags "/l 0x409 /d "_DEBUG" " 9 | "Browser Database Maker" with flags "/nologo /o"..\DebugAXP/ctf.bsc" " 10 | "COFF Linker for Alpha" with flags "winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"..\DebugAXP/gameaxp.pdb" /map:".\DebugAXP/gameaxp.map" /debug /machine:ALPHA /def:".\ctf.def" /out:".\debugAXP\gameaxp.dll" /implib:"..\DebugAXP/gameaxp.lib" /pdbtype:sept " 11 | "Custom Build" with flags "" 12 | "" with flags "" 13 | 14 | 15 | 16 | 17 | gameaxp.dll - 0 error(s), 0 warning(s) 18 | -------------------------------------------------------------------------------- /ctf/docs/admin.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/id-Software/Quake-2/372afde46e7defc9dd2d719a1732b8ace1fa096e/ctf/docs/admin.gif -------------------------------------------------------------------------------- /ctf/docs/adminset.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/id-Software/Quake-2/372afde46e7defc9dd2d719a1732b8ace1fa096e/ctf/docs/adminset.gif -------------------------------------------------------------------------------- /ctf/docs/automac.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/id-Software/Quake-2/372afde46e7defc9dd2d719a1732b8ace1fa096e/ctf/docs/automac.gif -------------------------------------------------------------------------------- /ctf/docs/ghost.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/id-Software/Quake-2/372afde46e7defc9dd2d719a1732b8ace1fa096e/ctf/docs/ghost.jpg -------------------------------------------------------------------------------- /ctf/docs/grapple.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/id-Software/Quake-2/372afde46e7defc9dd2d719a1732b8ace1fa096e/ctf/docs/grapple.jpg -------------------------------------------------------------------------------- /ctf/docs/layout.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/id-Software/Quake-2/372afde46e7defc9dd2d719a1732b8ace1fa096e/ctf/docs/layout.jpg -------------------------------------------------------------------------------- /ctf/docs/mainctf_back.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/id-Software/Quake-2/372afde46e7defc9dd2d719a1732b8ace1fa096e/ctf/docs/mainctf_back.jpg -------------------------------------------------------------------------------- /ctf/docs/menu.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/id-Software/Quake-2/372afde46e7defc9dd2d719a1732b8ace1fa096e/ctf/docs/menu.gif -------------------------------------------------------------------------------- /ctf/docs/q2ctf.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/id-Software/Quake-2/372afde46e7defc9dd2d719a1732b8ace1fa096e/ctf/docs/q2ctf.html -------------------------------------------------------------------------------- /ctf/docs/say_team.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/id-Software/Quake-2/372afde46e7defc9dd2d719a1732b8ace1fa096e/ctf/docs/say_team.gif -------------------------------------------------------------------------------- /ctf/docs/stats.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/id-Software/Quake-2/372afde46e7defc9dd2d719a1732b8ace1fa096e/ctf/docs/stats.jpg -------------------------------------------------------------------------------- /ctf/docs/tech1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/id-Software/Quake-2/372afde46e7defc9dd2d719a1732b8ace1fa096e/ctf/docs/tech1.gif -------------------------------------------------------------------------------- /ctf/docs/tech2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/id-Software/Quake-2/372afde46e7defc9dd2d719a1732b8ace1fa096e/ctf/docs/tech2.gif -------------------------------------------------------------------------------- /ctf/docs/tech3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/id-Software/Quake-2/372afde46e7defc9dd2d719a1732b8ace1fa096e/ctf/docs/tech3.gif -------------------------------------------------------------------------------- /ctf/docs/tech4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/id-Software/Quake-2/372afde46e7defc9dd2d719a1732b8ace1fa096e/ctf/docs/tech4.gif -------------------------------------------------------------------------------- /ctf/g_chase.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | #include "g_local.h" 21 | 22 | 23 | void UpdateChaseCam(edict_t *ent) 24 | { 25 | vec3_t o, ownerv, goal; 26 | edict_t *targ; 27 | vec3_t forward, right; 28 | trace_t trace; 29 | int i; 30 | vec3_t oldgoal; 31 | vec3_t angles; 32 | 33 | // is our chase target gone? 34 | if (!ent->client->chase_target->inuse) { 35 | ent->client->chase_target = NULL; 36 | return; 37 | } 38 | 39 | targ = ent->client->chase_target; 40 | 41 | VectorCopy(targ->s.origin, ownerv); 42 | VectorCopy(ent->s.origin, oldgoal); 43 | 44 | ownerv[2] += targ->viewheight; 45 | 46 | VectorCopy(targ->client->v_angle, angles); 47 | if (angles[PITCH] > 56) 48 | angles[PITCH] = 56; 49 | AngleVectors (angles, forward, right, NULL); 50 | VectorNormalize(forward); 51 | VectorMA(ownerv, -30, forward, o); 52 | 53 | if (o[2] < targ->s.origin[2] + 20) 54 | o[2] = targ->s.origin[2] + 20; 55 | 56 | // jump animation lifts 57 | if (!targ->groundentity) 58 | o[2] += 16; 59 | 60 | trace = gi.trace(ownerv, vec3_origin, vec3_origin, o, targ, MASK_SOLID); 61 | 62 | VectorCopy(trace.endpos, goal); 63 | 64 | VectorMA(goal, 2, forward, goal); 65 | 66 | // pad for floors and ceilings 67 | VectorCopy(goal, o); 68 | o[2] += 6; 69 | trace = gi.trace(goal, vec3_origin, vec3_origin, o, targ, MASK_SOLID); 70 | if (trace.fraction < 1) { 71 | VectorCopy(trace.endpos, goal); 72 | goal[2] -= 6; 73 | } 74 | 75 | VectorCopy(goal, o); 76 | o[2] -= 6; 77 | trace = gi.trace(goal, vec3_origin, vec3_origin, o, targ, MASK_SOLID); 78 | if (trace.fraction < 1) { 79 | VectorCopy(trace.endpos, goal); 80 | goal[2] += 6; 81 | } 82 | 83 | ent->client->ps.pmove.pm_type = PM_FREEZE; 84 | 85 | VectorCopy(goal, ent->s.origin); 86 | for (i=0 ; i<3 ; i++) 87 | ent->client->ps.pmove.delta_angles[i] = ANGLE2SHORT(targ->client->v_angle[i] - ent->client->resp.cmd_angles[i]); 88 | 89 | VectorCopy(targ->client->v_angle, ent->client->ps.viewangles); 90 | VectorCopy(targ->client->v_angle, ent->client->v_angle); 91 | 92 | ent->viewheight = 0; 93 | ent->client->ps.pmove.pm_flags |= PMF_NO_PREDICTION; 94 | gi.linkentity(ent); 95 | 96 | if ((!ent->client->showscores && !ent->client->menu && 97 | !ent->client->showinventory && !ent->client->showhelp && 98 | !(level.framenum & 31)) || ent->client->update_chase) { 99 | char s[1024]; 100 | 101 | ent->client->update_chase = false; 102 | sprintf(s, "xv 0 yb -68 string2 \"Chasing %s\"", 103 | targ->client->pers.netname); 104 | gi.WriteByte (svc_layout); 105 | gi.WriteString (s); 106 | gi.unicast(ent, false); 107 | } 108 | 109 | } 110 | 111 | void ChaseNext(edict_t *ent) 112 | { 113 | int i; 114 | edict_t *e; 115 | 116 | if (!ent->client->chase_target) 117 | return; 118 | 119 | i = ent->client->chase_target - g_edicts; 120 | do { 121 | i++; 122 | if (i > maxclients->value) 123 | i = 1; 124 | e = g_edicts + i; 125 | if (!e->inuse) 126 | continue; 127 | if (e->solid != SOLID_NOT) 128 | break; 129 | } while (e != ent->client->chase_target); 130 | 131 | ent->client->chase_target = e; 132 | ent->client->update_chase = true; 133 | } 134 | 135 | void ChasePrev(edict_t *ent) 136 | { 137 | int i; 138 | edict_t *e; 139 | 140 | if (!ent->client->chase_target) 141 | return; 142 | 143 | i = ent->client->chase_target - g_edicts; 144 | do { 145 | i--; 146 | if (i < 1) 147 | i = maxclients->value; 148 | e = g_edicts + i; 149 | if (!e->inuse) 150 | continue; 151 | if (e->solid != SOLID_NOT) 152 | break; 153 | } while (e != ent->client->chase_target); 154 | 155 | ent->client->chase_target = e; 156 | ent->client->update_chase = true; 157 | } 158 | -------------------------------------------------------------------------------- /ctf/g_svcmds.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | #include "g_local.h" 22 | 23 | 24 | void Svcmd_Test_f (void) 25 | { 26 | gi.cprintf (NULL, PRINT_HIGH, "Svcmd_Test_f()\n"); 27 | } 28 | 29 | /* 30 | ================= 31 | ServerCommand 32 | 33 | ServerCommand will be called when an "sv" command is issued. 34 | The game can issue gi.argc() / gi.argv() commands to get the rest 35 | of the parameters 36 | ================= 37 | */ 38 | void ServerCommand (void) 39 | { 40 | char *cmd; 41 | 42 | cmd = gi.argv(1); 43 | if (Q_stricmp (cmd, "test") == 0) 44 | Svcmd_Test_f (); 45 | else 46 | gi.cprintf (NULL, PRINT_HIGH, "Unknown server command \"%s\"\n", cmd); 47 | } 48 | 49 | -------------------------------------------------------------------------------- /ctf/layout.txt: -------------------------------------------------------------------------------- 1 | 01234567890123456789012345678901234567890123456789012345678901234567890123456789 2 | 3 | Name Score Kills Deaths BaseDef CarrierDef Efficiency 4 | 0123456789012345 01234 01234 012345 0123456 0123456789 0123456789 5 | >BC>Zoid 110 40 10 5 10 75% 6 | 7 | Name |Score|Kills|Deaths|BaseDef|CarrierDef|Efficiency| 8 | ----------------+-----+-----+------+-------+----------+----------+ 9 | 0123456789012345|01234|01234|012345|0123456|0123456789|0123456789| 10 | >BC>Zoid | 110| 40| 10| 5| 10| 75%| 11 | 12 | %-16.16s|%5d|%5d|%6d|%7d|%10d|%10d| 13 | -------------------------------------------------------------------------------- /ctf/p_menu.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | enum { 22 | PMENU_ALIGN_LEFT, 23 | PMENU_ALIGN_CENTER, 24 | PMENU_ALIGN_RIGHT 25 | }; 26 | 27 | typedef struct pmenuhnd_s { 28 | struct pmenu_s *entries; 29 | int cur; 30 | int num; 31 | void *arg; 32 | } pmenuhnd_t; 33 | 34 | typedef void (*SelectFunc_t)(edict_t *ent, pmenuhnd_t *hnd); 35 | 36 | typedef struct pmenu_s { 37 | char *text; 38 | int align; 39 | SelectFunc_t SelectFunc; 40 | } pmenu_t; 41 | 42 | pmenuhnd_t *PMenu_Open(edict_t *ent, pmenu_t *entries, int cur, int num, void *arg); 43 | void PMenu_Close(edict_t *ent); 44 | void PMenu_UpdateEntry(pmenu_t *entry, const char *text, int align, SelectFunc_t SelectFunc); 45 | void PMenu_Do_Update(edict_t *ent); 46 | void PMenu_Update(edict_t *ent); 47 | void PMenu_Next(edict_t *ent); 48 | void PMenu_Prev(edict_t *ent); 49 | void PMenu_Select(edict_t *ent); 50 | -------------------------------------------------------------------------------- /ctf/p_trail.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | #include "g_local.h" 21 | 22 | 23 | /* 24 | ============================================================================== 25 | 26 | PLAYER TRAIL 27 | 28 | ============================================================================== 29 | 30 | This is a circular list containing the a list of points of where 31 | the player has been recently. It is used by monsters for pursuit. 32 | 33 | .origin the spot 34 | .owner forward link 35 | .aiment backward link 36 | */ 37 | 38 | 39 | #define TRAIL_LENGTH 8 40 | 41 | edict_t *trail[TRAIL_LENGTH]; 42 | int trail_head; 43 | qboolean trail_active = false; 44 | 45 | #define NEXT(n) (((n) + 1) & (TRAIL_LENGTH - 1)) 46 | #define PREV(n) (((n) - 1) & (TRAIL_LENGTH - 1)) 47 | 48 | 49 | void PlayerTrail_Init (void) 50 | { 51 | int n; 52 | 53 | if (deathmatch->value /* FIXME || coop */) 54 | return; 55 | 56 | for (n = 0; n < TRAIL_LENGTH; n++) 57 | { 58 | trail[n] = G_Spawn(); 59 | trail[n]->classname = "player_trail"; 60 | } 61 | 62 | trail_head = 0; 63 | trail_active = true; 64 | } 65 | 66 | 67 | void PlayerTrail_Add (vec3_t spot) 68 | { 69 | vec3_t temp; 70 | 71 | if (!trail_active) 72 | return; 73 | 74 | VectorCopy (spot, trail[trail_head]->s.origin); 75 | 76 | trail[trail_head]->timestamp = level.time; 77 | 78 | VectorSubtract (spot, trail[PREV(trail_head)]->s.origin, temp); 79 | trail[trail_head]->s.angles[1] = vectoyaw (temp); 80 | 81 | trail_head = NEXT(trail_head); 82 | } 83 | 84 | 85 | void PlayerTrail_New (vec3_t spot) 86 | { 87 | if (!trail_active) 88 | return; 89 | 90 | PlayerTrail_Init (); 91 | PlayerTrail_Add (spot); 92 | } 93 | 94 | 95 | edict_t *PlayerTrail_PickFirst (edict_t *self) 96 | { 97 | int marker; 98 | int n; 99 | 100 | if (!trail_active) 101 | return NULL; 102 | 103 | for (marker = trail_head, n = TRAIL_LENGTH; n; n--) 104 | { 105 | if(trail[marker]->timestamp <= self->monsterinfo.trail_time) 106 | marker = NEXT(marker); 107 | else 108 | break; 109 | } 110 | 111 | if (visible(self, trail[marker])) 112 | { 113 | return trail[marker]; 114 | } 115 | 116 | if (visible(self, trail[PREV(marker)])) 117 | { 118 | return trail[PREV(marker)]; 119 | } 120 | 121 | return trail[marker]; 122 | } 123 | 124 | edict_t *PlayerTrail_PickNext (edict_t *self) 125 | { 126 | int marker; 127 | int n; 128 | 129 | if (!trail_active) 130 | return NULL; 131 | 132 | for (marker = trail_head, n = TRAIL_LENGTH; n; n--) 133 | { 134 | if(trail[marker]->timestamp <= self->monsterinfo.trail_time) 135 | marker = NEXT(marker); 136 | else 137 | break; 138 | } 139 | 140 | return trail[marker]; 141 | } 142 | 143 | edict_t *PlayerTrail_LastSpot (void) 144 | { 145 | return trail[PREV(trail_head)]; 146 | } 147 | -------------------------------------------------------------------------------- /game/g_chase.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | #include "g_local.h" 21 | 22 | void UpdateChaseCam(edict_t *ent) 23 | { 24 | vec3_t o, ownerv, goal; 25 | edict_t *targ; 26 | vec3_t forward, right; 27 | trace_t trace; 28 | int i; 29 | vec3_t oldgoal; 30 | vec3_t angles; 31 | 32 | // is our chase target gone? 33 | if (!ent->client->chase_target->inuse 34 | || ent->client->chase_target->client->resp.spectator) { 35 | edict_t *old = ent->client->chase_target; 36 | ChaseNext(ent); 37 | if (ent->client->chase_target == old) { 38 | ent->client->chase_target = NULL; 39 | ent->client->ps.pmove.pm_flags &= ~PMF_NO_PREDICTION; 40 | return; 41 | } 42 | } 43 | 44 | targ = ent->client->chase_target; 45 | 46 | VectorCopy(targ->s.origin, ownerv); 47 | VectorCopy(ent->s.origin, oldgoal); 48 | 49 | ownerv[2] += targ->viewheight; 50 | 51 | VectorCopy(targ->client->v_angle, angles); 52 | if (angles[PITCH] > 56) 53 | angles[PITCH] = 56; 54 | AngleVectors (angles, forward, right, NULL); 55 | VectorNormalize(forward); 56 | VectorMA(ownerv, -30, forward, o); 57 | 58 | if (o[2] < targ->s.origin[2] + 20) 59 | o[2] = targ->s.origin[2] + 20; 60 | 61 | // jump animation lifts 62 | if (!targ->groundentity) 63 | o[2] += 16; 64 | 65 | trace = gi.trace(ownerv, vec3_origin, vec3_origin, o, targ, MASK_SOLID); 66 | 67 | VectorCopy(trace.endpos, goal); 68 | 69 | VectorMA(goal, 2, forward, goal); 70 | 71 | // pad for floors and ceilings 72 | VectorCopy(goal, o); 73 | o[2] += 6; 74 | trace = gi.trace(goal, vec3_origin, vec3_origin, o, targ, MASK_SOLID); 75 | if (trace.fraction < 1) { 76 | VectorCopy(trace.endpos, goal); 77 | goal[2] -= 6; 78 | } 79 | 80 | VectorCopy(goal, o); 81 | o[2] -= 6; 82 | trace = gi.trace(goal, vec3_origin, vec3_origin, o, targ, MASK_SOLID); 83 | if (trace.fraction < 1) { 84 | VectorCopy(trace.endpos, goal); 85 | goal[2] += 6; 86 | } 87 | 88 | if (targ->deadflag) 89 | ent->client->ps.pmove.pm_type = PM_DEAD; 90 | else 91 | ent->client->ps.pmove.pm_type = PM_FREEZE; 92 | 93 | VectorCopy(goal, ent->s.origin); 94 | for (i=0 ; i<3 ; i++) 95 | ent->client->ps.pmove.delta_angles[i] = ANGLE2SHORT(targ->client->v_angle[i] - ent->client->resp.cmd_angles[i]); 96 | 97 | if (targ->deadflag) { 98 | ent->client->ps.viewangles[ROLL] = 40; 99 | ent->client->ps.viewangles[PITCH] = -15; 100 | ent->client->ps.viewangles[YAW] = targ->client->killer_yaw; 101 | } else { 102 | VectorCopy(targ->client->v_angle, ent->client->ps.viewangles); 103 | VectorCopy(targ->client->v_angle, ent->client->v_angle); 104 | } 105 | 106 | ent->viewheight = 0; 107 | ent->client->ps.pmove.pm_flags |= PMF_NO_PREDICTION; 108 | gi.linkentity(ent); 109 | } 110 | 111 | void ChaseNext(edict_t *ent) 112 | { 113 | int i; 114 | edict_t *e; 115 | 116 | if (!ent->client->chase_target) 117 | return; 118 | 119 | i = ent->client->chase_target - g_edicts; 120 | do { 121 | i++; 122 | if (i > maxclients->value) 123 | i = 1; 124 | e = g_edicts + i; 125 | if (!e->inuse) 126 | continue; 127 | if (!e->client->resp.spectator) 128 | break; 129 | } while (e != ent->client->chase_target); 130 | 131 | ent->client->chase_target = e; 132 | ent->client->update_chase = true; 133 | } 134 | 135 | void ChasePrev(edict_t *ent) 136 | { 137 | int i; 138 | edict_t *e; 139 | 140 | if (!ent->client->chase_target) 141 | return; 142 | 143 | i = ent->client->chase_target - g_edicts; 144 | do { 145 | i--; 146 | if (i < 1) 147 | i = maxclients->value; 148 | e = g_edicts + i; 149 | if (!e->inuse) 150 | continue; 151 | if (!e->client->resp.spectator) 152 | break; 153 | } while (e != ent->client->chase_target); 154 | 155 | ent->client->chase_target = e; 156 | ent->client->update_chase = true; 157 | } 158 | 159 | void GetChaseTarget(edict_t *ent) 160 | { 161 | int i; 162 | edict_t *other; 163 | 164 | for (i = 1; i <= maxclients->value; i++) { 165 | other = g_edicts + i; 166 | if (other->inuse && !other->client->resp.spectator) { 167 | ent->client->chase_target = other; 168 | ent->client->update_chase = true; 169 | UpdateChaseCam(ent); 170 | return; 171 | } 172 | } 173 | gi.centerprintf(ent, "No other players to chase."); 174 | } 175 | 176 | -------------------------------------------------------------------------------- /game/game.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | GetGameAPI 3 | -------------------------------------------------------------------------------- /game/game.plg: -------------------------------------------------------------------------------- 1 | --------------------Configuration: game - Win32 Release Alpha-------------------- 2 | Begining build with project "G:\quake2\code\game\game.dsp", at root. 3 | Active configuration is Win32 (ALPHA) Dynamic-Link Library (based on Win32 (ALPHA) Dynamic-Link Library) 4 | 5 | Project's tools are: 6 | "OLE Type Library Maker" with flags "/nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 " 7 | "C/C++ Compiler for Alpha" with flags "/nologo /QA21164 /MT /Gt0 /W3 /GX /Zi /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "C_ONLY" /Fp".\ReleaseAXP/game.pch" /YX /Fo".\ReleaseAXP/" /Fd".\ReleaseAXP/" /FD /c " 8 | "Win32 Resource Compiler" with flags "/l 0x409 /d "NDEBUG" " 9 | "Browser Database Maker" with flags "/nologo /o"..\ReleaseAXP/game.bsc" " 10 | "COFF Linker for Alpha" with flags "kernel32.lib user32.lib gdi32.lib /nologo /base:"0x20000000" /subsystem:windows /dll /incremental:no /pdb:"..\ReleaseAXP/gameaxp.pdb" /debug /machine:ALPHA /def:".\game.def" /out:"..\ReleaseAXP/gameaxp.dll" /implib:"..\ReleaseAXP/gameaxp.lib" " 11 | "Custom Build" with flags "" 12 | "" with flags "" 13 | 14 | Creating temp file "C:\TEMP\RSPA6.tmp" with contents 17 | Creating command line "cl.exe @C:\TEMP\RSPA6.tmp" 18 | Creating temp file "C:\TEMP\RSPA7.tmp" with contents 67 | Creating command line "link.exe @C:\TEMP\RSPA7.tmp" 68 | Compiling... 69 | p_weapon.c 70 | Linking... 71 | Creating library ..\ReleaseAXP/gameaxp.lib and object ..\ReleaseAXP/gameaxp.exp 72 | 73 | 74 | 75 | gameaxp.dll - 0 error(s), 0 warning(s) 76 | -------------------------------------------------------------------------------- /game/m_boss3.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | /* 21 | ============================================================================== 22 | 23 | boss3 24 | 25 | ============================================================================== 26 | */ 27 | 28 | #include "g_local.h" 29 | #include "m_boss32.h" 30 | 31 | void Use_Boss3 (edict_t *ent, edict_t *other, edict_t *activator) 32 | { 33 | gi.WriteByte (svc_temp_entity); 34 | gi.WriteByte (TE_BOSSTPORT); 35 | gi.WritePosition (ent->s.origin); 36 | gi.multicast (ent->s.origin, MULTICAST_PVS); 37 | G_FreeEdict (ent); 38 | } 39 | 40 | void Think_Boss3Stand (edict_t *ent) 41 | { 42 | if (ent->s.frame == FRAME_stand260) 43 | ent->s.frame = FRAME_stand201; 44 | else 45 | ent->s.frame++; 46 | ent->nextthink = level.time + FRAMETIME; 47 | } 48 | 49 | /*QUAKED monster_boss3_stand (1 .5 0) (-32 -32 0) (32 32 90) 50 | 51 | Just stands and cycles in one place until targeted, then teleports away. 52 | */ 53 | void SP_monster_boss3_stand (edict_t *self) 54 | { 55 | if (deathmatch->value) 56 | { 57 | G_FreeEdict (self); 58 | return; 59 | } 60 | 61 | self->movetype = MOVETYPE_STEP; 62 | self->solid = SOLID_BBOX; 63 | self->model = "models/monsters/boss3/rider/tris.md2"; 64 | self->s.modelindex = gi.modelindex (self->model); 65 | self->s.frame = FRAME_stand201; 66 | 67 | gi.soundindex ("misc/bigtele.wav"); 68 | 69 | VectorSet (self->mins, -32, -32, 0); 70 | VectorSet (self->maxs, 32, 32, 90); 71 | 72 | self->use = Use_Boss3; 73 | self->think = Think_Boss3Stand; 74 | self->nextthink = level.time + FRAMETIME; 75 | gi.linkentity (self); 76 | } 77 | -------------------------------------------------------------------------------- /game/m_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_parasite.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | // G:\quake2\baseq2\models/monsters/parasite 21 | 22 | // This file generated by ModelGen - Do NOT Modify 23 | 24 | #define FRAME_break01 0 25 | #define FRAME_break02 1 26 | #define FRAME_break03 2 27 | #define FRAME_break04 3 28 | #define FRAME_break05 4 29 | #define FRAME_break06 5 30 | #define FRAME_break07 6 31 | #define FRAME_break08 7 32 | #define FRAME_break09 8 33 | #define FRAME_break10 9 34 | #define FRAME_break11 10 35 | #define FRAME_break12 11 36 | #define FRAME_break13 12 37 | #define FRAME_break14 13 38 | #define FRAME_break15 14 39 | #define FRAME_break16 15 40 | #define FRAME_break17 16 41 | #define FRAME_break18 17 42 | #define FRAME_break19 18 43 | #define FRAME_break20 19 44 | #define FRAME_break21 20 45 | #define FRAME_break22 21 46 | #define FRAME_break23 22 47 | #define FRAME_break24 23 48 | #define FRAME_break25 24 49 | #define FRAME_break26 25 50 | #define FRAME_break27 26 51 | #define FRAME_break28 27 52 | #define FRAME_break29 28 53 | #define FRAME_break30 29 54 | #define FRAME_break31 30 55 | #define FRAME_break32 31 56 | #define FRAME_death101 32 57 | #define FRAME_death102 33 58 | #define FRAME_death103 34 59 | #define FRAME_death104 35 60 | #define FRAME_death105 36 61 | #define FRAME_death106 37 62 | #define FRAME_death107 38 63 | #define FRAME_drain01 39 64 | #define FRAME_drain02 40 65 | #define FRAME_drain03 41 66 | #define FRAME_drain04 42 67 | #define FRAME_drain05 43 68 | #define FRAME_drain06 44 69 | #define FRAME_drain07 45 70 | #define FRAME_drain08 46 71 | #define FRAME_drain09 47 72 | #define FRAME_drain10 48 73 | #define FRAME_drain11 49 74 | #define FRAME_drain12 50 75 | #define FRAME_drain13 51 76 | #define FRAME_drain14 52 77 | #define FRAME_drain15 53 78 | #define FRAME_drain16 54 79 | #define FRAME_drain17 55 80 | #define FRAME_drain18 56 81 | #define FRAME_pain101 57 82 | #define FRAME_pain102 58 83 | #define FRAME_pain103 59 84 | #define FRAME_pain104 60 85 | #define FRAME_pain105 61 86 | #define FRAME_pain106 62 87 | #define FRAME_pain107 63 88 | #define FRAME_pain108 64 89 | #define FRAME_pain109 65 90 | #define FRAME_pain110 66 91 | #define FRAME_pain111 67 92 | #define FRAME_run01 68 93 | #define FRAME_run02 69 94 | #define FRAME_run03 70 95 | #define FRAME_run04 71 96 | #define FRAME_run05 72 97 | #define FRAME_run06 73 98 | #define FRAME_run07 74 99 | #define FRAME_run08 75 100 | #define FRAME_run09 76 101 | #define FRAME_run10 77 102 | #define FRAME_run11 78 103 | #define FRAME_run12 79 104 | #define FRAME_run13 80 105 | #define FRAME_run14 81 106 | #define FRAME_run15 82 107 | #define FRAME_stand01 83 108 | #define FRAME_stand02 84 109 | #define FRAME_stand03 85 110 | #define FRAME_stand04 86 111 | #define FRAME_stand05 87 112 | #define FRAME_stand06 88 113 | #define FRAME_stand07 89 114 | #define FRAME_stand08 90 115 | #define FRAME_stand09 91 116 | #define FRAME_stand10 92 117 | #define FRAME_stand11 93 118 | #define FRAME_stand12 94 119 | #define FRAME_stand13 95 120 | #define FRAME_stand14 96 121 | #define FRAME_stand15 97 122 | #define FRAME_stand16 98 123 | #define FRAME_stand17 99 124 | #define FRAME_stand18 100 125 | #define FRAME_stand19 101 126 | #define FRAME_stand20 102 127 | #define FRAME_stand21 103 128 | #define FRAME_stand22 104 129 | #define FRAME_stand23 105 130 | #define FRAME_stand24 106 131 | #define FRAME_stand25 107 132 | #define FRAME_stand26 108 133 | #define FRAME_stand27 109 134 | #define FRAME_stand28 110 135 | #define FRAME_stand29 111 136 | #define FRAME_stand30 112 137 | #define FRAME_stand31 113 138 | #define FRAME_stand32 114 139 | #define FRAME_stand33 115 140 | #define FRAME_stand34 116 141 | #define FRAME_stand35 117 142 | 143 | #define MODEL_SCALE 1.000000 144 | -------------------------------------------------------------------------------- /game/m_rider.h: -------------------------------------------------------------------------------- 1 | // G:\quake2\baseq2\models/monsters/boss3/rider 2 | 3 | // This file generated by ModelGen - Do NOT Modify 4 | 5 | #define FRAME_stand201 0 6 | #define FRAME_stand202 1 7 | #define FRAME_stand203 2 8 | #define FRAME_stand204 3 9 | #define FRAME_stand205 4 10 | #define FRAME_stand206 5 11 | #define FRAME_stand207 6 12 | #define FRAME_stand208 7 13 | #define FRAME_stand209 8 14 | #define FRAME_stand210 9 15 | #define FRAME_stand211 10 16 | #define FRAME_stand212 11 17 | #define FRAME_stand213 12 18 | #define FRAME_stand214 13 19 | #define FRAME_stand215 14 20 | #define FRAME_stand216 15 21 | #define FRAME_stand217 16 22 | #define FRAME_stand218 17 23 | #define FRAME_stand219 18 24 | #define FRAME_stand220 19 25 | #define FRAME_stand221 20 26 | #define FRAME_stand222 21 27 | #define FRAME_stand223 22 28 | #define FRAME_stand224 23 29 | #define FRAME_stand225 24 30 | #define FRAME_stand226 25 31 | #define FRAME_stand227 26 32 | #define FRAME_stand228 27 33 | #define FRAME_stand229 28 34 | #define FRAME_stand230 29 35 | #define FRAME_stand231 30 36 | #define FRAME_stand232 31 37 | #define FRAME_stand233 32 38 | #define FRAME_stand234 33 39 | #define FRAME_stand235 34 40 | #define FRAME_stand236 35 41 | #define FRAME_stand237 36 42 | #define FRAME_stand238 37 43 | #define FRAME_stand239 38 44 | #define FRAME_stand240 39 45 | #define FRAME_stand241 40 46 | #define FRAME_stand242 41 47 | #define FRAME_stand243 42 48 | #define FRAME_stand244 43 49 | #define FRAME_stand245 44 50 | #define FRAME_stand246 45 51 | #define FRAME_stand247 46 52 | #define FRAME_stand248 47 53 | #define FRAME_stand249 48 54 | #define FRAME_stand250 49 55 | #define FRAME_stand251 50 56 | #define FRAME_stand252 51 57 | #define FRAME_stand253 52 58 | #define FRAME_stand254 53 59 | #define FRAME_stand255 54 60 | #define FRAME_stand256 55 61 | #define FRAME_stand257 56 62 | #define FRAME_stand258 57 63 | #define FRAME_stand259 58 64 | #define FRAME_stand260 59 65 | 66 | #define MODEL_SCALE 1.000000 67 | -------------------------------------------------------------------------------- /game/p_trail.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | #include "g_local.h" 21 | 22 | 23 | /* 24 | ============================================================================== 25 | 26 | PLAYER TRAIL 27 | 28 | ============================================================================== 29 | 30 | This is a circular list containing the a list of points of where 31 | the player has been recently. It is used by monsters for pursuit. 32 | 33 | .origin the spot 34 | .owner forward link 35 | .aiment backward link 36 | */ 37 | 38 | 39 | #define TRAIL_LENGTH 8 40 | 41 | edict_t *trail[TRAIL_LENGTH]; 42 | int trail_head; 43 | qboolean trail_active = false; 44 | 45 | #define NEXT(n) (((n) + 1) & (TRAIL_LENGTH - 1)) 46 | #define PREV(n) (((n) - 1) & (TRAIL_LENGTH - 1)) 47 | 48 | 49 | void PlayerTrail_Init (void) 50 | { 51 | int n; 52 | 53 | if (deathmatch->value /* FIXME || coop */) 54 | return; 55 | 56 | for (n = 0; n < TRAIL_LENGTH; n++) 57 | { 58 | trail[n] = G_Spawn(); 59 | trail[n]->classname = "player_trail"; 60 | } 61 | 62 | trail_head = 0; 63 | trail_active = true; 64 | } 65 | 66 | 67 | void PlayerTrail_Add (vec3_t spot) 68 | { 69 | vec3_t temp; 70 | 71 | if (!trail_active) 72 | return; 73 | 74 | VectorCopy (spot, trail[trail_head]->s.origin); 75 | 76 | trail[trail_head]->timestamp = level.time; 77 | 78 | VectorSubtract (spot, trail[PREV(trail_head)]->s.origin, temp); 79 | trail[trail_head]->s.angles[1] = vectoyaw (temp); 80 | 81 | trail_head = NEXT(trail_head); 82 | } 83 | 84 | 85 | void PlayerTrail_New (vec3_t spot) 86 | { 87 | if (!trail_active) 88 | return; 89 | 90 | PlayerTrail_Init (); 91 | PlayerTrail_Add (spot); 92 | } 93 | 94 | 95 | edict_t *PlayerTrail_PickFirst (edict_t *self) 96 | { 97 | int marker; 98 | int n; 99 | 100 | if (!trail_active) 101 | return NULL; 102 | 103 | for (marker = trail_head, n = TRAIL_LENGTH; n; n--) 104 | { 105 | if(trail[marker]->timestamp <= self->monsterinfo.trail_time) 106 | marker = NEXT(marker); 107 | else 108 | break; 109 | } 110 | 111 | if (visible(self, trail[marker])) 112 | { 113 | return trail[marker]; 114 | } 115 | 116 | if (visible(self, trail[PREV(marker)])) 117 | { 118 | return trail[PREV(marker)]; 119 | } 120 | 121 | return trail[marker]; 122 | } 123 | 124 | edict_t *PlayerTrail_PickNext (edict_t *self) 125 | { 126 | int marker; 127 | int n; 128 | 129 | if (!trail_active) 130 | return NULL; 131 | 132 | for (marker = trail_head, n = TRAIL_LENGTH; n; n--) 133 | { 134 | if(trail[marker]->timestamp <= self->monsterinfo.trail_time) 135 | marker = NEXT(marker); 136 | else 137 | break; 138 | } 139 | 140 | return trail[marker]; 141 | } 142 | 143 | edict_t *PlayerTrail_LastSpot (void) 144 | { 145 | return trail[PREV(trail_head)]; 146 | } 147 | -------------------------------------------------------------------------------- /irix/cd_irix.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "../client/client.h" 5 | 6 | void CDAudio_Play(int track, qboolean looping) 7 | { 8 | Com_Printf("XXX - CDAudio_Play %i (%i)\n", track, looping); 9 | } 10 | 11 | 12 | void CDAudio_Stop(void) 13 | { 14 | Com_Printf("XXX - CDAudio_Stop\n"); 15 | } 16 | 17 | 18 | void CDAudio_Resume(void) 19 | { 20 | Com_Printf("XXX - CDAudio_Resume\n"); 21 | } 22 | 23 | 24 | void CDAudio_Update(void) 25 | { 26 | /* Com_Printf("XXX - CDAudio_Update\n"); */ 27 | } 28 | 29 | 30 | int CDAudio_Init(void) 31 | { 32 | Com_Printf("XXX - CDAudio_Init\n"); 33 | return 0; 34 | } 35 | 36 | 37 | void CDAudio_Shutdown(void) 38 | { 39 | Com_Printf("XXX - CDAudio_Shutdown\n"); 40 | } 41 | -------------------------------------------------------------------------------- /irix/q_shirix.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include "../linux/glob.h" 11 | 12 | #include "../qcommon/qcommon.h" 13 | 14 | //=============================================================================== 15 | 16 | byte *membase; 17 | int maxhunksize; 18 | int curhunksize; 19 | 20 | void *Hunk_Begin (int maxsize) 21 | { 22 | maxhunksize = maxsize + sizeof(int); 23 | curhunksize = 0; 24 | /* membase = mmap(0, maxhunksize, PROT_READ|PROT_WRITE, */ 25 | /* MAP_PRIVATE, -1, 0); */ 26 | /* if ((membase == NULL) || (membase == MAP_FAILED)) */ 27 | membase = malloc(maxhunksize); 28 | if (membase == NULL) 29 | Com_Error(ERR_FATAL, "unable to virtual allocate %d bytes", maxsize); 30 | 31 | *((int *)membase) = curhunksize; 32 | 33 | return membase + sizeof(int); 34 | } 35 | 36 | void *Hunk_Alloc (int size) 37 | { 38 | byte *buf; 39 | 40 | // round to cacheline 41 | size = (size+31)&~31; 42 | if (curhunksize + size > maxhunksize) 43 | Com_Error(ERR_FATAL, "Hunk_Alloc overflow"); 44 | buf = membase + sizeof(int) + curhunksize; 45 | curhunksize += size; 46 | return buf; 47 | } 48 | 49 | int Hunk_End (void) 50 | { 51 | return curhunksize; 52 | } 53 | 54 | void Hunk_Free (void *base) 55 | { 56 | byte *m; 57 | 58 | if (base) { 59 | m = ((byte *)base) - sizeof(int); 60 | free(m); 61 | } 62 | } 63 | 64 | //=============================================================================== 65 | 66 | 67 | /* 68 | ================ 69 | Sys_Milliseconds 70 | ================ 71 | */ 72 | int curtime; 73 | int Sys_Milliseconds (void) 74 | { 75 | struct timeval tp; 76 | struct timezone tzp; 77 | static int secbase; 78 | 79 | gettimeofday(&tp, &tzp); 80 | 81 | if (!secbase) 82 | { 83 | secbase = tp.tv_sec; 84 | return tp.tv_usec/1000; 85 | } 86 | 87 | curtime = (tp.tv_sec - secbase)*1000 + tp.tv_usec/1000; 88 | 89 | return curtime; 90 | } 91 | 92 | void Sys_Mkdir (char *path) 93 | { 94 | mkdir (path, 0777); 95 | } 96 | 97 | char *strlwr (char *s) 98 | { 99 | char *origs = s; 100 | while (*s) { 101 | *s = tolower(*s); 102 | s++; 103 | } 104 | return origs; 105 | } 106 | 107 | //============================================ 108 | 109 | static char findbase[MAX_OSPATH]; 110 | static char findpath[MAX_OSPATH]; 111 | static char findpattern[MAX_OSPATH]; 112 | static DIR *fdir; 113 | 114 | static qboolean CompareAttributes(char *path, char *name, 115 | unsigned musthave, unsigned canthave ) 116 | { 117 | struct stat st; 118 | char fn[MAX_OSPATH]; 119 | 120 | // . and .. never match 121 | if (strcmp(name, ".") == 0 || strcmp(name, "..") == 0) 122 | return false; 123 | 124 | sprintf(fn, "%s/%s", path, name); 125 | if (stat(fn, &st) == -1) 126 | return false; // shouldn't happen 127 | 128 | if ( ( st.st_mode & S_IFDIR ) && ( canthave & SFF_SUBDIR ) ) 129 | return false; 130 | 131 | if ( ( musthave & SFF_SUBDIR ) && !( st.st_mode & S_IFDIR ) ) 132 | return false; 133 | 134 | return true; 135 | } 136 | 137 | char *Sys_FindFirst (char *path, unsigned musthave, unsigned canhave) 138 | { 139 | struct dirent *d; 140 | char *p; 141 | 142 | if (fdir) 143 | Sys_Error ("Sys_BeginFind without close"); 144 | 145 | // COM_FilePath (path, findbase); 146 | strcpy(findbase, path); 147 | 148 | if ((p = strrchr(findbase, '/')) != NULL) { 149 | *p = 0; 150 | strcpy(findpattern, p + 1); 151 | } else 152 | strcpy(findpattern, "*"); 153 | 154 | if (strcmp(findpattern, "*.*") == 0) 155 | strcpy(findpattern, "*"); 156 | 157 | if ((fdir = opendir(findbase)) == NULL) 158 | return NULL; 159 | while ((d = readdir(fdir)) != NULL) { 160 | if (!*findpattern || glob_match(findpattern, d->d_name)) { 161 | // if (*findpattern) 162 | // printf("%s matched %s\n", findpattern, d->d_name); 163 | if (CompareAttributes(findbase, d->d_name, musthave, canhave)) { 164 | sprintf (findpath, "%s/%s", findbase, d->d_name); 165 | return findpath; 166 | } 167 | } 168 | } 169 | return NULL; 170 | } 171 | 172 | char *Sys_FindNext (unsigned musthave, unsigned canhave) 173 | { 174 | struct dirent *d; 175 | 176 | if (fdir == NULL) 177 | return NULL; 178 | while ((d = readdir(fdir)) != NULL) { 179 | if (!*findpattern || glob_match(findpattern, d->d_name)) { 180 | // if (*findpattern) 181 | // printf("%s matched %s\n", findpattern, d->d_name); 182 | if (CompareAttributes(findbase, d->d_name, musthave, canhave)) { 183 | sprintf (findpath, "%s/%s", findbase, d->d_name); 184 | return findpath; 185 | } 186 | } 187 | } 188 | return NULL; 189 | } 190 | 191 | void Sys_FindClose (void) 192 | { 193 | if (fdir != NULL) 194 | closedir(fdir); 195 | fdir = NULL; 196 | } 197 | 198 | 199 | //============================================ 200 | 201 | -------------------------------------------------------------------------------- /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 | // 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 | #define ALIAS_ONSEAM 0x0020 14 | 15 | // !!! if this is changed, it must be changed in d_iface.h too !!! 16 | #define TURB_TEX_SIZE 64 // base turbulent texture size 17 | 18 | // !!! if this is changed, it must be changed in d_iface.h too !!! 19 | #define CYCLE 128 20 | 21 | // !!! if this is changed, it must be changed in r_shared.h too !!! 22 | #define MAXHEIGHT 1024 23 | 24 | // !!! if this is changed, it must be changed in quakedef.h too !!! 25 | #define CACHE_SIZE 32 // used to align key data structures 26 | 27 | // particle_t structure 28 | // !!! if this is changed, it must be changed in d_iface.h too !!! 29 | // driver-usable fields 30 | #define pt_org 0 31 | #define pt_color 12 32 | // drivers never touch the following fields 33 | #define pt_next 16 34 | #define pt_vel 20 35 | #define pt_ramp 32 36 | #define pt_die 36 37 | #define pt_type 40 38 | #define pt_size 44 39 | 40 | #define PARTICLE_Z_CLIP 8.0 41 | 42 | // finalvert_t structure 43 | // !!! if this is changed, it must be changed in d_iface.h too !!! 44 | #define fv_v 0 // !!! if this is moved, cases where the !!! 45 | // !!! address of this field is pushed in !!! 46 | // !!! d_polysa.s must be changed !!! 47 | #define fv_flags 24 48 | #define fv_reserved 28 49 | #define fv_size 32 50 | #define fv_shift 5 51 | 52 | 53 | // stvert_t structure 54 | // !!! if this is changed, it must be changed in modelgen.h too !!! 55 | #define stv_onseam 0 56 | #define stv_s 4 57 | #define stv_t 8 58 | #define stv_size 12 59 | 60 | 61 | // trivertx_t structure 62 | // !!! if this is changed, it must be changed in modelgen.h too !!! 63 | #define tv_v 0 64 | #define tv_lightnormalindex 3 65 | #define tv_size 4 66 | 67 | // affinetridesc_t structure 68 | // !!! if this is changed, it must be changed in d_iface.h too !!! 69 | #define atd_pskin 0 70 | #define atd_pskindesc 4 71 | #define atd_skinwidth 8 72 | #define atd_skinheight 12 73 | #define atd_ptriangles 16 74 | #define atd_pfinalverts 20 75 | #define atd_numtriangles 24 76 | #define atd_drawtype 28 77 | #define atd_seamfixupX16 32 78 | #define atd_size 36 79 | 80 | -------------------------------------------------------------------------------- /linux/gl_fxmesa.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** GLW_IMP.C 3 | ** 4 | ** This file contains ALL Linux specific stuff having to do with the 5 | ** OpenGL refresh. When a port is being made the following functions 6 | ** must be implemented by the port: 7 | ** 8 | ** GLimp_EndFrame 9 | ** GLimp_Init 10 | ** GLimp_Shutdown 11 | ** GLimp_SwitchFullscreen 12 | ** 13 | */ 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | #include "../ref_gl/gl_local.h" 24 | #include "../client/keys.h" 25 | #include "../linux/rw_linux.h" 26 | 27 | #include 28 | 29 | /*****************************************************************************/ 30 | 31 | static qboolean GLimp_SwitchFullscreen( int width, int height ); 32 | qboolean GLimp_InitGL (void); 33 | 34 | extern cvar_t *vid_fullscreen; 35 | extern cvar_t *vid_ref; 36 | 37 | static fxMesaContext fc = NULL; 38 | 39 | #define NUM_RESOLUTIONS 3 40 | 41 | static resolutions[NUM_RESOLUTIONS][3]={ 42 | { 512, 384, GR_RESOLUTION_512x384 }, 43 | { 640, 400, GR_RESOLUTION_640x400 }, 44 | { 640, 480, GR_RESOLUTION_640x480 } 45 | }; 46 | 47 | static int findres(int *width, int *height) 48 | { 49 | int i; 50 | 51 | for(i=0;i 3 | #include "../linux/glob.h" 4 | 5 | /* Like glob_match, but match PATTERN against any final segment of TEXT. */ 6 | static int glob_match_after_star(char *pattern, char *text) 7 | { 8 | register char *p = pattern, *t = text; 9 | register char c, c1; 10 | 11 | while ((c = *p++) == '?' || c == '*') 12 | if (c == '?' && *t++ == '\0') 13 | return 0; 14 | 15 | if (c == '\0') 16 | return 1; 17 | 18 | if (c == '\\') 19 | c1 = *p; 20 | else 21 | c1 = c; 22 | 23 | while (1) { 24 | if ((c == '[' || *t == c1) && glob_match(p - 1, t)) 25 | return 1; 26 | if (*t++ == '\0') 27 | return 0; 28 | } 29 | } 30 | 31 | /* Return nonzero if PATTERN has any special globbing chars in it. */ 32 | static int glob_pattern_p(char *pattern) 33 | { 34 | register char *p = pattern; 35 | register char c; 36 | int open = 0; 37 | 38 | while ((c = *p++) != '\0') 39 | switch (c) { 40 | case '?': 41 | case '*': 42 | return 1; 43 | 44 | case '[': /* Only accept an open brace if there is a close */ 45 | open++; /* brace to match it. Bracket expressions must be */ 46 | continue; /* complete, according to Posix.2 */ 47 | case ']': 48 | if (open) 49 | return 1; 50 | continue; 51 | 52 | case '\\': 53 | if (*p++ == '\0') 54 | return 0; 55 | } 56 | 57 | return 0; 58 | } 59 | 60 | /* Match the pattern PATTERN against the string TEXT; 61 | return 1 if it matches, 0 otherwise. 62 | 63 | A match means the entire string TEXT is used up in matching. 64 | 65 | In the pattern string, `*' matches any sequence of characters, 66 | `?' matches any character, [SET] matches any character in the specified set, 67 | [!SET] matches any character not in the specified set. 68 | 69 | A set is composed of characters or ranges; a range looks like 70 | character hyphen character (as in 0-9 or A-Z). 71 | [0-9a-zA-Z_] is the set of characters allowed in C identifiers. 72 | Any other character in the pattern must be matched exactly. 73 | 74 | To suppress the special syntactic significance of any of `[]*?!-\', 75 | and match the character exactly, precede it with a `\'. 76 | */ 77 | 78 | int glob_match(char *pattern, char *text) 79 | { 80 | register char *p = pattern, *t = text; 81 | register char c; 82 | 83 | while ((c = *p++) != '\0') 84 | switch (c) { 85 | case '?': 86 | if (*t == '\0') 87 | return 0; 88 | else 89 | ++t; 90 | break; 91 | 92 | case '\\': 93 | if (*p++ != *t++) 94 | return 0; 95 | break; 96 | 97 | case '*': 98 | return glob_match_after_star(p, t); 99 | 100 | case '[': 101 | { 102 | register char c1 = *t++; 103 | int invert; 104 | 105 | if (!c1) 106 | return (0); 107 | 108 | invert = ((*p == '!') || (*p == '^')); 109 | if (invert) 110 | p++; 111 | 112 | c = *p++; 113 | while (1) { 114 | register char cstart = c, cend = c; 115 | 116 | if (c == '\\') { 117 | cstart = *p++; 118 | cend = cstart; 119 | } 120 | if (c == '\0') 121 | return 0; 122 | 123 | c = *p++; 124 | if (c == '-' && *p != ']') { 125 | cend = *p++; 126 | if (cend == '\\') 127 | cend = *p++; 128 | if (cend == '\0') 129 | return 0; 130 | c = *p++; 131 | } 132 | if (c1 >= cstart && c1 <= cend) 133 | goto match; 134 | if (c == ']') 135 | break; 136 | } 137 | if (!invert) 138 | return 0; 139 | break; 140 | 141 | match: 142 | /* Skip the rest of the [...] construct that already matched. */ 143 | while (c != ']') { 144 | if (c == '\0') 145 | return 0; 146 | c = *p++; 147 | if (c == '\0') 148 | return 0; 149 | else if (c == '\\') 150 | ++p; 151 | } 152 | if (invert) 153 | return 0; 154 | break; 155 | } 156 | 157 | default: 158 | if (c != *t++) 159 | return 0; 160 | } 161 | 162 | return *t == '\0'; 163 | } 164 | 165 | -------------------------------------------------------------------------------- /linux/glob.h: -------------------------------------------------------------------------------- 1 | int glob_match(char *pattern, char *text); 2 | -------------------------------------------------------------------------------- /linux/in_linux.c: -------------------------------------------------------------------------------- 1 | // in_null.c -- for systems without a mouse 2 | 3 | #include "../client/client.h" 4 | 5 | cvar_t *in_mouse; 6 | cvar_t *in_joystick; 7 | 8 | void IN_Init (void) 9 | { 10 | in_mouse = Cvar_Get ("in_mouse", "1", CVAR_ARCHIVE); 11 | in_joystick = Cvar_Get ("in_joystick", "0", CVAR_ARCHIVE); 12 | } 13 | 14 | void IN_Shutdown (void) 15 | { 16 | } 17 | 18 | void IN_Commands (void) 19 | { 20 | } 21 | 22 | void IN_Move (usercmd_t *cmd) 23 | { 24 | } 25 | 26 | void IN_Activate (qboolean active) 27 | { 28 | } 29 | 30 | -------------------------------------------------------------------------------- /linux/q_shlinux.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include "../linux/glob.h" 11 | 12 | #include "../qcommon/qcommon.h" 13 | 14 | //=============================================================================== 15 | 16 | byte *membase; 17 | int maxhunksize; 18 | int curhunksize; 19 | 20 | void *Hunk_Begin (int maxsize) 21 | { 22 | // reserve a huge chunk of memory, but don't commit any yet 23 | maxhunksize = maxsize + sizeof(int); 24 | curhunksize = 0; 25 | membase = mmap(0, maxhunksize, PROT_READ|PROT_WRITE, 26 | MAP_PRIVATE|MAP_ANONYMOUS, -1, 0); 27 | if (membase == NULL || membase == (byte *)-1) 28 | Sys_Error("unable to virtual allocate %d bytes", maxsize); 29 | 30 | *((int *)membase) = curhunksize; 31 | 32 | return membase + sizeof(int); 33 | } 34 | 35 | void *Hunk_Alloc (int size) 36 | { 37 | byte *buf; 38 | 39 | // round to cacheline 40 | size = (size+31)&~31; 41 | if (curhunksize + size > maxhunksize) 42 | Sys_Error("Hunk_Alloc overflow"); 43 | buf = membase + sizeof(int) + curhunksize; 44 | curhunksize += size; 45 | return buf; 46 | } 47 | 48 | int Hunk_End (void) 49 | { 50 | byte *n; 51 | 52 | n = mremap(membase, maxhunksize, curhunksize + sizeof(int), 0); 53 | if (n != membase) 54 | Sys_Error("Hunk_End: Could not remap virtual block (%d)", errno); 55 | *((int *)membase) = curhunksize + sizeof(int); 56 | 57 | return curhunksize; 58 | } 59 | 60 | void Hunk_Free (void *base) 61 | { 62 | byte *m; 63 | 64 | if (base) { 65 | m = ((byte *)base) - sizeof(int); 66 | if (munmap(m, *((int *)m))) 67 | Sys_Error("Hunk_Free: munmap failed (%d)", errno); 68 | } 69 | } 70 | 71 | //=============================================================================== 72 | 73 | 74 | /* 75 | ================ 76 | Sys_Milliseconds 77 | ================ 78 | */ 79 | int curtime; 80 | int Sys_Milliseconds (void) 81 | { 82 | struct timeval tp; 83 | struct timezone tzp; 84 | static int secbase; 85 | 86 | gettimeofday(&tp, &tzp); 87 | 88 | if (!secbase) 89 | { 90 | secbase = tp.tv_sec; 91 | return tp.tv_usec/1000; 92 | } 93 | 94 | curtime = (tp.tv_sec - secbase)*1000 + tp.tv_usec/1000; 95 | 96 | return curtime; 97 | } 98 | 99 | void Sys_Mkdir (char *path) 100 | { 101 | mkdir (path, 0777); 102 | } 103 | 104 | char *strlwr (char *s) 105 | { 106 | while (*s) { 107 | *s = tolower(*s); 108 | s++; 109 | } 110 | } 111 | 112 | //============================================ 113 | 114 | static char findbase[MAX_OSPATH]; 115 | static char findpath[MAX_OSPATH]; 116 | static char findpattern[MAX_OSPATH]; 117 | static DIR *fdir; 118 | 119 | static qboolean CompareAttributes(char *path, char *name, 120 | unsigned musthave, unsigned canthave ) 121 | { 122 | struct stat st; 123 | char fn[MAX_OSPATH]; 124 | 125 | // . and .. never match 126 | if (strcmp(name, ".") == 0 || strcmp(name, "..") == 0) 127 | return false; 128 | 129 | sprintf(fn, "%s/%s", path, name); 130 | if (stat(fn, &st) == -1) 131 | return false; // shouldn't happen 132 | 133 | if ( ( st.st_mode & S_IFDIR ) && ( canthave & SFF_SUBDIR ) ) 134 | return false; 135 | 136 | if ( ( musthave & SFF_SUBDIR ) && !( st.st_mode & S_IFDIR ) ) 137 | return false; 138 | 139 | return true; 140 | } 141 | 142 | char *Sys_FindFirst (char *path, unsigned musthave, unsigned canhave) 143 | { 144 | struct dirent *d; 145 | char *p; 146 | 147 | if (fdir) 148 | Sys_Error ("Sys_BeginFind without close"); 149 | 150 | // COM_FilePath (path, findbase); 151 | strcpy(findbase, path); 152 | 153 | if ((p = strrchr(findbase, '/')) != NULL) { 154 | *p = 0; 155 | strcpy(findpattern, p + 1); 156 | } else 157 | strcpy(findpattern, "*"); 158 | 159 | if (strcmp(findpattern, "*.*") == 0) 160 | strcpy(findpattern, "*"); 161 | 162 | if ((fdir = opendir(findbase)) == NULL) 163 | return NULL; 164 | while ((d = readdir(fdir)) != NULL) { 165 | if (!*findpattern || glob_match(findpattern, d->d_name)) { 166 | // if (*findpattern) 167 | // printf("%s matched %s\n", findpattern, d->d_name); 168 | if (CompareAttributes(findbase, d->d_name, musthave, canhave)) { 169 | sprintf (findpath, "%s/%s", findbase, d->d_name); 170 | return findpath; 171 | } 172 | } 173 | } 174 | return NULL; 175 | } 176 | 177 | char *Sys_FindNext (unsigned musthave, unsigned canhave) 178 | { 179 | struct dirent *d; 180 | 181 | if (fdir == NULL) 182 | return NULL; 183 | while ((d = readdir(fdir)) != NULL) { 184 | if (!*findpattern || glob_match(findpattern, d->d_name)) { 185 | // if (*findpattern) 186 | // printf("%s matched %s\n", findpattern, d->d_name); 187 | if (CompareAttributes(findbase, d->d_name, musthave, canhave)) { 188 | sprintf (findpath, "%s/%s", findbase, d->d_name); 189 | return findpath; 190 | } 191 | } 192 | } 193 | return NULL; 194 | } 195 | 196 | void Sys_FindClose (void) 197 | { 198 | if (fdir != NULL) 199 | closedir(fdir); 200 | fdir = NULL; 201 | } 202 | 203 | 204 | //============================================ 205 | 206 | -------------------------------------------------------------------------------- /linux/r_aclipa.s: -------------------------------------------------------------------------------- 1 | // 2 | // r_aliasa.s 3 | // x86 assembly-language Alias model transform and project code. 4 | // 5 | 6 | #include "qasm.h" 7 | #include "d_ifacea.h" 8 | 9 | #if id386 10 | 11 | .data 12 | Ltemp0: .long 0 13 | Ltemp1: .long 0 14 | 15 | .text 16 | 17 | #define pfv0 8+4 18 | #define pfv1 8+8 19 | #define out 8+12 20 | 21 | .globl C(R_Alias_clip_bottom) 22 | C(R_Alias_clip_bottom): 23 | pushl %esi 24 | pushl %edi 25 | 26 | movl pfv0(%esp),%esi 27 | movl pfv1(%esp),%edi 28 | 29 | movl C(r_refdef)+rd_aliasvrectbottom,%eax 30 | 31 | LDoForwardOrBackward: 32 | 33 | movl fv_v+4(%esi),%edx 34 | movl fv_v+4(%edi),%ecx 35 | 36 | cmpl %ecx,%edx 37 | jl LDoForward 38 | 39 | movl fv_v+4(%esi),%ecx 40 | movl fv_v+4(%edi),%edx 41 | movl pfv0(%esp),%edi 42 | movl pfv1(%esp),%esi 43 | 44 | LDoForward: 45 | 46 | subl %edx,%ecx 47 | subl %edx,%eax 48 | movl %ecx,Ltemp1 49 | movl %eax,Ltemp0 50 | fildl Ltemp1 51 | fildl Ltemp0 52 | movl out(%esp),%edx 53 | movl $2,%eax 54 | 55 | fdivp %st(0),%st(1) // scale 56 | 57 | LDo3Forward: 58 | fildl fv_v+0(%esi) // fv0v0 | scale 59 | fildl fv_v+0(%edi) // fv1v0 | fv0v0 | scale 60 | fildl fv_v+4(%esi) // fv0v1 | fv1v0 | fv0v0 | scale 61 | fildl fv_v+4(%edi) // fv1v1 | fv0v1 | fv1v0 | fv0v0 | scale 62 | fildl fv_v+8(%esi) // fv0v2 | fv1v1 | fv0v1 | fv1v0 | fv0v0 | scale 63 | fildl fv_v+8(%edi) // fv1v2 | fv0v2 | fv1v1 | fv0v1 | fv1v0 | fv0v0 | 64 | // scale 65 | fxch %st(5) // fv0v0 | fv0v2 | fv1v1 | fv0v1 | fv1v0 | fv1v2 | 66 | // scale 67 | fsubr %st(0),%st(4) // fv0v0 | fv0v2 | fv1v1 | fv0v1 | fv1v0-fv0v0 | 68 | // fv1v2 | scale 69 | fxch %st(3) // fv0v1 | fv0v2 | fv1v1 | fv0v0 | fv1v0-fv0v0 | 70 | // fv1v2 | scale 71 | fsubr %st(0),%st(2) // fv0v1 | fv0v2 | fv1v1-fv0v1 | fv0v0 | 72 | // fv1v0-fv0v0 | fv1v2 | scale 73 | fxch %st(1) // fv0v2 | fv0v1 | fv1v1-fv0v1 | fv0v0 | 74 | // fv1v0-fv0v0 | fv1v2 | scale 75 | fsubr %st(0),%st(5) // fv0v2 | fv0v1 | fv1v1-fv0v1 | fv0v0 | 76 | // fv1v0-fv0v0 | fv1v2-fv0v2 | scale 77 | fxch %st(6) // scale | fv0v1 | fv1v1-fv0v1 | fv0v0 | 78 | // fv1v0-fv0v0 | fv1v2-fv0v2 | fv0v2 79 | fmul %st(0),%st(4) // scale | fv0v1 | fv1v1-fv0v1 | fv0v0 | 80 | // (fv1v0-fv0v0)*scale | fv1v2-fv0v2 | fv0v2 81 | addl $12,%edi 82 | fmul %st(0),%st(2) // scale | fv0v1 | (fv1v1-fv0v1)*scale | fv0v0 | 83 | // (fv1v0-fv0v0)*scale | fv1v2-fv0v2 | fv0v2 84 | addl $12,%esi 85 | addl $12,%edx 86 | fmul %st(0),%st(5) // scale | fv0v1 | (fv1v1-fv0v1)*scale | fv0v0 | 87 | // (fv1v0-fv0v0)*scale | (fv1v2-fv0v2)*scale | 88 | // fv0v2 89 | fxch %st(3) // fv0v0 | fv0v1 | (fv1v1-fv0v1)*scale | scale | 90 | // (fv1v0-fv0v0)*scale | (fv1v2-fv0v2)*scale | 91 | // fv0v2 92 | faddp %st(0),%st(4) // fv0v1 | (fv1v1-fv0v1)*scale | scale | 93 | // fv0v0+(fv1v0-fv0v0)*scale | 94 | // (fv1v2-fv0v2)*scale | fv0v2 95 | faddp %st(0),%st(1) // fv0v1+(fv1v1-fv0v1)*scale | scale | 96 | // fv0v0+(fv1v0-fv0v0)*scale | 97 | // (fv1v2-fv0v2)*scale | fv0v2 98 | fxch %st(4) // fv0v2 | scale | fv0v0+(fv1v0-fv0v0)*scale | 99 | // (fv1v2-fv0v2)*scale | fv0v1+(fv1v1-fv0v1)*scale 100 | faddp %st(0),%st(3) // scale | fv0v0+(fv1v0-fv0v0)*scale | 101 | // fv0v2+(fv1v2-fv0v2)*scale | 102 | // fv0v1+(fv1v1-fv0v1)*scale 103 | fxch %st(1) // fv0v0+(fv1v0-fv0v0)*scale | scale | 104 | // fv0v2+(fv1v2-fv0v2)*scale | 105 | // fv0v1+(fv1v1-fv0v1)*scale 106 | fadds float_point5 107 | fxch %st(3) // fv0v1+(fv1v1-fv0v1)*scale | scale | 108 | // fv0v2+(fv1v2-fv0v2)*scale | 109 | // fv0v0+(fv1v0-fv0v0)*scale 110 | fadds float_point5 111 | fxch %st(2) // fv0v2+(fv1v2-fv0v2)*scale | scale | 112 | // fv0v1+(fv1v1-fv0v1)*scale | 113 | // fv0v0+(fv1v0-fv0v0)*scale 114 | fadds float_point5 115 | fxch %st(3) // fv0v0+(fv1v0-fv0v0)*scale | scale | 116 | // fv0v1+(fv1v1-fv0v1)*scale | 117 | // fv0v2+(fv1v2-fv0v2)*scale 118 | fistpl fv_v+0-12(%edx) // scale | fv0v1+(fv1v1-fv0v1)*scale | 119 | // fv0v2+(fv1v2-fv0v2)*scale 120 | fxch %st(1) // fv0v1+(fv1v1-fv0v1)*scale | scale | 121 | // fv0v2+(fv1v2-fv0v2)*scale | scale 122 | fistpl fv_v+4-12(%edx) // scale | fv0v2+(fv1v2-fv0v2)*scale 123 | fxch %st(1) // fv0v2+(fv1v2-fv0v2)*sc | scale 124 | fistpl fv_v+8-12(%edx) // scale 125 | 126 | decl %eax 127 | jnz LDo3Forward 128 | 129 | fstp %st(0) 130 | 131 | popl %edi 132 | popl %esi 133 | 134 | ret 135 | 136 | 137 | .globl C(R_Alias_clip_top) 138 | C(R_Alias_clip_top): 139 | pushl %esi 140 | pushl %edi 141 | 142 | movl pfv0(%esp),%esi 143 | movl pfv1(%esp),%edi 144 | 145 | movl C(r_refdef)+rd_aliasvrect+4,%eax 146 | jmp LDoForwardOrBackward 147 | 148 | 149 | 150 | .globl C(R_Alias_clip_right) 151 | C(R_Alias_clip_right): 152 | pushl %esi 153 | pushl %edi 154 | 155 | movl pfv0(%esp),%esi 156 | movl pfv1(%esp),%edi 157 | 158 | movl C(r_refdef)+rd_aliasvrectright,%eax 159 | 160 | LRightLeftEntry: 161 | 162 | 163 | movl fv_v+4(%esi),%edx 164 | movl fv_v+4(%edi),%ecx 165 | 166 | cmpl %ecx,%edx 167 | movl fv_v+0(%esi),%edx 168 | 169 | movl fv_v+0(%edi),%ecx 170 | jl LDoForward2 171 | 172 | movl fv_v+0(%esi),%ecx 173 | movl fv_v+0(%edi),%edx 174 | movl pfv0(%esp),%edi 175 | movl pfv1(%esp),%esi 176 | 177 | LDoForward2: 178 | 179 | jmp LDoForward 180 | 181 | 182 | .globl C(R_Alias_clip_left) 183 | C(R_Alias_clip_left): 184 | pushl %esi 185 | pushl %edi 186 | 187 | movl pfv0(%esp),%esi 188 | movl pfv1(%esp),%edi 189 | 190 | movl C(r_refdef)+rd_aliasvrect+0,%eax 191 | jmp LRightLeftEntry 192 | 193 | 194 | #endif // id386 195 | 196 | -------------------------------------------------------------------------------- /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 | 3 | typedef void (*Key_Event_fp_t)(int key, qboolean down); 4 | 5 | extern void (*KBD_Update_fp)(void); 6 | extern void (*KBD_Init_fp)(Key_Event_fp_t fp); 7 | extern void (*KBD_Close_fp)(void); 8 | 9 | typedef struct in_state { 10 | // Pointers to functions back in client, set by vid_so 11 | void (*IN_CenterView_fp)(void); 12 | Key_Event_fp_t Key_Event_fp; 13 | vec_t *viewangles; 14 | int *in_strafe_state; 15 | } in_state_t; 16 | 17 | -------------------------------------------------------------------------------- /linux/snd_mixa.s: -------------------------------------------------------------------------------- 1 | // 2 | // snd_mixa.s 3 | // x86 assembly-language sound code 4 | // 5 | 6 | #include "qasm.h" 7 | 8 | #if id386 9 | 10 | .text 11 | 12 | //---------------------------------------------------------------------- 13 | // 8-bit sound-mixing code 14 | //---------------------------------------------------------------------- 15 | 16 | #define ch 4+16 17 | #define sc 8+16 18 | #define count 12+16 19 | 20 | .globl C(S_PaintChannelFrom8) 21 | C(S_PaintChannelFrom8): 22 | pushl %esi // preserve register variables 23 | pushl %edi 24 | pushl %ebx 25 | pushl %ebp 26 | 27 | // int data; 28 | // short *lscale, *rscale; 29 | // unsigned char *sfx; 30 | // int i; 31 | 32 | movl ch(%esp),%ebx 33 | movl sc(%esp),%esi 34 | 35 | // if (ch->leftvol > 255) 36 | // ch->leftvol = 255; 37 | // if (ch->rightvol > 255) 38 | // ch->rightvol = 255; 39 | movl ch_leftvol(%ebx),%eax 40 | movl ch_rightvol(%ebx),%edx 41 | cmpl $255,%eax 42 | jna LLeftSet 43 | movl $255,%eax 44 | LLeftSet: 45 | cmpl $255,%edx 46 | jna LRightSet 47 | movl $255,%edx 48 | LRightSet: 49 | 50 | // lscale = snd_scaletable[ch->leftvol >> 3]; 51 | // rscale = snd_scaletable[ch->rightvol >> 3]; 52 | // sfx = (signed char *)sc->data + ch->pos; 53 | // ch->pos += count; 54 | andl $0xF8,%eax 55 | addl $(sfxc_data),%esi 56 | andl $0xF8,%edx 57 | movl ch_pos(%ebx),%edi 58 | movl count(%esp),%ecx 59 | addl %edi,%esi 60 | shll $7,%eax 61 | addl %ecx,%edi 62 | shll $7,%edx 63 | movl %edi,ch_pos(%ebx) 64 | addl $(C(snd_scaletable)),%eax 65 | addl $(C(snd_scaletable)),%edx 66 | subl %ebx,%ebx 67 | movb -1(%esi,%ecx,1),%bl 68 | 69 | testl $1,%ecx 70 | jz LMix8Loop 71 | 72 | movl (%eax,%ebx,4),%edi 73 | movl (%edx,%ebx,4),%ebp 74 | addl C(paintbuffer)+psp_left-psp_size(,%ecx,psp_size),%edi 75 | addl C(paintbuffer)+psp_right-psp_size(,%ecx,psp_size),%ebp 76 | movl %edi,C(paintbuffer)+psp_left-psp_size(,%ecx,psp_size) 77 | movl %ebp,C(paintbuffer)+psp_right-psp_size(,%ecx,psp_size) 78 | movb -2(%esi,%ecx,1),%bl 79 | 80 | decl %ecx 81 | jz LDone 82 | 83 | // for (i=0 ; i>8; 139 | // if (val > 0x7fff) 140 | // snd_out[i] = 0x7fff; 141 | // else if (val < (short)0x8000) 142 | // snd_out[i] = (short)0x8000; 143 | // else 144 | // snd_out[i] = val; 145 | movl -8(%ebx,%ecx,4),%eax 146 | sarl $8,%eax 147 | cmpl $0x7FFF,%eax 148 | jg LClampHigh 149 | cmpl $0xFFFF8000,%eax 150 | jnl LClampDone 151 | movl $0xFFFF8000,%eax 152 | jmp LClampDone 153 | LClampHigh: 154 | movl $0x7FFF,%eax 155 | LClampDone: 156 | 157 | // val = (snd_p[i+1]*snd_vol)>>8; 158 | // if (val > 0x7fff) 159 | // snd_out[i+1] = 0x7fff; 160 | // else if (val < (short)0x8000) 161 | // snd_out[i+1] = (short)0x8000; 162 | // else 163 | // snd_out[i+1] = val; 164 | movl -4(%ebx,%ecx,4),%edx 165 | sarl $8,%edx 166 | cmpl $0x7FFF,%edx 167 | jg LClampHigh2 168 | cmpl $0xFFFF8000,%edx 169 | jnl LClampDone2 170 | movl $0xFFFF8000,%edx 171 | jmp LClampDone2 172 | LClampHigh2: 173 | movl $0x7FFF,%edx 174 | LClampDone2: 175 | shll $16,%edx 176 | andl $0xFFFF,%eax 177 | orl %eax,%edx 178 | movl %edx,-4(%edi,%ecx,2) 179 | 180 | // } 181 | subl $2,%ecx 182 | jnz LWLBLoopTop 183 | 184 | // snd_p += snd_linear_count; 185 | 186 | popl %ebx 187 | popl %edi 188 | 189 | ret 190 | 191 | 192 | #endif // id386 193 | 194 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /makezip: -------------------------------------------------------------------------------- 1 | zip -9 -r code . 2 | 3 | -------------------------------------------------------------------------------- /makezip.bat: -------------------------------------------------------------------------------- 1 | zip -9 -r -D -X code . 2 | -------------------------------------------------------------------------------- /null/cd_null.c: -------------------------------------------------------------------------------- 1 | #include "../client/client.h" 2 | 3 | void CDAudio_Play(int track, qboolean looping) 4 | { 5 | } 6 | 7 | 8 | void CDAudio_Stop(void) 9 | { 10 | } 11 | 12 | 13 | void CDAudio_Resume(void) 14 | { 15 | } 16 | 17 | 18 | void CDAudio_Update(void) 19 | { 20 | } 21 | 22 | 23 | int CDAudio_Init(void) 24 | { 25 | return 0; 26 | } 27 | 28 | 29 | void CDAudio_Shutdown(void) 30 | { 31 | } 32 | -------------------------------------------------------------------------------- /null/cl_null.c: -------------------------------------------------------------------------------- 1 | 2 | // cl_null.c -- this file can stub out the entire client system 3 | // for pure dedicated servers 4 | 5 | #include "../qcommon/qcommon.h" 6 | 7 | void Key_Bind_Null_f(void) 8 | { 9 | } 10 | 11 | void CL_Init (void) 12 | { 13 | } 14 | 15 | void CL_Drop (void) 16 | { 17 | } 18 | 19 | void CL_Shutdown (void) 20 | { 21 | } 22 | 23 | void CL_Frame (int msec) 24 | { 25 | } 26 | 27 | void Con_Print (char *text) 28 | { 29 | } 30 | 31 | void Cmd_ForwardToServer (void) 32 | { 33 | char *cmd; 34 | 35 | cmd = Cmd_Argv(0); 36 | Com_Printf ("Unknown command \"%s\"\n", cmd); 37 | } 38 | 39 | void SCR_DebugGraph (float value, int color) 40 | { 41 | } 42 | 43 | void SCR_BeginLoadingPlaque (void) 44 | { 45 | } 46 | 47 | void SCR_EndLoadingPlaque (void) 48 | { 49 | } 50 | 51 | void Key_Init (void) 52 | { 53 | Cmd_AddCommand ("bind", Key_Bind_Null_f); 54 | } 55 | 56 | -------------------------------------------------------------------------------- /null/glimp_null.c: -------------------------------------------------------------------------------- 1 | #include "../ref_gl/gl_local.h" 2 | 3 | void GLimp_BeginFrame( float camera_separation ) 4 | { 5 | } 6 | 7 | void GLimp_EndFrame( void ) 8 | { 9 | } 10 | 11 | int GLimp_Init( void *hinstance, void *hWnd ) 12 | { 13 | } 14 | 15 | void GLimp_Shutdown( void ) 16 | { 17 | } 18 | 19 | int GLimp_SetMode( int *pwidth, int *pheight, int mode, qboolean fullscreen ) 20 | { 21 | } 22 | 23 | void GLimp_AppActivate( qboolean active ) 24 | { 25 | } 26 | 27 | void GLimp_EnableLogging( qboolean enable ) 28 | { 29 | } 30 | 31 | void GLimp_LogNewFrame( void ) 32 | { 33 | } 34 | 35 | -------------------------------------------------------------------------------- /null/in_null.c: -------------------------------------------------------------------------------- 1 | // in_null.c -- for systems without a mouse 2 | 3 | #include "../client/client.h" 4 | 5 | void IN_Init (void) 6 | { 7 | } 8 | 9 | void IN_Shutdown (void) 10 | { 11 | } 12 | 13 | void IN_Commands (void) 14 | { 15 | } 16 | 17 | void IN_Frame (void) 18 | { 19 | } 20 | 21 | void IN_Move (usercmd_t *cmd) 22 | { 23 | } 24 | 25 | void IN_Activate (qboolean active) 26 | { 27 | } 28 | 29 | void IN_ActivateMouse (void) 30 | { 31 | } 32 | 33 | void IN_DeactivateMouse (void) 34 | { 35 | } 36 | 37 | -------------------------------------------------------------------------------- /null/snddma_null.c: -------------------------------------------------------------------------------- 1 | 2 | // snddma_null.c 3 | // all other sound mixing is portable 4 | 5 | #include "../client/client.h" 6 | #include "../client/snd_loc.h" 7 | 8 | qboolean SNDDMA_Init(void) 9 | { 10 | return false; 11 | } 12 | 13 | int SNDDMA_GetDMAPos(void) 14 | { 15 | return 0; 16 | } 17 | 18 | void SNDDMA_Shutdown(void) 19 | { 20 | } 21 | 22 | void SNDDMA_BeginPainting (void) 23 | { 24 | } 25 | 26 | void SNDDMA_Submit(void) 27 | { 28 | } 29 | -------------------------------------------------------------------------------- /null/swimp_null.c: -------------------------------------------------------------------------------- 1 | #include "../ref_soft/r_local.h" 2 | 3 | void SWimp_BeginFrame( float camera_separation ) 4 | { 5 | } 6 | 7 | void SWimp_EndFrame (void) 8 | { 9 | } 10 | 11 | int SWimp_Init( void *hInstance, void *wndProc ) 12 | { 13 | } 14 | 15 | void SWimp_SetPalette( const unsigned char *palette) 16 | { 17 | } 18 | 19 | void SWimp_Shutdown( void ) 20 | { 21 | } 22 | 23 | rserr_t SWimp_SetMode( int *pwidth, int *pheight, int mode, qboolean fullscreen ) 24 | { 25 | } 26 | 27 | void SWimp_AppActivate( qboolean active ) 28 | { 29 | } 30 | 31 | -------------------------------------------------------------------------------- /null/sys_null.c: -------------------------------------------------------------------------------- 1 | // sys_null.h -- null system driver to aid porting efforts 2 | 3 | #include "../qcommon/qcommon.h" 4 | #include "errno.h" 5 | 6 | int curtime; 7 | 8 | unsigned sys_frame_time; 9 | 10 | 11 | void Sys_mkdir (char *path) 12 | { 13 | } 14 | 15 | void Sys_Error (char *error, ...) 16 | { 17 | va_list argptr; 18 | 19 | printf ("Sys_Error: "); 20 | va_start (argptr,error); 21 | vprintf (error,argptr); 22 | va_end (argptr); 23 | printf ("\n"); 24 | 25 | exit (1); 26 | } 27 | 28 | void Sys_Quit (void) 29 | { 30 | exit (0); 31 | } 32 | 33 | void Sys_UnloadGame (void) 34 | { 35 | } 36 | 37 | void *Sys_GetGameAPI (void *parms) 38 | { 39 | return NULL; 40 | } 41 | 42 | char *Sys_ConsoleInput (void) 43 | { 44 | return NULL; 45 | } 46 | 47 | void Sys_ConsoleOutput (char *string) 48 | { 49 | } 50 | 51 | void Sys_SendKeyEvents (void) 52 | { 53 | } 54 | 55 | void Sys_AppActivate (void) 56 | { 57 | } 58 | 59 | void Sys_CopyProtect (void) 60 | { 61 | } 62 | 63 | char *Sys_GetClipboardData( void ) 64 | { 65 | return NULL; 66 | } 67 | 68 | void *Hunk_Begin (int maxsize) 69 | { 70 | return NULL; 71 | } 72 | 73 | void *Hunk_Alloc (int size) 74 | { 75 | return NULL; 76 | } 77 | 78 | void Hunk_Free (void *buf) 79 | { 80 | } 81 | 82 | int Hunk_End (void) 83 | { 84 | return 0; 85 | } 86 | 87 | int Sys_Milliseconds (void) 88 | { 89 | return 0; 90 | } 91 | 92 | void Sys_Mkdir (char *path) 93 | { 94 | } 95 | 96 | char *Sys_FindFirst (char *path, unsigned musthave, unsigned canthave) 97 | { 98 | return NULL; 99 | } 100 | 101 | char *Sys_FindNext (unsigned musthave, unsigned canthave) 102 | { 103 | return NULL; 104 | } 105 | 106 | void Sys_FindClose (void) 107 | { 108 | } 109 | 110 | void Sys_Init (void) 111 | { 112 | } 113 | 114 | 115 | //============================================================================= 116 | 117 | void main (int argc, char **argv) 118 | { 119 | Qcommon_Init (argc, argv); 120 | 121 | while (1) 122 | { 123 | Qcommon_Frame (0.1); 124 | } 125 | } 126 | 127 | 128 | -------------------------------------------------------------------------------- /null/vid_null.c: -------------------------------------------------------------------------------- 1 | // vid_null.c -- null video driver to aid porting efforts 2 | // this assumes that one of the refs is statically linked to the executable 3 | 4 | #include "../client/client.h" 5 | 6 | viddef_t viddef; // global video state 7 | 8 | refexport_t re; 9 | 10 | refexport_t GetRefAPI (refimport_t rimp); 11 | 12 | /* 13 | ========================================================================== 14 | 15 | DIRECT LINK GLUE 16 | 17 | ========================================================================== 18 | */ 19 | 20 | #define MAXPRINTMSG 4096 21 | void VID_Printf (int print_level, char *fmt, ...) 22 | { 23 | va_list argptr; 24 | char msg[MAXPRINTMSG]; 25 | 26 | va_start (argptr,fmt); 27 | vsprintf (msg,fmt,argptr); 28 | va_end (argptr); 29 | 30 | if (print_level == PRINT_ALL) 31 | Com_Printf ("%s", msg); 32 | else 33 | Com_DPrintf ("%s", msg); 34 | } 35 | 36 | void VID_Error (int err_level, char *fmt, ...) 37 | { 38 | va_list argptr; 39 | char msg[MAXPRINTMSG]; 40 | 41 | va_start (argptr,fmt); 42 | vsprintf (msg,fmt,argptr); 43 | va_end (argptr); 44 | 45 | Com_Error (err_level, "%s", msg); 46 | } 47 | 48 | void VID_NewWindow (int width, int height) 49 | { 50 | viddef.width = width; 51 | viddef.height = height; 52 | } 53 | 54 | /* 55 | ** VID_GetModeInfo 56 | */ 57 | typedef struct vidmode_s 58 | { 59 | const char *description; 60 | int width, height; 61 | int mode; 62 | } vidmode_t; 63 | 64 | vidmode_t vid_modes[] = 65 | { 66 | { "Mode 0: 320x240", 320, 240, 0 }, 67 | { "Mode 1: 400x300", 400, 300, 1 }, 68 | { "Mode 2: 512x384", 512, 384, 2 }, 69 | { "Mode 3: 640x480", 640, 480, 3 }, 70 | { "Mode 4: 800x600", 800, 600, 4 }, 71 | { "Mode 5: 960x720", 960, 720, 5 }, 72 | { "Mode 6: 1024x768", 1024, 768, 6 }, 73 | { "Mode 7: 1152x864", 1152, 864, 7 }, 74 | { "Mode 8: 1280x960", 1280, 960, 8 }, 75 | { "Mode 9: 1600x1200", 1600, 1200, 9 } 76 | }; 77 | #define VID_NUM_MODES ( sizeof( vid_modes ) / sizeof( vid_modes[0] ) ) 78 | 79 | qboolean VID_GetModeInfo( int *width, int *height, int mode ) 80 | { 81 | if ( mode < 0 || mode >= VID_NUM_MODES ) 82 | return false; 83 | 84 | *width = vid_modes[mode].width; 85 | *height = vid_modes[mode].height; 86 | 87 | return true; 88 | } 89 | 90 | 91 | void VID_Init (void) 92 | { 93 | refimport_t ri; 94 | 95 | viddef.width = 320; 96 | viddef.height = 240; 97 | 98 | ri.Cmd_AddCommand = Cmd_AddCommand; 99 | ri.Cmd_RemoveCommand = Cmd_RemoveCommand; 100 | ri.Cmd_Argc = Cmd_Argc; 101 | ri.Cmd_Argv = Cmd_Argv; 102 | ri.Cmd_ExecuteText = Cbuf_ExecuteText; 103 | ri.Con_Printf = VID_Printf; 104 | ri.Sys_Error = VID_Error; 105 | ri.FS_LoadFile = FS_LoadFile; 106 | ri.FS_FreeFile = FS_FreeFile; 107 | ri.FS_Gamedir = FS_Gamedir; 108 | ri.Vid_NewWindow = VID_NewWindow; 109 | ri.Cvar_Get = Cvar_Get; 110 | ri.Cvar_Set = Cvar_Set; 111 | ri.Cvar_SetValue = Cvar_SetValue; 112 | ri.Vid_GetModeInfo = VID_GetModeInfo; 113 | 114 | re = GetRefAPI(ri); 115 | 116 | if (re.api_version != API_VERSION) 117 | Com_Error (ERR_FATAL, "Re has incompatible api_version"); 118 | 119 | // call the init function 120 | if (re.Init (NULL, NULL) == -1) 121 | Com_Error (ERR_FATAL, "Couldn't start refresh"); 122 | } 123 | 124 | void VID_Shutdown (void) 125 | { 126 | if (re.Shutdown) 127 | re.Shutdown (); 128 | } 129 | 130 | void VID_CheckChanges (void) 131 | { 132 | } 133 | 134 | void VID_MenuInit (void) 135 | { 136 | } 137 | 138 | void VID_MenuDraw (void) 139 | { 140 | } 141 | 142 | const char *VID_MenuKey( int k) 143 | { 144 | return NULL; 145 | } 146 | -------------------------------------------------------------------------------- /qcommon/crc.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | /* crc.c */ 21 | 22 | #include "qcommon.h" 23 | 24 | // this is a 16 bit, non-reflected CRC using the polynomial 0x1021 25 | // and the initial and final xor values shown below... in other words, the 26 | // CCITT standard CRC used by XMODEM 27 | 28 | #define CRC_INIT_VALUE 0xffff 29 | #define CRC_XOR_VALUE 0x0000 30 | 31 | static unsigned short crctable[256] = 32 | { 33 | 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, 34 | 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, 35 | 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, 36 | 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de, 37 | 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485, 38 | 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, 39 | 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4, 40 | 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, 41 | 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823, 42 | 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b, 43 | 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12, 44 | 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a, 45 | 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41, 46 | 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49, 47 | 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, 48 | 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, 49 | 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f, 50 | 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067, 51 | 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e, 52 | 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256, 53 | 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d, 54 | 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, 55 | 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c, 56 | 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, 57 | 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, 58 | 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3, 59 | 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, 60 | 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92, 61 | 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9, 62 | 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, 63 | 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8, 64 | 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0 65 | }; 66 | 67 | void CRC_Init(unsigned short *crcvalue) 68 | { 69 | *crcvalue = CRC_INIT_VALUE; 70 | } 71 | 72 | void CRC_ProcessByte(unsigned short *crcvalue, byte data) 73 | { 74 | *crcvalue = (*crcvalue << 8) ^ crctable[(*crcvalue >> 8) ^ data]; 75 | } 76 | 77 | unsigned short CRC_Value(unsigned short crcvalue) 78 | { 79 | return crcvalue ^ CRC_XOR_VALUE; 80 | } 81 | 82 | unsigned short CRC_Block (byte *start, int count) 83 | { 84 | unsigned short crc; 85 | 86 | CRC_Init (&crc); 87 | while (count--) 88 | crc = (crc << 8) ^ crctable[(crc >> 8) ^ *start++]; 89 | 90 | return crc; 91 | } 92 | 93 | -------------------------------------------------------------------------------- /qcommon/crc.h: -------------------------------------------------------------------------------- 1 | /* crc.h */ 2 | 3 | void CRC_Init(unsigned short *crcvalue); 4 | void CRC_ProcessByte(unsigned short *crcvalue, byte data); 5 | unsigned short CRC_Value(unsigned short crcvalue); 6 | unsigned short CRC_Block (byte *start, int count); 7 | -------------------------------------------------------------------------------- /qcommon/md4.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/id-Software/Quake-2/372afde46e7defc9dd2d719a1732b8ace1fa096e/qcommon/md4.c -------------------------------------------------------------------------------- /quake2.bce: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/id-Software/Quake-2/372afde46e7defc9dd2d719a1732b8ace1fa096e/quake2.bce -------------------------------------------------------------------------------- /quake2.bcp: -------------------------------------------------------------------------------- 1 | C:\WINDOWS\TEMP\EVT32A3.TMP2AdjustWindowRect'CallNextHookEx' CloseHandle'CompareStringA' CreateFileA'CreateWindowExA'DefWindowProcA' ExitProcess'FreeEnvironmentStringsA'GetCommandLineA'GetEnvironmentStrings' GetFileType' GetLastError'GetModuleFileNameA'GetModuleHandleA'GetProcAddress'GetStartupInfoA' GetStdHandle' GetTickCount' 2 | GetVersion' GetVersionExA' HeapAlloc 3 | ' 4 | HeapCreate'HeapFree'InitCommonControls' IsBadReadPtr ' IsBadWritePtr ' LoadCursorA' LoadLibraryA' MessageBoxA'ReadFile'RegisterClassA'SetEnvironmentVariableA'SetFilePointer' 5 | ShowWindow' UpdateWindow' VirtualAlloc'SetHandleCount' 6 | WSAStartup'bind' closesocket' gethostname' gethostbyname' getsockname'htons' inet_addr'ntohs'sendto'socket' ioctlsocket'GetACP& GetCPInfo&SetForegroundWindow&GetEnvironmentStringsW$,NuMega BoundsChecker Event Compliance Report%s - Event Compliance -------------------------------------------------------------------------------- /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 | }}} 39 | 40 | ############################################################################### 41 | 42 | Project: "ref_gl"=.\ref_gl\ref_gl.dsp - Package Owner=<4> 43 | 44 | Package=<5> 45 | {{{ 46 | }}} 47 | 48 | Package=<4> 49 | {{{ 50 | }}} 51 | 52 | ############################################################################### 53 | 54 | Project: "ref_soft"=.\ref_soft\ref_soft.dsp - Package Owner=<4> 55 | 56 | Package=<5> 57 | {{{ 58 | }}} 59 | 60 | Package=<4> 61 | {{{ 62 | }}} 63 | 64 | ############################################################################### 65 | 66 | Global: 67 | 68 | Package=<5> 69 | {{{ 70 | }}} 71 | 72 | Package=<3> 73 | {{{ 74 | }}} 75 | 76 | ############################################################################### 77 | 78 | -------------------------------------------------------------------------------- /quake2.opt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/id-Software/Quake-2/372afde46e7defc9dd2d719a1732b8ace1fa096e/quake2.opt -------------------------------------------------------------------------------- /readme.txt: -------------------------------------------------------------------------------- 1 | 2 | This is the complete source code for Quake 2, version 3.19, buildable with 3 | visual C++ 6.0. The linux version should be buildable, but we haven't 4 | tested it for the release. 5 | 6 | The code is all licensed under the terms of the GPL (gnu public license). 7 | You should read the entire license, but the gist of it is that you can do 8 | anything you want with the code, including sell your new version. The catch 9 | is that if you distribute new binary versions, you are required to make the 10 | entire source code available for free to everyone. 11 | 12 | The primary intent of this release is for entertainment and educational 13 | purposes, but the GPL does allow commercial exploitation if you obey the 14 | full license. If you want to do something commercial and you just can't bear 15 | to have your source changes released, we could still negotiate a separate 16 | license agreement (for $$$), but I would encourage you to just live with the 17 | GPL. 18 | 19 | All of the Q2 data files remain copyrighted and licensed under the 20 | original terms, so you cannot redistribute data from the original game, but if 21 | you do a true total conversion, you can create a standalone game based on 22 | this code. 23 | 24 | Thanks to Robert Duffy for doing the grunt work of building this release. 25 | 26 | John Carmack 27 | Id Software 28 | 29 | 30 | -------------------------------------------------------------------------------- /ref_gl/ref_gl.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | GetRefAPI 3 | -------------------------------------------------------------------------------- /ref_gl/ref_gl.plg: -------------------------------------------------------------------------------- 1 | --------------------Configuration: ref_gl - Win32 Release Alpha-------------------- 2 | Begining build with project "G:\quake2\code\ref_gl\ref_gl.dsp", at root. 3 | Active configuration is Win32 (ALPHA) Dynamic-Link Library (based on Win32 (ALPHA) Dynamic-Link Library) 4 | 5 | Project's tools are: 6 | "OLE Type Library Maker" with flags "/nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 " 7 | "C/C++ Compiler for Alpha" with flags "/nologo /QA21164 /MT /Gt0 /W3 /GX /Zi /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "C_ONLY" /Fp".\ReleaseAXP/ref_gl.pch" /YX /Fo".\ReleaseAXP/" /Fd".\ReleaseAXP/" /FD /QAieee1 /c " 8 | "Win32 Resource Compiler" with flags "/l 0x409 /d "NDEBUG" " 9 | "Browser Database Maker" with flags "/nologo /o"..\ReleaseAXP/ref_gl.bsc" " 10 | "COFF Linker for Alpha" with flags "kernel32.lib user32.lib gdi32.lib winmm.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"..\ReleaseAXP/ref_gl.pdb" /debug /machine:ALPHA /def:".\ref_gl.def" /out:"..\ReleaseAXP/ref_gl.dll" /implib:"..\ReleaseAXP/ref_gl.lib" " 11 | "Custom Build" with flags "" 12 | "" with flags "" 13 | 14 | 15 | 16 | 17 | ref_gl.dll - 0 error(s), 0 warning(s) 18 | -------------------------------------------------------------------------------- /ref_gl/warpsin.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 0, 0.19633, 0.392541, 0.588517, 0.784137, 0.979285, 1.17384, 1.3677, 21 | 1.56072, 1.75281, 1.94384, 2.1337, 2.32228, 2.50945, 2.69512, 2.87916, 22 | 3.06147, 3.24193, 3.42044, 3.59689, 3.77117, 3.94319, 4.11282, 4.27998, 23 | 4.44456, 4.60647, 4.76559, 4.92185, 5.07515, 5.22538, 5.37247, 5.51632, 24 | 5.65685, 5.79398, 5.92761, 6.05767, 6.18408, 6.30677, 6.42566, 6.54068, 25 | 6.65176, 6.75883, 6.86183, 6.9607, 7.05537, 7.14579, 7.23191, 7.31368, 26 | 7.39104, 7.46394, 7.53235, 7.59623, 7.65552, 7.71021, 7.76025, 7.80562, 27 | 7.84628, 7.88222, 7.91341, 7.93984, 7.96148, 7.97832, 7.99036, 7.99759, 28 | 8, 7.99759, 7.99036, 7.97832, 7.96148, 7.93984, 7.91341, 7.88222, 29 | 7.84628, 7.80562, 7.76025, 7.71021, 7.65552, 7.59623, 7.53235, 7.46394, 30 | 7.39104, 7.31368, 7.23191, 7.14579, 7.05537, 6.9607, 6.86183, 6.75883, 31 | 6.65176, 6.54068, 6.42566, 6.30677, 6.18408, 6.05767, 5.92761, 5.79398, 32 | 5.65685, 5.51632, 5.37247, 5.22538, 5.07515, 4.92185, 4.76559, 4.60647, 33 | 4.44456, 4.27998, 4.11282, 3.94319, 3.77117, 3.59689, 3.42044, 3.24193, 34 | 3.06147, 2.87916, 2.69512, 2.50945, 2.32228, 2.1337, 1.94384, 1.75281, 35 | 1.56072, 1.3677, 1.17384, 0.979285, 0.784137, 0.588517, 0.392541, 0.19633, 36 | 9.79717e-16, -0.19633, -0.392541, -0.588517, -0.784137, -0.979285, -1.17384, -1.3677, 37 | -1.56072, -1.75281, -1.94384, -2.1337, -2.32228, -2.50945, -2.69512, -2.87916, 38 | -3.06147, -3.24193, -3.42044, -3.59689, -3.77117, -3.94319, -4.11282, -4.27998, 39 | -4.44456, -4.60647, -4.76559, -4.92185, -5.07515, -5.22538, -5.37247, -5.51632, 40 | -5.65685, -5.79398, -5.92761, -6.05767, -6.18408, -6.30677, -6.42566, -6.54068, 41 | -6.65176, -6.75883, -6.86183, -6.9607, -7.05537, -7.14579, -7.23191, -7.31368, 42 | -7.39104, -7.46394, -7.53235, -7.59623, -7.65552, -7.71021, -7.76025, -7.80562, 43 | -7.84628, -7.88222, -7.91341, -7.93984, -7.96148, -7.97832, -7.99036, -7.99759, 44 | -8, -7.99759, -7.99036, -7.97832, -7.96148, -7.93984, -7.91341, -7.88222, 45 | -7.84628, -7.80562, -7.76025, -7.71021, -7.65552, -7.59623, -7.53235, -7.46394, 46 | -7.39104, -7.31368, -7.23191, -7.14579, -7.05537, -6.9607, -6.86183, -6.75883, 47 | -6.65176, -6.54068, -6.42566, -6.30677, -6.18408, -6.05767, -5.92761, -5.79398, 48 | -5.65685, -5.51632, -5.37247, -5.22538, -5.07515, -4.92185, -4.76559, -4.60647, 49 | -4.44456, -4.27998, -4.11282, -3.94319, -3.77117, -3.59689, -3.42044, -3.24193, 50 | -3.06147, -2.87916, -2.69512, -2.50945, -2.32228, -2.1337, -1.94384, -1.75281, 51 | -1.56072, -1.3677, -1.17384, -0.979285, -0.784137, -0.588517, -0.392541, -0.19633, 52 | -------------------------------------------------------------------------------- /ref_soft/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 | -------------------------------------------------------------------------------- /ref_soft/ref_soft.plg: -------------------------------------------------------------------------------- 1 | --------------------Configuration: ref_soft - Win32 Release Alpha-------------------- 2 | Begining build with project "G:\quake2\code\ref_soft\ref_soft.dsp", at root. 3 | Active configuration is Win32 (ALPHA) Dynamic-Link Library (based on Win32 (ALPHA) Dynamic-Link Library) 4 | 5 | Project's tools are: 6 | "OLE Type Library Maker" with flags "/nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 " 7 | "C/C++ Compiler for Alpha" with flags "/nologo /QA21164 /MT /Gt0 /W3 /GX /Zi /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "C_ONLY" /Fp".\ReleaseAXP/ref_soft.pch" /YX /Fo".\ReleaseAXP/" /Fd".\ReleaseAXP/" /FD /QAieee1 /c " 8 | "Win32 Resource Compiler" with flags "/l 0x409 /d "NDEBUG" " 9 | "Browser Database Maker" with flags "/nologo /o"..\ReleaseAXP/ref_soft.bsc" " 10 | "COFF Linker for Alpha" with flags "kernel32.lib user32.lib gdi32.lib winmm.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"..\ReleaseAXP/ref_soft.pdb" /debug /machine:ALPHA /def:".\ref_soft.def" /out:"..\ReleaseAXP/ref_soft.dll" /implib:"..\ReleaseAXP/ref_soft.lib" " 11 | "Custom Build" with flags "" 12 | "" with flags "" 13 | 14 | 15 | 16 | 17 | ref_soft.dll - 0 error(s), 0 warning(s) 18 | -------------------------------------------------------------------------------- /rhapsody/makefile.bak: -------------------------------------------------------------------------------- 1 | 2 | CFLAGS = -O -g -DGAME_HARD_LINKED -DREF_HARD_LINKED 3 | LDFLAGS = -sectcreate __ICON __header quake2.iconheader -segprot __ICON r r -sectcreate __ICON app quake2.tiff -framework AppKit -framework Foundation 4 | EXE = quake2 5 | TARGETS = $(EXE) 6 | 7 | all: $(TARGETS) 8 | 9 | #---------------------------------------------------------------------- 10 | 11 | SERVERFILES = sv_ccmds.o sv_ents.o sv_game.o sv_init.o sv_main.o sv_send.o sv_user.o sv_world.o 12 | 13 | GAMEFILES = g_ai.o g_cmds.o g_combat.o g_func.o g_items.o g_main.o g_misc.o g_monster.o g_phys.o g_save.o g_spawn.o g_target.o g_trigger.o g_utils.o g_weapon.o g_turret.o m_actor.o m_berserk.o m_boss2.o m_boss3.o m_boss31.o m_boss32.o m_brain.o m_chick.o m_flipper.o m_float.o m_flyer.o m_gladiator.o m_gunner.o m_hover.o m_infantry.o m_insane.o m_medic.o m_move.o m_mutant.o m_parasite.o m_soldier.o m_supertank.o m_tank.o p_client.o p_hud.o p_trail.o p_view.o p_weapon.o 14 | 15 | CLIENTFILES = cl_ents.o cl_fx.o cl_input.o cl_inv.o cl_main.o cl_parse.o cl_pred.o cl_scrn.o cl_cin.o cl_tent.o cl_view.o console.o keys.o menu.o qmenu.o snd_dma.o snd_mem.o snd_mix.o 16 | 17 | # commonfiles are used by both client and server 18 | COMMONFILES = m_flash.o cmd.o cmodel.o common.o cvar.o files.o md4.o net_chan.o net_udp.o pmove.o 19 | 20 | REFGLFILES = gl_draw.o gl_light.o gl_mesh.o gl_model.o gl_rmain.o gl_rmisc.o gl_rsurf.o gl_warp.o gl_image.o 21 | 22 | REFSOFTFILES = r_aclip.o r_alias.o r_bsp.o r_draw.o r_edge.o r_image.o r_light.o r_main.o r_misc.o r_model.o r_part.o r_polyse.o r_poly.o r_rast.o r_scan.o r_sprite.o r_surf.o 23 | 24 | # sharedfiles are included in EVERY dll 25 | SHAREDFILES = q_shared.o 26 | 27 | IRIXFILES = cd_sgi.o glx_imp.o qgl_sgi.o sys_sgi.o vid_sgi.o in_sgi.o snddma_null.o 28 | 29 | RHAPFILES = cd_null.o in_null.o snddma_null.o sys_rhap.o vid_null.o swimp_rhap.o 30 | 31 | NULLFILES = cd_null.o in_null.o snddma_null.o sys_null.o vid_null.o swimp_null.o 32 | 33 | #---------------------------------------------------------------------- 34 | 35 | FILES = $(SERVERFILES) $(GAMEFILES) $(COMMONFILES) $(CLIENTFILES) $(REFSOFTFILES) $(SHAREDFILES) $(RHAPFILES) 36 | 37 | $(EXE) : $(FILES) 38 | cc -o $(EXE) $(FILES) $(LDFLAGS) 39 | 40 | clean: 41 | rm -f $(EXE) $(FILES) 42 | 43 | #---------------------------------------------------------------------- 44 | 45 | # gnumake pattern rules are so cool! 46 | 47 | %.o : ../game/%.c 48 | cc $(CFLAGS) -c -o $@ $? 49 | %.o : ../qcommon/%.c 50 | cc $(CFLAGS) -c -o $@ $? 51 | %.o : ../client/%.c 52 | cc $(CFLAGS) -c -o $@ $? 53 | %.o : ../server/%.c 54 | cc $(CFLAGS) -c -o $@ $? 55 | %.o : ../ref_soft/%.c 56 | cc $(CFLAGS) -c -o $@ $? 57 | %.o : ../ref_gl/%.c 58 | cc $(CFLAGS) -c -o $@ $? 59 | %.o : ../null/%.c 60 | cc $(CFLAGS) -c -o $@ $? 61 | %.o : ../rhapsody/%.m 62 | cc $(CFLAGS) -c -o $@ $? 63 | 64 | -------------------------------------------------------------------------------- /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/id-Software/Quake-2/372afde46e7defc9dd2d719a1732b8ace1fa096e/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 | // sv_null.c -- this file can stub out the entire server system 2 | // for pure net-only clients 3 | 4 | void SV_Init (void) 5 | { 6 | } 7 | 8 | void SV_Shutdown (char *finalmsg, qboolean reconnect) 9 | { 10 | } 11 | 12 | void SV_Frame (float time) 13 | { 14 | } 15 | 16 | -------------------------------------------------------------------------------- /solaris/g_so.c: -------------------------------------------------------------------------------- 1 | int main(int argc, char *argv) 2 | { 3 | } 4 | -------------------------------------------------------------------------------- /solaris/glob.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include "../linux/glob.h" 4 | 5 | /* Like glob_match, but match PATTERN against any final segment of TEXT. */ 6 | static int glob_match_after_star(char *pattern, char *text) 7 | { 8 | register char *p = pattern, *t = text; 9 | register char c, c1; 10 | 11 | while ((c = *p++) == '?' || c == '*') 12 | if (c == '?' && *t++ == '\0') 13 | return 0; 14 | 15 | if (c == '\0') 16 | return 1; 17 | 18 | if (c == '\\') 19 | c1 = *p; 20 | else 21 | c1 = c; 22 | 23 | while (1) { 24 | if ((c == '[' || *t == c1) && glob_match(p - 1, t)) 25 | return 1; 26 | if (*t++ == '\0') 27 | return 0; 28 | } 29 | } 30 | 31 | /* Return nonzero if PATTERN has any special globbing chars in it. */ 32 | static int glob_pattern_p(char *pattern) 33 | { 34 | register char *p = pattern; 35 | register char c; 36 | int open = 0; 37 | 38 | while ((c = *p++) != '\0') 39 | switch (c) { 40 | case '?': 41 | case '*': 42 | return 1; 43 | 44 | case '[': /* Only accept an open brace if there is a close */ 45 | open++; /* brace to match it. Bracket expressions must be */ 46 | continue; /* complete, according to Posix.2 */ 47 | case ']': 48 | if (open) 49 | return 1; 50 | continue; 51 | 52 | case '\\': 53 | if (*p++ == '\0') 54 | return 0; 55 | } 56 | 57 | return 0; 58 | } 59 | 60 | /* Match the pattern PATTERN against the string TEXT; 61 | return 1 if it matches, 0 otherwise. 62 | 63 | A match means the entire string TEXT is used up in matching. 64 | 65 | In the pattern string, `*' matches any sequence of characters, 66 | `?' matches any character, [SET] matches any character in the specified set, 67 | [!SET] matches any character not in the specified set. 68 | 69 | A set is composed of characters or ranges; a range looks like 70 | character hyphen character (as in 0-9 or A-Z). 71 | [0-9a-zA-Z_] is the set of characters allowed in C identifiers. 72 | Any other character in the pattern must be matched exactly. 73 | 74 | To suppress the special syntactic significance of any of `[]*?!-\', 75 | and match the character exactly, precede it with a `\'. 76 | */ 77 | 78 | int glob_match(char *pattern, char *text) 79 | { 80 | register char *p = pattern, *t = text; 81 | register char c; 82 | 83 | while ((c = *p++) != '\0') 84 | switch (c) { 85 | case '?': 86 | if (*t == '\0') 87 | return 0; 88 | else 89 | ++t; 90 | break; 91 | 92 | case '\\': 93 | if (*p++ != *t++) 94 | return 0; 95 | break; 96 | 97 | case '*': 98 | return glob_match_after_star(p, t); 99 | 100 | case '[': 101 | { 102 | register char c1 = *t++; 103 | int invert; 104 | 105 | if (!c1) 106 | return (0); 107 | 108 | invert = ((*p == '!') || (*p == '^')); 109 | if (invert) 110 | p++; 111 | 112 | c = *p++; 113 | while (1) { 114 | register char cstart = c, cend = c; 115 | 116 | if (c == '\\') { 117 | cstart = *p++; 118 | cend = cstart; 119 | } 120 | if (c == '\0') 121 | return 0; 122 | 123 | c = *p++; 124 | if (c == '-' && *p != ']') { 125 | cend = *p++; 126 | if (cend == '\\') 127 | cend = *p++; 128 | if (cend == '\0') 129 | return 0; 130 | c = *p++; 131 | } 132 | if (c1 >= cstart && c1 <= cend) 133 | goto match; 134 | if (c == ']') 135 | break; 136 | } 137 | if (!invert) 138 | return 0; 139 | break; 140 | 141 | match: 142 | /* Skip the rest of the [...] construct that already matched. */ 143 | while (c != ']') { 144 | if (c == '\0') 145 | return 0; 146 | c = *p++; 147 | if (c == '\0') 148 | return 0; 149 | else if (c == '\\') 150 | ++p; 151 | } 152 | if (invert) 153 | return 0; 154 | break; 155 | } 156 | 157 | default: 158 | if (c != *t++) 159 | return 0; 160 | } 161 | 162 | return *t == '\0'; 163 | } 164 | 165 | -------------------------------------------------------------------------------- /solaris/glob.h: -------------------------------------------------------------------------------- 1 | int glob_match(char *pattern, char *text); 2 | -------------------------------------------------------------------------------- /solaris/q_shsolaris.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include "../linux/glob.h" 11 | 12 | #include "../qcommon/qcommon.h" 13 | 14 | //=============================================================================== 15 | 16 | byte *membase; 17 | int maxhunksize; 18 | int curhunksize; 19 | 20 | void *Hunk_Begin (int maxsize) 21 | { 22 | // reserve a huge chunk of memory, but don't commit any yet 23 | maxhunksize = maxsize; 24 | curhunksize = 0; 25 | membase = malloc(maxhunksize); 26 | if (membase == NULL) 27 | Sys_Error(ERR_FATAL, "unable to allocate %d bytes", maxsize); 28 | 29 | return membase; 30 | } 31 | 32 | void *Hunk_Alloc (int size) 33 | { 34 | byte *buf; 35 | 36 | // round to cacheline 37 | size = (size+31)&~31; 38 | if (curhunksize + size > maxhunksize) 39 | Sys_Error(ERR_FATAL, "Hunk_Alloc overflow"); 40 | buf = membase + curhunksize; 41 | curhunksize += size; 42 | return buf; 43 | } 44 | 45 | int Hunk_End (void) 46 | { 47 | byte *n; 48 | 49 | n = realloc(membase, curhunksize); 50 | if (n != membase) 51 | Sys_Error(ERR_FATAL, "Hunk_End: Could not remap virtual block (%d)", errno); 52 | 53 | return curhunksize; 54 | } 55 | 56 | void Hunk_Free (void *base) 57 | { 58 | if (base) 59 | free(base); 60 | } 61 | 62 | //=============================================================================== 63 | 64 | 65 | /* 66 | ================ 67 | Sys_Milliseconds 68 | ================ 69 | */ 70 | int curtime; 71 | int Sys_Milliseconds (void) 72 | { 73 | struct timeval tp; 74 | struct timezone tzp; 75 | static int secbase; 76 | 77 | gettimeofday(&tp, &tzp); 78 | 79 | if (!secbase) 80 | { 81 | secbase = tp.tv_sec; 82 | return tp.tv_usec/1000; 83 | } 84 | 85 | curtime = (tp.tv_sec - secbase)*1000 + tp.tv_usec/1000; 86 | 87 | return curtime; 88 | } 89 | 90 | void Sys_Mkdir (char *path) 91 | { 92 | mkdir (path, 0777); 93 | } 94 | 95 | char *strlwr (char *s) 96 | { 97 | while (*s) { 98 | *s = tolower(*s); 99 | s++; 100 | } 101 | } 102 | 103 | //============================================ 104 | 105 | static char findbase[MAX_OSPATH]; 106 | static char findpath[MAX_OSPATH]; 107 | static char findpattern[MAX_OSPATH]; 108 | static DIR *fdir; 109 | 110 | static qboolean CompareAttributes(char *path, char *name, 111 | unsigned musthave, unsigned canthave ) 112 | { 113 | struct stat st; 114 | char fn[MAX_OSPATH]; 115 | 116 | // . and .. never match 117 | if (strcmp(name, ".") == 0 || strcmp(name, "..") == 0) 118 | return false; 119 | 120 | sprintf(fn, "%s/%s", path, name); 121 | if (stat(fn, &st) == -1) 122 | return false; // shouldn't happen 123 | 124 | if ( ( st.st_mode & S_IFDIR ) && ( canthave & SFF_SUBDIR ) ) 125 | return false; 126 | 127 | if ( ( musthave & SFF_SUBDIR ) && !( st.st_mode & S_IFDIR ) ) 128 | return false; 129 | 130 | return true; 131 | } 132 | 133 | char *Sys_FindFirst (char *path, unsigned musthave, unsigned canhave) 134 | { 135 | struct dirent *d; 136 | char *p; 137 | 138 | if (fdir) 139 | Sys_Error ("Sys_BeginFind without close"); 140 | 141 | // COM_FilePath (path, findbase); 142 | strcpy(findbase, path); 143 | 144 | if ((p = strrchr(findbase, '/')) != NULL) { 145 | *p = 0; 146 | strcpy(findpattern, p + 1); 147 | } else 148 | strcpy(findpattern, "*"); 149 | 150 | if (strcmp(findpattern, "*.*") == 0) 151 | strcpy(findpattern, "*"); 152 | 153 | if ((fdir = opendir(path)) == NULL) 154 | return NULL; 155 | while ((d = readdir(fdir)) != NULL) { 156 | if (!*findpattern || glob_match(findpattern, d->d_name)) { 157 | // if (*findpattern) 158 | // printf("%s matched %s\n", findpattern, d->d_name); 159 | if (CompareAttributes(findbase, d->d_name, musthave, canhave)) { 160 | sprintf (findpath, "%s/%s", findbase, d->d_name); 161 | return findpath; 162 | } 163 | } 164 | } 165 | return NULL; 166 | } 167 | 168 | char *Sys_FindNext (unsigned musthave, unsigned canhave) 169 | { 170 | struct dirent *d; 171 | 172 | if (fdir == NULL) 173 | return NULL; 174 | while ((d = readdir(fdir)) != NULL) { 175 | if (!*findpattern || glob_match(findpattern, d->d_name)) { 176 | // if (*findpattern) 177 | // printf("%s matched %s\n", findpattern, d->d_name); 178 | if (CompareAttributes(findbase, d->d_name, musthave, canhave)) { 179 | sprintf (findpath, "%s/%s", findbase, d->d_name); 180 | return findpath; 181 | } 182 | } 183 | } 184 | return NULL; 185 | } 186 | 187 | void Sys_FindClose (void) 188 | { 189 | if (fdir != NULL) 190 | closedir(fdir); 191 | fdir = NULL; 192 | } 193 | 194 | 195 | //============================================ 196 | 197 | -------------------------------------------------------------------------------- /unix/next/sv_ccmds.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/id-Software/Quake-2/372afde46e7defc9dd2d719a1732b8ace1fa096e/unix/next/sv_ccmds.o -------------------------------------------------------------------------------- /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.aps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/id-Software/Quake-2/372afde46e7defc9dd2d719a1732b8ace1fa096e/win32/q2.aps -------------------------------------------------------------------------------- /win32/q2.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/id-Software/Quake-2/372afde46e7defc9dd2d719a1732b8ace1fa096e/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 | 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 | #endif // English (U.S.) resources 59 | ///////////////////////////////////////////////////////////////////////////// 60 | 61 | 62 | 63 | #ifndef APSTUDIO_INVOKED 64 | ///////////////////////////////////////////////////////////////////////////// 65 | // 66 | // Generated from the TEXTINCLUDE 3 resource. 67 | // 68 | 69 | 70 | ///////////////////////////////////////////////////////////////////////////// 71 | #endif // not APSTUDIO_INVOKED 72 | 73 | -------------------------------------------------------------------------------- /win32/qe3.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/id-Software/Quake-2/372afde46e7defc9dd2d719a1732b8ace1fa096e/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.aps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/id-Software/Quake-2/372afde46e7defc9dd2d719a1732b8ace1fa096e/win32/winquake.aps -------------------------------------------------------------------------------- /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 | --------------------------------------------------------------------------------