diff options
-rw-r--r-- | Makefile | 6 | ||||
-rwxr-xr-x | configure | 17 | ||||
-rw-r--r-- | debian/q2pro-client.install | 2 | ||||
-rw-r--r-- | debian/q2pro-client.menu | 2 | ||||
-rw-r--r-- | source/q2pro.desktop | 8 | ||||
-rw-r--r-- | source/q2pro.xpm | 40 | ||||
-rw-r--r-- | source/sv_main.c | 86 |
7 files changed, 114 insertions, 47 deletions
@@ -42,6 +42,10 @@ install: install -m 644 -D $(SRCDIR)/q2pro.6 $(DESTDIR)$(MANDIR)/q2pro.6 install -m 644 -D $(SRCDIR)/wiki/doc/q2pro.menu \ $(DESTDIR)$(DATADIR)/baseq2/q2pro.menu + install -m 644 -D $(SRCDIR)/source/q2pro.desktop \ + $(DESTDIR)$(APPDIR)/q2pro.desktop + install -m 644 -D $(SRCDIR)/source/q2pro.xpm \ + $(DESTDIR)$(PIXDIR)/q2pro.xpm uninstall: for t in $(EXECUTABLES) ; do \ @@ -52,6 +56,8 @@ uninstall: done rm -f $(DESTDIR)$(MANDIR)/q2pro.6 rm -f $(DESTDIR)$(DATADIR)/baseq2/q2pro.menu + rm -f $(DESTDIR)$(APPDIR)/q2pro.desktop + rm -f $(DESTDIR)$(PIXDIR)/q2pro.xpm endif # !SINGLEUSER @@ -74,6 +74,8 @@ datadir="share/games/quake2" libdir="lib/games/quake2" bindir="games" mandir="share/man/man6" +appdir="share/applications" +pixdir="share/pixmaps" homedir="~/.q2pro" sitecfg="/etc/default/q2pro" @@ -180,6 +182,10 @@ for opt do ;; --mandir=*) mandir=`echo $opt | cut -d '=' -f 2` ;; + --appdir=*) appdir=`echo $opt | cut -d '=' -f 2` + ;; + --pixdir=*) pixdir=`echo $opt | cut -d '=' -f 2` + ;; --homedir=*) homedir=`echo $opt | cut -d '=' -f 2` ;; *) echo "Unknown option: $opt (try --help)" && exit 1 @@ -218,6 +224,8 @@ echo " --datadir=DIR path to game data tree [$datadir]" echo " --libdir=DIR path to game libs tree [$libdir]" echo " --bindir=DIR executables directory [$bindir]" echo " --mandir=DIR manpages directory [$mandir]" +echo " --appdir=DIR directory for .desktop files [$appdir]" +echo " --pixdir=DIR directory for pixmaps [$pixdir]" echo " --homedir=DIR home directory [$homedir]" echo "" echo "Object files are built in the directory from which configure is run." @@ -307,6 +315,8 @@ else libdir="." bindir="" mandir="" + appdir="" + pixdir="" homedir="" else if [ ! -z "$prefix" ]; then @@ -314,6 +324,8 @@ else libdir="$prefix/$libdir" bindir="$prefix/$bindir" mandir="$prefix/$mandir" + appdir="$prefix/$appdir" + pixdir="$prefix/$pixdir" fi fi @@ -331,6 +343,7 @@ if [ "$use_ref" = "soft" ]; then use_tga="no" use_png="no" use_jpg="no" + use_md3="no" fi gamelib="game$cpu$libsuffix" @@ -359,6 +372,8 @@ if [ "$mingw" = "no" ]; then echo "Game libraries $libdir" echo "Binaries $bindir" echo "Man pages $mandir" + echo "Desktop files $appdir" + echo "Pixmap files $pixdir" echo "Home directory $homedir" fi fi @@ -454,6 +469,8 @@ if [ "$mingw" = "no" ]; then else echo "BINDIR=$bindir" >> $config_mk echo "MANDIR=$mandir" >> $config_mk + echo "APPDIR=$appdir" >> $config_mk + echo "PIXDIR=$pixdir" >> $config_mk fi else echo "#define PRIz \"u\"" >> $config_h # FIXME: change this for x86_64 diff --git a/debian/q2pro-client.install b/debian/q2pro-client.install index 634d385..7fcca65 100644 --- a/debian/q2pro-client.install +++ b/debian/q2pro-client.install @@ -1,2 +1,4 @@ +usr/share/applications/q2pro.desktop +usr/share/pixmaps/q2pro.xpm usr/share/games/quake2/baseq2/q2pro.menu usr/games/q2pro diff --git a/debian/q2pro-client.menu b/debian/q2pro-client.menu index cdcaf8a..01b78f2 100644 --- a/debian/q2pro-client.menu +++ b/debian/q2pro-client.menu @@ -1 +1 @@ -?package(q2pro-client):needs="x11" section="Games/Arcade" title="Q2PRO" command="q2pro" +?package(q2pro-client):needs="x11" section="Games/Action" title="Q2PRO" command="q2pro" diff --git a/source/q2pro.desktop b/source/q2pro.desktop new file mode 100644 index 0000000..ede8fb1 --- /dev/null +++ b/source/q2pro.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Name=Q2PRO +GenericName=Quake 2 client +Exec=q2pro +Icon=q2pro +Terminal=false +Type=Application +Categories=Game;ActionGame; diff --git a/source/q2pro.xpm b/source/q2pro.xpm new file mode 100644 index 0000000..594a738 --- /dev/null +++ b/source/q2pro.xpm @@ -0,0 +1,40 @@ +/* XPM */ +static char *q2pro[] = { +/* columns rows colors chars-per-pixel */ +"32 32 2 1", +" c DarkGreen", +". c None", +/* pixels */ +"................................", +"......... .......... .........", +"........ ............ ........", +"....... .............. .......", +"...... ................ ......", +"..... .................. .....", +"..... .................. .....", +".... .................... ....", +".... .................... ....", +".... .................... ....", +".... .................... ....", +".... .................... ....", +".... .................... ....", +".... .................... ....", +".... .................. ....", +".... ..... ..... ....", +"..... ..... ..... .....", +"..... .... .. .... .....", +"...... ... .. ... ......", +"....... .. .......", +"........ ........", +"......... .........", +"........... ...........", +"............. .............", +"............. .. .............", +"............. .. .............", +"............. .. .............", +"............. .. .............", +"............. .. .............", +"............. .. .............", +"............. .. .............", +"............. .. ............." +}; diff --git a/source/sv_main.c b/source/sv_main.c index 9b674f1..021ba2c 100644 --- a/source/sv_main.c +++ b/source/sv_main.c @@ -1090,6 +1090,37 @@ int SV_CountClients( void ) { return count; } +static int ping_nop( client_t *cl ) { + return 0; +} + +static int ping_min( client_t *cl ) { + int j; + int count = 9999; + + for( j = 0; j < LATENCY_COUNTS; j++ ) { + if( cl->frame_latency[j] > 0 ) { + if( count > cl->frame_latency[j] ) { + count = cl->frame_latency[j]; + } + } + } + return count == 9999 ? 0 : count; +} + +static int ping_avg( client_t *cl ) { + int j; + int total = 0, count = 0; + + for( j = 0; j < LATENCY_COUNTS; j++ ) { + if( cl->frame_latency[j] > 0 ) { + count++; + total += cl->frame_latency[j]; + } + } + return count ? total / count : 0; +} + /* =================== SV_CalcPings @@ -1098,57 +1129,20 @@ Updates the cl->ping variables =================== */ static void SV_CalcPings( void ) { - int j; client_t *cl; - int total, count; + int (*calc)( client_t * ); switch( sv_calcpings_method->integer ) { - case 0: - FOR_EACH_CLIENT( cl ) { - if( cl->state != cs_spawned ) - continue; - cl->ping = 0; - cl->edict->client->ping = 0; - } - break; - case 2: - FOR_EACH_CLIENT( cl ) { - if( cl->state != cs_spawned ) - continue; - - count = 9999; - for( j = 0; j < LATENCY_COUNTS; j++ ) { - if( cl->frame_latency[j] > 0 ) { - if( count > cl->frame_latency[j] ) { - count = cl->frame_latency[j]; - } - } - } - cl->ping = count == 9999 ? 0 : count; - - // let the game dll know about the ping - cl->edict->client->ping = cl->ping; - } - break; - default: - FOR_EACH_CLIENT( cl ) { - if( cl->state != cs_spawned ) - continue; + case 0: calc = ping_nop; break; + case 2: calc = ping_min; break; + default: calc = ping_avg; break; + } - total = 0; - count = 0; - for( j = 0; j < LATENCY_COUNTS; j++ ) { - if( cl->frame_latency[j] > 0 ) { - count++; - total += cl->frame_latency[j]; - } - } - cl->ping = count ? total / count : 0; + FOR_EACH_CLIENT( cl ) { + cl->ping = cl->state == cs_spawned ? calc( cl ) : 0; - // let the game dll know about the ping - cl->edict->client->ping = cl->ping; - } - break; + // let the game dll know about the ping + cl->edict->client->ping = cl->ping; } } |