This commit is contained in:
Charles 2001-06-15 21:24:14 +00:00
parent f3c69806b7
commit 87d561c4ab
19 changed files with 331 additions and 65 deletions

View file

@ -283,7 +283,8 @@ player_src := demoplay \
psjump \
psrun \
psspring \
pscart
pscart \
psfloat
script_src := script \
function
@ -335,7 +336,11 @@ triggers_src := trigger \
tldripemit \
tsdownemit \
tsleftemit \
tsrightemit
tsrightemit \
twindup \
twinddown \
twindleft \
twindright
utils_src := utils \
sincos \

View file

@ -39,12 +39,16 @@
#include "player\player.h"
#endif
#ifndef __PROJECTL_PROJECTL_H__
#include "projectl\projectl.h"
#endif
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcMotherJellyfishEnemy::postInit()
{
m_state = MOTHER_JELLYFISH_RETURN_TO_START_1;
m_state = MOTHER_JELLYFISH_CYCLE;
m_spawnTimer = 0;
m_meterOn=false;
@ -72,6 +76,13 @@ void CNpcMotherJellyfishEnemy::postInit()
}
m_RGB = 255 + ( 128 << 8 ) + ( 255 << 16 );
targetPos = Pos;
m_movementTimer = GameState::getOneSecondInFrames() * 5;
m_pulsateTimer = GameState::getOneSecondInFrames();
m_renderScale = 4096;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -130,7 +141,153 @@ void CNpcMotherJellyfishEnemy::setupWaypoints( sThingActor *ThisActor )
void CNpcMotherJellyfishEnemy::processMovement( int _frames )
{
s32 xDist, yDist;
if ( m_movementTimer <= 0 )
{
if ( m_pulsateTimer <= 0 )
{
// fire at player
s16 heading = ratan2( playerYDist, playerXDist ) & 4095;
CProjectile *projectile;
projectile = CProjectile::Create();
DVECTOR newPos = Pos;
projectile->init( newPos, heading );
projectile->setGraphic( FRM__LIGHTNING2 );
m_movementTimer = GameState::getOneSecondInFrames() * 5;
m_pulsateTimer = GameState::getOneSecondInFrames();
}
else
{
m_pulsateTimer -= _frames;
m_renderScale = 4096 + ( ( 256 * rsin( ( ( m_pulsateTimer << 14 ) / GameState::getOneSecondInFrames() ) & 4095 ) ) >> 12 );
}
}
else
{
m_movementTimer -= _frames;
s32 distX, distY;
distX = targetPos.vx - Pos.vx;
distY = targetPos.vy - Pos.vy;
if( abs( distX ) < 10 && abs( distY ) < 10 )
{
s32 minX, maxX, minY, maxY;
m_npcPath.getPathXExtents( &minX, &maxX );
m_npcPath.getPathYExtents( &minY, &maxY );
targetPos.vx = minX + ( getRnd() % ( maxX - minX + 1 ) );
targetPos.vy = minY + ( getRnd() % ( maxY - minY + 1 ) );
}
else
{
s16 headingToTarget = ratan2( distY, distX );
s16 decDir, incDir;
s16 moveDist;
s16 maxTurnRate = m_data[m_type].turnSpeed;
s32 moveX, moveY;
decDir = m_heading - headingToTarget;
if ( decDir < 0 )
{
decDir += ONE;
}
incDir = headingToTarget - m_heading;
if ( incDir < 0 )
{
incDir += ONE;
}
if ( decDir < incDir )
{
moveDist = -decDir;
}
else
{
moveDist = incDir;
}
if ( moveDist < -maxTurnRate )
{
moveDist = -maxTurnRate;
}
else if ( moveDist > maxTurnRate )
{
moveDist = maxTurnRate;
}
m_heading += moveDist;
m_heading &= 4095;
s32 preShiftX = _frames * m_speed * rcos( m_heading );
s32 preShiftY = _frames * m_speed * rsin( m_heading );
moveX = preShiftX >> 12;
if ( !moveX && preShiftX )
{
moveX = preShiftX / abs( preShiftX );
}
if ( distX > 0 )
{
if ( moveX > distX )
{
moveX = distX;
}
}
else if ( distX < 0 )
{
if ( moveX < distX )
{
moveX = distX;
}
}
else
{
moveX = 0;
}
moveY = preShiftY >> 12;
if ( !moveY && preShiftY )
{
moveY = preShiftY / abs( preShiftY );
}
if ( distY > 0 )
{
if ( moveY > distY )
{
moveY = distY;
}
}
else if ( distY < 0 )
{
if ( moveY < distY )
{
moveY = distY;
}
}
else
{
moveY = 0;
}
Pos.vx += moveX;
Pos.vy += moveY;
}
}
/*s32 xDist, yDist;
s32 xDistSqr, yDistSqr;
switch( m_state )
@ -225,14 +382,14 @@ void CNpcMotherJellyfishEnemy::processMovement( int _frames )
default:
break;
}
}*/
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcMotherJellyfishEnemy::processClose( int _frames )
{
switch( m_state )
/*switch( m_state )
{
case MOTHER_JELLYFISH_ATTACK_PLAYER_SHOCK:
{
@ -286,7 +443,7 @@ void CNpcMotherJellyfishEnemy::processClose( int _frames )
m_heading = 0;
spawnJellyfish( _frames );
//spawnJellyfish( _frames );
}
else
{
@ -307,7 +464,7 @@ void CNpcMotherJellyfishEnemy::processClose( int _frames )
m_heading = 2048;
spawnJellyfish( _frames );
//spawnJellyfish( _frames );
}
else
{
@ -318,7 +475,7 @@ void CNpcMotherJellyfishEnemy::processClose( int _frames )
break;
}
}
}*/
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -336,7 +493,7 @@ void CNpcMotherJellyfishEnemy::shutdown()
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcMotherJellyfishEnemy::spawnJellyfish( int _frames )
/*void CNpcMotherJellyfishEnemy::spawnJellyfish( int _frames )
{
if ( m_jellyfishCount )
{
@ -361,7 +518,7 @@ void CNpcMotherJellyfishEnemy::spawnJellyfish( int _frames )
m_spawnTimer = 1 * GameState::getOneSecondInFrames();
}
}
}
}*/
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -384,11 +541,8 @@ void CNpcMotherJellyfishEnemy::render()
DVECTOR &renderPos=getRenderPos();
s16 scale;
scale = 2048 + ( ( ( 8192 - 2048 ) * m_health ) / m_data[m_type].initHealth );
SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),false);
m_actorGfx->RotateScale( SprFrame, renderPos, 0, scale, scale );
m_actorGfx->RotateScale( SprFrame, renderPos, 0, m_renderScale, m_renderScale );
sBBox boundingBox = m_actorGfx->GetBBox();
setCollisionSize( ( boundingBox.XMax - boundingBox.XMin ), ( boundingBox.YMax - boundingBox.YMin ) );
@ -406,12 +560,12 @@ void CNpcMotherJellyfishEnemy::render()
void CNpcMotherJellyfishEnemy::processShot( int _frames )
{
s16 scale;
scale = 2048 + ( ( ( 8192 - 2048 ) * m_health ) / m_data[m_type].initHealth );
scale = 2048 + ( ( ( 4096 - 2048 ) * m_health ) / m_data[m_type].initHealth );
for ( int i = 0 ; i < 4 ; i++ )
{
legs[i]->Setup( ( legsPos[i].vx * scale ) >> 13, legsPos[i].vy, i > 1 );
legs[i]->setScale( scale >> 1 );
legs[i]->Setup( ( legsPos[i].vx * scale ) >> 12, legsPos[i].vy, i > 1 );
legs[i]->setScale( scale );
}
switch ( m_state )
@ -423,6 +577,8 @@ void CNpcMotherJellyfishEnemy::processShot( int _frames )
if ( m_health > 0 )
{
m_health -= 5;
m_renderScale = 2048 + ( ( ( 4096 - 2048 ) * m_health ) / m_data[m_type].initHealth );
}
m_state = NPC_GENERIC_HIT_RECOIL;
@ -446,18 +602,3 @@ void CNpcMotherJellyfishEnemy::processShot( int _frames )
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
u8 CNpcMotherJellyfishEnemy::canBeCaughtByNet()
{
return( m_isActive && !m_isDying && m_health <= 5 );
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcMotherJellyfishEnemy::caughtWithNet()
{
setToShutdown();
CGameScene::setBossHasBeenKilled();
}

View file

@ -25,18 +25,16 @@ public:
void render();
virtual void shutdown();
virtual void setupWaypoints( sThingActor *ThisActor );
virtual u8 canBeCaughtByNet();
virtual void caughtWithNet();
protected:
virtual void processClose( int _frames );
virtual void processMovement( int _frames );
virtual void processShot( int _frames );
void spawnJellyfish( int _frames );
//void spawnJellyfish( int _frames );
//virtual void processUserCollision( CThing *thisThing );
enum NPC_MOTHER_JELLYFISH_STATE
{
MOTHER_JELLYFISH_RETURN_TO_START_1 = 0,
/*MOTHER_JELLYFISH_RETURN_TO_START_1 = 0,
MOTHER_JELLYFISH_CYCLE_1 = 1,
MOTHER_JELLYFISH_ATTACK_PLAYER_SPAWN_1,
MOTHER_JELLYFISH_RETURN_TO_START_2,
@ -44,17 +42,23 @@ protected:
MOTHER_JELLYFISH_ATTACK_PLAYER_SPAWN_2,
MOTHER_JELLYFISH_RETURN_TO_START_3,
MOTHER_JELLYFISH_CYCLE_3,
MOTHER_JELLYFISH_ATTACK_PLAYER_SHOCK,
MOTHER_JELLYFISH_ATTACK_PLAYER_SHOCK,*/
MOTHER_JELLYFISH_CYCLE = 0,
MOTHER_JELLYFISH_ATTACK_PLAYER = 1,
};
int m_jellyfishCount;
s32 m_spawnTimer;
s32 m_pulsateTimer;
s32 m_cycleWidth;
s32 m_halfCycleWidth;
bool m_meterOn;
s16 m_renderScale;
CFXJellyFishLegs *legs[4];
DVECTOR legsPos[4];
DVECTOR targetPos;
};
#endif

View file

@ -123,6 +123,7 @@ public:
virtual void trigger() {;}
virtual u8 isCart() {return( false );}
virtual void jump() {;}
s16 getCollisionAngle() {return m_collisionAngle;}
static NPC_PLATFORM_UNIT_TYPE getTypeFromMapEdit( u16 newType );
static CNpcPlatform *Create(int Type);
@ -240,7 +241,6 @@ protected:
virtual void calculateBoundingBoxSize();
virtual void setCollisionAngle(int newAngle); // Actually.. this probly doesn't need to be in the base calss anymore.. :/
s16 getCollisionAngle() {return m_collisionAngle;}
s16 m_collisionAngle;

View file

@ -1553,6 +1553,17 @@ void CPlayer::springPlayerUp(int _springHeight)
m_currentPlayerModeClass->springPlayerUp(_springHeight);
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CPlayer::setFloating()
{
m_currentPlayerModeClass->setFloating();
}
/*----------------------------------------------------------------------
Function:
Purpose:
@ -1814,6 +1825,16 @@ void CPlayer::renderSb(DVECTOR *_pos,int _animNo,int _animFrame)
// Render SB
ft4=m_actorGfx->Render(*_pos,_animNo,_animFrame,m_facing==FACING_RIGHT?0:1);
CThing *platform;
platform=isOnPlatform();
if(platform)
{
if ( ( (CNpcPlatform *) platform )->isCart() )
{
m_actorGfx->RotateScale( ft4, *_pos, ( (CNpcPlatform *) platform )->getCollisionAngle(), ONE, ONE );
}
}
setSemiTrans(ft4,trans);
}

View file

@ -85,6 +85,7 @@ typedef enum
STATE_LOOKDOWNRELAX,
STATE_JUMPBACK,
STATE_CART,
STATE_FLOAT,
NUM_STATES,
}PLAYER_STATE;
@ -398,6 +399,8 @@ public:
void justButtBouncedABadGuy(); // Also fugly.. :/
void setFloating();
private:
int m_squeakyBootsTimer;
int m_invincibilityRingTimer;

View file

@ -83,6 +83,9 @@ void CPlayerModeCart::think()
newPos.vy = platform->getPos().vy;
int platformOffset = ( ( CNpcPlatform* ) platform )->getHeightFromPlatformAtPosition( newPos.vx, newPos.vy );
s16 angle = ( ( CNpcPlatform * ) platform )->getCollisionAngle();
newPos.vx += ( -platformOffset * rsin( angle ) ) >> 12;
platformOffset = ( ( CNpcPlatform* ) platform )->getHeightFromPlatformAtPosition( newPos.vx, newPos.vy );
newPos.vy += platformOffset;
m_player->setPos( newPos );
@ -96,23 +99,5 @@ void CPlayerModeCart::think()
}
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
/*
void CPlayerModeDead::render(DVECTOR *_pos)
{
DVECTOR deadSbPos;
deadSbPos=*_pos;
deadSbPos.vy-=m_deadTime;
m_player->renderSb(&deadSbPos,ANIM_SPONGEBOB_DEATHANGLE,0);
}
*/
/*===========================================================================
end */

View file

@ -74,6 +74,10 @@
#include "player\pscart.h"
#endif
#ifndef __PLAYER_PSFLOAT_H__
#include "player\psfloat.h"
#endif
#ifndef __PLATFORM_PLATFORM_H__
#include "platform\platform.h"
#endif
@ -127,6 +131,7 @@ static CPlayerState *s_stateTable[]=
&s_stateLookDownRelax, // STATE_LOOKDOWNRELAX
&s_stateJumpBack, // STATE_JUMPBACK
&s_stateCart, // STATE_CART
&s_stateFloat, // STATE_FLOAT
};
static PlayerMetrics s_playerMetrics=
@ -316,7 +321,8 @@ void CPlayerModeBase::thinkVerticalMovement()
else if(m_currentState!=STATE_FALL&&m_currentState!=STATE_FALLFAR&& // Hmm.. (pkg)
m_currentState!=STATE_BUTTFALL&&m_currentState!=STATE_BUTTBOUNCE&&
m_currentState!=STATE_JUMP&&m_currentState!=STATE_SPRINGUP&&
m_currentState!=STATE_JUMPBACK&&m_currentState!=STATE_BUTTBOUNCEUP)
m_currentState!=STATE_JUMPBACK&&m_currentState!=STATE_BUTTBOUNCEUP&&
m_currentState!=STATE_FLOAT)
{
DVECTOR pos;
pos=m_player->getPlayerPos();

View file

@ -92,6 +92,7 @@ public:
virtual void renderModeUi() {;} // Ui specific to this mode (eg: ammo)
virtual int canDoLookAround() {return false;}
virtual void springPlayerUp(int _springHeight) {;}
virtual void setFloating() {;}
void inSoakUpState();
virtual int setState(int _state) {return 0;}
@ -128,6 +129,7 @@ public:
virtual void render() {;}
virtual int canDoLookAround();
virtual void springPlayerUp(int _springHeight) {m_springHeight=_springHeight;setState(STATE_SPRINGUP);}
virtual void setFloating() {setState( STATE_FLOAT );}
virtual ATTACK_STATE getAttackState();

View file

@ -131,6 +131,22 @@
#include "triggers\tsrightemit.h"
#endif
#ifndef __TRIGGERS_TWINDUP_H__
#include "triggers\twindup.h"
#endif
#ifndef __TRIGGERS_TWINDDOWN_H__
#include "triggers\twinddown.h"
#endif
#ifndef __TRIGGERS_TWINDLEFT_H__
#include "triggers\twindleft.h"
#endif
#ifndef __TRIGGERS_TWINDRIGHT_H__
#include "triggers\twindright.h"
#endif
#ifndef __GAME_GAME_H__
#include "game\game.h"
#endif
@ -291,6 +307,26 @@ CTrigger *trigger;
trigger=(CSteamSwitchEmitterTrigger*)new("SteamSwitchEmitterTrigger") CSteamSwitchEmitterTrigger();
break;
// Wind up
case TRIGGER_WIND_UP:
trigger = (CWindUpTrigger*)new("WindUpTrigger") CWindUpTrigger();
break;
// Wind down
case TRIGGER_WIND_DOWN:
trigger = (CWindDownTrigger*)new("WindDownTrigger") CWindDownTrigger();
break;
// Wind up
case TRIGGER_WIND_LEFT:
trigger = (CWindLeftTrigger*)new("WindLeftTrigger") CWindLeftTrigger();
break;
// Wind up
case TRIGGER_WIND_RIGHT:
trigger = (CWindRightTrigger*)new("WindRightTrigger") CWindRightTrigger();
break;
default:
trigger=NULL;
}

View file

@ -51,6 +51,10 @@ enum TRIGGER_TYPE
TRIGGER_STEAM_DOWN_EMITTER,
TRIGGER_STEAM_LEFT_EMITTER,
TRIGGER_STEAM_RIGHT_EMITTER,
TRIGGER_WIND_UP,
TRIGGER_WIND_DOWN,
TRIGGER_WIND_LEFT,
TRIGGER_WIND_RIGHT,
// Code based triggers
TRIGGER_PLATFORM,

View file

@ -37,6 +37,8 @@ void CWindDownTrigger::collidedWith(CThing *_thisThing)
move.vy = 4 * GameState::getFramesSinceLast();
player->shove( move );
move.vx = player->getMoveVelocity()->vx;
player->setMoveVelocity( &move );
player->setFloating();
break;

View file

@ -37,6 +37,7 @@ void CWindLeftTrigger::collidedWith(CThing *_thisThing)
move.vy = 0;
player->shove( move );
player->setMoveVelocity( &move );
player->setFloating();
break;

View file

@ -37,6 +37,7 @@ void CWindRightTrigger::collidedWith(CThing *_thisThing)
move.vy = 0;
player->shove( move );
player->setMoveVelocity( &move );
player->setFloating();
break;

View file

@ -33,9 +33,12 @@ void CWindUpTrigger::collidedWith(CThing *_thisThing)
CPlayer *player = (CPlayer *) _thisThing;
DVECTOR move;
move.vx = 0;
move.vy = -4 * GameState::getFramesSinceLast();
player->shove( move );
move.vx = player->getMoveVelocity()->vx;
player->setMoveVelocity( &move );
player->setFloating();
break;

