diff --git a/CMakeLists.txt b/CMakeLists.txt index 4341704..402ff00 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,12 +36,12 @@ set(CMAKE_CXX_EXTENSIONS OFF) add_executable(${LIRI_EXECUTABLE_NAME} WIN32 src/audio.cc src/audio.h - src/ecran.cc - src/ecran.h - src/editeur.cc - src/editeur.h - src/jeux.cc - src/jeux.h + src/screen.cc + src/screen.h + src/editor.cc + src/editor.h + src/game.cc + src/game.h src/loco.cc src/loco.h src/main.cc @@ -51,8 +51,8 @@ add_executable(${LIRI_EXECUTABLE_NAME} WIN32 src/mouse.h src/sprite.cc src/sprite.h - src/tableau.cc - src/tableau.h + src/level.cc + src/level.h src/utils.cc src/utils.h ) diff --git a/android/app/src/main/jni/src/Android.mk b/android/app/src/main/jni/src/Android.mk index 5b974cf..daca552 100644 --- a/android/app/src/main/jni/src/Android.mk +++ b/android/app/src/main/jni/src/Android.mk @@ -12,15 +12,15 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/$(SDL_PATH)/ \ # Add your application source files here... LOCAL_SRC_FILES := $(SDL_PATH)/src/main/android/SDL_android_main.c \ ../../../../../../src/audio.cc \ - ../../../../../../src/ecran.cc \ - ../../../../../../src/editeur.cc \ - ../../../../../../src/jeux.cc \ + ../../../../../../src/editor.cc \ + ../../../../../../src/game.cc \ + ../../../../../../src/level.cc \ ../../../../../../src/loco.cc \ ../../../../../../src/main.cc \ ../../../../../../src/menu.cc \ ../../../../../../src/mouse.cc \ + ../../../../../../src/screen.cc \ ../../../../../../src/sprite.cc \ - ../../../../../../src/tableau.cc \ ../../../../../../src/utils.cc \ LOCAL_SHARED_LIBRARIES := SDL2 SDL2_mixer diff --git a/src/audio.cc b/src/audio.cc index 53ae2fa..fdf4626 100644 --- a/src/audio.cc +++ b/src/audio.cc @@ -1,12 +1,12 @@ // (_||_/ -// ( ) Classe Audio +// ( ) // ( o 0 ) //-OOO°--(_)---°OOO--------------------------------------- // Copyright (C) 2006 By Dominique Roux-Serret // .OOOo oOOO. roux-serret@ifrance.com //-( )------( )--------------------------------------- -// ( ( ) / Le 27/05/2006 -// (_) (_/ +// ( ( ) / Copyright (C) 2023 By Johnny Jazeix +// (_) (_/ jazeix@gmail.com // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/audio.h b/src/audio.h index 206ab04..5c4ed5d 100644 --- a/src/audio.h +++ b/src/audio.h @@ -1,12 +1,12 @@ // (_||_/ -// ( ) Classe Audio +// ( ) Audio class // ( o 0 ) //-OOO°--(_)---°OOO--------------------------------------- // Copyright (C) 2006 By Dominique Roux-Serret // .OOOo oOOO. roux-serret@ifrance.com //-( )------( )--------------------------------------- -// ( ( ) / Le 27/05/2006 -// (_) (_/ +// ( ( ) / Copyright (C) 2023 By Johnny Jazeix +// (_) (_/ jazeix@gmail.com // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/editeur.cc b/src/editor.cc similarity index 69% rename from src/editeur.cc rename to src/editor.cc index 5bacc13..4dac345 100644 --- a/src/editeur.cc +++ b/src/editor.cc @@ -1,12 +1,12 @@ // (_||_/ -// ( ) Classe Editeur +// ( ) // ( o 0 ) //-OOO°--(_)---°OOO--------------------------------------- // Copyright (C) 2006 By Dominique Roux-Serret // .OOOo oOOO. roux-serret@ifrance.com //-( )------( )--------------------------------------- -// ( ( ) / Le 04/04/2006 -// (_) (_/ +// ( ( ) / Copyright (C) 2023 By Johnny Jazeix +// (_) (_/ jazeix@gmail.com // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -25,10 +25,10 @@ #include #include -#include "editeur.h" +#include "editor.h" #include "menu.h" -#include "jeux.h" -#include "tableau.h" +#include "game.h" +#include "level.h" #include "mouse.h" /*** Variables globales ***/ @@ -41,23 +41,23 @@ extern sPreference Pref; extern int Horloge; extern int HorlogeAvant; -extern Tableau Niveau; -extern Mouse Sourie; -extern Jeux Jeu; +extern Level level; +extern Mouse mouse; +extern Game game; static int NumRail[]={ 10,10,10,0,10,1,2,3,10,4,5,6,7,8,9,10 }; /*** Constructeur et Destructeur ***/ /***********************************/ -Editeur::Editeur() : N(0), NumDeco(0) +Editor::Editor() : N(0), NumDeco(0) { } -Editeur::~Editeur() +Editor::~Editor() { } /*** SDL Main ***/ /****************/ -eMenu Editeur::SDLMain(int NumNiv) +eMenu Editor::SDLMain(int NumNiv) { int PyE; int cx=0,cy=0; @@ -75,13 +75,13 @@ eMenu Editeur::SDLMain(int NumNiv) Option=rail; // Initialise la sourie - Sourie.Init(NULL); + mouse.Init(NULL); // Prend les evenements do { SDL_Event event; while(SDL_PollEvent(&event)) { - Sourie.GetEvent(event,PyE); // Prend les evenements de la sourie + mouse.GetEvent(event,PyE); // Prend les evenements de la sourie switch(event.type) { case SDL_WINDOWEVENT: if(event.window.event==SDL_WINDOWEVENT_ENTER) Affiche(); @@ -101,7 +101,7 @@ eMenu Editeur::SDLMain(int NumNiv) case SDL_MOUSEBUTTONUP: Boutton=false; if(TypeB!=-1 && Option==deco && cx>=LT) { // Si doit effacer une décoration - Niveau.T[NumN].NDeco--; + level.T[NumN].NDeco--; } TypeB=-1; break; @@ -112,75 +112,75 @@ eMenu Editeur::SDLMain(int NumNiv) } // Gère l'appuis du boutton de la sourie - cx=Sourie.Px/D_Case; - cy=Sourie.Py/D_Case; + cx=mouse.Px/D_Case; + cy=mouse.Py/D_Case; if(Boutton && cx #include -#include "jeux.h" -#include "ecran.h" +#include "game.h" +#include "screen.h" #include "menu.h" #include "sprite.h" -#include "tableau.h" +#include "level.h" #include "audio.h" /*** Variables globales ***/ @@ -42,10 +42,10 @@ extern sPreference Pref; extern int Horloge; extern int HorlogeAvant; -extern Ecran Ec; -extern Menu MenuPrincipale; +extern Screen Ec; +extern Menu MainMenu; -extern Tableau Niveau; +extern Level level; extern Audio Sons; static int NumRail[]={ -1,-1,-1,0,-1,1,2,3,-1,4,5,6,7,8,9,10 }; @@ -54,7 +54,7 @@ int MasqueK; // Masque pour les touches de déplacement /*** Constructeur et Destructeur ***/ /***********************************/ -Jeux::Jeux() +Game::Game() { NumSS=0; Touche[0]=D_Haut; @@ -63,12 +63,12 @@ Jeux::Jeux() Touche[3]=D_Droite; } -Jeux::~Jeux() +Game::~Game() { } /*** SDL Main ***/ /****************/ -eMenu Jeux::SDLMain(void) +eMenu Game::SDLMain(void) { eMenu mRet; int NumN=Pref.Niveau; @@ -76,7 +76,7 @@ eMenu Jeux::SDLMain(void) Help=true; Load(NumN); // Charge le tableau SDL_RenderPresent(sdlRenderer); - Ec.Cls(fjeu); + Ec.CleanSpriteAndScreen(fjeu); Pause=true; Horloge=SDL_GetTicks(); // Prend l'horloge @@ -106,8 +106,8 @@ eMenu Jeux::SDLMain(void) int Px=event.button.x; int Py=event.button.y; if(Px>=680 && Py<=90) { - mRet=MenuPrincipale.SDLMain_InGame(); - if(mRet==mJeux) { + mRet=MainMenu.SDLMain_InGame(); + if(mRet==mGame) { DrawLevel(NumN); SDL_RenderPresent(sdlRenderer); Pause=true; @@ -125,8 +125,8 @@ eMenu Jeux::SDLMain(void) case SDL_KEYDOWN: if(event.key.state==SDL_PRESSED) { if(event.key.keysym.sym==SDLK_ESCAPE) { - mRet=MenuPrincipale.SDLMain_InGame(); - if(mRet==mJeux) { + mRet=MainMenu.SDLMain_InGame(); + if(mRet==mGame) { DrawLevel(NumN); SDL_RenderPresent(sdlRenderer); Pause=true; @@ -200,10 +200,10 @@ eMenu Jeux::SDLMain(void) if(Pref.NVie<0) return mScoreEdit; // Si mort fini if(Lo.Gagne) { #ifndef DCHILDREN - if(MenuPrincipale.SDLMain_HR()==mQuit) return mQuit; + if(MainMenu.SDLMain_HR()==mQuit) return mQuit; #endif NumN++; - if(Niveau.N==NumN) { + if(level.N==NumN) { Pref.Score+=Pref.NVie*100; return mScoreEdit; } @@ -223,14 +223,14 @@ eMenu Jeux::SDLMain(void) /*** Charge un tableau ***/ /*************************/ -bool Jeux::Load(int NivN) +bool Game::Load(int NivN) { int i; Pref.Niveau=NivN; // Recopie le tableau - for(i=0;iECARTWAGON_MOY) Ec.Affiche(pluslong,(DureeJeu*40/1000)%50,715,295); - if(Pref.VitesseMoy>Pref.Vitesse) Ec.Affiche(vitesse,(DureeJeu*40/1000+7)%50,765,295); + Ec.PrintOptions(Pref.NVie,Pref.Score); + if(Pref.EcartWagonECARTWAGON_MOY) Ec.PrintSprite(pluslong,(DureeJeu*40/1000)%50,715,295); + if(Pref.VitesseMoy>Pref.Vitesse) Ec.PrintSprite(vitesse,(DureeJeu*40/1000+7)%50,765,295); } diff --git a/src/jeux.h b/src/game.h similarity index 90% rename from src/jeux.h rename to src/game.h index 8326a7e..1279045 100644 --- a/src/jeux.h +++ b/src/game.h @@ -1,12 +1,12 @@ // (_||_/ -// ( ) Classe Jeux +// ( ) Game class // ( o 0 ) //-OOO°--(_)---°OOO--------------------------------------- // Copyright (C) 2006 By Dominique Roux-Serret // .OOOo oOOO. roux-serret@ifrance.com //-( )------( )--------------------------------------- -// ( ( ) / Le 01/02/2006 -// (_) (_/ +// ( ( ) / Copyright (C) 2023 By Johnny Jazeix +// (_) (_/ jazeix@gmail.com // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -21,18 +21,18 @@ // with this program; if not, write to the Free Software Foundation, Inc., // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -#ifndef _JEUX_DOM_ -#define _JEUX_DOM_ +#ifndef _GAME_DOM_ +#define _GAME_DOM_ #include "preference.h" #include "loco.h" /*** Définition de la class ***/ /******************************/ -class Jeux { +class Game { public: - Jeux(void); - ~Jeux(void); + Game(void); + ~Game(void); /*** Fonctions ***/ /*****************/ diff --git a/src/tableau.cc b/src/level.cc similarity index 89% rename from src/tableau.cc rename to src/level.cc index ea02082..ebc0dae 100644 --- a/src/tableau.cc +++ b/src/level.cc @@ -1,12 +1,12 @@ // (_||_/ -// ( ) Classe Sprite +// ( ) // ( o 0 ) //-OOO°--(_)---°OOO--------------------------------------- // Copyright (C) 2006 By Dominique Roux-Serret // .OOOo oOOO. roux-serret@ifrance.com //-( )------( )--------------------------------------- -// ( ( ) / Le 3/04/2006 -// (_) (_/ +// ( ( ) / Copyright (C) 2023 By Johnny Jazeix +// (_) (_/ jazeix@gmail.com // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -24,23 +24,23 @@ #include #include "preference.h" #include "utils.h" -#include "tableau.h" +#include "level.h" /*** Constructeurs ***/ /*********************/ -Tableau::Tableau(void) : N(0) +Level::Level(void) : N(0) { int i; for(i=0;i #include "preference.h" -#include "jeux.h" +#include "game.h" #include "audio.h" #include "sprite.h" -#include "ecran.h" +#include "screen.h" #include "mouse.h" #include "menu.h" -#include "tableau.h" -#include "editeur.h" +#include "level.h" +#include "editor.h" #include "utils.h" /*** Variables globales ***/ @@ -47,13 +47,13 @@ char Titre[]="Li-ri V3.0.1"; Sprite *Sprites=NULL; // Pointe sur les sprites int NSprites=0; // Nombre de sprites en mémoire -Ecran Ec; // Pointe sur les 2 buffets vidéo +Screen Ec; // Pointe sur les 2 buffets vidéo sPreference Pref; // Tableau des préférences. -Jeux Jeu; // Gère le jeu -Mouse Sourie; // Gère les mouvements de sourie -Menu MenuPrincipale; // Gère les menus -Tableau Niveau; // Gère les niveaux -Editeur Edit; // Gère le menu de l'éditeur +Game game; // Gère le jeu +Mouse mouse; // Gère les mouvements de sourie +Menu MainMenu; // Gère les menus +Level level; // Gère les niveaux +Editor Edit; // Gère le menu de l'éditeur Audio Sons; // Gère les sons int Horloge=0; // Horloges du jeu @@ -131,45 +131,45 @@ int main(int narg,char *argv[]) // Chargement des sprites Sons.Init(); if(LoadSprites()==false) exit(-1); - if(Niveau.Load()==false) exit(-1); + if(level.Load()==false) exit(-1); Sons.PlayMusic(); - Sourie.InitStart(); + mouse.InitStart(); // Initialise l'horloge et le hazard HorlogeAvant=Horloge=SDL_GetTicks(); srand(SDL_GetTicks()); // Si pas de langues demande la langue - if(Pref.Langue==-1) MenuPrincipale.SDLMain_Langue(); + if(Pref.Langue==-1) MainMenu.SDLMain_Language(); // Gère les menus do { switch(RetMenu) { case mMenu: - RetM=MenuPrincipale.SDLMain(); + RetM=MainMenu.SDLMain(); break; case mLangue: - RetM=MenuPrincipale.SDLMain_Langue(); + RetM=MainMenu.SDLMain_Language(); break; case mOption: - RetM=MenuPrincipale.SDLMain_Options(); + RetM=MainMenu.SDLMain_Options(); break; case mScoreEdit: - RetM=MenuPrincipale.SDLMain_Score(true); + RetM=MainMenu.SDLMain_Score(true); break; case mScore: - RetM=MenuPrincipale.SDLMain_Score(); + RetM=MainMenu.SDLMain_Score(); break; case mMenuSpeed: - RetM=MenuPrincipale.SDLMain_Speed(); + RetM=MainMenu.SDLMain_Speed(); break; case mMenuNiveau: - RetM=MenuPrincipale.SDLMain_Niveau(); + RetM=MainMenu.SDLMain_Level(); break; - case mJeux: + case mGame: Sons.LoadMusic(1); - RetM=Jeu.SDLMain(); + RetM=game.SDLMain(); Sons.LoadMusic(0); break; case mEdit: diff --git a/src/menu.cc b/src/menu.cc index 3c693c5..91d4cfa 100644 --- a/src/menu.cc +++ b/src/menu.cc @@ -1,12 +1,12 @@ // (_||_/ -// ( ) Classe Menu +// ( ) // ( o 0 ) //-OOO°--(_)---°OOO--------------------------------------- // Copyright (C) 2006 By Dominique Roux-Serret // .OOOo oOOO. roux-serret@ifrance.com //-( )------( )--------------------------------------- -// ( ( ) / Le 23/03/2006 -// (_) (_/ +// ( ( ) / Copyright (C) 2023 By Johnny Jazeix +// (_) (_/ jazeix@gmail.com // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -29,7 +29,7 @@ #include "preference.h" #include "menu.h" #include "sprite.h" -#include "ecran.h" +#include "screen.h" #include "mouse.h" #include "audio.h" @@ -42,8 +42,8 @@ extern int HorlogeAvant; extern SDL_Window *sdlWindow; extern SDL_Renderer *sdlRenderer; extern Sprite *Sprites; -extern Mouse Sourie; -extern Ecran Ec; +extern Mouse mouse; +extern Screen Ec; extern sPreference Pref; extern Audio Sons; @@ -106,7 +106,7 @@ eMenu Menu::SDLMain(void) char key; // Initialisations Divers - Sourie.Init(Menu_Py); // Initialise la sourie + mouse.Init(Menu_Py); // Initialise la sourie PyE=0; // Prend les evenements @@ -129,7 +129,7 @@ eMenu Menu::SDLMain(void) Menu_Py[4].DepX=-1; SDL_Event event; while(SDL_PollEvent(&event)) { - Sourie.GetEvent(event,PyE); // Prend les evenements de la sourie + mouse.GetEvent(event,PyE); // Prend les evenements de la sourie switch(event.type) { case SDL_WINDOWEVENT: if(event.window.event==SDL_WINDOWEVENT_ENTER) { @@ -189,9 +189,9 @@ eMenu Menu::SDLMain(void) Sleeping(); // Gère l'Affichage - Ec.Efface(fmenu); - Affiche_Main(); - Sourie.Affiche(0); + Ec.ClearSprite(fmenu); + Print_Main(); + mouse.Print(); // Echange les buffets video SDL_RenderPresent(sdlRenderer); @@ -203,7 +203,7 @@ eMenu Menu::SDLMain(void) /*** SDL Main Menu Choix de la langue ***/ /****************************************/ -eMenu Menu::SDLMain_Langue(void) +eMenu Menu::SDLMain_Language(void) { int NCol=1; int NL; @@ -213,7 +213,7 @@ eMenu Menu::SDLMain_Langue(void) int OldLangue=Pref.Langue; // Initialisations Divers - Sourie.Init(Menu_Py); // Initialise la sourie + mouse.Init(Menu_Py); // Initialise la sourie PyE=Pref.Langue; if(PyE==-1) PyE=1; @@ -255,7 +255,7 @@ eMenu Menu::SDLMain_Langue(void) SDL_Event event; while(SDL_PollEvent(&event)) { - Sourie.GetEvent(event,PyE); // Prend les evenements de la sourie + mouse.GetEvent(event,PyE); // Prend les evenements de la sourie switch(event.type) { case SDL_WINDOWEVENT: if(event.window.event==SDL_WINDOWEVENT_ENTER) { @@ -309,10 +309,10 @@ eMenu Menu::SDLMain_Langue(void) Sleeping(); // Gère l'Affichage - Ec.Efface(fmenu); // Something is done in the Efface that prevents a crash (or maybe more computation)! + Ec.ClearSprite(fmenu); // Something is done in the Efface that prevents a crash (or maybe more computation)! Affiche_Main_Centre(); - Sourie.Affiche(0); + mouse.Print(); // Echange les buffets video SDL_RenderPresent(sdlRenderer); @@ -327,7 +327,7 @@ eMenu Menu::SDLMain_Langue(void) void Menu::InitMain_Options(void) { // Initialisations Divers - Sourie.Init(Menu_Py); // Initialise la sourie + mouse.Init(Menu_Py); // Initialise la sourie //PyE=4; // Prend l'image du fond et fait l'affichage @@ -398,12 +398,12 @@ eMenu Menu::SDLMain_Options(void) PyE=4; // Prend les evenements do { - Ec.Cls(fmenu); // To not crash... + Ec.CleanSpriteAndScreen(fmenu); // To not crash... SDL_RenderClear(sdlRenderer); InitMain_Options(); // Prépare le menu SDL_Event event; while(SDL_PollEvent(&event)) { - Sourie.GetEvent(event,PyE); // Prend les evenements de la sourie + mouse.GetEvent(event,PyE); // Prend les evenements de la sourie switch(event.type) { case SDL_WINDOWEVENT: if(event.window.event==SDL_WINDOWEVENT_ENTER) { @@ -495,7 +495,7 @@ eMenu Menu::SDLMain_Options(void) PyE=2; break; case 3: // Choix de la langue - SDLMain_Langue(); + SDLMain_Language(); //InitMain_Options(); PyE=3; break; @@ -545,66 +545,66 @@ eMenu Menu::SDLMain_Options(void) //Ec.Efface(fmenu); if(Pref.FullScreen) { - Ec.Affiche(fleches,1,350,300); - Ec.Affiche(fleches,3,450,300); + Ec.PrintSprite(fleches,1,350,300); + Ec.PrintSprite(fleches,3,450,300); } else { - Ec.Affiche(fleches,0,350,300); - Ec.Affiche(fleches,4,450,300); + Ec.PrintSprite(fleches,0,350,300); + Ec.PrintSprite(fleches,4,450,300); } NumSp=(Horloge/30)%25; - Ec.Affiche(bruitage,NumSp,150,110); + Ec.PrintSprite(bruitage,NumSp,150,110); NumSp=(Horloge/30)%25; - Ec.Affiche(music,NumSp,150,200); + Ec.PrintSprite(music,NumSp,150,200); NumSp=(Horloge/50)%50; - Ec.Affiche(monde,NumSp,180,400); + Ec.PrintSprite(monde,NumSp,180,400); N=(int)(Pref.Volume*10+1)/SDL_MIX_MAXVOLUME; NumSp=(Horloge/50)%40+120; for(i=0;i0) { - if(PyE==3) Ec.Affiche(fleches,2,330,380); - else Ec.Affiche(fleches,1,330,380); + if(PyE==3) Ec.PrintSprite(fleches,2,330,380); + else Ec.PrintSprite(fleches,1,330,380); } - else Ec.Affiche(fleches,0,330,380); + else Ec.PrintSprite(fleches,0,330,380); if(Niv #include "mouse.h" #include "preference.h" -#include "ecran.h" +#include "screen.h" #include "audio.h" /*** Variables Globales ***/ /**************************/ extern Audio Sons; extern int Horloge; -extern Ecran Ec; +extern Screen Ec; extern SDL_Window *sdlWindow; /*** Constructeur et Destructeur ***/ @@ -58,7 +58,7 @@ void Mouse::InitStart(void) /*** Initialise un bebut d'utilisation ***/ /*****************************************/ -void Mouse::Init(struct mPy *TablePy,struct mBoutton *B) +void Mouse::Init(struct mPy *TablePy,struct mButton *B) { // Sauve les adresses utils tPy=TablePy; @@ -132,7 +132,7 @@ void Mouse::GetEvent(SDL_Event &event,int &pPy) /*** Affiche le curseur ***/ /**************************/ -void Mouse::Affiche(int NumVideo) +void Mouse::Print() { int X=Px,Y=Py; int NumSp=(Horloge/50)%20; @@ -145,6 +145,6 @@ void Mouse::Affiche(int NumVideo) #ifndef ANDROID // Affiche le curseur - Ec.Affiche(curseur,NumSp,X,Y); + Ec.PrintSprite(curseur,NumSp,X,Y); #endif } diff --git a/src/mouse.h b/src/mouse.h index e3a29e3..838fa22 100644 --- a/src/mouse.h +++ b/src/mouse.h @@ -1,12 +1,12 @@ // (_||_/ -// ( ) Class de la Sourie +// ( ) Mouse class // ( o 0 ) //-OOO°--(_)---°OOO--------------------------------------- // Copyright (C) 2006 By Dominique Roux-Serret // .OOOo oOOO. roux-serret@ifrance.com //-( )------( )--------------------------------------- -// ( ( ) / Le 23/03/2006 -// (_) (_/ +// ( ( ) / Copyright (C) 2023 By Johnny Jazeix +// (_) (_/ jazeix@gmail.com // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -21,8 +21,8 @@ // with this program; if not, write to the Free Software Foundation, Inc., // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -#ifndef _SOURIE_DOM_ -#define _SOURIE_DOM_ +#ifndef _MOUSE_DOM_ +#define _MOUSE_DOM_ #include @@ -35,7 +35,7 @@ struct mPy { // DepX==-1 si derniere entrée bool Valide; // Si doit valider un enter quand click de la sourie }; -struct mBoutton { // DepX=-1 si derniere entrée +struct mButton { // DepX=-1 si derniere entrée int DepX,DepY; int FinX,FinY; int Valeur; @@ -50,13 +50,13 @@ class Mouse { ~Mouse(void); void InitStart(void); // Initialise les coordonnées de la sourie - void Init(struct mPy *tPy,struct mBoutton *B=NULL); // Initialise la sourie + void Init(struct mPy *tPy,struct mButton *B=NULL); // Initialise la sourie void GetEvent(SDL_Event &event,int &Py); // Prend les evenements - void Affiche(int NumEcran); // Affiche le curseur + void Print(); // Affiche le curseur int Px,Py; // Position réel de la sourie struct mPy *tPy; // Pointe sur coordonées pour Py - struct mBoutton *Bo; // Pointe sur les coordonnées des bouttons + struct mButton *Bo; // Pointe sur les coordonnées des bouttons }; #endif diff --git a/src/preference.h b/src/preference.h index 41e7a13..d44cda0 100644 --- a/src/preference.h +++ b/src/preference.h @@ -1,12 +1,12 @@ // (_||_/ -// ( ) Structure des Preferences +// ( ) Preferences data // ( o 0 ) //-OOO°--(_)---°OOO--------------------------------------- // Copyright (C) 2006 By Dominique Roux-Serret // .OOOo oOOO. roux-serret@ifrance.com //-( )------( )--------------------------------------- -// ( ( ) / Le 14/01/2006 -// (_) (_/ +// ( ( ) / Copyright (C) 2023 By Johnny Jazeix +// (_) (_/ jazeix@gmail.com // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -104,7 +104,7 @@ enum eMenu { mMenuSpeed, mMenuNiveau, mLangue, - mJeux, + mGame, mScore, mScoreEdit, mOption, diff --git a/src/ecran.cc b/src/screen.cc similarity index 82% rename from src/ecran.cc rename to src/screen.cc index 992e7d3..f82c6e8 100644 --- a/src/ecran.cc +++ b/src/screen.cc @@ -1,12 +1,12 @@ // (_||_/ -// ( ) Classe Ecran +// ( ) // ( o 0 ) //-OOO°--(_)---°OOO--------------------------------------- // Copyright (C) 2006 By Dominique Roux-Serret // .OOOo oOOO. roux-serret@ifrance.com //-( )------( )--------------------------------------- -// ( ( ) / Le 12/01/2006 -// (_) (_/ +// ( ( ) / Copyright (C) 2023 By Johnny Jazeix +// (_) (_/ jazeix@gmail.com // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -23,7 +23,7 @@ #include "preference.h" #include "sprite.h" -#include "ecran.h" +#include "screen.h" /*** Variables globales ***/ /**************************/ @@ -31,15 +31,15 @@ extern Sprite *Sprites; /*** Constructeur ***/ /********************/ -Ecran::Ecran(void) : N(0), Score(-1) +Screen::Screen(void) : N(0), Score(-1) { } -Ecran::~Ecran(void) +Screen::~Screen(void) { } /*** Affiche un Sprite ***/ /*************************/ -void Ecran::Affiche(e_Sprite NumSpr,int Num,int x,int y) +void Screen::PrintSprite(e_Sprite NumSpr,int Num,int x,int y) { B[N].NumSpr=NumSpr; B[N].Num=Num; @@ -52,7 +52,7 @@ void Ecran::Affiche(e_Sprite NumSpr,int Num,int x,int y) /*** Affiche un cable ***/ /************************/ -void Ecran::AfficheCable(int dx,int dy,int fx,int fy) +void Screen::PrintCable(int dx,int dy,int fx,int fy) { // Affiche la corde Sprites[corde].AfficheCorde(dx,dy,fx,fy); @@ -69,7 +69,7 @@ void Ecran::AfficheCable(int dx,int dy,int fx,int fy) /*** Affiche un text ***/ /***********************/ -void Ecran::Affiche_Text(e_Sprite Text,int x,int y) +void Screen::PrintText(e_Sprite Text,int x,int y) { B[N].NumSpr=Text; B[N].Num=0; @@ -82,7 +82,7 @@ void Ecran::Affiche_Text(e_Sprite Text,int x,int y) /*** Affiche les options du jeu ***/ /**********************************/ -void Ecran::AfficheOptions(int NV,int NScore) +void Screen::PrintOptions(int NV,int NScore) { int x,y; @@ -101,14 +101,14 @@ void Ecran::AfficheOptions(int NV,int NScore) /*** Efface les sprites ***/ /**************************/ -void Ecran::Efface(e_Sprite NumSp) +void Screen::ClearSprite(e_Sprite NumSp) { N=0; } /*** Efface l'ecran avec l'image de fond ***/ /*******************************************/ -void Ecran::Cls(e_Sprite NumSp) +void Screen::CleanSpriteAndScreen(e_Sprite NumSp) { Sprites[NumSp].Affiche(Sprites[NumSp].Dim[0].L/2,Sprites[NumSp].Dim[0].H/2,0); N=0; diff --git a/src/ecran.h b/src/screen.h similarity index 64% rename from src/ecran.h rename to src/screen.h index 9cb121b..b5c1169 100644 --- a/src/ecran.h +++ b/src/screen.h @@ -1,12 +1,12 @@ // (_||_/ -// ( ) Classe Ecran (Gère un buffet d'écran) +// ( ) Screen class // ( o 0 ) //-OOO°--(_)---°OOO--------------------------------------- // Copyright (C) 2006 By Dominique Roux-Serret // .OOOo oOOO. roux-serret@ifrance.com //-( )------( )--------------------------------------- -// ( ( ) / Le 12/01/2006 -// (_) (_/ +// ( ( ) / Copyright (C) 2023 By Johnny Jazeix +// (_) (_/ jazeix@gmail.com // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -21,15 +21,15 @@ // with this program; if not, write to the Free Software Foundation, Inc., // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -#ifndef _ECRAN_DOM_ -#define _ECRAN_DOM_ +#ifndef _SCREEN_DOM_ +#define _SCREEN_DOM_ #include "sprite.h" #include "preference.h" /*** Définitions générales ***/ /*****************************/ -struct s_Ecran { +struct s_Screen { e_Sprite NumSpr; int Num; int x,y; @@ -38,24 +38,24 @@ struct s_Ecran { /*** Definitions de la class Ecran ***/ /*************************************/ -class Ecran +class Screen { public: - Ecran(void); - ~Ecran(void); + Screen(void); + ~Screen(void); /*** Fonctions ***/ - void Affiche(e_Sprite NumSpr,int Num,int x,int y); // Affiche un sprite - void AfficheCable(int dx,int dy,int fx,int fy); // Affiche un cable - void Affiche_Text(e_Sprite Text,int x,int y); // Affiche un text à l'ecran - void AfficheOptions(int NVies,int NouveauScore); // Affiches les options sur le coté - void Efface(e_Sprite NumSpriteFondEcran); // Efface tous ce qui a été affiché - void Cls(e_Sprite NumSpriteFondEcran); // Efface l'ecran avec l'image de fond + void PrintSprite(e_Sprite NumSpr,int Num,int x,int y); // Affiche un sprite + void PrintCable(int dx,int dy,int fx,int fy); // Affiche un cable + void PrintText(e_Sprite Text,int x,int y); // Affiche un text à l'ecran + void PrintOptions(int NVies,int NouveauScore); // Affiche les options sur le coté + void ClearSprite(e_Sprite NumSpriteFondEcran); // Efface tous ce qui a été affiché + void CleanSpriteAndScreen(e_Sprite NumSpriteFondEcran); // Efface l'ecran avec l'image de fond /*** Variables ***/ int N; // Nombre de sprites mémorisés aprés l'affichage int Score; // Mémorise le score affiché - s_Ecran B[LT*HT*2]; // N° des sprites à effacer plus tard + s_Screen B[LT*HT*2]; // N° des sprites à effacer plus tard }; #endif diff --git a/src/sprite.cc b/src/sprite.cc index 8cb2e46..13c79bd 100644 --- a/src/sprite.cc +++ b/src/sprite.cc @@ -1,12 +1,12 @@ // (_||_/ -// ( ) Classe Sprite +// ( ) // ( o 0 ) //-OOO°--(_)---°OOO--------------------------------------- // Copyright (C) 2006 By Dominique Roux-Serret // .OOOo oOOO. roux-serret@ifrance.com //-( )------( )--------------------------------------- -// ( ( ) / Le 11/01/2006 -// (_) (_/ +// ( ( ) / Copyright (C) 2023 By Johnny Jazeix +// (_) (_/ jazeix@gmail.com // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -80,11 +80,11 @@ bool LoadLangue() strcpy(PathFile,Langue[Pref.Langue]); Utils::GetPath(PathFile); - if(Utils::FileExiste(PathFile)==false) { + if(Utils::FileExists(PathFile)==false) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to find '%s'", Langue[Pref.Langue]); return false; } - L=Utils::ChargeFichier(PathFile,Buf); + L=Utils::LoadFile(PathFile,Buf); // Lit les sprites P=0; @@ -124,11 +124,11 @@ bool LoadSprites() // *** Charge le fichier des langues *** // ************************************* - if(Utils::FileExiste(PathFile)==false) { + if(Utils::FileExists(PathFile)==false) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to find 'language.dat'"); return false; } - L=Utils::ChargeFichier(PathFile,Buf); + L=Utils::LoadFile(PathFile,Buf); // Prend le nombre de sprites NSp=(int)(Buf[0])*256+(int)(Buf[1]); @@ -159,11 +159,11 @@ bool LoadSprites() // ************************************* strcpy(PathFile,"sprites.dat"); Utils::GetPath(PathFile); - if(Utils::FileExiste(PathFile)==false) { + if(Utils::FileExists(PathFile)==false) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to find 'sprites.dat'"); return false; } - L=Utils::ChargeFichier(PathFile,Buf); + L=Utils::LoadFile(PathFile,Buf); // Lit les sprites P=0; diff --git a/src/sprite.h b/src/sprite.h index bf051d9..2f891fb 100644 --- a/src/sprite.h +++ b/src/sprite.h @@ -1,12 +1,12 @@ // (_||_/ -// ( ) Classe Sprite +// ( ) Sprite class // ( o 0 ) //-OOO°--(_)---°OOO--------------------------------------- // Copyright (C) 2006 By Dominique Roux-Serret // .OOOo oOOO. roux-serret@ifrance.com //-( )------( )--------------------------------------- -// ( ( ) / Le 11/01/2006 -// (_) (_/ +// ( ( ) / Copyright (C) 2023 By Johnny Jazeix +// (_) (_/ jazeix@gmail.com // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/utils.cc b/src/utils.cc index babb06b..b62f8af 100644 --- a/src/utils.cc +++ b/src/utils.cc @@ -1,12 +1,12 @@ -// (_||_/ Utils.cc -// ( ) Fonctions divers +// (_||_/ +// ( ) // ( o 0 ) //-OOO°--(_)---°OOO--------------------------------------- -// Copyright (C) 2006 By Dominique Roux-Serret +// Copyright (C) 2006 By Dominique Roux-Serret // .OOOo oOOO. roux-serret@ifrance.com //-( )------( )--------------------------------------- -// ( ( ) / Le 03/01/2006 -// (_) (_/ +// ( ( ) / Copyright (C) 2023 By Johnny Jazeix +// (_) (_/ jazeix@gmail.com // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -51,7 +51,7 @@ extern char DefPath[]; // Chemin par defaut dans arg /*** Test si un fichier exite ***/ /********************************/ -bool Utils::FileExiste(const char *Path) +bool Utils::FileExists(const char *Path) { SDL_RWops* file=SDL_RWFromFile(Path,"rb"); @@ -65,7 +65,7 @@ bool Utils::FileExiste(const char *Path) /*** Charge un fichier en Mémoire ***/ /************************************/ -long Utils::ChargeFichier(const char *Path,unsigned char *&Buf) +long Utils::LoadFile(const char *Path,unsigned char *&Buf) { SDL_RWops* file=SDL_RWFromFile(Path,"rb"); if(!file) { @@ -113,7 +113,7 @@ long Utils::ChargeFichier(const char *Path,unsigned char *&Buf) /*** Sauve un Fichier ***/ /************************/ -bool Utils::SauveFichier(const char *Path,char *Buf,long L) +bool Utils::SaveFile(const char *Path,char *Buf,long L) { FILE *file; @@ -158,24 +158,24 @@ void Utils::GetPath(char *Path) #ifndef ANDROID if(DefPath[0]) { sprintf(Path,"%s%s",DefPath,Provi); - if(Utils::FileExiste(Path)) return; + if(Utils::FileExists(Path)) return; } sprintf(Path,"%s/%s",DATA_DIR,Provi); - if(Utils::FileExiste(Path)) return; + if(Utils::FileExists(Path)) return; #endif // Android is directly the filename sprintf(Path,"%s",Provi); - if(Utils::FileExiste(Path)) return; + if(Utils::FileExists(Path)) return; sprintf(Path,"./%s",Provi); - if(Utils::FileExiste(Path)) return; + if(Utils::FileExists(Path)) return; sprintf(Path,"/usr/local/share/Li-ri/%s",Provi); - if(Utils::FileExiste(Path)) return; + if(Utils::FileExists(Path)) return; sprintf(Path,"/usr/share/Li-ri/%s",Provi); - if(Utils::FileExiste(Path)) return; + if(Utils::FileExists(Path)) return; sprintf(Path,"/usr/share/games/Li-ri/%s",Provi); - if(Utils::FileExiste(Path)) return; + if(Utils::FileExists(Path)) return; SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to find '%s'", Provi); } @@ -190,7 +190,7 @@ void Utils::GetPath(char *Path) strcpy(Provi,Path); sprintf(Path,"PROGDIR:%s",Provi); - if(Utils::FileExiste(Path)) return; + if(Utils::FileExists(Path)) return; SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to find '%s'", Path); exit(-1); @@ -206,7 +206,7 @@ void Utils::GetPath(char *Path) strcpy(Provi,Path); sprintf(Path,"Li-ri.app/Contents/Resources/%s",Provi); - if(Utils::FileExiste(Path)) return; + if(Utils::FileExists(Path)) return; SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to find '%s'", Path); exit(-1); @@ -222,7 +222,7 @@ void Utils::GetPath(char *Path) strcpy(Provi,Path); char *basePath = SDL_GetBasePath(); sprintf(Path,"%s/%s",basePath,Provi); - if(Utils::FileExiste(Path)) { + if(Utils::FileExists(Path)) { SDL_free(basePath); return; } @@ -243,8 +243,8 @@ bool Utils::LoadPref(void) SDL_free(PrefFolder); - if(Utils::FileExiste(PathPref)) { - L=Utils::ChargeFichier(PathPref,Provi); + if(Utils::FileExists(PathPref)) { + L=Utils::LoadFile(PathPref,Provi); if(L>0) { memcpy((char*)&Pref,Provi,L); delete [] Provi; @@ -264,6 +264,6 @@ void Utils::SauvePref(void) sprintf(PathPref, "%sli-ri.pref", PrefFolder); SDL_free(PrefFolder); - Utils::SauveFichier(PathPref,(char*)&Pref,sizeof(sPreference)); + Utils::SaveFile(PathPref,(char*)&Pref,sizeof(sPreference)); } diff --git a/src/utils.h b/src/utils.h index 22d8ab6..7e57901 100644 --- a/src/utils.h +++ b/src/utils.h @@ -1,12 +1,12 @@ -// (_||_/ Utils.h -// ( ) Fonctions divers pour les differents systèmes d'exploitation +// (_||_/ +// ( ) Utils functions // ( o 0 ) //-OOO°--(_)---°OOO--------------------------------------- // Copyright (C) 2006 By Dominique Roux-Serret // .OOOo oOOO. roux-serret@ifrance.com //-( )------( )--------------------------------------- -// ( ( ) / Le 03/01/2006 -// (_) (_/ +// ( ( ) / Copyright (C) 2023 By Johnny Jazeix +// (_) (_/ jazeix@gmail.com // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -26,14 +26,14 @@ class Utils { public: - static bool FileExiste(const char *Path); // Si un fichier existe - static long ChargeFichier(const char *Path,unsigned char *&Buf); // Charge un ficher en mémoire - static bool SauveFichier(const char *Path,char *Buf,long L); // Sauve un Fichier + static bool FileExists(const char *Path); // Check if the file exists + static long LoadFile(const char *Path,unsigned char *&Buf); // Load a file in memory + static bool SaveFile(const char *Path,char *Buf,long L); // Save a file - static void GetPath(char *Name); // Rajoute le chemin au nom du fichier (sprites, levels) + static void GetPath(char *Name); // Add the path to the filename depending on the OS (sprites, levels) - static bool LoadPref(void); // Charger les préferences - static void SauvePref(void); // Sauve les preferences + static bool LoadPref(void); // Load preferences + static void SauvePref(void); // Save preferences }; #endif