Commit d90fbf58 authored by Gerhard Stein's avatar Gerhard Stein

Keen 5 Signs are now perfect. Some collision improvements.

parent 763f3259
......@@ -116,7 +116,11 @@ void CSpriteObject::alignToTile()
int moveX = (1<<CSF)/2;
moveX -= ((rSprite.getWidth()/2)<<STC);
m_Pos.x += moveX;
m_Pos.x += moveX;
// This should ensure no enemies get stuck in walls!
processMove( -(1<<CSF), 0 );
processMove( (1<<CSF)+moveX, 0 );
}
......
......@@ -7,11 +7,13 @@
#include "CFlag.h"
#include "sdl/sound/CSound.h"
#include "common/CBehaviorEngine.h"
namespace galaxy {
const Uint16 FLYING_BASEFRAME = 174;
const Uint16 FLYING_BASEFRAME_EP4 = 174;
const Uint16 FLYING_BASEFRAME_EP5 = 173;
const Uint16 ANIMATION_TIME = 8;
const Uint16 SPEED = 64;
......@@ -21,22 +23,25 @@ CFlag::CFlag(CMap *pmap, const VectorD2<Uint32> &Location,
CGalaxySpriteObject(pmap, FOE_ID, Location.x, Location.y),
m_location(Location),
m_destination(Destination),
m_baseframe(FLYING_BASEFRAME),
m_baseframe(FLYING_BASEFRAME_EP4),
processState(&CFlag::processFlying)
{
solid = false;
honorPriority = false;
sprite = WAVING_BASEFRAME;
/*CSprite &rSprite = g_pGfxEngine->getSprite(sprite);
int moveup = (1<<CSF)-1;
moveup -= ((rSprite.getHeight()+1)<<STC);
m_Pos.y += moveup;*/
alignToTile();
//processMove(0, 1);
if(g_pBehaviorEngine->getEpisode() == 5)
{
// In Episode 5 the sign is not thrown! It just appears in the holder
//m_location = m_destination;
moveTo(m_destination);
processState = &CFlag::processRotation;
m_baseframe = FLYING_BASEFRAME_EP5;
sprite = m_baseframe;
}
}
/**
......@@ -85,7 +90,7 @@ void CFlag::processFlying()
}
/*
* Called when flag is in the pole
* Called when flag is in the pole. Keen 4 or 6
*/
void CFlag::processWaving()
{
......@@ -98,4 +103,18 @@ void CFlag::processWaving()
}
}
/*
* Called when sign is in the holder. Keen 5 normally
*/
void CFlag::processRotation()
{
if(mp_Map->getAnimtiletimer()%ANIMATION_TIME == 0)
{
if(sprite-m_baseframe >= 3)
sprite = m_baseframe;
else
sprite++;
}
}
}
......@@ -5,7 +5,7 @@
* Author: gerstrong
*
* This class represents the flag sign object
* which is shown and performed when Keen finished a Level
* which is shown and performed when Keen finished a Level. It might also be a sign like in Keen 5
*/
#ifndef CFLAG_H_
......@@ -31,6 +31,7 @@ public:
void process();
void processFlying();
void processWaving();
void processRotation();
private:
// Where the flag/sign will pop in
......
......@@ -616,12 +616,23 @@ void CPlayerWM::finishLevel(Uint16 object)
csfX += (6<<STC);
csfY -= FlagSprite.m_bboxY2;
csfY += (2<<STC);
if(g_pBehaviorEngine->getEpisode() == 5)
{
csfX -= (14<<STC);
csfY -= (1<<CSF);
}
else
{
g_pSound->playSound( SOUND_FLAG_APPEAR );
}
VectorD2<Uint32> dst(csfX, csfY);
CFlag *pFlag = new CFlag(mp_Map, src, dst);
g_pBehaviorEngine->m_EventList.spawnObj(pFlag);
g_pSound->playSound( SOUND_FLAG_APPEAR );
// Mark the tileinfo on the map as marked!!
mp_Map->setTile( x, y, 0, true, 2);
......
......@@ -32,7 +32,7 @@ CGalaxySpriteObject(pmap, foeID, x, y)
bool CArachnut::isNearby(CSpriteObject &theObject)
{
if( !getProbability(80) )
if( !getProbability(10) )
return false;
if( CPlayerLevel *player = dynamic_cast<CPlayerLevel*>(&theObject) )
......
......@@ -54,7 +54,7 @@ void CBlueBird::setActionForce(const size_t ActionNumber)
bool CBlueBird::isNearby(CSpriteObject &theObject)
{
if( !getProbability(60) )
if( !getProbability(20) )
return false;
if( CPlayerLevel *player = dynamic_cast<CPlayerLevel*>(&theObject) )
......
......@@ -31,7 +31,6 @@ jumpcounter(0)
byte *ptr = g_pBehaviorEngine->m_ExeFile.getRawData();
ptr += 0xFF90;
memcpy(&bounceAmount, ptr, 1 );
}
......
......@@ -40,9 +40,9 @@ m_fireTimer(0)
setActionSprite();
calcBoundingBoxes();
// This should recalibrate the position in case the plats are stuck due some bad level design
processMove( (3<<CSF), 0 );
processMove(-(3<<CSF), 0 );
// This should recalibrate the position in case the plats are stuck due some bad level design. (Keen 7 - Fun House)
processMove( -(3<<CSF), 0 );
processMove( (3<<CSF), 0 );
}
const int MOVE_HORIZ_SPEED = 20;
......
......@@ -42,11 +42,7 @@ m_fireTimer(0)
m_ActionBaseOffset = actionOffset;
setActionForce(A_PLATFORM_MOVE);
setActionSprite();
calcBoundingBoxes();
// This should recalibrate the position in case the plats are stuck due some bad level design
processMove( (3<<CSF), 0 );
processMove(-(3<<CSF), 0 );
calcBoundingBoxes();
}
void CPlatformVertical::process()
......
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