games-strategy/scorched3d: Port to wxGTK 3.2

And more fixes

Closes: https://bugs.gentoo.org/657280
Closes: https://bugs.gentoo.org/665900
Closes: https://bugs.gentoo.org/699168
Closes: https://bugs.gentoo.org/831909
Closes: https://bugs.gentoo.org/884919
Signed-off-by: Pacho Ramos <pacho@gentoo.org>
This commit is contained in:
Pacho Ramos
2023-11-24 14:26:29 +01:00
parent b90fe51277
commit 9d891dae91
6 changed files with 320 additions and 0 deletions

View File

@@ -1 +1,2 @@
DIST Scorched3D-44-src.tar.gz 41689613 BLAKE2B 61f5536ad6e9dedeb0e778f90d73aa918f890632385278d4d788a43f1e199e817d6199f923c264dadbe8084fa53c32968b599c9b08784de0d5752069f9bed818 SHA512 27341d12ef9db5b64c1051a8abe45cef8a957e26c2cd8928f64c071589052d2857fc6f8104772bb67d5d348aef14122a117d9e00d61e4d9f963f3b5bbe5859ca
DIST scorched3d.png 4559 BLAKE2B dba1c4021844b71cea7e71132f6a1ff6ecfbd5bcf8978210b56100d005accdcb85eaa619406863dc0582413cd1d4c0c07d7d1924cbcef49d80af7eaaf77c41ff SHA512 3034e7ff643443bbc283c0c566d0ef062c10b9f7d326f005ebbe87e68b795cafff20ce65dd4656057aac7982eee4cff44196e0e38a3b6bbd556c98439e3950d4

View File

