diff --git a/Graphics/levels/Chapter06/Level01/Level01.MEX b/Graphics/levels/Chapter06/Level01/Level01.MEX index 4afb752c6..26ff8d761 100644 Binary files a/Graphics/levels/Chapter06/Level01/Level01.MEX and b/Graphics/levels/Chapter06/Level01/Level01.MEX differ diff --git a/Graphics/levels/Chapter06/Level01/level01.Mep b/Graphics/levels/Chapter06/Level01/level01.Mep index 2c4056380..9586e08f1 100644 Binary files a/Graphics/levels/Chapter06/Level01/level01.Mep and b/Graphics/levels/Chapter06/Level01/level01.Mep differ diff --git a/source/friend/fgary.cpp b/source/friend/fgary.cpp index 9f66c70c0..034a3688e 100644 --- a/source/friend/fgary.cpp +++ b/source/friend/fgary.cpp @@ -161,7 +161,7 @@ void CNpcGaryFriend::think( int _frames ) case COLLISION_TYPE_FLAG_MOVE_LEFT: { conveyorOverride = true; - Pos.vx--; + Pos.vx -= 4; break; } @@ -169,7 +169,7 @@ void CNpcGaryFriend::think( int _frames ) case COLLISION_TYPE_FLAG_MOVE_RIGHT: { conveyorOverride = true; - Pos.vx++; + Pos.vx += 4; break; } diff --git a/source/gfx/animtex.cpp b/source/gfx/animtex.cpp index a05f6473c..c59c0b0c4 100644 --- a/source/gfx/animtex.cpp +++ b/source/gfx/animtex.cpp @@ -76,7 +76,7 @@ CAnimTex *ThisTex=new ("CAnimTex::AddAnimTex") CAnimTex; ThisTex->Rect.w=W; ThisTex->Rect.h=H; ThisTex->TexData=0; - ThisTex->Count=0; ThisTex->Speed=-1; + ThisTex->Count=0; ThisTex->Speed=-4; ThisTex->TPage=Frame->TPage; ThisTex->TexName=Filename; @@ -152,23 +152,23 @@ int Time = GameState::getFramesSinceLast(); } /*****************************************************************************/ -void CAnimTex::SetSpeed(FileEquate TexName,int Frm,int Speed) +int CAnimTex::GetSpeed() { CAnimTex *ThisTex; ThisTex=AnimTexList; - while(ThisTex) - { - if (ThisTex->TexName==TexName && ThisTex->FrameNo==Frm) - { - ThisTex->Speed=Speed; - return; - } - ThisTex=ThisTex->NextTex; - } - ASSERT(!"CAnimTex::SetSpeed - Frame not Found"); + return(ThisTex->Speed); +} +/*****************************************************************************/ +void CAnimTex::SetSpeed(int Speed) +{ +CAnimTex *ThisTex; + + ThisTex=AnimTexList; + + ThisTex->Speed=Speed; } /*****************************************************************************/ diff --git a/source/gfx/animtex.h b/source/gfx/animtex.h index 7797f0cc8..30770b2c0 100644 --- a/source/gfx/animtex.h +++ b/source/gfx/animtex.h @@ -19,7 +19,8 @@ static void AddAnimTex(sFrameHdr *Frame,int Frame,FileEquate Filename); static void AnimateTex(); static void GetTexData(); static void DumpThisTPage(FileEquate TexName); -static void SetSpeed(FileEquate Filename,int Frm,int Speed); +static void SetSpeed(int Speed); +static int GetSpeed(); private: CAnimTex *NextTex; diff --git a/source/hazard/hcswitch.cpp b/source/hazard/hcswitch.cpp index 714dab93b..f2a07d783 100644 --- a/source/hazard/hcswitch.cpp +++ b/source/hazard/hcswitch.cpp @@ -27,6 +27,10 @@ #include "game\game.h" #endif +#ifndef _ANIMTEX_HEADER_ +#include "gfx\animtex.h" +#endif + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -98,23 +102,6 @@ void CNpcConveyorSwitchHazard::setWaypoints( sThingHazard *ThisHazard ) trigger=(CHazardTrigger*)CTrigger::Create(CTrigger::TRIGGER_HAZARD); trigger->setPositionAndSize( ( newXPos << 4 ) + 8 - 50, ( newYPos << 4 ) + 16, 100, 0 ); trigger->setHazard( this ); - - newXPos = (u16) *PntList; - PntList++; - newYPos = (u16) *PntList; - PntList++; - m_conveyorPos.vx = ( newXPos << 4 ) + 8; - m_conveyorPos.vy = ( newYPos << 4 ) + 8; - - s32 minX, maxX, minY, maxY; - - m_npcPath.getPathXExtents( &minX, &maxX ); - m_npcPath.getPathYExtents( &minY, &maxY ); - - m_thinkArea.x1 = minX; - m_thinkArea.x2 = maxX; - m_thinkArea.y1 = minY; - m_thinkArea.y2 = maxY; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -124,5 +111,7 @@ void CNpcConveyorSwitchHazard::trigger() m_reversed = !m_reversed; CLevel &level = GameScene.GetLevel(); - level.reverseMapConveyor( m_conveyorPos ); + level.reverseMapConveyor(); + + CAnimTex::SetSpeed( -CAnimTex::GetSpeed() ); } \ No newline at end of file diff --git a/source/hazard/hcswitch.h b/source/hazard/hcswitch.h index 3bd32a6aa..8575f0090 100644 --- a/source/hazard/hcswitch.h +++ b/source/hazard/hcswitch.h @@ -25,11 +25,11 @@ public: void init(); void render(); void trigger(); + CRECT const *getThinkBBox() {return( CThing::getThinkBBox() );} protected: void collidedWith(CThing *_thisThing) {} u8 m_reversed; - DVECTOR m_conveyorPos; }; #endif \ No newline at end of file diff --git a/source/level/level.cpp b/source/level/level.cpp index d3a035774..8d2ab22c7 100644 --- a/source/level/level.cpp +++ b/source/level/level.cpp @@ -739,50 +739,29 @@ sTileMapElem *MapElem=TileLayers[CLayerTile::LAYER_TILE_TYPE_ACTION]->getMapPtr( /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ -void CLevel::reverseMapConveyor(DVECTOR const &Pos) +void CLevel::reverseMapConveyor() { -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 size = getMapSize(); +int ColT; DVECTOR DP; - for (DP.vy=TL.vy; DP.vy<=BR.vy; DP.vy+=16) + for (DP.vy=0; DP.vy<=(size.vy<<4); DP.vy+=16) { - for (DP.vx=TL.vx; DP.vx<=BR.vx; DP.vx+=16) + for (DP.vx=0; DP.vx<=(size.vx<<4); DP.vx+=16) { u8 *ColElem=CollisionLayer->getMapPtr(DP.vx,DP.vy); - if (*ColElem>>COLLISION_TYPE_FLAG_SHIFT==ColT) + if ( (*ColElem)>>COLLISION_TYPE_FLAG_SHIFT == COLLISION_TYPE_MOVE_LEFT ) { - 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; - } + *ColElem &= ~COLLISION_TYPE_FLAG_MOVE_LEFT; + *ColElem |= COLLISION_TYPE_FLAG_MOVE_RIGHT; + } + else if ( (*ColElem)>>COLLISION_TYPE_FLAG_SHIFT == COLLISION_TYPE_MOVE_RIGHT ) + { + *ColElem &= ~COLLISION_TYPE_FLAG_MOVE_RIGHT; + *ColElem |= COLLISION_TYPE_FLAG_MOVE_LEFT; } - } } } diff --git a/source/level/level.h b/source/level/level.h index 0bda90ecd..5129b4c4c 100644 --- a/source/level/level.h +++ b/source/level/level.h @@ -54,7 +54,7 @@ static CFmaScene::FMA_SCRIPT_NUMBER getFMAToFollow() {return LvlTable[s_glo void destroyMapArea(DVECTOR const &Pos); void destroyMapTile(DVECTOR const &Pos); - void reverseMapConveyor(DVECTOR const &Pos); + void reverseMapConveyor(); int getActorCount() {return ActorCount;} sThingActor **getActorList() {return ActorList;} diff --git a/source/platform/pconveyr.cpp b/source/platform/pconveyr.cpp index 54d418f1d..857fb98ee 100644 --- a/source/platform/pconveyr.cpp +++ b/source/platform/pconveyr.cpp @@ -145,13 +145,13 @@ void CNpcConveyorPlatform::processMovement( int _frames ) { moveX = distX; - if ( moveX > 1 ) + if ( moveX > 4 ) { - moveX = 1; + moveX = 4; } - else if ( moveX < -1 ) + else if ( moveX < -4 ) { - moveX = -1; + moveX = -4; } } else