Commit f089a580 authored by Gerhard Stein's avatar Gerhard Stein

More HUD Code (Galaxy engine)

parent ecffee12
......@@ -27,8 +27,6 @@ mp_Background(NULL)
if( Episode>=1 && Episode<=3 )
CreateBackground();
else if( Episode>=4 && Episode<=6 )
CreateBackgroundGalaxy();
}
std::string getRightAligned(std::string text, size_t size)
......@@ -109,18 +107,6 @@ void CHUD::CreateBackground()
DrawCircle(58, 15, 22);
}
/**
* \brief This function prepares the Background, so in process it can be rendered.
* This function should only be called once! This is the galaxy version.
*/
void CHUD::CreateBackgroundGalaxy()
{
// Draw the HUD Box Galaxy. In Episode 4 it's Sprite 129
CSprite &HUDBox = g_pGfxEngine->getSprite(129);
HUDBox.drawSprite(mp_Background, 0, 0);
}
// Draw a circle on the surface
void CHUD::DrawCircle(int x, int y, int width)
{
......@@ -172,6 +158,11 @@ void CHUD::DrawCircle(int x, int y, int width)
*/
void CHUD::renderGalaxy()
{
m_Rect.x = 4;
m_Rect.y = 2;
m_Rect.w = 80;
m_Rect.h = 29;
// Compute the score that really will be seen
int score, lives, charges;
score = (m_score<999999999) ? m_score : 999999999;
......@@ -181,7 +172,14 @@ void CHUD::renderGalaxy()
SDL_Surface *blitsurface = g_pVideoDriver->getBlitSurface();
// Draw the background
SDL_BlitSurface( mp_Background, NULL, blitsurface, &m_Rect);
CSprite &HUDBox = g_pGfxEngine->getSprite(129);
HUDBox.drawSprite(blitsurface, m_Rect.x, m_Rect.y);
CTilemap &Tilemap = g_pGfxEngine->getTileMap(2);
//Font.drawFont(blitsurface, getRightAligned(itoa(lives),9), 5+m_Rect.x, 2+m_Rect.y);
Tilemap.drawTile(blitsurface, 5+m_Rect.x, 2+m_Rect.y, 43);
}
/**
* \brief This part of the code will render the entire HUD. Vorticon version
......
......@@ -27,7 +27,6 @@ public:
private:
void CreateBackground();
void CreateBackgroundGalaxy();
void renderGalaxy();
void renderVorticon();
void DrawCircle(int x, int y, int width);
......
......@@ -12,9 +12,10 @@
namespace galaxy {
CLevelPlay::CLevelPlay(CExeFile &ExeFile) :
CLevelPlay::CLevelPlay(CExeFile &ExeFile, CInventory &Inventory) :
m_active(false),
m_ExeFile(ExeFile)
m_ExeFile(ExeFile),
m_Inventory(Inventory)
{ }
bool CLevelPlay::isActive()
......@@ -23,10 +24,10 @@ bool CLevelPlay::isActive()
void CLevelPlay::setActive(bool value)
{ m_active = value; }
bool CLevelPlay::loadLevel(Uint16 level, CInventory &Inventory)
bool CLevelPlay::loadLevel(Uint16 level)
{
// Load the World map level.
CMapLoaderGalaxy MapLoader(m_ExeFile, m_ObjectPtr, Inventory);
CMapLoaderGalaxy MapLoader(m_ExeFile, m_ObjectPtr, m_Inventory);
m_Map.setScrollSurface(g_pVideoDriver->getScrollSurface());
MapLoader.loadMap(m_Map, level);
......@@ -78,6 +79,8 @@ void CLevelPlay::process()
if(!(*obj)->honorPriority)
(*obj)->draw();
}
m_Inventory.drawHUD();
}
}
......@@ -19,11 +19,11 @@ namespace galaxy {
class CLevelPlay {
public:
CLevelPlay(CExeFile &ExeFile);
CLevelPlay(CExeFile &ExeFile, CInventory &Inventory);
bool isActive();
void setActive(bool value);
bool loadLevel(Uint16 level, CInventory &Inventory);
bool loadLevel(Uint16 level);
void process();
......@@ -33,6 +33,7 @@ private:
CMap m_Map;
CExeFile &m_ExeFile;
CInventory &m_Inventory;
};
}
......
......@@ -21,7 +21,7 @@ CPlayGameGalaxy::CPlayGameGalaxy(CExeFile &ExeFile, char level,
stOption *p_option, CSavedGame &SavedGame) :
CPlayGame(ExeFile, level, numplayers, difficulty, p_option),
m_WorldMap(ExeFile, m_Inventory),
m_LevelPlay(ExeFile),
m_LevelPlay(ExeFile, m_Inventory),
mp_Menu(NULL),
m_SavedGame(SavedGame)
{
......@@ -42,7 +42,7 @@ bool CPlayGameGalaxy::init()
else
{
// manually a level has been loaded
m_LevelPlay.loadLevel(m_Level, m_Inventory);
m_LevelPlay.loadLevel(m_Level);
m_LevelPlay.setActive(true);
return true;
}
......@@ -103,7 +103,7 @@ void CPlayGameGalaxy::process()
if(ev->data > 0xC000)
{
m_WorldMap.setActive(false);
m_LevelPlay.loadLevel(ev->data - 0xC000, m_Inventory);
m_LevelPlay.loadLevel(ev->data - 0xC000);
m_LevelPlay.setActive(true);
}
EventContainer.pop_Event();
......
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