View file

@ -18,8 +18,8 @@
Includes
-------- */
#ifndef __TRIGGERS_THAZARD_H__
#include "triggers\thazard.h"
#ifndef __TRIGGER_TRIGGER_HEADER__
#include "triggers\trigger.h"
#endif
/* Std Lib

View file

@ -157,6 +157,10 @@ LavaBubbleEmitter=24
SteamDownEmitter=25
SteamLeftEmitter=26
SteamRightEmitter=27
WindUp=28
WindDown=29
WindLeft=30
WindRight=31
################################################
# FX

View file

@ -62,3 +62,11 @@ HasBox=1
[OilDripEmitter]
[LavaDripEmitter]
[WindUp]
[WindDown]
[WindLeft]
[WindRight]

View file

@ -1743,6 +1743,14 @@ SOURCE=..\..\..\source\player\psfall.h
# End Source File
# Begin Source File
SOURCE=..\..\..\source\player\psfloat.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\source\player\psfloat.h
# End Source File
# Begin Source File
SOURCE=..\..\..\source\player\pshitgnd.cpp
# End Source File
# Begin Source File
@ -2371,6 +2379,38 @@ SOURCE=..\..\..\source\triggers\twdripemit.cpp
SOURCE=..\..\..\source\triggers\twdripemit.h
# End Source File
# Begin Source File
SOURCE=..\..\..\source\triggers\twinddown.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\source\triggers\twinddown.h
# End Source File
# Begin Source File
SOURCE=..\..\..\source\triggers\twindleft.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\source\triggers\twindleft.h
# End Source File
# Begin Source File
SOURCE=..\..\..\source\triggers\twindright.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\source\triggers\twindright.h
# End Source File
# Begin Source File
SOURCE=..\..\..\source\triggers\twindup.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\source\triggers\twindup.h
# End Source File
# End Group
# Begin Group "utils"