Commit aff26a5e authored by Gerstrong's avatar Gerstrong

Small bug fixes which improves some physics

parent 7e66c101
......@@ -211,7 +211,7 @@ public:
bool hitdetect(CObject &hitobject);
bool hitdetectWithTilePropertyRect(const Uint16 Property, int &lx, int &ly, int &lw, int &lh, const int res);
bool hitdetectWithTileProperty(const int& Property, const int& x, const int& y);
bool hitdetectWithTileProperty(const int Property, const int x, const int y);
virtual void kill();
void blink(Uint16 frametime);
......
......@@ -265,7 +265,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(const int& Property, const int& x, const int& 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;
......
......@@ -83,14 +83,14 @@ bool CMessages::extractEp4Strings(std::map<std::string, std::string>& StringMap)
// Now the spoken Messages of some Characters like Lindsey and the elders
StringMap.insert( extractString( "LINDSEY_TEXT1", 0x3094C, 0x30998 ) );
StringMap.insert( extractString( "LINDSEY_TEXT2", 0x30999, 0x309E3 ) );
StringMap.insert( extractString( "LINDSEY_TEXT1", 0x3094B, 0x30997 ) );
StringMap.insert( extractString( "LINDSEY_TEXT2", 0x30999, 0x309E1 ) );
StringMap.insert( extractString( "LINDSEY_END_TEXT1", 0x309E3, 0x309F9 ) );
StringMap.insert( extractString( "LINDSEY_END_TEXT2", 0x309FA, 0x30A24 ) );
StringMap.insert( extractString( "LINDSEY_START_TEXT", 0x30A25, 0x30A3C ) );
StringMap.insert( extractString( "LINDSEY_END_TEXT2", 0x309FA, 0x30A22 ) );
StringMap.insert( extractString( "LINDSEY_START_TEXT", 0x30A23, 0x30A3B ) );
StringMap.insert( extractString( "CANT_SWIM_TEXT", 0x30A3D, 0x30A4A ) );
StringMap.insert( extractString( "CANT_SWIM_TEXT", 0x30A3C, 0x30A4A ) );
StringMap.insert( extractString( "SWIM_SUIT_TEXT", 0x30A4B, 0x30A72 ) );
......
......@@ -395,7 +395,7 @@ void CMapLoaderGalaxy::addFoe(CMap &Map, word foe, size_t x, size_t y)
case 1:
case 2:
// This is the player on the map in one level
p_newfoe = new galaxy::CPlayerLevel(&Map, x, y, m_ObjectPtr,
p_newfoe = new galaxy::CPlayerLevel(&Map, x, y-750, m_ObjectPtr,
(foe==1) ? RIGHT : LEFT, m_Inventory, m_Cheatmode);
break;
......
......@@ -49,6 +49,7 @@ m_jumpdownfromobject(false)
m_climbing = false;
m_pogotoggle = false;
m_jumped = false;
m_hanging = false;
setupGalaxyObjectOnMap(0x98C, A_KEEN_STAND);
}
......@@ -153,6 +154,7 @@ bool CPlayerLevel::checkandtriggerforCliffHanging()
moveTo(x,y);
solid = false;
yinertia = 0;
m_hanging = false;
mp_processState = (void (CPlayerBase::*)()) &CPlayerLevel::processCliffHanging;
return true;
}
......@@ -171,6 +173,7 @@ bool CPlayerLevel::checkandtriggerforCliffHanging()
moveTo(x,y);
solid = false;
yinertia = 0;
m_hanging = false;
mp_processState = (void (CPlayerBase::*)()) &CPlayerLevel::processCliffHanging;
return true;
}
......@@ -186,13 +189,27 @@ bool CPlayerLevel::checkandtriggerforCliffHanging()
void CPlayerLevel::processCliffHanging()
{
if( m_playcontrol[PA_Y] < 0 )
// In case you released the direction
if( m_playcontrol[PA_Y] == 0 && m_playcontrol[PA_X] == 0)
m_hanging = true;
if(!m_hanging)
return;
// If you want to climb up
if( m_playcontrol[PA_Y] < 0 ||
((m_hDir == LEFT) && (m_playcontrol[PA_X] < 0)) ||
((m_hDir == RIGHT) && (m_playcontrol[PA_X] > 0)) )
{
setAction(A_KEEN_CLIMB);
mp_processState = (void (CPlayerBase::*)()) &CPlayerLevel::processCliffClimbing;
m_camera.m_freeze = true;
}
else if( m_playcontrol[PA_Y] > 0 )
// If you want to fall down.
else if( m_playcontrol[PA_Y] > 0 ||
((m_hDir == LEFT) && (m_playcontrol[PA_X] > 0)) ||
((m_hDir == RIGHT) && (m_playcontrol[PA_X] < 0)) )
{
setAction( A_KEEN_FALL );
playSound( SOUND_KEEN_FALL );
......@@ -212,20 +229,27 @@ void CPlayerLevel::processCliffHanging()
void CPlayerLevel::processCliffClimbing()
{
const int dy = 32;
const int dy = 24;
const int dx = dy/3;
moveUp(dy);
moveXDir( (m_hDir == LEFT) ? -dx : dx, true);
std::vector<CTileProperties> &TileProperty = g_pBehaviorEngine->getTileProperties();
if( getActionStatus(A_KEEN_STAND) && !TileProperty[mp_Map->at(getXMidPos()>>CSF, getYDownPos()>>CSF)].bup )
if( getActionStatus(A_KEEN_STAND) )
{
solid = true;
setAction(A_KEEN_STAND);
m_camera.m_freeze = false;
setActionSprite();
calcBouncingBoxes();
mp_processState = (void (CPlayerBase::*)()) &CPlayerLevel::processStanding;
const int target_x = getXMidPos()>>CSF;
const int target_y = getYDownPos()>>CSF;
const bool noblock = !TileProperty[mp_Map->at(target_x, target_y)].bup;
if(noblock)
{
moveDown(1<<CSF);
solid = true;
setAction(A_KEEN_STAND);
m_camera.m_freeze = false;
setActionSprite();
calcBouncingBoxes();
mp_processState = (void (CPlayerBase::*)()) &CPlayerLevel::processStanding;
}
}
}
......@@ -910,7 +934,6 @@ void CPlayerLevel::processPoleClimbing()
// Lets check if Keen can move up, down or reaches the end of the pole
Uint32 l_x = ( getXLeftPos() + getXRightPos() ) / 2;
Uint32 l_y_up = getYUpPos()-(7<<STC);
Uint32 l_y_down = getYDownPos()+(7<<STC);
if( m_playcontrol[PA_Y] < 0 )
{
......@@ -951,13 +974,15 @@ void CPlayerLevel::processPoleClimbing()
l_y_up = getYUpPos()+(16<<STC);
Uint32 l_y_down = getYDownPos()/*+(7<<STC)*/;
if(!hitdetectWithTileProperty(1, l_x, l_y_down))
solid = true;
else
solid = false;
// Check for the and upper and lower side, upper because the hand can touch the edge in that case
if( hitdetectWithTileProperty(1, l_x, l_y_down) || hitdetectWithTileProperty(1, l_x, l_y_up) )
const bool up = hitdetectWithTileProperty(1, l_x, l_y_up);
if( up && !blockedd )
{
// Slide down if there is more of the pole
setAction(A_KEEN_POLE_SLIDE);
......@@ -971,7 +996,9 @@ void CPlayerLevel::processPoleClimbing()
yinertia = 0;
solid = true;
if(!blockedd)
const bool down = mp_Map->at(l_x>>CSF, l_y_down>>CSF);
if(!blockedd && !down)
{
setAction(A_KEEN_FALL);
playSound( SOUND_KEEN_FALL );
......@@ -979,6 +1006,10 @@ void CPlayerLevel::processPoleClimbing()
}
else
{
blockedd = true;
moveUp(1<<CSF);
moveDown(1<<CSF);
setAction(A_KEEN_STAND);
mp_processState = (void (CPlayerBase::*)()) &CPlayerLevel::processStanding;
}
......
......@@ -234,6 +234,7 @@ private:
int m_fire_recharge_time;
bool m_EnterDoorAttempt;
bool m_hanging;
};
}
......
......@@ -19,8 +19,12 @@ m_timer(0)
setupGalaxyObjectOnMap(0x38EA, 0);
answermap[0] = "LINDSEY_START_TEXT";
answermap[1] = "LINDSEY_END_TEXT1";
answermap[2] = "LINDSEY_END_TEXT2";
answermap[1] = "LINDSEY_TEXT1";
answermap[2] = "LINDSEY_TEXT2";
answermap[3] = "LINDSEY_END_TEXT1";
answermap[4] = "LINDSEY_END_TEXT2";
}
void CLindsey::process()
......@@ -51,18 +55,17 @@ void CLindsey::getTouchedBy(CObject &theObject)
g_pSound->playSound(SOUND_GET_WETSUIT, PLAY_PAUSEALL);
std::string lindsey_text[3];
std::string lindsey_text[4];
//lindsey_text[0] = g_pBehaviorEngine->getString(answermap[0]);
//lindsey_text[1] = g_pBehaviorEngine->getString(answermap[1]);
//lindsey_text[2] = g_pBehaviorEngine->getString(answermap[2]);
lindsey_text[0] = "Princess Lindsey has to say the folling (Fake Message):";
lindsey_text[1] = "Blah Blah (Message)";
lindsey_text[2] = "Thanks Highness! (Fake Message)";
lindsey_text[0] = g_pBehaviorEngine->getString(answermap[0]);
lindsey_text[1] = g_pBehaviorEngine->getString(answermap[1]);
lindsey_text[2] = g_pBehaviorEngine->getString(answermap[2]);
lindsey_text[3] = g_pBehaviorEngine->getString(answermap[3+(rand()%2)]);
EventContainer.add( new EventSendBitmapDialogMsg(108, lindsey_text[0], LEFT) );
EventContainer.add( new EventSendBitmapDialogMsg(108, lindsey_text[1], LEFT) );
EventContainer.add( new EventSendBitmapDialogMsg(106, lindsey_text[2], RIGHT) );
EventContainer.add( new EventSendBitmapDialogMsg(108, lindsey_text[2], RIGHT) );
EventContainer.add( new EventSendBitmapDialogMsg(106, lindsey_text[3], RIGHT) );
exists = false;
}
......
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