Commit 050a9a13 authored by Gerhard Stein's avatar Gerhard Stein

Loading save games now works with small glitches left

parent 8748b732
......@@ -43,7 +43,11 @@ public:
bool createEmptyDataPlane(size_t plane, Uint32 width, Uint32 height);
bool gotoPos( int x, int y );
void resetScrolls();
// If force is enabled it will ignore scroll blockers
bool scrollLeft(const bool force=false);
bool scrollRight(const bool force=false);
......
......@@ -31,24 +31,25 @@ struct LoadGameSlotFunctorEvent : public InvokeFunctorEvent
CLoadMenu::CLoadMenu() :
CBaseMenu( CRect<float>(0.1f, 0.0f, 0.8f, 1.0f) )
{
// Load the state-file list
std::vector<std::string> StateFileList = gpSaveGameController->getSlotList();
std::vector<std::string>::iterator it = StateFileList.begin();
Uint32 i=1;
CGUIButton *button;
std::string text;
for( Uint32 i=1 ; i<=8 ; i++ )
for( ; it != StateFileList.end() ; i++,it++ )
{
std::string text = "Slot " + itoa(i);
text = *it;
if( i <= StateFileList.size() )
{
text = StateFileList.at(i-1);
mpMenuDialog->addControl( new CGUIButton( text,
new LoadGameSlotFunctorEvent(i) ) );
}
else
if( !text.empty() )
{
button = new CGUIButton( text,
new LoadGameSlotFunctorEvent(i) );
mpMenuDialog->addControl( button );
mpMenuDialog->addControl( new CGUIText( text ) );
button->enable( true );
}
}
......
......@@ -7,8 +7,9 @@
#include "CGalaxySpriteObject.h"
CGalaxySpriteObject::CGalaxySpriteObject(CMap *pmap, Uint32 x, Uint32 y) :
CGalaxySpriteObject::CGalaxySpriteObject(CMap *pmap, const Uint16 foeID, Uint32 x, Uint32 y) :
CSpriteObject(pmap, x, y),
mFoeID(foeID),
m_ActionTicker(0),
m_ActionNumber(0),
m_ActionBaseOffset(0x0),
......
......@@ -13,7 +13,7 @@
class CGalaxySpriteObject: public CSpriteObject
{
public:
CGalaxySpriteObject(CMap *pmap, Uint32 x, Uint32 y);
CGalaxySpriteObject(CMap *pmap, const Uint16 foeID, Uint32 x, Uint32 y);
void setupGalaxyObjectOnMap(const size_t ActionBaseOffset = 0x0,
const size_t ActionNumber = 0x0 );
......@@ -32,6 +32,7 @@ public:
void processActionRoutine();
// This is used for action format only
uint16_t mFoeID;
uint16_t m_ActionTicker;
uint16_t m_ActionNumber;
size_t m_ActionBaseOffset;
......
......@@ -299,7 +299,7 @@ void CMapLoaderGalaxy::spawnFoes(CMap &Map)
{
for(size_t x=0 ; x<width ; x++)
{
addFoe(Map, *data_ptr++, x, y);
addFoe(Map, *data_ptr++, x<<CSF, y<<CSF);
}
}
......@@ -360,11 +360,6 @@ const int DIVE_SUIT = 35;
*/
void CMapLoaderGalaxy::addFoe(CMap &Map, word foe, size_t x, size_t y)
{
// TODO: Split this function into the one meant for the map, because some enemies are loaded on that WM
// that shouldn't
x <<= CSF;
y <<= CSF;
CGalaxySpriteObject *p_newfoe = NULL;
VectorD2<Uint32> Location(x,y);
......@@ -374,13 +369,13 @@ void CMapLoaderGalaxy::addFoe(CMap &Map, word foe, size_t x, size_t y)
if( foe == i )
{
const Uint32 newsprite = 103+2*(i-61);
p_newfoe = new galaxy::CSpriteItem(&Map, x, y, m_ObjectPtr, newsprite);
p_newfoe = new galaxy::CSpriteItem(&Map, foe, x, y, m_ObjectPtr, newsprite);
}
}
if( foe == 68 )
{
p_newfoe = new galaxy::CSpriteItem(&Map, x, y, m_ObjectPtr, 127);
p_newfoe = new galaxy::CSpriteItem(&Map, foe, x, y, m_ObjectPtr, 127);
}
for( Uint32 i=57 ; i<=60 ; i++ )
......@@ -388,7 +383,7 @@ void CMapLoaderGalaxy::addFoe(CMap &Map, word foe, size_t x, size_t y)
if( foe == i )
{
const Uint32 newsprite = 118+2*(i-57);
p_newfoe = new galaxy::CSpriteItem(&Map, x, y, m_ObjectPtr, newsprite);
p_newfoe = new galaxy::CSpriteItem(&Map, foe, x, y, m_ObjectPtr, newsprite);
}
}
......@@ -398,108 +393,108 @@ void CMapLoaderGalaxy::addFoe(CMap &Map, word foe, size_t x, size_t y)
case 1:
case 2:
// This is the player on the map in one level
p_newfoe = new galaxy::CPlayerLevel(&Map, x, y-750, m_ObjectPtr,
p_newfoe = new galaxy::CPlayerLevel(&Map, foe, x, y-750, m_ObjectPtr,
(foe==1) ? RIGHT : LEFT, m_Inventory, m_Cheatmode);
break;
case 3:
// This is the player on the world map
// Add the Camera into the game scene and attach it to this player
p_newfoe = new galaxy::CPlayerWM(&Map, x, y, m_ObjectPtr, m_Inventory, m_Cheatmode);
p_newfoe = new galaxy::CPlayerWM(&Map, foe, x, y, m_ObjectPtr, m_Inventory, m_Cheatmode);
break;
case 4:
//This is a council member.
p_newfoe = new galaxy::CCouncilMember(&Map, x, y-750);
p_newfoe = new galaxy::CCouncilMember(&Map, foe, x, y-750);
break;
case 6:
//This is pincess Lindsey.
p_newfoe = new galaxy::CLindsey(&Map, x, y-750);
p_newfoe = new galaxy::CLindsey(&Map, foe, x, y-750);
break;
case 12:
//This is a Bounder.
// 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, x, y-250);
p_newfoe = new galaxy::CBounder(&Map, foe, x, y-250);
break;
case 19:
//This is a Mimrock.
// TODO: Those relative coordinates are not a good sign. Try to remove them and make the Sprite substract them
p_newfoe = new galaxy::CMimrock(&Map, x, y-(2<<CSF));
p_newfoe = new galaxy::CMimrock(&Map, foe, x, y-(2<<CSF));
break;
case 21:
// This is a Mad Mushroom.
p_newfoe = new galaxy::CMadMushroom(&Map, x, y-(2<<CSF));
p_newfoe = new galaxy::CMadMushroom(&Map, foe, x, y-(2<<CSF));
break;
case 22:
// This is a Poison Slug.
p_newfoe = new galaxy::CPoisonSlug(&Map, x, y-250, m_ObjectPtr);
p_newfoe = new galaxy::CPoisonSlug(&Map, foe, x, y-250, m_ObjectPtr);
break;
case 23:
// This is a Sprite from the well of wishes.
p_newfoe = new galaxy::CDevilSprite(&Map, x, y);
p_newfoe = new galaxy::CDevilSprite(&Map, foe, x, y);
break;
case 24:
// This is a Sprite from the well of wishes.
p_newfoe = new galaxy::CSchoolFish(&Map, x, y);
p_newfoe = new galaxy::CSchoolFish(&Map, foe, x, y);
break;
case 25:
// This is Skypest.
p_newfoe = new galaxy::CSkypest(&Map, x, y);
p_newfoe = new galaxy::CSkypest(&Map, foe, x, y);
break;
case PLATFORM_VERT: case PLATFORM_VERT_ALT:
p_newfoe = new galaxy::CPlatformVertical(&Map, x, y); break;
p_newfoe = new galaxy::CPlatformVertical(&Map, foe, x, y); break;
case PLATFORM_HORIZ_ALT:
case PLATFORM_HORIZ:
p_newfoe = new galaxy::CPlatformHorizontal(&Map, x, y); break;
p_newfoe = new galaxy::CPlatformHorizontal(&Map, foe, x, y); break;
case PLATFORM_DROP:
p_newfoe = new galaxy::CPlatformDrop(&Map, x, y); break;
p_newfoe = new galaxy::CPlatformDrop(&Map, foe, x, y); break;
case 33:
// Place Miragia in Episode 4 on the Map
p_newfoe = new galaxy::CMiragia(&Map, Location);
p_newfoe = new galaxy::CMiragia(&Map, foe, Location);
break;
case DIVE_SUIT:
// Place Miragia in Episode 4 on the Map
p_newfoe = new galaxy::CDiveSuit(&Map, x, y);
p_newfoe = new galaxy::CDiveSuit(&Map, foe, x, y);
break;
case 42:
// This is Keen in the swimming suit
p_newfoe = new galaxy::CPlayerDive(&Map, x, y, m_ObjectPtr,
p_newfoe = new galaxy::CPlayerDive(&Map, foe, x, y, m_ObjectPtr,
RIGHT, m_Inventory, m_Cheatmode);
break;
case 47:
// This is the Lick
p_newfoe = new galaxy::CLick(&Map, x, y);
p_newfoe = new galaxy::CLick(&Map, foe, x, y);
break;
case 71:
// Watermine vertical
p_newfoe = new galaxy::CWaterMine(&Map, x, y, true);
p_newfoe = new galaxy::CWaterMine(&Map, foe, x, y, true);
break;
case 72:
// Watermine horizontal
p_newfoe = new galaxy::CWaterMine(&Map, x, y, false);
p_newfoe = new galaxy::CWaterMine(&Map, foe, x, y, false);
break;
case 87:
// Dope Fish
p_newfoe = new galaxy::CDopeFish(&Map, x, y);
p_newfoe = new galaxy::CDopeFish(&Map, foe, x, y);
break;
......
......@@ -8,6 +8,7 @@
#include "CMapPlayGalaxy.h"
#include "engine/galaxy/ai/CPlayerBase.h"
#include "common/CBehaviorEngine.h"
#include "CMapLoaderGalaxy.h"
CMapPlayGalaxy::CMapPlayGalaxy(CExeFile &ExeFile, CInventory &Inventory, stCheat &Cheatmode) :
mActive(false),
......@@ -158,6 +159,9 @@ void CMapPlayGalaxy::process(const bool msgboxactive)
// Saves the inventory using the Savegamecontroller.
void CMapPlayGalaxy::operator>>(CSaveGameController &savedGame)
{
const Uint16 level = mMap.getLevel();
savedGame.encodeData( level );
size_t size = mObjectPtr.size();
// save the number of objects on screen
savedGame.encodeData(size);
......@@ -166,6 +170,7 @@ void CMapPlayGalaxy::operator>>(CSaveGameController &savedGame)
for( ; it != mObjectPtr.end() ; it++ )
{
// save all the objects states
savedGame.encodeData( (*it)->mFoeID );
savedGame.encodeData( (*it)->getXPosition() );
savedGame.encodeData( (*it)->getYPosition() );
savedGame.encodeData( (*it)->dead );
......@@ -190,42 +195,78 @@ void CMapPlayGalaxy::operator>>(CSaveGameController &savedGame)
// Save the map_data as it is left
savedGame.encodeData(mMap.m_width);
savedGame.encodeData(mMap.m_height);
savedGame.addData( reinterpret_cast<byte*>(mMap.getBackgroundData()),
mMap.m_width*mMap.m_height*sizeof(word) );
savedGame.addData( reinterpret_cast<byte*>(mMap.getForegroundData()),
mMap.m_width*mMap.m_height*sizeof(word) );
const Uint32 mapSize = mMap.m_width*mMap.m_height*sizeof(word);
savedGame.addData( reinterpret_cast<byte*>(mMap.getBackgroundData()), mapSize );
savedGame.addData( reinterpret_cast<byte*>(mMap.getForegroundData()), mapSize );
}
// This is for loading the game
bool CMapPlayGalaxy::operator<<(CSaveGameController &savedGame)
{
Uint16 level;
savedGame.decodeData( level );
// Load the World map level.
galaxy::CMapLoaderGalaxy MapLoader(mExeFile, mObjectPtr, mInventory, mCheatmode);
MapLoader.loadMap( mMap, level );
// Load the Background Music
g_pMusicPlayer->stop();
if( !g_pMusicPlayer->load(mExeFile, level) )
g_pLogFile->textOut("Warning: The music cannot be played. Check that all the files have been correctly copied!");
else
g_pMusicPlayer->play();
// load the number of objects on screen
Uint32 size;
Uint32 x, y;
Uint16 foeID;
uint16_t actionNumber;
savedGame.decodeData(size);
std::vector< SmartPointer<CGalaxySpriteObject> >::iterator it = mObjectPtr.begin();
for( ; it != mObjectPtr.end() ; it++ )
// Now load the previously created objects
if(!mObjectPtr.empty())
mObjectPtr.clear();
for( Uint32 i=0 ; i<size ; i++ )
{
// save all the objects states
savedGame.decodeData(foeID);
savedGame.decodeData(x);
savedGame.decodeData(y);
(*it)->moveToForce(VectorD2<int>(x,y));
savedGame.decodeData( (*it)->dead );
savedGame.decodeData( (*it)->onscreen );
savedGame.decodeData( (*it)->hasbeenonscreen );
savedGame.decodeData( (*it)->exists );
savedGame.decodeData( (*it)->blockedd );
savedGame.decodeData( (*it)->blockedu );
savedGame.decodeData( (*it)->blockedl );
savedGame.decodeData( (*it)->blockedr );
savedGame.decodeData( (*it)->mHealthPoints );
savedGame.decodeData( (*it)->canbezapped );
savedGame.decodeData( (*it)->cansupportplayer );
savedGame.decodeData( (*it)->inhibitfall );
savedGame.decodeData( (*it)->honorPriority );
savedGame.decodeData( (*it)->sprite );
savedGame.decodeData( (*it)->m_ActionNumber );
MapLoader.addFoe(mMap, foeID, x, y);
CGalaxySpriteObject &obj = *(mObjectPtr.back().get());
savedGame.decodeData( obj.dead );
savedGame.decodeData( obj.onscreen );
savedGame.decodeData( obj.hasbeenonscreen );
savedGame.decodeData( obj.exists );
savedGame.decodeData( obj.blockedd );
savedGame.decodeData( obj.blockedu );
savedGame.decodeData( obj.blockedl );
savedGame.decodeData( obj.blockedr );
savedGame.decodeData( obj.mHealthPoints );
savedGame.decodeData( obj.canbezapped );
savedGame.decodeData( obj.cansupportplayer );
savedGame.decodeData( obj.inhibitfall );
savedGame.decodeData( obj.honorPriority );
savedGame.decodeData( obj.sprite );
savedGame.decodeData( actionNumber );
obj.setActionForce(actionNumber);
// remove non existing objects, they only are problematic
if(obj.dead)
obj.exists = false;
if(!obj.exists)
mObjectPtr.pop_back();
}
savedGame.decodeData( mActive );
......@@ -237,5 +278,8 @@ bool CMapPlayGalaxy::operator<<(CSaveGameController &savedGame)
savedGame.readDataBlock( reinterpret_cast<byte*>(mMap.getBackgroundData()) );
savedGame.readDataBlock( reinterpret_cast<byte*>(mMap.getForegroundData()) );
if( mMap.m_width * mMap.m_height > 0 )
mMap.drawAll();
return true;
}
......@@ -27,7 +27,8 @@
#include <vector>
#include <list>
class CMapPlayGalaxy {
class CMapPlayGalaxy
{
public:
CMapPlayGalaxy(CExeFile &ExeFile, CInventory &Inventory, stCheat &Cheatmode);
......@@ -47,6 +48,9 @@ public:
// This is for loading the game
bool operator<<(CSaveGameController &savedGame);
CMap &getMapObj()
{ return mMap ;}
protected:
std::vector< SmartPointer<CGalaxySpriteObject> > mObjectPtr;
......
......@@ -47,23 +47,23 @@ bool CPlayGameGalaxy::loadGameState()
/// Save the Game in the CSavedGame object
// store the episode, level and difficulty
savedGame.decodeData(m_Episode);
savedGame.decodeData(m_Level);
savedGame.decodeData(g_pBehaviorEngine->mDifficulty);
// Load number of Players
savedGame.decodeData(m_NumPlayers);
// We need to load both Levels first, before we do the writing from the saved state.
init(); // This will do the job
m_Inventory << savedGame;
m_WorldMap << savedGame;
m_LevelPlay << savedGame;
// Create the special merge effect (Fadeout)
g_pGfxEngine->setupEffect(pColorMergeFX);
return savedGame.load();
return true;
}
bool CPlayGameGalaxy::saveGameState()
......@@ -73,7 +73,6 @@ bool CPlayGameGalaxy::saveGameState()
/// Save the Game in the CSavedGame object
// store the episode, level and difficulty
savedGame.encodeData(m_Episode);
savedGame.encodeData(m_Level);
savedGame.encodeData(g_pBehaviorEngine->mDifficulty);
// Save number of Players
......
......@@ -14,8 +14,8 @@ namespace galaxy
const Uint32 speed = 10;
const Uint32 hittime = 100;
CBullet::CBullet(CMap *pmap, const Uint32 x, const Uint32 y, const direction_t dir) :
CGalaxySpriteObject(pmap, x, y)
CBullet::CBullet(CMap *pmap, const Uint16 foeID, const Uint32 x, const Uint32 y, const direction_t dir) :
CGalaxySpriteObject(pmap, foeID, x, y)
{
m_hDir = NONE; m_vDir = NONE;
......
......@@ -63,7 +63,7 @@ namespace galaxy
class CBullet : public CGalaxySpriteObject {
public:
CBullet(CMap *pmap, Uint32 x, Uint32 y, direction_t dir);
CBullet(CMap *pmap, const Uint16 foeID, Uint32 x, Uint32 y, direction_t dir);
void process();
private:
......
......@@ -12,9 +12,9 @@ namespace galaxy {
CEnemyShot::CEnemyShot(CMap *pmap, const Uint32 x, const Uint32 y,
CEnemyShot::CEnemyShot(CMap *pmap, const Uint16 foeID, const Uint32 x, const Uint32 y,
const int actionFormatOffset, const direction_t dir, const int speed) :
CGalaxySpriteObject(pmap, x, y),
CGalaxySpriteObject(pmap, foeID, x, y),
m_speed(speed)
{
setupGalaxyObjectOnMap(actionFormatOffset, 0);
......
......@@ -18,7 +18,7 @@ namespace galaxy {
class CEnemyShot : public CGalaxySpriteObject
{
public:
CEnemyShot(CMap *pmap, const Uint32 x, const Uint32 y,
CEnemyShot(CMap *pmap, const Uint16 foeID, const Uint32 x, const Uint32 y,
const int actionFormatOffset, const direction_t dir, const int speed);
void getTouchedBy(CSpriteObject &theObject);
......
......@@ -16,9 +16,9 @@ const Uint16 WAVING_BASEFRAME = 181;
const Uint16 ANIMATION_TIME = 8;
const Uint16 SPEED = 64;
CFlag::CFlag(CMap *pmap, const VectorD2<Uint32> &Location,
CFlag::CFlag(CMap *pmap, const Uint16 foeID, const VectorD2<Uint32> &Location,
const VectorD2<Uint32> &Destination) :
CGalaxySpriteObject(pmap, Location.x, Location.y),
CGalaxySpriteObject(pmap, foeID, Location.x, Location.y),
m_location(Location),
m_destination(Destination),
m_baseframe(FLYING_BASEFRAME),
......
......@@ -19,7 +19,7 @@ namespace galaxy {
class CFlag : public CGalaxySpriteObject
{
public:
CFlag(CMap *pmap, const VectorD2<Uint32> &Location,
CFlag(CMap *pmap, const Uint16 foeID, const VectorD2<Uint32> &Location,
const VectorD2<Uint32> &Destination);
// The flag is flying when player throws it.
......
......@@ -16,8 +16,8 @@ namespace galaxy {
const int itemEffectTime = 50;
const int itemEffectTime_Animation = 14;
CItemEffect::CItemEffect(CMap *pmap, Uint32 x, Uint32 y, Uint16 l_sprite, item_effect_type ieffect) :
CGalaxySpriteObject(pmap, x, y)
CItemEffect::CItemEffect(CMap *pmap, const Uint16 foeID, Uint32 x, Uint32 y, Uint16 l_sprite, item_effect_type ieffect) :
CGalaxySpriteObject(pmap, foeID, x, y)
{
m_timer = 0;
sprite = l_sprite-124;
......
......@@ -38,7 +38,7 @@ enum item_effect_type
class CItemEffect : public CGalaxySpriteObject
{
public:
CItemEffect(CMap *pmap, Uint32 x, Uint32 y, Uint16 l_sprite, item_effect_type ieffect = FLOAT);
CItemEffect(CMap *pmap, const Uint16 foeID, Uint32 x, Uint32 y, Uint16 l_sprite, item_effect_type ieffect = FLOAT);
void process();
private:
......
......@@ -15,13 +15,14 @@ namespace galaxy {
CPlayerBase::CPlayerBase(
CMap *pmap,
const Uint16 foeID,
Uint32 x,
Uint32 y,
std::vector< SmartPointer<CGalaxySpriteObject> >& ObjectPtrs,
direction_t facedir,
CInventory &l_Inventory,
stCheat &Cheatmode) :
CGalaxySpriteObject(pmap, x, y),
CGalaxySpriteObject(pmap, foeID, x, y),
m_Inventory(l_Inventory),
m_camera(pmap,x,y,this),
mPlayerNum(0),
......@@ -48,7 +49,7 @@ void CPlayerBase::getAnotherLife(const int &lc_x, const int &lc_y)
{
m_Inventory.Item.m_lifes++;
g_pSound->playSound( SOUND_EXTRA_LIFE );
m_ObjectPtrs.push_back(new CItemEffect(mp_Map, lc_x<<CSF, lc_y<<CSF, got_sprite_item_pics[10]));
m_ObjectPtrs.push_back(new CItemEffect(mp_Map, 0, lc_x<<CSF, lc_y<<CSF, got_sprite_item_pics[10]));
}
......@@ -153,7 +154,7 @@ void CPlayerBase::processLevelMiscFlagsCheck()
const int lc_x = l_x>>CSF;
const int lc_y = l_y>>CSF;
mp_Map->setTile( lc_x, lc_y, 0, true, 1 );
m_ObjectPtrs.push_back(new CItemEffect(mp_Map, lc_x<<CSF, lc_y<<CSF, 215, ANIMATE));
m_ObjectPtrs.push_back(new CItemEffect(mp_Map, 0, lc_x<<CSF, lc_y<<CSF, 215, ANIMATE));
m_Item.m_drops++;
if(m_Item.m_drops >= 100)
......@@ -174,7 +175,7 @@ void CPlayerBase::processLevelMiscFlagsCheck()
const int lc_x = l_x>>CSF;
const int lc_y = l_y>>CSF;
mp_Map->setTile( lc_x, lc_y, 0, true, 1 );
m_ObjectPtrs.push_back(new CItemEffect(mp_Map, lc_x<<CSF, lc_y<<CSF, got_sprite_item_pics[4+i-21]));
m_ObjectPtrs.push_back(new CItemEffect(mp_Map, 0, lc_x<<CSF, lc_y<<CSF, got_sprite_item_pics[4+i-21]));
switch(i)
{
......
......@@ -38,6 +38,7 @@ public:
* Coordinates as also the type of the Object
*/
CPlayerBase(CMap *pmap,
const Uint16 foeID,
Uint32 x,
Uint32 y,
std::vector< SmartPointer<CGalaxySpriteObject> >& ObjectPtrs,
......
......@@ -33,10 +33,10 @@ const int POGO_INERTIA_HOR_REACTION = 2;
const int FIRE_RECHARGE_TIME = 5;
CPlayerLevel::CPlayerLevel(CMap *pmap, Uint32 x, Uint32 y,
CPlayerLevel::CPlayerLevel(CMap *pmap, const Uint16 foeID, Uint32 x, Uint32 y,
std::vector< SmartPointer<CGalaxySpriteObject> > &ObjectPtrs, direction_t facedir,
CInventory &l_Inventory, stCheat &Cheatmode) :
CPlayerBase(pmap, x, y, ObjectPtrs, facedir, l_Inventory, Cheatmode),
CPlayerBase(pmap, foeID, x, y, ObjectPtrs, facedir, l_Inventory, Cheatmode),
m_jumpdownfromobject(false)
{
mp_processState = (void (CPlayerBase::*)()) &CPlayerLevel::processStanding;
......@@ -95,7 +95,7 @@ void CPlayerLevel::tryToShoot( const VectorD2<int> &pos, const direction_t &dir
{
if(m_Inventory.Item.m_bullets > 0)
{
m_ObjectPtrs.push_back(new CBullet(mp_Map, pos.x, pos.y, dir));
m_ObjectPtrs.push_back(new CBullet(mp_Map, 0, pos.x, pos.y, dir));
m_Inventory.Item.m_bullets--;
}
else
......
......@@ -49,7 +49,7 @@ namespace galaxy {
class CPlayerLevel : public CPlayerBase {
public:
CPlayerLevel(CMap *pmap, Uint32 x, Uint32 y,
CPlayerLevel(CMap *pmap, const Uint16 foeID, Uint32 x, Uint32 y,
std::vector< SmartPointer<CGalaxySpriteObject> > &ObjectPtrs, direction_t facedir,
CInventory &l_Inventory, stCheat &Cheatmode);
......
......@@ -20,12 +20,13 @@ const Uint16 SWIMBASEFRAME = 156;
namespace galaxy {
CPlayerWM::CPlayerWM(CMap *pmap,
const Uint16 foeID,
Uint32 x,
Uint32 y,
std::vector< SmartPointer<CGalaxySpriteObject> > &ObjectPtrs,
CInventory &l_Inventory,
stCheat &Cheatmode):
CPlayerBase(pmap, x, y,
CPlayerBase(pmap, foeID, x, y,
ObjectPtrs,
LEFT,
l_Inventory,
......@@ -211,7 +212,7 @@ void CPlayerWM::finishLevel(Uint16 object)
VectorD2<Uint32> src(getXPosition(), getYPosition());
VectorD2<Uint32> dst((x<<CSF), (y<<CSF));
CFlag *pFlag = new CFlag(mp_Map, src, dst);
CFlag *pFlag = new CFlag(mp_Map, 0, src, dst);
m_ObjectPtrs.push_back(pFlag);
g_pSound->playSound( SOUND_FLAG_APPEAR );
......
......@@ -16,6 +16,7 @@ class CPlayerWM : public CPlayerBase
{
public:
CPlayerWM(CMap *pmap,
const Uint16 foeID,
Uint32 x,
Uint32 y,
std::vector< SmartPointer<CGalaxySpriteObject> > &ObjectPtrs,
......
......@@ -15,9 +15,9 @@ namespace galaxy {
const int MAX_ANIMATION_TIMER = 20;
CSpriteItem::CSpriteItem(CMap *pmap, Uint32 x, Uint32 y,
CSpriteItem::CSpriteItem(CMap *pmap, const Uint16 foeID, Uint32 x, Uint32 y,
std::vector< SmartPointer<CGalaxySpriteObject> > &ObjectPtrs, Uint32 sprite) :
CGalaxySpriteObject(pmap, x, y),
CGalaxySpriteObject(pmap, foeID, x, y),
m_ObjectPtrs(ObjectPtrs)
{
m_basesprite = sprite;
......@@ -75,7 +75,7 @@ void CSpriteItem::getTouchedBy(CSpriteObject &theObject)
g_pSound->playSound( SOUND_GET_AMMO );
}
m_ObjectPtrs.push_back(new CItemEffect(mp_Map, getXPosition(), getYPosition(), newanimsprite));
m_ObjectPtrs.push_back(new CItemEffect(mp_Map, 0, getXPosition(), getYPosition(), newanimsprite));
// Now add the stuff to the inventory
......