Files
haikuports/games-arcade/ri_li/patches/ri_li-2.0.1.patchset
Schrijvers Luc 30767b4bc7 Ri-li, new recipe (#3476)
* Ri-li, new recipe
2018-12-29 10:57:58 +01:00

521 lines
15 KiB
Plaintext

From ee3b2c72f60190f9551d14af53c50258bb384211 Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Sat, 8 Dec 2018 12:01:22 +0100
Subject: fixes for gcc7
diff --git a/src/audio.cc b/src/audio.cc
index bd3af3a..373ea94 100644
--- a/src/audio.cc
+++ b/src/audio.cc
@@ -22,7 +22,8 @@
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#include <stdlib.h>
-#include <iostream.h>
+#include <iostream>
+#include <ostream>
#include <string.h>
#include "audio.h"
@@ -57,7 +58,7 @@ bool Audio::Init(void)
char PathFile[512];
if(Mix_OpenAudio(22050,AUDIO_S16,1,1024)) {
- cerr <<"Enable to init Sound card ! "<<SDL_GetError()<<endl;
+ std::cerr <<"Enable to init Sound card ! "<<SDL_GetError()<<std::endl;
return false;
}
diff --git a/src/ecran.cc b/src/ecran.cc
index 9e21e95..38f203c 100644
--- a/src/ecran.cc
+++ b/src/ecran.cc
@@ -21,7 +21,7 @@
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#include <iostream.h>
+#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
diff --git a/src/editeur.cc b/src/editeur.cc
index 3c246fd..913b4f5 100644
--- a/src/editeur.cc
+++ b/src/editeur.cc
@@ -25,7 +25,8 @@
#include <windows.h>
#endif
-#include <iostream.h>
+#include <iostream>
+#include <ostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -374,7 +375,7 @@ void Editeur::PrendTouche(int Tou)
// Sauve le niveau
if(Niveau.Save()==false) {
- cerr <<"ERREUR Saving levels!"<<endl;
+ std::cerr <<"ERREUR Saving levels!"<<std::endl;
exit(-1);
}
diff --git a/src/jeux.cc b/src/jeux.cc
index 139cfb5..3c30f41 100644
--- a/src/jeux.cc
+++ b/src/jeux.cc
@@ -25,7 +25,7 @@
#include <windows.h>
#endif
-#include <iostream.h>
+#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/src/loco.cc b/src/loco.cc
index b49b2f7..0476e82 100644
--- a/src/loco.cc
+++ b/src/loco.cc
@@ -21,7 +21,7 @@
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#include <iostream.h>
+#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/src/main.cc b/src/main.cc
index 282d3b0..3f5187c 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -23,7 +23,8 @@
#include <stdio.h>
#include <stdlib.h>
-#include <iostream.h>
+#include <iostream>
+#include <ostream>
#include <string.h>
#include <SDL/SDL.h>
#include <SDL/SDL_mixer.h>
@@ -115,7 +116,7 @@ int main(int narg,char *argv[])
// Initilise SDL
if( SDL_Init(SDL_INIT_VIDEO|SDL_INIT_TIMER|SDL_INIT_AUDIO|SDL_INIT_NOPARACHUTE) < 0 ) {
- cerr <<"Impossible d'initialiser SDL:"<<SDL_GetError()<<endl;
+ std::cerr <<"Impossible d'initialiser SDL:"<<SDL_GetError()<<std::endl;
exit(-1);
}
// Ferme le programme correctement quant quit
@@ -125,7 +126,7 @@ int main(int narg,char *argv[])
sdlVideoInfo=(SDL_VideoInfo*)SDL_GetVideoInfo();
if(sdlVideoInfo->vfmt->BitsPerPixel==8) {
- cerr <<"Impossible d'utiliser 8bits pour la vidéo !"<<endl;
+ std::cerr <<"Impossible d'utiliser 8bits pour la vidéo !"<<std::endl;
exit(-1);
}
@@ -145,7 +146,7 @@ int main(int narg,char *argv[])
sdlVideo=SDL_SetVideoMode(800,600,sdlVideoInfo->vfmt->BitsPerPixel,vOption);
if(sdlVideo==NULL) {
- cerr <<"Impossible de passer dans le mode vidéo 800x600 !"<<endl;
+ std::cerr <<"Impossible de passer dans le mode vidéo 800x600 !"<<std::endl;
exit(-1);
}
// Change le nom de la fenetre
diff --git a/src/menu.cc b/src/menu.cc
index e1c455c..af8e599 100644
--- a/src/menu.cc
+++ b/src/menu.cc
@@ -21,7 +21,8 @@
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#include <iostream.h>
+#include <iostream>
+#include <ostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -92,7 +93,7 @@ void ChangeVideo(void)
// Teste la resolution video
sdlVideoInfo=(SDL_VideoInfo*)SDL_GetVideoInfo();
if(sdlVideoInfo->vfmt->BitsPerPixel==8) {
- cerr <<"Impossible d'utiliser 8bits pour la vidéo !"<<endl;
+ std::cerr <<"Impossible d'utiliser 8bits pour la vidéo !"<<std::endl;
exit(-1);
}
@@ -112,7 +113,7 @@ void ChangeVideo(void)
if(Pref.FullScreen) vOption|=SDL_FULLSCREEN;
sdlVideo=SDL_SetVideoMode(800,600,sdlVideoInfo->vfmt->BitsPerPixel,vOption);
if(sdlVideo==NULL) {
- cerr <<"Impossible de passer dans le mode vidéo 800x600 !"<<endl;
+ std::cerr <<"Impossible de passer dans le mode vidéo 800x600 !"<<std::endl;
exit(-1);
}
diff --git a/src/mouse.cc b/src/mouse.cc
index 6b899d4..a0656ef 100644
--- a/src/mouse.cc
+++ b/src/mouse.cc
@@ -21,7 +21,7 @@
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#include <iostream.h>
+#include <iostream>
#include <stdio.h>
#include "mouse.h"
#include "preference.h"
diff --git a/src/sprite.cc b/src/sprite.cc
index 251bfde..46003c6 100644
--- a/src/sprite.cc
+++ b/src/sprite.cc
@@ -21,7 +21,8 @@
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#include <iostream.h>
+#include <iostream>
+#include <ostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -84,7 +85,7 @@ bool LoadLangue()
strcpy(PathFile,Langue[Pref.Langue]);
GetPath(PathFile);
if(FileExiste(PathFile)==false) {
- cerr <<"Impossible de trouver "<<Langue[Pref.Langue]<<endl;
+ std::cerr <<"Impossible de trouver "<<Langue[Pref.Langue]<<std::endl;
return false;
}
L=ChargeFichier(PathFile,Buf);
@@ -128,7 +129,7 @@ bool LoadSprites()
// *** Charge le fichier des langues ***
// *************************************
if(FileExiste(PathFile)==false) {
- cerr <<"Impossible de trouver 'language.dat'"<<endl;
+ std::cerr <<"Impossible de trouver 'language.dat'"<<std::endl;
return false;
}
L=ChargeFichier(PathFile,Buf);
@@ -163,7 +164,7 @@ bool LoadSprites()
strcpy(PathFile,"sprites.dat");
GetPath(PathFile);
if(FileExiste(PathFile)==false) {
- cerr <<"Impossible de trouver 'sprites.dat'"<<endl;
+ std::cerr <<"Impossible de trouver 'sprites.dat'"<<std::endl;
return false;
}
L=ChargeFichier(PathFile,Buf);
@@ -352,7 +353,7 @@ bool Sprite::Load(unsigned char *Buf,long &P)
Image[i]=SDL_CreateRGBSurface((Dim[i].bpp-3)*SDL_SRCALPHA,Dim[i].L,Dim[i].H,Dim[i].bpp*8,
0xff,0xff00,0xff0000,0xff000000*(Dim[i].bpp-3));
if(Image[i]<=NULL) {
- cerr <<"Impossible de créer une Surface SDL!"<<endl;
+ std::cerr <<"Impossible de créer une Surface SDL!"<<std::endl;
return false;
}
@@ -486,7 +487,7 @@ bool Sprite::Nouveau(int Lx,int Ly)
Image[0]=SDL_CreateRGBSurface((Dim[0].bpp-3)*SDL_SRCALPHA,Dim[0].L,Dim[0].H,Dim[0].bpp*8,
0xff,0xff00,0xff0000,0xff000000*(Dim[0].bpp-3));
if(Image[0]<=NULL) {
- cerr <<"Impossible de créer une Surface SDL!"<<endl;
+ std::cerr <<"Impossible de créer une Surface SDL!"<<std::endl;
return false;
}
return true;
diff --git a/src/tableau.cc b/src/tableau.cc
index a849126..ddbc096 100644
--- a/src/tableau.cc
+++ b/src/tableau.cc
@@ -21,7 +21,7 @@
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#include <iostream.h>
+#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include "preference.h"
diff --git a/src/utils.cc b/src/utils.cc
index ef41f67..348566a 100644
--- a/src/utils.cc
+++ b/src/utils.cc
@@ -21,7 +21,8 @@
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#include <iostream.h>
+#include <iostream>
+#include <ostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -77,7 +78,7 @@ long ChargeFichier(const char *Path,unsigned char *&Buf)
file=fopen(Path,"r");
if(!file) {
- cerr <<"ERREUR: Impossible d'ouvrir '"<<Path<<"'"<<endl;
+ std::cerr <<"ERREUR: Impossible d'ouvrir '"<<Path<<"'"<<std::endl;
perror("fopen");
return -1;
}
@@ -93,7 +94,7 @@ long ChargeFichier(const char *Path,unsigned char *&Buf)
Buf=new unsigned char [L+1];
if(Buf==NULL) {
- cerr <<"ERREUR: Memoire insuffisante!"<<endl;
+ std::cerr <<"ERREUR: Memoire insuffisante!"<<std::endl;
fclose(file);
return -1;
}
@@ -104,7 +105,7 @@ long ChargeFichier(const char *Path,unsigned char *&Buf)
while(Compt>1024) {
AfficheChargeur();
if( fread(Po,1,1024,file) != 1024 ) {
- cerr <<"ERREUR de lecture du fichier '"<<Path<<"'"<<endl;
+ std::cerr <<"ERREUR de lecture du fichier '"<<Path<<"'"<<std::endl;
perror("fread");
fclose(file);
delete [] Buf;
@@ -131,13 +132,13 @@ long ChargeFichier(const char *Path,unsigned char *&Buf)
file=_lopen(Path,OF_READ);
if(file==-1) {
- cerr <<"Impossible d'ouvrir "<<Path<<endl;
+ std::cerr <<"Impossible d'ouvrir "<<Path<<std::endl;
exit(-1);
}
long L=(long)_llseek(file,0,SEEK_END);
if(L==-1) {
- cerr <<"Impossible de trouver la longueur du fichier"<<endl;
+ std::cerr <<"Impossible de trouver la longueur du fichier"<<std::endl;
perror("lseek");
_lclose(file);
return -1;
@@ -146,7 +147,7 @@ long ChargeFichier(const char *Path,unsigned char *&Buf)
Buf=new unsigned char [L+1];
if(Buf==NULL) {
- cerr <<"ERREUR: Memoire insuffisante!"<<endl;
+ std::cerr <<"ERREUR: Memoire insuffisante!"<<std::endl;
_lclose(file);
return -1;
}
@@ -169,14 +170,14 @@ bool SauveFichier(const char *Path,char *Buf,long L)
file=fopen(Path,"w");
if(!file) {
- cerr <<"ERREUR: Impossible d'ouvrir '"<<Path<<"'"<<endl;
+ std::cerr <<"ERREUR: Impossible d'ouvrir '"<<Path<<"'"<<std::endl;
perror("fopen");
return false;
}
while(L>512) {
if( fwrite(Buf,1,512,file) != 512 ) {
- cerr <<"ERREUR d'ecriture du fichier '"<<Path<<"'"<<endl;
+ std::cerr <<"ERREUR d'ecriture du fichier '"<<Path<<"'"<<std::endl;
perror("fwrite");
fclose(file);
return false;
@@ -187,7 +188,7 @@ bool SauveFichier(const char *Path,char *Buf,long L)
if(L>0) {
if( fwrite(Buf,1,(size_t)L,file) != (size_t)L ) {
- cerr <<"ERREUR d'ecriture du fichier '"<<Path<<"'"<<endl;
+ std::cerr <<"ERREUR d'ecriture du fichier '"<<Path<<"'"<<std::endl;
perror("fwrite");
fclose(file);
return false;
@@ -208,7 +209,7 @@ bool SauveFichier(const char *Path,char *Buf,long L)
file=_lcreat(Path,0);
if(!file) {
- cerr <<"ERREUR: Impossible de créer le fichier '"<<Path<<"'"<<endl;
+ std::cerr <<"ERREUR: Impossible de créer le fichier '"<<Path<<"'"<<std::endl;
return false;
}
@@ -216,7 +217,7 @@ bool SauveFichier(const char *Path,char *Buf,long L)
_lclose(file);
if(Lec!=L) {
- cerr <<"Problème d'ecriture du fichier '"<<Path<<"' ecris="<<Lec<<" au lieux de ="<<L<<endl;
+ std::cerr <<"Problème d'ecriture du fichier '"<<Path<<"' ecris="<<Lec<<" au lieux de ="<<L<<std::endl;
return false;
}
@@ -250,7 +251,7 @@ void GetPath(char *Path)
sprintf(Path,"/usr/share/games/Ri-li/%s",Provi);
if(FileExiste(Path)) return;
- cerr <<"Impossible de trouver le fichier '"<<Provi<<endl;
+ std::cerr <<"Impossible de trouver le fichier '"<<Provi<<std::endl;
exit(-1);
}
#endif
@@ -266,7 +267,7 @@ void GetPath(char *Path)
sprintf(Path,"PROGDIR:%s",Provi);
if(FileExiste(Path)) return;
- cerr <<"Impossible de trouver le fichier '"<<Path<<endl;
+ std::cerr <<"Impossible de trouver le fichier '"<<Path<<std::endl;
exit(-1);
}
#endif
@@ -282,7 +283,7 @@ void GetPath(char *Path)
sprintf(Path,"Ri-li.app/Contents/Resources/%s",Provi);
if(FileExiste(Path)) return;
- cerr <<"Impossible de trouver le fichier '"<<Path<<endl;
+ std::cerr <<"Impossible de trouver le fichier '"<<Path<<std::endl;
exit(-1);
}
#endif
--
2.19.1
From 5bdc61b8ba4f59c64a2414da2fb9ae6258445e70 Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Tue, 18 Dec 2018 08:46:37 +0100
Subject: fix save/load settings location
diff --git a/src/utils.cc b/src/utils.cc
index 348566a..f32c214 100644
--- a/src/utils.cc
+++ b/src/utils.cc
@@ -33,6 +33,11 @@
#include <commdlg.h>
#endif
+#ifdef __HAIKU__
+#include <FindDirectory.h>
+#include <Path.h>
+#endif
+
#include "utils.h"
#include "preference.h"
#include "sprite.h"
@@ -227,7 +232,7 @@ bool SauveFichier(const char *Path,char *Buf,long L)
/*** Met le bon chemin pour charger un fichier ***/
/*************************************************/
-#if defined(LINUX) && !defined(__AMIGAOS4__)
+#if defined(LINUX) && !defined(__AMIGAOS4__) && !defined(__HAIKU__)
// Version Linux
void GetPath(char *Path)
{
@@ -272,6 +277,27 @@ void GetPath(char *Path)
}
#endif
+#ifdef __HAIKU__
+// Version Haiku
+void GetPath(char *Path)
+{
+ char Provi[512];
+
+ strcpy(Provi,Path);
+
+ if(DefPath[0]) {
+ sprintf(Path,"%s%s",DefPath,Provi);
+ if(FileExiste(Path)) return;
+ }
+
+ sprintf(Path,"%s/%s",DATA_DIR,Provi);
+ if(FileExiste(Path)) return;
+
+ std::cerr <<"Impossible de trouver le fichier '"<<Path<<std::endl;
+ exit(-1);
+}
+#endif
+
#ifdef MAC_OSX
// Version Mac OSX
void GetPath(char *Path)
@@ -301,7 +327,7 @@ bool LoadPref(void)
int L;
unsigned char *Provi;
-#if defined(LINUX) && !defined(__AMIGAOS4__)
+#if defined(LINUX) && !defined(__AMIGAOS4__) && !defined(__HAIKU__)
char PathPref[512];
char *Env=getenv("HOME");
sprintf(PathPref,"%s/.ri-li.pref",Env);
@@ -309,6 +335,12 @@ bool LoadPref(void)
char PathPref[512];
char *Env="PROGDIR:";
sprintf(PathPref,"%s.ri-li.pref",Env);
+#elif defined(__HAIKU__)
+ BPath SettingPath;
+ if (find_directory(B_USER_SETTINGS_DIRECTORY,&SettingPath) != B_OK)
+ return false;
+ char PathPref[512];
+ sprintf(PathPref,"%s/ri-li.pref",SettingPath.Path());
#endif
#ifdef MAC_OSX
@@ -338,7 +370,7 @@ bool LoadPref(void)
/*****************************/
void SauvePref(void)
{
-#if defined(LINUX) && !defined(__AMIGAOS4__)
+#if defined(LINUX) && !defined(__AMIGAOS4__) && !defined(__HAIKU__)
char Provi[512];
char *Env=getenv("HOME");
sprintf(Provi,"%s/.ri-li.pref",Env);
@@ -348,6 +380,14 @@ void SauvePref(void)
char *Env="PROGDIR:";
sprintf(Provi,"%s.ri-li.pref",Env);
SauveFichier(Provi,(char*)&Pref,sizeof(sPreference));
+#elif defined(__HAIKU__)
+ BPath SettingPath;
+ char Provi[512];
+ if (find_directory(B_USER_SETTINGS_DIRECTORY,&SettingPath) == B_OK) {
+ sprintf(Provi,"%s/ri-li.pref",SettingPath.Path());
+ SauveFichier(Provi,(char*)&Pref,sizeof(sPreference));
+ } else
+ SauveFichier("",NULL,0);
#endif
#ifdef MAC_OSX
--
2.19.1
From d1105578fb6f4c05c79eb14ed198237a71ec9889 Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Tue, 18 Dec 2018 09:24:24 +0100
Subject: link against -lbe
diff --git a/configure.in b/configure.in
index 3c20bad..fa3bba0 100644
--- a/configure.in
+++ b/configure.in
@@ -20,6 +20,7 @@ AC_CHECK_LIB([SDL], [SDL_Init])
AC_CHECK_LIB([SDL_mixer], [Mix_OpenAudio])
AC_CHECK_LIB([pthread], [pthread_create])
AC_CHECK_LIB([m],[sqrt])
+AC_CHECK_LIB([be],[main])
# Checks for header files.
AC_HEADER_STDC
--
2.19.1