This commit is contained in:
parent
027484747a
commit
e71271653f
4 changed files with 100 additions and 52 deletions
|
@ -153,6 +153,7 @@ int CGameScene::s_levelFinished;
|
||||||
int CGameScene::s_skipToNextLevel;
|
int CGameScene::s_skipToNextLevel;
|
||||||
#endif
|
#endif
|
||||||
int CGameScene::s_restartLevel;
|
int CGameScene::s_restartLevel;
|
||||||
|
int CGameScene::s_bossHasBeenKilled;
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
@ -393,11 +394,14 @@ void CGameScene::initLevel()
|
||||||
CPlayer::CameraBox camBox={0,0,mapSize.vx<<4,mapSize.vy<<4};
|
CPlayer::CameraBox camBox={0,0,mapSize.vx<<4,mapSize.vy<<4};
|
||||||
m_player->setCameraBox(camBox);
|
m_player->setCameraBox(camBox);
|
||||||
|
|
||||||
|
s_bossHasBeenKilled=false;
|
||||||
|
|
||||||
// Song is loaded/dumped by the level, and played from here. This just gives some
|
// Song is loaded/dumped by the level, and played from here. This just gives some
|
||||||
// better timing over when it starts (pkg)
|
// better timing over when it starts (pkg)
|
||||||
CSoundMediator::playSong();
|
CSoundMediator::playSong();
|
||||||
CActorPool::SetUpCache();
|
CActorPool::SetUpCache();
|
||||||
SYSTEM_DBGMSG("InitLevelDone\n");
|
SYSTEM_DBGMSG("InitLevelDone\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,9 @@ static void restartlevel() {s_restartLevel=true;}
|
||||||
// static MATRIX &GetCamMtx() {return(CamMtx);}
|
// static MATRIX &GetCamMtx() {return(CamMtx);}
|
||||||
static ACTOR_TYPE getActorType( int actorNum ) {return actorType[actorNum];}
|
static ACTOR_TYPE getActorType( int actorNum ) {return actorType[actorNum];}
|
||||||
|
|
||||||
|
static void setBossHasBeenKilled() {s_bossHasBeenKilled=true;}
|
||||||
|
static int getBossHasBeenKilled() {return s_bossHasBeenKilled;}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
void initLevel();
|
void initLevel();
|
||||||
|
@ -88,6 +91,7 @@ static CLayerCollision *getCollision() {return(s_GlobalCollision);}
|
||||||
|
|
||||||
static SpriteBank *s_GlobalSpritebank;
|
static SpriteBank *s_GlobalSpritebank;
|
||||||
static CLayerCollision *s_GlobalCollision;
|
static CLayerCollision *s_GlobalCollision;
|
||||||
|
static int s_bossHasBeenKilled;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
#include "game\game.h"
|
#include "game\game.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "game/game.h"
|
|
||||||
|
|
||||||
/* Std Lib
|
/* Std Lib
|
||||||
------- */
|
------- */
|
||||||
|
@ -133,6 +132,15 @@ void CQuestItemPickup::init()
|
||||||
|
|
||||||
fh=CGameScene::getSpriteBank()->getFrameHeader(m_gfxFrame);
|
fh=CGameScene::getSpriteBank()->getFrameHeader(m_gfxFrame);
|
||||||
setCollisionSize(fh->W,fh->H);
|
setCollisionSize(fh->W,fh->H);
|
||||||
|
|
||||||
|
if(level==5-1)
|
||||||
|
{
|
||||||
|
m_hiddenUntilBossDead=true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_hiddenUntilBossDead=false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*----------------------------------------------------------------------
|
/*----------------------------------------------------------------------
|
||||||
|
@ -164,6 +172,22 @@ void CQuestItemPickup::collect(class CPlayer *_player)
|
||||||
CBasePickup::collect(_player);
|
CBasePickup::collect(_player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Function:
|
||||||
|
Purpose:
|
||||||
|
Params:
|
||||||
|
Returns:
|
||||||
|
---------------------------------------------------------------------- */
|
||||||
|
void CQuestItemPickup::collidedWith(CThing *_thisThing)
|
||||||
|
{
|
||||||
|
if(!m_hiddenUntilBossDead)
|
||||||
|
{
|
||||||
|
CBasePickup::collidedWith(_thisThing);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int quest_pingframes=50;
|
int quest_pingframes=50;
|
||||||
int quest_pingwaitframes=100;
|
int quest_pingwaitframes=100;
|
||||||
int quest_pingsize=100;
|
int quest_pingsize=100;
|
||||||
|
@ -191,11 +215,18 @@ int CQuestItemPickup::getVisibilityRadius()
|
||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
void CQuestItemPickup::thinkPickup(int _frames)
|
void CQuestItemPickup::thinkPickup(int _frames)
|
||||||
{
|
{
|
||||||
m_pingFrame+=_frames;
|
if(!m_hiddenUntilBossDead)
|
||||||
if(m_pingFrame>(quest_pingframes+quest_pingwaitframes))
|
|
||||||
{
|
{
|
||||||
// Do sound too.. (pkg)
|
m_pingFrame+=_frames;
|
||||||
m_pingFrame=0;
|
if(m_pingFrame>(quest_pingframes+quest_pingwaitframes))
|
||||||
|
{
|
||||||
|
// Do sound too.. (pkg)
|
||||||
|
m_pingFrame=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(GameScene.getBossHasBeenKilled())
|
||||||
|
{
|
||||||
|
m_hiddenUntilBossDead=false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,58 +238,61 @@ void CQuestItemPickup::thinkPickup(int _frames)
|
||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
void CQuestItemPickup::renderPickup(DVECTOR *_pos)
|
void CQuestItemPickup::renderPickup(DVECTOR *_pos)
|
||||||
{
|
{
|
||||||
SpriteBank *sprites;
|
if(!m_hiddenUntilBossDead)
|
||||||
sFrameHdr *fh;
|
|
||||||
int x,y;
|
|
||||||
|
|
||||||
sprites=CGameScene::getSpriteBank();
|
|
||||||
fh=sprites->getFrameHeader(m_gfxFrame);
|
|
||||||
x=_pos->vx-(fh->W/2);
|
|
||||||
y=_pos->vy-(fh->H/2);
|
|
||||||
sprites->printFT4(fh,x,y,0,0,OTPOS__PICKUP_POS);
|
|
||||||
|
|
||||||
if(m_pingFrame<quest_pingframes)
|
|
||||||
{
|
{
|
||||||
int radius;
|
SpriteBank *sprites;
|
||||||
int endr,endg,endb;
|
sFrameHdr *fh;
|
||||||
int angle;
|
int x,y;
|
||||||
DVECTOR p1,p2;
|
|
||||||
int i;
|
|
||||||
POLY_G3 *g3;
|
|
||||||
POLY_FT3 *ft3;
|
|
||||||
|
|
||||||
x=_pos->vx;
|
sprites=CGameScene::getSpriteBank();
|
||||||
y=_pos->vy;
|
fh=sprites->getFrameHeader(m_gfxFrame);
|
||||||
radius=(quest_pingsize*m_pingFrame)/quest_pingframes;
|
x=_pos->vx-(fh->W/2);
|
||||||
endr=(quest_pingr*(quest_pingframes-m_pingFrame))/quest_pingframes;
|
y=_pos->vy-(fh->H/2);
|
||||||
endg=(quest_pingg*(quest_pingframes-m_pingFrame))/quest_pingframes;
|
sprites->printFT4(fh,x,y,0,0,OTPOS__PICKUP_POS);
|
||||||
endb=(quest_pingb*(quest_pingframes-m_pingFrame))/quest_pingframes;
|
|
||||||
|
|
||||||
p1.vx=x;
|
if(m_pingFrame<quest_pingframes)
|
||||||
p1.vy=y+radius;
|
|
||||||
for(i=0;i<quest_pingsegments;i++)
|
|
||||||
{
|
{
|
||||||
angle=(4095*(i+1))/quest_pingsegments;
|
int radius;
|
||||||
p2.vx=x+((msin(angle)*radius)>>12);
|
int endr,endg,endb;
|
||||||
p2.vy=y+((mcos(angle)*radius)>>12);
|
int angle;
|
||||||
g3=GetPrimG3();
|
DVECTOR p1,p2;
|
||||||
setXY3(g3,x,y,p1.vx,p1.vy,p2.vx,p2.vy);
|
int i;
|
||||||
setRGB0(g3,0,0,0);
|
POLY_G3 *g3;
|
||||||
setRGB1(g3,endr,endg,endb);
|
POLY_FT3 *ft3;
|
||||||
setRGB2(g3,endr,endg,endb);
|
|
||||||
setShadeTex(g3,0);
|
|
||||||
setSemiTrans(g3,1);
|
|
||||||
AddPrimToList(g3,OTPOS__PICKUP_POS+1);
|
|
||||||
p1=p2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Trans
|
x=_pos->vx;
|
||||||
ft3=GetPrimFT3();
|
y=_pos->vy;
|
||||||
setShadeTex(ft3,1);
|
radius=(quest_pingsize*m_pingFrame)/quest_pingframes;
|
||||||
setSemiTrans(ft3,1);
|
endr=(quest_pingr*(quest_pingframes-m_pingFrame))/quest_pingframes;
|
||||||
ft3->tpage=(quest_transmode<<5);
|
endg=(quest_pingg*(quest_pingframes-m_pingFrame))/quest_pingframes;
|
||||||
setXY3(ft3,512,512,512,512,512,512);
|
endb=(quest_pingb*(quest_pingframes-m_pingFrame))/quest_pingframes;
|
||||||
AddPrimToList(ft3,OTPOS__PICKUP_POS+1);
|
|
||||||
|
p1.vx=x;
|
||||||
|
p1.vy=y+radius;
|
||||||
|
for(i=0;i<quest_pingsegments;i++)
|
||||||
|
{
|
||||||
|
angle=(4095*(i+1))/quest_pingsegments;
|
||||||
|
p2.vx=x+((msin(angle)*radius)>>12);
|
||||||
|
p2.vy=y+((mcos(angle)*radius)>>12);
|
||||||
|
g3=GetPrimG3();
|
||||||
|
setXY3(g3,x,y,p1.vx,p1.vy,p2.vx,p2.vy);
|
||||||
|
setRGB0(g3,0,0,0);
|
||||||
|
setRGB1(g3,endr,endg,endb);
|
||||||
|
setRGB2(g3,endr,endg,endb);
|
||||||
|
setShadeTex(g3,0);
|
||||||
|
setSemiTrans(g3,1);
|
||||||
|
AddPrimToList(g3,OTPOS__PICKUP_POS+1);
|
||||||
|
p1=p2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Trans
|
||||||
|
ft3=GetPrimFT3();
|
||||||
|
setShadeTex(ft3,1);
|
||||||
|
setSemiTrans(ft3,1);
|
||||||
|
ft3->tpage=(quest_transmode<<5);
|
||||||
|
setXY3(ft3,512,512,512,512,512,512);
|
||||||
|
AddPrimToList(ft3,OTPOS__PICKUP_POS+1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,11 @@ public:
|
||||||
virtual DVECTOR getSizeForPlacement();
|
virtual DVECTOR getSizeForPlacement();
|
||||||
virtual void collect(class CPlayer *_player);
|
virtual void collect(class CPlayer *_player);
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void collidedWith(CThing *_thisThing);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual int getVisibilityRadius();
|
virtual int getVisibilityRadius();
|
||||||
|
|
||||||
|
@ -50,6 +55,7 @@ private:
|
||||||
|
|
||||||
virtual CSoundMediator::SFXID sfxToPlayWhenCollected(){return CSoundMediator::SFX_ITEM__LEVEL_ITEM;}
|
virtual CSoundMediator::SFXID sfxToPlayWhenCollected(){return CSoundMediator::SFX_ITEM__LEVEL_ITEM;}
|
||||||
|
|
||||||
|
int m_hiddenUntilBossDead;
|
||||||
int m_pingFrame;
|
int m_pingFrame;
|
||||||
int m_gfxFrame;
|
int m_gfxFrame;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue