This commit is contained in:
Daveo 2001-05-29 18:40:38 +00:00
parent 66b8f87573
commit a22646985b
14 changed files with 37 additions and 37 deletions

View file

@ -186,6 +186,7 @@ void CGameScene::init()
void CGameScene::createPlayer()
{
m_player=new ("player") CPlayer();
m_player->setThingSubType(0);
}
// This is also to be overloaded for demomode.. to stop the pause menu appearing

View file

@ -279,7 +279,6 @@ CNpcHazard *CNpcHazard::Create(sThingHazard *ThisHazard)
ASSERT( hazard );
hazard->setType( Type );
hazard->setThingSubType(Type);
hazard->init();
hazard->setWaypoints( ThisHazard );

View file

@ -72,8 +72,6 @@ public:
virtual void setWaypoints( sThingHazard *ThisHazard );
void addWaypoint( s32 xPos, s32 yPos );
virtual void setRespawnRate( s16 newRespawnRate ) {m_respawnRate=newRespawnRate;}
void setType( NPC_HAZARD_UNIT_TYPE type ) {m_type = type;}
NPC_HAZARD_UNIT_TYPE getType() {return( m_type );}
static NPC_HAZARD_UNIT_TYPE getTypeFromMapEdit( u16 newType );
static CNpcHazard *Create(sThingHazard *ThisHazard);
@ -97,9 +95,7 @@ protected:
virtual void processTimer( int _frames );
virtual void collidedWith(CThing *_thisThing);
NPC_HAZARD_UNIT_TYPE m_type;
CNpcPath m_npcPath;
//CActorGfx *m_actorGfx;
DVECTOR m_base;
s32 m_timer;
bool m_timerActive;

View file

