--- /dev/null
+PREFIX ?= /usr/local
+BINDIR ?= $(PREFIX)/bin
+LIBDIR ?= $(PREFIX)/lib/xonotic
+DOCDIR ?= $(PREFIX)/share/doc/xonotic
+ZIP ?= zip -9
+INSTALL ?= install
+ARCH ?= $(shell if [ x"`uname -m`" = x"x86_64" ]; then echo linux64; else echo linux32; fi)
+LN ?= ln
+SUFFIX ?= $(shell if [ -d .git ]; then echo git; else echo zip; fi)
+CP ?= cp
+
+
+.PHONY: all
+all: all-$(SUFFIX)
+
+.PHONY: all-git
+all-git:
+ ./all compile -r
+
+.PHONY: all-zip
+all-zip:
+ @echo Sorry, this is not implemented yet
+ @false
+
+
+.PHONY: clean
+clean: clean-$(SUFFIX)
+
+.PHONY: clean-git
+clean-git:
+ ./all clean
+
+.PHONY: clean-zip
+clean-zip:
+ @echo Sorry, this is not implemented yet
+ @false
+
+
+.PHONY: install-data
+install-data: install-data-$(SUFFIX)
+
+.PHONY: install-data-git
+install-data-git:
+ $(RM) -rf $(LIBDIR)/data
+ $(INSTALL) -d $(LIBDIR)/data
+ for p in data/*.pk3; do $(INSTALL) $$p $(LIBDIR)/$$p || exit 1; done
+ for p in data/*.pk3dir; do ( cd $$p; $(ZIP) -r $(LIBDIR)/$${p%dir} * ) || exit 1; done
+
+.PHONY: install-data-zip
+install-data-zip:
+ $(RM) -rf $(LIBDIR)/data
+ $(INSTALL) -d $(LIBDIR)/data
+ for p in data/*.pk3; do $(INSTALL) $$p $(LIBDIR)/$$p || exit 1; done
+
+
+.PHONY: install-engine
+install-engine: install-engine-$(SUFFIX)
+
+.PHONY: install-engine-git
+install-engine-git:
+ $(INSTALL) -d $(LIBDIR)
+ $(INSTALL) xonotic-linux-glx.sh $(LIBDIR)/xonotic-linux-glx.sh
+ $(INSTALL) xonotic-linux-sdl.sh $(LIBDIR)/xonotic-linux-sdl.sh
+ $(INSTALL) xonotic-linux-dedicated.sh $(LIBDIR)/xonotic-linux-dedicated.sh
+ $(INSTALL) darkplaces/darkplaces-sdl $(LIBDIR)/xonotic-$(ARCH)-sdl
+ $(INSTALL) darkplaces/darkplaces-glx $(LIBDIR)/xonotic-$(ARCH)-glx
+ $(INSTALL) darkplaces/darkplaces-dedicated $(LIBDIR)/xonotic-$(ARCH)-dedicated
+
+.PHONY: install-engine-zip
+install-engine-zip:
+ $(INSTALL) -d $(LIBDIR)
+ $(INSTALL) xonotic-linux-glx.sh $(LIBDIR)/xonotic-linux-glx.sh
+ $(INSTALL) xonotic-linux-sdl.sh $(LIBDIR)/xonotic-linux-sdl.sh
+ $(INSTALL) xonotic-linux-dedicated.sh $(LIBDIR)/xonotic-linux-dedicated.sh
+ $(INSTALL) xonotic-$(ARCH)-sdl $(LIBDIR)/xonotic-$(ARCH)-sdl
+ $(INSTALL) xonotic-$(ARCH)-glx $(LIBDIR)/xonotic-$(ARCH)-glx
+ $(INSTALL) xonotic-$(ARCH)-dedicated $(LIBDIR)/xonotic-$(ARCH)-dedicated
+
+
+.PHONY: install-links
+install-links:
+ $(INSTALL) -d $(BINDIR)
+ $(LN) -snf $(LIBDIR)/xonotic-$(ARCH)-sdl $(BINDIR)/xonotic-sdl
+ $(LN) -snf $(LIBDIR)/xonotic-$(ARCH)-glx $(BINDIR)/xonotic-glx
+ $(LN) -snf $(LIBDIR)/xonotic-$(ARCH)-dedicated $(BINDIR)/xonotic-dedicated
+
+
+.PHONY: install-doc
+install-doc:
+ $(INSTALL) -d $(DOCDIR)/server
+ $(CP) -R Docs/* $(DOCDIR)/
+ $(CP) -R server/* $(DOCDIR)/server
+
+
+.PHONY: install
+install: install-data install-engine install-links install-doc
for d in $repos; do
p="${d%dir}"
f="`repoflags "$d"`"
- # if we have the dir, always keep it
- if [ -d "$d" ]; then
- msg "Repository $d enabled because it already exists"
- $ECHO "$d"
+ # if we have .no file, skip
+ if [ -f "$d.no" ]; then
+ msg "Repository $d disabled by a .no file, delete $d.no to enable"
continue
fi
# if .yes file exists, always keep it
$ECHO "$d"
continue
fi
- # if we have .no file, skip
- if [ -f "$d.no" ]; then
- msg "Repository $d disabled by a .no file, delete $d.no to enable"
+ # if we have the dir, always keep it
+ if [ -d "$d" ]; then
+ msg "Repository $d enabled because it already exists"
+ $ECHO "$d"
continue
fi
# if we have matching pk3, skip
* SUCH DAMAGE.
*
* $Format:commit %H$
- * $Id: 9a7b912057b836675f4e24f08514cad53fa46d2a $
+ * $Id: a6b551ba6968466f5bf1003bd1f000cd29beb698 $
*/
#ifndef __D0_H__
#define D0_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
#define D0_BOOL int
-extern void *(*d0_malloc)(size_t len);
-extern void (*d0_free)(void *p);
+typedef void *(d0_malloc_t)(size_t len);
+typedef void (d0_free_t)(void *p);
+typedef void *(d0_createmutex_t)(void);
+typedef void (d0_destroymutex_t)(void *);
+typedef int (d0_lockmutex_t)(void *); // zero on success
+typedef int (d0_unlockmutex_t)(void *); // zero on success
+
+extern d0_malloc_t *d0_malloc;
+extern d0_free_t *d0_free;
+extern d0_createmutex_t *d0_createmutex;
+extern d0_destroymutex_t *d0_destroymutex;
+extern d0_lockmutex_t *d0_lockmutex;
+extern d0_unlockmutex_t *d0_unlockmutex;
+
+void d0_setmallocfuncs(d0_malloc_t *m, d0_free_t *f);
+void d0_setmutexfuncs(d0_createmutex_t *c, d0_destroymutex_t *d, d0_lockmutex_t *l, d0_unlockmutex_t *u);
+
extern const char *d0_bsd_license_notice;
#endif
* SUCH DAMAGE.
*
* $Format:commit %H$
- * $Id: bea924581e2a7daf61a2fe20ab360ed1f05f5aaa $
+ * $Id: cbb0b2c932cb3a3c921ef6969522ba6250d54ece $
*/
#ifndef __D0_BLIND_ID_H__
D0_EXPORT void d0_blind_id_util_sha256(char *out, const char *in, size_t n);
+// for exporting
+D0_EXPORT void d0_blind_id_setmallocfuncs(d0_malloc_t *m, d0_free_t *f);
+D0_EXPORT void d0_blind_id_setmutexfuncs(d0_createmutex_t *c, d0_destroymutex_t *d, d0_lockmutex_t *l, d0_unlockmutex_t *u);
+
#endif
inherited_linker_flags=''
# Libraries that this one depends upon.
-dependency_libs=' -L/tmp/Darkplaces.build.linux32.deps/lib /tmp/gg/lib/libgmp.la'
+dependency_libs=' -L/tmp/d0_blind_id.deps/lib/ /tmp/gg/lib/libgmp.la'
# Names of additional weak libraries provided by this library
weak_library_names=''
dlpreopen=''
# Directory that this library needs to be installed in:
-libdir='/tmp/d0c/lib'
+libdir='/usr/local/lib'
inherited_linker_flags=''
# Libraries that this one depends upon.
-dependency_libs=' -L/tmp/Darkplaces.build.linux32.deps/lib /tmp/gg/lib/libgmp.la'
+dependency_libs=' -L/tmp/d0_blind_id.deps/lib/ /tmp/gg/lib/libgmp.la'
# Names of additional weak libraries provided by this library
weak_library_names=''
dlpreopen=''
# Directory that this library needs to be installed in:
-libdir='/tmp/d0c/lib'
+libdir='/usr/local/lib'
-prefix=/tmp/d0c
+prefix=/usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: Blind-ID
Description: Library for user identification using RSA blind signatures
Requires:
-Version: 0.3
+Version: 0.4
Libs: -L${libdir} -ld0_blind_id
Cflags: -I${includedir}/d0_blind_id
-prefix=/tmp/d0c
+prefix=/usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: Rijndael
Description: Library for Rijndael encryption
Requires:
-Version: 0.3
+Version: 0.4
Libs: -L${libdir} -ld0_rijndael
Cflags: -I${includedir}/d0_blind_id
* SUCH DAMAGE.
*
* $Format:commit %H$
- * $Id: 9a7b912057b836675f4e24f08514cad53fa46d2a $
+ * $Id: a6b551ba6968466f5bf1003bd1f000cd29beb698 $
*/
#ifndef __D0_H__
#define D0_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
#define D0_BOOL int
-extern void *(*d0_malloc)(size_t len);
-extern void (*d0_free)(void *p);
+typedef void *(d0_malloc_t)(size_t len);
+typedef void (d0_free_t)(void *p);
+typedef void *(d0_createmutex_t)(void);
+typedef void (d0_destroymutex_t)(void *);
+typedef int (d0_lockmutex_t)(void *); // zero on success
+typedef int (d0_unlockmutex_t)(void *); // zero on success
+
+extern d0_malloc_t *d0_malloc;
+extern d0_free_t *d0_free;
+extern d0_createmutex_t *d0_createmutex;
+extern d0_destroymutex_t *d0_destroymutex;
+extern d0_lockmutex_t *d0_lockmutex;
+extern d0_unlockmutex_t *d0_unlockmutex;
+
+void d0_setmallocfuncs(d0_malloc_t *m, d0_free_t *f);
+void d0_setmutexfuncs(d0_createmutex_t *c, d0_destroymutex_t *d, d0_lockmutex_t *l, d0_unlockmutex_t *u);
+
extern const char *d0_bsd_license_notice;
#endif
* SUCH DAMAGE.
*
* $Format:commit %H$
- * $Id: bea924581e2a7daf61a2fe20ab360ed1f05f5aaa $
+ * $Id: cbb0b2c932cb3a3c921ef6969522ba6250d54ece $
*/
#ifndef __D0_BLIND_ID_H__
D0_EXPORT void d0_blind_id_util_sha256(char *out, const char *in, size_t n);
+// for exporting
+D0_EXPORT void d0_blind_id_setmallocfuncs(d0_malloc_t *m, d0_free_t *f);
+D0_EXPORT void d0_blind_id_setmutexfuncs(d0_createmutex_t *c, d0_destroymutex_t *d, d0_lockmutex_t *l, d0_unlockmutex_t *u);
+
#endif
inherited_linker_flags=''
# Libraries that this one depends upon.
-dependency_libs=' -L/tmp/Darkplaces.build.linux64.deps/lib /tmp/g/lib/libgmp.la'
+dependency_libs=' -L/tmp/d0_blind_id.deps/lib/ /tmp/g/lib/libgmp.la'
# Names of additional weak libraries provided by this library
weak_library_names=''
dlpreopen=''
# Directory that this library needs to be installed in:
-libdir='/tmp/d0c/lib'
+libdir='/usr/local/lib'
inherited_linker_flags=''
# Libraries that this one depends upon.
-dependency_libs=' -L/tmp/Darkplaces.build.linux64.deps/lib /tmp/g/lib/libgmp.la'
+dependency_libs=' -L/tmp/d0_blind_id.deps/lib/ /tmp/g/lib/libgmp.la'
# Names of additional weak libraries provided by this library
weak_library_names=''
dlpreopen=''
# Directory that this library needs to be installed in:
-libdir='/tmp/d0c/lib'
+libdir='/usr/local/lib'
-prefix=/tmp/d0c
+prefix=/usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: Blind-ID
Description: Library for user identification using RSA blind signatures
Requires:
-Version: 0.3
+Version: 0.4
Libs: -L${libdir} -ld0_blind_id
Cflags: -I${includedir}/d0_blind_id
-prefix=/tmp/d0c
+prefix=/usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: Rijndael
Description: Library for Rijndael encryption
Requires:
-Version: 0.3
+Version: 0.4
Libs: -L${libdir} -ld0_rijndael
Cflags: -I${includedir}/d0_blind_id
--- /dev/null
+import subprocess
+import os
+import fcntl
+import base64
+import select
+
+d0_blind_id_keygen = "./crypto-keygen-standalone"
+d0_blind_id_d0pk = "key_0.d0pk"
+
+def d0_blind_id_verify(sig, querystring, postdata=None): #-> (idfp, status)
+ data = None
+ if postdata == None:
+ data = querystring
+ else:
+ data = postdata + "\0" + querystring
+ if sig != None:
+ # make some pipes
+ (dpipe_r, dpipe_w) = os.pipe()
+ (spipe_r, spipe_w) = os.pipe()
+
+ # smoke them
+ def closepipes():
+ os.close(dpipe_w)
+ os.close(spipe_w)
+ checker = subprocess.Popen([d0_blind_id_keygen, "-p", d0_blind_id_d0pk, "-d", "/dev/fd/%d" % (dpipe_r, ), "-s", "/dev/fd/%d" % (spipe_r, )], stdout=subprocess.PIPE, preexec_fn=closepipes)
+
+ # close them
+ os.close(dpipe_r)
+ os.close(spipe_r)
+
+ # make them nonblocking
+ fcntl.fcntl(dpipe_w, fcntl.F_SETFL, fcntl.fcntl(dpipe_w, fcntl.F_GETFL) | os.O_NONBLOCK)
+ fcntl.fcntl(spipe_w, fcntl.F_SETFL, fcntl.fcntl(spipe_w, fcntl.F_GETFL) | os.O_NONBLOCK)
+
+ # fill vars
+ rpipes = [dpipe_w, spipe_w]
+ buffers = [data, base64.b64decode(sig)]
+
+ # generic nonblocking buffer loop
+ while len([p for p in rpipes if p != None]) != 0:
+ (readers, writers, errorers) = select.select([], [p for p in rpipes if p != None], [p for p in rpipes if p != None], None)
+ n = 0
+ for e in errorers:
+ i = [j for j in range(len(rpipes)) if rpipes[j] == e]
+ if len(i) != 1:
+ continue
+ i = i[0]
+ os.close(e)
+ buffers[i] = None
+ rpipes[i] = None
+ n += 1
+ for w in writers:
+ i = [j for j in range(len(rpipes)) if rpipes[j] == w]
+ if len(i) != 1:
+ continue
+ i = i[0]
+ written = os.write(w, buffers[i])
+ if written > 0:
+ buffers[i] = buffers[i][written:]
+ if buffers[i] == "":
+ os.close(w)
+ buffers[i] = None
+ rpipes[i] = None
+ n += 1
+ if not n:
+ break
+
+ # close all remaining
+ for p in rpipes:
+ if p != None:
+ os.close(p)
+
+ # check
+ if len([x for x in buffers if x != None]) != 0:
+ raise Exception("could not write data to process")
+
+ # retrieve data from stdout
+ status = checker.stdout.readline().rstrip("\n")
+ idfp = checker.stdout.readline().rstrip("\n")
+ checker.stdout.close()
+ checker.wait()
+ if checker.returncode != 0:
+ return (None, None)
+ return (idfp, (status == "1"))
+
+if __name__ == "__main__":
+ sig = "gQEBERjDsnVNr4qrYkvaevguF4ypPZHq0yiXfMMKwlu7+kY3HuI8zHx2WhiYj+q26re5uamQ9r8umh54CEJ7zqZAz8IavVblWYznzee9WjIBAB1FeHwILGlKOCDpGBikoZBkMxI4MqjCPzDPAkDMrd1DK0FsWOTpWljLgNGfACTKcgKBAQGPqnGoD6GhuHLYN+Sf73ROColneBdJ7ttuVwm32FvI8LuD5aLDll7bpqfHTWhgbTW02CYvkTAYtoz2RZmIGK5ZHHaM/V6vcSXnq2ab/7mFRiag7D5OUsmIFY9E3IqcqtP7+wXSVgiNFY3DBPy27bXjk8ZJ9nUD5dQBL9sG8TzWd4EBAYrTMfF82EBgsVArIaQjeOuJC3bkPzP5b3El/ZCHkDShpu7wZ82h/82B4W5Ep3KXpgu+YAEULt+5i2WbsfRSXeVZctzD4A++MBqQx9VuN/KsxgHS/20tRiBgd1VElhRD8KJ0lbkxYNcHSkpWSMDFS+eFmizcM3/XQNQ7ukAmM3lkgQEBIZR+FpDFLoGg9mIu2RH9O7lWdifpVhqjrEnvkr4KdB6JzBXAwVPmt1NAVDjGRI/ELlTysOx1b9F2EgdJejY5LgcVxz6irwEckx0z+L10A6Ca2lsGR1E+rViFffNNIJv34dNKgaCInyUNCeBei0AF8KLXLHhRTiBvSVBi6ANb/lY="
+ querystring = ""
+ postdata = "hello world"
+ (idfp, status) = d0_blind_id_verify(sig, querystring, postdata)
+ print(repr((idfp, status)))
raw set places_tuba "tUba1 tUba2 tUba3 tUba4 tUba5 tUba6 tUba7 tUba8 tUba9 tUba10 tUba11 tUba12 tUba13 tUba14 tUba15 tUba16 tUba17 tUba18 tUba19 tUba20 tUba21 tUba22 tUba23 tUba24 tUba25 tUba26 tUba27 tUba28 tUba29 tUba30 tUba31 tUba32"
raw set places_percussion "tChr1 tChr2 tChr3 tChr4 tChr5 tChr6 tChr7 tChr8 tChr9 tChr10 tChr11 tChr12 tChr13 tChr14 tChr15 tChr16 tChr17 tChr18 tChr19 tChr20 tChr21 tChr22 tChr23 tChr24 tChr25 tChr26 tChr27 tChr38 tChr39 tChr30 tChr31 tChr32"
raw set places_vocals "tVocals"
+raw set places_metalsteps "tMetalSteps1 tMetalSteps2 tMetalSteps3"
+raw set places_nosteps "tNoSteps1 tNoSteps2 tNoSteps3 tNoSteps4"
raw settemp bot_ai_thinkinterval 0
raw settemp bot_sound_monopoly 1
-bot tuba
- channels 1 2 3 4 5 6 7 8 9 11 12 13 14 15 16
- init
- cmd barrier
- cmd selectweapon 15
- cmd wait 0.5
- raw settemp g_balance_tuba_attenuation 0.1
- raw settemp g_balance_tuba_damage 0
+bot notebot
note on -18
time 0
cmd debug_assert_canfire 1
buttons
time 0
+bot tuba
+ include notebot
+ channels 1 2 3 4 5 6 7 8 9 11 12 13 14 15 16
+ programs 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
+ transpose 48
+ init
+ cmd barrier
+ cmd selectweapon 15
+ cmd wait 0.5
+ raw settemp g_balance_tuba_attenuation 0.1
+
+bot accordeon
+ include notebot
+ channels 1 2 3 4 5 6 7 8 9 11 12 13 14 15 16
+ programs 22 23 24
+ transpose 60
+ init
+ cmd barrier
+ cmd selectweapon 15
+ cmd wait 0.5
+ cmd impulse 20
+ raw settemp g_balance_tuba_attenuation 0.1
+
bot tuba_red
include tuba
transpose 0
cmd cc "color 221"
super
+bot accordeon_red
+ include accordeon
+ transpose 0
+ init
+ cmd cc "color 68"
+ super
+
+bot accordeon_blue
+ include accordeon
+ transpose 3
+ init
+ cmd cc "color 221"
+ super
+
# laser = lasershot NONE
bot laser
channels 10
buttons
time 0
busy 1.1
+ percussion 73 # 073_Guiro_1_Short-0.wav
+ percussion 74
# uzi = bullet BAD
bot uzi
percussion 27
percussion 33 # 033_Metronome_Click-0.wav
percussion 27
- percussion 36 # 036_Kick_2-0.wav
- percussion 27
percussion 53 # 053_Cymbal_Ride_Bell-0.wav
percussion 27
- percussion 54 # 054_Tombourine-0.wav
+ percussion 54 # 054_Tambourine-0.wav
percussion 27
# grenadelauncher = RELOADSOUND RELOADSOUND
percussion 34
percussion 72 # 072_Whistle_2_Low_Long-0.wav
percussion 45
+ percussion 75 # 075_Claves-0.wav
+ percussion 34
# nex is nex NONE
bot nex
percussion 35
percussion 61 # 061_Bongo_Low-0.wav
percussion 35
- percussion 65 # 065_Timbale_High-0.wav
- percussion 35
- percussion 66 # 066_Timbale_Low-0.wav
- percussion 35
# TODO hookbomb would be useful for #60
busy 0.9
percussion 81 # 081_Triangle_2_Open-0.wav
percussion 62
+ percussion 80 # 081_Triangle_1_Mute-0.wav
+ percussion 62
# seeker is BADFLYSOUND tag
bot seeker
busy 0.9
bot jetpack
+ channels 10
init
time -2
cmd aimtarget "tPercussion 1"
percussion 42
percussion 64 # 064_Conga_Low-0.wav
percussion 42
+ percussion 70 # 070_Maracas-0.wav
+ percussion 42
+
+bot jumper
+ channels 10
+ init
+ time -2
+ cmd aimtarget "tPercussion 1"
+ cmd barrier
+ cmd wait 0.5
+ percussion 36 # 036_Kick_2-0.wav
+ time -0.6666666
+ buttons jump
+ time -0.5
+ buttons
+ time 0
+ busy 0.1
+
+bot metaljumper
+ channels 10
+ init
+ time -2
+ cmd aimtarget "tPercussion 1"
+ cmd barrier
+ cmd wait 0.5
+ percussion 65 # 065_Timbale_High-0.wav
+ time -0.6666666
+ buttons jump
+ time -0.5
+ buttons
+ time 0
+ busy 0.1
+ percussion 66 # 066_Timbale_Low-0.wav
+ percussion 65
bot switcher
+ channels 10
init
time -2
cmd aimtarget "tPercussion 1"
percussion 29
bot vocals
+ channels -1
init
time -2
cmd aimtarget "tPercussion 1"
bot instance_tuba_red
include tuba_red
include common
- count 8
+ count 16
init
cmd movetotarget @places_tuba
cmd barrier
bot instance_tuba_blue
include tuba_blue
include common
- count 8
+ count 16
+ init
+ cmd movetotarget @places_tuba
+ cmd barrier
+ super
+
+bot instance_accordeon_red
+ include accordeon_red
+ include common
+ count 16
+ init
+ cmd movetotarget @places_tuba
+ cmd barrier
+ super
+
+bot instance_accordeon_blue
+ include accordeon_blue
+ include common
+ count 16
init
cmd movetotarget @places_tuba
cmd barrier
super
bot instance_nex
- include rocket
+ include nex
include common
count 16
init
super
bot instance_minstanex
- include rocket
+ include minstanex
include common
count 16
init
include jetpack
include common
count 16
+ init
+ cmd movetotarget @places_nosteps
+ cmd barrier
+ super
+
+bot instance_jumper
+ include jumper
+ include common
+ count 16
init
cmd movetotarget @places_percussion
cmd barrier
super
+bot instance_metaljumper
+ include metaljumper
+ include common
+ count 16
+ init
+ cmd movetotarget @places_metalsteps
+ cmd barrier
+ super
+
bot instance_switcher
include switcher
include common
my $votehigh = 0;
my $votelow = 0;
my $votegood = 0;
- for(@busybots_allocated)
+ for(@busybots_allocated, grep { $_->{count} > 0 } values %$busybots)
{
next # I won't play on this channel
if defined $_->{channels} and not $_->{channels}->{$channel};
my @preallocate_new = map { $_->{classname} } @busybots_allocated;
if(@preallocate_new == @preallocate)
{
+ print "sv_cmd bot_cmd reset\n";
+ print "sv_cmd bot_cmd setbots @{[scalar @preallocate_new]}\n";
print "$precommands$commands";
exit 0;
}
+++ /dev/null
-#!/usr/bin/perl
-
-# converter from Type 1 MIDI files to CFG files that control bots with the Tuba and other weapons for percussion (requires g_weaponarena all)
-# usage:
-# perl midi2cfg.pl filename.mid basenote walktime "x y z" "x y z" "x y z" ... "/" "x y z" "x y z" ... > filename.cfg
-
-use strict;
-use warnings;
-use MIDI;
-use MIDI::Opus;
-
-use constant MIDI_FIRST_NONCHANNEL => 17;
-use constant MIDI_DRUMS_CHANNEL => 10;
-
-my ($filename, $transpose, $walktime, $staccato, @coords) = @ARGV;
-my @coords_percussion = ();
-my @coords_tuba = ();
-my $l = \@coords_tuba;
-for(@coords)
-{
- if($_ eq '/')
- {
- $l = \@coords_percussion;
- }
- else
- {
- push @$l, [split /\s+/, $_];
- }
-}
-
-my $opus = MIDI::Opus->new({from_file => $filename});
-#$opus->write_to_file("/tmp/y.mid");
-my $ticksperquarter = $opus->ticks();
-my $tracks = $opus->tracks_r();
-my @tempi = (); # list of start tick, time per tick pairs (calculated as seconds per quarter / ticks per quarter)
-my $tick;
-
-$tick = 0;
-for($tracks->[0]->events())
-{
- $tick += $_->[1];
- if($_->[0] eq 'set_tempo')
- {
- push @tempi, [$tick, $_->[2] * 0.000001 / $ticksperquarter];
- }
-}
-sub tick2sec($)
-{
- my ($tick) = @_;
- my $sec = 0;
- my $curtempo = [0, 0.5 / $ticksperquarter];
- for(@tempi)
- {
- if($_->[0] < $tick)
- {
- # this event is in the past
- # we add the full time since the last one then
- $sec += ($_->[0] - $curtempo->[0]) * $curtempo->[1];
- }
- else
- {
- # if this event is in the future, we break
- last;
- }
- $curtempo = $_;
- }
- $sec += ($tick - $curtempo->[0]) * $curtempo->[1];
- return $sec;
-}
-
-# merge all to a single track
-my @allmidievents = ();
-my $sequence = 0;
-for my $track(0..@$tracks-1)
-{
- $tick = 0;
- for($tracks->[$track]->events())
- {
- my ($command, $delta, @data) = @$_;
- $tick += $delta;
- push @allmidievents, [$command, $tick, $sequence++, $track, @data];
- }
-}
-@allmidievents = sort { $a->[1] <=> $b->[1] or $a->[2] <=> $b->[2] } @allmidievents;
-
-
-
-
-
-my @busybots_percussion = map { undef } @coords_percussion;
-my @busybots_tuba = map { undef } @coords_tuba;
-
-my $notes = 0;
-sub busybot_findfree($$$)
-{
- my ($time, $vchannel, $note) = @_;
- my $l = ($vchannel < MIDI_FIRST_NONCHANNEL) ? \@busybots_tuba : \@busybots_percussion;
- my $c = ($vchannel < MIDI_FIRST_NONCHANNEL) ? \@coords_tuba : \@coords_percussion;
- for(0..@$l-1)
- {
- if(!$l->[$_])
- {
- my $bot = {id => $_ + 1, busy => 0, busytime => 0, channel => $vchannel, curtime => -$walktime, curbuttons => 0, noteoffset => 0};
- $l->[$_] = $bot;
-
- # let the bot walk to his place
- printf "m $_ $c->[$_]->[0] $c->[$_]->[1] $c->[$_]->[2]\n";
-
- return $bot;
- }
- return $l->[$_] if
- (($vchannel < MIDI_FIRST_NONCHANNEL) || ($l->[$_]{channel} == $vchannel))
- &&
- !$l->[$_]{busy}
- &&
- $time > $l->[$_]{busytime};
- }
- use Data::Dumper;
- print STDERR Dumper $l;
- die "No free channel found at time $time ($notes notes active)\n";
-}
-
-sub busybot_find($$)
-{
- my ($vchannel, $note) = @_;
- my $l = ($vchannel < MIDI_FIRST_NONCHANNEL) ? \@busybots_tuba : \@busybots_percussion;
- for(0..@$l-1)
- {
- return $l->[$_] if
- $l->[$_]
- &&
- $l->[$_]{busy}
- &&
- $l->[$_]{channel} == $vchannel
- &&
- defined $l->[$_]{note}
- &&
- $l->[$_]{note} == $note;
- }
- return undef;
-}
-
-sub busybot_advance($$)
-{
- my ($bot, $t) = @_;
- my $t0 = $bot->{curtime};
- if($t != $t0)
- {
- #print "sv_cmd bot_cmd $bot->{id} wait @{[$t - $t0]}\n";
- print "w $bot->{id} $t\n";
- }
- $bot->{curtime} = $t;
-}
-
-sub busybot_setbuttonsandadvance($$$)
-{
- my ($bot, $t, $b) = @_;
- my $b0 = $bot->{curbuttons};
- my $press = $b & ~$b0;
- my $release = $b0 & ~$b;
- busybot_advance $bot => $t - 0.10
- if $release & (32 | 64);
- print "r $bot->{id} attack1\n" if $release & 32;
- print "r $bot->{id} attack2\n" if $release & 64;
- busybot_advance $bot => $t - 0.05
- if ($release | $press) & (1 | 2 | 4 | 8 | 16 | 128);
- print "r $bot->{id} forward\n" if $release & 1;
- print "r $bot->{id} backward\n" if $release & 2;
- print "r $bot->{id} left\n" if $release & 4;
- print "r $bot->{id} right\n" if $release & 8;
- print "r $bot->{id} crouch\n" if $release & 16;
- print "r $bot->{id} jump\n" if $release & 128;
- print "p $bot->{id} forward\n" if $press & 1;
- print "p $bot->{id} backward\n" if $press & 2;
- print "p $bot->{id} left\n" if $press & 4;
- print "p $bot->{id} right\n" if $press & 8;
- print "p $bot->{id} crouch\n" if $press & 16;
- print "p $bot->{id} jump\n" if $press & 128;
- busybot_advance $bot => $t
- if $press & (32 | 64);
- print "p $bot->{id} attack1\n" if $press & 32;
- print "p $bot->{id} attack2\n" if $press & 64;
- $bot->{curbuttons} = $b;
-}
-
-my %notes = (
- -18 => '1lbc',
- -17 => '1bc',
- -16 => '1brc',
- -13 => '1frc',
- -12 => '1c',
- -11 => '2lbc',
- -10 => '1rc',
- -9 => '1flc',
- -8 => '1fc',
- -7 => '1lc',
- -6 => '1lb',
- -5 => '1b',
- -4 => '1br',
- -3 => '2rc',
- -2 => '2flc',
- -1 => '1fl',
- 0 => '1',
- 1 => '2lb',
- 2 => '1r',
- 3 => '1fl',
- 4 => '1f',
- 5 => '1l',
- 6 => '2fr',
- 7 => '2',
- 8 => '1brj',
- 9 => '2r',
- 10 => '2fl',
- 11 => '2f',
- 12 => '2l',
- 13 => '2lbj',
- 14 => '1rj',
- 15 => '1flj',
- 16 => '1fj',
- 17 => '1lj',
- 18 => '2frj',
- 19 => '2j',
- 21 => '2rj',
- 22 => '2flj',
- 23 => '2fj',
- 24 => '2lj'
-);
-
-my $note_min = +99;
-my $note_max = -99;
-sub getnote($$)
-{
- my ($bot, $note) = @_;
- $note_max = $note if $note_max < $note;
- $note_min = $note if $note_min > $note;
- $note -= $transpose;
- $note -= $bot->{noteoffset};
- my $s = $notes{$note};
- return $s;
-}
-
-sub busybot_playnoteandadvance($$$)
-{
- my ($bot, $t, $note) = @_;
- my $s = getnote $bot => $note;
- return (warn("note $note not found"), 0)
- unless defined $s;
- my $buttons = 0;
- $buttons |= 1 if $s =~ /f/;
- $buttons |= 2 if $s =~ /b/;
- $buttons |= 4 if $s =~ /l/;
- $buttons |= 8 if $s =~ /r/;
- $buttons |= 16 if $s =~ /c/;
- $buttons |= 32 if $s =~ /1/;
- $buttons |= 64 if $s =~ /2/;
- $buttons |= 128 if $s =~ /j/;
- busybot_setbuttonsandadvance $bot => $t, $buttons;
- return 1;
-}
-
-sub busybot_stopnoteandadvance($$$)
-{
- my ($bot, $t, $note) = @_;
- my $s = getnote $bot => $note;
- return 0
- unless defined $s;
- my $buttons = $bot->{curbuttons};
- #$buttons &= ~(32 | 64);
- $buttons = 0;
- busybot_setbuttonsandadvance $bot => $t, $buttons;
- return 1;
-}
-
-sub note_on($$$)
-{
- my ($t, $channel, $note) = @_;
- ++$notes;
- if($channel == MIDI_DRUMS_CHANNEL)
- {
- $channel = MIDI_FIRST_NONCHANNEL + $note; # percussion
- return if !@coords_percussion;
- }
- my $bot = busybot_findfree($t, $channel, $note);
- if($channel < MIDI_FIRST_NONCHANNEL)
- {
- if(busybot_playnoteandadvance $bot => $t, $note)
- {
- $bot->{busy} = 1;
- $bot->{note} = $note;
- $bot->{busytime} = $t + 0.25;
- if($staccato)
- {
- busybot_stopnoteandadvance $bot => $t + 0.15, $note;
- $bot->{busy} = 0;
- }
- }
- }
- if($channel >= MIDI_FIRST_NONCHANNEL)
- {
- busybot_advance $bot => $t;
- print "p $bot->{id} attack1\n";
- print "r $bot->{id} attack1\n";
- $bot->{busy} = 1;
- $bot->{note} = $note;
- $bot->{busytime} = $t + 1.5;
- }
-}
-
-sub note_off($$$)
-{
- my ($t, $channel, $note) = @_;
- --$notes;
- if($channel == MIDI_DRUMS_CHANNEL)
- {
- $channel = MIDI_FIRST_NONCHANNEL + $note; # percussion
- }
- my $bot = busybot_find($channel, $note)
- or return;
- $bot->{busy} = 0;
- if($channel < MIDI_FIRST_NONCHANNEL)
- {
- busybot_stopnoteandadvance $bot => $t, $note;
- $bot->{busytime} = $t + 0.25;
- }
-}
-
-print 'alias p "sv_cmd bot_cmd $1 presskey $2"' . "\n";
-print 'alias r "sv_cmd bot_cmd $1 releasekey $2"' . "\n";
-print 'alias w "sv_cmd bot_cmd $1 wait_until $2"' . "\n";
-print 'alias m "sv_cmd bot_cmd $1 moveto \"$2 $3 $4\""' . "\n";
-
-my %midinotes = ();
-for(@allmidievents)
-{
- my $t = tick2sec $_->[1];
- my $track = $_->[3];
- if($_->[0] eq 'note_on')
- {
- my $chan = $_->[4] + 1;
- if($midinotes{$chan}{$_->[5]})
- {
- note_off($t, $chan, $_->[5]);
- }
- note_on($t, $chan, $_->[5]);
- $midinotes{$chan}{$_->[5]} = 1;
- }
- elsif($_->[0] eq 'note_off')
- {
- my $chan = $_->[4] + 1;
- if($midinotes{$chan}{$_->[5]})
- {
- note_off($t, $chan, $_->[5]);
- }
- $midinotes{$chan}{$_->[5]} = 0;
- }
-}
-
-print STDERR "Range of notes: $note_min .. $note_max\n";
-print STDERR "Safe transpose range: @{[$note_max - 19]} .. @{[$note_min + 13]}\n";
-print STDERR "Unsafe transpose range: @{[$note_max - 24]} .. @{[$note_min + 18]}\n";
-printf STDERR "%d bots allocated for tuba, %d for percussion\n", int scalar grep { defined $_ } @busybots_tuba, int scalar grep { defined $_ } @busybots_percussion;
-
-my $n = 0;
-for(@busybots_percussion, @busybots_tuba)
-{
- ++$n if $_ && $_->{busy};
-}
-if($n)
-{
- die "$n channels blocked ($notes MIDI notes)";
-}
#!/bin/sh
-../midi2cfg-ng.pl ../midi2cfg-ng.conf stairs-min.mid 60 > ~/.xonotic/data/stairs.cfg
+../midi2cfg-ng.pl ../midi2cfg-ng.conf stairs-min.mid 6 > ~/.xonotic/data/x.cfg
--- /dev/null
+maxplayers 64
+cl_autodemo 1
+sv_autodemo_perclient 1
+bot_number 0
+minplayers 0
+m_filter 1
+sensitivity 2
+cl_maxphysicsframesperserverframe 1
+alias cl_hook_gamestart_all "echo S; defer 5 \"sv_cmd bot_cmd load x.cfg\"; alias cl_hook_gamestart_all \"\""
+
+exec tuba-settings.cfg
+
+map opera
--- /dev/null
+menu_vid_width 1280
+menu_vid_height 720
+vid_width 1280
+vid_height 720
+
+cl_capturevideo_framestep 4
+cl_capturevideo_fps 25
+r_motionblur 2
+
+bind x "toggle cl_capturevideo"
+exec effects-ultra.cfg
+
+exec tuba-settings.cfg
--- /dev/null
+// sound
+bgmvolume 0 // bgm OFF
+snd_staticvolume 0 // ambient OFF
+snd_channel0volume 0 // info OFF
+snd_channel1volume 0.5 // guns -3dB
+snd_channel2volume 0 // voice OFF
+snd_channel3volume 2 // jetpack +3dB
+snd_channel4volume 0.5 // shots -3dB
+snd_channel5volume 1 // tuba 0dB
+snd_channel6volume 0 // pain OFF
+snd_channel7volume 2 // jumps +3dB
+snd_channel8volume 0 // bgm OFF
+snd_channel9volume 0 // ambient OFF
+
+// graphics
+r_shadow_lightattenuationlinearscale 0.15
+r_shadow_lightattenuationdividebias 0.03125
+r_shadow_lightintensityscale 4
+r_coronas 0.0625
+r_shadows_throwdistance 10000
+r_shadows_shadowmapscale 0.25
+r_usedepthtextures 1 // workaround for broken shadowmaps
--- /dev/null
+xonotic-linux-glx.sh
\ No newline at end of file
cd "${path}"
case "${0##*/}" in
+ *dedicated*) mode="dedicated" ;;
*sdl*) mode="sdl" ;;
*) mode="glx" ;;
esac