This commit is contained in:
parent
0b65d9d4a7
commit
c110d56dc5
15 changed files with 403 additions and 536 deletions
|
@ -241,29 +241,18 @@ void CNpcFriend::render()
|
||||||
CNpcThing::render();
|
CNpcThing::render();
|
||||||
|
|
||||||
// Render
|
// Render
|
||||||
DVECTOR renderPos;
|
|
||||||
DVECTOR offset = CLevel::getCameraPos();
|
|
||||||
|
|
||||||
renderPos.vx = Pos.vx - offset.vx;
|
if (canRender())
|
||||||
renderPos.vy = Pos.vy - offset.vy;
|
|
||||||
|
|
||||||
CRECT collisionRect = getCollisionArea();
|
|
||||||
collisionRect.x1 -= Pos.vx;
|
|
||||||
collisionRect.x2 -= Pos.vx;
|
|
||||||
collisionRect.y1 -= Pos.vy;
|
|
||||||
collisionRect.y2 -= Pos.vy;
|
|
||||||
|
|
||||||
if ( renderPos.vx + collisionRect.x2 >= 0 && renderPos.vx + collisionRect.x1 <= VidGetScrW() )
|
|
||||||
{
|
|
||||||
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() )
|
|
||||||
{
|
{
|
||||||
|
DVECTOR &renderPos=getRenderPos();
|
||||||
|
|
||||||
m_actorGfx->Render(renderPos,m_animNo,(m_frame>>8),m_reversed);
|
m_actorGfx->Render(renderPos,m_animNo,(m_frame>>8),m_reversed);
|
||||||
|
|
||||||
sBBox boundingBox = m_actorGfx->GetBBox();
|
sBBox boundingBox = m_actorGfx->GetBBox();
|
||||||
setCollisionSize( ( boundingBox.XMax - boundingBox.XMin ), ( boundingBox.YMax - boundingBox.YMin ) );
|
setCollisionSize( ( boundingBox.XMax - boundingBox.XMin ), ( boundingBox.YMax - boundingBox.YMin ) );
|
||||||
setCollisionCentreOffset( ( boundingBox.XMax + boundingBox.XMin ) >> 1, ( boundingBox.YMax + boundingBox.YMin ) >> 1 );
|
setCollisionCentreOffset( ( boundingBox.XMax + boundingBox.XMin ) >> 1, ( boundingBox.YMax + boundingBox.YMin ) >> 1 );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -119,7 +119,7 @@ s16 *dH=HeightTable;
|
||||||
_MapOfs.vx+=LX;
|
_MapOfs.vx+=LX;
|
||||||
_MapOfs.vy+=LY;
|
_MapOfs.vy+=LY;
|
||||||
|
|
||||||
if (!Parent->getOnScreenFlag()) return;
|
if (!Parent->canRender()) return;
|
||||||
MapOfs.vx=_MapOfs.vx+XOfs;
|
MapOfs.vx=_MapOfs.vx+XOfs;
|
||||||
|
|
||||||
for (int L=0; L<Width; L++)
|
for (int L=0; L<Width; L++)
|
||||||
|
|
|
@ -32,8 +32,8 @@ public:
|
||||||
void think(int _frames);
|
void think(int _frames);
|
||||||
|
|
||||||
void setCameraCentre(DVECTOR _pos) {MapPos=_pos;}
|
void setCameraCentre(DVECTOR _pos) {MapPos=_pos;}
|
||||||
static DVECTOR getCameraPos() {return MapPos;}
|
static DVECTOR const &getCameraPos() {return MapPos;}
|
||||||
static DVECTOR getPlayerSpawnPos() {return s_playerSpawnPos;}
|
static DVECTOR const &getPlayerSpawnPos() {return s_playerSpawnPos;}
|
||||||
|
|
||||||
static int getCurrentChapter();
|
static int getCurrentChapter();
|
||||||
static int getCurrentChapterLevel();
|
static int getCurrentChapterLevel();
|
||||||
|
|
|
@ -230,23 +230,9 @@ void CNpcBranchPlatform::render()
|
||||||
{
|
{
|
||||||
CPlatformThing::render();
|
CPlatformThing::render();
|
||||||
|
|
||||||
// Render
|
if (canRender())
|
||||||
DVECTOR renderPos;
|
|
||||||
DVECTOR offset = CLevel::getCameraPos();
|
|
||||||
|
|
||||||
renderPos.vx = Pos.vx - offset.vx ;
|
|
||||||
renderPos.vy = Pos.vy - offset.vy ;
|
|
||||||
|
|
||||||
CRECT collisionRect = getCollisionArea();
|
|
||||||
collisionRect.x1 -= Pos.vx;
|
|
||||||
collisionRect.x2 -= Pos.vx;
|
|
||||||
collisionRect.y1 -= Pos.vy;
|
|
||||||
collisionRect.y2 -= Pos.vy;
|
|
||||||
|
|
||||||
if ( renderPos.vx + collisionRect.x2 >= 0 && renderPos.vx + collisionRect.x1 <= VidGetScrW() )
|
|
||||||
{
|
|
||||||
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() )
|
|
||||||
{
|
{
|
||||||
|
DVECTOR &renderPos=getRenderPos();
|
||||||
SVECTOR rotation;
|
SVECTOR rotation;
|
||||||
rotation.vx = 0;
|
rotation.vx = 0;
|
||||||
if ( m_reversed )
|
if ( m_reversed )
|
||||||
|
@ -306,7 +292,7 @@ void CNpcBranchPlatform::render()
|
||||||
|
|
||||||
DrawLine(x1,y1,x2,y2,0,255,0,0);
|
DrawLine(x1,y1,x2,y2,0,255,0,0);
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,24 +150,11 @@ void CNpcCartPlatform::render()
|
||||||
{
|
{
|
||||||
CPlatformThing::render();
|
CPlatformThing::render();
|
||||||
|
|
||||||
// Render
|
if (canRender())
|
||||||
DVECTOR renderPos;
|
|
||||||
DVECTOR offset = CLevel::getCameraPos();
|
|
||||||
|
|
||||||
renderPos.vx = Pos.vx - offset.vx ;
|
|
||||||
renderPos.vy = Pos.vy - offset.vy ;
|
|
||||||
|
|
||||||
CRECT collisionRect = getCollisionArea();
|
|
||||||
collisionRect.x1 -= Pos.vx;
|
|
||||||
collisionRect.x2 -= Pos.vx;
|
|
||||||
collisionRect.y1 -= Pos.vy;
|
|
||||||
collisionRect.y2 -= Pos.vy;
|
|
||||||
|
|
||||||
if ( renderPos.vx + collisionRect.x2 >= 0 && renderPos.vx + collisionRect.x1 <= VidGetScrW() )
|
|
||||||
{
|
|
||||||
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() )
|
|
||||||
{
|
{
|
||||||
|
DVECTOR &renderPos=getRenderPos();
|
||||||
SVECTOR rotation;
|
SVECTOR rotation;
|
||||||
|
|
||||||
rotation.vx = 0;
|
rotation.vx = 0;
|
||||||
rotation.vy = 0;
|
rotation.vy = 0;
|
||||||
rotation.vz = getCollisionAngle();
|
rotation.vz = getCollisionAngle();
|
||||||
|
@ -203,7 +190,7 @@ void CNpcCartPlatform::render()
|
||||||
|
|
||||||
DrawLine(x1,y1,x2,y2,0,255,0,0);
|
DrawLine(x1,y1,x2,y2,0,255,0,0);
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -205,34 +205,15 @@ void CNpcDualPlatform::render()
|
||||||
{
|
{
|
||||||
int x1,y1,x2,y2;
|
int x1,y1,x2,y2;
|
||||||
|
|
||||||
setOnScreenFlag(false);
|
|
||||||
if ( m_isActive )
|
if ( m_isActive )
|
||||||
{
|
{
|
||||||
CPlatformThing::render();
|
CPlatformThing::render();
|
||||||
|
|
||||||
// Render
|
if (canRender())
|
||||||
DVECTOR renderPos;
|
|
||||||
DVECTOR offset = CLevel::getCameraPos();
|
|
||||||
|
|
||||||
renderPos.vx = Pos.vx - offset.vx;
|
|
||||||
renderPos.vy = Pos.vy - offset.vy;
|
|
||||||
|
|
||||||
CRECT collisionRect = getCollisionArea();
|
|
||||||
collisionRect.x1 -= Pos.vx;
|
|
||||||
collisionRect.x2 -= Pos.vx;
|
|
||||||
collisionRect.y1 -= Pos.vy;
|
|
||||||
collisionRect.y2 -= Pos.vy;
|
|
||||||
|
|
||||||
if ( renderPos.vx + collisionRect.x2 >= 0 && renderPos.vx + collisionRect.x1 <= VidGetScrW() )
|
|
||||||
{
|
{
|
||||||
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() )
|
DVECTOR &renderPos=getRenderPos();
|
||||||
{
|
|
||||||
setOnScreenFlag(true);
|
|
||||||
m_modelGfx->Render(renderPos);
|
m_modelGfx->Render(renderPos);
|
||||||
// POLY_F4 *F4=GetPrimF4();
|
|
||||||
// setXYWH(F4,renderPos.vx-32,renderPos.vy-32,64,16);
|
|
||||||
// setRGB0(F4,127,127,64);
|
|
||||||
// AddPrimToList(F4,2);
|
|
||||||
|
|
||||||
#if defined (__USER_paul__) || defined (__USER_charles__)
|
#if defined (__USER_paul__) || defined (__USER_charles__)
|
||||||
DVECTOR size;
|
DVECTOR size;
|
||||||
|
@ -257,9 +238,7 @@ void CNpcDualPlatform::render()
|
||||||
|
|
||||||
DrawLine(x1,y1,x2,y2,0,255,0,0);
|
DrawLine(x1,y1,x2,y2,0,255,0,0);
|
||||||
#endif
|
#endif
|
||||||
}
|
/*
|
||||||
}
|
|
||||||
|
|
||||||
x1 = Pos.vx - offset.vx;
|
x1 = Pos.vx - offset.vx;
|
||||||
x2 = m_lineBase.vx - offset.vx;
|
x2 = m_lineBase.vx - offset.vx;
|
||||||
|
|
||||||
|
@ -339,6 +318,7 @@ void CNpcDualPlatform::render()
|
||||||
DrawLine( x1, y1, x2, y2, 0, 0, 0, 0 );
|
DrawLine( x1, y1, x2, y2, 0, 0, 0, 0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,34 +77,14 @@ void CNpcFishHookPlatform::render()
|
||||||
{
|
{
|
||||||
int x1,y1,x2,y2;
|
int x1,y1,x2,y2;
|
||||||
|
|
||||||
setOnScreenFlag(false);
|
|
||||||
if ( m_isActive )
|
if ( m_isActive )
|
||||||
{
|
{
|
||||||
CPlatformThing::render();
|
CPlatformThing::render();
|
||||||
|
|
||||||
// Render
|
DVECTOR &renderPos=getRenderPos();
|
||||||
DVECTOR renderPos;
|
if (canRender())
|
||||||
DVECTOR offset = CLevel::getCameraPos();
|
|
||||||
|
|
||||||
renderPos.vx = Pos.vx - offset.vx;
|
|
||||||
renderPos.vy = Pos.vy - offset.vy;
|
|
||||||
|
|
||||||
CRECT collisionRect = getCollisionArea();
|
|
||||||
collisionRect.x1 -= Pos.vx;
|
|
||||||
collisionRect.x2 -= Pos.vx;
|
|
||||||
collisionRect.y1 -= Pos.vy;
|
|
||||||
collisionRect.y2 -= Pos.vy;
|
|
||||||
|
|
||||||
if ( renderPos.vx + collisionRect.x2 >= 0 && renderPos.vx + collisionRect.x1 <= VidGetScrW() )
|
|
||||||
{
|
{
|
||||||
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() )
|
|
||||||
{
|
|
||||||
setOnScreenFlag(true);
|
|
||||||
m_modelGfx->Render(renderPos);
|
m_modelGfx->Render(renderPos);
|
||||||
// POLY_F4 *F4=GetPrimF4();
|
|
||||||
// setXYWH(F4,renderPos.vx-32,renderPos.vy-32,64,16);
|
|
||||||
// setRGB0(F4,127,127,64);
|
|
||||||
// AddPrimToList(F4,2);
|
|
||||||
|
|
||||||
#if defined (__USER_paul__) || defined (__USER_charles__)
|
#if defined (__USER_paul__) || defined (__USER_charles__)
|
||||||
DVECTOR size;
|
DVECTOR size;
|
||||||
|
@ -129,11 +109,16 @@ void CNpcFishHookPlatform::render()
|
||||||
|
|
||||||
DrawLine(x1,y1,x2,y2,0,255,0,0);
|
DrawLine(x1,y1,x2,y2,0,255,0,0);
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
x1 = Pos.vx - offset.vx;
|
|
||||||
x2 = m_lineBase.vx - offset.vx;
|
}
|
||||||
|
// draw Line (Literally!!)
|
||||||
|
if (renderPos.vx>0 && renderPos.vx<512)
|
||||||
|
{
|
||||||
|
DVECTOR const &CamPos=CLevel::getCameraPos();
|
||||||
|
|
||||||
|
x1 = renderPos.vx;
|
||||||
|
x2 = m_lineBase.vx - CamPos.vx;
|
||||||
|
|
||||||
if ( x1 > x2 )
|
if ( x1 > x2 )
|
||||||
{
|
{
|
||||||
|
@ -142,8 +127,8 @@ void CNpcFishHookPlatform::render()
|
||||||
x2 = tempX;
|
x2 = tempX;
|
||||||
}
|
}
|
||||||
|
|
||||||
y1 = Pos.vy - offset.vy;
|
y1 = renderPos.vy;
|
||||||
y2 = m_lineBase.vy - offset.vy;
|
y2 = m_lineBase.vy - CamPos.vy;
|
||||||
|
|
||||||
if ( y1 > y2 )
|
if ( y1 > y2 )
|
||||||
{
|
{
|
||||||
|
@ -161,13 +146,8 @@ void CNpcFishHookPlatform::render()
|
||||||
{
|
{
|
||||||
y2 = VidGetScrH();
|
y2 = VidGetScrH();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( x2 >= 0 && x1 <= VidGetScrW() )
|
|
||||||
{
|
|
||||||
if ( y2 >= 0 && y1 <= VidGetScrH() )
|
|
||||||
{
|
|
||||||
DrawLine( x1, y1, x2, y2, 0, 0, 0, 0 );
|
DrawLine( x1, y1, x2, y2, 0, 0, 0, 0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,60 +30,3 @@
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void CNpcJellyfishPlatform::render()
|
|
||||||
{
|
|
||||||
if ( m_isActive )
|
|
||||||
{
|
|
||||||
CPlatformThing::render();
|
|
||||||
|
|
||||||
// Render
|
|
||||||
DVECTOR renderPos;
|
|
||||||
DVECTOR offset = CLevel::getCameraPos();
|
|
||||||
|
|
||||||
renderPos.vx = Pos.vx - offset.vx;
|
|
||||||
renderPos.vy = Pos.vy - offset.vy;
|
|
||||||
|
|
||||||
CRECT collisionRect = getCollisionArea();
|
|
||||||
collisionRect.x1 -= Pos.vx;
|
|
||||||
collisionRect.x2 -= Pos.vx;
|
|
||||||
collisionRect.y1 -= Pos.vy;
|
|
||||||
collisionRect.y2 -= Pos.vy;
|
|
||||||
|
|
||||||
if ( renderPos.vx + collisionRect.x2 >= 0 && renderPos.vx + collisionRect.x1 <= VidGetScrW() )
|
|
||||||
{
|
|
||||||
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() )
|
|
||||||
{
|
|
||||||
m_modelGfx->Render(renderPos);
|
|
||||||
// POLY_F4 *F4=GetPrimF4();
|
|
||||||
// setXYWH(F4,renderPos.vx-32,renderPos.vy-32,64,16);
|
|
||||||
// setRGB0(F4,127,127,64);
|
|
||||||
// AddPrimToList(F4,2);
|
|
||||||
|
|
||||||
#if defined (__USER_paul__) || defined (__USER_charles__)
|
|
||||||
DVECTOR size;
|
|
||||||
DVECTOR centre;
|
|
||||||
int halfLength;
|
|
||||||
int x1,y1,x2,y2;
|
|
||||||
|
|
||||||
centre=getCollisionCentre();
|
|
||||||
size=getCollisionSize();
|
|
||||||
halfLength=size.vx>>1;
|
|
||||||
|
|
||||||
x1=-halfLength*mcos(getCollisionAngle()&4095)>>12;
|
|
||||||
y1=-halfLength*msin(getCollisionAngle()&4095)>>12;
|
|
||||||
x2=+halfLength*mcos(getCollisionAngle()&4095)>>12;
|
|
||||||
y2=+halfLength*msin(getCollisionAngle()&4095)>>12;
|
|
||||||
|
|
||||||
centre.vx-=offset.vx;
|
|
||||||
centre.vy-=offset.vy;
|
|
||||||
x1+=centre.vx;
|
|
||||||
y1+=centre.vy;
|
|
||||||
x2+=centre.vx;
|
|
||||||
y2+=centre.vy;
|
|
||||||
|
|
||||||
DrawLine(x1,y1,x2,y2,0,255,0,0);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
class CNpcJellyfishPlatform : public CNpcPlatform
|
class CNpcJellyfishPlatform : public CNpcPlatform
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void render();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -884,34 +884,17 @@ void CNpcPlatform::processMovement( int _frames )
|
||||||
|
|
||||||
void CNpcPlatform::render()
|
void CNpcPlatform::render()
|
||||||
{
|
{
|
||||||
setOnScreenFlag(false);
|
|
||||||
if ( m_isActive )
|
if ( m_isActive )
|
||||||
{
|
{
|
||||||
CPlatformThing::render();
|
CPlatformThing::render();
|
||||||
|
|
||||||
// Render
|
// Render
|
||||||
DVECTOR renderPos;
|
if (canRender())
|
||||||
DVECTOR offset = CLevel::getCameraPos();
|
|
||||||
|
|
||||||
renderPos.vx = Pos.vx - offset.vx;
|
|
||||||
renderPos.vy = Pos.vy - offset.vy;
|
|
||||||
|
|
||||||
CRECT collisionRect = getCollisionArea();
|
|
||||||
collisionRect.x1 -= Pos.vx;
|
|
||||||
collisionRect.x2 -= Pos.vx;
|
|
||||||
collisionRect.y1 -= Pos.vy;
|
|
||||||
collisionRect.y2 -= Pos.vy;
|
|
||||||
|
|
||||||
if ( renderPos.vx + collisionRect.x2 >= 0 && renderPos.vx + collisionRect.x1 <= VidGetScrW() )
|
|
||||||
{
|
{
|
||||||
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() )
|
DVECTOR &renderPos=getRenderPos();
|
||||||
{
|
|
||||||
setOnScreenFlag(true);
|
|
||||||
m_modelGfx->Render(renderPos);
|
m_modelGfx->Render(renderPos);
|
||||||
// POLY_F4 *F4=GetPrimF4();
|
}
|
||||||
// setXYWH(F4,renderPos.vx-32,renderPos.vy-32,64,16);
|
|
||||||
// setRGB0(F4,127,127,64);
|
|
||||||
// AddPrimToList(F4,2);
|
|
||||||
|
|
||||||
#if defined (__USER_paul__) || defined (__USER_charles__)
|
#if defined (__USER_paul__) || defined (__USER_charles__)
|
||||||
DVECTOR size;
|
DVECTOR size;
|
||||||
|
@ -939,8 +922,6 @@ void CNpcPlatform::render()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
|
@ -126,34 +126,15 @@ void CNpcPendulumPlatform::render()
|
||||||
int x1,y1,x2,y2;
|
int x1,y1,x2,y2;
|
||||||
int x1Boundary,y1Boundary,x2Boundary,y2Boundary;
|
int x1Boundary,y1Boundary,x2Boundary,y2Boundary;
|
||||||
|
|
||||||
setOnScreenFlag(false);
|
|
||||||
if ( m_isActive )
|
if ( m_isActive )
|
||||||
{
|
{
|
||||||
CPlatformThing::render();
|
CPlatformThing::render();
|
||||||
|
|
||||||
// Render
|
if (canRender())
|
||||||
DVECTOR renderPos;
|
|
||||||
DVECTOR offset = CLevel::getCameraPos();
|
|
||||||
|
|
||||||
renderPos.vx = Pos.vx - offset.vx;
|
|
||||||
renderPos.vy = Pos.vy - offset.vy;
|
|
||||||
|
|
||||||
CRECT collisionRect = getCollisionArea();
|
|
||||||
collisionRect.x1 -= Pos.vx;
|
|
||||||
collisionRect.x2 -= Pos.vx;
|
|
||||||
collisionRect.y1 -= Pos.vy;
|
|
||||||
collisionRect.y2 -= Pos.vy;
|
|
||||||
|
|
||||||
if ( renderPos.vx + collisionRect.x2 >= 0 && renderPos.vx + collisionRect.x1 <= VidGetScrW() )
|
|
||||||
{
|
{
|
||||||
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() )
|
DVECTOR &renderPos=getRenderPos();
|
||||||
{
|
|
||||||
setOnScreenFlag(true);
|
|
||||||
m_modelGfx->Render(renderPos);
|
m_modelGfx->Render(renderPos);
|
||||||
// POLY_F4 *F4=GetPrimF4();
|
|
||||||
// setXYWH(F4,renderPos.vx-32,renderPos.vy-32,64,16);
|
|
||||||
// setRGB0(F4,127,127,64);
|
|
||||||
// AddPrimToList(F4,2);
|
|
||||||
|
|
||||||
#if defined (__USER_paul__) || defined (__USER_charles__)
|
#if defined (__USER_paul__) || defined (__USER_charles__)
|
||||||
DVECTOR size;
|
DVECTOR size;
|
||||||
|
@ -178,9 +159,7 @@ void CNpcPendulumPlatform::render()
|
||||||
|
|
||||||
DrawLine(x1,y1,x2,y2,0,255,0,0);
|
DrawLine(x1,y1,x2,y2,0,255,0,0);
|
||||||
#endif
|
#endif
|
||||||
}
|
/*
|
||||||
}
|
|
||||||
|
|
||||||
x1 = x1Boundary = Pos.vx - offset.vx;
|
x1 = x1Boundary = Pos.vx - offset.vx;
|
||||||
x2 = x2Boundary = m_lineBase.vx - offset.vx;
|
x2 = x2Boundary = m_lineBase.vx - offset.vx;
|
||||||
|
|
||||||
|
@ -226,5 +205,7 @@ void CNpcPendulumPlatform::render()
|
||||||
DrawLine( x1, y1, x2, y2, 0, 0, 0, 0 );
|
DrawLine( x1, y1, x2, y2, 0, 0, 0, 0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,23 +107,13 @@ void CNpcRetractingPlatform::render()
|
||||||
CPlatformThing::render();
|
CPlatformThing::render();
|
||||||
|
|
||||||
// Render
|
// Render
|
||||||
DVECTOR renderPos;
|
CPlatformThing::render();
|
||||||
DVECTOR offset = CLevel::getCameraPos();
|
|
||||||
|
|
||||||
renderPos.vx = Pos.vx - offset.vx ;
|
if (canRender())
|
||||||
renderPos.vy = Pos.vy - offset.vy ;
|
|
||||||
|
|
||||||
CRECT collisionRect = getCollisionArea();
|
|
||||||
collisionRect.x1 -= Pos.vx;
|
|
||||||
collisionRect.x2 -= Pos.vx;
|
|
||||||
collisionRect.y1 -= Pos.vy;
|
|
||||||
collisionRect.y2 -= Pos.vy;
|
|
||||||
|
|
||||||
if ( renderPos.vx + collisionRect.x2 >= 0 && renderPos.vx + collisionRect.x1 <= VidGetScrW() )
|
|
||||||
{
|
|
||||||
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() )
|
|
||||||
{
|
{
|
||||||
|
DVECTOR &renderPos=getRenderPos();
|
||||||
SVECTOR rotation;
|
SVECTOR rotation;
|
||||||
|
|
||||||
rotation.vx = 0;
|
rotation.vx = 0;
|
||||||
rotation.vy = 0;
|
rotation.vy = 0;
|
||||||
rotation.vz = 0;
|
rotation.vz = 0;
|
||||||
|
@ -162,4 +152,3 @@ void CNpcRetractingPlatform::render()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -117,24 +117,11 @@ void CNpcSeesawPlatform::render()
|
||||||
{
|
{
|
||||||
CPlatformThing::render();
|
CPlatformThing::render();
|
||||||
|
|
||||||
// Render
|
if (canRender())
|
||||||
DVECTOR renderPos;
|
|
||||||
DVECTOR offset = CLevel::getCameraPos();
|
|
||||||
|
|
||||||
renderPos.vx = Pos.vx - offset.vx;
|
|
||||||
renderPos.vy = Pos.vy - offset.vy;
|
|
||||||
|
|
||||||
CRECT collisionRect = getCollisionArea();
|
|
||||||
collisionRect.x1 -= Pos.vx;
|
|
||||||
collisionRect.x2 -= Pos.vx;
|
|
||||||
collisionRect.y1 -= Pos.vy;
|
|
||||||
collisionRect.y2 -= Pos.vy;
|
|
||||||
|
|
||||||
if ( renderPos.vx + collisionRect.x2 >= 0 && renderPos.vx + collisionRect.x1 <= VidGetScrW() )
|
|
||||||
{
|
|
||||||
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() )
|
|
||||||
{
|
{
|
||||||
|
DVECTOR &renderPos=getRenderPos();
|
||||||
SVECTOR rotation;
|
SVECTOR rotation;
|
||||||
|
|
||||||
rotation.vx = 0;
|
rotation.vx = 0;
|
||||||
rotation.vy = 0;
|
rotation.vy = 0;
|
||||||
rotation.vz = getCollisionAngle();
|
rotation.vz = getCollisionAngle();
|
||||||
|
@ -173,4 +160,3 @@ void CNpcSeesawPlatform::render()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -29,6 +29,8 @@
|
||||||
#include "utils\utils.h"
|
#include "utils\utils.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "level\level.h"
|
||||||
|
|
||||||
|
|
||||||
/* Std Lib
|
/* Std Lib
|
||||||
------- */
|
------- */
|
||||||
|
@ -52,9 +54,13 @@
|
||||||
Vars
|
Vars
|
||||||
---- */
|
---- */
|
||||||
|
|
||||||
CThing *CThingManager::s_thingLists[CThing::MAX_TYPE]={NULL,NULL};
|
CThing *CThingManager::s_thingLists[CThing::MAX_TYPE];//={NULL,NULL};
|
||||||
|
CThing *CThingManager::s_CollisionLists[CThing::MAX_TYPE];
|
||||||
int CThingManager::s_initialised=false;
|
int CThingManager::s_initialised=false;
|
||||||
|
|
||||||
|
sBBox CThingManager::m_RenderBBox;
|
||||||
|
sBBox CThingManager::m_ThinkBBox;
|
||||||
|
|
||||||
/*----------------------------------------------------------------------
|
/*----------------------------------------------------------------------
|
||||||
Function:
|
Function:
|
||||||
Purpose:
|
Purpose:
|
||||||
|
@ -63,13 +69,9 @@ int CThingManager::s_initialised=false;
|
||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
void CThingManager::init()
|
void CThingManager::init()
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
|
|
||||||
ASSERT(!s_initialised);
|
ASSERT(!s_initialised);
|
||||||
for(i=0;i<CThing::MAX_TYPE;i++)
|
initList(s_thingLists);
|
||||||
{
|
initList(s_CollisionLists);
|
||||||
s_thingLists[i]=NULL;
|
|
||||||
}
|
|
||||||
s_initialised=true;
|
s_initialised=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,6 +99,22 @@ void CThingManager::shutdown()
|
||||||
s_initialised=false;
|
s_initialised=false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Function:
|
||||||
|
Purpose:
|
||||||
|
Params:
|
||||||
|
Returns:
|
||||||
|
---------------------------------------------------------------------- */
|
||||||
|
void CThingManager::initList(CThing **List)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for(i=0 ;i<CThing::MAX_TYPE; i++)
|
||||||
|
{
|
||||||
|
List[i]=NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*----------------------------------------------------------------------
|
/*----------------------------------------------------------------------
|
||||||
Function:
|
Function:
|
||||||
Purpose: Kills every CThing except the player
|
Purpose: Kills every CThing except the player
|
||||||
|
@ -142,7 +160,7 @@ void CThingManager::thinkAllThings(int _frames)
|
||||||
{
|
{
|
||||||
thing->think(_frames);
|
thing->think(_frames);
|
||||||
thing->updateCollisionArea();
|
thing->updateCollisionArea();
|
||||||
thing=thing->m_nextThing;
|
thing=thing->m_nextListThing;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,7 +186,7 @@ void CThingManager::thinkAllThings(int _frames)
|
||||||
|
|
||||||
thing1->collidedWith(thing2);
|
thing1->collidedWith(thing2);
|
||||||
}
|
}
|
||||||
thing1=thing1->m_nextThing;
|
thing1=thing1->m_nextListThing;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Player -> Pickup collision
|
// Player -> Pickup collision
|
||||||
|
@ -181,7 +199,7 @@ void CThingManager::thinkAllThings(int _frames)
|
||||||
{
|
{
|
||||||
thing1->collidedWith(thing2);
|
thing1->collidedWith(thing2);
|
||||||
}
|
}
|
||||||
thing1=thing1->m_nextThing;
|
thing1=thing1->m_nextListThing;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Player -> Enemy collision
|
// Player -> Enemy collision
|
||||||
|
@ -194,7 +212,7 @@ void CThingManager::thinkAllThings(int _frames)
|
||||||
{
|
{
|
||||||
thing1->collidedWith(thing2);
|
thing1->collidedWith(thing2);
|
||||||
}
|
}
|
||||||
thing1=thing1->m_nextThing;
|
thing1=thing1->m_nextListThing;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Player -> Friend collision
|
// Player -> Friend collision
|
||||||
|
@ -207,7 +225,7 @@ void CThingManager::thinkAllThings(int _frames)
|
||||||
{
|
{
|
||||||
thing1->collidedWith(thing2);
|
thing1->collidedWith(thing2);
|
||||||
}
|
}
|
||||||
thing1=thing1->m_nextThing;
|
thing1=thing1->m_nextListThing;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Player -> Hazard collision
|
// Player -> Hazard collision
|
||||||
|
@ -220,7 +238,7 @@ void CThingManager::thinkAllThings(int _frames)
|
||||||
{
|
{
|
||||||
thing1->collidedWith(thing2);
|
thing1->collidedWith(thing2);
|
||||||
}
|
}
|
||||||
thing1=thing1->m_nextThing;
|
thing1=thing1->m_nextListThing;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Player -> Enemy projectile collision
|
// Player -> Enemy projectile collision
|
||||||
|
@ -233,7 +251,7 @@ void CThingManager::thinkAllThings(int _frames)
|
||||||
{
|
{
|
||||||
thing1->collidedWith(thing2);
|
thing1->collidedWith(thing2);
|
||||||
}
|
}
|
||||||
thing1=thing1->m_nextThing;
|
thing1=thing1->m_nextListThing;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Player -> Trigger collision
|
// Player -> Trigger collision
|
||||||
|
@ -246,7 +264,7 @@ void CThingManager::thinkAllThings(int _frames)
|
||||||
{
|
{
|
||||||
thing1->collidedWith(thing2);
|
thing1->collidedWith(thing2);
|
||||||
}
|
}
|
||||||
thing1=thing1->m_nextThing;
|
thing1=thing1->m_nextListThing;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enemy -> Player projectile collision
|
// Enemy -> Player projectile collision
|
||||||
|
@ -262,9 +280,9 @@ void CThingManager::thinkAllThings(int _frames)
|
||||||
{
|
{
|
||||||
thing1->collidedWith(thing2);
|
thing1->collidedWith(thing2);
|
||||||
}
|
}
|
||||||
thing2=thing2->m_nextThing;
|
thing2=thing2->m_nextListThing;
|
||||||
}
|
}
|
||||||
thing1=thing1->m_nextThing;
|
thing1=thing1->m_nextListThing;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enemy -> Enemy collision
|
// Enemy -> Enemy collision
|
||||||
|
@ -286,10 +304,10 @@ void CThingManager::thinkAllThings(int _frames)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
thing2 = thing2->m_nextThing;
|
thing2 = thing2->m_nextListThing;
|
||||||
}
|
}
|
||||||
|
|
||||||
thing1 = thing1->m_nextThing;
|
thing1 = thing1->m_nextListThing;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hazard -> Platform collision
|
// Hazard -> Platform collision
|
||||||
|
@ -311,10 +329,10 @@ void CThingManager::thinkAllThings(int _frames)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
thing2 = thing2->m_nextThing;
|
thing2 = thing2->m_nextListThing;
|
||||||
}
|
}
|
||||||
|
|
||||||
thing1 = thing1->m_nextThing;
|
thing1 = thing1->m_nextListThing;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i=0;i<CThing::MAX_TYPE;i++)
|
for(i=0;i<CThing::MAX_TYPE;i++)
|
||||||
|
@ -323,7 +341,7 @@ void CThingManager::thinkAllThings(int _frames)
|
||||||
CThing *nextThing = thing;
|
CThing *nextThing = thing;
|
||||||
while(thing)
|
while(thing)
|
||||||
{
|
{
|
||||||
nextThing=thing->m_nextThing;
|
nextThing=thing->m_nextListThing;
|
||||||
|
|
||||||
if ( thing->isSetToShutdown() )
|
if ( thing->isSetToShutdown() )
|
||||||
{
|
{
|
||||||
|
@ -342,8 +360,30 @@ void CThingManager::thinkAllThings(int _frames)
|
||||||
Params:
|
Params:
|
||||||
Returns:
|
Returns:
|
||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
|
static int s_RenderBBoxX0=0;
|
||||||
|
static int s_RenderBBoxX1=512;
|
||||||
|
static int s_RenderBBoxY0=0;
|
||||||
|
static int s_RenderBBoxY1=256;
|
||||||
|
static int s_ThinkBBoxX0=0-256;
|
||||||
|
static int s_ThinkBBoxX1=512+526;
|
||||||
|
static int s_ThinkBBoxY0=0+128;
|
||||||
|
static int s_ThinkBBoxY1=256+128;
|
||||||
|
|
||||||
void CThingManager::renderAllThings()
|
void CThingManager::renderAllThings()
|
||||||
{
|
{
|
||||||
|
// Setup Screen BBox's
|
||||||
|
DVECTOR const &CamPos=CLevel::getCameraPos();
|
||||||
|
|
||||||
|
m_RenderBBox.XMin=s_RenderBBoxX0+CamPos.vx;
|
||||||
|
m_RenderBBox.XMax=s_RenderBBoxX1+CamPos.vx;
|
||||||
|
m_RenderBBox.YMin=s_RenderBBoxY0+CamPos.vy;
|
||||||
|
m_RenderBBox.YMax=s_RenderBBoxY1+CamPos.vy;
|
||||||
|
|
||||||
|
m_ThinkBBox.XMin=s_ThinkBBoxX0+CamPos.vx;
|
||||||
|
m_ThinkBBox.XMax=s_ThinkBBoxX1+CamPos.vx;
|
||||||
|
m_ThinkBBox.YMin=s_ThinkBBoxY0+CamPos.vy;
|
||||||
|
m_ThinkBBox.YMax=s_ThinkBBoxY1+CamPos.vy;
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
CThing *thing;
|
CThing *thing;
|
||||||
|
|
||||||
|
@ -353,7 +393,7 @@ void CThingManager::renderAllThings()
|
||||||
while(thing)
|
while(thing)
|
||||||
{
|
{
|
||||||
thing->render();
|
thing->render();
|
||||||
thing=thing->m_nextThing;
|
thing=thing->m_nextListThing;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -375,7 +415,7 @@ void CThingManager::processEventAllThings(GAME_EVENT _event,CThing *_sourceThin
|
||||||
while(thing)
|
while(thing)
|
||||||
{
|
{
|
||||||
thing->processEvent(_event,_sourceThing);
|
thing->processEvent(_event,_sourceThing);
|
||||||
thing=thing->m_nextThing;
|
thing=thing->m_nextListThing;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -403,7 +443,7 @@ CThing *CThingManager::checkCollisionAreaAgainstThings(CRECT *_area,int _type,i
|
||||||
if(_continue)
|
if(_continue)
|
||||||
{
|
{
|
||||||
ASSERT(thing);
|
ASSERT(thing);
|
||||||
thing=thing->m_nextThing;
|
thing=thing->m_nextListThing;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -416,7 +456,7 @@ CThing *CThingManager::checkCollisionAreaAgainstThings(CRECT *_area,int _type,i
|
||||||
{
|
{
|
||||||
return thing;
|
return thing;
|
||||||
}
|
}
|
||||||
thing=thing->m_nextThing;
|
thing=thing->m_nextListThing;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -430,7 +470,7 @@ CThing *CThingManager::checkCollisionAreaAgainstThings(CRECT *_area,int _type,i
|
||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
void CThingManager::addToThingList(CThing *_this)
|
void CThingManager::addToThingList(CThing *_this)
|
||||||
{
|
{
|
||||||
_this->m_nextThing=s_thingLists[_this->getThingType()];
|
_this->m_nextListThing=s_thingLists[_this->getThingType()];
|
||||||
s_thingLists[_this->getThingType()]=_this;
|
s_thingLists[_this->getThingType()]=_this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -449,16 +489,16 @@ void CThingManager::removeFromThingList(CThing *_this)
|
||||||
while(thing!=_this)
|
while(thing!=_this)
|
||||||
{
|
{
|
||||||
prevThing=thing;
|
prevThing=thing;
|
||||||
thing=thing->m_nextThing;
|
thing=thing->m_nextListThing;
|
||||||
ASSERT(thing); // Not in the list!?!?
|
ASSERT(thing); // Not in the list!?!?
|
||||||
}
|
}
|
||||||
if(prevThing)
|
if(prevThing)
|
||||||
{
|
{
|
||||||
prevThing->m_nextThing=_this->m_nextThing;
|
prevThing->m_nextListThing=_this->m_nextListThing;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
s_thingLists[_this->getThingType()]=_this->m_nextThing;
|
s_thingLists[_this->getThingType()]=_this->m_nextListThing;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -524,24 +564,48 @@ void CThing::think(int _frames)
|
||||||
Params:
|
Params:
|
||||||
Returns:
|
Returns:
|
||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
#if !defined(__USER_CDBUILD__)
|
|
||||||
#include "gfx\prim.h"
|
|
||||||
#include "level\level.h"
|
|
||||||
|
|
||||||
#if defined (__USER_paul__) || defined (__USER_charles__)
|
#if defined (__USER_paul__) || defined (__USER_charles__)
|
||||||
|
#define SHOW_BBOX 1
|
||||||
int showthings=true;
|
int showthings=true;
|
||||||
#else
|
#endif
|
||||||
|
|
||||||
|
#if defined (__USER_daveo__)
|
||||||
|
#define SHOW_BBOX 1
|
||||||
int showthings=false;
|
int showthings=false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void CThing::render()
|
void CThing::render()
|
||||||
|
{
|
||||||
|
// Check Is Onscreen
|
||||||
|
CRECT const &collisionRect = getCollisionArea();
|
||||||
|
sBBox &ScrBBox=CThingManager::getRenderBBox();
|
||||||
|
DVECTOR const &CamPos=CLevel::getCameraPos();
|
||||||
|
|
||||||
|
m_RenderPos.vx = Pos.vx - CamPos.vx;
|
||||||
|
m_RenderPos.vy = Pos.vy - CamPos.vy;
|
||||||
|
|
||||||
|
// Will speed this up
|
||||||
|
m_renderFlag=true;
|
||||||
|
if (collisionRect.x2<ScrBBox.XMin || collisionRect.x1>ScrBBox.XMax) m_renderFlag=false;
|
||||||
|
if (collisionRect.y2<ScrBBox.YMin || collisionRect.y1>ScrBBox.YMax) m_renderFlag=false;
|
||||||
|
|
||||||
|
/***/
|
||||||
|
#ifdef SHOW_BBOX
|
||||||
|
if(showthings) ShowBBox();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
/****************************************************************************************/
|
||||||
|
#ifdef SHOW_BBOX
|
||||||
|
#include "gfx\prim.h"
|
||||||
|
|
||||||
|
void CThing::ShowBBox()
|
||||||
{
|
{
|
||||||
if(showthings)
|
if(showthings)
|
||||||
{
|
{
|
||||||
DVECTOR ofs;
|
DVECTOR const &ofs=CLevel::getCameraPos();
|
||||||
CRECT area;
|
CRECT area;
|
||||||
|
|
||||||
ofs=CLevel::getCameraPos();
|
|
||||||
area=getCollisionArea();
|
area=getCollisionArea();
|
||||||
area.x1-=ofs.vx;
|
area.x1-=ofs.vx;
|
||||||
area.y1-=ofs.vy;
|
area.y1-=ofs.vy;
|
||||||
|
@ -636,10 +700,6 @@ void CThing::render()
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
void CThing::render()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*----------------------------------------------------------------------
|
/*----------------------------------------------------------------------
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "game\event.h"
|
#include "game\event.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <dstructs.h>
|
||||||
|
|
||||||
/* Std Lib
|
/* Std Lib
|
||||||
------- */
|
------- */
|
||||||
|
@ -39,14 +40,14 @@
|
||||||
-------------------- */
|
-------------------- */
|
||||||
|
|
||||||
// Collision rectangle definition
|
// Collision rectangle definition
|
||||||
typedef struct
|
struct CRECT
|
||||||
{
|
{
|
||||||
int x1,y1,x2,y2;
|
int x1,y1,x2,y2;
|
||||||
}
|
};
|
||||||
CRECT;
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------*/
|
||||||
// Thing manager class
|
// Thing manager class
|
||||||
|
class CThing;
|
||||||
class CThingManager
|
class CThingManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -56,27 +57,38 @@ public:
|
||||||
|
|
||||||
static void thinkAllThings(int _frames);
|
static void thinkAllThings(int _frames);
|
||||||
static void renderAllThings();
|
static void renderAllThings();
|
||||||
static void processEventAllThings(GAME_EVENT _event,class CThing *_sourceThing);
|
static void processEventAllThings(GAME_EVENT _event,CThing *_sourceThing);
|
||||||
|
|
||||||
static CThing* checkCollisionAreaAgainstThings(CRECT *_area,int _type,int _continue);
|
static CThing* checkCollisionAreaAgainstThings(CRECT *_area,int _type,int _continue);
|
||||||
|
static void initCollision();
|
||||||
|
|
||||||
|
static sBBox &getRenderBBox() {return(m_RenderBBox);}
|
||||||
|
static sBBox &getThinkBBox() {return(m_ThinkBBox);}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static void addToThingList(class CThing *_this);
|
static void initList(CThing **List);
|
||||||
|
static void addToThingList(CThing *_this);
|
||||||
static void removeFromThingList(CThing *_this);
|
static void removeFromThingList(CThing *_this);
|
||||||
|
|
||||||
|
static void addToCollisionList(CThing *_this);
|
||||||
|
|
||||||
friend class CThing;
|
friend class CThing;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static class CThing *s_thingLists[];
|
static CThing *s_thingLists[];
|
||||||
static int s_initialised;
|
static int s_initialised;
|
||||||
|
|
||||||
|
static CThing *s_CollisionLists[];
|
||||||
|
static sBBox m_RenderBBox;
|
||||||
|
static sBBox m_ThinkBBox;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------*/
|
||||||
// Base thing class
|
// Base thing class
|
||||||
class CThing
|
class CThing
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef enum
|
enum TYPE
|
||||||
{
|
{
|
||||||
TYPE_PICKUP,
|
TYPE_PICKUP,
|
||||||
TYPE_PLATFORM,
|
TYPE_PLATFORM,
|
||||||
|
@ -90,15 +102,13 @@ public:
|
||||||
TYPE_FX,
|
TYPE_FX,
|
||||||
|
|
||||||
MAX_TYPE,
|
MAX_TYPE,
|
||||||
}
|
};
|
||||||
TYPE;
|
// TYPE;
|
||||||
|
|
||||||
CThing() {;}
|
CThing() {;}
|
||||||
virtual ~CThing() {;}
|
virtual ~CThing() {;}
|
||||||
|
|
||||||
virtual TYPE getThingType()=0;
|
virtual TYPE getThingType()=0;
|
||||||
|
|
||||||
|
|
||||||
virtual void init();
|
virtual void init();
|
||||||
virtual void shutdown();
|
virtual void shutdown();
|
||||||
virtual void think(int _frames);
|
virtual void think(int _frames);
|
||||||
|
@ -114,19 +124,16 @@ public:
|
||||||
int getNumChildren();
|
int getNumChildren();
|
||||||
|
|
||||||
|
|
||||||
DVECTOR getPos() {return Pos;}
|
DVECTOR const &getPos() {return Pos;}
|
||||||
void setPos(DVECTOR newPos) {Pos=newPos;}
|
void setPos(DVECTOR newPos) {Pos=newPos;}
|
||||||
DVECTOR getPosDelta() {return PosDelta;}
|
DVECTOR getPosDelta() {return PosDelta;}
|
||||||
CThing *getNext() {return Next;}
|
CThing *getNext() {return Next;}
|
||||||
|
|
||||||
|
|
||||||
virtual void processEvent(GAME_EVENT _event,CThing *_sourceThing);
|
virtual void processEvent(GAME_EVENT _event,CThing *_sourceThing);
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
// Parent Child Linkage
|
||||||
// Linkage
|
|
||||||
CThing *Parent,*Next;
|
CThing *Parent,*Next;
|
||||||
// Count
|
// Count
|
||||||
int m_numChildren;
|
int m_numChildren;
|
||||||
|
@ -134,21 +141,19 @@ protected:
|
||||||
DVECTOR Pos, PosLast, PosDelta;
|
DVECTOR Pos, PosLast, PosDelta;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
class CThing *m_nextThing;
|
CThing *m_nextListThing;
|
||||||
|
CThing *m_nextCollisionThing;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// -- Collision --
|
// -- Collision --
|
||||||
public:
|
public:
|
||||||
DVECTOR getCollisionCentre() {return m_collisionCentre;}
|
void ShowBBox();
|
||||||
DVECTOR getCollisionCentreOffset() {return m_collisionCentreOffset;}
|
DVECTOR const &getCollisionCentre() {return m_collisionCentre;}
|
||||||
|
DVECTOR const &getCollisionCentreOffset() {return m_collisionCentreOffset;}
|
||||||
int getCollisionRadius() {return m_collisionRadius;}
|
int getCollisionRadius() {return m_collisionRadius;}
|
||||||
CRECT getCollisionArea() {return m_collisionArea;}
|
CRECT const &getCollisionArea() {return m_collisionArea;}
|
||||||
s16 getCollisionAngle() {return m_collisionAngle;} // pkg - move to CNpcPlatform?
|
s16 getCollisionAngle() {return m_collisionAngle;} // pkg - move to CNpcPlatform?
|
||||||
DVECTOR getNewCollidedPos() {return m_newCollidedPos;} // pkg - to be removed?
|
DVECTOR const &getNewCollidedPos() {return m_newCollidedPos;} // pkg - to be removed?
|
||||||
DVECTOR getCollisionSize() {return m_collisionSize;}
|
DVECTOR const &getCollisionSize() {return m_collisionSize;}
|
||||||
|
|
||||||
virtual int canCollide() {return true;}
|
virtual int canCollide() {return true;}
|
||||||
virtual int checkCollisionAgainst(CThing *_thisThing, int _frames);
|
virtual int checkCollisionAgainst(CThing *_thisThing, int _frames);
|
||||||
|
@ -160,9 +165,9 @@ public:
|
||||||
virtual s32 getNewYPos( CThing *_thisThing );
|
virtual s32 getNewYPos( CThing *_thisThing );
|
||||||
void setNewCollidedPos(DVECTOR newPos) {m_newCollidedPos = newPos;} // pkg - to be removed?
|
void setNewCollidedPos(DVECTOR newPos) {m_newCollidedPos = newPos;} // pkg - to be removed?
|
||||||
|
|
||||||
bool IsOnScreen() {return(m_OnScreenFlag);/* Put check code here */}
|
bool canRender() {return (m_renderFlag);}
|
||||||
bool getOnScreenFlag() {return(m_OnScreenFlag);}
|
DVECTOR &getRenderPos() {return(m_RenderPos);}
|
||||||
void setOnScreenFlag(bool f) {m_OnScreenFlag=f;}
|
bool canThink() {return (m_thinkFlag);}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void setCollisionSize(int _w,int _h);
|
virtual void setCollisionSize(int _w,int _h);
|
||||||
|
@ -177,46 +182,55 @@ private:
|
||||||
DVECTOR m_collisionCentre;
|
DVECTOR m_collisionCentre;
|
||||||
s16 m_collisionAngle; // pkg - move to CNpcPlatform?
|
s16 m_collisionAngle; // pkg - move to CNpcPlatform?
|
||||||
DVECTOR m_newCollidedPos; // pkg - to be removed?
|
DVECTOR m_newCollidedPos; // pkg - to be removed?
|
||||||
bool m_OnScreenFlag;
|
|
||||||
|
|
||||||
|
bool m_renderFlag,m_thinkFlag;
|
||||||
|
DVECTOR m_RenderPos;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------- */
|
||||||
/* These are the individual base classes for each of the seperate thing types */
|
/* These are the individual base classes for each of the seperate thing types */
|
||||||
class CPickupThing : public CThing
|
class CPickupThing : public CThing
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual TYPE getThingType() {return TYPE_PICKUP;}
|
virtual TYPE getThingType() {return TYPE_PICKUP;}
|
||||||
};
|
};
|
||||||
|
|
||||||
class CPlayerThing : public CThing
|
class CPlayerThing : public CThing
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual TYPE getThingType() {return TYPE_PLAYER;}
|
virtual TYPE getThingType() {return TYPE_PLAYER;}
|
||||||
};
|
};
|
||||||
|
|
||||||
class CPlayerProjectileThing : public CThing
|
class CPlayerProjectileThing : public CThing
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual TYPE getThingType() {return TYPE_PLAYERPROJECTILE;}
|
virtual TYPE getThingType() {return TYPE_PLAYERPROJECTILE;}
|
||||||
};
|
};
|
||||||
|
|
||||||
class CNpcThing : public CThing
|
class CNpcThing : public CThing
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual TYPE getThingType() {return TYPE_NPC;}
|
virtual TYPE getThingType() {return TYPE_NPC;}
|
||||||
};
|
};
|
||||||
|
|
||||||
class CEnemyThing : public CThing
|
class CEnemyThing : public CThing
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual TYPE getThingType() {return TYPE_ENEMY;}
|
virtual TYPE getThingType() {return TYPE_ENEMY;}
|
||||||
};
|
};
|
||||||
|
|
||||||
class CEnemyProjectileThing : public CThing
|
class CEnemyProjectileThing : public CThing
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual TYPE getThingType() {return TYPE_ENEMYPROJECTILE;}
|
virtual TYPE getThingType() {return TYPE_ENEMYPROJECTILE;}
|
||||||
};
|
};
|
||||||
|
|
||||||
class CPlatformThing : public CThing
|
class CPlatformThing : public CThing
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual TYPE getThingType() {return TYPE_PLATFORM;}
|
virtual TYPE getThingType() {return TYPE_PLATFORM;}
|
||||||
};
|
};
|
||||||
|
|
||||||
class CTriggerThing : public CThing
|
class CTriggerThing : public CThing
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -226,28 +240,19 @@ public:
|
||||||
protected:
|
protected:
|
||||||
int m_boxX1,m_boxY1,m_boxX2,m_boxY2;
|
int m_boxX1,m_boxY1,m_boxX2,m_boxY2;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CHazardThing : public CThing
|
class CHazardThing : public CThing
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual TYPE getThingType() {return TYPE_HAZARD;}
|
virtual TYPE getThingType() {return TYPE_HAZARD;}
|
||||||
};
|
};
|
||||||
|
|
||||||
class CFXThing : public CThing
|
class CFXThing : public CThing
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual TYPE getThingType() {return TYPE_FX;}
|
virtual TYPE getThingType() {return TYPE_FX;}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------
|
|
||||||
Globals
|
|
||||||
------- */
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------
|
|
||||||
Functions
|
|
||||||
--------- */
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
#endif /* __THING_THING_H__ */
|
#endif /* __THING_THING_H__ */
|
||||||
|
|
||||||
/*===========================================================================
|
/*===========================================================================
|
||||||
|
|
Loading…
Add table
Reference in a new issue