home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2009 February / maximum-cd-2009-02.iso / DiscContents / SMC_1.6_win32.exe / src / enemies / turtle.h < prev   
Encoding:
C/C++ Source or Header  |  2008-07-01  |  3.3 KB  |  116 lines

  1. /***************************************************************************
  2.  * turtle.h  -  headers for the corresponding cpp file
  3.  *
  4.  * Copyright (C) 2003 - 2008 Florian Richter
  5.  ***************************************************************************/
  6. /*
  7.    This program is free software; you can redistribute it and/or modify
  8.    it under the terms of the GNU General Public License as published by
  9.    the Free Software Foundation; either version 3 of the License, or
  10.    (at your option) any later version.
  11.    
  12.    You should have received a copy of the GNU General Public License
  13.    along with this program.  If not, see <http://www.gnu.org/licenses/>.
  14. */
  15.  
  16. #ifndef SMC_TURTLE_H
  17. #define SMC_TURTLE_H
  18.  
  19. #include "../enemies/enemy.h"
  20.  
  21. /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
  22.  
  23. enum Turtle_state
  24. {
  25.     TURTLE_DEAD        = 0,
  26.     TURTLE_WALK        = 1,
  27.     TURTLE_SHELL_STAND    = 2,
  28.     TURTLE_SHELL_RUN    = 3,
  29.     TURTLE_FLY        = 4, // todo
  30. };
  31.  
  32. /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
  33.  
  34. class cTurtle : public cEnemy
  35. {
  36. public:
  37.     // constructor
  38.     cTurtle( float x, float y );
  39.     // create from stream
  40.     cTurtle( CEGUI::XMLAttributes &attributes );
  41.     // destructor
  42.     virtual ~cTurtle( void );
  43.  
  44.     // init defaults
  45.     void Init( void );
  46.     // copy
  47.     virtual cTurtle *Copy( void );
  48.  
  49.     // create from stream
  50.     virtual void Create_from_Stream( CEGUI::XMLAttributes &attributes );
  51.     // save to stream
  52.     virtual void Save_to_Stream( ofstream &file );
  53.  
  54.     // load from savegame
  55.     virtual void Load_from_Savegame( cSave_Level_Object *save_object );
  56.     // save to savegame
  57.     virtual cSave_Level_Object *Save_to_Savegame( void );
  58.  
  59.     // Set Direction
  60.     void Set_Direction( ObjectDirection dir, bool new_start_direction = 0 );
  61.     // set color
  62.     void Set_Color( DefaultColor col );
  63.  
  64.     /* Move into the opposite Direction
  65.      * if col_dir is given only turns around if the collision direction is in front
  66.      */
  67.     virtual void Turn_Around( ObjectDirection col_dir = DIR_UNDEFINED );
  68.  
  69.     /* downgrade state ( if already weakest state : dies )
  70.      * force : usually dies or a complete downgrade
  71.     */
  72.     virtual void DownGrade( bool force = 0 );
  73.     virtual void DieStep( void );
  74.  
  75.     // update
  76.     virtual void Update( void );
  77.  
  78.     // if update is valid for the current state
  79.     virtual bool Is_Update_Valid( void );
  80.  
  81.     /* Validate the given collision object
  82.      * returns 1 if an internal collision with this object is valid
  83.      * returns 2 if the given object collides with this object (blocking)
  84.     */
  85.     virtual unsigned int Validate_Collision( cSprite *obj );
  86.     // collision from player
  87.     virtual void Handle_Collision_Player( cObjectCollision *collision );
  88.     // collision from an enemy
  89.     virtual void Handle_Collision_Enemy( cObjectCollision *collision );
  90.     // collision with massive
  91.     virtual void Handle_Collision_Massive( cObjectCollision *collision );
  92.  
  93.     // internal turtle state
  94.     Turtle_state turtle_state;
  95.  
  96.     // default speed
  97.     float speed_walk, speed_shell;
  98.  
  99.     /* If the player kicked the shell this counter is set.
  100.      * if this counter is higher than 0
  101.      * maryo cannot get killed by the shell
  102.      */
  103.     float playercounter;
  104.  
  105.     // Color
  106.     DefaultColor color_type;
  107.  
  108. private:
  109.     // Create the Name from the current settings
  110.     void Create_Name( void );
  111. };
  112.  
  113. /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
  114.  
  115. #endif
  116.