Skip to content

Commit

Permalink
refactor more and deal with problem of getting game stuff
Browse files Browse the repository at this point in the history
... when game lives in PATH and user runs it just by its name #22
yeah, that PathToGame is gone since yet

change gui.Font & GuiManager to read the file with picture of letters once

add more support for c++11 like nullptr and such

change build scripts for osx

with help from Atilla Kiss
    update Magyar ( hu_HU ) translation
    add extras/headoverheels.desktop
  • Loading branch information
dougmencken committed Mar 3, 2018
1 parent b896595 commit 579d7fb
Show file tree
Hide file tree
Showing 83 changed files with 954 additions and 980 deletions.
4 changes: 2 additions & 2 deletions build-osx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ pathToCompiler="/Developer/GCC/${gccVersion}/PowerPC/32bit" # ="/usr"
if [ ! -f src/Makefile ]
then
LDFLAGS="-L/opt/xerces-c-3.2.0/lib -L/opt/ogg-vorbis/lib -L/opt/libpng-1.6.34/lib -L/opt/zlib-1.2.8/lib -L${pathToCompiler}/lib" \
CPPFLAGS="-I/opt/xerces-c-3.2.0/include" \
CC="${pathToCompiler}/bin/gcc" CXX="${pathToCompiler}/bin/g++ -std=c++03" \
CPPFLAGS="-I/opt/libpng-1.6.34/include -I/opt/xerces-c-3.2.0/include -I/opt/allegro-4.4.2/include" \
CC="${pathToCompiler}/bin/gcc" CXX="${pathToCompiler}/bin/g++" \
./configure --prefix=${installPrefix} --enable-debug
fi

Expand Down
179 changes: 139 additions & 40 deletions external/buildexternal-osx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,40 +14,55 @@ echo " zlib"
echo " a Massively Spiffy Yet Delicately Unobtrusive Compression Library"
echo

zlib_version="1.2.8"

cd "${pathToExternal}"/zlib
tar xzf zlib-1.2.8.tar.gz
cd zlib-1.2.8

./configure --prefix=/opt/zlib-1.2.8 --libdir=/opt/zlib-1.2.8/lib --archs="" && make
make install DESTDIR=`pwd`/root32dir
CC="/usr/bin/gcc-4.2 -arch ppc64" CXX="/usr/bin/g++-4.2 -arch ppc64" ./configure --prefix=/opt/zlib-1.2.8 --libdir=/opt/zlib-1.2.8/lib --archs="" && make
make install DESTDIR=`pwd`/root64dir
lipo -create root32dir/opt/zlib-1.2.8/lib/libz.1.2.8.dylib root64dir/opt/zlib-1.2.8/lib/libz.1.2.8.dylib -output ./libz.1.2.8.dylib
[ -d "zlib-$zlib_version" ] || tar xzf zlib-"$zlib_version".tar.gz
cd zlib-"$zlib_version"

if [ ! -f ./okay ]; then

./configure --prefix=/opt/zlib-"$zlib_version" --libdir=/opt/zlib-"$zlib_version"/lib --archs="" && make
make install

./configure --prefix=/opt/zlib-1.2.8 --libdir=/opt/zlib-1.2.8/lib --archs="" --static && make
make install DESTDIR=`pwd`/root32dir
CC="/usr/bin/gcc-4.2 -arch ppc64" CXX="/usr/bin/g++-4.2 -arch ppc64" ./configure --prefix=/opt/zlib-1.2.8 --libdir=/opt/zlib-1.2.8/lib --archs="" --static && make
make install DESTDIR=`pwd`/root64dir
lipo -create root32dir/opt/zlib-1.2.8/lib/libz.a root64dir/opt/zlib-1.2.8/lib/libz.a -output ./libz.a
./configure --prefix=/opt/zlib-"$zlib_version" --libdir=/opt/zlib-"$zlib_version"/lib --archs="" --static && make
make install

file -h /opt/zlib-1.2.8/lib/libz*
file -h /opt/zlib-"$zlib_version"/lib/libz*
echo "okay" > ./okay

else

echo "already built"

fi

echo
echo " libpng"
echo " a Portable Network Graphics reference library which supports almost all PNG features"
echo

libpng_version="1.6.34"

cd "${pathToExternal}"/libpng
tar xzf libpng-1.6.34.tar.gz
cd libpng-1.6.34
[ -d libpng-"$libpng_version" ] || tar xzf libpng-"$libpng_version".tar.gz
cd libpng-"$libpng_version"

LDFLAGS="-L/opt/zlib-1.2.8/lib" ./configure --prefix=/opt/libpng-1.6.34 --enable-static --enable-shared --with-zlib-prefix=/opt/zlib-1.2.8
if [ ! -f ./okay ]; then

if [ ! -f ./Makefile ]; then
LDFLAGS="-L/opt/zlib-$zlib_version/lib" ./configure --prefix=/opt/libpng-"$libpng_version" --enable-static --enable-shared --with-zlib-prefix=/opt/zlib-"$zlib_version"
fi
make
make install

