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

  1. /***************************************************************************
  2.  * box.h  -  header 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_BOX_H
  17. #define SMC_BOX_H
  18.  
  19. #include "../core/globals.h"
  20. #include "../objects/objectsprite.h"
  21.  
  22. /* *** *** *** *** *** *** *** *** cBaseBox *** *** *** *** *** *** *** *** *** */
  23.  
  24. class cBaseBox : public cImageObjectSprite
  25. {
  26. public:
  27.     cBaseBox( float x = 0, float y = 0 );
  28.     virtual ~cBaseBox( void );
  29.  
  30.     // create from stream
  31.     virtual void Create_from_Stream( CEGUI::XMLAttributes &attributes );
  32.     // save to stream
  33.     virtual void Save_to_Stream( ofstream &file );
  34.  
  35.     // load from savegame
  36.     virtual void Load_from_Savegame( cSave_Level_Object *save_object );
  37.     // save to savegame
  38.     virtual cSave_Level_Object *Save_to_Savegame( void );
  39.  
  40.     /* Set the Animation Type
  41.      * new_anim_type can be : Bonus, Default or Power
  42.     */
  43.     void Set_Animation( string new_anim_type );
  44.     // sets the count this object can be activated
  45.     virtual void Set_Useable_Count( int count, bool new_startcount = 0 );
  46.     /* Set invisible type
  47.      * 1 : invisible until activation
  48.      * 2 : ghost box
  49.     */
  50.     void Set_Invisible( unsigned int type );
  51.  
  52.     // activates collision movement
  53.     void Activate_Collision( ObjectDirection cdirection );
  54.     // updates the collision movement
  55.     void Update_Collision( void );
  56.  
  57.     // check for collision with objects
  58.     void Check_Collision( ObjectDirection cdirection );
  59.     // collision with the given enemy
  60.     void Col_Enemy( cSprite *obj );
  61.  
  62.     // activate
  63.     virtual void Activate( void );
  64.  
  65.     // update
  66.     virtual void Update( void );
  67.     // draw
  68.     virtual void Draw( cSurfaceRequest *request = NULL );
  69.  
  70.     // Generate activation Particles
  71.     void Generate_Activation_Particles( void );
  72.  
  73.     // if update is valid for the current state
  74.     virtual bool Is_Update_Valid( void );
  75.     // if draw is valid for the current state and position
  76.     virtual bool Is_Draw_Valid( void );
  77.  
  78.     /* Validate the given collision object
  79.      * returns 1 if an internal collision with this object is valid
  80.      * returns 2 if the given object collides with this object (blocking)
  81.     */
  82.     virtual unsigned int Validate_Collision( cSprite *obj );
  83.     // handle the basic box player collision
  84.     virtual void Handle_Collision_Player( cObjectCollision *collision );
  85.     // handle the basic box enemy collision
  86.     virtual void Handle_Collision_Enemy( cObjectCollision *collision );
  87.  
  88.     // leveleditor activation
  89.     virtual void Editor_Activate( void );
  90.     bool Editor_Useable_Count_Key( const CEGUI::EventArgs &event ); // editor useable count key up
  91.     bool Editor_Invisible_Select( const CEGUI::EventArgs &event ); // editor invisible option selected
  92.  
  93.     // animation type
  94.     string anim_type;
  95.     // animation counter
  96.     float counter;
  97.     unsigned int anim_counter_min;
  98.     unsigned int anim_counter_max;
  99.     // box type
  100.     SpriteType box_type;
  101.  
  102.     // leveleditor item image
  103.     GL_Surface *item_image;
  104.  
  105.     // moving direction when activated
  106.     ObjectDirection move_col_dir;
  107.     // current moving counter ( if activated )
  108.     float move_counter;
  109.     // if object is moving back to the original position
  110.     bool move_back;
  111.     // times the box object can be activated ( -1 = infinite )
  112.     int useable_count, start_useable_count;
  113.  
  114.     // box invisible type
  115.     unsigned int box_invisible;
  116.  
  117.     // active particle animation counter
  118.     float particle_counter_active;
  119.  
  120. protected:
  121.     // Create the Name from the current settings
  122.     void Create_Name( void );
  123. };
  124.  
  125. /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
  126.  
  127. #endif
  128.