Commit 72c38c84 authored by Gerstrong's avatar Gerstrong

If Keen gets 100 drops he now will get an extra life, like it should be...

parent bd605b2e
#!/bin/sh
# Windows Version
cmake . -DBUILD_TYPE=WIN32 -DDEBUG=OFF -DOGG=yes -DTREMOR=NO -DHAVE_64_BIT=1
cmake . -DBUILD_TYPE=WIN32 -DDEBUG=OFF -DOGG=yes -DTREMOR=NO -DHAVE_64_BIT=1 -DCREATE_DEBS=0
make package
rm CMakeFiles -R
......
......@@ -210,7 +210,7 @@ void CObject::moveToForce(const VectorD2<int> &dir)
solid = laststate;
}
void CObject::moveToForce(int new_x, int new_y)
void CObject::moveToForce(const int& new_x, const int& new_y)
{
moveToForce(VectorD2<int>(new_x, new_y));
}
......@@ -222,34 +222,39 @@ void CObject::moveDir(const VectorD2<int> &dir)
moveYDir(dir.y);
}
void CObject::moveToHorizontal(const int& new_x)
{
const int pos_x = new_x - m_Pos.x;
moveXDir(pos_x);
}
void CObject::moveToVertical(const int& new_y)
{
const int pos_y = new_y - m_Pos.y;
moveYDir(pos_y);
}
void CObject::moveTo(const VectorD2<Uint32> &new_loc)
{
VectorD2<int> amount = new_loc - m_Pos;
if(amount.x < 0) // move left
moveLeft(-amount.x);
else if(amount.x > 0) // move right
moveRight(amount.x);
if(amount.y < 0) // means up
moveUp(-amount.y);
else if(amount.y > 0) // means down
moveDown(amount.y);
moveXDir(amount.x);
moveYDir(amount.y);
}
void CObject::moveTo(int new_x, int new_y)
void CObject::moveTo(const int &new_x, const int &new_y)
{
moveTo(VectorD2<Uint32>(new_x, new_y));
}
void CObject::moveXDir(int amount, bool force)
void CObject::moveXDir(const int& amount, const bool& force)
{
if(amount<0)
moveLeft(-amount, force);
else if(amount>0)
moveRight(amount, force);
}
void CObject::moveYDir(int amount)
void CObject::moveYDir(const int& amount)
{
if(amount<0)
moveUp(-amount);
......@@ -257,11 +262,13 @@ void CObject::moveYDir(int amount)
moveDown(amount);
}
void CObject::moveLeft(int amount, bool force)
void CObject::moveLeft(const int& amnt, const bool& force)
{
if(amount <= 0)
if(amnt <= 0)
return;
int amount = amnt;
blockedr = false;
// If it is forced don't check for collision
if(force) {
......@@ -306,11 +313,13 @@ void CObject::moveLeft(int amount, bool force)
} while( amount > 0 );
}
void CObject::moveRight(int amount, bool force)
void CObject::moveRight(const int& amnt, const bool& force)
{
if(amount <= 0)
if(amnt <= 0)
return;
int amount = amnt;
int y1 = m_Pos.y + bboxY1;
int y2 = m_Pos.y + bboxY2;
......@@ -351,11 +360,13 @@ void CObject::moveRight(int amount, bool force)
} while( amount > 0 );
}
void CObject::moveUp(int amount)
void CObject::moveUp(const int& amnt)
{
if(amount <= 0)
if(amnt <= 0)
return;
int amount = amnt;
int y1 = m_Pos.y + bboxY1;
if( y1-amount < 0 )
......@@ -389,12 +400,13 @@ void CObject::moveUp(int amount)
} while( amount > 0 );
}
void CObject::moveDown(int amount)
void CObject::moveDown(const int& amnt)
{
if(amount <= 0)
if(amnt <= 0)
return;
blockedu = false;
int amount = amnt;
if(!solid)
{
......@@ -427,7 +439,7 @@ void CObject::moveDown(int amount)
// This decreases the inertia we have of the object in X-direction.
// It should be used for objects, where it must be assured, that the inertia can get
// zero and not pass that limit
void CObject::decreaseXInertia(int value)
void CObject::decreaseXInertia(const int& value)
{
if(xinertia < 0) {
if(xinertia+value > 0) xinertia = 0;
......
......@@ -108,25 +108,27 @@ public:
// Moving parts
void moveToForce(const VectorD2<int> &dir);
void moveToForce(int new_x, int new_y);
void moveToForce(const int& new_x, const int& new_y);
void moveDir(const VectorD2<int> &dir);
void moveToHorizontal(const int& new_x);
void moveToVertical(const int& new_y);
void moveTo(const VectorD2<Uint32> &new_loc);
void moveTo(int x, int y);
void moveXDir(int amount, bool force = false);
void moveYDir(int amount);
void moveLeft(int amount, bool force = false);
void moveRight(int amount, bool force = false);
void moveUp(int amount);
void moveDown(int amount);
void decreaseXInertia(int value);
void moveTo(const int &new_x, const int &new_y);
void moveXDir(const int& amount, const bool& force = false);
void moveYDir(const int& amount);
void moveLeft(const int& amnt, const bool& force = false);
void moveRight(const int& amnt, const bool& force = false);
void moveUp(const int& amnt);
void moveDown(const int& amnt);
void decreaseXInertia(const int& value);
void InertiaAndFriction_X();
virtual void process() { }
bool hitdetect(CObject &hitobject);
bool hitdetectWithTilePropertyRect(const Uint16 Property, int &lx, int &ly, int &lw, int &lh, const int res);
bool hitdetectWithTileProperty(Uint16 Property, Uint16 x, Uint16 y);
bool hitdetectWithTileProperty(const int& Property, const int& x, const int& y);
virtual void kill();
void blink(Uint16 frametime);
......
......@@ -347,9 +347,9 @@ bool CObject::hitdetectWithTilePropertyRect(const Uint16 Property, int &lx, int
{
std::vector<CTileProperties> &Tile = g_pBehaviorEngine->getTileProperties(1);
for( Uint16 i=0 ; i<lw ; i+=res )
for( int i=0 ; i<lw ; i+=res )
{
for( Uint16 j=0 ; j<lh ; j+=res )
for( int j=0 ; j<lh ; j+=res )
{
const char behavior = Tile[mp_Map->getPlaneDataAt(1, lx+i, ly+j)].behaviour;
if(behavior == Property || behavior == Property-128 ) // -128 for foreground properties
......@@ -369,7 +369,7 @@ bool CObject::hitdetectWithTilePropertyRect(const Uint16 Property, int &lx, int
* \param Property The Tile Property we are looking
* \return true if detection worked with that tile having the property, else false
*/
bool CObject::hitdetectWithTileProperty(Uint16 Property, Uint16 x, Uint16 y)
bool CObject::hitdetectWithTileProperty(const int& Property, const int& x, const int& y)
{
std::vector<CTileProperties> &Tile = g_pBehaviorEngine->getTileProperties(1);
const char behavior = Tile[mp_Map->getPlaneDataAt(1, x, y)].behaviour;
......
......@@ -141,6 +141,7 @@ void CPlayGameGalaxy::process()
m_WorldMap.setActive(false);
m_LevelPlay.loadLevel(ev->data - 0xC000);
m_LevelName = m_LevelPlay.getLevelName();
g_pSound->playSound( SOUND_ENTER_LEVEL );
m_LevelPlay.setActive(true);
}
EventContainer.pop_Event();
......
......@@ -870,6 +870,7 @@ void CPlayerLevel::processLevelMiscFlagsCheck()
else
break;
moveToHorizontal((l_x>>CSF)<<CSF);
setAction(A_KEEN_SLIDE);
g_pSound->playSound( SOUND_DOOR_OPEN );
}
......@@ -892,6 +893,15 @@ void CPlayerLevel::processLevelMiscFlagsCheck()
mp_Map->setTile( lc_x, lc_y, 0, true, 1 );
m_ObjectPtrs.push_back(new CItemEffect(mp_Map, lc_x<<CSF, lc_y<<CSF, 215, ANIMATE));
m_Item.m_drops++;
if(m_Item.m_drops==100)
{
m_Item.m_drops = 0;
m_Item.m_lifes++;
g_pSound->playSound( SOUND_EXTRA_LIFE );
m_ObjectPtrs.push_back(new CItemEffect(mp_Map, lc_x<<CSF, lc_y<<CSF, got_sprite_item_pics[10]));
}
g_pSound->playSound( SOUND_GET_DROP );
}
......@@ -1066,12 +1076,7 @@ void CPlayerLevel::processPlaceGem()
void CPlayerLevel::processDying()
{
// TODO: Here Keen must be falling out the screen, die effect of Keen Galaxy
}
void CPlayerLevel::kill()
{
// TODO: Here were prepare Keen to die, setting that action
m_dying = true;
m_Inventory.Item.m_lifes--;
setActionForce(A_KEEN_DIE);
g_pSound->playSound( SOUND_KEEN_DIE );
......@@ -1080,4 +1085,10 @@ void CPlayerLevel::kill()
EventContainer.add( new EventExitLevel(mp_Map->getLevel(), false) );
}
void CPlayerLevel::kill()
{
// TODO: Here were prepare Keen to die, setting that action
m_dying = true;
}
}
......@@ -117,7 +117,6 @@ void CPlayerWM::processWalking()
if(object)
{
startLevel(object);
g_pSound->playSound( SOUND_ENTER_LEVEL );
g_pInput->flushCommands();
}
}
......
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