1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-28 01:06:17 +00:00

games/dustrac:

- Update to 1.8.1
- Remove upstreamed patches
- Add upstream patch to fix build on 10.x
- Remove option for Qt 4 (support has been ended upstream)
This commit is contained in:
Max Brazhnikov 2014-11-15 12:20:43 +00:00
parent 2fc1f0f4b2
commit ffd1a11f5d
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=372595
6 changed files with 458 additions and 60 deletions

View File

@ -1,8 +1,7 @@
# $FreeBSD$
PORTNAME= dustrac
PORTVERSION= 1.7.2
PORTREVISION= 1
PORTVERSION= 1.8.1
CATEGORIES= games
MASTER_SITES= SF/${PORTNAME}/src
@ -11,28 +10,16 @@ COMMENT= 2D top-view racing game
LIB_DEPENDS= libvorbisfile.so:${PORTSDIR}/audio/libvorbis
USES= compiler:c++11-lib cmake openal pkgconfig zip
USES= compiler:c++11-lib cmake:outsource openal pkgconfig
USE_GL= glu
_USE_QT4= corelib opengl xml linguist_build \
moc_build qmake_build rcc_build uic_build
_USE_QT5= core opengl xml widgets \
USE_QT5= core opengl xml widgets \
buildtools_build linguisttools_build qmake_build
CMAKE_ARGS= -DReleaseBuild=on \
-DDATA_PATH=${DATADIR} \
-DDOC_PATH=${DOCSDIR}
LDFLAGS= -L${LOCALBASE}/lib
LDFLAGS+= -L${LOCALBASE}/lib
OPTIONS_DEFINE= DOCS DEBUG
OPTIONS_SINGLE= TOOLKIT
OPTIONS_SINGLE_TOOLKIT= QT4 QT5
OPTIONS_DEFAULT= QT5
TOOLKIT_DESC= Qt toolkit
DEBUG_CMAKE_ON= -DDebugBuild=on
QT4_USE= ${_USE_QT4:S/^/QT4=/}
QT5_USE= ${_USE_QT5:S/^/QT5=/}
QT5_CMAKE_ON= -DUseQt5=on
QT5_CMAKE_OFF= -DUseQt5=off
OPTIONS_DEFINE= DOCS
STRIP_FILES= bin/dustrac-game \
bin/dustrac-editor

View File

@ -1,2 +1,2 @@
SHA256 (dustrac-1.7.2.zip) = 2eaa4b98c77936cbbc0c34120b3e1a32a48612886254f8ea85ed042034e4268b
SIZE (dustrac-1.7.2.zip) = 26450932
SHA256 (dustrac-1.8.1.tar.gz) = ec0496a91cfa9dfa11225d3a0dd1b2c39250ead88cf062b7d0a00ad16352e289
SIZE (dustrac-1.8.1.tar.gz) = 25828452

View File

@ -1,18 +0,0 @@
--- ./CMakeLists.txt.orig 2014-03-09 12:40:35.000000000 +0000
+++ ./CMakeLists.txt 2014-04-05 13:27:16.455482525 +0000
@@ -40,13 +40,12 @@
cmake_policy(VERSION 2.8.7)
endif()
-if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+if(UNIX)
include("InstallLinux.cmake")
-elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
+elseif(WIN32)
include("InstallWindows.cmake")
endif()
-set(CMAKE_VERBOSE_MAKEFILE OFF)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -W -Wall -O3 -pedantic")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fomit-frame-pointer -finline-functions -ffast-math")

View File

