From e71271653f6e3257bdbc24b2caebb78d02aef27a Mon Sep 17 00:00:00 2001 From: Paul Date: Tue, 12 Jun 2001 15:41:47 +0000 Subject: [PATCH] --- source/game/game.cpp | 4 ++ source/game/game.h | 4 ++ source/pickups/pquest.cpp | 138 ++++++++++++++++++++++++-------------- source/pickups/pquest.h | 6 ++ 4 files changed, 100 insertions(+), 52 deletions(-) diff --git a/source/game/game.cpp b/source/game/game.cpp index 607a0ca5d..a732982df 100644 --- a/source/game/game.cpp +++ b/source/game/game.cpp @@ -153,6 +153,7 @@ int CGameScene::s_levelFinished; int CGameScene::s_skipToNextLevel; #endif 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}; m_player->setCameraBox(camBox); + s_bossHasBeenKilled=false; + // Song is loaded/dumped by the level, and played from here. This just gives some // better timing over when it starts (pkg) CSoundMediator::playSong(); CActorPool::SetUpCache(); SYSTEM_DBGMSG("InitLevelDone\n"); + } diff --git a/source/game/game.h b/source/game/game.h index bca3851af..5191066ec 100644 --- a/source/game/game.h +++ b/source/game/game.h @@ -56,6 +56,9 @@ static void restartlevel() {s_restartLevel=true;} // static MATRIX &GetCamMtx() {return(CamMtx);} static ACTOR_TYPE getActorType( int actorNum ) {return actorType[actorNum];} +static void setBossHasBeenKilled() {s_bossHasBeenKilled=true;} +static int getBossHasBeenKilled() {return s_bossHasBeenKilled;} + protected: void initLevel(); @@ -88,6 +91,7 @@ static CLayerCollision *getCollision() {return(s_GlobalCollision);} static SpriteBank *s_GlobalSpritebank; static CLayerCollision *s_GlobalCollision; +static int s_bossHasBeenKilled; }; diff --git a/source/pickups/pquest.cpp b/source/pickups/pquest.cpp index d09f89357..c60485ea0 100644 --- a/source/pickups/pquest.cpp +++ b/source/pickups/pquest.cpp @@ -37,7 +37,6 @@ #include "game\game.h" #endif -#include "game/game.h" /* Std Lib ------- */ @@ -133,6 +132,15 @@ void CQuestItemPickup::init() fh=CGameScene::getSpriteBank()->getFrameHeader(m_gfxFrame); 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); } +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CQuestItemPickup::collidedWith(CThing *_thisThing) +{ + if(!m_hiddenUntilBossDead) + { + CBasePickup::collidedWith(_thisThing); + } +} + + + int quest_pingframes=50; int quest_pingwaitframes=100; int quest_pingsize=100; @@ -191,11 +215,18 @@ int CQuestItemPickup::getVisibilityRadius() ---------------------------------------------------------------------- */ void CQuestItemPickup::thinkPickup(int _frames) { - m_pingFrame+=_frames; - if(m_pingFrame>(quest_pingframes+quest_pingwaitframes)) + if(!m_hiddenUntilBossDead) { - // Do sound too.. (pkg) - m_pingFrame=0; + m_pingFrame+=_frames; + 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) { - SpriteBank *sprites; - 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_pingFramevx; - y=_pos->vy; - radius=(quest_pingsize*m_pingFrame)/quest_pingframes; - endr=(quest_pingr*(quest_pingframes-m_pingFrame))/quest_pingframes; - endg=(quest_pingg*(quest_pingframes-m_pingFrame))/quest_pingframes; - endb=(quest_pingb*(quest_pingframes-m_pingFrame))/quest_pingframes; + 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); - p1.vx=x; - p1.vy=y+radius; - for(i=0;i>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; - } + int radius; + int endr,endg,endb; + int angle; + DVECTOR p1,p2; + int i; + POLY_G3 *g3; + POLY_FT3 *ft3; - // 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); + x=_pos->vx; + y=_pos->vy; + radius=(quest_pingsize*m_pingFrame)/quest_pingframes; + endr=(quest_pingr*(quest_pingframes-m_pingFrame))/quest_pingframes; + endg=(quest_pingg*(quest_pingframes-m_pingFrame))/quest_pingframes; + endb=(quest_pingb*(quest_pingframes-m_pingFrame))/quest_pingframes; + + p1.vx=x; + p1.vy=y+radius; + for(i=0;i>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); + } } } diff --git a/source/pickups/pquest.h b/source/pickups/pquest.h index c6572e04e..7ace1d72a 100644 --- a/source/pickups/pquest.h +++ b/source/pickups/pquest.h @@ -42,6 +42,11 @@ public: virtual DVECTOR getSizeForPlacement(); virtual void collect(class CPlayer *_player); + +protected: + virtual void collidedWith(CThing *_thisThing); + + private: virtual int getVisibilityRadius(); @@ -50,6 +55,7 @@ private: virtual CSoundMediator::SFXID sfxToPlayWhenCollected(){return CSoundMediator::SFX_ITEM__LEVEL_ITEM;} + int m_hiddenUntilBossDead; int m_pingFrame; int m_gfxFrame;