Skip to content

Commit

Permalink
Synced with latest from upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
darkshade9 committed Oct 14, 2024
2 parents fae2693 + d54bdc6 commit d05bd86
Show file tree
Hide file tree
Showing 55 changed files with 2,529 additions and 1,181 deletions.
76 changes: 76 additions & 0 deletions .ci/configure-ffmpeg.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#!/bin/sh -e

OPTS_COMMON="--disable-everything \
--enable-decoder=theora \
--enable-decoder=vorbis \
--enable-decoder=idcin \
--enable-decoder=pcm_* \
--disable-decoder=pcm_bluray \
--disable-decoder=pcm_dvd \
--disable-decoder=pcm_alaw_at \
--disable-decoder=pcm_mulaw_at \
--enable-demuxer=ogg \
--enable-demuxer=idcin \
--enable-demuxer=wav \
--enable-parser=vp3 \
--enable-parser=vorbis \
--disable-protocols \
--enable-protocol=file \
--disable-avdevice \
--disable-avfilter \
--disable-postproc \
--disable-programs \
--disable-autodetect \
--disable-network \
--disable-doc \
--disable-swscale-alpha \
--enable-small \
--disable-pthreads \
--disable-w32threads"

config_linux() {
../configure --prefix="$1" $OPTS_COMMON
}

config_win32() {
../configure \
--prefix="$1" \
--cross-prefix=i686-w64-mingw32- \
--arch=x86 \
--target-os=mingw32 \
--extra-cflags='-msse2 -mfpmath=sse' \
$OPTS_COMMON
}

config_win64() {
../configure \
--prefix="$1" \
--cross-prefix=x86_64-w64-mingw32- \
--arch=x86 \
--target-os=mingw64 \
$OPTS_COMMON
}

usage() {
echo "Usage: $0 <build type> <prefix>"
exit 1
}

if [ -z "$2" ] ; then
usage
fi

case "$1" in
--win32)
config_win32 "$2"
;;
--win64)
config_win64 "$2"
;;
--linux)
config_linux "$2"
;;
*)
usage
;;
esac
1 change: 1 addition & 0 deletions .ci/i686-w64-mingw32.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ ar = 'i686-w64-mingw32-ar'
strip = 'i686-w64-mingw32-strip'
windres = 'i686-w64-mingw32-windres'
nasm = 'nasm'
pkg-config = 'pkg-config'

[host_machine]
system = 'windows'
Expand Down
145 changes: 145 additions & 0 deletions .ci/nightly.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
#!/bin/sh -ex

MESON_OPTS_COMMON="--auto-features=enabled --fatal-meson-warnings \
-Dwerror=true -Dwrap_mode=forcefallback"

MESON_OPTS="$MESON_OPTS_COMMON \
-Dgame-build-options=optimization=s,b_lto=true \
-Dsdl2=disabled -Dwayland=disabled -Dx11=disabled"

SRC_DIR=`pwd`
CI=$SRC_DIR/.ci

TMP_DIR=$SRC_DIR/q2pro-build
mkdir $TMP_DIR

export MESON_PACKAGE_CACHE_DIR=$SRC_DIR/subprojects/packagecache

### Source ###

REV=$(git rev-list --count HEAD)
SHA=$(git rev-parse --short HEAD)
VER="r$REV~$SHA"
SRC="q2pro-r$REV"

cd $TMP_DIR
GIT_DIR=$SRC_DIR/.git git archive --format=tar --prefix=$SRC/ HEAD | tar x
echo "$VER" > $SRC/VERSION
rm -rf $SRC/.gitignore $SRC/.ci $SRC/.github
fakeroot tar czf q2pro-source.tar.gz $SRC

sed -e "s/##VER##/$VER/" -e "s/##DATE##/`date -R`/" $CI/readme-template.txt > README
sed -e "s/##VER##/$VER/" -e "s/##DATE##/`date -R`/" $CI/readme-template-rr.txt > README.rr

### FFmpeg ###

cd $TMP_DIR
git clone --depth=1 https://github.com/FFmpeg/FFmpeg.git ffmpeg
cd ffmpeg

mkdir build-mingw-32
cd build-mingw-32
$CI/configure-ffmpeg.sh --win32 $TMP_DIR/ffmpeg-prefix-32
make -j4 install
cd ..

mkdir build-mingw-64
cd build-mingw-64
$CI/configure-ffmpeg.sh --win64 $TMP_DIR/ffmpeg-prefix-64
make -j4 install
cd ..

### Win32 ###

export PKG_CONFIG_SYSROOT_DIR="$TMP_DIR/ffmpeg-prefix-32"
export PKG_CONFIG_LIBDIR="$PKG_CONFIG_SYSROOT_DIR/lib/pkgconfig"

cd $TMP_DIR
meson setup --cross-file $CI/i686-w64-mingw32.txt $MESON_OPTS build-mingw-32 $SRC
cd build-mingw-32
ninja
i686-w64-mingw32-strip q2pro.exe q2proded.exe gamex86.dll