@ -367,6 +367,7 @@ void CLevel::initThings(int _respawningLevel)
{
// Camera lock trigger
trigger=(CCameraLockTrigger*)new ("CameraLockTrigger") CCameraLockTrigger();
trigger->setThingSubType(0);
trigger->init();
trigger->setPositionAndSize(TriggerList->Pos.X<<4,TriggerList->Pos.Y<<4,
TriggerList->Width<<4,TriggerList->Height<<4);
@ -417,6 +418,7 @@ void CLevel::initThings(int _respawningLevel)
}
if(trigger)
{
trigger->setThingSubType(0);
trigger->init();
trigger->setPositionAndSize(TriggerList->Pos.X<<4,TriggerList->Pos.Y<<4,
TriggerList->Width<<4,TriggerList->Height<<4);

View file

@ -50,7 +50,7 @@ void CNpcGeyserPlatformGenerator::think( int _frames )
if ( m_timer < 0 )
{
//m_timer = getRnd() % ( m_data[m_type].initTimer * GameState::getOneSecondInFrames() );
m_timer = m_data[m_type].initTimer * GameState::getOneSecondInFrames();
m_timer = m_dataPtr->initTimer * GameState::getOneSecondInFrames();
// generate new falling platform
@ -75,7 +75,7 @@ void CNpcGeyserPlatformGenerator::think( int _frames )
ASSERT(newPlatform);
newPlatform->setType( m_targetType );
newPlatform->setThingSubType( m_targetType );
newPlatform->setGraphic( m_graphicNum );
DVECTOR startPos = Pos;

View file

@ -53,7 +53,7 @@ void CNpcConveyorPlatformGenerator::think( int _frames )
m_timer = second;
m_timer += m_data[m_type].initTimer * second;
m_timer += m_dataPtr->initTimer * second;
m_timer += second - ( getRnd() % ( 2 * second ) );
@ -66,7 +66,7 @@ void CNpcConveyorPlatformGenerator::think( int _frames )
ASSERT(newPlatform);
newPlatform->setType( NPC_CONVEYOR_PLATFORM );
newPlatform->setThingSubType( NPC_CONVEYOR_PLATFORM );
newPlatform->setGraphic( m_graphicNum );
CNpcWaypoint *sourceWaypoint = m_npcPath.getWaypointList();

View file

@ -53,7 +53,7 @@ void CNpcFallingPlatformGenerator::think( int _frames )
m_timer = second;
m_timer += m_data[m_type].initTimer * second;
m_timer += m_dataPtr->initTimer * second;
m_timer += second - ( getRnd() % ( 2 * second ) );
@ -84,7 +84,7 @@ void CNpcFallingPlatformGenerator::think( int _frames )
ASSERT(newPlatform);
newPlatform->setType( m_targetType );
newPlatform->setThingSubType( m_targetType );
newPlatform->setGraphic( m_graphicNum );
CNpcWaypoint *sourceWaypoint = m_npcPath.getWaypointList();

View file

@ -394,7 +394,6 @@ CNpcPlatform *CNpcPlatform::Create(int Type)
}
ASSERT(platform);
platform->setType( (NPC_PLATFORM_UNIT_TYPE) Type );
platform->setThingSubType( Type );
platform->setTiltable( false );
@ -422,7 +421,7 @@ CNpcPlatform *CNpcPlatform::Create(sThingPlatform *ThisPlatform)
dualPlatformSlave = (CNpcDualPlatform *) CNpcPlatform::Create( NPC_DUAL_PLATFORM );
dualPlatformSlave->setMaster( false );
dualPlatformSlave->setType( Type );
dualPlatformSlave->setThingSubType( Type );
dualPlatformSlave->setGraphic( ThisPlatform );
dualPlatformSlave->setTiltable( false );
@ -504,6 +503,7 @@ void CNpcPlatform::init()
{
CPlatformThing::init();
m_dataPtr=&m_data[getThingSubType()];
m_heading = 0;
m_velocity = 0;
@ -511,10 +511,10 @@ void CNpcPlatform::init()
m_reversed = false;
m_extension = 0;
m_contact = false;
m_timer = m_data[m_type].initTimer * GameState::getOneSecondInFrames();
m_timerType = m_data[m_type].initTimerType;
m_timer = m_dataPtr->initTimer * GameState::getOneSecondInFrames();
m_timerType = m_dataPtr->initTimerType;
m_isActive = true;
m_detectCollision = m_data[m_type].detectCollision;
m_detectCollision = m_dataPtr->detectCollision;
m_state = 0;
m_tiltAngle = 0;
m_tiltVelocity = 0;
@ -522,13 +522,13 @@ void CNpcPlatform::init()
m_initRotation = 0;
m_lifetime = 0;
m_lifetimeType = m_data[m_type].lifetimeType;
m_lifetimeType = m_dataPtr->lifetimeType;
m_isShuttingDown = false;
m_npcPath.initPath();
m_speed = m_data[m_type].speed;
m_speed = m_dataPtr->speed;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -539,7 +539,7 @@ void CNpcPlatform::init( DVECTOR initPos )
Pos = m_initPos = m_base = initPos;
m_initLifetime = m_lifetime = GameState::getOneSecondInFrames() * m_data[m_type].lifetime;
m_initLifetime = m_lifetime = GameState::getOneSecondInFrames() * m_dataPtr->lifetime;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -560,10 +560,10 @@ void CNpcPlatform::reinit()
m_rotation = 0;
m_reversed = false;
m_contact = false;
m_timer = m_data[m_type].initTimer * GameState::getOneSecondInFrames();
m_timerType = m_data[m_type].initTimerType;
m_timer = m_dataPtr->initTimer * GameState::getOneSecondInFrames();
m_timerType = m_dataPtr->initTimerType;
m_isActive = true;
m_detectCollision = m_data[m_type].detectCollision;
m_detectCollision = m_dataPtr->detectCollision;
m_state = 0;
m_tiltAngle = 0;
m_tiltVelocity = 0;
@ -1205,7 +1205,8 @@ void CNpcPlatform::addWaypoint( s32 xPos, s32 yPos )
void CNpcPlatform::setTypeFromMapEdit( u16 newType )
{
m_type = mapEditConvertTable[newType];
int Type= mapEditConvertTable[newType];
setThingSubType(Type);
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View file

@ -103,7 +103,6 @@ public:
virtual void think(int _frames);
virtual void render();
virtual u8 canDrop() {return true;}
void setType( NPC_PLATFORM_UNIT_TYPE newType ) {m_type = newType;}
void setTypeFromMapEdit( u16 newType );
virtual int checkCollisionAgainst(CThing *_thisThing, int _frames);
virtual u8 checkCollisionDelta( CThing *_thisThing, int threshold, CRECT collisionArea );
@ -114,7 +113,6 @@ 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(int Type);
@ -187,7 +185,8 @@ protected:
// internal variables
NPC_PLATFORM_UNIT_TYPE m_type;
// NPC_PLATFORM_UNIT_TYPE m_type;
NPC_PLATFORM_DATA *m_dataPtr;
CNpcPath m_npcPath;
s32 m_heading;
s32 m_velocity;

View file

@ -40,7 +40,7 @@ void CNpcLinearPlatform::processMovement( int _frames )
if ( !pathComplete )
{
s16 decDir, incDir;
s16 maxTurnRate = m_data[m_type].turnSpeed;
s16 maxTurnRate = m_dataPtr->turnSpeed;
decDir = m_heading - headingToTarget;

View file

@ -88,6 +88,7 @@ void CNpcRisingBridgePlatform::setWaypoints( sThingPlatform *ThisPlatform )
ASSERT( trigger );
trigger->init();
trigger->setThingSubType(0);
trigger->setPositionAndSize( newXPos << 4, newYPos << 4, 100, 0 );
//trigger->setTargetBox(TriggerList->TargetPos.X<<4,TriggerList->TargetPos.Y<<4,TriggerList->TargetSize.X<<4,TriggerList->TargetSize.Y<<4);
trigger->setPlatform( this );
@ -100,7 +101,7 @@ void CNpcRisingBridgePlatform::processMovement( int _frames )
if ( m_triggered )
{
m_triggered = false;
m_extension += ( m_data[m_type].speed * _frames ) << 8;
m_extension += ( m_dataPtr->speed * _frames ) << 8;
if ( m_extension > m_maxExtension )
{
m_extension = m_maxExtension;

View file

@ -107,7 +107,7 @@ void CPlayerModeBubbleMixture::think()
CNpcPlayerBubblePlatform *bubble;
DVECTOR pos;
bubble=new ("bubble platform") CNpcPlayerBubblePlatform;
bubble->setType( CNpcPlatform::NPC_PLAYER_BUBBLE_PLATFORM );
bubble->setThingSubType( CNpcPlatform::NPC_PLAYER_BUBBLE_PLATFORM );
bubble->setGraphic( (u8) 0 );
bubble->setTiltable( false );
pos=m_player->getPos();

View file

@ -57,6 +57,7 @@ void CProjectile::init()
m_spriteFrame = FRM__SPIKE;
setThingSubType(0);
m_initHeading = m_heading = 0;
m_lifetime = GameState::getOneSecondInFrames() * 2;
m_movementType = PROJECTILE_DUMBFIRE;
@ -400,7 +401,7 @@ void CProjectile::collidedWith(CThing *_thisThing)
void CPlayerProjectile::init()
{
CPlayerProjectileThing::init();
setThingSubType(0);
m_heading = 0;
m_lifetime = GameState::getOneSecondInFrames() * 2;
m_movementType = PLAYER_PROJECTILE_DUMBFIRE;

View file

@ -244,7 +244,7 @@ void CThingManager::matchPressureSwitches()
while( hazard )
{
if ( hazard->getType() == CNpcHazard::NPC_PRESSURE_SWITCH_HAZARD )
if ( hazard->getThingSubType() == CNpcHazard::NPC_PRESSURE_SWITCH_HAZARD )
{
CNpcPressureSwitchHazard *switchHazard = (CNpcPressureSwitchHazard *) hazard;
@ -256,7 +256,7 @@ void CThingManager::matchPressureSwitches()
while( platform )
{
if ( platform->getType() == CNpcPlatform::NPC_TRAPDOOR_PLATFORM )
if ( platform->getThingSubType() == CNpcPlatform::NPC_TRAPDOOR_PLATFORM )
{
CNpcTrapdoorPlatform *trapdoor = (CNpcTrapdoorPlatform *) platform;
@ -292,7 +292,7 @@ void CThingManager::matchWheelsAndWeights()
while( hazard1 )
{
if ( hazard1->getType() == CNpcHazard::NPC_RISING_WEIGHT_HAZARD )
if ( hazard1->getThingSubType() == CNpcHazard::NPC_RISING_WEIGHT_HAZARD )
{
CNpcRisingWeightHazard *weight = (CNpcRisingWeightHazard *) hazard1;
DVECTOR wheelPos = weight->getWheelPos();
@ -301,7 +301,7 @@ void CThingManager::matchWheelsAndWeights()
while( hazard2 )
{
if ( hazard2->getType() == CNpcHazard::NPC_RISING_WEIGHT_WHEEL_HAZARD )
if ( hazard2->getThingSubType() == CNpcHazard::NPC_RISING_WEIGHT_WHEEL_HAZARD )
{
CNpcRisingWeightWheelHazard *wheel = (CNpcRisingWeightWheelHazard *) hazard2;
@ -860,8 +860,7 @@ int SubType=Thing->getThingSubType();
CThing **List=s_FreeList[Type];
// Check its been aquired/set correctly
// Temp workaround
ASSERT(SubType!=1234);
// ASSERT(SubType!=1234);
if (SubType!=1234)
{
Thing->NextFreeThing=List[SubType];
@ -870,7 +869,8 @@ CThing **List=s_FreeList[Type];
}
else
{
// delete Thing;
printf("%i %i\n",Type,SubType);
ASSERT(!"Thing not Setup Correctly");
Thing->NextFreeThing=DuffList;
DuffList=Thing;
DuffListCount++;