diff --git a/Makefile b/Makefile index 4da6a8ea..e07f0709 100644 --- a/Makefile +++ b/Makefile @@ -47,7 +47,31 @@ else NOTTF = 1 else - # Linux specific + #BeOS specific + ifeq ($(PLATFORM),BeOS) + DELCOMMAND = rm -rf + MKDIR = mkdir -p + BIN = grafx2 + CFGBIN = gfxcfg + COPT = -W -Wall -c -g `sdl-config --cflags` $(TTFCOPT) + LOPT = `sdl-config --libs` -lSDL_image -lpng -ljpeg -lz $(TTFLOPT) + CC = gcc + OBJDIR = obj/beos + else + + #Haiku specific + ifeq ($(PLATFORM),Haiku) + DELCOMMAND = rm -rf + MKDIR = mkdir -p + BIN = grafx2 + CFGBIN = gfxcfg + COPT = -W -Wall -c -g `sdl-config --cflags` $(TTFCOPT) + LOPT = `sdl-config --libs` -lSDL_image -lpng -ljpeg -lz $(TTFLOPT) + CC = gcc + OBJDIR = obj/haiku + else + + # Linux specific DELCOMMAND = rm -rf MKDIR = mkdir -p ifdef WIN32CROSS @@ -68,6 +92,8 @@ else endif endif endif +endif +endif #TrueType is optional: make NOTTF=1 to disable support and dependencies. ifeq ($(NOTTF),1) @@ -77,7 +103,7 @@ ifeq ($(NOTTF),1) TTFLABEL = -nottf else TTFCOPT = - TTFLOPT = -L/usr/local/lib -lSDL_ttf + TTFLOPT = `sdl-config --libs` -lSDL_ttf TTFLIBS = libfreetype-6.dll SDL_ttf.dll TTFLABEL = endif diff --git a/aide.c b/aide.c index 4d63ab52..f98dc99a 100644 --- a/aide.c +++ b/aide.c @@ -45,9 +45,13 @@ #endif #else #ifndef __amigaos4__ +#ifndef __BEOS__ +#ifndef __HAIKU__ #include #endif #endif +#endif +#endif extern char SVNRevision[]; @@ -317,7 +321,7 @@ void Bouton_Stats(void) struct statfs Informations_Disque; uint64_t Taille = 0; #else - #ifdef __amigaos4__ + #if defined(__amigaos4__)||defined(__BEOS__)||defined(__HAIKU__) uint64_t Taille = 0; #else unsigned __int64 Taille; @@ -368,11 +372,11 @@ void Bouton_Stats(void) #ifdef __linux__ statfs(Principal_Repertoire_courant,&Informations_Disque); Taille=Informations_Disque.f_bfree * Informations_Disque.f_bsize; - #else - #ifdef __amigaos4__ #else - GetDiskFreeSpaceEx(Principal_Repertoire_courant,&tailleU,NULL,NULL); - Taille = tailleU.QuadPart; + #if defined(__amigaos4__)||defined(__BEOS__)||defined(__HAIKU__) + #else + GetDiskFreeSpaceEx(Principal_Repertoire_courant,&tailleU,NULL,NULL); + Taille = tailleU.QuadPart; #endif #endif diff --git a/divers.c b/divers.c index 8e1016c2..e0c975f0 100644 --- a/divers.c +++ b/divers.c @@ -156,6 +156,7 @@ void Get_input(void) SDL_Event event; Touche=0; + { byte ok = 0; if( SDL_PollEvent(&event)) /* Il y a un évènement en attente */ @@ -363,6 +364,7 @@ void Get_input(void) // Vidage de toute mise à jour de l'affichage à l'écran qui serait encore en attente. // (c'est fait ici car on est sur que cette fonction est apellée partout ou on a besoin d'interragir avec l'utilisateur) Flush_update(); + } } diff --git a/files.c b/files.c index dd43a47b..7016959e 100644 --- a/files.c +++ b/files.c @@ -44,7 +44,7 @@ #include "io.h" -#ifdef __linux__ +#if defined(__linux__)||defined(__BEOS__)||defined(__HAIKU__) #include #define isHidden(Enreg) ((Enreg)->d_name[0]=='.') #elif defined(__amigaos4__) diff --git a/graph.c b/graph.c index c67e2e7e..5168839c 100644 --- a/graph.c +++ b/graph.c @@ -997,6 +997,7 @@ void Initialiser_mode_video(int Largeur, int Hauteur, int Fullscreen) int Sensibilite_X; int Sensibilite_Y; int Indice; + int Facteur; if (Largeur_ecran!=Largeur || Hauteur_ecran!=Hauteur || @@ -1011,7 +1012,6 @@ void Initialiser_mode_video(int Largeur, int Hauteur, int Fullscreen) Largeur = (Largeur + 3 ) & 0xFFFFFFFC; // Taille des menus - int Facteur; if (Largeur/320 > Hauteur/200) Facteur=Hauteur/200; else @@ -4484,13 +4484,14 @@ void Rectifier_coordonnees_a_45_degres(short AX, short AY, short* BX, short* BY) // - une droite avec une pente de 45 degrés { int dx, dy; + float tan; dx = (*BX)-AX; dy = AY- *BY; // On prend l'opposée car à l'écran les Y sont positifs en bas, et en maths, positifs en haut if (dx==0) return; // On est en lockx et de toutes façons le X n'a pas bougé, on sort tout de suite pour éviter une méchante division par 0 - float tan = (float)dy/(float)dx; + tan = (float)dy/(float)dx; if (tan <= 0.4142 && tan >= -0.4142) { @@ -5221,11 +5222,13 @@ void Tracer_rectangle_degrade(short RAX,short RAY,short RBX,short RBY,short VAX, } else { - Degrade_Intervalle_total = sqrt(pow(VBY - VAY,2)+pow(VBX - VAX,2)); - short a = (VBY - VAY)/(VBX - VAX); - short b = VAY - a*VAX; + short a,b; int Distance_X, Distance_Y; + Degrade_Intervalle_total = sqrt(pow(VBY - VAY,2)+pow(VBX - VAX,2)); + a = (VBY - VAY)/(VBX - VAX); + b = VAY - a*VAX; + for (Pos_Y=RAY;Pos_Y<=RBY;Pos_Y++) for (Pos_X = RAX;Pos_X<=RBX;Pos_X++) { diff --git a/init.c b/init.c index 4a5ebe2b..a96256f7 100644 --- a/init.c +++ b/init.c @@ -50,9 +50,13 @@ #ifndef __linux__ #ifndef __amigaos4__ +#ifndef __BEOS__ +#ifndef __HAIKU__ #include "windows.h" #endif #endif +#endif +#endif #ifdef __macosx__ #import @@ -112,7 +116,10 @@ void Rechercher_drives(void) char * Home = getenv("HOME"); Ajouter_lecteur('/', LECTEUR_HDD, "/"); Ajouter_lecteur('~', LECTEUR_HDD, Home ? Home : ""); - + #elif defined(__BEOS__) || defined(__HAIKU__) + char * Home = getenv("$HOME"); + Ajouter_lecteur('/', LECTEUR_HDD, "/"); + Ajouter_lecteur('~', LECTEUR_HDD, Home ? Home : ""); #elif defined(__amigaos4__) // No icons by default. // It's possible to add some here. @@ -189,10 +196,10 @@ void Charger_DAT(void) case EBADF: puts("filedes est un mauvais descripteur."); break; case EFAULT: puts("Un pointeur se trouve en dehors de l'espace d'adressage."); break; case ENAMETOOLONG: puts("Nom de fichier trop long."); break; - case ENOENT: puts("Un composant du chemin path n'existe pas, ou il s'agit d'une chaîne vide."); break; + case ENOENT: puts("The file path is empty or points to a non-existing directory."); break; case ENOMEM: puts("Pas assez de mémoire pour le noyau."); break; case ENOTDIR: puts("Un composant du chemin d'accès n'est pas un répertoire."); break; - #if defined(__linux__)||defined(__amigaos4__) + #if defined(__linux__)||defined(__amigaos4__)||defined(__BEOS__)||defined(__HAIKU__) case ELOOP: puts("Trop de liens symboliques rencontrés dans le chemin d'accès."); break; #endif } diff --git a/linux.c b/linux.c index 4f96b3b7..0cb7015b 100644 --- a/linux.c +++ b/linux.c @@ -20,7 +20,7 @@ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Diverses fonctions qui existaient sous dos mais pas sous linux... -#if defined(__linux__)||defined(__amigaos4__) +#if defined(__linux__)||defined(__amigaos4__)||defined(__BEOS__)||defined(__HAIKU__) #include #include diff --git a/main.c b/main.c index 88ebc07a..8dd2293d 100644 --- a/main.c +++ b/main.c @@ -51,12 +51,16 @@ #ifndef __linux__ #ifndef __amigaos4__ +#ifndef __BEOS__ +#ifndef __HAIKU__ #include #include #define chdir(dir) SetCurrentDirectory(dir) #define M_PI 3.14159265358979323846 #endif #endif +#endif +#endif #ifdef __macosx__ #import @@ -223,7 +227,7 @@ void Analyse_de_la_ligne_de_commande(int argc,char * argv[]) // On récupère le chemin complet du paramètre // Et on découpe ce chemin en répertoire(path) + fichier(.ext) - #if defined(__linux__) || defined(__amigaos4__) + #if defined(__linux__) || defined(__amigaos4__) || defined(__BEOS__) || defined(__HAIKU__) Buffer=realpath(argv[Indice],NULL); #else Buffer = malloc(TAILLE_CHEMIN_FICHIER); @@ -233,9 +237,13 @@ void Analyse_de_la_ligne_de_commande(int argc,char * argv[]) Extraire_nom_fichier(Principal_Nom_fichier, Buffer); #ifndef __linux__ #ifndef __amigaos4__ + #ifndef __BEOS__ + #ifndef __HAIKU__ free(Buffer); #endif #endif + #endif + #endif chdir(Principal_Repertoire_fichier); } else diff --git a/operatio.c b/operatio.c index 356fed3a..d794462a 100644 --- a/operatio.c +++ b/operatio.c @@ -4239,7 +4239,7 @@ void Rectangle_Degrade_0_5(void) short RAX; short RAY; short RBX; - short RBY; + short RBY, largeur,hauteur; // Tracé propre du rectangle @@ -4252,8 +4252,8 @@ void Rectangle_Degrade_0_5(void) Pinceau_Y = RAY; Effacer_curseur(); - short largeur = abs(RBX-RAX); - short hauteur = abs(RBY-RAY); + largeur = abs(RBX-RAX); + hauteur = abs(RBY-RAY); Ligne_horizontale_XOR(Min(RAX,RBX),Min(RAY,RBY),largeur); Ligne_horizontale_XOR(Min(RAX,RBX),Max(RAY,RBY)-1,largeur); Ligne_verticale_XOR(Min(RAX,RBX),Min(RAY,RBY),hauteur); diff --git a/tables_aide.h b/tables_aide.h index d617dab6..4b6a14b8 100644 --- a/tables_aide.h +++ b/tables_aide.h @@ -255,6 +255,10 @@ static const char * TableAideCredits[] = AIDE_TEXTE("") // AIDE_TEXTE(" hitchhikr") // AIDE_TEXTE("") + AIDE_BOLD (" HAIKU OS AND BEOS PORT") // + AIDE_TEXTE("") // + AIDE_TEXTE(" Luc Schrijvers (begasus@skynet.be)") // + AIDE_TEXTE("") AIDE_BOLD(" BUGFINDERS") // AIDE_TEXTE("") // AIDE_TEXTE(" Ced El Topo fallenblood Frost")