Commit b601f135 authored by Gerhard Stein's avatar Gerhard Stein

bug fixes, HUD seen on map and better walking animation on map

parent c18643f7
......@@ -14,9 +14,9 @@
#include "CCamera.h"
#include "../CLogFile.h"
#include "../sdl/CVideoDriver.h"
#include "../sdl/CInput.h"
#include "CLogFile.h"
#include "sdl/CVideoDriver.h"
#include "sdl/CInput.h"
#include "spritedefines.h"
CCamera::CCamera(CMap *pmap, Uint32 x, Uint32 y):
......
......@@ -12,10 +12,12 @@
namespace galaxy {
CLevelPlay::CLevelPlay(CExeFile &ExeFile, CInventory &Inventory) :
CLevelPlay::CLevelPlay(CExeFile &ExeFile,
CInventory &Inventory, stOption *p_option) :
m_active(false),
m_ExeFile(ExeFile),
m_Inventory(Inventory)
m_Inventory(Inventory),
mp_option(p_option)
{ }
bool CLevelPlay::isActive()
......@@ -80,7 +82,8 @@ void CLevelPlay::process()
(*obj)->draw();
}
m_Inventory.drawHUD();
if(mp_option[OPT_HUD].value )
m_Inventory.drawHUD();
}
}
......@@ -19,7 +19,7 @@ namespace galaxy {
class CLevelPlay {
public:
CLevelPlay(CExeFile &ExeFile, CInventory &Inventory);
CLevelPlay(CExeFile &ExeFile, CInventory &Inventory, stOption *p_option);
bool isActive();
void setActive(bool value);
......@@ -34,6 +34,7 @@ private:
CMap m_Map;
CExeFile &m_ExeFile;
CInventory &m_Inventory;
stOption *mp_option;
};
}
......
......@@ -350,7 +350,7 @@ void CMapLoaderGalaxy::addFoe(CMap &Map, word foe, size_t x, size_t y)
case 3:
// This is the player on map
p_newfoe = new galaxy::CPlayerWM(&Map, x, y, m_ObjectPtr);
p_newfoe = new galaxy::CPlayerWM(&Map, x, y, m_ObjectPtr, m_Inventory);
// Add the Camera into the game scene and attach it to this player
camera = new CCamera(&Map,x,y);
......
......@@ -20,8 +20,8 @@ CPlayGameGalaxy::CPlayGameGalaxy(CExeFile &ExeFile, char level,
char numplayers, Uint8& difficulty,
stOption *p_option, CSavedGame &SavedGame) :
CPlayGame(ExeFile, level, numplayers, difficulty, p_option),
m_WorldMap(ExeFile, m_Inventory),
m_LevelPlay(ExeFile, m_Inventory),
m_WorldMap(ExeFile, m_Inventory, p_option),
m_LevelPlay(ExeFile, m_Inventory, p_option),
mp_Menu(NULL),
m_SavedGame(SavedGame)
{
......
......@@ -13,10 +13,12 @@
namespace galaxy {
CWorldMap::CWorldMap(CExeFile &ExeFile, CInventory &Inventory):
CWorldMap::CWorldMap(CExeFile &ExeFile,
CInventory &Inventory, stOption *p_option):
m_active(false),
m_ExeFile(ExeFile),
m_Inventory(Inventory)
m_Inventory(Inventory),
mp_option(p_option)
{}
bool CWorldMap::isActive()
......@@ -67,6 +69,10 @@ void CWorldMap::process()
// Draw masked tiles here!
m_Map.drawForegroundTiles();
// Draw the inventory
if(mp_option[OPT_HUD].value)
m_Inventory.drawHUD();
}
......
......@@ -19,7 +19,7 @@ namespace galaxy {
class CWorldMap {
public:
CWorldMap(CExeFile &ExeFile, CInventory &Inventory);
CWorldMap(CExeFile &ExeFile, CInventory &Inventory, stOption *p_option);
bool isActive();
void setActive(bool value);
......@@ -35,6 +35,7 @@ private:
CMap m_Map;
CExeFile &m_ExeFile;
CInventory &m_Inventory;
stOption *mp_option;
};
}
......
......@@ -17,8 +17,10 @@ const Uint16 SWIMBASEFRAME = 156;
namespace galaxy {
CPlayerWM::CPlayerWM(CMap *pmap, Uint32 x, Uint32 y,
std::vector<CObject*>& ObjectPtrs):
std::vector<CObject*>& ObjectPtrs,
CInventory &l_Inventory):
CObject(pmap, x, y, OBJ_PLAYER),
m_Inventory(l_Inventory),
m_basesprite(WALKBASEFRAME),
m_looking_dir(LEFT),
m_animation(0),
......@@ -26,9 +28,7 @@ m_animation_time(1),
m_animation_ticker(0),
m_ObjectPtrs(ObjectPtrs)
{
// TODO Auto-generated constructor stub
sprite = m_basesprite;
performCollisions();
}
......@@ -77,6 +77,8 @@ void CPlayerWM::processWalking()
walking = true;
m_hDir = RIGHT;
}
else
m_hDir = NONE;
if(g_pInput->getHoldedCommand(IC_UP))
{
......@@ -96,6 +98,9 @@ void CPlayerWM::processWalking()
walking = true;
m_vDir = DOWN;
}
else
m_vDir = NONE;
if(g_pInput->getHoldedCommand(IC_STATUS))
solid = !solid;
......
......@@ -10,13 +10,14 @@
#include "common/CObject.h"
#include "engine/CEvent.h"
#include "engine/galaxy/CInventory.h"
namespace galaxy {
class CPlayerWM : public CObject {
public:
CPlayerWM(CMap *pmap, Uint32 x, Uint32 y,
std::vector<CObject*>& ObjectPtrs);
std::vector<CObject*>& ObjectPtrs, CInventory &l_Inventory);
void process();
void processWalking();
......@@ -28,6 +29,9 @@ public:
void performSwimmingAnimation();
virtual ~CPlayerWM();
CInventory &m_Inventory;
private:
Uint16 m_basesprite;
direction_t m_looking_dir;
......
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