qwx/qk1

Description
qk1 - (9) quake
===============
Port of linux/x11 quake and quakeworld to plan9front.
- Works on amd64 and 386, broken on zynq

For details, see: http://nopenopenope.net/posts/quake


Installation
------------
Besides building and installing qk1, you still need .pak files to play.  Both
shareware and registered versions work, as well as the official expansions,
and mods.
The data files are to be installed in /sys/games/lib/quake/$gamename, where
$gamename is 'id1' for plain old quake.  Savegames, configuration files and
other user-specific data is saved in $home/lib/quake/$gamename, if it exists.

; mk install
; mkdir -p $home/lib/quake/id1
; cp /n/quakecd/id1/*.pak $home/lib/quake/id1
; quake >/dev/null

To install quakeworld:

; cd qw
; mk install

By default, qk1 allocates 12 MB of memory for its internal heap.  This amount
can be controlled via the -m command line parameter like so:

; quake -m 16

It is necessary to increase it when playing on larger resolutions, else qk1
might crash with errors such as 'Hunk_Alloc: failed on 548512 bytes'.

qk1 reads /mnt/cd/[au]NNN files as in cdfs(1) to play music.  The directory
needn't be populated by cdfs(1), so long as the files are in the format
described by audio(3).  Reading from actual cdroms is currently broken.

On lower framerates, devaudio's delay must be increased appropriately, up to
4410 (for a rate of 44.1 kHz), or sound will cut up.  This applies to
quakeworld as well, for which the framerate is capped lower by default.

Installing an expansion or mod, for example rogue:

; mkdir /sys/games/lib/quake/rogue
; cp /n/roguecd/*.pak /sys/games/lib/quake/rogue
; mkdir $home/lib/quake/rogue

Then start with:

; quake -g rogue

To enable grabbing the mouse, set the m_windowed console variable to 1.


Todo/bugs
---------
- don't use #pragma pack and do not read in structs directly
- fix zynq graphics issues
- cd: buffer reading from actual cdroms
- do away with PR_Str shit
- manpages
- merge quakeworld: mkmany, etc
- random crashes in d_sprite.c:D_SpriteDrawSpans
- infinite loop in SV_TouchLinks
- (amd64) entities visible through walls right when emerging from/immerging
  into water
- resolutions other than 4:3: some vertical and horizontal strips on the edge
  of the screen aren't drawn
- #define PARANOID reveals several points of failure that are otherwise ignored
- (?) sprites not scaled correctly on higher resolutions
- more testing, cleanups and bug fixes (g '/\* FIXME')


Shitty workarounds and other bullshit
-------------------------------------
- #pragma pack for stuff (structs) loaded from files
- pr_strings assumed 32bit pointer arithmetic, so enter PR_GetStr(), which
  completely sucks
- text and code seen as useless for plan9 nuked from orbit (cpp defs, etc.)
- arbitrary resolution limit (r_shared.h): 2048x2048 (was 1280x1024), which
  inflates e.g. a bunch of arrays in the code
- both stdio and print(2) are used due to the way colored strings are handled


Legal
-----
Quake, hence qk1, is licensed under the GPLv2. see COPYING for details.
Last 5 commits (shortlog)
Date Author Short message Commit hash
2021-03-02 Sigrid increase local models name size for the insane amounts of brushes in BSP2 3ba533fb9d5e013768813983fc0a4464f4ba13ac
2021-02-13 Sigrid "profile" cmd: no action unless an active server 1d23f8a32e4a26c71b21376e21cf539aee95b831
2021-02-08 Sigrid replace nsec() with nanosec(): less context switching dcf466b34d62b087c003ecc6347a43e247217b65
2021-02-08 Sigrid draw viewmodel when fov is > 90 (can still be disabled with a cvar) 42681cb8ee1bab11448ddda478f5791b6b7699e9
2021-02-04 qwx in: override of console key for swe keyboard (thanks sigrid) 94c34b727da415e203ee31d6757a04d35a60afd4
Files (browse)
.hgignore
COPYING
Makefile
NOTES
README
adivtab.h
anorms.h
bspfile.h
chase.c
cl_demo.c
cl_input.c
cl_main.c
cl_parse.c
cl_tent.c
client.h
cmd.c
cmd.h
common.c
common.h
console.c
console.h
cvar.c
cvar.h
d_edge.c
d_fill.c
d_iface.h
d_init.c
d_local.h
d_modech.c
d_part.c
d_polyse.c
d_scan.c
d_sky.c
d_sprite.c
d_surf.c
d_vars.c
d_zpoint.c
dat.h
draw.c
draw.h
fns.h
fs.c
host.c
host_cmd.c
in.c
input.h
keys.c
keys.h
mathlib.c
mathlib.h
menu.c
menu.h
mkfile
model.c
model.h
modelgen.h
nanosec.c
net.h
net_dgrm.c
net_loop.c
net_main.c
net_udp.c
pr_cmds.c
pr_comp.h
pr_edict.c
pr_exec.c
progdefs.h
progdefs.q1
progs.h
protocol.h
qk1.c
quakedef.h
qw/
r_aclip.c
r_alias.c
r_bsp.c
r_draw.c
r_edge.c
r_efrag.c
r_light.c
r_local.h
r_main.c
r_misc.c
r_part.c
r_shared.h
r_sky.c
r_sprite.c
r_surf.c
r_vars.c
render.h
sbar.c
sbar.h
screen.c
screen.h
server.h
snd.c
spritegn.h
sv_main.c
sv_move.c
sv_phys.c
sv_user.c
vid.c
vid.h
view.c
view.h
wad.c
wad.h
world.c
world.h
zone.c
zone.h