Commit c9206dba authored by Gerhard Stein's avatar Gerhard Stein

Egg now at least cracks open, but bit code still is missing.

parent fcbd7320
...@@ -728,6 +728,7 @@ bool CEGAGraphicsGalaxy::readSprites( size_t NumSprites, size_t IndexSprite ) ...@@ -728,6 +728,7 @@ bool CEGAGraphicsGalaxy::readSprites( size_t NumSprites, size_t IndexSprite )
CSprite &Sprite = g_pGfxEngine->getSprite(i); CSprite &Sprite = g_pGfxEngine->getSprite(i);
Sprite.setSize( Head.Width*8, Head.Height ); Sprite.setSize( Head.Width*8, Head.Height );
Sprite.setOffset( Head.OrgX>>(TILE_S), Head.OrgY>>(TILE_S) ); Sprite.setOffset( Head.OrgX>>(TILE_S), Head.OrgY>>(TILE_S) );
// Setup the collision information // Setup the collision information
...@@ -791,6 +792,7 @@ bool CEGAGraphicsGalaxy::readSprites( size_t NumSprites, size_t IndexSprite ) ...@@ -791,6 +792,7 @@ bool CEGAGraphicsGalaxy::readSprites( size_t NumSprites, size_t IndexSprite )
} }
} }
SDL_UnlockSurface(sfc); SDL_UnlockSurface(sfc);
} }
return true; return true;
} }
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include "engine/galaxy/ai/ep4/CLindsey.h" #include "engine/galaxy/ai/ep4/CLindsey.h"
#include "engine/galaxy/ai/ep4/CSkypest.h" #include "engine/galaxy/ai/ep4/CSkypest.h"
#include "engine/galaxy/ai/ep4/CMimrock.h" #include "engine/galaxy/ai/ep4/CMimrock.h"
#include "engine/galaxy/ai/ep4/CEgg.h"
// General stuff // General stuff
#include "engine/galaxy/ai/CSpriteItem.h" #include "engine/galaxy/ai/CSpriteItem.h"
...@@ -424,11 +425,11 @@ CGalaxySpriteObject* CMapLoaderGalaxy::addFoe(CMap &Map, word foe, size_t x, siz ...@@ -424,11 +425,11 @@ CGalaxySpriteObject* CMapLoaderGalaxy::addFoe(CMap &Map, word foe, size_t x, siz
p_newfoe = new galaxy::CBounder(&Map, foe, x, y-250); p_newfoe = new galaxy::CBounder(&Map, foe, x, y-250);
break; break;
/*case 13: case 13:
// I think this is an egg // This is an egg
// TODO: Those relative coordinates are not a good sign. Try to remove them and make the Sprite substract them // TODO: Those relative coordinates are not a good sign. Try to remove them and make the Sprite substract them
p_newfoe = new galaxy::CBounder(&Map, foe, x, y-250); p_newfoe = new galaxy::CEgg(&Map, foe, x, y-(2<<CSF));
break;*/ break;
case 19: case 19:
......
...@@ -80,6 +80,7 @@ void CMapPlayGalaxy::process(const bool msgboxactive) ...@@ -80,6 +80,7 @@ void CMapPlayGalaxy::process(const bool msgboxactive)
player->processDead(); player->processDead();
} }
if( p_Object->exists && p_Object->calcVisibility() ) if( p_Object->exists && p_Object->calcVisibility() )
{ {
// Process the AI of the object as it's given // Process the AI of the object as it's given
......
...@@ -9,21 +9,32 @@ ...@@ -9,21 +9,32 @@
#include "engine/galaxy/ai/CPlayerLevel.h" #include "engine/galaxy/ai/CPlayerLevel.h"
#include "engine/galaxy/ai/CBullet.h" #include "engine/galaxy/ai/CBullet.h"
namespace galaxy { namespace galaxy
{
const int A_EGG_NORMAL = 0;
const int A_EGG_BROKEN = 1;
const int A_EGG_SHELL = 2;
CEgg::CEgg(CMap *pmap, const Uint16 foeID, Uint32 x, Uint32 y) : CEgg::CEgg(CMap *pmap, const Uint16 foeID, Uint32 x, Uint32 y) :
CGalaxySpriteObject(pmap, foeID, x, y) CGalaxySpriteObject(pmap, foeID, x, y)
{} {
setupGalaxyObjectOnMap(0x2120, A_EGG_NORMAL);
}
void CEgg::hatch() void CEgg::hatch()
{ {
setAction(A_EGG_BROKEN);
setActionSprite();
} }
void CEgg::getTouchedBy(CSpriteObject &theObject) void CEgg::getTouchedBy(CSpriteObject &theObject)
{ {
if(theObject.dead ) if( !getActionNumber(A_EGG_NORMAL) || theObject.dead )
return; return;
if( CBullet *bullet = dynamic_cast<CBullet*>(&theObject) ) if( CBullet *bullet = dynamic_cast<CBullet*>(&theObject) )
...@@ -34,10 +45,21 @@ void CEgg::getTouchedBy(CSpriteObject &theObject) ...@@ -34,10 +45,21 @@ void CEgg::getTouchedBy(CSpriteObject &theObject)
hatch(); hatch();
} }
if( CPlayerBase *player = dynamic_cast<CPlayerBase*>(&theObject) ) if( dynamic_cast<CPlayerBase*>(&theObject) )
{ {
hatch(); hatch();
} }
} }
void CEgg::process()
{
processFalling();
performCollisions();
//processActionRoutine();
}
} /* namespace galaxy */ } /* namespace galaxy */
...@@ -7,8 +7,6 @@ ...@@ -7,8 +7,6 @@
* It processes the egg just laying there * It processes the egg just laying there
*/ */
#include "engine/galaxy/CGalaxySpriteObject.h"
#ifndef CEGG_H_ #ifndef CEGG_H_
#define CEGG_H_ #define CEGG_H_
...@@ -23,8 +21,15 @@ public: ...@@ -23,8 +21,15 @@ public:
CEgg(CMap *pmap, const Uint16 foeID, Uint32 x, Uint32 y); CEgg(CMap *pmap, const Uint16 foeID, Uint32 x, Uint32 y);
void hatch(); void hatch();
// When something touches the bouncing mushroom
void getTouchedBy(CSpriteObject &theObject); void getTouchedBy(CSpriteObject &theObject);
// Happens every LPS. Here the Bouncing AI is handled
void process();
}; };
} /* namespace galaxy */ } /* namespace galaxy */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment