Commit 7e619a65 authored by Gerhard Stein's avatar Gerhard Stein

Some Keen 5 additions

parent f7ea9170
......@@ -7,6 +7,7 @@
#include "CLevelPlay.h"
#include "ep4/CMapLoaderGalaxyEp4.h"
#include "ep5/CMapLoaderGalaxyEp5.h"
#include "sdl/input/CInput.h"
#include "sdl/CVideoDriver.h"
#include "sdl/music/CMusic.h"
......@@ -31,8 +32,8 @@ void CLevelPlay::loadMap(const int level)
if(g_pBehaviorEngine->getEpisode() == 4)
MapLoader = new CMapLoaderGalaxyEp4(mExeFile, mObjectPtr, mInventory, mCheatmode);
else
MapLoader = new CMapLoaderGalaxy(mExeFile, mObjectPtr, mInventory, mCheatmode);
else if(g_pBehaviorEngine->getEpisode() == 5)
MapLoader = new CMapLoaderGalaxyEp5(mExeFile, mObjectPtr, mInventory, mCheatmode);
MapLoader->loadMap( mMap, level );
......@@ -60,7 +61,11 @@ bool CLevelPlay::loadLevel(const Uint16 level)
const std::string loading_text = g_pBehaviorEngine->getString(level_text);
CEventContainer& EventContainer = g_pBehaviorEngine->m_EventList;
EventContainer.add( new EventSendBitmapDialogMsg(106, loading_text, LEFT) );
if(g_pBehaviorEngine->getEpisode() == 4 )
EventContainer.add( new EventSendBitmapDialogMsg(106, loading_text, LEFT) );
else
EventContainer.add( new EventSendBitmapDialogMsg(1, loading_text, LEFT) );
mMap.drawAll();
return true;
......
......@@ -24,8 +24,6 @@
/// AI Headers
// General stuff
#include "engine/galaxy/ai/CPlayerWM.h"
#include "engine/galaxy/ai/CPlayerLevel.h"
#include "engine/galaxy/ai/CSpriteItem.h"
#include <fstream>
......@@ -359,22 +357,6 @@ CGalaxySpriteObject* CMapLoaderGalaxy::addFoe(CMap &Map, word foe, size_t x, siz
}
}
switch(foe)
{
case 1:
case 2:
// This is the player on the map in one level
p_newfoe = new galaxy::CPlayerLevel(&Map, foe, x, y, 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, foe, x, y, m_ObjectPtr, m_Inventory, m_Cheatmode);
break;
default: break;
}
return p_newfoe;
}
......
......@@ -17,7 +17,8 @@
#include "engine/galaxy/CInventory.h"
#include "engine/galaxy/CGalaxySpriteObject.h"
#include "common/CBehaviorEngine.h"
#include "CMapLoaderGalaxy.h"
#include "ep4/CMapLoaderGalaxyEp4.h"
#include "ep5/CMapLoaderGalaxyEp5.h"
#include "sdl/input/CInput.h"
#include "sdl/CVideoDriver.h"
#include "sdl/music/CMusic.h"
......
......@@ -19,11 +19,17 @@ CMapPlayGalaxy(ExeFile, Inventory, Cheatmode)
void CWorldMap::init()
{
// Load the World map level.
CMapLoaderGalaxy MapLoader(mExeFile, mObjectPtr, mInventory, mCheatmode);
SmartPointer<CMapLoaderGalaxy> MapLoader;
MapLoader.loadMap(mMap, 0); // Is it a Map Level?
const std::string loading_text = g_pBehaviorEngine->getString("WORLDMAP_LOAD_TEXT");
if(g_pBehaviorEngine->getEpisode() == 4)
MapLoader = new CMapLoaderGalaxyEp4(mExeFile, mObjectPtr, mInventory, mCheatmode);
else if(g_pBehaviorEngine->getEpisode() == 5)
MapLoader = new CMapLoaderGalaxyEp5(mExeFile, mObjectPtr, mInventory, mCheatmode);
MapLoader->loadMap( mMap, 0 );
const std::string loading_text = g_pBehaviorEngine->getString("WORLDMAP_LOAD_TEXT");
CEventContainer& EventContainer = g_pBehaviorEngine->m_EventList;
if(g_pBehaviorEngine->getEpisode() == 4 )
......
......@@ -14,7 +14,6 @@
#include "sdl/sound/CSound.h"
#include "CVec.h"
const Uint16 WALKBASEFRAME = 130;
const Uint16 SWIMBASEFRAME = 156;
namespace galaxy {
......@@ -25,21 +24,38 @@ CPlayerWM::CPlayerWM(CMap *pmap,
Uint32 y,
std::vector< SmartPointer<CGalaxySpriteObject> > &ObjectPtrs,
CInventory &l_Inventory,
stCheat &Cheatmode):
stCheat &Cheatmode,
const unsigned int actionoffset):
CPlayerBase(pmap, foeID, x, y,
ObjectPtrs,
LEFT,
l_Inventory,
Cheatmode),
m_basesprite(WALKBASEFRAME),
m_basesprite(0),
walkBaseFrame(0),
m_looking_dir(LEFT),
m_animation(0),
m_animation_time(1),
m_animation_ticker(0),
m_cantswim(false)
{
sprite = m_basesprite;
// TODO: Another Workaround
if(g_pBehaviorEngine->getEpisode() == 4)
{
setupGalaxyObjectOnMap(actionoffset, 0);
}
else
sprite = 115;
// TODO: Temporary workaround
sprite += 15;
walkBaseFrame = sprite;
m_basesprite = walkBaseFrame;
CSprite &rSprite = g_pGfxEngine->getSprite(sprite);
performCollisions();
processMove( 0, rSprite.m_bboxY1-rSprite.m_bboxY2 );
}
/**
......@@ -83,7 +99,7 @@ void CPlayerWM::processMoving()
int movespeed;
if(m_basesprite == SWIMBASEFRAME)
movespeed = 25;
else if(m_basesprite == WALKBASEFRAME)
else if(m_basesprite == walkBaseFrame)
movespeed = 50;
else
movespeed = 0;
......@@ -155,7 +171,7 @@ void CPlayerWM::processMoving()
}
// If keen is just walking on the map or swimming in the sea. Do the proper animation for it.
if(m_basesprite == WALKBASEFRAME)
if(m_basesprite == walkBaseFrame)
{
performWalkingAnimation(walking);
m_cantswim = false;
......@@ -262,7 +278,7 @@ void CPlayerWM::checkforSwimming(bool &bleft, bool &bright, bool &bup, bool &bdo
m_basesprite = SWIMBASEFRAME;
}
else if(down == 11)
m_basesprite = WALKBASEFRAME;
m_basesprite = walkBaseFrame;
// from right
if(right == 12)
......@@ -271,7 +287,7 @@ void CPlayerWM::checkforSwimming(bool &bleft, bool &bright, bool &bup, bool &bdo
m_basesprite = SWIMBASEFRAME;
}
else if(left == 12)
m_basesprite = WALKBASEFRAME;
m_basesprite = walkBaseFrame;
// from bottom
if(down == 13)
......@@ -280,7 +296,7 @@ void CPlayerWM::checkforSwimming(bool &bleft, bool &bright, bool &bup, bool &bdo
m_basesprite = SWIMBASEFRAME;
}
else if(up == 13)
m_basesprite = WALKBASEFRAME;
m_basesprite = walkBaseFrame;
// from left
if(left == 14)
......@@ -289,7 +305,7 @@ void CPlayerWM::checkforSwimming(bool &bleft, bool &bright, bool &bup, bool &bdo
m_basesprite = SWIMBASEFRAME;
}
else if(right == 14)
m_basesprite = WALKBASEFRAME;
m_basesprite = walkBaseFrame;
if(m_Inventory.Item.m_special.ep4.swimsuit)
bleft = bright = bup = bdown = false;
......
......@@ -21,7 +21,8 @@ public:
Uint32 y,
std::vector< SmartPointer<CGalaxySpriteObject> > &ObjectPtrs,
CInventory &l_Inventory,
stCheat &Cheatmode);
stCheat &Cheatmode,
const unsigned int actionoffset);
void process();
void processMoving();
......@@ -35,6 +36,7 @@ public:
private:
Uint16 m_basesprite;
Uint16 walkBaseFrame;
direction_t m_looking_dir;
Uint8 m_animation;
......
......@@ -8,6 +8,8 @@
#include "CMapLoaderGalaxyEp4.h"
// Episode 4
#include "engine/galaxy/ai/CPlayerWM.h"
#include "engine/galaxy/ai/CPlayerLevel.h"
#include "engine/galaxy/ai/ep4/CPlayerDive.h"
#include "engine/galaxy/ai/ep4/CPoisonSlug.h"
#include "engine/galaxy/ai/ep4/CMadMushroom.h"
......@@ -78,6 +80,20 @@ CGalaxySpriteObject* CMapLoaderGalaxyEp4::addFoe(CMap &Map, word foe, size_t x,
switch(foe)
{
case 1:
case 2:
// This is the player on the map in one level
p_newfoe = new galaxy::CPlayerLevel(&Map, foe, x, y, 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, foe, x, y,
m_ObjectPtr, m_Inventory, m_Cheatmode, 0x150A);
break;
case 4:
//This is a council member.
......
/*
* CMapLoaderGalaxyEp5.cpp
*
* Created on: 29.07.2012
* Author: gerstrong
*/
#include "CMapLoaderGalaxyEp5.h"
// Episode 5
#include "engine/galaxy/ai/CPlayerWM.h"
#include "engine/galaxy/ai/CPlayerLevel.h"
// TODO: I'm note sure yet, if those are really common platforms
#include "engine/galaxy/ai/platforms.h"
#include "engine/galaxy/ai/CFlag.h"
namespace galaxy
{
CMapLoaderGalaxyEp5::CMapLoaderGalaxyEp5(CExeFile &ExeFile,
std::vector< SmartPointer<CGalaxySpriteObject> > &ObjectPtr,
CInventory &Inventory, stCheat &Cheatmode) :
CMapLoaderGalaxy( ExeFile, ObjectPtr, Inventory, Cheatmode)
{}
// Platforms:
// 27-30 & 32 seem to be the actual platforms. There may be more of numbers lower than 27.
// 31 seem to be the stoppers, those are not created because the platform
// get this from the object map directly
const unsigned int PLATFORM_VERT_ALT = 27;
const unsigned int PLATFORM_HORIZ_ALT = 28;
const unsigned int PLATFORM_VERT = 29;
const unsigned int PLATFORM_HORIZ = 30;
// 31 does not count, because it's a blocker.
const unsigned int PLATFORM_DROP = 32;
const unsigned int DIVE_SUIT = 35;
/**
* @brief Loads a foe given by the coordiantes
*/
CGalaxySpriteObject* CMapLoaderGalaxyEp5::addFoe(CMap &Map, word foe, size_t x, size_t y)
{
CGalaxySpriteObject* commonfoe = CMapLoaderGalaxy::addFoe(Map, foe, x, y);
// If a foe was found, that is common in all the galaxy games, just return.
if( commonfoe )
return commonfoe;
// otherwise look for special foe.
VectorD2<Uint32> loc(x,y);
CGalaxySpriteObject* p_newfoe = NULL;
switch(foe)
{
case 1:
case 2:
// This is the player on the map in one level
p_newfoe = new galaxy::CPlayerLevel(&Map, foe, x, y, 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,
foe, x, y, m_ObjectPtr,
m_Inventory, m_Cheatmode, 0x13B6 );
break;
case PLATFORM_VERT: case PLATFORM_VERT_ALT:
p_newfoe = new galaxy::CPlatformVertical(&Map, foe, x, y); break;
case PLATFORM_HORIZ_ALT:
case PLATFORM_HORIZ:
p_newfoe = new galaxy::CPlatformHorizontal(&Map, foe, x, y); break;
case PLATFORM_DROP:
p_newfoe = new galaxy::CPlatformDrop(&Map, foe, x, y); break;
default:
break;
}
return p_newfoe;
}
};
/*
* CMapLoaderGalaxyEp4.h
*
* Created on: 29.07.2012
* Author: gerstrong
*/
#ifndef CMAPLOADERGALAXYEP5_H_
#define CMAPLOADERGALAXYEP5_H_
#include "../CMapLoaderGalaxy.h"
namespace galaxy
{
class CMapLoaderGalaxyEp5 : public CMapLoaderGalaxy
{
public:
CMapLoaderGalaxyEp5(CExeFile &ExeFile,
std::vector< SmartPointer<CGalaxySpriteObject> > &ObjectPtr,
CInventory &Inventory, stCheat &Cheatmode);
CGalaxySpriteObject* addFoe(CMap &Map, word foe, size_t x, size_t y);
};
};
#endif /* CMAPLOADERGALAXYEP4_H_ */
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