games/Scorched3D: Patched to use wxGTK3

Signed-off-by: Heinz Wiesinger <pprkut@slackbuilds.org>

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
Heinz Wiesinger 2021-09-26 16:21:58 +02:00 committed by Willy Sudiarto Raharjo
parent f323436c3e
commit ec987d5542
No known key found for this signature in database
GPG Key ID: 3F617144D7238786
7 changed files with 302 additions and 18 deletions

View File

@ -2,7 +2,7 @@
# Slackware build script for Scorched3D
# Copyright 2008-2013 Heinz Wiesinger, Amsterdam, The Netherlands
# Copyright 2008-2021 Heinz Wiesinger, Amsterdam, The Netherlands
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@ -11,22 +11,22 @@
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=Scorched3D
VERSION=${VERSION:-44}
BUILD=${BUILD:-1}
BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
@ -50,8 +50,8 @@ TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
if [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
@ -81,7 +81,20 @@ find -L . \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
patch -p1 < $CWD/gcc.patch
# Apply patches from Fedora
# Fix race condition on fast machines
patch -p1 -i $CWD/patches/scorched3d-fix-hang-on-fast-machines.patch
# Use xdg-open instead of firefox to open help
patch -p1 -i $CWD/patches/scorched3d-help.patch
# Fix compatibility with wxGTK3
patch -p1 -i $CWD/patches/scorched3d-wx3.0.patch
# Fix build issues
patch -p0 -i $CWD/patches/scorched3d-returntype.patch
patch -p1 -i $CWD/patches/scorched3d-freetype-buildfix.patch
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \

View File

@ -5,6 +5,6 @@ DOWNLOAD="http://downloads.sourceforge.net/scorched3d/Scorched3D-44-src.tar.gz"
MD5SUM="c395d54a7a43cf91166d2cc0f7dec83e"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES="freealut wxPython"
REQUIRES="freealut wxGTK3"
MAINTAINER="Heinz Wiesinger"
EMAIL="pprkut@slackbuilds.org"

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,36 @@
diff -up scorched/src/launcher/wxdialogs/TrueTypeFont.h~ scorched/src/launcher/wxdialogs/TrueTypeFont.h
--- scorched/src/launcher/wxdialogs/TrueTypeFont.h~ 2014-08-01 18:47:32.000000000 +0200
+++ scorched/src/launcher/wxdialogs/TrueTypeFont.h 2014-08-29 14:04:55.726042013 +0200
@@ -25,10 +25,10 @@
#include <wx/image.h>
#include <ft2build.h>
#include <string>
-#include <freetype/freetype.h>
-#include <freetype/ftglyph.h>
-#include <freetype/ftoutln.h>
-#include <freetype/fttrigon.h>
+#include FT_FREETYPE_H
+#include FT_GLYPH_H
+#include FT_OUTLINE_H
+#include FT_TRIGONOMETRY_H
class TrueTypeFont
{
diff -up scorched/src/client/GLEXT/GLFont2dFreeType.h~ scorched/src/client/GLEXT/GLFont2dFreeType.h
--- scorched/src/client/GLEXT/GLFont2dFreeType.h~ 2014-08-01 18:47:31.000000000 +0200
+++ scorched/src/client/GLEXT/GLFont2dFreeType.h 2014-08-29 14:08:10.327083878 +0200
@@ -23,10 +23,10 @@
#include <GLEXT/GLFont2dStorage.h>
#include <ft2build.h>
-#include <freetype/freetype.h>
-#include <freetype/ftglyph.h>
-#include <freetype/ftoutln.h>
-#include <freetype/fttrigon.h>
+#include FT_FREETYPE_H
+#include FT_GLYPH_H
+#include FT_OUTLINE_H
+#include FT_TRIGONOMETRY_H
#include <string>
class GLFont2dFreeType

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

@ -1,5 +1,5 @@
--- scorched/src/common/weapons/AccessoryStore.cpp.orig 2017-07-07 22:27:57.777261322 +0700
+++ scorched/src/common/weapons/AccessoryStore.cpp 2017-07-07 22:39:34.368313611 +0700
--- src/common/weapons/AccessoryStore.cpp.orig 2016-02-13 22:16:08.997822186 -0600
+++ src/common/weapons/AccessoryStore.cpp 2016-02-13 22:16:47.949819533 -0600
@@ -156,7 +156,7 @@
Accessory *parent, XMLNode *currentNode)
{

View File

@ -0,0 +1,170 @@
From: Markus Koschany <apo@debian.org>
Date: Fri, 15 Jul 2016 18:01:36 +0200
Subject: wx3.0 compat
Make Scorched3D compatible with wxWidgets 3.0
Thanks to Olly Betts for the patch.
---
src/launcher/wxdialogs/Display.cpp | 10 +++++-----
src/launcher/wxdialogs/DisplayDialog.cpp | 10 +++++-----
src/launcher/wxdialogs/SettingsDialog.cpp | 14 +++++++-------
3 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/src/launcher/wxdialogs/Display.cpp b/src/launcher/wxdialogs/Display.cpp
index e0a423a..22169e0 100644
--- a/src/launcher/wxdialogs/Display.cpp
+++ b/src/launcher/wxdialogs/Display.cpp
@@ -26,7 +26,7 @@ static void createMainControls(wxWindow *parent, wxSizer *sizer)
// Display settings
wxStaticBox *displayBox = new wxStaticBox(parent, -1, wxT("&Display"));
wxStaticBoxSizer *displaySizer = new wxStaticBoxSizer(displayBox, wxVERTICAL);
- wxFlexGridSizer *displaySizer2 = new wxFlexGridSizer(2, 3, 5, 5);
+ wxFlexGridSizer *displaySizer2 = new wxFlexGridSizer(0, 3, 5, 5);
wxStaticText *resText = new wxStaticText(parent, -1, wxT("&Resolution :"));
IDC_DISPLAY_CTRL =
new wxComboBox(parent, -1,
@@ -88,7 +88,7 @@ static void createMainControls(wxWindow *parent, wxSizer *sizer)
// Sound settings
wxStaticBox *soundBox = new wxStaticBox(parent, -1, wxT("&Sound"));
wxStaticBoxSizer *soundSizerMain = new wxStaticBoxSizer(soundBox, wxVERTICAL);
- wxFlexGridSizer *soundSizer1 = new wxFlexGridSizer(4, 2);
+ wxFlexGridSizer *soundSizer1 = new wxFlexGridSizer(0, 4, 2, 0);
wxStaticText *volumeText = new wxStaticText(parent, -1, wxT("Sound Volume :"));
wxStaticText *musicVolumeText = new wxStaticText(parent, -1, wxT("Music Volume :"));
wxStaticText *ambientVolumeText = new wxStaticText(parent, -1, wxT("Ambient Volume :"));
@@ -137,7 +137,7 @@ static void createMainControls(wxWindow *parent, wxSizer *sizer)
wxT("Game Detail Options"));
wxStaticBoxSizer *speedSizer = new wxStaticBoxSizer(speedBox, wxHORIZONTAL);
- wxGridSizer *loadSizer = new wxFlexGridSizer(2, 2);
+ wxGridSizer *loadSizer = new wxFlexGridSizer(0, 2, 2, 0);
IDC_LOADULTRA_CTRL = new wxButton(parent, ID_LOADULTRA, wxT("&Ultra Detail"), wxDefaultPosition, wxSize(120,-1));
IDC_LOADDEFAULTS_CTRL = new wxButton(parent, ID_LOADDEFAULTS, wxT("&Normal Detail"), wxDefaultPosition, wxSize(120,-1));
IDC_LOADMEDIUM_CTRL = new wxButton(parent, ID_LOADMEDIUM, wxT("Faster Detail"), wxDefaultPosition, wxSize(120,-1));
@@ -256,7 +256,7 @@ static void createSpeedControls(wxWindow *parent, wxSizer *sizer)
wxStaticBox *waterDetailBox = new wxStaticBox(parent, -1,
wxT("Graphics Detail"));
wxStaticBoxSizer *waterDetailSizer = new wxStaticBoxSizer(waterDetailBox, wxHORIZONTAL);
- wxGridSizer *waterDetailSizer2 = new wxGridSizer(3, 1, 10, 10);
+ wxGridSizer *waterDetailSizer2 = new wxGridSizer(0, 1, 10, 10);
IDC_NOWATERREF_CTRL =
new wxCheckBox(parent, -1, wxT("Don't draw water reflections - Large Framerate Improvement"));
@@ -471,7 +471,7 @@ static void createKeysControls(wxWindow *parent, wxSizer *topsizer)
{
wxScrolledWindow *scrolledWindow = new wxScrolledWindow(parent, -1,
wxDefaultPosition, wxSize(480, 250));
- wxSizer *sizer = new wxFlexGridSizer(5, 1);
+ wxSizer *sizer = new wxFlexGridSizer(0, 5, 1, 0);
keyboardKeyList.clear();
if (!Keyboard::instance()->loadKeyFile())
diff --git a/src/launcher/wxdialogs/DisplayDialog.cpp b/src/launcher/wxdialogs/DisplayDialog.cpp
index c34c9dc..0cdc620 100644
--- a/src/launcher/wxdialogs/DisplayDialog.cpp
+++ b/src/launcher/wxdialogs/DisplayDialog.cpp
@@ -449,15 +449,15 @@ void DisplayFrame::refreshScreen()
IDC_SLIDER1_CTRL->SetValue(OptionsDisplay::instance()->getBrightness());
IDC_SLIDER1_CTRL->SetToolTip(wxString(OptionsDisplay::instance()->getBrightnessEntry().getDescription(), wxConvUTF8));
IDC_VOLUME_CTRL->SetRange(0, 128);
- IDC_VOLUME_CTRL->SetTickFreq(4, 0);
+ IDC_VOLUME_CTRL->SetTickFreq(4);
IDC_VOLUME_CTRL->SetValue(OptionsDisplay::instance()->getSoundVolume());
IDC_VOLUME_CTRL->SetToolTip(wxString(OptionsDisplay::instance()->getSoundVolumeEntry().getDescription(), wxConvUTF8));
IDC_MUSICVOLUME_CTRL->SetRange(0, 128);
- IDC_MUSICVOLUME_CTRL->SetTickFreq(4, 0);
+ IDC_MUSICVOLUME_CTRL->SetTickFreq(4);
IDC_MUSICVOLUME_CTRL->SetValue(OptionsDisplay::instance()->getMusicVolume());
IDC_MUSICVOLUME_CTRL->SetToolTip(wxString(OptionsDisplay::instance()->getMusicVolumeEntry().getDescription(), wxConvUTF8));
IDC_AMBIENTVOLUME_CTRL->SetRange(0, 128);
- IDC_AMBIENTVOLUME_CTRL->SetTickFreq(4, 0);
+ IDC_AMBIENTVOLUME_CTRL->SetTickFreq(4);
IDC_AMBIENTVOLUME_CTRL->SetValue(OptionsDisplay::instance()->getAmbientSoundVolume());
IDC_AMBIENTVOLUME_CTRL->SetToolTip(wxString(OptionsDisplay::instance()->getAmbientSoundVolumeEntry().getDescription(), wxConvUTF8));
IDC_USERNAME_CTRL->SetValue(wxString(OptionsDisplay::instance()->getOnlineUserName(), wxConvUTF8));
@@ -736,7 +736,7 @@ void DisplayFrame::onExportMod(wxCommandEvent &event)
#if wxCHECK_VERSION(2, 8, 0)
wxFD_SAVE);
#else
- wxSAVE);
+ wxFD_SAVE);
#endif
if (file.empty()) return;
ModFiles files;
@@ -764,7 +764,7 @@ void DisplayFrame::onImportMod(wxCommandEvent &event)
#if wxCHECK_VERSION(2, 8, 0)
wxFD_OPEN | wxFD_FILE_MUST_EXIST);
#else
- wxOPEN | wxFILE_MUST_EXIST);
+ wxFD_OPEN | wxFD_FILE_MUST_EXIST);
#endif
if (file.empty()) return;
ModFiles files;
diff --git a/src/launcher/wxdialogs/SettingsDialog.cpp b/src/launcher/wxdialogs/SettingsDialog.cpp
index b312085..03ba629 100644
--- a/src/launcher/wxdialogs/SettingsDialog.cpp
+++ b/src/launcher/wxdialogs/SettingsDialog.cpp
@@ -105,7 +105,7 @@ void SettingsFrame::createMainPanel(bool server)
mainPanel_ = new wxPanel(book_, -1);
book_->AddPage(mainPanel_, wxT("Main"));
wxSizer *mainPanelSizer = new wxBoxSizer(wxVERTICAL);
- wxSizer *sizer = new wxFlexGridSizer(2, 2);
+ wxSizer *sizer = new wxFlexGridSizer(0, 2, 2, 0);
mainPanelSizer->Add(sizer, 0, wxALL | wxALIGN_CENTER, 10);
setters_.push_back(
@@ -166,7 +166,7 @@ void SettingsFrame::createMoneyPanel()
{
moneyPanel_ = new wxPanel(book_, -1);
wxSizer *ecoPanelSizer = new wxBoxSizer(wxVERTICAL);
- wxSizer *sizer = new wxFlexGridSizer(2, 2);
+ wxSizer *sizer = new wxFlexGridSizer(0, 2, 2, 0);
ecoPanelSizer->Add(sizer, 0, wxALL | wxALIGN_CENTER, 10);
setters_.push_back(
@@ -215,7 +215,7 @@ void SettingsFrame::createScorePanel()
{
scorePanel_ = new wxPanel(book_, -1);
wxSizer *ecoPanelSizer = new wxBoxSizer(wxVERTICAL);
- wxSizer *sizer = new wxFlexGridSizer(2, 2);
+ wxSizer *sizer = new wxFlexGridSizer(0, 2, 2, 0);
ecoPanelSizer->Add(sizer, 0, wxALL | wxALIGN_CENTER, 10);
setters_.push_back(
@@ -249,7 +249,7 @@ void SettingsFrame::createWeaponsPanel()
{
weaponsPanel_ = new wxPanel(book_, -1);
wxSizer *ecoPanelSizer = new wxBoxSizer(wxVERTICAL);
- wxSizer *sizer = new wxFlexGridSizer(2, 2);
+ wxSizer *sizer = new wxFlexGridSizer(0, 2, 2, 0);
ecoPanelSizer->Add(sizer, 0, wxALL | wxALIGN_CENTER, 10);
setters_.push_back(
@@ -286,7 +286,7 @@ void SettingsFrame::createEnvPanel()
{
envPanel_ = new wxPanel(book_, -1);
wxSizer *envPanelSizer = new wxBoxSizer(wxVERTICAL);
- wxSizer *sizer = new wxFlexGridSizer(2, 2);
+ wxSizer *sizer = new wxFlexGridSizer(0, 2, 2, 0);
envPanelSizer->Add(sizer, 0, wxALL | wxALIGN_CENTER, 10);
setters_.push_back(
@@ -337,7 +337,7 @@ void SettingsFrame::createLandPanel()
wxScrolledWindow *scrolledWindow = new wxScrolledWindow(landPanel_, -1,
wxDefaultPosition, wxSize(225, 200));
- wxSizer *sizer = new wxFlexGridSizer(3, 3);
+ wxSizer *sizer = new wxFlexGridSizer(0, 3, 3, 0);
int i = 0;
std::list<LandscapeDefinitionsEntry> &defns =
landscapeDefinitions.getAllLandscapes();
@@ -438,7 +438,7 @@ void SettingsFrame::createPlayersPanel()
wxT("Players are persistent for game"));
playersPanelSizer->Add(IDC_SERVER_RESIDUAL_CTRL, 0, wxALIGN_CENTER | wxTOP, 10);
- wxSizer *sizer = new wxGridSizer(3, 3);
+ wxSizer *sizer = new wxGridSizer(0, 3, 3, 0);
playersPanelSizer->Add(sizer, 0, wxALL | wxALIGN_CENTER, 10);
for (int i=0; i<24; i++)