This commit is contained in:
parent
ec8ff7ed5b
commit
396949c907
13 changed files with 142 additions and 6 deletions
|
@ -103,6 +103,10 @@
|
|||
#include "hazard\hrwheel.h"
|
||||
#endif
|
||||
|
||||
#ifndef __HAZARD_HPSWITCH_H__
|
||||
#include "hazard\hpswitch.h"
|
||||
#endif
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -126,6 +130,7 @@ CNpcHazard::NPC_HAZARD_UNIT_TYPE CNpcHazard::mapEditConvertTable[NPC_HAZARD_TYPE
|
|||
NPC_FLY_TRAP_HAZARD,
|
||||
NPC_RISING_WEIGHT_HAZARD,
|
||||
NPC_RISING_WEIGHT_WHEEL_HAZARD,
|
||||
NPC_PRESSURE_SWITCH_HAZARD,
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -246,6 +251,12 @@ CNpcHazard *CNpcHazard::Create(sThingHazard *ThisHazard)
|
|||
break;
|
||||
}
|
||||
|
||||
case NPC_PRESSURE_SWITCH_HAZARD:
|
||||
{
|
||||
hazard = new ("pressure switch hazard") CNpcPressureSwitchHazard;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
hazard = NULL;
|
||||
|
|
|
@ -54,6 +54,7 @@ public:
|
|||
NPC_FLY_TRAP_HAZARD,
|
||||
NPC_RISING_WEIGHT_HAZARD,
|
||||
NPC_RISING_WEIGHT_WHEEL_HAZARD,
|
||||
NPC_PRESSURE_SWITCH_HAZARD,
|
||||
|
||||
NPC_HAZARD_TYPE_MAX,
|
||||
};
|
||||
|
|
|
@ -555,6 +555,7 @@ void CLevel::initThings(int _respawningLevel)
|
|||
CJellyfishGenerator::init();
|
||||
CThingManager::initAllThings();
|
||||
CThingManager::matchWheelsAndWeights();
|
||||
CThingManager::matchPressureSwitches();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -395,6 +395,18 @@ CNpcPlatform::NPC_PLATFORM_DATA CNpcPlatform::m_data[NPC_PLATFORM_TYPE_MAX] =
|
|||
NPC_PLATFORM_TIMER_NONE,
|
||||
},
|
||||
|
||||
{ // NPC_TRAPDOOR_PLATFORM
|
||||
3,
|
||||
128,
|
||||
true,
|
||||
DAMAGE__NONE,
|
||||
0,
|
||||
4,
|
||||
NPC_PLATFORM_INFINITE_LIFE,
|
||||
0,
|
||||
NPC_PLATFORM_TIMER_NONE,
|
||||
},
|
||||
|
||||
{ // NPC_PLAYER_BUBBLE_PLATFORM
|
||||
3,
|
||||
128,
|
||||
|
@ -451,6 +463,7 @@ CNpcPlatform::NPC_PLATFORM_UNIT_TYPE CNpcPlatform::mapEditConvertTable[NPC_PLATF
|
|||
NPC_FISH_HOOK_3_PLATFORM,
|
||||
NPC_RISING_BRIDGE_PLATFORM,
|
||||
NPC_BALLOON_BRIDGE_PLATFORM,
|
||||
NPC_TRAPDOOR_PLATFORM,
|
||||
NPC_PLAYER_BUBBLE_PLATFORM,
|
||||
NPC_CLAM_PLATFORM,
|
||||
};
|
||||
|
|
|
@ -155,6 +155,10 @@
|
|||
#include "platform\pbaloon.h"
|
||||
#endif
|
||||
|
||||
#ifndef __PLATFORM_PTRPDOOR_H__
|
||||
#include "platform\ptrpdoor.h"
|
||||
#endif
|
||||
|
||||
#include "fx\fx.h"
|
||||
#include "fx\fxjfish.h"
|
||||
|
||||
|
@ -364,6 +368,12 @@ CNpcPlatform *CNpcPlatform::Create(sThingPlatform *ThisPlatform)
|
|||
break;
|
||||
}
|
||||
|
||||
case NPC_TRAPDOOR_PLATFORM:
|
||||
{
|
||||
platform = new ("trapdoor platform") CNpcTrapdoorPlatform;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
ASSERT( 0 );
|
||||
|
@ -1077,11 +1087,20 @@ int CNpcPlatform::getHeightFromPlatformAtPosition(int _x,int _y, int offsetX, in
|
|||
|
||||
// Rotate backwards to find height at current position
|
||||
|
||||
int hypotenuse = ( ( top.vx - _x ) << 12 ) / rcos( angle );
|
||||
s16 cosVal = rcos( angle );
|
||||
|
||||
int angleHeight = -( hypotenuse * rsin( angle ) ) >> 12;
|
||||
if ( !cosVal )
|
||||
{
|
||||
return( top.vy - _y );
|
||||
}
|
||||
else
|
||||
{
|
||||
int hypotenuse = ( ( top.vx - _x ) << 12 ) / cosVal;
|
||||
|
||||
return( ( top.vy - _y ) + angleHeight );
|
||||
int angleHeight = -( hypotenuse * rsin( angle ) ) >> 12;
|
||||
|
||||
return( ( top.vy - _y ) + angleHeight );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -83,6 +83,7 @@ public:
|
|||
NPC_FISH_HOOK_3_PLATFORM,
|
||||
NPC_RISING_BRIDGE_PLATFORM,
|
||||
NPC_BALLOON_BRIDGE_PLATFORM,
|
||||
NPC_TRAPDOOR_PLATFORM,
|
||||
NPC_PLAYER_BUBBLE_PLATFORM,
|
||||
NPC_CLAM_PLATFORM,
|
||||
NPC_PLATFORM_TYPE_MAX,
|
||||
|
@ -108,6 +109,7 @@ public:
|
|||
void setGraphic( u8 graphicNum );
|
||||
virtual void setWaypoints( sThingPlatform *ThisPlatform );
|
||||
virtual void trigger() {;}
|
||||
NPC_PLATFORM_UNIT_TYPE getType() {return( m_type );}
|
||||
|
||||
static NPC_PLATFORM_UNIT_TYPE getTypeFromMapEdit( u16 newType );
|
||||
static CNpcPlatform *Create(sThingPlatform *ThisPlatform);
|
||||
|
|
|
@ -43,6 +43,10 @@
|
|||
#include "hazard\hrwheel.h"
|
||||
#endif
|
||||
|
||||
#ifndef __HAZARD_HPSWITCH_H__
|
||||
#include "hazard\hpswitch.h"
|
||||
#endif
|
||||
|
||||
|
||||
/* Std Lib
|
||||
------- */
|
||||
|
@ -189,6 +193,53 @@ void CThingManager::initAllThings()
|
|||
}
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
void CThingManager::matchPressureSwitches()
|
||||
{
|
||||
CNpcHazard *hazard;
|
||||
|
||||
hazard = (CNpcHazard *) s_thingLists[CThing::TYPE_HAZARD];
|
||||
|
||||
while( hazard )
|
||||
{
|
||||
if ( hazard->getType() == CNpcHazard::NPC_PRESSURE_SWITCH_HAZARD )
|
||||
{
|
||||
CNpcPressureSwitchHazard *switchHazard = (CNpcPressureSwitchHazard *) hazard;
|
||||
|
||||
DVECTOR triggerPos = switchHazard->getTriggerPos();
|
||||
|
||||
CNpcPlatform *platform;
|
||||
|
||||
platform = (CNpcPlatform *) s_thingLists[CThing::TYPE_PLATFORM];
|
||||
|
||||
while( platform )
|
||||
{
|
||||
if ( platform->getType() == CNpcPlatform::NPC_TRAPDOOR_PLATFORM )
|
||||
{
|
||||
CNpcTrapdoorPlatform *trapdoor = (CNpcTrapdoorPlatform *) platform;
|
||||
|
||||
DVECTOR testPos = trapdoor->getTriggerPos();
|
||||
|
||||
if ( testPos.vx == triggerPos.vx && testPos.vy == triggerPos.vy )
|
||||
{
|
||||
switchHazard->linkToPlatform( trapdoor );
|
||||
}
|
||||
}
|
||||
|
||||
platform = (CNpcPlatform *) platform->m_nextListThing;
|
||||
}
|
||||
}
|
||||
|
||||
hazard = (CNpcHazard *) hazard->m_nextListThing;
|
||||
}
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
|
|
|
@ -63,6 +63,7 @@ public:
|
|||
static CThing* checkCollisionAreaAgainstThings(CRECT *_area,int _type,int _continue);
|
||||
static void initCollision();
|
||||
static void matchWheelsAndWeights();
|
||||
static void matchPressureSwitches();
|
||||
|
||||
static sBBox &getRenderBBox() {return(m_RenderBBox);}
|
||||
static sBBox &getThinkBBox() {return(m_ThinkBBox);}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue