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 )
CSprite &Sprite = g_pGfxEngine->getSprite(i);
Sprite.setSize( Head.Width*8, Head.Height );
Sprite.setOffset( Head.OrgX>>(TILE_S), Head.OrgY>>(TILE_S) );
// Setup the collision information
......@@ -791,6 +792,7 @@ bool CEGAGraphicsGalaxy::readSprites( size_t NumSprites, size_t IndexSprite )
}
}
SDL_UnlockSurface(sfc);
}
return true;
}
......
......@@ -41,6 +41,7 @@
#include "engine/galaxy/ai/ep4/CLindsey.h"
#include "engine/galaxy/ai/ep4/CSkypest.h"
#include "engine/galaxy/ai/ep4/CMimrock.h"
#include "engine/galaxy/ai/ep4/CEgg.h"
// General stuff
#include "engine/galaxy/ai/CSpriteItem.h"
......@@ -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);
break;
/*case 13:
// I think this is an egg
case 13:
// This is an egg
// 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);
break;*/
p_newfoe = new galaxy::CEgg(&Map, foe, x, y-(2<<CSF));
break;
case 19:
......
......@@ -80,6 +80,7 @@ void CMapPlayGalaxy::process(const bool msgboxactive)
player->processDead();
}
if( p_Object->exists && p_Object->calcVisibility() )
{
// Process the AI of the object as it's given
......
......@@ -9,21 +9,32 @@
#include "engine/galaxy/ai/CPlayerLevel.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) :
CGalaxySpriteObject(pmap, foeID, x, y)
{}
{
setupGalaxyObjectOnMap(0x2120, A_EGG_NORMAL);
}
void CEgg::hatch()
{
setAction(A_EGG_BROKEN);
setActionSprite();
}
void CEgg::getTouchedBy(CSpriteObject &theObject)
{
if(theObject.dead )
if( !getActionNumber(A_EGG_NORMAL) || theObject.dead )
return;
if( CBullet *bullet = dynamic_cast<CBullet*>(&theObject) )
......@@ -34,10 +45,21 @@ void CEgg::getTouchedBy(CSpriteObject &theObject)
hatch();
}
if( CPlayerBase *player = dynamic_cast<CPlayerBase*>(&theObject) )
if( dynamic_cast<CPlayerBase*>(&theObject) )
{
hatch();
}
}
void CEgg::process()
{
processFalling();
performCollisions();
//processActionRoutine();
}
} /* namespace galaxy */
......@@ -7,8 +7,6 @@
* It processes the egg just laying there
*/
#include "engine/galaxy/CGalaxySpriteObject.h"
#ifndef CEGG_H_
#define CEGG_H_
......@@ -23,8 +21,15 @@ public:
CEgg(CMap *pmap, const Uint16 foeID, Uint32 x, Uint32 y);
void hatch();
// When something touches the bouncing mushroom
void getTouchedBy(CSpriteObject &theObject);
// Happens every LPS. Here the Bouncing AI is handled
void process();
};
} /* 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