Skip to content

Commit

Permalink
games-arcade/amphetamine: Apply Debian fixes and drop games.eclass usage
Browse files Browse the repository at this point in the history
Package-Manager: Portage-2.3.28, Repoman-2.3.9
  • Loading branch information
pacho2 committed Apr 15, 2018
1 parent 9c2402d commit 6d2e578
Show file tree
Hide file tree
Showing 7 changed files with 617 additions and 2 deletions.
48 changes: 48 additions & 0 deletions games-arcade/amphetamine/amphetamine-0.8.10-r1.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=6
inherit desktop

DESCRIPTION="a cool Jump'n Run game offering some unique visual effects"
HOMEPAGE="http://homepage.hispeed.ch/loehrer/amph/amph.html"
SRC_URI="http://homepage.hispeed.ch/loehrer/amph/files/${P}.tar.bz2
http://homepage.hispeed.ch/loehrer/amph/files/${PN}-data-0.8.6.tar.bz2"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86 ~x86-fbsd"
IUSE=""

DEPEND="media-libs/libsdl[sound,video]
x11-libs/libXpm"
RDEPEND=${DEPEND}

PATCHES=(
"${FILESDIR}"/${P}-build.patch
"${FILESDIR}"/${P}-64bit.patch

# From Debian:
"${FILESDIR}"/${P}-no-lxt.patch
"${FILESDIR}"/${P}-bugs.patch
"${FILESDIR}"/${P}-missing-headers.patch
"${FILESDIR}"/${P}-newline.patch
)

src_prepare() {
default
sed -i -e '55d' src/ObjInfo.cpp || die
}

src_compile() {
emake INSTALL_DIR=/usr/share/${PN}
}

src_install() {
newbin amph ${PN}
insinto /usr/share/${PN}
doins -r ../amph/*
newicon amph.xpm ${PN}.xpm
make_desktop_entry ${PN} Amphetamine ${PN}
einstalldocs
}
56 changes: 56 additions & 0 deletions games-arcade/amphetamine/files/amphetamine-0.8.10-bugs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
description: fix issues in collision detection
Index: amphetamine-0.8.10/src/Appl.cpp
===================================================================
--- amphetamine-0.8.10.orig/src/Appl.cpp 2006-05-15 19:16:56.000000000 +0200
+++ amphetamine-0.8.10/src/Appl.cpp 2006-05-15 19:17:02.000000000 +0200
@@ -183,7 +183,7 @@

firstPlayRound = 1;
command = kCmdNoCommand;
- syncTime = gSystem->GetTicks();
+ syncTime = gSystem->GetTicks() - 20;
aveTime = 20;

while (command == kCmdNoCommand) {
@@ -256,7 +256,7 @@

if (gSystem->KeyPressed(kKeyEscape)) {
command = gGUI->RunUserInterface(kMainPage);
- syncTime = gSystem->GetTicks();
+ syncTime = gSystem->GetTicks() - aveTime;
}

if (command >= kSaveGameSlot0 && command <= kSaveGameSlot5) {
Index: amphetamine-0.8.10/src/Object.cpp
===================================================================
--- amphetamine-0.8.10.orig/src/Object.cpp 2006-05-15 19:18:21.000000000 +0200
+++ amphetamine-0.8.10/src/Object.cpp 2006-05-15 19:18:33.000000000 +0200
@@ -70,10 +70,13 @@
{
if (ABS(forcex) > ABS(forcey)) {
sx += SIGN(forcex);
- sy += forcey / ABS(forcex);
+ if (forcex != 0)
+ sy += forcey / ABS(forcex);
}else{
sy += SIGN(forcey);
- sx += forcex / ABS(forcey);
+ /* Avoid SIGFE on alpha on divide by zero. -- JEH */
+ if (forcey != 0)
+ sx += forcex / ABS(forcey);
}
}

Index: amphetamine-0.8.10/src/Pltform.cpp
===================================================================
--- amphetamine-0.8.10.orig/src/Pltform.cpp 2006-05-15 19:18:25.000000000 +0200
+++ amphetamine-0.8.10/src/Pltform.cpp 2006-05-15 19:18:33.000000000 +0200
@@ -136,7 +136,7 @@

short CPlatform::Forces()
{
- short collisionObject, collisionCode;
+ short collisionObject = 0, collisionCode;
CObject *collObj;

CObject::Forces();
4 changes: 2 additions & 2 deletions games-arcade/amphetamine/files/amphetamine-0.8.10-build.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--- Makefile
+++ Makefile
--- a/Makefile
+++ b/Makefile
@@ -26,8 +26,8 @@

# makemake variables
Expand Down
126 changes: 126 additions & 0 deletions games-arcade/amphetamine/files/amphetamine-0.8.10-etc.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
description: use /etc/amphetamine for config files
Index: amphetamine-0.8.10/src/ConstVal.cpp
===================================================================
--- amphetamine-0.8.10.orig/src/ConstVal.cpp 2006-05-15 19:16:56.000000000 +0200
+++ amphetamine-0.8.10/src/ConstVal.cpp 2006-05-15 19:17:02.000000000 +0200
@@ -19,7 +19,7 @@
{
char levelSetString[11] = "xxLevelSet";
char levelBkgndString[13] = "xxLevelBkgnd";
- FILE *paramFile = fopen(gSystem->QualifyDataDir(kParFileName), "r"); // by LL
+ FILE *paramFile = fopen(gSystem->QualifyEtcDir(kParFileName), "r"); // by LL

gConst = new tConstValues;

@@ -159,7 +159,7 @@
fclose(paramFile);

// Hier sollte auch im Home Directory gesucht werden...
- paramFile = gSystem->FindFile(gConst->kFileConfig); // by LL
+ paramFile = fopen(gSystem->QualifyEtcDir(gConst->kFileConfig), "r"); // by LL

gConfigData->leftKey = GetLongConstant(paramFile, "LeftKey");
GetStringConstant(paramFile, "LeftKeyText", gConfigData->leftKeyText);
@@ -212,6 +212,7 @@
char c = 0;
short n;

+ key[0] = '\0';
fseek(f, 0, SEEK_SET);

while (strcmp(key, constName)) {
Index: amphetamine-0.8.10/src/Gui.cpp
===================================================================
--- amphetamine-0.8.10.orig/src/Gui.cpp 2006-05-15 19:16:56.000000000 +0200
+++ amphetamine-0.8.10/src/Gui.cpp 2006-05-15 19:17:02.000000000 +0200
@@ -688,7 +688,7 @@

void CGUI::LoadMessages()
{
- FILE *f = fopen(gSystem->QualifyDataDir(kParFileName), "r"); // by LL
+ FILE *f = fopen(gSystem->QualifyEtcDir(kParFileName), "r"); // by LL
char msgString[6] = "msgxx";
short n;

@@ -724,7 +724,7 @@

void LoadGUIParameters()
{
- FILE *f = fopen(gSystem->QualifyDataDir(kParFileName), "r"); // by LL
+ FILE *f = fopen(gSystem->QualifyEtcDir(kParFileName), "r"); // by LL

gGUIConst = new tGUIConstants;

Index: amphetamine-0.8.10/src/System.cpp
===================================================================
--- amphetamine-0.8.10.orig/src/System.cpp 2006-05-15 19:16:56.000000000 +0200
+++ amphetamine-0.8.10/src/System.cpp 2006-05-15 19:17:02.000000000 +0200
@@ -143,6 +143,14 @@
return tmp;
}

+char *CSystem::QualifyEtcDir(const char *fname)
+{
+ char *tmp = new char[strlen(etcDir)+strlen(fname)+2];
+ sprintf(tmp, "%s/%s", etcDir, fname);
+
+ return tmp;
+}
+
void CSystem::GetHomeDir()
{
char *tmp;
@@ -169,7 +177,9 @@
GetHomeDir();
dataDir = new char[strlen(INSTALL_DIR)+1];
strcpy(dataDir, INSTALL_DIR);
-
+ etcDir = new char[strlen(ETC_DIR)+1];
+ strcpy(etcDir, ETC_DIR);
+
char *logFileName = QualifyHomeDir(kLogFileName);

logFile = fopen(logFileName, "w"); // by LL
@@ -180,6 +190,8 @@
if ( SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO) < 0 ) {
MSG("SDL_Init_Failed.");
MSG(SDL_GetError());
+ /* Ouput to stdout too. */
+ printf("SDL_Init_Failed: %s\n", SDL_GetError());

exit(1);
}
Index: amphetamine-0.8.10/src/System.hpp
===================================================================
--- amphetamine-0.8.10.orig/src/System.hpp 2006-05-15 19:16:57.000000000 +0200
+++ amphetamine-0.8.10/src/System.hpp 2006-05-15 19:17:02.000000000 +0200
@@ -16,6 +16,10 @@
#define INSTALL_DIR "/usr/local/games/amph"
#endif

+#ifndef ETC_DIR
+#define ETC_DIR "/etc/amphetamine"
+#endif
+
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
#undef __BIG_ENDIAN__
#else
@@ -76,6 +80,7 @@
RGBcolor *palColors;
char *homeDir;
char *dataDir;
+ char *etcDir;
int workingSound;

//"""""""""""""""" System Stuff
@@ -107,8 +112,10 @@
void GetHomeDir();
char *QualifyDataDir(const char *fname);
char *QualifyHomeDir(const char *fname);
+ char *QualifyEtcDir(const char *fname);
void ScreenShot();
FILE *FindFile(const char *fname);
};

#endif
+
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
description: include string.h
Index: amphetamine-0.8.10/src/Surface.cpp
===================================================================
--- amphetamine-0.8.10.orig/src/Surface.cpp 2006-05-15 19:10:49.000000000 +0200
+++ amphetamine-0.8.10/src/Surface.cpp 2006-05-15 19:11:01.000000000 +0200
@@ -3,6 +3,7 @@
#include "ShapeLd.hpp"
#include "Clut.hpp"
#include "ConstVal.hpp"
+#include <string.h>
#include <memory.h>

const short kNoCharSpace = 20;
Loading

0 comments on commit 6d2e578

Please sign in to comment.