Commit 985eacc7 authored by Gerhard Stein's avatar Gerhard Stein

More cleanups

parent 1f819f5a
......@@ -43,11 +43,11 @@ void CInventory::reset()
void CInventory::fetchImportantStuff(const CInventory &other)
{
Item.m_special.ep4.swimsuit |= other.Item.m_special.ep4.swimsuit;
Item.m_special.ep4.elders += other.Item.m_special.ep4.elders;
Item.m_special.ep6.sandwich |= other.Item.m_special.ep6.sandwich;
Item.m_special.ep6.hook |= other.Item.m_special.ep6.hook;
Item.m_special.ep6.rocketKeycard |= other.Item.m_special.ep6.rocketKeycard;
Item.m_special.swimsuit |= other.Item.m_special.swimsuit;
Item.m_special.elders += other.Item.m_special.elders;
Item.m_special.sandwich |= other.Item.m_special.sandwich;
Item.m_special.hook |= other.Item.m_special.hook;
Item.m_special.rocketKeycard |= other.Item.m_special.rocketKeycard;
}
......
......@@ -238,7 +238,7 @@ void CStatusScreenGalaxy::GenerateStatusEp4()
// Rescued Box
TempRect.w = 8*8;
mStatusSurface.fillRGBA(TempRect, 0x0, 0x0, 0x0, 0xFF);
for( int count=0 ; count<m_Item.m_special.ep4.elders ; count++ )
for( int count=0 ; count<m_Item.m_special.elders ; count++ )
{
gGraphics.drawDigit(40,
TempRect.x+8*count,
......@@ -328,7 +328,7 @@ void CStatusScreenGalaxy::GenerateStatusEp4()
mStatusSurface.fillRGBA(TempRect, 0xFF, 0xFF, 0xFF, 0xFF);
Font.setupColor(0x0);
Font.drawFontCentered(mStatusSurface.getSDLSurface(),
m_Item.m_special.ep4.swimsuit ? swLine : "???",
m_Item.m_special.swimsuit ? swLine : "???",
TempRect.x,
TempRect.w,
TempRect.y+1, false);
......@@ -536,7 +536,7 @@ void CStatusScreenGalaxy::GenerateStatusEp6()
TempRect.h = 10;
SDL_FillRect(mStatusSurface.getSDLSurface(), &TempRect, 0xFF000000);
auto &spItem = m_Item.m_special.ep6;
auto &spItem = m_Item.m_special;
const int sandwichTile = (spItem.sandwich > 0) ? 2 : 1;
const int hookTile = (spItem.hook > 0) ? 4 : 3;
......
......@@ -328,9 +328,9 @@ void CPlayerWM::processMoving()
// Check if Keen has a hook, but
if(!mUsedGrapplingHook)
{
if(m_Inventory.Item.m_special.ep6.hook > 0)
if(m_Inventory.Item.m_special.hook > 0)
{
m_Inventory.Item.m_special.ep6.hook--;
m_Inventory.Item.m_special.hook--;
mUsedGrapplingHook = true;
int x = getXMidPos();
......@@ -485,7 +485,7 @@ void CPlayerWM::processMoving()
}
else if( isSwimming() )
{
if(m_Inventory.Item.m_special.ep4.swimsuit)
if(m_Inventory.Item.m_special.swimsuit)
{
performSwimmingAnimation(moving);
}
......@@ -1188,7 +1188,7 @@ void CPlayerWM::checkforSwimming(bool &bleft, bool &bright, bool &bup, bool &bdo
makeHimSwim(false);
}
if(m_Inventory.Item.m_special.ep4.swimsuit)
if(m_Inventory.Item.m_special.swimsuit)
{
bleft = bright = bup = bdown = false;
}
......
......@@ -150,7 +150,7 @@ void CCouncilMember::getTouchedBy(CSpriteObject &theObject)
// When Keen touches the Council Member exit the level and add one to the council list
if( CPlayerBase *player = dynamic_cast<CPlayerBase*>(&theObject) )
{
int &rescuedelders = player->m_Inventory.Item.m_special.ep4.elders;
int &rescuedelders = player->m_Inventory.Item.m_special.elders;
// TODO: In this part we have to check which level we are and send the proper messages
......
......@@ -31,7 +31,7 @@ void CDiveSuit::getTouchedBy(CSpriteObject &theObject)
// When Keen touches the Council Member exit the level and add one to the council list
if( CPlayerLevel *player = dynamic_cast<CPlayerLevel*>(&theObject) )
{
bool &swimsuit = player->m_Inventory.Item.m_special.ep4.swimsuit;
bool &swimsuit = player->m_Inventory.Item.m_special.swimsuit;
gSound.playSound( SOUND_GET_WETSUIT, SoundPlayMode::PLAY_PAUSEALL );
taken = swimsuit = true;
......
......@@ -67,9 +67,9 @@ void CGrabbiter::getTouchedBy(CSpriteObject& theObject)
const int diffX = getXMidPos()-player->getXMidPos();
player->moveXDir(-diffX/4);
if(player->m_Inventory.Item.m_special.ep6.sandwich > 0)
if(player->m_Inventory.Item.m_special.sandwich > 0)
{
player->m_Inventory.Item.m_special.ep6.sandwich--;
player->m_Inventory.Item.m_special.sandwich--;
// Show grabbiter message
showMsg( gBehaviorEngine.getString("KEEN_GRABBITER_SLEEPY") );
......
......@@ -147,7 +147,7 @@ void CRocket::getTouchedBy(CSpriteObject& theObject)
if( CPlayerBase *player = dynamic_cast<CPlayerBase*>(&theObject) )
{
if(player->m_Inventory.Item.m_special.ep6.rocketKeycard > 0)
if(player->m_Inventory.Item.m_special.rocketKeycard > 0)
{
setAction(A_ROCKET_FLY);
playSound(SOUND_ROCKET_LAUNCH);
......
......@@ -26,7 +26,7 @@ void CSpecialItem::getTouchedBy(CSpriteObject& theObject)
if( CPlayerBase *player = dynamic_cast<CPlayerBase*>(&theObject) )
{
mTaken = true;
auto &item = player->m_Inventory.Item.m_special.ep6;
auto &item = player->m_Inventory.Item.m_special;
// Sound play
gSound.playSound(SOUND_GET_SPECIAL_ITEM, SoundPlayMode::PLAY_PAUSEALL);
......
......@@ -27,15 +27,15 @@ void stItemGalaxy::reset()
if(ep == 4)
{
m_special.ep4.elders = 0;
m_special.ep4.swimsuit = 0;
m_special.elders = 0;
m_special.swimsuit = 0;
}
else if(ep == 6)
{
// k6demo starts with possesion of the hook.
m_special.ep6.hook = gBehaviorEngine.isDemo() ? 1 : 0;
m_special.ep6.sandwich = 0;
m_special.ep6.rocketKeycard = 0;
m_special.hook = gBehaviorEngine.isDemo() ? 1 : 0;
m_special.sandwich = 0;
m_special.rocketKeycard = 0;
}
fuse_levels_completed = 0;
......@@ -51,13 +51,13 @@ void stItemGalaxy::triggerAllItemsCheat()
if(ep == 4)
{
m_special.ep4.swimsuit = 1;
m_special.swimsuit = 1;
}
else if(ep == 6)
{
m_special.ep6.hook = 1;
m_special.ep6.sandwich = 1;
m_special.ep6.rocketKeycard = 1;
m_special.hook = 1;
m_special.sandwich = 1;
m_special.rocketKeycard = 1;
}
m_keycards = 1;
......@@ -86,14 +86,14 @@ void stItemGalaxy::operator>>(boost::property_tree::ptree &invNode)
const auto ep = gBehaviorEngine.getEpisode();
if(ep == 4)
{
invNode.put("elders", m_special.ep4.elders);
invNode.put("swimsuit", m_special.ep4.swimsuit);
invNode.put("elders", m_special.elders);
invNode.put("swimsuit", m_special.swimsuit);
}
else if(ep == 6)
{
invNode.put("hook", m_special.ep6.hook);
invNode.put("rocketKeycard", m_special.ep6.rocketKeycard);
invNode.put("sandwich", m_special.ep6.sandwich);
invNode.put("hook", m_special.hook);
invNode.put("rocketKeycard", m_special.rocketKeycard);
invNode.put("sandwich", m_special.sandwich);
}
}
......@@ -122,13 +122,13 @@ void stItemGalaxy::operator<<(boost::property_tree::ptree &invNode)
const auto ep = gBehaviorEngine.getEpisode();
if(ep == 4)
{
m_special.ep4.elders = invNode.get<int>("elders", 0);
m_special.ep4.swimsuit = invNode.get<bool>("swimsuit", false);
m_special.elders = invNode.get<int>("elders", 0);
m_special.swimsuit = invNode.get<bool>("swimsuit", false);
}
else if(ep == 6)
{
m_special.ep6.hook = invNode.get<int>("hook", 0);
m_special.ep6.rocketKeycard = invNode.get<int>("rocketKeycard", 0);
m_special.ep6.sandwich = invNode.get<int>("sandwich", 0);
m_special.hook = invNode.get<int>("hook", 0);
m_special.rocketKeycard = invNode.get<int>("rocketKeycard", 0);
m_special.sandwich = invNode.get<int>("sandwich", 0);
}
}
......@@ -42,20 +42,13 @@ struct stItemGalaxy
int m_keycards;
int fuse_levels_completed;
union {
struct
{
bool swimsuit;
int elders;
}ep4;
struct
{
unsigned char sandwich;
unsigned char hook;
unsigned char rocketKeycard;
}ep6;
struct
{
bool swimsuit = false;
int elders = 0;
unsigned char sandwich = 0;
unsigned char hook = 0;
unsigned char rocketKeycard = 0;
} m_special;
......
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