unix2dos -k -n ../$SRC/LICENSE LICENSE.txt ../$SRC/doc/client.asciidoc MANUAL.txt ../README README.txt
mkdir baseq2
cp -a ../$SRC/src/client/ui/q2pro.menu baseq2/
mv gamex86.dll baseq2/

zip -9 ../q2pro-client_win32_x86.zip \
q2pro.exe \
LICENSE.txt \
MANUAL.txt \
README.txt \
baseq2/q2pro.menu \
baseq2/gamex86.dll

unix2dos -k -n ../$SRC/doc/server.asciidoc MANUAL.txt
zip -9 ../q2pro-server_win32_x86.zip \
q2proded.exe \
LICENSE.txt \
MANUAL.txt \
README.txt

### Win64 ###

export PKG_CONFIG_SYSROOT_DIR="$TMP_DIR/ffmpeg-prefix-64"
export PKG_CONFIG_LIBDIR="$PKG_CONFIG_SYSROOT_DIR/lib/pkgconfig"

cd $TMP_DIR
meson setup --cross-file $CI/x86_64-w64-mingw32.txt $MESON_OPTS build-mingw-64 $SRC
cd build-mingw-64
ninja
x86_64-w64-mingw32-strip q2pro.exe q2proded.exe gamex86_64.dll

unix2dos -k -n ../$SRC/LICENSE LICENSE.txt ../$SRC/doc/client.asciidoc MANUAL.txt ../README README.txt
mkdir baseq2
cp -a ../$SRC/src/client/ui/q2pro.menu baseq2/
mv gamex86_64.dll baseq2/
mv q2pro.exe q2pro64.exe
mv q2proded.exe q2proded64.exe

zip -9 ../q2pro-client_win64_x64.zip \
q2pro64.exe \
LICENSE.txt \
MANUAL.txt \
README.txt \
baseq2/q2pro.menu \
baseq2/gamex86_64.dll

unix2dos -k -n ../$SRC/doc/server.asciidoc MANUAL.txt
zip -9 ../q2pro-server_win64_x64.zip \
q2proded64.exe \
LICENSE.txt \
MANUAL.txt \
README.txt

### Win64-rerelease ###

cd $TMP_DIR
git clone https://github.com/skullernet/q2pro-rerelease-dll.git
cd q2pro-rerelease-dll
meson setup --cross-file $CI/x86_64-w64-mingw32.txt $MESON_OPTS_COMMON build-mingw
ninja -C build-mingw
x86_64-w64-mingw32-strip build-mingw/gamex86_64.dll
cd etc
zip -9 ../build-mingw/q2pro.pkz default.cfg q2pro.menu

cd $TMP_DIR/build-mingw-64

mv q2pro64.exe q2pro.exe
cp -a ../q2pro-rerelease-dll/build-mingw/q2pro.pkz baseq2/
cp -a ../q2pro-rerelease-dll/build-mingw/gamex86_64.dll baseq2/
unix2dos -k -n ../$SRC/doc/client.asciidoc MANUAL.txt ../README.rr README.txt

zip -9 ../q2pro-rerelease-client_win64_x64.zip \
q2pro.exe \
LICENSE.txt \
MANUAL.txt \
README.txt \
baseq2/q2pro.pkz \
baseq2/gamex86_64.dll

### Version ###

cd $TMP_DIR
echo $VER > version.txt
13 changes: 13 additions & 0 deletions .ci/readme-template-rr.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Welcome to Q2PRO, an enhanced Quake 2 client and server.

Version ##VER## has been automatically built ##DATE##
from git master branch.

Installation: extract this archive into new directory, then create shortcut to
q2pro.exe with the following command line:

q2pro.exe +set basedir "<path to re-release dir>" +set homedir "."

For information on using and configuring Q2PRO, refer to MANUAL file.

Project homepage: https://github.com/skullernet/q2pro
10 changes: 10 additions & 0 deletions .ci/readme-template.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Welcome to Q2PRO, an enhanced Quake 2 client and server.

Version ##VER## has been automatically built ##DATE##
from git master branch.

Installation: extract this archive into your Quake 2 directory.

For information on using and configuring Q2PRO, refer to MANUAL file.

Project homepage: https://github.com/skullernet/q2pro
1 change: 1 addition & 0 deletions .ci/x86_64-w64-mingw32.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ ar = 'x86_64-w64-mingw32-ar'
strip = 'x86_64-w64-mingw32-strip'
windres = 'x86_64-w64-mingw32-windres'
nasm = 'nasm'
pkg-config = 'pkg-config'

[host_machine]
system = 'windows'
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: nightly

on:
push:
branches: [master]

permissions:
contents: write

