home *** CD-ROM | disk | FTP | other *** search
/ Freelog 17 / Freelog017.iso / BeOS / ababelone / Sources / Deplacement.h < prev    next >
C/C++ Source or Header  |  2000-11-21  |  3KB  |  78 lines

  1. /*
  2.     Copyright (C) 2000 by Herv├⌐ PHILIPPE <rv@bemail.org>
  3.  
  4.     This library is free software; you can redistribute it and/or
  5.     modify it under the terms of the GNU Library General Public
  6.     License as published by the Free Software Foundation; either
  7.     version 2 of the License, or (at your option) any later version.
  8.  
  9.     This library is distributed in the hope that it will be useful,
  10.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12.     Library General Public License for more details.
  13.  
  14.     You should have received a copy of the GNU Library General Public
  15.     License along with this library; if not, write to the Free
  16.     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17. */
  18.  
  19. #ifndef _DEPLACEMENT_H_
  20. #define _DEPLACEMENT_H_
  21.  
  22. #include <FileGameSound.h>
  23.  
  24. #include "PlateauDeJeuInterne.h"
  25. #include "PlateauDeJeuGraphique.h"
  26.  
  27. #define DELAI_POUR_POUSSER    6000    // D├⌐lai en ┬╡secondes (6000 normalement)
  28.  
  29. // REMARQUE : "LARGEUR_CASE_BOULE/2" toujours inf├⌐rieur ├á "HAUTEUR_CASE_BOULE"
  30. //  (sinon, il faut changer les proc├⌐dures "FaireGlisserLesBoules" et "FaireGlisserLesBoulesLaterales")
  31.  
  32. typedef struct
  33. {
  34.     int8    PremiereBouleSelectionnee;
  35.     int8    NombreBoulesADeplacer;
  36.     int8    Direction;
  37.     int8    DirectionLaterale;
  38.     int8    BouleEjectee;
  39. } type_deplacement;
  40.  
  41. class Deplacement
  42. {
  43. // FONCTIONS
  44.     public:
  45.                             Deplacement(PlateauDeJeuInterne* plateau_de_jeu_interne, PlateauDeJeuGraphique* plateau_de_jeu_graphique, int8 couleur, bool ordinateur);
  46.         bool                Ordinateur();
  47.         type_deplacement    CoupJoue();
  48.         void                JouerCoupPrecedent(type_deplacement coup_joue, bool mise_a_jour_buffer_ecran = true);
  49.         void                JouerCoup(type_deplacement coup_joue, bool faire_glisser_les_boules = true, bool mise_a_jour_buffer_ecran = true);
  50.     protected:
  51.         void    RangerBouleEjectee(int8 numero_boule);
  52.  
  53.         bool    DirectionPousseePossible(int8 direction, int8* ptr_nombre_boules_joueur = NULL, int8* ptr_nombre_boules_adversaire = NULL);
  54.         void    FaireGlisserLesBoulesPoussee(int8 nombre_de_boules_a_deplacer, bool ejection);
  55.         bool    DeplacerBoulesPoussee(bool faire_glisser_les_boules = true, bool mise_a_jour_buffer_ecran = true);
  56.  
  57.         bool    DirectionLateralePossible(int8 direction, bool* ptr_deplacement_avec_2_boules = NULL);
  58.         void    FaireGlisserLesBoulesLaterales();
  59.         void    DeplacerBoulesLaterales(bool faire_glisser_les_boules = true, bool mise_a_jour_buffer_ecran = true);
  60.  
  61. // VARIABLES ET CONSTANTES
  62.     private:
  63.         const bool            m_kOrdinateur;
  64.         type_deplacement    m_CoupJoue;
  65.         BFileGameSound*        m_SonPousser;
  66.         BFileGameSound*        m_SonTomber;
  67.     protected:
  68.         int8                m_CouleurCourante;    // 'couleur ├á jouer' c'est-├á-dire couleur du joueur ├á jouer
  69.         PlateauDeJeuInterne*    m_PlateauInterne;    // Objet qui r├⌐unit les fonctions li├⌐es au plateau de jeu interne
  70.         PlateauDeJeuGraphique*    m_PlateauGraphique;
  71.  
  72.         int8                m_PremiereBouleSelectionnee;
  73.         int8                m_Direction;
  74.         int8                m_NombreBoulesSelectionnees;
  75.         int8                m_DirectionLaterale;
  76. };
  77.  
  78. #endif