Commit 11238485 authored by tulip81's avatar tulip81

fixed enemy and shot speeds relative to keen as far as I could

fixed Elite hitpoints
parents 0529af3a 95f862fd
......@@ -12,41 +12,14 @@ m_Player(PlayerVect)
state = BUTLER_WALK;
movedir = RIGHT;
animtimer = 0;
canbezapped = false; // will stop bullets but are not harmed
m_invincible = false; // will stop bullets but are not harmed
canbezapped = true;
}
void CButler::process()
{
bool not_about_to_fall;
// push keen
CPlayer &touched_player = m_Player[touchedBy];
if (touchPlayer && !touched_player.pdie)
{
if(!((touched_player.pdir == movedir) && (touched_player.pwalking)))
{
g_pSound->playStereofromCoord(SOUND_YORP_BUMP, PLAY_NORESTART, scrx);
short butlerpushamount;
butlerpushamount = BUTLERPUSHAMOUNT;
if(touched_player.pwalking) butlerpushamount = 3*BUTLERPUSHAMOUNT/2;
if (touched_player.getXPosition() < getXPosition())
{
touched_player.playpushed_x = -butlerpushamount;
touched_player.playpushed_decreasetimer = 0;
touched_player.pdir = touched_player.pshowdir = LEFT;
}
else
{
touched_player.playpushed_x = butlerpushamount;
touched_player.playpushed_decreasetimer = 0;
touched_player.pdir = touched_player.pshowdir = RIGHT;
}
}
}
switch(state)
{
case BUTLER_TURN:
......@@ -108,3 +81,27 @@ void CButler::process()
default: break;
}
}
void CButler::getTouchedBy(CObject &theObject)
{
// push keen
if( theObject.m_type == OBJ_PLAYER )
{
CPlayer &Player = dynamic_cast<CPlayer&>(theObject);
if(Player.dead)
return;
if(!((Player.pdir == movedir) && (Player.pwalking)))
{
g_pSound->playStereofromCoord(SOUND_YORP_BUMP, PLAY_NORESTART, scrx);
short butlerpushamount;
butlerpushamount = BUTLERPUSHAMOUNT;
if(Player.pwalking) butlerpushamount = 3*BUTLERPUSHAMOUNT/2;
Player.bump(butlerpushamount, false);
}
}
}
......@@ -38,6 +38,7 @@ public:
CButler(CMap *pmap, Uint32 x, Uint32 y,
std::vector<CPlayer> &PlayerVect);
void process();
void getTouchedBy(CObject &theObject);
private:
// AI for "butler" robot (ep1)
......
......@@ -14,7 +14,6 @@ keenonsameleveltimer(0),
about_to_charge(0),
walkframe(0),
dist_traveled(0),
gargdie_inertia_y(0),
movedir(0),
detectedPlayer(0),
detectedPlayerIndex(0),
......@@ -39,14 +38,13 @@ void CGarg::process()
state = GARG_DYING;
canbezapped = false;
sprite = GARG_DYING_FRAME;
gargdie_inertia_y = GARGDIE_START_INERTIA;
moveUp(10);
inhibitfall = 1;
yinertia = GARGDIE_START_INERTIA;
moveUp(GARGDIE_START_INERTIA);
g_pSound->playStereofromCoord(SOUND_GARG_DIE, PLAY_NOW, scrx);
}
// Check, if Garg is moving and collides
if(state != GARG_LOOK && state != GARG_CHARGE)
if(state != GARG_LOOK && state != GARG_CHARGE && state != GARG_DYING)
{
if (movedir==LEFT)
{ // garg is heading left
......@@ -84,13 +82,9 @@ void CGarg::process()
switch(state)
{
case GARG_DYING:
moveDown(gargdie_inertia_y);
gargdie_inertia_y+=16;
if (gargdie_inertia_y >= 0 && blockedd)
if (blockedd)
{
sprite = GARG_DEAD_FRAME;
inhibitfall = 0;
state = GARG_DEAD;
}
break;
......
......@@ -35,7 +35,7 @@
#define GARG_DYING_FRAME 68
#define GARG_DEAD_FRAME 69
#define GARGDIE_START_INERTIA -80
#define GARGDIE_START_INERTIA -20
// Reference to ../misc.cpp
unsigned int rnd(void);
......@@ -61,8 +61,6 @@ private:
unsigned char about_to_charge;
unsigned char walkframe;
unsigned int dist_traveled;
signed int gargdie_inertia_y;
unsigned char movedir;
unsigned char detectedPlayer, detectedPlayerIndex;
......
......@@ -61,7 +61,10 @@ void CObjectAI::process()
std::vector<CObject*>::iterator theOther = m_Objvect.begin();
for( ; theOther != m_Objvect.end() ; theOther++ )
object.getTouchedBy(**theOther);
{
if( (&object) != *theOther )
object.getTouchedBy(**theOther);
}
}
}
......
......@@ -158,7 +158,7 @@ void CRay::getTouchedBy(CObject &theObject)
{
if(hitdetect(theObject))
{
if(theObject.canbezapped && state == RAY_STATE_FLY )
if( theObject.canbezapped && state == RAY_STATE_FLY )
{
// Check, if it's not form the same object
if(theObject.m_type != owner.obj_type)
......
......@@ -27,27 +27,6 @@ m_Object(Object)
void CTank::process()
{
// stop keen from walking through our sprite
if (touchPlayer && !m_Player[touchedBy].pdie)
{
g_pSound->playStereofromCoord(SOUND_YORP_BUMP, PLAY_NORESTART, scrx);
if (!((m_Player[touchedBy].getYPosition()) < (getYUpPos() - 300))) // give the m_Player a little jump-over room
{
if (m_Player[touchedBy].getXPosition() < getXLeftPos())
{
m_Player[touchedBy].playpushed_x = -TANKPUSHAMOUNT;
m_Player[touchedBy].playpushed_decreasetimer = 0;
m_Player[touchedBy].pdir = m_Player[touchedBy].pshowdir = LEFT;
}
else
{
m_Player[touchedBy].playpushed_x = TANKPUSHAMOUNT;
m_Player[touchedBy].playpushed_decreasetimer = 0;
m_Player[touchedBy].pdir = m_Player[touchedBy].pshowdir = RIGHT;
}
}
}
switch(state)
{
......@@ -217,3 +196,26 @@ bool CTank::CanMoveRight()
if (!blockedr && currentTile.bup) return true;
return false;
}
void CTank::getTouchedBy(CObject &theObject)
{
// push keen
if( theObject.m_type == OBJ_PLAYER )
{
CPlayer &Player = dynamic_cast<CPlayer&>(theObject);
if(Player.dead)
return;
if(!((Player.pdir == movedir) && (Player.pwalking)))
{
g_pSound->playStereofromCoord(SOUND_YORP_BUMP, PLAY_NORESTART, scrx);
short butlerpushamount;
butlerpushamount = TANKPUSHAMOUNT;
if(Player.pwalking) butlerpushamount = 3*butlerpushamount/2;
Player.bump( (Player.getXPosition() < getXPosition()) ? -butlerpushamount : butlerpushamount, false);
}
}
}
......@@ -79,6 +79,8 @@ public:
bool CanMoveLeft();
bool CanMoveRight();
void getTouchedBy(CObject &theObject);
protected:
// Tank Robot (Ep2 and (ep1))
enum{ TANK_WALK,TANK_TURN,TANK_WAIT,TANK_WAIT_LOOK,TANK_FIRE,TANK_LOOK
......
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