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 \
|
||||
tteleprt \
|
||||
twater \
|
||||
tplatfrm
|
||||
tplatfrm \
|
||||
tgarygo
|
||||
|
||||
utils_src := utils \
|
||||
sincos \
|
||||
|
|
|
@ -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
|
||||
|
@ -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
|
||||
{
|
||||
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
|
|
@ -354,3 +354,10 @@ void CNpcFriend::startConderversation()
|
|||
{
|
||||
// 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 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 );
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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);}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -29,6 +29,7 @@ enum TRIGGER_TYPE
|
|||
TRIGGER_CAMLOCK,
|
||||
TRIGGER_INWATER,
|
||||
TRIGGER_OUTWATER,
|
||||
TRIGGER_GARYSTART,
|
||||
|
||||
// Code based triggers
|
||||
TRIGGER_PLATFORM,
|
||||
|
|
|
@ -130,6 +130,7 @@ Teleport=2
|
|||
CameraLock=3
|
||||
InWater=4
|
||||
OutOfWater=5
|
||||
GaryStart=6
|
||||
|
||||
################################################
|
||||
# FX
|
||||
|
|
|
@ -18,3 +18,5 @@ HasBox=1
|
|||
[InWater]
|
||||
|
||||
[OutOfWater]
|
||||
|
||||
[GaryStart]
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue