shithub: rc

Download patch

ref: 86d856d1b1aa908f153e7cd62a1cb2fb3e97bd1f
parent: 0dac38003861b6a485dab758a9437f2ea800990c
author: qwx <qwx@sciops.net>
date: Thu Jan 9 00:22:31 EST 2020

add wolf3d, doom and quake launchers

--- /dev/null
+++ b/doom
@@ -1,0 +1,58 @@
+#!/bin/rc -e
+# set up namespace for a particular version of doom and launch it
+# default setup:
+# - $home/lib/doom: mntpt and location of config file
+# - $home/lib/doom/$game: user game directories: savegames and screenshots
+# - /sys/games/lib/doom/$game: system iwad and pwad directories
+# cwd is bound over $mntpt to allow loading stuff from there
+# example: launch doom2 with scythe.wad (both in /sys/games/lib/doom/d2)
+#	; doom d2 -file scythe.wad
+# example game version names:
+# doom.wad → /sys/games/lib/doom/d1/
+# doom2.wad → /sys/games/lib/doom/d2/
+# doom2f.wad → /sys/games/lib/doom/d2f/
+# doom1.wad → /sys/games/lib/doom/dsh/
+# plutonia.wad → /sys/games/lib/doom/plt/
+# tnt.wad → /sys/games/lib/doom/tnt/
+# doomu.wad → /sys/games/lib/doom/ud/
+
+rfork ne
+flagfmt='b,l,z,m mntpt'
+args='game [params]'
+if(! ifs=() eval `{aux/getflags $*} || ~ $#* 0){
+	aux/usage
+	exit usage
+}
+mntpt=$home/lib/doom
+if(~ $#flagm 1)
+	mntpt=$flagm
+if(! test -d $mntpt/$1)
+	mkdir -p $mntpt/$1
+bind -ac $mntpt/$1 $mntpt
+if(test -d /sys/games/lib/doom/$1)
+	bind -a /sys/games/lib/doom/$1 $mntpt
+if(! ~ $flagb 1)
+	bind -b `{pwd} $mntpt
+cd $mntpt
+
+# max scaling factor is 4 unless doom itself is patched
+if(~ $#vgasize 0 || ~ $flagz 1)
+	r=(-dx 328 -dy 208)
+if not
+	r=`{echo $vgasize |\
+		awk -Fx '{
+			a=$1/320;
+			b=$2/200;
+			c=int(b<a?b:a);
+			if(c*320 == $1 || c*200 == $2)
+				c--;
+			print "-dx", c*320+8, "-dy", c*200+8
+		}'
+	}
+if(! ~ $flagz 1)
+	echo resize $r >/dev/wctl
+
+if(! ~ $flagl 1)
+	games/doom $* >/dev/null
+if not
+	games/doom $* >/tmp/doomlog.$pid >[2=1]
--- /dev/null
+++ b/qk1
@@ -1,0 +1,14 @@
+#!/bin/rc
+rfork ne
+switch($sysname){
+case u24 u27 u20 u25
+	res=(-dx 1032 -dy 776)
+case u11
+	res=(-dx 1608 -dy 1208)
+	a=(-m 32)
+case *
+	res=(-dx 808 -dy 608)
+}
+echo resize $res >/dev/wctl
+bind -q /sys/games/lib/quake/cd /mnt/cd	# cdfs(4)
+quake $a $* >/dev/null
--- /dev/null
+++ b/qk2
@@ -1,0 +1,28 @@
+#!/bin/rc
+rfork ne
+res=(-dx 808 -dy 608)
+noresz=()
+c=(quake2)
+# launch ctf with: qk2 -g ctf $* +set ctf 1
+# launch crbot with: qk2 -g crbot $* +set deathmatch 1 +set ctf 0
+while(~ $1 -?){
+	switch($1){
+	case -g
+		# mods' executables are named q2$x
+		c=(q2$2 +set game $2)
+		shift
+	case -m
+		cdmnt=$2
+		shift
+	case -r
+		res=(-dx `{echo $2 + 8 | pc -n} -dy `{echo $3 + 8 | pc -n})
+		shift 2
+	case -z
+		noresz=1
+	}
+	shift
+}
+if(~ $#noresz 0)
+	echo resize $res >/dev/wctl
+bind -q /sys/games/lib/quake2/cd /mnt/cd	# cdfs(4)
+$c $* >/dev/null
--- /dev/null
+++ b/qk3
@@ -1,0 +1,4 @@
+#!/bin/rc
+echo scroll >/dev/wctl
+#cd /sys/games/lib/quake3 && q3ded +set developer 1 +set fs_game cpma +map cpm22
+cd /sys/games/lib/quake3 && q3ded +set developer 1 +map q3dm17
--- /dev/null
+++ b/qw
@@ -1,0 +1,13 @@
+#!/bin/rc
+rfork ne
+switch($sysname){
+case u24 u27 u20 u25
+	res=(-dx 1032 -dy 776)
+case u11
+	res=(-dx 1608 -dy 1208)
+case *
+	res=(-dx 808 -dy 608)
+}
+echo resize $res >/dev/wctl
+bind -q /sys/games/lib/quake/cd /mnt/cd	# cdfs(4)
+qwcl -mem 32 $* >/dev/null
--- /dev/null
+++ b/wl
@@ -1,0 +1,25 @@
+#!/bin/rc
+rfork n
+
+bind -b . /sys/games/lib/wl3d
+cd $home/lib/wl3d
+if(~ $1 -R){
+	r=(-dx $2 -dy $3)
+	shift 2
+}
+if not if(~ $#vgasize 0)
+	r=(-dx 328 -dy 208)
+if not
+	r=`{echo $vgasize |\
+		awk -Fx '{
+			a=$1/320;
+			b=$2/200;
+			c=int(b<a?b:a);
+			if(c*320 == $1 || c*200 == $2)
+				c--;
+			print "-dx", c*320+8, "-dy", c*200+8
+		}'
+	}
+
+echo resize $r >/dev/wctl
+wl3d $*