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

  1. /***************************************************************************
  2.  * goldpiece.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_GOLDPIECE_H
  17. #define SMC_GOLDPIECE_H
  18.  
  19. #include "../core/globals.h"
  20. #include "../objects/objectsprite.h"
  21.  
  22. /* *** *** *** *** *** cGoldpiece *** *** *** *** *** *** *** *** *** *** *** *** */
  23.  
  24. class cGoldpiece : public cImageObjectSprite
  25. {
  26. public:
  27.     // constructor
  28.     cGoldpiece( float x, float y );
  29.     // create from stream
  30.     cGoldpiece( CEGUI::XMLAttributes &attributes );
  31.     // destructor
  32.     virtual ~cGoldpiece( void );
  33.  
  34.     // create from stream
  35.     virtual void Create_from_Stream( CEGUI::XMLAttributes &attributes );
  36.     // save to stream
  37.     virtual void Save_to_Stream( ofstream &file );
  38.     // init defaults
  39.     void Init( void );
  40.  
  41.     // copy
  42.     virtual cGoldpiece *Copy( void );
  43.  
  44.     // load from savegame
  45.     virtual void Load_from_Savegame( cSave_Level_Object *save_object );
  46.     // save to savegame
  47.     virtual cSave_Level_Object *Save_to_Savegame( void );
  48.  
  49.     // Set the gold color
  50.     virtual void Set_Gold_Color( DefaultColor ncolor );
  51.  
  52.     // the player gets the goldpiece
  53.     void Activate( void );
  54.  
  55.     // update
  56.     virtual void Update( void );
  57.     // draw
  58.     virtual void Draw( cSurfaceRequest *request = NULL );
  59.  
  60.     // if update is valid for the current state
  61.     virtual bool Is_Update_Valid( void );
  62.  
  63.     // ignore onground check if goldpiece
  64.     virtual void Check_on_Ground( void );
  65.  
  66.     // goldpiece rotation
  67.     float counter;
  68.     // gold color
  69.     DefaultColor color_type;
  70. };
  71.  
  72. /* *** *** *** *** *** cJGoldpiece *** *** *** *** *** *** *** *** *** *** *** *** */
  73.  
  74. /* Jumping Goldpiece
  75.  * used by Goldbox
  76. */
  77. class cJGoldpiece : public cGoldpiece
  78. {
  79. public:
  80.     cJGoldpiece( float x, float y );
  81.     virtual ~cJGoldpiece( void );
  82.     
  83.     // update
  84.     virtual void Update( void );
  85.  
  86.     // ignore ground check
  87.     virtual void Check_on_Ground( void ) {};
  88.  
  89.     /* Validate the given collision object
  90.      * returns 1 if an internal collision with this object is valid
  91.      * returns 2 if the given object collides with this object (blocking)
  92.     */
  93.     virtual unsigned int Validate_Collision( cSprite *obj );
  94. };
  95.  
  96. /* *** *** *** *** *** cFGoldpiece *** *** *** *** *** *** *** *** *** *** *** *** */
  97.  
  98. /* Falling Goldpiece
  99.  * if direction is undefined it moves into a random direction
  100. */
  101. class cFGoldpiece : public cGoldpiece
  102. {
  103. public:
  104.     cFGoldpiece( float x, float y, ObjectDirection dir = DIR_UNDEFINED );
  105.     virtual ~cFGoldpiece( void );
  106.     
  107.     // Set the gold color
  108.     virtual void Set_Gold_Color( DefaultColor ncolor );
  109.  
  110.     // update
  111.     virtual void Update( void );
  112.  
  113.     /* Validate the given collision object
  114.      * returns 1 if an internal collision with this object is valid
  115.      * returns 2 if the given object collides with this object (blocking)
  116.     */
  117.     virtual unsigned int Validate_Collision( cSprite *obj );
  118.     // collision with massive
  119.     virtual void Handle_Collision_Massive( cObjectCollision *collision );
  120.     // collision from a box
  121.     virtual void Handle_Collision_Box( ObjectDirection cdirection, GL_rect *r2 );
  122. };
  123.  
  124. /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
  125.  
  126. #endif
  127.