This commit is contained in:
Charles 2001-05-30 20:24:02 +00:00
parent 650f284e4a
commit 0ff14a08b7
14 changed files with 161 additions and 7 deletions

View File

@ -294,7 +294,8 @@ triggers_src := trigger \
trestart \
tteleprt \
twater \
tplatfrm
tplatfrm \
tgarygo
utils_src := utils \
sincos \

View File

@ -19,6 +19,21 @@
#include "game\game.h"
#endif
#ifndef __UTILS_HEADER__
#include "utils\utils.h"
#endif
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcGaryFriend::postInit()
{
CNpcFriend::postInit();
m_started = false;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcGaryFriend::think( int _frames )
{
@ -65,7 +80,10 @@ void CNpcGaryFriend::think( int _frames )
Pos.vy += groundHeight;
Pos.vx += multiplier * _frames;
if ( m_started )
{
Pos.vx += multiplier * _frames;
}
}
}
else
@ -86,7 +104,10 @@ void CNpcGaryFriend::think( int _frames )
}
else
{
Pos.vx += multiplier * _frames;
if ( m_started )
{
Pos.vx += multiplier * _frames;
}
}
}
else
@ -94,4 +115,31 @@ void CNpcGaryFriend::think( int _frames )
Pos.vy += yMovement;
}
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
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;
}
}

View File

@ -21,7 +21,15 @@
class CNpcGaryFriend : public CNpcFriend
{
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

View File

@ -353,4 +353,11 @@ void CNpcFriend::collidedWith( CThing *_thisThing )
void CNpcFriend::startConderversation()
{
// I am 'avin a fayg
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcFriend::setupWaypoints( sThingActor *ThisActor )
{
// do nothing
}

View File

@ -57,6 +57,7 @@ public:
void setType( NPC_FRIEND_UNIT_TYPE newType ) {m_type = newType;}
void setPlatform( CNpcPlatform *platform ) {m_platform = platform;}
void clearPlatform() {m_platform = NULL;}
virtual void setupWaypoints( sThingActor *ThisActor );
static CNpcFriend *Create(sThingActor *ThisActor);
static NPC_FRIEND_UNIT_TYPE getTypeFromMapEdit( u16 newType );

View File

@ -486,6 +486,7 @@ void CLevel::initThings(int _respawningLevel)
{
CNpcFriend *friendNpc;
friendNpc=CNpcFriend::Create(ThisActor);
friendNpc->setupWaypoints( ThisActor );
friendNpc->postInit();
}
break;
@ -534,6 +535,7 @@ void CLevel::initThings(int _respawningLevel)
CThingManager::initAllThings();
CThingManager::matchWheelsAndWeights();
CThingManager::matchPressureSwitches();
CThingManager::matchGaryTriggers();
}

View File

@ -23,7 +23,7 @@ void CNpcBubblePlatform::processMovement( int _frames )
{
Pos.vy -= m_speed * _frames;
if ( m_npcPath.getWaypointCount() > 1 )
if ( m_npcPath.getWaypointCount() )
{
s32 minY, maxY;

View File

@ -45,6 +45,10 @@
#include "friend\friend.h"
#endif
#ifndef __FRIEND_FGARY_H__
#include "friend\fgary.h"
#endif
#ifndef __HAZARD_HRWEIGHT_H__
#include "hazard\hrweight.h"
#endif
@ -57,6 +61,10 @@
#include "hazard\hpswitch.h"
#endif
#ifndef __TRIGGERS_TGARYGO_H__
#include "triggers\tgarygo.h"
#endif
/* 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:
Purpose:

View File

@ -64,6 +64,7 @@ public:
static void initCollision();
static void matchWheelsAndWeights();
static void matchPressureSwitches();
static void matchGaryTriggers();
static sBBox &getRenderBBox() {return(m_RenderBBox);}
static sBBox &getThinkBBox() {return(m_ThinkBBox);}

View File

@ -39,6 +39,10 @@
#include "triggers\tplatfrm.h"
#endif
#ifndef __TRIGGERS_TGARYGO_H__
#include "triggers\tgarygo.h"
#endif
#ifndef __GAME_GAME_H__
#include "game\game.h"
#endif
@ -81,6 +85,11 @@ CTrigger *trigger;
trigger=(COutOfWaterTrigger*)new ("OutOfWaterTrigger") COutOfWaterTrigger();
break;
// Gary start trigger
case TRIGGER_GARYSTART:
trigger=(CGaryStartTrigger*)new( "GaryStartTrigger") CGaryStartTrigger();
break;
case TRIGGER_PLATFORM:
trigger = (CPlatformTrigger*)new ("PlatformTrigger") CPlatformTrigger();
break;

View File

@ -29,6 +29,7 @@ enum TRIGGER_TYPE
TRIGGER_CAMLOCK,
TRIGGER_INWATER,
TRIGGER_OUTWATER,
TRIGGER_GARYSTART,
// Code based triggers
TRIGGER_PLATFORM,

View File

@ -130,6 +130,7 @@ Teleport=2
CameraLock=3
InWater=4
OutOfWater=5
GaryStart=6
################################################
# FX

View File

@ -18,3 +18,5 @@ HasBox=1
[InWater]
[OutOfWater]
[GaryStart]

View File

@ -1905,6 +1905,14 @@ SOURCE=..\..\..\source\triggers\tcamlock.h
# End 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
# End Source File
# Begin Source File
@ -1937,6 +1945,14 @@ SOURCE=..\..\..\source\triggers\trestart.h
# End 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
# End Source File
# Begin Source File