From 7a43d05c5f0cb13b57633bc506e8ba06d2b5f5ee Mon Sep 17 00:00:00 2001 From: Daveo Date: Wed, 15 Aug 2001 15:05:44 +0000 Subject: [PATCH] --- source/enemy/nbuttfly.cpp | 7 ------- source/enemy/nbuttfly.h | 2 ++ source/enemy/nsjback.cpp | 8 -------- source/enemy/nsjback.h | 2 ++ source/level/layercollision.h | 4 ++-- source/level/level.cpp | 6 +++--- source/player/player.cpp | 3 ++- source/thing/thing.cpp | 2 +- source/thing/thing.h | 4 +++- 9 files changed, 15 insertions(+), 23 deletions(-) diff --git a/source/enemy/nbuttfly.cpp b/source/enemy/nbuttfly.cpp index 1d6b5e828..63858c199 100644 --- a/source/enemy/nbuttfly.cpp +++ b/source/enemy/nbuttfly.cpp @@ -35,13 +35,6 @@ void CNpcButterflyBackgroundEnemy::processMovementModifier(int _frames, s32 dist m_animPlaying = true; m_frame = 0; } - - CLevel &level = GameScene.GetLevel(); - if ( Pos.vx < 0 || Pos.vx > ( level.getCollisionLayer()->getMapWidth() << 4 ) || - Pos.vy < 0 || Pos.vy > ( level.getCollisionLayer()->getMapHeight() << 4 ) ) - { - setToShutdown(); - } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/enemy/nbuttfly.h b/source/enemy/nbuttfly.h index 271da19d7..ce2397c0c 100644 --- a/source/enemy/nbuttfly.h +++ b/source/enemy/nbuttfly.h @@ -28,6 +28,8 @@ public: void render(); int getFrameCount() {return( FRM_BUTTERFLY_FLAP04 - FRM_BUTTERFLY_FLAP01 + 1 );} u8 canBeCaughtByNet() {return( false );} + bool allowOffMap() {return(true);} + protected: void processMovementModifier( int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange ); }; diff --git a/source/enemy/nsjback.cpp b/source/enemy/nsjback.cpp index 86a05a42a..052dae89c 100644 --- a/source/enemy/nsjback.cpp +++ b/source/enemy/nsjback.cpp @@ -162,14 +162,6 @@ void CNpcSmallJellyfishBackgroundEnemy::processMovement( int _frames ) }*/ processMovementModifier( _frames, moveX, moveY, moveVel, moveDist ); - - CLevel &level = GameScene.GetLevel(); - DVECTOR const &MapSize=level.getMapSize16(); - if ( Pos.vx < 0 || Pos.vx >= MapSize.vx || - Pos.vy < 0 || Pos.vy >= MapSize.vy ) - { - setToShutdown(); - } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/enemy/nsjback.h b/source/enemy/nsjback.h index ef453dede..da92cb1b7 100644 --- a/source/enemy/nsjback.h +++ b/source/enemy/nsjback.h @@ -26,6 +26,8 @@ public: void shutdown(); void setTargetHeading( s16 newTargetHeading ) {m_targetHeading = newTargetHeading;} u8 hasBeenAttacked(); + bool allowOffMap() {return(true);} + protected: bool processSensor(); void processMovement( int _frames ); diff --git a/source/level/layercollision.h b/source/level/layercollision.h index dd1348bae..93a3f2ba3 100644 --- a/source/level/layercollision.h +++ b/source/level/layercollision.h @@ -65,8 +65,8 @@ inline u8 Get(int X,int Y) void render(DVECTOR &MapPos); #endif - int getMapWidth() {return(MapWidth);} - int getMapHeight() {return(MapHeight);} +// int getMapWidth() {return(MapWidth);} +// int getMapHeight() {return(MapHeight);} protected: sLayerHdr *LayerHdr; diff --git a/source/level/level.cpp b/source/level/level.cpp index f408903c9..00efde057 100644 --- a/source/level/level.cpp +++ b/source/level/level.cpp @@ -792,7 +792,7 @@ DVECTOR DP; // Note: relies on tiles not being top or bottom of map tho!! void CLevel::destroyMapTile(DVECTOR const &Pos) { -int Width=CollisionLayer->getMapWidth(); +int Width=getMapWidth(); DVECTOR MP=Pos; const int ColT=COLLISION_TYPE_DESTRUCTABLE_FLOOR; @@ -855,8 +855,8 @@ DVECTOR DP; /*****************************************************************************/ void CLevel::CreateTileStore() { -int MapW=CollisionLayer->getMapWidth(); -int MapH=CollisionLayer->getMapHeight(); +int MapW=getMapWidth(); +int MapH=getMapHeight(); int X,Y; m_TileStoreCount=0; diff --git a/source/player/player.cpp b/source/player/player.cpp index d14d1953f..f72ae0b7d 100644 --- a/source/player/player.cpp +++ b/source/player/player.cpp @@ -719,6 +719,7 @@ if(PadGetDown(0)&PAD_R1) #endif +#ifdef _STATE_DEBUG_ if(PadGetDown(0)&PAD_L1&&m_currentMode!=PLAYER_MODE_DEAD) { oldmode=m_currentMode; @@ -729,7 +730,7 @@ else if(oldmode!=-1&&!(PadGetHeld(0)&PAD_L1)) newmode=oldmode; oldmode=-1; } - +#endif if(newmode!=-1) { setMode((PLAYER_MODE)newmode); diff --git a/source/thing/thing.cpp b/source/thing/thing.cpp index fd217b105..3498ff4d7 100644 --- a/source/thing/thing.cpp +++ b/source/thing/thing.cpp @@ -461,7 +461,7 @@ DVECTOR const &MapSize=Lvl.getMapSize16(); DVECTOR const &ThingPos=thing->getPos(); // Will speed this up - doubt it, not now!! - if (i!=CThing::TYPE_PLAYER && (ThingPos.vx<0 || ThingPos.vx>=MapSize.vx || ThingPos.vy<0 || ThingPos.vy>=MapSize.vy)) + if (!thing->allowOffMap() && (ThingPos.vx<0 || ThingPos.vx>=MapSize.vx || ThingPos.vy<0 || ThingPos.vy>=MapSize.vy)) { thing->setToShutdown(); SYSTEM_DBGMSG("ThingOffMap: T:%i S:%i TXY%i %i, MWH%i %i\n",(int)thing->getThingType(),(int)thing->getThingSubType(),ThingPos.vx,ThingPos.vy,MapSize.vx,MapSize.vy); diff --git a/source/thing/thing.h b/source/thing/thing.h index db1791846..f11c20ffe 100644 --- a/source/thing/thing.h +++ b/source/thing/thing.h @@ -198,7 +198,8 @@ virtual void leftThinkZone(int _frames) {} CRECT const &getCollisionArea() {return m_collisionArea;} DVECTOR const &getCollisionSize() {return m_collisionSize;} -virtual int canCollide() {return true;} +virtual int canCollide() {return (true);} +virtual bool allowOffMap() {return (false);} virtual int checkCollisionAgainst(CThing *_thisThing, int _frames); int checkCollisionAgainstArea(CRECT *_rect); void updateCollisionArea(); @@ -254,6 +255,7 @@ public: }; virtual TYPE getThingType() {return TYPE_PLAYER;} virtual bool alwaysThink() {return(true);} +bool allowOffMap() {return(true);} };