This commit is contained in:
parent
68ca825123
commit
861c534304
@ -65,7 +65,7 @@ void CNpcSquidDartEnemy::render()
|
|||||||
|
|
||||||
int frame = FRM_SQUIDDART_SWIM0001 + ( m_frame >> 8 );
|
int frame = FRM_SQUIDDART_SWIM0001 + ( m_frame >> 8 );
|
||||||
|
|
||||||
SprFrame = CGameScene::getSpriteBank()->printFT4(frame,renderPos.vx,renderPos.vy,m_reversed,0,10);
|
SprFrame = CGameScene::getSpriteBank()->printFT4(frame,renderPos.vx,renderPos.vy,m_reversed,0,0);
|
||||||
|
|
||||||
//setRGB0( SprFrame, 255, 128, 255 );
|
//setRGB0( SprFrame, 255, 128, 255 );
|
||||||
|
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
fgary.cpp
|
fgary.cpp
|
||||||
|
|
||||||
Author: CRB
|
Author: CRB
|
||||||
Created:
|
Created:
|
||||||
Project: Spongebob
|
Project: Spongebob
|
||||||
Purpose:
|
Purpose:
|
||||||
|
|
||||||
Copyright (c) 2000 Climax Development Ltd
|
Copyright (c) 2000 Climax Development Ltd
|
||||||
|
|
||||||
@ -34,6 +34,19 @@ void CNpcGaryFriend::think( int _frames )
|
|||||||
|
|
||||||
groundHeight = CGameScene::getCollision()->getHeightFromGround( Pos.vx, Pos.vy, yMovement + 16 );
|
groundHeight = CGameScene::getCollision()->getHeightFromGround( Pos.vx, Pos.vy, yMovement + 16 );
|
||||||
|
|
||||||
|
if ( m_platform )
|
||||||
|
{
|
||||||
|
s32 platformHeight = m_platform->getHeightFromPlatformAtPosition( Pos.vx, Pos.vy );
|
||||||
|
|
||||||
|
if ( platformHeight < groundHeight )
|
||||||
|
{
|
||||||
|
groundHeight = platformHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Pos.vy += platformHeight;
|
||||||
|
//return;
|
||||||
|
}
|
||||||
|
|
||||||
if ( groundHeight <= 0 )
|
if ( groundHeight <= 0 )
|
||||||
{
|
{
|
||||||
// groundHeight <= 0 indicates either on ground or below ground
|
// groundHeight <= 0 indicates either on ground or below ground
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
friend.cpp
|
friend.cpp
|
||||||
|
|
||||||
Author: CRB
|
Author: CRB
|
||||||
Created:
|
Created:
|
||||||
Project: Spongebob
|
Project: Spongebob
|
||||||
Purpose:
|
Purpose:
|
||||||
|
|
||||||
Copyright (c) 2000 Climax Development Ltd
|
Copyright (c) 2000 Climax Development Ltd
|
||||||
|
|
||||||
@ -174,6 +174,7 @@ void CNpcFriend::init()
|
|||||||
m_animNo = m_data[m_type].idleAnim;
|
m_animNo = m_data[m_type].idleAnim;
|
||||||
m_frame = 0;
|
m_frame = 0;
|
||||||
m_reversed = false;
|
m_reversed = false;
|
||||||
|
m_platform = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -245,6 +246,7 @@ void CNpcFriend::render()
|
|||||||
m_actorGfx->Render(renderPos,m_animNo,(m_frame>>8),m_reversed);
|
m_actorGfx->Render(renderPos,m_animNo,(m_frame>>8),m_reversed);
|
||||||
|
|
||||||
sBBox boundingBox = m_actorGfx->GetBBox();
|
sBBox boundingBox = m_actorGfx->GetBBox();
|
||||||
|
boundingBox.YMax = 0;
|
||||||
setCollisionSize( ( boundingBox.XMax - boundingBox.XMin ), ( boundingBox.YMax - boundingBox.YMin ) );
|
setCollisionSize( ( boundingBox.XMax - boundingBox.XMin ), ( boundingBox.YMax - boundingBox.YMin ) );
|
||||||
setCollisionCentreOffset( ( boundingBox.XMax + boundingBox.XMin ) >> 1, ( boundingBox.YMax + boundingBox.YMin ) >> 1 );
|
setCollisionCentreOffset( ( boundingBox.XMax + boundingBox.XMin ) >> 1, ( boundingBox.YMax + boundingBox.YMin ) >> 1 );
|
||||||
}
|
}
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
friend.h
|
friend.h
|
||||||
|
|
||||||
Author: CRB
|
Author: CRB
|
||||||
Created:
|
Created:
|
||||||
Project: Spongebob
|
Project: Spongebob
|
||||||
Purpose:
|
Purpose:
|
||||||
|
|
||||||
Copyright (c) 2000 Climax Development Ltd
|
Copyright (c) 2000 Climax Development Ltd
|
||||||
|
|
||||||
@ -22,6 +22,10 @@
|
|||||||
#include "player\player.h"
|
#include "player\player.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __PLATFORM_PLATFORM_H__
|
||||||
|
#include "platform\platform.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class CNpcFriend : public CNpcThing
|
class CNpcFriend : public CNpcThing
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -51,6 +55,8 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
void setType( NPC_FRIEND_UNIT_TYPE newType ) {m_type = newType;}
|
void setType( NPC_FRIEND_UNIT_TYPE newType ) {m_type = newType;}
|
||||||
|
void setPlatform( CNpcPlatform *platform ) {m_platform = platform;}
|
||||||
|
void clearPlatform() {m_platform = NULL;}
|
||||||
|
|
||||||
static CNpcFriend *Create(sThingActor *ThisActor);
|
static CNpcFriend *Create(sThingActor *ThisActor);
|
||||||
static NPC_FRIEND_UNIT_TYPE getTypeFromMapEdit( u16 newType );
|
static NPC_FRIEND_UNIT_TYPE getTypeFromMapEdit( u16 newType );
|
||||||
@ -90,9 +96,10 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
// internal variables
|
// internal variables
|
||||||
|
|
||||||
NPC_FRIEND_UNIT_TYPE m_type;
|
NPC_FRIEND_UNIT_TYPE m_type;
|
||||||
s32 m_extension;
|
s32 m_extension;
|
||||||
|
CNpcPlatform *m_platform;
|
||||||
|
|
||||||
int m_frame;
|
int m_frame;
|
||||||
int m_animNo;
|
int m_animNo;
|
||||||
|
@ -15,6 +15,10 @@
|
|||||||
#include "platform\pdual.h"
|
#include "platform\pdual.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __HAZARD_HAZARD_H__
|
||||||
|
#include "hazard\hazard.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef __UTILS_HEADER__
|
#ifndef __UTILS_HEADER__
|
||||||
#include "utils\utils.h"
|
#include "utils\utils.h"
|
||||||
#endif
|
#endif
|
||||||
@ -231,4 +235,77 @@ const CRECT *CNpcDualPlatform::getThinkBBox()
|
|||||||
objThinkBox.y2 = thinkBBox.YMax;
|
objThinkBox.y2 = thinkBBox.YMax;
|
||||||
|
|
||||||
return &objThinkBox;
|
return &objThinkBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CNpcDualPlatform::collidedWith( CThing *_thisThing )
|
||||||
|
{
|
||||||
|
switch(_thisThing->getThingType())
|
||||||
|
{
|
||||||
|
case TYPE_PLAYER:
|
||||||
|
{
|
||||||
|
CPlayer *player;
|
||||||
|
DVECTOR playerPos;
|
||||||
|
CRECT collisionArea;
|
||||||
|
|
||||||
|
// Only interested in SBs feet colliding with the box (pkg)
|
||||||
|
player=(CPlayer*)_thisThing;
|
||||||
|
playerPos=player->getPos();
|
||||||
|
collisionArea=getCollisionArea();
|
||||||
|
|
||||||
|
s32 threshold = abs( collisionArea.y2 - collisionArea.y1 );
|
||||||
|
|
||||||
|
if ( threshold > 16 )
|
||||||
|
{
|
||||||
|
threshold = 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( playerPos.vx >= collisionArea.x1 && playerPos.vx <= collisionArea.x2 )
|
||||||
|
{
|
||||||
|
if ( checkCollisionDelta( _thisThing, threshold, collisionArea ) )
|
||||||
|
{
|
||||||
|
player->setPlatform( this );
|
||||||
|
|
||||||
|
m_contact = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( playerPos.vy >= collisionArea.y1 && playerPos.vy <= collisionArea.y2 )
|
||||||
|
{
|
||||||
|
int height = getHeightFromPlatformAtPosition( playerPos.vx, playerPos.vy );
|
||||||
|
|
||||||
|
if ( height >= -threshold && height < 1 )
|
||||||
|
{
|
||||||
|
player->setPlatform( this );
|
||||||
|
|
||||||
|
m_contact = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case TYPE_NPC:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TYPE_HAZARD:
|
||||||
|
{
|
||||||
|
m_contact = true;
|
||||||
|
|
||||||
|
CNpcHazard *hazard;
|
||||||
|
|
||||||
|
hazard = (CNpcHazard *)_thisThing;
|
||||||
|
|
||||||
|
hazard->setPlatform( this );
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
ASSERT(0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -32,6 +32,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
virtual void setWaypoints( sThingPlatform *ThisPlatform );
|
virtual void setWaypoints( sThingPlatform *ThisPlatform );
|
||||||
virtual void processMovement( int _frames );
|
virtual void processMovement( int _frames );
|
||||||
|
virtual void collidedWith(CThing *_thisThing);
|
||||||
|
|
||||||
u8 m_isMaster;
|
u8 m_isMaster;
|
||||||
CNpcDualPlatform *m_otherPlatform;
|
CNpcDualPlatform *m_otherPlatform;
|
||||||
|
@ -29,6 +29,10 @@
|
|||||||
#include "player\player.h"
|
#include "player\player.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __FRIEND_FRIEND_H__
|
||||||
|
#include "friend\friend.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef __HAZARD_HAZARD_H__
|
#ifndef __HAZARD_HAZARD_H__
|
||||||
#include "hazard\hazard.h"
|
#include "hazard\hazard.h"
|
||||||
#endif
|
#endif
|
||||||
@ -249,7 +253,7 @@ CNpcPlatform *CNpcPlatform::Create(sThingPlatform *ThisPlatform)
|
|||||||
platform = new ("cart platform") CNpcCartPlatform;
|
platform = new ("cart platform") CNpcCartPlatform;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case NPC_SEESAW_PLATFORM:
|
case NPC_SEESAW_PLATFORM:
|
||||||
{
|
{
|
||||||
platform = new ("seesaw platform") CNpcSeesawPlatform;
|
platform = new ("seesaw platform") CNpcSeesawPlatform;
|
||||||
@ -668,7 +672,7 @@ void CNpcPlatform::setCollisionAngle(int newAngle)
|
|||||||
m_collisionAngle=newAngle;
|
m_collisionAngle=newAngle;
|
||||||
// CPlatformThing::setCollisionAngle(newAngle);
|
// CPlatformThing::setCollisionAngle(newAngle);
|
||||||
calculateBoundingBoxSize();
|
calculateBoundingBoxSize();
|
||||||
|
|
||||||
CPlayer *player;
|
CPlayer *player;
|
||||||
|
|
||||||
// Is the player stood on this platform as it rotates?
|
// Is the player stood on this platform as it rotates?
|
||||||
@ -966,19 +970,55 @@ void CNpcPlatform::collidedWith( CThing *_thisThing )
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case TYPE_HAZARD:
|
case TYPE_NPC:
|
||||||
{
|
{
|
||||||
m_contact = true;
|
CNpcFriend *friendNpc;
|
||||||
|
DVECTOR friendPos;
|
||||||
|
CRECT collisionArea;
|
||||||
|
|
||||||
CNpcHazard *hazard;
|
friendNpc = (CNpcFriend*) _thisThing;
|
||||||
|
friendPos = friendNpc->getPos();
|
||||||
|
collisionArea=getCollisionArea();
|
||||||
|
|
||||||
hazard = (CNpcHazard *)_thisThing;
|
s32 threshold = abs( collisionArea.y2 - collisionArea.y1 );
|
||||||
|
|
||||||
hazard->setPlatform( this );
|
if ( threshold > 16 )
|
||||||
|
{
|
||||||
|
threshold = 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( friendPos.vx >= collisionArea.x1 && friendPos.vx <= collisionArea.x2 )
|
||||||
|
{
|
||||||
|
if ( checkCollisionDelta( _thisThing, threshold, collisionArea ) )
|
||||||
|
{
|
||||||
|
int height = getHeightFromPlatformAtPosition( friendPos.vx, friendPos.vy );
|
||||||
|
|
||||||
|
friendNpc->setPlatform( this );
|
||||||
|
|
||||||
|
m_contact = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( friendPos.vy >= collisionArea.y1 && friendPos.vy <= collisionArea.y2 )
|
||||||
|
{
|
||||||
|
int height = getHeightFromPlatformAtPosition( friendPos.vx, friendPos.vy );
|
||||||
|
|
||||||
|
if ( height >= -threshold && height < 1 )
|
||||||
|
{
|
||||||
|
friendNpc->setPlatform( this );
|
||||||
|
|
||||||
|
m_contact = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case TYPE_HAZARD:
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
break;
|
break;
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
thing.cpp
|
thing.cpp
|
||||||
|
|
||||||
Author: PKG
|
Author: PKG
|
||||||
Created:
|
Created:
|
||||||
Project: Spongebob
|
Project: Spongebob
|
||||||
Purpose:
|
Purpose:
|
||||||
|
|
||||||
Copyright (c) 2001 Climax Development Ltd
|
Copyright (c) 2001 Climax Development Ltd
|
||||||
|
|
||||||
@ -40,6 +40,10 @@
|
|||||||
#include "friend\friend.h"
|
#include "friend\friend.h"
|
||||||
#include "fx\fx.h"
|
#include "fx\fx.h"
|
||||||
|
|
||||||
|
#ifndef __FRIEND_FRIEND_H__
|
||||||
|
#include "friend\friend.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef __HAZARD_HRWEIGHT_H__
|
#ifndef __HAZARD_HRWEIGHT_H__
|
||||||
#include "hazard\hrweight.h"
|
#include "hazard\hrweight.h"
|
||||||
#endif
|
#endif
|
||||||
@ -172,7 +176,7 @@ int i;
|
|||||||
|
|
||||||
/*----------------------------------------------------------------------
|
/*----------------------------------------------------------------------
|
||||||
Function:
|
Function:
|
||||||
Purpose:
|
Purpose:
|
||||||
Params:
|
Params:
|
||||||
Returns:
|
Returns:
|
||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
@ -346,7 +350,7 @@ DVECTOR const &CamPos=CLevel::getCameraPos();
|
|||||||
CRECT const *ThingRect= thing->getThinkBBox();
|
CRECT const *ThingRect= thing->getThinkBBox();
|
||||||
bool Flag=true;
|
bool Flag=true;
|
||||||
// Will speed this up
|
// Will speed this up
|
||||||
|
|
||||||
if (!thing->alwaysThink())
|
if (!thing->alwaysThink())
|
||||||
{
|
{
|
||||||
if (ThingRect->x2<m_ThinkBBox.XMin || ThingRect->x1>m_ThinkBBox.XMax) Flag=false;
|
if (ThingRect->x2<m_ThinkBBox.XMin || ThingRect->x1>m_ThinkBBox.XMax) Flag=false;
|
||||||
@ -537,6 +541,32 @@ DVECTOR const &CamPos=CLevel::getCameraPos();
|
|||||||
}
|
}
|
||||||
thing1=thing1->m_nextCollisionThing;
|
thing1=thing1->m_nextCollisionThing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Friendly npc -> Platform projectile collision - first clear platforms
|
||||||
|
|
||||||
|
CNpcFriend *friendNpc = (CNpcFriend *) s_CollisionLists[CThing::TYPE_NPC];
|
||||||
|
while( friendNpc )
|
||||||
|
{
|
||||||
|
friendNpc->clearPlatform();
|
||||||
|
friendNpc = (CNpcFriend *) friendNpc->m_nextCollisionThing;
|
||||||
|
}
|
||||||
|
|
||||||
|
// now detect new platform
|
||||||
|
|
||||||
|
thing1=s_CollisionLists[CThing::TYPE_PLATFORM];
|
||||||
|
while(thing1)
|
||||||
|
{
|
||||||
|
thing2=s_CollisionLists[CThing::TYPE_NPC];
|
||||||
|
while(thing2)
|
||||||
|
{
|
||||||
|
if(thing1->checkCollisionAgainst(thing2, _frames))
|
||||||
|
{
|
||||||
|
thing1->collidedWith(thing2);
|
||||||
|
}
|
||||||
|
thing2=thing2->m_nextCollisionThing;
|
||||||
|
}
|
||||||
|
thing1=thing1->m_nextCollisionThing;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Shut emm down, sh sh shut em down, we shutem down
|
// Shut emm down, sh sh shut em down, we shutem down
|
||||||
for(i=0;i<CThing::MAX_TYPE;i++)
|
for(i=0;i<CThing::MAX_TYPE;i++)
|
||||||
@ -753,7 +783,7 @@ void CThingManager::resetFreeList()
|
|||||||
}
|
}
|
||||||
List[t]=0;
|
List[t]=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -799,7 +829,7 @@ void CThingManager::DeleteThing(CThing *Thing)
|
|||||||
int Type=Thing->getThingType();
|
int Type=Thing->getThingType();
|
||||||
int SubType=Thing->getThingSubType();
|
int SubType=Thing->getThingSubType();
|
||||||
CThing **List=s_FreeList[Type];
|
CThing **List=s_FreeList[Type];
|
||||||
|
|
||||||
// Check its been aquired/set correctly
|
// Check its been aquired/set correctly
|
||||||
|
|
||||||
ASSERT(SubType!=1234);
|
ASSERT(SubType!=1234);
|
||||||
@ -851,7 +881,7 @@ void CThing::init()
|
|||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
void CThing::shutdown()
|
void CThing::shutdown()
|
||||||
{
|
{
|
||||||
if (ParentThing)
|
if (ParentThing)
|
||||||
{ // Is child
|
{ // Is child
|
||||||
ParentThing->removeChild(this);
|
ParentThing->removeChild(this);
|
||||||
}
|
}
|
||||||
@ -872,7 +902,7 @@ void CThing::shutdown()
|
|||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
void CThing::think(int _frames)
|
void CThing::think(int _frames)
|
||||||
{
|
{
|
||||||
PosDelta.vx=Pos.vx-PosLast.vx;
|
PosDelta.vx=Pos.vx-PosLast.vx;
|
||||||
PosDelta.vy=Pos.vy-PosLast.vy;
|
PosDelta.vy=Pos.vy-PosLast.vy;
|
||||||
PosLast=Pos;
|
PosLast=Pos;
|
||||||
|
|
||||||
@ -1036,7 +1066,7 @@ CThing *List=NextThing;
|
|||||||
if ( List )
|
if ( List )
|
||||||
{
|
{
|
||||||
// Find end of list
|
// Find end of list
|
||||||
while (List->NextThing)
|
while (List->NextThing)
|
||||||
{
|
{
|
||||||
List=List->NextThing;
|
List=List->NextThing;
|
||||||
}
|
}
|
||||||
@ -1327,4 +1357,3 @@ void CTriggerThing::setTargetBox(int _x,int _y,int _w,int _h)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user