@@ -0,0 +1,53 @@
diff -up scorched/src/common/coms/ComsLoadLevelMessage.cpp~ scorched/src/common/coms/ComsLoadLevelMessage.cpp
--- scorched/src/common/coms/ComsLoadLevelMessage.cpp~ 2014-08-01 18:47:31.000000000 +0200
+++ scorched/src/common/coms/ComsLoadLevelMessage.cpp 2020-08-13 21:33:59.895250469 +0200
@@ -108,6 +108,49 @@ bool ComsLoadLevelMessage::loadState(Sco
bool ComsLoadLevelMessage::loadTanks(ScorchedContext &context)
{
+ /*
+ * There is a timing bug which shows on really fast machines
+ * where the client starts talking to the server before the
+ * server initial setup is done.
+ * In sofar as I have managed to debug this, the following
+ * happens on slower machines, aka the GOOD case:
+ *
+ * Server TankAddSimAction::invokeAction() new Tank "(Bot) Fred"
+ * Server TankAddSimAction::invokeAction() new Tank "(Bot) Ted"
+ * Server TankAddSimAction::invokeAction() new Tank "Player 1"
+ * Server TankAddSimAction::invokeAction() new Tank "Spectator"
+ * Client TankAddSimAction::invokeAction() new Tank "(Bot) Fred"
+ * Client TankAddSimAction::invokeAction() new Tank "(Bot) Ted"
+ * Client TankAddSimAction::invokeAction() new Tank "Player 1"
+ * Client TankAddSimAction::invokeAction() new Tank "Spectator"
+ *
+ * Note the server internally creates all tanks before the
+ * client does and thus before the client starts sending
+ * messages related to these tanks to the server.
+ *
+ * On a fast enough system (i7-10610U) the following order
+ * has been observed instead:
+ *
+ * Server TankAddSimAction::invokeAction() new Tank "(Bot) Fred"
+ * Server TankAddSimAction::invokeAction() new Tank "(Bot) Ted"
+ * Client TankAddSimAction::invokeAction() new Tank "(Bot) Fred"
+ * Client TankAddSimAction::invokeAction() new Tank "(Bot) Ted"
+ * Client TankAddSimAction::invokeAction() new Tank "Player 1"
+ * Client TankAddSimAction::invokeAction() new Tank "Spectator"
+ * Server TankAddSimAction::invokeAction() new Tank "Player 1"
+ * Server TankAddSimAction::invokeAction() new Tank "Spectator"
+ *
+ * Note the server creates the "Player 1" and "Spectator"
+ * tanks after the client, this causes the server to ignore
+ * some initial messages from the client related to these
+ * tanks, after which things get stuck, breaking non-networked
+ * games on fast machines.
+ *
+ * The sleep below is an ugly but effective workaround for this
+ * issue.
+ */
+ SDL_Delay(100);
+
NetBufferReader reader(tanksBuffer_);
// Add any new tanks

View File

@@ -0,0 +1,12 @@
diff -up scorched/src/common/common/DefinesScorched.cpp.orig scorched/src/common/common/DefinesScorched.cpp
--- scorched/src/common/common/DefinesScorched.cpp.orig 2009-02-15 15:11:18.000000000 +0100
+++ scorched/src/common/common/DefinesScorched.cpp 2009-02-16 14:28:53.000000000 +0100
@@ -58,7 +58,7 @@ void S3D::showURL(const std::string &url
std::string buffer = S3D::formatStringBuffer("open %s", url.c_str());
system(buffer.c_str());
#else
- std::string buffer = S3D::formatStringBuffer("firefox %s", url.c_str());
+ std::string buffer = S3D::formatStringBuffer("xdg-open %s", url.c_str());
system(buffer.c_str());
#endif // __DARWIN__
#endif // _WIN32

View File

@@ -0,0 +1,137 @@
Description: make use of pkg-config instead of openal-config
From: Reinhard Tartler <siretart@tauware.de>
Date: Sun, 28 Jun 2009 20:04:31 +0200
Subject: openal-pkgconfig
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=533973
---
configure-al.m4 | 118 ++------------------------------------------------------
1 file changed, 4 insertions(+), 114 deletions(-)
diff --git a/configure-al.m4 b/configure-al.m4
index e37c20b..5250f0d 100644
--- a/configure-al.m4
+++ b/configure-al.m4
@@ -1,118 +1,8 @@
dnl Checking for OpenAL
-AC_ARG_WITH([openal-static],
- AC_HELP_STRING([--with-openal-static],
- [enable static linking for openal (default no)]),
- [use_static_openal=${withval}],,)
-AC_ARG_ENABLE(openaltest,
- [ --disable-openaltest Do not try to compile and run a test OpenAL program],
- , enable_openaltest=yes)
-AC_MSG_CHECKING(for OpenAL support)
-AC_PATH_PROG(OPENAL_CONFIG, openal-config, no)
-if test x$OPENAL_CONFIG = xno; then
- echo "The openal-config script installed by OpenAL could not be found"
- echo "Make sure openal-config is in your path, or set the OPENAL_CONFIG"
- echo "environment variable to the full path to openal-config."
- echo "Trying pkg-config instead."
-
- AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
- if test x$PKG_CONFIG = xno; then
- echo "The pkg-config script could not be found"
- echo "Make sure pkg-config is in your path, or set the PKG_CONFIG"
- echo "environment variable to the full path to pkg-config."
-
- AC_MSG_ERROR([*** Can't find the openal library. Try: http://www.openal.org/])
- else
- OPENAL_CONFIG="$PKG_CONFIG openal";
- fi
-fi
-
-if test x"$use_static_openal" = x"yes"; then
- AL_LIBS="/usr/local/lib/libopenal.a"
-else
- AL_LIBS="`$OPENAL_CONFIG --libs`"
-fi
-
-AL_CFLAGS="`$OPENAL_CONFIG --cflags`"
-
-AC_MSG_RESULT(yes)
-
-AC_MSG_CHECKING(for Freealut support)
-AC_PATH_PROG(FREEALUT_CONFIG, freealut-config, no)
-if test x$FREEALUT_CONFIG = xno; then
- echo "*** Warning: The freealut-config script installed by OpenAL could not be found."
- echo "*** The alut library is required, however some older OpenAL distribitions may include it."
- echo "*** If Scorched3D fails to link check alut is in the link line."
- echo "*** Alternatively, make sure freealut-config is in your path, or set the FREEALUT_CONFIG"
- echo "*** environment variable to the full path to openal-config."
-else
-
- AL_LIBS="$AL_LIBS `$FREEALUT_CONFIG --libs`"
- AL_CFLAGS="$AL_CFLAGS `$FREEALUT_CONFIG --cflags`"
-
- AC_MSG_RESULT(yes)
-fi
-
-AC_MSG_CHECKING(for OpenAL compilation)
-if test "x$enable_openaltest" = "xyes" ; then
-
- ac_save_CFLAGS="$CFLAGS"
- ac_save_LIBS="$LIBS"
- CFLAGS="$CFLAGS $AL_CFLAGS"
- LIBS="$AL_LIBS $LIBS"
-
- AC_TRY_COMPILE([
-#ifdef __APPLE__
- #include <OpenAL/al.h>
- #include <OpenAL/alc.h>
-#else
- #include <AL/al.h>
- #include <AL/alut.h>
- #include <AL/alc.h>
-#endif
-
- ],[
- ],[
- have_openal=yes
- ],[
- echo "*** Failed to compile using the OpenAL library."
- echo "*** CFLAGS = $AL_CFLAGS";
- AC_MSG_ERROR([*** Check the OpenAL library is correctly installed.])
- ])
-
- AC_TRY_LINK([
-#ifdef __APPLE__
- #include <OpenAL/al.h>
- #include <OpenAL/alc.h>
-#else
- #include <AL/al.h>
- #include <AL/alut.h>
- #include <AL/alc.h>
-#endif
-
- int main(int argc, char *argv[])
- {
- alutInit(argc, argv);
- return 0;
- }
-#undef main
-#define main K_and_R_C_main
-
- ],[
- ],[
- have_openal=yes
- ],[
- echo "*** Compiled but failed to link using the OpenAL library."
- echo "*** LIBS = $AL_LIBS";
- echo "*** Check the OpenAL library is on the LD_LIBRARY_PATH";
- AC_MSG_ERROR([*** Check the OpenAL library is correctly installed.])
- ])
-
- CFLAGS="$ac_save_CFLAGS"
- LIBS="$ac_save_LIBS"
-
- AC_MSG_RESULT(yes)
-fi
-
+PKG_CHECK_MODULES([OPENAL], [openal])
+PKG_CHECK_MODULES([FREEALUT], [freealut])
+AL_CFLAGS="$OPENAL_CFLAGS $FREEALUT_CFLAGS"
+AL_LIBS="$OPENAL_LIBS $FREEALUT_LIBS"
AC_SUBST(AL_CFLAGS)
AC_SUBST(AL_LIBS)

View File

@@ -0,0 +1,19 @@
--- a/src/launcher/scorched/main.cpp
+++ b/src/launcher/scorched/main.cpp
@@ -26,6 +26,7 @@
#include <graph/OptionsDisplay.h>
#include <wx/wx.h>
#include <wx/utils.h>
+#include <wx/sizer.h>
#include <locale.h>
#include <math.h>
#include <signal.h>
@@ -86,6 +87,8 @@ int main(int argc, char *argv[])
ScorchedParams::instance()->getSDLInitVideo() = true;
}
+ wxSizerFlags::DisableConsistencyChecks();
+
#ifdef _WIN32
wxEntry((WXHINSTANCE) (HINSTANCE) GetModuleHandle(NULL),
(WXHINSTANCE) NULL, "", SW_SHOWNORMAL);

View File

@@ -0,0 +1,98 @@
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
WX_GTK_VER="3.2-gtk3"
inherit autotools desktop edos2unix wxwidgets
DESCRIPTION="Multi-player tank battle in 3D (OpenGL)"
HOMEPAGE="http://www.scorched3d.co.uk/"
SRC_URI="mirror://sourceforge/scorched3d/Scorched3D-${PV}-src.tar.gz
https://salsa.debian.org/games-team/scorched3d/-/raw/master/debian/scorched3d.png"
S="${WORKDIR}/scorched"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~ppc64 ~x86"
IUSE="dedicated mysql"
RDEPEND="
dev-libs/expat
media-fonts/dejavu
media-libs/libpng:0=
media-libs/libsdl[video]
media-libs/sdl-net
sys-libs/zlib
x11-misc/xdg-utils
virtual/jpeg:0
!dedicated? (
virtual/opengl
virtual/glu
media-libs/glew:0=
media-libs/libogg
media-libs/libvorbis
media-libs/openal
media-libs/freealut
x11-libs/wxGTK:${WX_GTK_VER}[X]
media-libs/freetype:2
sci-libs/fftw:3.0=
)
mysql? ( dev-db/mysql-connector-c )
"
DEPEND="${RDEPEND}"
BDEPEND="!dedicated? ( virtual/pkgconfig )"
PATCHES=(
"${FILESDIR}"/${P}-fixups.patch
"${FILESDIR}"/${P}-gcc43.patch
"${FILESDIR}"/${P}-odbc.patch
"${FILESDIR}"/${P}-win32.patch
"${FILESDIR}"/${P}-freetype.patch
"${FILESDIR}"/${P}-jpeg9.patch
"${FILESDIR}"/${P}-wxgtk.patch
"${FILESDIR}"/${P}-fix-c++14.patch
"${FILESDIR}"/${P}-help.patch
"${FILESDIR}"/${P}-hang-fast-machines.patch
"${FILESDIR}"/${P}-wxgtk32.patch
"${FILESDIR}"/${P}-openal-pkgconfig.patch
)
src_prepare() {
edos2unix \
src/launcher/wxdialogs/SettingsDialog.cpp \
src/launcher/wxdialogs/DisplayDialog.cpp \
src/launcher/wxdialogs/Display.cpp \
src/launcher/wxdialogs/KeyDialog.cpp
default
eautoreconf
}
src_configure() {
setup-wxwidgets
econf \
--datadir="${EPREFIX}"/usr/share/${PN} \
--with-fftw="${EPREFIX}"/usr \
--with-ogg="${EPREFIX}"/usr \
--with-vorbis="${EPREFIX}"/usr \
--with-docdir="${EPREFIX}"/usr/share/doc/${PF} \
--with-wx-config="${WX_CONFIG}" \
--without-pgsql \
$(use_with mysql) \
$(use_enable dedicated serveronly)
}
src_install() {
default
# remove bundled fonts
rm "${ED}"/usr/share/${PN}/data/fonts/* || die
dosym ../../../fonts/dejavu/DejaVuSans.ttf /usr/share/${PN}/data/fonts/dejavusans.ttf
dosym ../../../fonts/dejavu/DejaVuSansCondensed-Bold.ttf /usr/share/${PN}/data/fonts/dejavusconbd.ttf
dosym ../../../fonts/dejavu/DejaVuSansMono-Bold.ttf /usr/share/${PN}/data/fonts/dejavusmobd.ttf
if ! use dedicated; then
doicon "${DISTDIR}"/${PN}.png
make_desktop_entry ${PN} "Scorched 3D"
fi
}