cd "${pathToExternal}"
echo "okay" > ./okay

else

echo "already built"

fi

echo
echo " ogg-vorbis ( libogg, libvorbis, vorbis-tools )"
Expand All @@ -57,71 +72,155 @@ echo
echo " libogg"
echo

libogg_version="1.3.3"

cd "${pathToExternal}"/ogg-vorbis
tar xzf libogg-1.3.3.tar.gz
cd libogg-1.3.3
[ -d libogg-"$libogg_version" ] || tar xzf libogg-"$libogg_version".tar.gz
cd libogg-"$libogg_version"

if [ ! -f ./okay ]; then

./configure --prefix=/opt/ogg-vorbis && make
if [ ! -f ./Makefile ]; then
./configure --prefix=/opt/ogg-vorbis && make
fi
make install

rm -r -f /usr/include/ogg
ln -s /opt/ogg-vorbis/include/ogg /usr/include/ogg

echo "okay" > ./okay

else

echo "already built"

fi

echo
echo " libvorbis"
echo

libvorbis_version="1.3.5"

cd "${pathToExternal}"/ogg-vorbis
tar xzf libvorbis-1.3.5.tar.gz
cd libvorbis-1.3.5
[ -d libvorbis-"$libvorbis_version" ] || tar xzf libvorbis-"$libvorbis_version".tar.gz
cd libvorbis-"$libvorbis_version"

if [ ! -f ./okay ]; then

./configure --prefix=/opt/ogg-vorbis --with-ogg=/opt/ogg-vorbis && make
if [ ! -f ./Makefile ]; then
./configure --prefix=/opt/ogg-vorbis --with-ogg=/opt/ogg-vorbis && make
fi
make install

rm -f -r /usr/include/vorbis
ln -s /opt/ogg-vorbis/include/vorbis /usr/include/vorbis

echo "okay" > ./okay

else

echo "already built"

fi

echo
echo " vorbis-tools"
echo

vorbistools_version="1.4.0"

cd "${pathToExternal}"/ogg-vorbis
tar xzf vorbis-tools-1.4.0.tar.gz
cd vorbis-tools-1.4.0
[ -d vorbis-tools-"$vorbistools_version" ] || tar xzf vorbis-tools-"$vorbistools_version".tar.gz
cd vorbis-tools-"$vorbistools_version"

./configure --prefix=/opt/ogg-vorbis --with-ogg=/opt/ogg-vorbis --with-vorbis=/opt/ogg-vorbis && make
if [ ! -f ./okay ]; then

if [ ! -f ./Makefile ]; then
./configure --prefix=/opt/ogg-vorbis --with-ogg=/opt/ogg-vorbis --with-vorbis=/opt/ogg-vorbis && make
fi
make install

echo "okay" > ./okay

else

echo "already built"

fi

echo
echo " xerces-c"
echo " a validating XML parser written in a portable subset of C++"
echo

xercesc_version="3.2.0"

cd "${pathToExternal}"/xerces-c
tar xjf xerces-c-3.2.0.tar.bz2
cd xerces-c-3.2.0
[ -d xerces-c-"$xercesc_version" ] || tar xjf xerces-c-"$xercesc_version".tar.bz2
cd xerces-c-"$xercesc_version"

CC="/usr/bin/gcc-4.2" CXX="/usr/bin/g++-4.2" ./configure --prefix=/opt/xerces-c-3.2.0
if [ ! -f ./okay ]; then

if [ ! -f ./Makefile ]; then
./configure --prefix=/opt/xerces-c-"$xercesc_version"
fi
make
make install

echo "okay" > ./okay

else

echo "already built"

fi

echo
echo " allegro 4"
echo " a cross-platform library for video game and multimedia programming"
echo

cd "${pathToExternal}"/allegro
tar xzf allegro-4.4.2.tar.gz
cd allegro-4.4.2
allegro4_version="4.4.2"

mkdir TheBuild && cd TheBuild
export CC="/usr/bin/gcc-4.2" CXX="/usr/bin/g++-4.2"
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=/opt/allegro-4.4.2 ..
make
mkdir -p docs/txt ; cp ./docs/build/* ./docs/txt/ && make install
if [ -x "$( command -v cmake )" ]; then

rm -f /usr/bin/allegro-config
ln -s /opt/allegro-4.4.2/bin/allegro-config /usr/bin/allegro-config
cd "${pathToExternal}"/allegro
[ -d allegro-"$allegro4_version" ] || tar xzf allegro-"$allegro4_version".tar.gz
cd allegro-"$allegro4_version"

if [ ! -f ./okay ]; then

[ -d TheBuild ] || mkdir TheBuild

cd TheBuild

if [ ! -f ./Makefile ]; then
# export CC=`command -v gcc` CXX=`command -v g++`
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=/opt/allegro-"$allegro4_version" -DCMAKE_C_FLAGS:STRING="-fno-common" ..
fi

make
mkdir -p docs/txt ; cp ./docs/build/* ./docs/txt/ && make install

cd ..

rm -f /usr/bin/allegro-config
ln -s /opt/allegro-"$allegro4_version"/bin/allegro-config /usr/bin/allegro-config

echo "okay" > ./okay

else

echo "already built"

fi

else

echo "can’t build allegro 4, it needs cmake to build"

fi

echo
echo " the end"
10 changes: 10 additions & 0 deletions extras/headoverheels.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Desktop Entry]
Name=headoverheels
GenericName=Head over Heels
Comment=Solid 3d Game
Comment[hu]=Klasszikus szobás játék
Exec=headoverheels
Icon=headoverheels
StartupNotify=false
Type=Application
Categories=Game;ActionGame;PuzzleGame
6 changes: 6 additions & 0 deletions gamedata/text/hu_HU.xml
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,12 @@
</properties>
</text>

<text id="play-room-melodies">
<properties>
<ustring>helyiség dallamok</ustring>
</properties>
</text>

<text id="show-credits">
<properties>
<ustring>alkotók</ustring>
Expand Down
7 changes: 4 additions & 3 deletions src/BonusManager.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

#include "BonusManager.hpp"
#include "Ism.hpp"


namespace isomot
Expand All @@ -15,11 +16,11 @@ BonusManager::~BonusManager( )
bonusRooms.clear();
}

BonusManager * BonusManager::instance = 0 ;
BonusManager * BonusManager::instance = nilPointer ;

BonusManager* BonusManager::getInstance ()
{
if ( instance == 0 )
if ( instance == nilPointer )
{
instance = new BonusManager();
}
Expand Down Expand Up @@ -101,7 +102,7 @@ bool BonusRoom::isPresent ( const std::string& label )

bool BonusRoom::operator== ( const std::string& fileName )
{
return ( this->nameOfFile.compare( fileName ) == 0 ) ;
return ( this->nameOfFile == fileName ) ;
}

}
8 changes: 4 additions & 4 deletions src/Camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void Camera::turnOn( PlayerItem* player, const Way& wayOfEntry )
{
const unsigned int maxTilesOfSingleRoom = 10 ;

if ( delta.first == 0 && delta.second == 0 && player != 0 &&
if ( delta.first == 0 && delta.second == 0 && player != nilPointer &&
( room->getTilesX() > maxTilesOfSingleRoom || room->getTilesY() > maxTilesOfSingleRoom ) )
{
// is it double room along Y
Expand Down Expand Up @@ -66,7 +66,7 @@ void Camera::turnOn( PlayerItem* player, const Way& wayOfEntry )
else
{
TripleRoomInitialPoint* initialPoint = room->findInitialPointOfEntryToTripleRoom( wayOfEntry );
if ( initialPoint != 0 )
if ( initialPoint != nilPointer )
{
delta.first = initialPoint->getX();
delta.second = initialPoint->getY();
Expand All @@ -93,7 +93,7 @@ bool Camera::centerOn( PlayerItem* player )
bool changed = false;

// Sala triple
if ( ( room->getTilesX() > maxTilesOfSingleRoom && room->getTilesY() > maxTilesOfSingleRoom ) && player != 0 )
if ( ( room->getTilesX() > maxTilesOfSingleRoom && room->getTilesY() > maxTilesOfSingleRoom ) && player != nilPointer )
{
// Debe haber cambio en el eje X para realizar los cálculos
if ( reference.first - player->getX() != 0 && room->getTilesX() > maxTilesOfSingleRoom )
Expand Down Expand Up @@ -148,7 +148,7 @@ bool Camera::centerOn( PlayerItem* player )
}
}
// Sala doble
else if ( ( room->getTilesX() > maxTilesOfSingleRoom || room->getTilesY() > maxTilesOfSingleRoom ) && player != 0 )
else if ( ( room->getTilesX() > maxTilesOfSingleRoom || room->getTilesY() > maxTilesOfSingleRoom ) && player != nilPointer )
{
// Debe haber cambio en el eje X para realizar los cálculos
if ( reference.first - player->getX() != 0 && room->getTilesX() > maxTilesOfSingleRoom )
Expand Down
5 changes: 3 additions & 2 deletions src/Color.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

#include "Color.hpp"
#include "Ism.hpp"

#include <cmath> // for sqrt

Expand All @@ -22,7 +23,7 @@ BITMAP* Color::colorizePicture( BITMAP* picture, Color* color )
/* private static */
BITMAP* Color::colorizePicture( BITMAP* picture, unsigned char red, unsigned char green, unsigned char blue )
{
if ( picture == 0 ) return 0 ;
if ( picture == nilPointer ) return nilPointer ;

for ( int x = 0; x < picture->w; x++ )
{
Expand All @@ -41,7 +42,7 @@ BITMAP* Color::colorizePicture( BITMAP* picture, unsigned char red, unsigned cha
/* public static */
BITMAP * Color::pictureToGrayscale ( BITMAP * picture )
{
if ( picture == 0 ) return 0 ;
if ( picture == nilPointer ) return nilPointer ;

for ( int y = 0; y < picture->h; y++ )
{
Expand Down
Loading

0 comments on commit 579d7fb

Please sign in to comment.