games/megamario: Added (Super Mario Brothers clone).

Signed-off-by: David Spencer <idlemoor@slackbuilds.org>
This commit is contained in:
B. Watson 2016-08-15 00:50:09 +01:00 committed by David Spencer
parent 9f7821b5b8
commit 40ba4e09f4
9 changed files with 280 additions and 0 deletions

12
games/megamario/README Normal file
View file

@ -0,0 +1,12 @@
megamario (Super Mario Brothers clone)
Mega Mario is a Super Mario Brothers 1 clone. It features everything the
original features - with better graphics, higher resolution, smoother
movement and new levels. The story of Mario and Luigi continues in
old-school style.
If you want to change the window size or use fullscreen, edit
~/.megamario/mario.ini after running & exiting the game.
The megamario level editor is Windows-only, so it's not included in
this build.

View file

@ -0,0 +1,3 @@
if [ -x /usr/bin/update-desktop-database ]; then
/usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1
fi

View file

@ -0,0 +1,116 @@
#!/bin/sh
# Slackware build script for megamario
# Written by B. Watson (yalhcru@gmail.com)
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
PRGNAM=megamario
VERSION=${VERSION:-1.7}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i586 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
fi
set -e
ZIPFILE="MegaMario_v${VERSION}_full.zip"
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
# zip file doesn't contain a top-level directory, so:
mkdir -p $PRGNAM-$VERSION
cd $PRGNAM-$VERSION
# don't even extract the windows binaries or trash files
unzip $CWD/$ZIPFILE -x '*.exe' '*.dll' \
log.txt data/save.sav data/levels/1/1 data/levels/11/mai
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
-o -perm 511 \) -exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
# missing includes
patch -p1 < $CWD/patches/compilefix.diff
# look for mp3music in DATADIR, not current dir
patch -p1 < $CWD/patches/usemp3music.diff
# write log.txt to ~/.megamario/, not current dir
patch -p1 < $CWD/patches/logfile.diff
# bin is hardcoded
sed -i 's,\<bin\>,games,' Makefile
# default to windowed, since there's no GUI for changing resolution or
# fullscreen/windowed. it's 2016, everyone has a 1080p monitor, but the
# default res is 640x480. in SDL1 this means huge black borders. this
# is only the default, users can change it by editing the ini file.
sed -i '/getboolean.*Mario:FULLSCREEN/s,1,0,' src/main.cpp
# 'make install' doesn't create the data dir
DATADIR=/usr/share/games/$PRGNAM
mkdir -p $PKG/$DATADIR
make CFLAGS="$SLKCFLAGS" \
DATADIR="$DATADIR" \
PREFIX=/usr
strip $PRGNAM
make install \
PREFIX=$PKG/usr \
DATADIR="$PKG/$DATADIR"
# 'make install' doesn't install the high-quality mp3 music
cp -a mp3music $PKG/$DATADIR
# upstream's .desktop fails to validate, use our own fixed one.
# the icon is upstream's.
# not doing a man page as there are no command-line options.
mkdir -p $PKG/usr/share/applications $PKG/usr/share/pixmaps
cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop
cat $PRGNAM.png > $PKG/usr/share/pixmaps/$PRGNAM.png
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a *.txt $PKG/usr/doc/$PRGNAM-$VERSION
# get rid of DOS line endings:
sed -i 's,\r,,' $PKG/usr/doc/$PRGNAM-$VERSION/*.txt
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}

View file

@ -0,0 +1,10 @@
[Desktop Entry]
Exec=megamario %u
Icon=megamario
Type=Application
Categories=Game;ArcadeGame;
Name=megamario
GenericName=Mega Mario
GenericName[fr]=Clone de Mario Bros
GenericName[de]=Mega Mario
StartupNotify=false

View file

@ -0,0 +1,10 @@
PRGNAM="megamario"
VERSION="1.7"
HOMEPAGE="http://www.megamario.de/"
DOWNLOAD="http://downloads.sourceforge.net/project/mmario/Mega%20Mario%20Full%20Game/Mega%20Mario%20v1.7%20%28Full%20Game%2C%20high%20Quality%20music%29/MegaMario_v1.7_full.zip"
MD5SUM="9550b20f7c2754cd8f94ebf309becf62"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES=""
MAINTAINER="B. Watson"
EMAIL="yalhcru@gmail.com"

View file

@ -0,0 +1,56 @@
diff -Naur a/src/SDL_gfxPrimitives.c b/src/SDL_gfxPrimitives.c
--- a/src/SDL_gfxPrimitives.c 2007-03-07 10:35:26.000000000 -0500
+++ b/src/SDL_gfxPrimitives.c 2016-08-14 15:36:20.470686223 -0400
@@ -10,6 +10,7 @@
#include <stdlib.h>
#include <math.h>
#include <string.h>
+#include <limits.h>
#include "SDL_gfxPrimitives.h"
#include "SDL_gfxPrimitives_font.h"
diff -Naur a/src/global.cpp b/src/global.cpp
--- a/src/global.cpp 2007-03-07 10:34:56.000000000 -0500
+++ b/src/global.cpp 2016-08-14 15:39:23.252692634 -0400
@@ -9,7 +9,7 @@
#include "Global.h"
#include "unixutils.h"
-
+#include <limits.h>
SDL_Surface *screen;
diff -Naur a/src/levels.cpp b/src/levels.cpp
--- a/src/levels.cpp 2007-03-07 10:35:04.000000000 -0500
+++ b/src/levels.cpp 2016-08-14 15:38:08.660690018 -0400
@@ -6,6 +6,7 @@
*********************************************************************/
+#include <limits.h>
#include "Global.h"
#include "unixutils.h"
diff -Naur a/src/main.cpp b/src/main.cpp
--- a/src/main.cpp 2007-03-07 10:35:04.000000000 -0500
+++ b/src/main.cpp 2016-08-14 15:38:42.660691210 -0400
@@ -10,6 +10,7 @@
#include "iniparser.h"
#include "unixutils.h"
#include <time.h>
+#include <limits.h>
bool running;
diff -Naur a/src/menu.cpp b/src/menu.cpp
--- a/src/menu.cpp 2007-03-07 10:35:10.000000000 -0500
+++ b/src/menu.cpp 2016-08-14 15:40:10.108694278 -0400
@@ -7,6 +7,7 @@
#include "Global.h"
#include "unixutils.h"
+#include <limits.h>
bool hideMenu;

View file

@ -0,0 +1,30 @@
diff -Naur a/src/main.cpp b/src/main.cpp
--- a/src/main.cpp 2007-03-07 10:35:04.000000000 -0500
+++ b/src/main.cpp 2016-08-14 16:53:05.113847723 -0400
@@ -47,21 +47,24 @@
NoFrameCheck = 1;
NoFrameCheck = 1;
+ out_logfile.open ("log.txt");
#else /* defined __unix__ */
int main(int argc, char *argv[])
{
+ char logfile[MAX_PATH];
char *home_dir = get_homedir();
snprintf(szIniFile, MAX_PATH, "%s/.megamario",
home_dir? home_dir:".");
check_and_create_dir(szIniFile);
snprintf(szIniFile, MAX_PATH, "%s/.megamario/mario.ini",
home_dir? home_dir:".");
-
+ snprintf(logfile, MAX_PATH, "%s/.megamario/log.txt",
+ home_dir? home_dir:".");
+ out_logfile.open (logfile);
#endif /* defined __unix__ */
- out_logfile.open ("log.txt");
dictionary * d = iniparser_new(szIniFile);
pixelation = iniparser_getboolean (d, "Mario:Pixelation", 1);

View file

@ -0,0 +1,24 @@
diff -Naur a/src/functions.cpp b/src/functions.cpp
--- a/src/functions.cpp 2007-03-07 10:34:56.000000000 -0500
+++ b/src/functions.cpp 2016-08-14 16:26:04.208790873 -0400
@@ -447,7 +447,7 @@
}
else
{
- sprintf(tmp, "mp3music/%s",filename);
+ sprintf(tmp, DATADIR "mp3music/%s",filename);
tmp[strlen(tmp)-3]='m';
tmp[strlen(tmp)-2]='p';
tmp[strlen(tmp)-1]='3';
diff -Naur a/src/main.cpp b/src/main.cpp
--- a/src/main.cpp 2007-03-07 10:35:04.000000000 -0500
+++ b/src/main.cpp 2016-08-14 16:25:41.230790067 -0400
@@ -413,7 +413,7 @@
fstream fin;
-fin.open("mp3music/music_available.dat",ios::in);
+fin.open(DATADIR "mp3music/music_available.dat",ios::in);
if( fin.is_open() )
{
HighQualityMusicFound=1;

View file

@ -0,0 +1,19 @@
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.
# Line up the first '|' above the ':' following the base package name, and
# the '|' on the right side marks the last column you can put a character in.
# You must make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':' except on otherwise blank lines.
|-----handy-ruler------------------------------------------------------|
megamario: megamario (Super Mario Brothers clone)
megamario:
megamario: Mega Mario is a Super Mario Brothers 1 clone. It features everything
megamario: the original features - with better graphics, higher resolution,
megamario: smoother movement and new levels. The story of Mario and Luigi
megamario: continues in old-school style.
megamario:
megamario:
megamario:
megamario:
megamario: