Commit 74cb690c authored by Gerstrong's avatar Gerstrong

Now Keen can dive in the well of wishes. Have fun!

parent 4e69a3d1
......@@ -22,6 +22,7 @@
#include "engine/galaxy/ai/CMiragia.h"
#include "engine/galaxy/ai/CPlayerWM.h"
#include "engine/galaxy/ai/CPlayerLevel.h"
#include "engine/galaxy/ai/CPlayerDive.h"
#include "engine/galaxy/ai/CSpriteItem.h"
#include "engine/galaxy/ai/platforms.h"
#include "engine/galaxy/ai/CPoisonSlug.h"
......@@ -268,20 +269,6 @@ void CMapLoaderGalaxy::spawnFoes(CMap &Map)
word width = Map.m_width;
word height = Map.m_height;
/*std::ofstream file("foe.txt");
data_ptr = start_data;
for(size_t y=0 ; y<height ; y++)
{
for(size_t x=0 ; x<width ; x++)
{
file << (*data_ptr);
file << " ";
data_ptr++;
}
file << std::endl;
}
file.close();*/
// If objects are in the buffer clean them up
while(!m_ObjectPtr.empty())
{
......@@ -416,6 +403,13 @@ void CMapLoaderGalaxy::addFoe(CMap &Map, word foe, size_t x, size_t y)
p_newfoe = new galaxy::CMiragia(&Map, Location);
break;
case 42:
// This is Keen in the swimming suit
p_newfoe = new galaxy::CPlayerDive(&Map, x, y, m_ObjectPtr,
RIGHT, m_Inventory, m_Cheatmode);
break;
default:
break;
}
......
......@@ -14,9 +14,15 @@ m_Inventory(Inventory),
mp_option(g_pBehaviorEngine->m_option)
{}
bool CMapPlayGalaxy::isActive()
{ return m_active; }
void CMapPlayGalaxy::setActive(bool value)
{
m_active = value;
......@@ -29,6 +35,9 @@ void CMapPlayGalaxy::setActive(bool value)
}
}
/**
* return the name of the opened level
*/
......@@ -38,12 +47,19 @@ std::string CMapPlayGalaxy::getLevelName()
}
std::list<CMessageBoxGalaxy*>& CMapPlayGalaxy::getMessageBoxQueue()
{
std::list<CMessageBoxGalaxy*>& queue = m_MessageBoxes;
return queue;
}
void CMapPlayGalaxy::process()
{
// Check if the engine need to be paused
......@@ -163,6 +179,9 @@ void CMapPlayGalaxy::process()
}
}
CMapPlayGalaxy::~CMapPlayGalaxy()
{
while(!m_ObjectPtr.empty())
......
/*
* CPlayerDive.cpp
*
* Created on: 19.06.2011
* Author: gerstrong
*/
#include "CPlayerDive.h"
#include "sdl/CInput.h"
namespace galaxy {
CPlayerDive::CPlayerDive(CMap *pmap,
Uint32 x,
Uint32 y,
std::vector<CObject*>& ObjectPtrs,
direction_t facedir,
CInventory &l_Inventory,
stCheat &Cheatmode) :
CPlayerBase(pmap, x, y,
ObjectPtrs,
facedir,
l_Inventory,
Cheatmode)
{
m_ActionBaseOffset = 0x19EC;
setActionForce(A_KEENSWIM_MOVE);
processActionRoutine();
CSprite &rSprite = g_pGfxEngine->getSprite(sprite);
processMove(0, (14<<STC)-(rSprite.m_bboxY2-rSprite.m_bboxY1));
performCollisions();
}
const int movespeed = 40;
const int WATERFALLSPEED = 20;
void CPlayerDive::process()
{
// In case noclipping was triggered, make it solid, or remove it...
if(m_Cheatmode.noclipping)
{
solid = !solid;
m_Cheatmode.noclipping = false;
}
// Swimming
if(g_pInput->getHoldedCommand(IC_LEFT))
{
if(!g_pInput->getHoldedCommand(IC_UP) && !g_pInput->getHoldedCommand(IC_DOWN))
m_vDir = NONE;
moveLeft(movespeed);
m_hDir = LEFT;
}
else if(g_pInput->getHoldedCommand(IC_RIGHT))
{
if(!g_pInput->getHoldedCommand(IC_UP) && !g_pInput->getHoldedCommand(IC_DOWN))
m_vDir = NONE;
moveRight(movespeed);
m_hDir = RIGHT;
}
// perform actions depending on if the jump button was pressed
if(g_pInput->getHoldedCommand(IC_JUMP))
{
if(g_pInput->getHoldedCommand(IC_UP))
{
//if(!g_pInput->getHoldedCommand(IC_LEFT) && !g_pInput->getHoldedCommand(IC_RIGHT))
moveUp(movespeed);
m_vDir = UP;
}
}
moveDown(WATERFALLSPEED);
m_camera.process();
m_camera.processEvents();
processActionRoutine();
}
}
/*
* CPlayerDive.h
*
* Created on: 19.06.2011
* Author: gerstrong
*/
#ifndef CPLAYERDIVE_H_
#define CPLAYERDIVE_H_
#include "CPlayerBase.h"
namespace galaxy {
#define A_KEENSWIM_MOVE 0
class CPlayerDive: public CPlayerBase {
public:
CPlayerDive(CMap *pmap,
Uint32 x,
Uint32 y,
std::vector<CObject*>& ObjectPtrs,
direction_t facedir,
CInventory &l_Inventory,
stCheat &Cheatmode);
void process();
};
}
#endif /* CPLAYERDIVE_H_ */
......@@ -55,6 +55,8 @@ CPlayerBase(pmap, x, y, ObjectPtrs, facedir, l_Inventory, Cheatmode)
}
// This special code is important, so platforms in all cases will catch Keen when he is falling on them
void CPlayerLevel::processMoveBitDown()
{
......
......@@ -19,23 +19,25 @@ const Uint16 SWIMBASEFRAME = 156;
namespace galaxy {
CPlayerWM::CPlayerWM(CMap *pmap, Uint32 x, Uint32 y,
std::vector<CObject*>& ObjectPtrs,
CInventory &l_Inventory, stCheat &Cheatmode):
CObject(pmap, x, y, OBJ_PLAYER),
m_Inventory(l_Inventory),
CPlayerWM::CPlayerWM(CMap *pmap,
Uint32 x,
Uint32 y,
std::vector<CObject*>& ObjectPtrs,
CInventory &l_Inventory,
stCheat &Cheatmode):
CPlayerBase(pmap, x, y,
ObjectPtrs,
LEFT,
l_Inventory,
Cheatmode),
m_basesprite(WALKBASEFRAME),
m_looking_dir(LEFT),
m_animation(0),
m_animation_time(1),
m_animation_ticker(0),
m_ObjectPtrs(ObjectPtrs),
m_camera(pmap,x,y,this),
m_Cheatmode(Cheatmode)
m_animation_ticker(0)
{
sprite = m_basesprite;
performCollisions();
m_camera.setPosition(m_Pos);
}
/**
......
......@@ -8,19 +8,19 @@
#ifndef CPLAYERWM_H_
#define CPLAYERWM_H_
#include "common/CObject.h"
#include "common/Cheat.h"
#include "engine/CCamera.h"
#include "engine/CEvent.h"
#include "engine/galaxy/CInventory.h"
#include "CPlayerBase.h"
namespace galaxy {
class CPlayerWM : public CObject {
class CPlayerWM : public CPlayerBase {
public:
CPlayerWM(CMap *pmap, Uint32 x, Uint32 y,
CPlayerWM(CMap *pmap,
Uint32 x,
Uint32 y,
std::vector<CObject*>& ObjectPtrs,
CInventory &l_Inventory, stCheat &Cheatmode);
CInventory &l_Inventory,
stCheat &Cheatmode);
void process();
void processMoving();
......@@ -31,8 +31,6 @@ public:
void performWalkingAnimation(bool walking);
void performSwimmingAnimation();
CInventory &m_Inventory;
private:
Uint16 m_basesprite;
direction_t m_looking_dir;
......@@ -40,9 +38,6 @@ private:
Uint8 m_animation;
Uint8 m_animation_time;
Uint8 m_animation_ticker;
std::vector<CObject*>& m_ObjectPtrs;
CCamera m_camera;
stCheat &m_Cheatmode;
};
}
......
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