This commit is contained in:
parent
37beeedc6d
commit
e252951f9c
5 changed files with 71 additions and 3 deletions
|
@ -23,6 +23,10 @@
|
||||||
#include "utils\utils.h"
|
#include "utils\utils.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __GAME_GAME_H__
|
||||||
|
#include "game\game.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@ -92,8 +96,15 @@ void CNpcConveyorSwitchHazard::setWaypoints( sThingHazard *ThisHazard )
|
||||||
CHazardTrigger *trigger;
|
CHazardTrigger *trigger;
|
||||||
|
|
||||||
trigger=(CHazardTrigger*)CTrigger::Create(CTrigger::TRIGGER_HAZARD);
|
trigger=(CHazardTrigger*)CTrigger::Create(CTrigger::TRIGGER_HAZARD);
|
||||||
trigger->setPositionAndSize( ( newXPos << 4 ) + 8, ( newYPos << 4 ) + 16, 100, 0 );
|
trigger->setPositionAndSize( ( newXPos << 4 ) + 8 - 50, ( newYPos << 4 ) + 16, 100, 0 );
|
||||||
trigger->setHazard( this );
|
trigger->setHazard( this );
|
||||||
|
|
||||||
|
newXPos = (u16) *PntList;
|
||||||
|
PntList++;
|
||||||
|
newYPos = (u16) *PntList;
|
||||||
|
PntList++;
|
||||||
|
m_conveyorPos.vx = ( newXPos << 4 ) + 8;
|
||||||
|
m_conveyorPos.vy = ( newYPos << 4 ) + 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -101,4 +112,7 @@ void CNpcConveyorSwitchHazard::setWaypoints( sThingHazard *ThisHazard )
|
||||||
void CNpcConveyorSwitchHazard::trigger()
|
void CNpcConveyorSwitchHazard::trigger()
|
||||||
{
|
{
|
||||||
m_reversed = !m_reversed;
|
m_reversed = !m_reversed;
|
||||||
|
|
||||||
|
CLevel &level = GameScene.GetLevel();
|
||||||
|
level.reverseMapConveyor( m_conveyorPos );
|
||||||
}
|
}
|
|
@ -29,6 +29,7 @@ protected:
|
||||||
virtual void collidedWith(CThing *_thisThing) {}
|
virtual void collidedWith(CThing *_thisThing) {}
|
||||||
|
|
||||||
u8 m_reversed;
|
u8 m_reversed;
|
||||||
|
DVECTOR m_conveyorPos;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -708,6 +708,57 @@ DVECTOR DP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
void CLevel::reverseMapConveyor(DVECTOR const &Pos)
|
||||||
|
{
|
||||||
|
DVECTOR TL,BR;
|
||||||
|
|
||||||
|
|
||||||
|
TL.vx=Pos.vx&-16;;
|
||||||
|
TL.vy=Pos.vy&-16;;
|
||||||
|
BR=TL;
|
||||||
|
|
||||||
|
int ColT=CollisionLayer->getCollisionBlock(TL.vx,TL.vy)>>COLLISION_TYPE_FLAG_SHIFT;
|
||||||
|
|
||||||
|
// if (CollisionLayer->getCollisionBlock(TL.vx,TL.vy)>>COLLISION_TYPE_FLAG_SHIFT==ColT)printf ("!!");
|
||||||
|
|
||||||
|
// Left
|
||||||
|
while (CollisionLayer->getCollisionBlock(TL.vx-16,TL.vy)>>COLLISION_TYPE_FLAG_SHIFT==ColT) TL.vx-=16;
|
||||||
|
// Top
|
||||||
|
while (CollisionLayer->getCollisionBlock(TL.vx,TL.vy-16)>>COLLISION_TYPE_FLAG_SHIFT==ColT) TL.vy-=16;
|
||||||
|
// Right
|
||||||
|
while (CollisionLayer->getCollisionBlock(BR.vx+16,BR.vy)>>COLLISION_TYPE_FLAG_SHIFT==ColT) BR.vx+=16;
|
||||||
|
// Bottom
|
||||||
|
while (CollisionLayer->getCollisionBlock(BR.vx,BR.vy+16)>>COLLISION_TYPE_FLAG_SHIFT==ColT) BR.vy+=16;
|
||||||
|
|
||||||
|
DVECTOR DP;
|
||||||
|
|
||||||
|
for (DP.vy=TL.vy; DP.vy<=BR.vy; DP.vy+=16)
|
||||||
|
{
|
||||||
|
for (DP.vx=TL.vx; DP.vx<=BR.vx; DP.vx+=16)
|
||||||
|
{
|
||||||
|
u8 *ColElem=CollisionLayer->getMapPtr(DP.vx,DP.vy);
|
||||||
|
|
||||||
|
if (*ColElem>>COLLISION_TYPE_FLAG_SHIFT==ColT)
|
||||||
|
{
|
||||||
|
if ( ColT == COLLISION_TYPE_MOVE_LEFT )
|
||||||
|
{
|
||||||
|
*ColElem &= ~COLLISION_TYPE_FLAG_MOVE_LEFT;
|
||||||
|
*ColElem |= COLLISION_TYPE_FLAG_MOVE_RIGHT;
|
||||||
|
}
|
||||||
|
else if ( ColT == COLLISION_TYPE_MOVE_RIGHT )
|
||||||
|
{
|
||||||
|
*ColElem &= ~COLLISION_TYPE_FLAG_MOVE_RIGHT;
|
||||||
|
*ColElem |= COLLISION_TYPE_FLAG_MOVE_LEFT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CLevel::destroyMapTile(DVECTOR const &Pos)
|
void CLevel::destroyMapTile(DVECTOR const &Pos)
|
||||||
{
|
{
|
||||||
|
|
|
@ -46,6 +46,8 @@ static int getTotalSpatCount() {return( LvlTable[s_globalLevelSelectThin
|
||||||
void destroyMapArea(DVECTOR const &Pos);
|
void destroyMapArea(DVECTOR const &Pos);
|
||||||
void destroyMapTile(DVECTOR const &Pos);
|
void destroyMapTile(DVECTOR const &Pos);
|
||||||
|
|
||||||
|
void reverseMapConveyor(DVECTOR const &Pos);
|
||||||
|
|
||||||
int getActorCount() {return ActorCount;}
|
int getActorCount() {return ActorCount;}
|
||||||
sThingActor **getActorList() {return ActorList;}
|
sThingActor **getActorList() {return ActorList;}
|
||||||
int getPlatformCount() {return PlatformCount;}
|
int getPlatformCount() {return PlatformCount;}
|
||||||
|
|
|
@ -261,8 +261,8 @@ AttackStrength=0
|
||||||
Respawn=1
|
Respawn=1
|
||||||
|
|
||||||
[ConveyorSwitch]
|
[ConveyorSwitch]
|
||||||
Gfx=..\..\graphics\hazards\water_bucket\water_bucket.gin
|
Gfx=..\..\graphics\hazards\redswitch\redswitch.gin
|
||||||
WayPoints=0
|
WayPoints=2
|
||||||
Speed=0
|
Speed=0
|
||||||
TurnRate=0
|
TurnRate=0
|
||||||
Collision=0
|
Collision=0
|
||||||
|
|
Loading…
Add table
Reference in a new issue