This commit is contained in:
parent
86ca3a02db
commit
85fecdb6f2
22 changed files with 91 additions and 195 deletions
|
@ -285,7 +285,8 @@ system_src := main \
|
||||||
|
|
||||||
thing_src := thing
|
thing_src := thing
|
||||||
|
|
||||||
triggers_src := tcamlock \
|
triggers_src := trigger \
|
||||||
|
tcamlock \
|
||||||
tlevexit \
|
tlevexit \
|
||||||
tlook \
|
tlook \
|
||||||
trestart \
|
trestart \
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
|
|
||||||
#include "gfx\font.h"
|
#include "gfx\font.h"
|
||||||
|
|
||||||
|
#include "triggers\trigger.h"
|
||||||
|
/*
|
||||||
#ifndef __TRIGGERS_TLEVEXIT_H__
|
#ifndef __TRIGGERS_TLEVEXIT_H__
|
||||||
#include "triggers\tlevexit.h"
|
#include "triggers\tlevexit.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -38,6 +40,7 @@
|
||||||
#ifndef __TRIGGERS_TWATER_H__
|
#ifndef __TRIGGERS_TWATER_H__
|
||||||
#include "triggers\twater.h"
|
#include "triggers\twater.h"
|
||||||
#endif
|
#endif
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef __PICKUPS_PICKUP_H__
|
#ifndef __PICKUPS_PICKUP_H__
|
||||||
#include "pickups\pickup.h"
|
#include "pickups\pickup.h"
|
||||||
|
@ -352,79 +355,28 @@ void CLevel::initLayers()
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CLevel::initThings(int _respawningLevel)
|
void CLevel::initThings(int _respawningLevel)
|
||||||
{
|
{
|
||||||
// Triggers
|
|
||||||
// Yeah yeah - I'll put this crap into a seperate file when the numbers of trigger types get a bit bigger! (pkg)
|
|
||||||
if (LevelHdr->TriggerList)
|
if (LevelHdr->TriggerList)
|
||||||
{
|
{
|
||||||
sThingHdr *Hdr=(sThingHdr*)MakePtr(LevelHdr,LevelHdr->TriggerList);
|
sThingHdr *Hdr=(sThingHdr*)MakePtr(LevelHdr,LevelHdr->TriggerList);
|
||||||
TriggerCount=Hdr->Count;
|
TriggerCount=Hdr->Count;
|
||||||
TriggerList=(sThingTrigger*)MakePtr(Hdr,sizeof(sThingHdr));
|
TriggerList=(sThingTrigger*)MakePtr(Hdr,sizeof(sThingHdr));
|
||||||
|
|
||||||
|
// Cam Locks first
|
||||||
for(int i=0;i<TriggerCount;i++)
|
for(int i=0;i<TriggerCount;i++)
|
||||||
{
|
{
|
||||||
CTriggerThing *trigger=NULL; // I hate having to do this just to keep the compiler quiet :/ (pkg)
|
if (TriggerList[i].Type==CTrigger::TRIGGER_CAMLOCK)
|
||||||
if(TriggerList->Type==3)
|
|
||||||
{
|
{
|
||||||
// Camera lock trigger
|
CTrigger::Create(&TriggerList[i]);
|
||||||
trigger=(CCameraLockTrigger*)new ("CameraLockTrigger") CCameraLockTrigger();
|
|
||||||
trigger->setThingSubType(0);
|
|
||||||
trigger->init();
|
|
||||||
trigger->setPositionAndSize(TriggerList->Pos.X<<4,TriggerList->Pos.Y<<4,
|
|
||||||
TriggerList->Width<<4,TriggerList->Height<<4);
|
|
||||||
trigger->setTargetBox(TriggerList->TargetPos.X<<4,TriggerList->TargetPos.Y<<4,TriggerList->TargetSize.X<<4,TriggerList->TargetSize.Y<<4);
|
|
||||||
}
|
}
|
||||||
TriggerList++;
|
|
||||||
}
|
}
|
||||||
}
|
// the rest
|
||||||
|
|
||||||
if (LevelHdr->TriggerList)
|
|
||||||
{
|
|
||||||
sThingHdr *Hdr=(sThingHdr*)MakePtr(LevelHdr,LevelHdr->TriggerList);
|
|
||||||
TriggerCount=Hdr->Count;
|
|
||||||
TriggerList=(sThingTrigger*)MakePtr(Hdr,sizeof(sThingHdr));
|
TriggerList=(sThingTrigger*)MakePtr(Hdr,sizeof(sThingHdr));
|
||||||
|
|
||||||
for(int i=0;i<TriggerCount;i++)
|
for(int i=0;i<TriggerCount;i++)
|
||||||
{
|
{
|
||||||
CTriggerThing *trigger=NULL; // I hate having to do this just to keep the compiler quiet :/ (pkg)
|
if (TriggerList[i].Type!=CTrigger::TRIGGER_CAMLOCK)
|
||||||
switch(TriggerList->Type)
|
|
||||||
{
|
{
|
||||||
// Exit trigger
|
CTrigger::Create(&TriggerList[i]);
|
||||||
case 0:
|
|
||||||
trigger=(CTriggerThing*)new ("LevelExitTrigger") CLevelExitTrigger();
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Level respawn trigger
|
|
||||||
case 1:
|
|
||||||
trigger=(CRestartPointTrigger*)new ("RestartTrigger") CRestartPointTrigger();
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Teleport trigger
|
|
||||||
case 2:
|
|
||||||
trigger=(CTeleportTrigger*)new ("TeleportTrigger") CTeleportTrigger();
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Camera lock trigger
|
|
||||||
case 3:
|
|
||||||
trigger=NULL;
|
|
||||||
break;
|
|
||||||
|
|
||||||
// In/Out of water triggers
|
|
||||||
case 4:
|
|
||||||
trigger=(CInWaterTrigger*)new ("InWaterTrigger") CInWaterTrigger();
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
trigger=(COutOfWaterTrigger*)new ("OutOfWaterTrigger") COutOfWaterTrigger();
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
if(trigger)
|
|
||||||
{
|
|
||||||
trigger->setThingSubType(0);
|
|
||||||
trigger->init();
|
|
||||||
trigger->setPositionAndSize(TriggerList->Pos.X<<4,TriggerList->Pos.Y<<4,
|
|
||||||
TriggerList->Width<<4,TriggerList->Height<<4);
|
|
||||||
trigger->setTargetBox(TriggerList->TargetPos.X<<4,TriggerList->TargetPos.Y<<4,TriggerList->TargetSize.X<<4,TriggerList->TargetSize.Y<<4);
|
|
||||||
}
|
|
||||||
TriggerList++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
#define LListLen (32*2)
|
#define LListLen (256)
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
typedef struct
|
typedef struct
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
#include "platform\prbridge.h"
|
#include "platform\prbridge.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "triggers\trigger.h"
|
||||||
|
|
||||||
#ifndef __TRIGGERS_TPLATFRM_H__
|
#ifndef __TRIGGERS_TPLATFRM_H__
|
||||||
#include "triggers\tplatfrm.h"
|
#include "triggers\tplatfrm.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include "projectl\projectl.h"
|
#include "projectl\projectl.h"
|
||||||
#include "enemy\npc.h"
|
#include "enemy\npc.h"
|
||||||
#include "friend\friend.h"
|
#include "friend\friend.h"
|
||||||
|
#include "triggers\trigger.h"
|
||||||
#include "fx\fx.h"
|
#include "fx\fx.h"
|
||||||
|
|
||||||
#ifndef __FRIEND_FRIEND_H__
|
#ifndef __FRIEND_FRIEND_H__
|
||||||
|
@ -115,7 +116,7 @@ static const sFreeListTable FreeListTable[]=
|
||||||
/* 4*/ {CThing::TYPE_NPC ,CNpcFriend::MAX_SUBTYPE},
|
/* 4*/ {CThing::TYPE_NPC ,CNpcFriend::MAX_SUBTYPE},
|
||||||
/* 5*/ {CThing::TYPE_ENEMY ,CNpcEnemy::MAX_SUBTYPE},
|
/* 5*/ {CThing::TYPE_ENEMY ,CNpcEnemy::MAX_SUBTYPE},
|
||||||
/* 6*/ {CThing::TYPE_ENEMYPROJECTILE ,CProjectile::MAX_SUBTYPE},
|
/* 6*/ {CThing::TYPE_ENEMYPROJECTILE ,CProjectile::MAX_SUBTYPE},
|
||||||
/* 7*/ {CThing::TYPE_TRIGGER ,CTriggerThing::MAX_SUBTYPE},
|
/* 7*/ {CThing::TYPE_TRIGGER ,CTrigger::MAX_SUBTYPE},
|
||||||
/* 8*/ {CThing::TYPE_HAZARD ,CNpcHazard::MAX_SUBTYPE},
|
/* 8*/ {CThing::TYPE_HAZARD ,CNpcHazard::MAX_SUBTYPE},
|
||||||
/* 9*/ {CThing::TYPE_FX ,CFX::MAX_SUBTYPE},
|
/* 9*/ {CThing::TYPE_FX ,CFX::MAX_SUBTYPE},
|
||||||
};
|
};
|
||||||
|
@ -837,6 +838,8 @@ CThing *CThingManager::GetThing(int Type,int SubType)
|
||||||
CThing **List=s_FreeList[Type];
|
CThing **List=s_FreeList[Type];
|
||||||
CThing *Thing=List[SubType];
|
CThing *Thing=List[SubType];
|
||||||
|
|
||||||
|
ASSERT(Type<CThing::MAX_TYPE);
|
||||||
|
ASSERT(SubType<FreeListTable[Type].Count);
|
||||||
if (Thing)
|
if (Thing)
|
||||||
{
|
{
|
||||||
List[SubType]=Thing->NextFreeThing;
|
List[SubType]=Thing->NextFreeThing;
|
||||||
|
@ -898,6 +901,7 @@ void CThing::init()
|
||||||
{
|
{
|
||||||
ParentThing=NULL;
|
ParentThing=NULL;
|
||||||
NextThing=NULL;
|
NextThing=NULL;
|
||||||
|
NextFreeThing=0;
|
||||||
m_numChildren = 0;
|
m_numChildren = 0;
|
||||||
|
|
||||||
Pos.vx=Pos.vy=10;
|
Pos.vx=Pos.vy=10;
|
||||||
|
@ -1012,78 +1016,6 @@ void CThing::ShowBBox()
|
||||||
DrawLine(area.x1,area.y1,area.x2,area.y2,255,0,0,0);
|
DrawLine(area.x1,area.y1,area.x2,area.y2,255,0,0,0);
|
||||||
DrawLine(area.x2,area.y1,area.x1,area.y2,255,0,0,0);
|
DrawLine(area.x2,area.y1,area.x1,area.y2,255,0,0,0);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
DVECTOR ofs;
|
|
||||||
CRECT area;
|
|
||||||
|
|
||||||
ofs=CLevel::getCameraPos();
|
|
||||||
|
|
||||||
area=getCollisionArea();
|
|
||||||
area.x1-=ofs.vx;
|
|
||||||
area.y1-=ofs.vy;
|
|
||||||
area.x2-=ofs.vx;
|
|
||||||
area.y2-=ofs.vy;
|
|
||||||
|
|
||||||
if(area.x1<=511&&area.x2>=0&&
|
|
||||||
area.y1<=255&&area.y2>=0)
|
|
||||||
{
|
|
||||||
area=getCollisionArea();
|
|
||||||
|
|
||||||
SVECTOR points[4];
|
|
||||||
VECTOR vecPoints[4];
|
|
||||||
|
|
||||||
points[0].vx = area.x1 - Pos.vx;
|
|
||||||
points[0].vy = area.y1 - Pos.vy;
|
|
||||||
|
|
||||||
points[1].vx = area.x1 - Pos.vx;
|
|
||||||
points[1].vy = area.y2 - Pos.vy;
|
|
||||||
|
|
||||||
points[2].vx = area.x2 - Pos.vx;
|
|
||||||
points[2].vy = area.y2 - Pos.vy;
|
|
||||||
|
|
||||||
points[3].vx = area.x2 - Pos.vx;
|
|
||||||
points[3].vy = area.y1 - Pos.vy;
|
|
||||||
|
|
||||||
MATRIX mtx;
|
|
||||||
|
|
||||||
SetIdentNoTrans(&mtx );
|
|
||||||
RotMatrixZ( m_collisionAngle, &mtx );
|
|
||||||
|
|
||||||
ApplyMatrix( &mtx, &points[0], &vecPoints[0] );
|
|
||||||
ApplyMatrix( &mtx, &points[1], &vecPoints[1] );
|
|
||||||
ApplyMatrix( &mtx, &points[2], &vecPoints[2] );
|
|
||||||
ApplyMatrix( &mtx, &points[3], &vecPoints[3] );
|
|
||||||
|
|
||||||
vecPoints[0].vx += Pos.vx - ofs.vx;
|
|
||||||
vecPoints[0].vy += Pos.vy - ofs.vy;
|
|
||||||
|
|
||||||
vecPoints[1].vx += Pos.vx - ofs.vx;
|
|
||||||
vecPoints[1].vy += Pos.vy - ofs.vy;
|
|
||||||
|
|
||||||
vecPoints[2].vx += Pos.vx - ofs.vx;
|
|
||||||
vecPoints[2].vy += Pos.vy - ofs.vy;
|
|
||||||
|
|
||||||
vecPoints[3].vx += Pos.vx - ofs.vx;
|
|
||||||
vecPoints[3].vy += Pos.vy - ofs.vy;
|
|
||||||
|
|
||||||
//DrawLine(area.x1,area.y1,area.x1,area.y2,255,255,255,0);
|
|
||||||
//DrawLine(area.x1,area.y2,area.x2,area.y2,255,255,255,0);
|
|
||||||
//DrawLine(area.x2,area.y2,area.x2,area.y1,255,255,255,0);
|
|
||||||
//DrawLine(area.x2,area.y1,area.x1,area.y1,255,255,255,0);
|
|
||||||
|
|
||||||
DrawLine( vecPoints[0].vx, vecPoints[0].vy, vecPoints[1].vx, vecPoints[1].vy,255,255,255,0);
|
|
||||||
DrawLine( vecPoints[1].vx, vecPoints[1].vy, vecPoints[2].vx, vecPoints[2].vy,255,255,255,0);
|
|
||||||
DrawLine( vecPoints[2].vx, vecPoints[2].vy, vecPoints[3].vx, vecPoints[3].vy,255,255,255,0);
|
|
||||||
DrawLine( vecPoints[3].vx, vecPoints[3].vy, vecPoints[0].vx, vecPoints[0].vy,255,255,255,0);
|
|
||||||
|
|
||||||
area.x1=Pos.vx-10-ofs.vx;
|
|
||||||
area.y1=Pos.vy-10-ofs.vy;
|
|
||||||
area.x2=Pos.vx+10-ofs.vx;
|
|
||||||
area.y2=Pos.vy+10-ofs.vy;
|
|
||||||
DrawLine(area.x1,area.y1,area.x2,area.y2,255,0,0,0);
|
|
||||||
DrawLine(area.x2,area.y1,area.x1,area.y2,255,0,0,0);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1207,17 +1139,7 @@ CThing *List=NextThing;
|
||||||
Params:
|
Params:
|
||||||
Returns:
|
Returns:
|
||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
int CThing::getNumChildren()
|
/*
|
||||||
{
|
|
||||||
return( m_numChildren );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------
|
|
||||||
Function:
|
|
||||||
Purpose:
|
|
||||||
Params:
|
|
||||||
Returns:
|
|
||||||
---------------------------------------------------------------------- */
|
|
||||||
bool CThing::hasChild(CThing *Child)
|
bool CThing::hasChild(CThing *Child)
|
||||||
{
|
{
|
||||||
CThing *nextChild = NextThing;
|
CThing *nextChild = NextThing;
|
||||||
|
@ -1234,7 +1156,7 @@ CThing *nextChild = NextThing;
|
||||||
|
|
||||||
return( false );
|
return( false );
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
/*----------------------------------------------------------------------
|
/*----------------------------------------------------------------------
|
||||||
Function:
|
Function:
|
||||||
Purpose:
|
Purpose:
|
||||||
|
@ -1370,25 +1292,3 @@ void CThing::processEvent(GAME_EVENT _event,CThing *_sourceThing)
|
||||||
Params:
|
Params:
|
||||||
Returns:
|
Returns:
|
||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
void CTriggerThing::setPositionAndSize(int _x,int _y,int _w,int _h)
|
|
||||||
{
|
|
||||||
Pos.vx=_x+(_w/2);
|
|
||||||
Pos.vy=_y+(_h/2);
|
|
||||||
setCollisionSize(_w,_h);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------
|
|
||||||
Function:
|
|
||||||
Purpose:
|
|
||||||
Params:
|
|
||||||
Returns:
|
|
||||||
---------------------------------------------------------------------- */
|
|
||||||
void CTriggerThing::setTargetBox(int _x,int _y,int _w,int _h)
|
|
||||||
{
|
|
||||||
m_boxX1=_x;
|
|
||||||
m_boxY1=_y;
|
|
||||||
m_boxX2=_x+_w;
|
|
||||||
m_boxY2=_y+_h;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -149,8 +149,8 @@ virtual int dontKillDuringLevelRespawn() {return false;}
|
||||||
void removeChild(CThing *Child);
|
void removeChild(CThing *Child);
|
||||||
void removeAllChild();
|
void removeAllChild();
|
||||||
void deleteAllChild();
|
void deleteAllChild();
|
||||||
bool hasChild(CThing *Child);
|
// bool hasChild(CThing *Child);
|
||||||
int getNumChildren();
|
int getNumChildren() {return( m_numChildren );}
|
||||||
|
|
||||||
|
|
||||||
DVECTOR const &getPos() {return Pos;}
|
DVECTOR const &getPos() {return Pos;}
|
||||||
|
@ -286,17 +286,7 @@ virtual TYPE getThingType() {return TYPE_PLATFORM;}
|
||||||
class CTriggerThing : public CThing
|
class CTriggerThing : public CThing
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum
|
|
||||||
{ // For Dynamic ThingCache
|
|
||||||
MAX_SUBTYPE =1,
|
|
||||||
};
|
|
||||||
|
|
||||||
virtual TYPE getThingType() {return TYPE_TRIGGER;}
|
virtual TYPE getThingType() {return TYPE_TRIGGER;}
|
||||||
virtual void setPositionAndSize(int _x,int _y,int _w,int _h); // Wonder if this might be better in CThing? (pkg)
|
|
||||||
virtual void setTargetBox(int _x,int _y,int _w,int _h); // Wonder if this might be better in CThing? (pkg)
|
|
||||||
|
|
||||||
protected:
|
|
||||||
int m_boxX1,m_boxY1,m_boxX2,m_boxY2;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class CHazardThing : public CThing
|
class CHazardThing : public CThing
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
Includes
|
Includes
|
||||||
-------- */
|
-------- */
|
||||||
|
|
||||||
|
#include "triggers\trigger.h"
|
||||||
|
|
||||||
#include "triggers\tcamlock.h"
|
#include "triggers\tcamlock.h"
|
||||||
|
|
||||||
#ifndef __PLAYER_PLAYER_H__
|
#ifndef __PLAYER_PLAYER_H__
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
Structure defintions
|
Structure defintions
|
||||||
-------------------- */
|
-------------------- */
|
||||||
|
|
||||||
class CCameraLockTrigger : public CTriggerThing
|
class CCameraLockTrigger : public CTrigger
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
virtual void collidedWith(CThing *_thisThing);
|
virtual void collidedWith(CThing *_thisThing);
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
Includes
|
Includes
|
||||||
-------- */
|
-------- */
|
||||||
|
|
||||||
|
#include "triggers\trigger.h"
|
||||||
#include "triggers\tlevexit.h"
|
#include "triggers\tlevexit.h"
|
||||||
|
|
||||||
#ifndef __GAME_GAME_H__
|
#ifndef __GAME_GAME_H__
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
Structure defintions
|
Structure defintions
|
||||||
-------------------- */
|
-------------------- */
|
||||||
|
|
||||||
class CLevelExitTrigger : public CTriggerThing
|
class CLevelExitTrigger : public CTrigger
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
#if defined (__USER_art__) || defined (__USER_sbart__)
|
#if defined (__USER_art__) || defined (__USER_sbart__)
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
Includes
|
Includes
|
||||||
-------- */
|
-------- */
|
||||||
|
|
||||||
|
#include "triggers\trigger.h"
|
||||||
#include "triggers\tlook.h"
|
#include "triggers\tlook.h"
|
||||||
|
|
||||||
#ifndef __PLAYER_PLAYER_H__
|
#ifndef __PLAYER_PLAYER_H__
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
Structure defintions
|
Structure defintions
|
||||||
-------------------- */
|
-------------------- */
|
||||||
|
|
||||||
class CLookTrigger : public CTriggerThing
|
class CLookTrigger : public CTrigger
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
virtual void collidedWith(CThing *_thisThing);
|
virtual void collidedWith(CThing *_thisThing);
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
Includes
|
Includes
|
||||||
-------- */
|
-------- */
|
||||||
|
|
||||||
|
#include "triggers\trigger.h"
|
||||||
#include "triggers\tplatfrm.h"
|
#include "triggers\tplatfrm.h"
|
||||||
|
|
||||||
#ifndef __GAME_GAME_H__
|
#ifndef __GAME_GAME_H__
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
Structure defintions
|
Structure defintions
|
||||||
-------------------- */
|
-------------------- */
|
||||||
|
|
||||||
class CPlatformTrigger : public CTriggerThing
|
class CPlatformTrigger : public CTrigger
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
#if defined (__USER_art__) || defined (__USER_sbart__)
|
#if defined (__USER_art__) || defined (__USER_sbart__)
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
Includes
|
Includes
|
||||||
-------- */
|
-------- */
|
||||||
|
|
||||||
|
#include "triggers\trigger.h"
|
||||||
#include "triggers\trestart.h"
|
#include "triggers\trestart.h"
|
||||||
|
|
||||||
#ifndef __PLAYER_PLAYER_H__
|
#ifndef __PLAYER_PLAYER_H__
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
Structure defintions
|
Structure defintions
|
||||||
-------------------- */
|
-------------------- */
|
||||||
|
|
||||||
class CRestartPointTrigger : public CTriggerThing
|
class CRestartPointTrigger : public CTrigger
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
virtual void collidedWith(CThing *_thisThing);
|
virtual void collidedWith(CThing *_thisThing);
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
CTrigger *CTrigger::Create(int Type)
|
CTrigger *CTrigger::Create(int Type)
|
||||||
{
|
{
|
||||||
CTrigger *trigger;
|
CTrigger *trigger;
|
||||||
printf("Trig Type %i\n",Type);
|
|
||||||
trigger = (CTrigger*)CThingManager::GetThing(CThing::TYPE_TRIGGER,Type);
|
trigger = (CTrigger*)CThingManager::GetThing(CThing::TYPE_TRIGGER,Type);
|
||||||
if (!trigger)
|
if (!trigger)
|
||||||
switch( Type )
|
switch( Type )
|
||||||
|
@ -66,20 +66,19 @@ printf("Trig Type %i\n",Type);
|
||||||
|
|
||||||
// Camera lock trigger
|
// Camera lock trigger
|
||||||
case TRIGGER_CAMLOCK:
|
case TRIGGER_CAMLOCK:
|
||||||
trigger=NULL;
|
trigger=(CCameraLockTrigger*)new ("CameraLockTrigger") CCameraLockTrigger();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// In/Out of water triggers
|
// In/Out of water triggers
|
||||||
case TRIGGER_WATER:
|
case TRIGGER_INWATER:
|
||||||
trigger=(CInWaterTrigger*)new ("InWaterTrigger") CInWaterTrigger();
|
trigger=(CInWaterTrigger*)new ("InWaterTrigger") CInWaterTrigger();
|
||||||
break;
|
break;
|
||||||
case 5:
|
case TRIGGER_OUTWATER:
|
||||||
trigger=(COutOfWaterTrigger*)new ("OutOfWaterTrigger") COutOfWaterTrigger();
|
trigger=(COutOfWaterTrigger*)new ("OutOfWaterTrigger") COutOfWaterTrigger();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
trigger=NULL;
|
trigger=NULL;
|
||||||
}
|
}
|
||||||
printf("TriggerDone\n");
|
|
||||||
ASSERT( trigger);
|
ASSERT( trigger);
|
||||||
|
|
||||||
trigger->setThingSubType(Type);
|
trigger->setThingSubType(Type);
|
||||||
|
@ -92,7 +91,6 @@ printf("TriggerDone\n");
|
||||||
CTrigger *CTrigger::Create(sThingTrigger *ThisTrigger)
|
CTrigger *CTrigger::Create(sThingTrigger *ThisTrigger)
|
||||||
{
|
{
|
||||||
CTrigger *trigger=Create(ThisTrigger->Type);
|
CTrigger *trigger=Create(ThisTrigger->Type);
|
||||||
|
|
||||||
trigger->setPositionAndSize(ThisTrigger->Pos.X<<4,ThisTrigger->Pos.Y<<4,ThisTrigger->Width<<4,ThisTrigger->Height<<4);
|
trigger->setPositionAndSize(ThisTrigger->Pos.X<<4,ThisTrigger->Pos.Y<<4,ThisTrigger->Width<<4,ThisTrigger->Height<<4);
|
||||||
trigger->setTargetBox(ThisTrigger->TargetPos.X<<4,ThisTrigger->TargetPos.Y<<4,ThisTrigger->TargetSize.X<<4,ThisTrigger->TargetSize.Y<<4);
|
trigger->setTargetBox(ThisTrigger->TargetPos.X<<4,ThisTrigger->TargetPos.Y<<4,ThisTrigger->TargetSize.X<<4,ThisTrigger->TargetSize.Y<<4);
|
||||||
|
|
||||||
|
@ -102,9 +100,47 @@ CTrigger *trigger=Create(ThisTrigger->Type);
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
void CTrigger::init()
|
void CTrigger::init()
|
||||||
{
|
{
|
||||||
|
CTriggerThing::init();
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
void CTrigger::shutdown()
|
void CTrigger::shutdown()
|
||||||
{
|
{
|
||||||
|
CTriggerThing::shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
void CTrigger::think(int _frames)
|
||||||
|
{
|
||||||
|
CTriggerThing::think(_frames);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
void CTrigger::render()
|
||||||
|
{
|
||||||
|
CTriggerThing::render();
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
void CTrigger::setPositionAndSize(int _x,int _y,int _w,int _h)
|
||||||
|
{
|
||||||
|
Pos.vx=_x+(_w/2);
|
||||||
|
Pos.vy=_y+(_h/2);
|
||||||
|
setCollisionSize(_w,_h);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Function:
|
||||||
|
Purpose:
|
||||||
|
Params:
|
||||||
|
Returns:
|
||||||
|
---------------------------------------------------------------------- */
|
||||||
|
void CTrigger::setTargetBox(int _x,int _y,int _w,int _h)
|
||||||
|
{
|
||||||
|
m_boxX1=_x;
|
||||||
|
m_boxY1=_y;
|
||||||
|
m_boxX2=_x+_w;
|
||||||
|
m_boxY2=_y+_h;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
trigger.h
|
trigger.h
|
||||||
|
|
||||||
Author: dave
|
Author: dave
|
||||||
Created:
|
Created: cos paul was too lazy
|
||||||
Project: Spongebob
|
Project: Spongebob
|
||||||
Purpose:
|
Purpose: Oh, cos I like the sound of my own typing
|
||||||
|
|
||||||
Copyright (c) 2001 Climax Development Ltd
|
Copyright (c) 2001 Climax Development Ltd
|
||||||
|
|
||||||
|
@ -27,7 +27,8 @@ enum TRIGGER_TYPE
|
||||||
TRIGGER_RESPAWN,
|
TRIGGER_RESPAWN,
|
||||||
TRIGGER_TELEPORT,
|
TRIGGER_TELEPORT,
|
||||||
TRIGGER_CAMLOCK,
|
TRIGGER_CAMLOCK,
|
||||||
TRIGGER_WATER,
|
TRIGGER_INWATER,
|
||||||
|
TRIGGER_OUTWATER,
|
||||||
TRIGGER_MAX,
|
TRIGGER_MAX,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -38,13 +39,19 @@ enum TRIGGER_TYPE
|
||||||
|
|
||||||
virtual void init();
|
virtual void init();
|
||||||
virtual void shutdown();
|
virtual void shutdown();
|
||||||
|
virtual void think(int _frames);
|
||||||
|
virtual void render();
|
||||||
|
|
||||||
static CTrigger *Create(int Type);
|
static CTrigger *Create(int Type);
|
||||||
static CTrigger *Create(sThingTrigger *ThisTrigger);
|
static CTrigger *Create(sThingTrigger *ThisTrigger);
|
||||||
|
virtual void setPositionAndSize(int _x,int _y,int _w,int _h);
|
||||||
|
virtual void setTargetBox(int _x,int _y,int _w,int _h);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void collidedWith(CThing *_thisThing){};
|
virtual void collidedWith(CThing *_thisThing){};
|
||||||
|
|
||||||
|
int m_boxX1,m_boxY1,m_boxX2,m_boxY2;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
Includes
|
Includes
|
||||||
-------- */
|
-------- */
|
||||||
|
|
||||||
|
#include "triggers\trigger.h"
|
||||||
#include "triggers\tteleprt.h"
|
#include "triggers\tteleprt.h"
|
||||||
|
|
||||||
#ifndef __PLAYER_PLAYER_H__
|
#ifndef __PLAYER_PLAYER_H__
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
Structure defintions
|
Structure defintions
|
||||||
-------------------- */
|
-------------------- */
|
||||||
|
|
||||||
class CTeleportTrigger : public CTriggerThing
|
class CTeleportTrigger : public CTrigger
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
virtual void collidedWith(CThing *_thisThing);
|
virtual void collidedWith(CThing *_thisThing);
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
Includes
|
Includes
|
||||||
-------- */
|
-------- */
|
||||||
|
|
||||||
|
#include "triggers\trigger.h"
|
||||||
#include "triggers\twater.h"
|
#include "triggers\twater.h"
|
||||||
|
|
||||||
#ifndef __PLAYER_PLAYER_H__
|
#ifndef __PLAYER_PLAYER_H__
|
||||||
|
|
|
@ -34,14 +34,14 @@
|
||||||
Structure defintions
|
Structure defintions
|
||||||
-------------------- */
|
-------------------- */
|
||||||
|
|
||||||
class CInWaterTrigger : public CTriggerThing
|
class CInWaterTrigger : public CTrigger
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
virtual void collidedWith(CThing *_thisThing);
|
virtual void collidedWith(CThing *_thisThing);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class COutOfWaterTrigger : public CTriggerThing
|
class COutOfWaterTrigger : public CTrigger
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
virtual void collidedWith(CThing *_thisThing);
|
virtual void collidedWith(CThing *_thisThing);
|
||||||
|
|
Loading…
Add table
Reference in a new issue