@ -0,0 +1,451 @@
diff --git CMakeLists.txt CMakeLists.txt
index 5921d71..1692ee0 100644
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -39,6 +39,9 @@ endif()
if(CMAKE_COMPILER_IS_GNUCXX OR MINGW)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -W -Wall -O3 -pedantic")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fomit-frame-pointer -finline-functions -ffast-math")
+elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -W -Wall -O3 -pedantic")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fomit-frame-pointer -finline-functions -ffast-math")
endif()
set(GAME_BINARY_NAME "dustrac-game")
diff --git src/game/MiniCore/CMakeLists.txt src/game/MiniCore/CMakeLists.txt
index 5144d1a..286cfc9 100644
--- src/game/MiniCore/CMakeLists.txt
+++ src/game/MiniCore/CMakeLists.txt
@@ -29,6 +29,7 @@ Graphics/mcglobjectbase.cc
Graphics/mcglpointparticlerenderer.cc
Graphics/mcglscene.cc
Graphics/mcglshaderprogram.cc
+Graphics/mcrenderlayer.cc
Graphics/mcshaders.hh
Graphics/mcshaders30.hh
Graphics/mcshadersGLES.hh
diff --git src/game/MiniCore/Graphics/mcrenderlayer.cc src/game/MiniCore/Graphics/mcrenderlayer.cc
new file mode 100644
index 0000000..c5f9016
--- /dev/null
+++ src/game/MiniCore/Graphics/mcrenderlayer.cc
@@ -0,0 +1,52 @@
+// This file belongs to the "MiniCore" game engine.
+// Copyright (C) 2014 Jussi Lind <jussi.lind@iki.fi>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+// MA 02110-1301, USA.
+//
+
+#include "mcrenderlayer.hh"
+#include "mccamera.hh"
+#include "mcobject.hh"
+
+MCRenderLayer::MCRenderLayer()
+ : m_depthTestEnabled(false)
+{
+}
+
+void MCRenderLayer::setDepthTestEnabled(bool enable)
+{
+ m_depthTestEnabled = enable;
+}
+
+bool MCRenderLayer::depthTestEnabled() const
+{
+ return m_depthTestEnabled;
+}
+
+MCRenderLayer::ObjectSet & MCRenderLayer::objectSet()
+{
+ return m_objectSet;
+}
+
+MCRenderLayer::CameraBatchMap & MCRenderLayer::objectBatches()
+{
+ return m_objectBatches;
+}
+
+MCRenderLayer::CameraBatchMap & MCRenderLayer::particleBatches()
+{
+ return m_particleBatches;
+}
diff --git src/game/MiniCore/Graphics/mcrenderlayer.hh src/game/MiniCore/Graphics/mcrenderlayer.hh
new file mode 100644
index 0000000..0b2fae4
--- /dev/null
+++ src/game/MiniCore/Graphics/mcrenderlayer.hh
@@ -0,0 +1,63 @@
+// This file belongs to the "MiniCore" game engine.
+// Copyright (C) 2014 Jussi Lind <jussi.lind@iki.fi>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+// MA 02110-1301, USA.
+//
+
+#ifndef MCRENDERLAYER_HH
+#define MCRENDERLAYER_HH
+
+#include <map>
+#include <unordered_set>
+#include <vector>
+
+class MCCamera;
+class MCObject;
+
+class MCRenderLayer
+{
+public:
+
+ MCRenderLayer();
+
+ void setDepthTestEnabled(bool enable);
+
+ bool depthTestEnabled() const;
+
+ typedef std::unordered_set<MCObject *> ObjectSet;
+
+ ObjectSet & objectSet();
+
+ typedef int ObjectTypeId;
+ typedef std::map<ObjectTypeId, std::vector<MCObject *> > BatchMap;
+ typedef std::map<MCCamera *, BatchMap> CameraBatchMap;
+
+ CameraBatchMap & objectBatches();
+
+ CameraBatchMap & particleBatches();
+
+private:
+
+ bool m_depthTestEnabled;
+
+ ObjectSet m_objectSet;
+
+ CameraBatchMap m_objectBatches;
+
+ CameraBatchMap m_particleBatches;
+};
+
+#endif // MCRENDERLAYER_HH
diff --git src/game/MiniCore/Graphics/mcworldrenderer.cc src/game/MiniCore/Graphics/mcworldrenderer.cc
index 41e6607..ab8cb8a 100644
--- src/game/MiniCore/Graphics/mcworldrenderer.cc
+++ src/game/MiniCore/Graphics/mcworldrenderer.cc
@@ -31,10 +31,6 @@
MCWorldRenderer::MCWorldRenderer()
{
- for (unsigned i = 0; i < MCWorld::MaxLayers; i++)
- {
- m_depthTestEnabled[i] = false;
- }
}
void MCWorldRenderer::registerPointParticleRenderer(MCUint typeId, MCGLPointParticleRenderer & renderer)
@@ -61,13 +57,15 @@ void MCWorldRenderer::buildBatches(MCCamera * camera)
// Grouping the objects like this reduces texture switches etc and increases
// overall performance.
- for (int i = 0; i < MCWorld::MaxLayers; i++)
+ auto layerIter = m_layers.begin();
+ while (layerIter != m_layers.end())
{
- m_objectBatches[camera][i].clear();
- m_particleBatches[camera][i].clear();
+ MCRenderLayer & layer = layerIter->second;
- const auto end = m_layers[i].end();
- for (auto objectIter = m_layers[i].begin(); objectIter != end; objectIter++)
+ layer.objectBatches().clear();
+ layer.particleBatches().clear();
+
+ for (auto objectIter = layer.objectSet().begin(); objectIter != layer.objectSet().end(); objectIter++)
{
MCObject & object = **objectIter;
if (object.isRenderable())
@@ -83,7 +81,7 @@ void MCWorldRenderer::buildBatches(MCCamera * camera)
bbox.translate(MCVector2dF(object.location()));
if (!camera || camera->isVisible(bbox))
{
- m_objectBatches[camera][i][object.typeID()].push_back(&object);
+ layer.objectBatches()[camera][object.typeID()].push_back(&object);
}
}
}
@@ -93,7 +91,7 @@ void MCWorldRenderer::buildBatches(MCCamera * camera)
{
if (camera->isVisible(object.bbox()))
{
- m_particleBatches[camera][i][object.typeID()].push_back(&object);
+ layer.particleBatches()[camera][object.typeID()].push_back(&object);
}
else
{
@@ -120,12 +118,14 @@ void MCWorldRenderer::buildBatches(MCCamera * camera)
}
else
{
- m_particleBatches[camera][i][object.typeID()].push_back(&object);
+ layer.particleBatches()[camera][object.typeID()].push_back(&object);
}
}
}
}
}
+
+ layerIter++;
}
}
@@ -135,11 +135,14 @@ void MCWorldRenderer::renderBatches(MCCamera * camera)
// layer-specific.
bool depthTest = false;
- for (int layer = 0; layer < MCWorld::MaxLayers; layer++)
+ auto layerIter = m_layers.begin();
+ while (layerIter != m_layers.end())
{
+ MCRenderLayer & layer = layerIter->second;
+
// The depth test is enabled/disabled separately on
// each object layer.
- if (m_depthTestEnabled[layer] && !depthTest)
+ if (layer.depthTestEnabled() && !depthTest)
{
glEnable(GL_DEPTH_TEST);
depthTest = true;
@@ -152,13 +155,15 @@ void MCWorldRenderer::renderBatches(MCCamera * camera)
renderObjectBatches(camera, layer);
renderParticleBatches(camera, layer);
+
+ layerIter++;
}
}
-void MCWorldRenderer::renderObjectBatches(MCCamera * camera, int layer)
+void MCWorldRenderer::renderObjectBatches(MCCamera * camera, MCRenderLayer & layer)
{
- auto iter = m_objectBatches[camera][layer].begin();
- const auto end = m_objectBatches[camera][layer].end();
+ auto iter = layer.objectBatches()[camera].begin();
+ const auto end = layer.objectBatches()[camera].end();
while (iter != end)
{
const int itemCountInBatch = iter->second.size();
@@ -185,11 +190,11 @@ void MCWorldRenderer::renderObjectBatches(MCCamera * camera, int layer)
}
}
-void MCWorldRenderer::renderParticleBatches(MCCamera * camera, int layer)
+void MCWorldRenderer::renderParticleBatches(MCCamera * camera, MCRenderLayer & layer)
{
// Render particle batches
- auto batchIter = m_particleBatches[camera][layer].begin();
- const auto end = m_particleBatches[camera][layer].end();
+ auto batchIter = layer.particleBatches()[camera].begin();
+ const auto end = layer.particleBatches()[camera].end();
while (batchIter != end)
{
if (!batchIter->second.size())
@@ -233,17 +238,20 @@ void MCWorldRenderer::renderShadows(MCCamera * camera)
{
glDisable(GL_DEPTH_TEST);
- for (int i = 0; i < MCWorld::MaxLayers; i++)
+ auto layerIter = m_layers.begin();
+ while (layerIter != m_layers.end())
{
+ MCRenderLayer & layer = layerIter->second;
+
// Render batches
- auto iter = m_objectBatches[camera][i].begin();
- const auto end = m_objectBatches[camera][i].end();
- while (iter != end)
+ auto batchIter = layer.objectBatches()[camera].begin();
+ const auto end = layer.objectBatches()[camera].end();
+ while (batchIter != end)
{
- const int itemCountInBatch = iter->second.size();
+ const int itemCountInBatch = batchIter->second.size();
if (itemCountInBatch > 0)
{
- MCObject * object = iter->second[0];
+ MCObject * object = batchIter->second[0];
std::shared_ptr<MCShapeView> view = object->shape()->view();
if (view && view->hasShadow())
{
@@ -252,10 +260,10 @@ void MCWorldRenderer::renderShadows(MCCamera * camera)
for (int i = 1; i < itemCountInBatch - 1; i++)
{
- iter->second[i]->renderShadow(camera);
+ batchIter->second[i]->renderShadow(camera);
}
- object = iter->second[itemCountInBatch - 1];
+ object = batchIter->second[itemCountInBatch - 1];
object->renderShadow(camera);
view = object->shape()->view();
@@ -263,31 +271,26 @@ void MCWorldRenderer::renderShadows(MCCamera * camera)
}
}
- iter++;
+ batchIter++;
}
+
+ layerIter++;
}
}
void MCWorldRenderer::enableDepthTestOnLayer(int layer, bool enable)
{
- if (layer < MCWorld::MaxLayers)
- {
- m_depthTestEnabled[layer] = enable;
- }
+ m_layers[layer].setDepthTestEnabled(enable);
}
void MCWorldRenderer::addToLayerMap(MCObject & object)
{
- const int layerIndex =
- object.renderLayer() >= MCWorld::MaxLayers ? MCWorld::MaxLayers - 1 : object.renderLayer();
- m_layers[layerIndex].insert(&object);
+ m_layers[object.renderLayer()].objectSet().insert(&object);
}
void MCWorldRenderer::removeFromLayerMap(MCObject & object)
{
- const int layerIndex =
- object.renderLayer() >= MCWorld::MaxLayers ? MCWorld::MaxLayers - 1 : object.renderLayer();
- m_layers[layerIndex].erase(&object);
+ m_layers[object.renderLayer()].objectSet().erase(&object);
}
void MCWorldRenderer::addParticleVisibilityCamera(MCCamera & camera)
@@ -302,8 +305,5 @@ void MCWorldRenderer::removeParticleVisibilityCameras()
void MCWorldRenderer::clear()
{
- for (int i = 0; i < MCWorld::MaxLayers; i++)
- {
- m_layers[i].clear();
- }
+ m_layers.clear();
}
diff --git src/game/MiniCore/Graphics/mcworldrenderer.hh src/game/MiniCore/Graphics/mcworldrenderer.hh
index 0a45a49..287af58 100644
--- src/game/MiniCore/Graphics/mcworldrenderer.hh
+++ src/game/MiniCore/Graphics/mcworldrenderer.hh
@@ -20,6 +20,7 @@
#ifndef MCWORLDRENDERER_HH
#define MCWORLDRENDERER_HH
+#include "mcrenderlayer.hh"
#include "mctypes.hh"
#include "mcworld.hh"
@@ -72,24 +73,17 @@ private:
void renderBatches(MCCamera * camera = nullptr);
- void renderObjectBatches(MCCamera * camera, int layer);
+ void renderObjectBatches(MCCamera * camera, MCRenderLayer & layer);
- void renderParticleBatches(MCCamera * camera, int layer);
+ void renderParticleBatches(MCCamera * camera, MCRenderLayer & layer);
- typedef std::unordered_set<MCObject *> LayerSet;
- LayerSet m_layers[MCWorld::MaxLayers];
-
- typedef std::map<int, std::vector<MCObject *> > BatchMap;
- typedef std::map<MCCamera *, BatchMap[MCWorld::MaxLayers]> CameraBatchMap;
-
- CameraBatchMap m_objectBatches;
- CameraBatchMap m_particleBatches;
-
- bool m_depthTestEnabled[MCWorld::MaxLayers];
+ typedef int LayerId;
+ std::map<LayerId, MCRenderLayer> m_layers;
std::vector<MCCamera *> m_visibilityCameras;
- typedef std::map<int, MCGLPointParticleRenderer *> ParticleRendererMap;
+ typedef int ParticleTypeId;
+ typedef std::map<ParticleTypeId, MCGLPointParticleRenderer *> ParticleRendererMap;
ParticleRendererMap m_particleRenderers;
};
diff --git src/game/checkeredflag.cpp src/game/checkeredflag.cpp
index 10fd62d..67bb608 100644
--- src/game/checkeredflag.cpp
+++ src/game/checkeredflag.cpp
@@ -23,7 +23,6 @@
static const int FLAG_W = 32;
static const int FLAG_H = 24;
static const int V_SPACING = 20;
-static const float APPEARANCE_SPEED = 0.05f;
CheckeredFlag::CheckeredFlag()
: m_surface(MCAssetManager::surfaceManager().surface("checkeredFlag"))
diff --git src/game/game.cpp src/game/game.cpp
index db4a55a..5ad81ac 100644
--- src/game/game.cpp
+++ src/game/game.cpp
@@ -44,8 +44,7 @@
#include <cassert>
-static const unsigned int MAX_PLAYERS = 2;
-static const float DEFAULT_VOLUME = 0.5;
+static const unsigned int MAX_PLAYERS = 2;
Game * Game::m_instance = nullptr;
diff --git src/game/game.pro src/game/game.pro
index 055d28c..a73daae 100644
--- src/game/game.pro
+++ src/game/game.pro
@@ -152,6 +152,7 @@ HEADERS += \
MiniCore/Graphics/mcshaders.hh \
MiniCore/Graphics/mcshaders30.hh \
MiniCore/Graphics/mcshadersGLES.hh \
+ MiniCore/Graphics/mcrenderlayer.hh \
MiniCore/Graphics/mcshapeview.hh \
MiniCore/Graphics/mcsurface.hh \
MiniCore/Graphics/mcsurfaceconfigloader.hh \
@@ -292,6 +293,7 @@ SOURCES += \
MiniCore/Graphics/mcmeshmanager.cc \
MiniCore/Graphics/mcmeshobjectdata.cc \
MiniCore/Graphics/mcmeshview.cc \
+ MiniCore/Graphics/mcrenderlayer.cc \
MiniCore/Graphics/mcsurface.cc \
MiniCore/Graphics/mcsurfaceconfigloader.cc \
MiniCore/Graphics/mcsurfacemanager.cc \

View File

@ -1,11 +0,0 @@
--- ./src/editor/CMakeLists.txt.orig 2014-04-05 14:09:43.520483380 +0000
+++ ./src/editor/CMakeLists.txt 2014-04-05 14:10:03.847483124 +0000
@@ -75,7 +75,7 @@
endif()
# Copy desktop file
-if(ReleaseBuild AND ${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+if(ReleaseBuild AND UNIX)
set(DesktopFileSourcePath)
if(USC)
set(DesktopFileSourcePath ${CMAKE_SOURCE_DIR}/src/dustrac-editor.desktop.opt.in)

View File

@ -1,11 +0,0 @@
--- ./src/game/CMakeLists.txt.orig 2014-04-05 14:09:28.680493168 +0000
+++ ./src/game/CMakeLists.txt 2014-04-05 14:09:35.694483369 +0000
@@ -129,7 +129,7 @@
endif()
# Copy desktop file
-if(ReleaseBuild AND ${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+if(ReleaseBuild AND UNIX)
set(DesktopFileSourcePath)
if(USC)
set(DesktopFileSourcePath ${CMAKE_SOURCE_DIR}/src/dustrac-game.desktop.opt.in)