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

  1. /***************************************************************************
  2.  * thromp.h  -  headers for the corresponding cpp file
  3.  *
  4.  * Copyright (C) 2006 - 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_THROMP_H
  17. #define SMC_THROMP_H
  18.  
  19. #include "../enemies/enemy.h"
  20.  
  21. /* *** *** *** *** *** cThromp *** *** *** *** *** *** *** *** *** *** *** *** */
  22.  
  23. /* Thromp
  24.  * The falling Stone
  25. */
  26. class cThromp : public cEnemy
  27. {
  28. public:
  29.     // constructor
  30.     cThromp( float x, float y );
  31.     // create from stream
  32.     cThromp( CEGUI::XMLAttributes &attributes );
  33.     // destructor
  34.     virtual ~cThromp( void );
  35.  
  36.     // init defaults
  37.     void Init( void );
  38.     // copy
  39.     virtual cThromp *Copy( void );
  40.  
  41.     // create from stream
  42.     virtual void Create_from_Stream( CEGUI::XMLAttributes &attributes );
  43.     // save to stream
  44.     virtual void Save_to_Stream( ofstream &file );
  45.  
  46.     // load from savegame
  47.     virtual void Load_from_Savegame( cSave_Level_Object *save_object );
  48.     // save to savegame
  49.     virtual cSave_Level_Object *Save_to_Savegame( void );
  50.  
  51.     // Set the image directory
  52.     void Set_Image_Dir( string filename );
  53.     // Set Direction
  54.     void Set_Direction( ObjectDirection dir );
  55.     // Set Max Distance
  56.     void Set_Max_Distance( float nmax_distance );
  57.     // Set the Speed
  58.     void Set_Speed( float val );
  59.  
  60.     // Move to destination direction
  61.     void Activate( void );
  62.     // Move back to the original position
  63.     void Move_Back( void );
  64.  
  65.     /* downgrade state ( if already the weakest state it dies )
  66.      * force : usually dies or a complete downgrade
  67.     */
  68.     virtual void DownGrade( bool force = 0 );
  69.     virtual void DieStep( void );
  70.  
  71.     // update
  72.     virtual void Update( void );
  73.     // draw
  74.     virtual void Draw( cSurfaceRequest *request = NULL );
  75.  
  76.     // update images
  77.     void Update_Images( void );
  78.     // update destination velocity from the speed
  79.     void Update_dest_vel( void );
  80.     // update the distance rect
  81.     void Update_Distance_rect( void );
  82.     // Get the final distance rect
  83.     GL_rect Get_Final_Distance_Rect( void );
  84.  
  85.     // Generates Smoke Particles
  86.     void Generate_Smoke( unsigned int power = 10 );
  87.  
  88.     // if update is valid for the current state
  89.     virtual bool Is_Update_Valid( void );
  90.     // if draw is valid for the current state and position
  91.     virtual bool Is_Draw_Valid( void );
  92.  
  93.     // ignore onground check
  94.     virtual void Check_on_Ground( void ) {};
  95.     /* Validate the given collision object
  96.      * returns 1 if an internal collision with this object is valid
  97.      * returns 2 if the given object collides with this object (blocking)
  98.     */
  99.     virtual unsigned int Validate_Collision( cSprite *obj );
  100.     // collision from player
  101.     virtual void Handle_Collision_Player( cObjectCollision *collision );
  102.     // collision from an enemy
  103.     virtual void Handle_Collision_Enemy( cObjectCollision *collision );
  104.     // collision with massive
  105.     virtual void Handle_Collision_Massive( cObjectCollision *collision );
  106.  
  107.     // editor activation
  108.     virtual void Editor_Activate( void );
  109.     // editor image dir key up event
  110.     bool Editor_Image_Dir_Key( const CEGUI::EventArgs &event );
  111.     // editor max distance key up event
  112.     bool Editor_Max_Distance_Key( const CEGUI::EventArgs &event );
  113.     // editor speed key up event
  114.     bool Editor_Speed_Key( const CEGUI::EventArgs &event );
  115.  
  116.     // image directory
  117.     string img_dir;
  118.     // speed
  119.     float speed;
  120.     // destination direction velocity
  121.     float dest_velx, dest_vely;
  122.     // maximum distance from the startposition
  123.     float max_distance;
  124.  
  125.     // moving back to the original position
  126.     bool move_back;
  127.     // distance rect to end position
  128.     GL_rect distance_rect;
  129.  
  130. private:
  131.     // Create the Name from the current settings
  132.     void Create_Name( void );
  133. };
  134.  
  135. /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
  136.  
  137. #endif
  138.