jobs:
mingw:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/cache@v4
with:
path: subprojects/packagecache
key: ${{ hashFiles('subprojects/*.wrap') }}

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y gcc-mingw-w64 dos2unix nasm meson ninja-build
- name: Build
run: ./.ci/nightly.sh

- name: Update release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release edit nightly -t "Nightly" -n "Latest nightly build `cat q2pro-build/version.txt`." --latest
gh release upload nightly q2pro-build/*.zip q2pro-build/*.tar.gz q2pro-build/version.txt --clobber
- name: Update tag
uses: actions/github-script@v7
with:
script: |
github.rest.git.updateRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "tags/nightly",
sha: context.sha,
force: true
})
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,5 @@ For building Q2PRO, consult the INSTALL.md file.
Q2PRO doesn't have releases. It is always recommended to use the git master
version.

Nightly Windows builds are available at https://skuller.net/q2pro/

For information on using and configuring Q2PRO, refer to client and server
manuals available in doc/ subdirectory.
16 changes: 10 additions & 6 deletions doc/client.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -707,11 +707,14 @@ gl_downsample_skins::
Default value is 1 (downsampling enabled).

gl_drawsky::
Enables skybox texturing and N64 skies. N64 skies only work if
‘gl_shaders’ is enabled. Default value is 1.
- 0 — draw solid black sky
- 1 — draw normal sky, or N64 sky if present
- 2 — draw normal sky, ignore N64 sky
Enables skybox texturing. 0 means to draw sky in solid black color.
Default value is 1 (enabled).

gl_cubemaps::
Enables use of cubemaps for skybox drawing. Cubemaps allow multiple skybox
textures per map, and help to avoid sky rendering bugs. Also enables N64
skies in re-release maps. Only effective if ‘gl_shaders’ is enabled.
Default value is 0 (disabled).

gl_waterwarp::
Enable screen warping effect when underwater. Only effective when using
Expand Down Expand Up @@ -1633,11 +1636,12 @@ remotemode <address> <password>::
Put client console into rcon mode. All commands entered will be forwarded
to remove server. Press Ctrl+D or close console to exit this mode.

ogg <info|play|stop>::
ogg <info|play|stop|next>::
Execute OGG subcommand. Available subcommands:
info::: Display information about currently playing background music track.
play <track>::: Start playing background music track ‘music/_track_.ogg’.
stop::: Stop playing background music track.
next::: Play next track if shuffling is enabled.

whereis <path> [all]::
Search for _path_ and print the name of packfile or directory where it is
Expand Down
3 changes: 3 additions & 0 deletions doc/server.md
Original file line number Diff line number Diff line change
Expand Up @@ -828,6 +828,9 @@ also create an alias for the map. How to create such files is out of
scope of this manual (search the internet for ‘r1q2 map override file
generator’).

This is togglable with `sv_load_ent` -- default enabled (`1`), a setting of
`0` will disable loading overrides of either type

### map\_visibility\_patch
Attempt to patch miscalculated visibility data for some well-known maps
(q2dm1, q2dm3 and q2dm8 are patched so far), fixing disappearing walls
Expand Down
11 changes: 9 additions & 2 deletions inc/common/hash_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/

#pragma once

#include "common/zone.h"

typedef struct hash_map_s hash_map_t;

hash_map_t *HashMap_CreateImpl(const uint32_t key_size, const uint32_t value_size,
uint32_t (*hasher)(const void *const),
bool (*comp)(const void *const, const void *const));
bool (*comp)(const void *const, const void *const),
memtag_t tag);
void HashMap_Destroy(hash_map_t *map);
void HashMap_Reserve(hash_map_t *map, uint32_t capacity);
bool HashMap_InsertImpl(hash_map_t *map, const uint32_t key_size, const uint32_t value_size, const void *const key, const void *const value);
Expand All @@ -32,7 +37,9 @@ uint32_t HashMap_Size(const hash_map_t *map);
void *HashMap_GetKeyImpl(const hash_map_t *map, uint32_t index);
void *HashMap_GetValueImpl(const hash_map_t *map, uint32_t index);

#define HashMap_Create(key_type, value_type, hasher, comp) HashMap_CreateImpl(sizeof(key_type), sizeof(value_type), hasher, comp)
#define HashMap_TagCreate(key_type, value_type, hasher, comp, tag) \
HashMap_CreateImpl(sizeof(key_type), sizeof(value_type), hasher, comp, tag)
#define HashMap_Create(key_type, value_type, hasher, comp) HashMap_TagCreate(key_type, value_type, hasher, comp, TAG_GENERAL)
#define HashMap_Insert(map, key, value) HashMap_InsertImpl(map, sizeof(*key), sizeof(*value), key, value)
#define HashMap_Erase(map, key) HashMap_EraseImpl(map, sizeof(*key), key)
#define HashMap_Lookup(type, map, key) ((type *)HashMap_LookupImpl(map, sizeof(*key), key))
Expand Down
Loading

0 comments on commit d05bd86

Please sign in to comment.