This commit is contained in:
parent
650f284e4a
commit
0ff14a08b7
14 changed files with 161 additions and 7 deletions
|
@ -294,7 +294,8 @@ triggers_src := trigger \
|
||||||
trestart \
|
trestart \
|
||||||
tteleprt \
|
tteleprt \
|
||||||
twater \
|
twater \
|
||||||
tplatfrm
|
tplatfrm \
|
||||||
|
tgarygo
|
||||||
|
|
||||||
utils_src := utils \
|
utils_src := utils \
|
||||||
sincos \
|
sincos \
|
||||||
|
|
|
@ -19,6 +19,21 @@
|
||||||
#include "game\game.h"
|
#include "game\game.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __UTILS_HEADER__
|
||||||
|
#include "utils\utils.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CNpcGaryFriend::postInit()
|
||||||
|
{
|
||||||
|
CNpcFriend::postInit();
|
||||||
|
|
||||||
|
m_started = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void CNpcGaryFriend::think( int _frames )
|
void CNpcGaryFriend::think( int _frames )
|
||||||
{
|
{
|
||||||
|
@ -65,7 +80,10 @@ void CNpcGaryFriend::think( int _frames )
|
||||||
|
|
||||||
Pos.vy += groundHeight;
|
Pos.vy += groundHeight;
|
||||||
|
|
||||||
Pos.vx += multiplier * _frames;
|
if ( m_started )
|
||||||
|
{
|
||||||
|
Pos.vx += multiplier * _frames;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -86,7 +104,10 @@ void CNpcGaryFriend::think( int _frames )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Pos.vx += multiplier * _frames;
|
if ( m_started )
|
||||||
|
{
|
||||||
|
Pos.vx += multiplier * _frames;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -95,3 +116,30 @@ void CNpcGaryFriend::think( int _frames )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CNpcGaryFriend::setupWaypoints( sThingActor *ThisActor )
|
||||||
|
{
|
||||||
|
if ( ThisActor->PointCount > 1 )
|
||||||
|
{
|
||||||
|
u16 *PntList=(u16*)MakePtr(ThisActor,sizeof(sThingActor));
|
||||||
|
|
||||||
|
u16 newXPos, newYPos;
|
||||||
|
|
||||||
|
// skip first waypoint
|
||||||
|
|
||||||
|
PntList++;
|
||||||
|
PntList++;
|
||||||
|
|
||||||
|
// get trigger position
|
||||||
|
|
||||||
|
newXPos = (u16) *PntList;
|
||||||
|
PntList++;
|
||||||
|
newYPos = (u16) *PntList;
|
||||||
|
PntList++;
|
||||||
|
|
||||||
|
m_triggerPos.vx = newXPos;
|
||||||
|
m_triggerPos.vy = newYPos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -21,7 +21,15 @@
|
||||||
class CNpcGaryFriend : public CNpcFriend
|
class CNpcGaryFriend : public CNpcFriend
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void think( int _frames );
|
virtual void postInit();
|
||||||
|
virtual void think( int _frames );
|
||||||
|
virtual void setupWaypoints( sThingActor *ThisActor );
|
||||||
|
DVECTOR const &getTriggerPos() {return( m_triggerPos );}
|
||||||
|
void start() {m_started = true;}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
DVECTOR m_triggerPos;
|
||||||
|
u8 m_started;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -354,3 +354,10 @@ void CNpcFriend::startConderversation()
|
||||||
{
|
{
|
||||||
// I am 'avin a fayg
|
// I am 'avin a fayg
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CNpcFriend::setupWaypoints( sThingActor *ThisActor )
|
||||||
|
{
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
|
|
@ -57,6 +57,7 @@ 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 setPlatform( CNpcPlatform *platform ) {m_platform = platform;}
|
||||||
void clearPlatform() {m_platform = NULL;}
|
void clearPlatform() {m_platform = NULL;}
|
||||||
|
virtual void setupWaypoints( sThingActor *ThisActor );
|
||||||
|
|
||||||
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 );
|
||||||
|
|
|
@ -486,6 +486,7 @@ void CLevel::initThings(int _respawningLevel)
|
||||||
{
|
{
|
||||||
CNpcFriend *friendNpc;
|
CNpcFriend *friendNpc;
|
||||||
friendNpc=CNpcFriend::Create(ThisActor);
|
friendNpc=CNpcFriend::Create(ThisActor);
|
||||||
|
friendNpc->setupWaypoints( ThisActor );
|
||||||
friendNpc->postInit();
|
friendNpc->postInit();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -534,6 +535,7 @@ void CLevel::initThings(int _respawningLevel)
|
||||||
CThingManager::initAllThings();
|
CThingManager::initAllThings();
|
||||||
CThingManager::matchWheelsAndWeights();
|
CThingManager::matchWheelsAndWeights();
|
||||||
CThingManager::matchPressureSwitches();
|
CThingManager::matchPressureSwitches();
|
||||||
|
CThingManager::matchGaryTriggers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ void CNpcBubblePlatform::processMovement( int _frames )
|
||||||
{
|
{
|
||||||
Pos.vy -= m_speed * _frames;
|
Pos.vy -= m_speed * _frames;
|
||||||
|
|
||||||
if ( m_npcPath.getWaypointCount() > 1 )
|
if ( m_npcPath.getWaypointCount() )
|
||||||
{
|
{
|
||||||
s32 minY, maxY;
|
s32 minY, maxY;
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,10 @@
|
||||||
#include "friend\friend.h"
|
#include "friend\friend.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __FRIEND_FGARY_H__
|
||||||
|
#include "friend\fgary.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef __HAZARD_HRWEIGHT_H__
|
#ifndef __HAZARD_HRWEIGHT_H__
|
||||||
#include "hazard\hrweight.h"
|
#include "hazard\hrweight.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -57,6 +61,10 @@
|
||||||
#include "hazard\hpswitch.h"
|
#include "hazard\hpswitch.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __TRIGGERS_TGARYGO_H__
|
||||||
|
#include "triggers\tgarygo.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Std Lib
|
/* Std Lib
|
||||||
------- */
|
------- */
|
||||||
|
|
||||||
|
@ -322,6 +330,55 @@ void CThingManager::matchWheelsAndWeights()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Function:
|
||||||
|
Purpose:
|
||||||
|
Params:
|
||||||
|
Returns:
|
||||||
|
---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void CThingManager::matchGaryTriggers()
|
||||||
|
{
|
||||||
|
CNpcFriend *friendNpc;
|
||||||
|
|
||||||
|
friendNpc = (CNpcFriend *) s_thingLists[CThing::TYPE_NPC];
|
||||||
|
|
||||||
|
while( friendNpc )
|
||||||
|
{
|
||||||
|
if ( friendNpc->getThingSubType() == CNpcFriend::NPC_FRIEND_GARY )
|
||||||
|
{
|
||||||
|
CNpcGaryFriend *gary = (CNpcGaryFriend *) friendNpc;
|
||||||
|
|
||||||
|
DVECTOR triggerPos = gary->getTriggerPos();
|
||||||
|
|
||||||
|
CTrigger *trigger;
|
||||||
|
|
||||||
|
trigger = (CTrigger *) s_thingLists[CThing::TYPE_TRIGGER];
|
||||||
|
|
||||||
|
while( trigger )
|
||||||
|
{
|
||||||
|
if ( trigger->getThingSubType() == CTrigger::TRIGGER_GARYSTART )
|
||||||
|
{
|
||||||
|
CGaryStartTrigger *garyTrigger = (CGaryStartTrigger *) trigger;
|
||||||
|
|
||||||
|
DVECTOR testPos = garyTrigger->getPos();
|
||||||
|
testPos.vx >>= 4;
|
||||||
|
testPos.vy >>= 4;
|
||||||
|
|
||||||
|
if ( testPos.vx == triggerPos.vx && testPos.vy == triggerPos.vy )
|
||||||
|
{
|
||||||
|
garyTrigger->setGary( gary );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
trigger = (CTrigger *) trigger->m_nextListThing;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
friendNpc = (CNpcFriend *) friendNpc->m_nextListThing;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*----------------------------------------------------------------------
|
/*----------------------------------------------------------------------
|
||||||
Function:
|
Function:
|
||||||
Purpose:
|
Purpose:
|
||||||
|
|
|
@ -64,6 +64,7 @@ public:
|
||||||
static void initCollision();
|
static void initCollision();
|
||||||
static void matchWheelsAndWeights();
|
static void matchWheelsAndWeights();
|
||||||
static void matchPressureSwitches();
|
static void matchPressureSwitches();
|
||||||
|
static void matchGaryTriggers();
|
||||||
|
|
||||||
static sBBox &getRenderBBox() {return(m_RenderBBox);}
|
static sBBox &getRenderBBox() {return(m_RenderBBox);}
|
||||||
static sBBox &getThinkBBox() {return(m_ThinkBBox);}
|
static sBBox &getThinkBBox() {return(m_ThinkBBox);}
|
||||||
|
|
|
@ -39,6 +39,10 @@
|
||||||
#include "triggers\tplatfrm.h"
|
#include "triggers\tplatfrm.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __TRIGGERS_TGARYGO_H__
|
||||||
|
#include "triggers\tgarygo.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef __GAME_GAME_H__
|
#ifndef __GAME_GAME_H__
|
||||||
#include "game\game.h"
|
#include "game\game.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -81,6 +85,11 @@ CTrigger *trigger;
|
||||||
trigger=(COutOfWaterTrigger*)new ("OutOfWaterTrigger") COutOfWaterTrigger();
|
trigger=(COutOfWaterTrigger*)new ("OutOfWaterTrigger") COutOfWaterTrigger();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// Gary start trigger
|
||||||
|
case TRIGGER_GARYSTART:
|
||||||
|
trigger=(CGaryStartTrigger*)new( "GaryStartTrigger") CGaryStartTrigger();
|
||||||
|
break;
|
||||||
|
|
||||||
case TRIGGER_PLATFORM:
|
case TRIGGER_PLATFORM:
|
||||||
trigger = (CPlatformTrigger*)new ("PlatformTrigger") CPlatformTrigger();
|
trigger = (CPlatformTrigger*)new ("PlatformTrigger") CPlatformTrigger();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -29,6 +29,7 @@ enum TRIGGER_TYPE
|
||||||
TRIGGER_CAMLOCK,
|
TRIGGER_CAMLOCK,
|
||||||
TRIGGER_INWATER,
|
TRIGGER_INWATER,
|
||||||
TRIGGER_OUTWATER,
|
TRIGGER_OUTWATER,
|
||||||
|
TRIGGER_GARYSTART,
|
||||||
|
|
||||||
// Code based triggers
|
// Code based triggers
|
||||||
TRIGGER_PLATFORM,
|
TRIGGER_PLATFORM,
|
||||||
|
|
|
@ -130,6 +130,7 @@ Teleport=2
|
||||||
CameraLock=3
|
CameraLock=3
|
||||||
InWater=4
|
InWater=4
|
||||||
OutOfWater=5
|
OutOfWater=5
|
||||||
|
GaryStart=6
|
||||||
|
|
||||||
################################################
|
################################################
|
||||||
# FX
|
# FX
|
||||||
|
|
|
@ -18,3 +18,5 @@ HasBox=1
|
||||||
[InWater]
|
[InWater]
|
||||||
|
|
||||||
[OutOfWater]
|
[OutOfWater]
|
||||||
|
|
||||||
|
[GaryStart]
|
|
@ -1905,6 +1905,14 @@ SOURCE=..\..\..\source\triggers\tcamlock.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\..\source\triggers\tgarygo.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\..\source\triggers\tgarygo.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=..\..\..\source\triggers\tlevexit.cpp
|
SOURCE=..\..\..\source\triggers\tlevexit.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
@ -1937,6 +1945,14 @@ SOURCE=..\..\..\source\triggers\trestart.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\..\source\triggers\trigger.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\..\source\triggers\trigger.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=..\..\..\source\triggers\tteleprt.cpp
|
SOURCE=..\..\..\source\triggers\tteleprt.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue