From 4e4724e222626d8508fa64c488ce874ed26eb5fa Mon Sep 17 00:00:00 2001 From: Paul Date: Tue, 5 Jun 2001 19:26:14 +0000 Subject: [PATCH] --- data/DataCache.scr | 1 + data/translations/text.dat | 19 ++ makefile.gaz | 2 + makefile.gfx | 28 +++ source/gui/gui.cpp | 39 ++-- source/paul/scenesel.cpp | 5 + source/shop/shop.cpp | 131 ++++++++++- source/shop/shop.h | 5 + .../spongebob project/spongebob project.dsp | 204 ++++++++++-------- 9 files changed, 324 insertions(+), 110 deletions(-) diff --git a/data/DataCache.scr b/data/DataCache.scr index 0302c7b63..ac4d40dc4 100644 --- a/data/DataCache.scr +++ b/data/DataCache.scr @@ -1,6 +1,7 @@ { SYSTEM_CACHE 4 } sprites/sprites.spr +shop/shop.spr scripts/ch1l1_01.dat scripts/ch1l1_02.dat diff --git a/data/translations/text.dat b/data/translations/text.dat index 54aebbb04..29cd9dc29 100644 --- a/data/translations/text.dat +++ b/data/translations/text.dat @@ -247,6 +247,25 @@ eng=Start +; --------------------------------------------------------------- +; Shop screen +; --------------------------------------------------------------- +[STR__SHOP_SCREEN__TOKENS] +eng=Tokens +[STR__SHOP_SCREEN__PRICE] +eng=Price +[STR__SHOP_SCREEN__LEFT_RIGHT_TO_SELECT_ITEM] +eng=Select +[STR__SHOP_SCREEN__CROSS_TO_PURCHASE] +eng=Purchase +[STR__SHOP_SCREEN__TRIANGLE_TO_EXIT] +eng=Exit +[STR__SHOP_SCREEN__ITEM_ALREADY_PURCHASED] +eng=Item already purchased + + + + ; --------------------------------------------------------------- ; Chapter and level names ; --------------------------------------------------------------- diff --git a/makefile.gaz b/makefile.gaz index 5272f2710..76b3f0e93 100644 --- a/makefile.gaz +++ b/makefile.gaz @@ -276,6 +276,8 @@ player_src := demoplay \ script_src := script \ function +shop_src := shop + sound_src := sound \ spu \ xmplay \ diff --git a/makefile.gfx b/makefile.gfx index 308d6ab39..38d8ae480 100644 --- a/makefile.gfx +++ b/makefile.gfx @@ -296,6 +296,34 @@ FRONTENDGFX_SPR_IN := -r- -z+ $(FRONTEND_GFX_TRANS_NO_ROT_IN) -r+ \ # GRAF_DIRS_TO_MAKE += $(FRONTEND_GFX_OUT_DIR) # GFX_DATA_OUT += $(FRONTEND_GFX_TEX_OUT) + +#---------------------------------------------------------------------------- +# Shop icons +#---------------------------------------------------------------------------- +SHOP_GFX_DIR := $(GRAF_DIR)/shop +SHOP_GFX_OUT_DIR := $(DATA_OUT)/shop + +SHOP_GFX_TRANS := blower cake cupcake jelly2 partyhat prezzie sarnie teddy +SHOP_GFX_TRANS_IN := $(foreach FILE,$(SHOP_GFX_TRANS),$(SHOP_GFX_DIR)/$(FILE).bmp) + +SHOP_GFX_TEX_OUT := $(SHOP_GFX_OUT_DIR)/shop.spr + +SHOP_GFX_HDR_OUT := $(INC_DIR)/shop.h +SHOP_GFX_REP_FILE := + +cleanshop: + @$(RM) -f $(SHOP_GFX_TEX_OUT) + @$(ECHO) Shop Cleaned + +shop: $(SHOP_GFX_TEX_IN) +$(SHOP_GFX_TEX_OUT) : $(SHOP_GFX_TEX_IN) + @parkgrab -z+ $(SHOP_GFX_TRANS_IN) -b+ -t:8,1,1 -l:$(REPORT_DIR)/shop.lbm -o:$(SHOP_GFX_TEX_OUT) + @$(MV) -f $(SHOP_GFX_OUT_DIR)/shop.h $(SHOP_GFX_HDR_OUT) + +GRAF_DIRS_TO_MAKE += $(SHOP_GFX_OUT_DIR) +GFX_DATA_OUT += $(SHOP_GFX_TEX_OUT) + + #---------------------------------------------------------------------------- #---------------------------------------------------------------------------- SPRITES_OUT_DIR := $(DATA_OUT)/sprites diff --git a/source/gui/gui.cpp b/source/gui/gui.cpp index 32bfec0d4..15407c406 100644 --- a/source/gui/gui.cpp +++ b/source/gui/gui.cpp @@ -185,20 +185,20 @@ void CGUIObject::render() ot=getOt(); r=g=b=200; - DrawLine(x ,y ,x+w,y ,r,g,b,ot); - DrawLine(x ,y ,x ,y+h,r,g,b,ot); - DrawLine(x+w,y ,x+w,y+h,r,g,b,ot); - DrawLine(x ,y+h,x+w,y+h,r,g,b,ot); + DrawLine(x ,y ,x+w,y ,r,g,b,0); + DrawLine(x ,y ,x ,y+h,r,g,b,0); + DrawLine(x+w,y ,x+w,y+h,r,g,b,0); + DrawLine(x ,y+h,x+w,y+h,r,g,b,0); x+=1;y+=1;w-=2;h-=2; - DrawLine(x ,y ,x+w,y ,r,g,b,ot); - DrawLine(x ,y ,x ,y+h,r,g,b,ot); - DrawLine(x+w,y ,x+w,y+h,r,g,b,ot); - DrawLine(x ,y+h,x+w,y+h,r,g,b,ot); + DrawLine(x ,y ,x+w,y ,r,g,b,0); + DrawLine(x ,y ,x ,y+h,r,g,b,0); + DrawLine(x+w,y ,x+w,y+h,r,g,b,0); + DrawLine(x ,y+h,x+w,y+h,r,g,b,0); x+=1;y+=1;w+=1;h+=1; - DrawLine(x ,y ,x+w,y ,0,0,0,ot); - DrawLine(x ,y ,x ,y+h,0,0,0,ot); - DrawLine(x+w,y ,x+w,y+h,0,0,0,ot); - DrawLine(x ,y+h,x+w,y+h,0,0,0,ot); + DrawLine(x ,y ,x+w,y ,0,0,0,0); + DrawLine(x ,y ,x ,y+h,0,0,0,0); + DrawLine(x+w,y ,x+w,y+h,0,0,0,0); + DrawLine(x ,y+h,x+w,y+h,0,0,0,0); } #endif } @@ -463,6 +463,14 @@ void drawBambooBorder(int _x,int _y,int _w,int _h,int _ot) y1+=step; } } + else + { + x1=_x-(vbam->W/2); + x2=x1+_w; + y1=1+(_y+(corner->H/2)+(vbam->H/2)-(vbam->H/2)+vbam->H-vbam->H-1); + s_uiSpriteBank->printFT4(vbam,x1,y1,0,0,_ot); + s_uiSpriteBank->printFT4(vbam,x2,y1,0,0,_ot); + } // Draw Corners corner=s_uiSpriteBank->getFrameHeader(FRM__BAMBOOTOPLEFT); @@ -496,13 +504,6 @@ _sbb sbb= }; void drawSpeechBubbleBorder(int _x,int _y,int _w,int _h,int _ot,int _faceFrame) { -/* -DrawLine(_x ,_y ,_x+_w,_y ,255,0,255,0); -DrawLine(_x+_w,_y ,_x+_w,_y+_h,255,0,255,0); -DrawLine(_x+_w,_y+_h,_x ,_y+_h,255,0,255,0); -DrawLine(_x ,_y+_h,_x ,_y ,255,0,255,0); -*/ - sFrameHdr *cornerFh; POLY_FT4 *ft4; LINE_F2 *f2; diff --git a/source/paul/scenesel.cpp b/source/paul/scenesel.cpp index a3a73d8a9..3ec1b7eef 100644 --- a/source/paul/scenesel.cpp +++ b/source/paul/scenesel.cpp @@ -47,6 +47,10 @@ #include "fma\fma.h" #endif +#ifndef __SHOP_SHOP_H__ +#include "shop\shop.h" +#endif + #ifndef __BACKEND_GAMEOVER_H__ #include "backend\gameover.h" #endif @@ -94,6 +98,7 @@ CScene *CSceneSelector::s_sceneList[]= &GameCompletedScene, &FmaScene, &MapScene, + &ShopScene, }; int CSceneSelector::s_sceneCount=sizeof(s_sceneList)/sizeof(CScene*); diff --git a/source/shop/shop.cpp b/source/shop/shop.cpp index eb8d192ba..fa5ad9b95 100644 --- a/source/shop/shop.cpp +++ b/source/shop/shop.cpp @@ -50,6 +50,18 @@ #include "game\game.h" #endif +#ifndef __GUI_GFRAME_H__ +#include "gui\gframe.h" +#endif + +#ifndef __GUI_GFACTORY_H__ +#include "gui\gfactory.h" +#endif + +#ifndef __GUI_GTEXTBOX_H__ +#include "gui\gtextbox.h" +#endif + /* Std Lib ------- */ @@ -111,6 +123,10 @@ CShopScene ShopScene; Params: Returns: ---------------------------------------------------------------------- */ +int fx=48; +int fy=155; +int fw=416; +int fh=64; void CShopScene::init() { m_image=CFileIO::loadFile(BACKDROP_SHOP_GFX); @@ -125,6 +141,14 @@ void CShopScene::init() m_spriteBank=new ("shop sprites") SpriteBank(); m_spriteBank->load(SHOP_SHOP_SPR); + // GUI Frame + CGUITextBox *tb; + m_guiFrame=new ("Token Count Frame") CGUIGroupFrame(); + m_guiFrame->init(0); + m_guiFrame->setOt(0); + m_guiFrame->setFlags(CGUIObject::FLAG_DRAWBORDER); + m_guiFrame->setObjectXYWH(fx,fy,fw,fh); + m_readyToExit=false; CFader::setFadingIn(CFader::BLACK_FADE); @@ -141,6 +165,8 @@ void CShopScene::init() ---------------------------------------------------------------------- */ void CShopScene::shutdown() { + m_guiFrame->shutdown(); + m_spriteBank->dump(); delete m_spriteBank; m_font->dump(); delete m_font; @@ -157,7 +183,7 @@ void CShopScene::shutdown() int shopx=180; int shopy=38; int shopw=512-(180*2); -int shopygap=50; +int shopygap=51; int shopitemsperrow=4; int shopflashspeed=200; int shopflashbase=128; @@ -184,7 +210,7 @@ void CShopScene::render() { SpriteBank *sb=CGameScene::getSpriteBank(); sFrameHdr *fh=sb->getFrameHeader(FRM__MAPPOINTER); - sb->printFT4(fh,x-fh->W,y+25,0,0,0); + sb->printFT4(fh,x-fh->W,y+30,0,0,0); // Flash selected item int rgb=((msin(m_flashSin)*shopflashrange)>>12)+shopflashbase; @@ -208,6 +234,8 @@ void CShopScene::render() x+=gap; } } + + renderUi(); } @@ -241,8 +269,9 @@ void CShopScene::think(int _frames) m_flashSin=0; } - m_flashSin=(m_flashSin+(_frames*shopflashspeed))&4095; + + m_guiFrame->think(_frames); } @@ -258,6 +287,102 @@ int CShopScene::readyToShutdown() } +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +typedef struct +{ + int + tokenx,tokeny, + pricex,pricey, + gaptoreadout, + instructionsx,instructionsy, + instructionsygap, + instructionsbuttonyoffset, + instructionsbuttonspace, + instructionsbuttongap, + + + end; +} shopdata; + +shopdata shop= +{ + 10,10, // tokenx,tokeny, + 40,10, // pricex,pricey, + 5, // gaptoreadout + 250,7, // instructionsx,instructionsy, + 16, // instructionsygap, + 3, // instructionsbuttonyoffset, + 10, // instructionsbuttonspace, + 5, // instructionsbuttongap, +}; + +void CShopScene::renderUi() +{ + int xbase,ybase; + SpriteBank *sb; + sFrameHdr *fh1,*fh2; + int x,y; + char buf[10]; + + xbase=fx; + ybase=fy; + sb=CGameScene::getSpriteBank(); + + m_font->setJustification(FontBank::JUST_LEFT); + + // Token count + fh1=sb->getFrameHeader(FRM__TOKEN); + x=xbase+shop.tokenx; + y=ybase+shop.tokeny; + sb->printFT4(fh1,x,y,0,0,0); + sprintf(buf,"x%d",99); +// x+=fh1->W+shop.gaptoreadout; +// y+=fh1->H+m_font->getStringHeight(buf); +PAUL_DBGMSG("%d,%d",fh1->H,m_font->getStringHeight(buf)); + m_font->print(x,y,buf); + + + // Item price + m_font->print(xbase+shop.pricex,ybase+shop.pricey,STR__SHOP_SCREEN__PRICE); + + + // Instructions + x=xbase+shop.instructionsx; + y=ybase+shop.instructionsy; + m_font->print(x,y,STR__SHOP_SCREEN__LEFT_RIGHT_TO_SELECT_ITEM); + fh1=sb->getFrameHeader(FRM__BUTL); + fh2=sb->getFrameHeader(FRM__BUTR); + x-=shop.instructionsbuttonspace+fh2->W; + y+=shop.instructionsbuttonyoffset; + sb->printFT4(fh2,x,y,0,0,0); + x-=shop.instructionsbuttongap+fh1->W; + sb->printFT4(fh1,x,y,0,0,0); + + x=xbase+shop.instructionsx; + y=ybase+shop.instructionsy+shop.instructionsygap; + m_font->print(x,y,STR__SHOP_SCREEN__CROSS_TO_PURCHASE); + fh1=sb->getFrameHeader(FRM__BUTX); + x-=shop.instructionsbuttonspace+fh2->W; + y+=shop.instructionsbuttonyoffset; + sb->printFT4(fh1,x,y,0,0,0); + + x=xbase+shop.instructionsx; + y=ybase+shop.instructionsy+(shop.instructionsygap*2); + m_font->print(x,y,STR__SHOP_SCREEN__TRIANGLE_TO_EXIT); + fh1=sb->getFrameHeader(FRM__BUTT); + x-=shop.instructionsbuttonspace+fh2->W; + y+=shop.instructionsbuttonyoffset; + sb->printFT4(fh1,x,y,0,0,0); + + m_guiFrame->render(); +} + + /*---------------------------------------------------------------------- Function: Purpose: diff --git a/source/shop/shop.h b/source/shop/shop.h index cab17da2e..fc803b758 100644 --- a/source/shop/shop.h +++ b/source/shop/shop.h @@ -46,6 +46,8 @@ public: private: + void renderUi(); + int isItemAvailableToBut(int _itemNumber); @@ -74,6 +76,9 @@ private: int m_readyToExit; unsigned char *m_image; + class CGUIGroupFrame *m_guiFrame; + + int m_currentlySelectedItem; int m_flashSin; diff --git a/users/paul/spongebob project/spongebob project.dsp b/users/paul/spongebob project/spongebob project.dsp index 6328470c1..93d84b048 100644 --- a/users/paul/spongebob project/spongebob project.dsp +++ b/users/paul/spongebob project/spongebob project.dsp @@ -516,6 +516,18 @@ SOURCE=..\..\..\source\friend\fsquid.cpp SOURCE=..\..\..\source\friend\fsquid.h # End Source File # End Group +# Begin Group "fma" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\..\..\source\fma\fma.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\source\fma\fma.h +# End Source File +# End Group # Begin Group "fmv" # PROP Default_Filter "" @@ -604,6 +616,82 @@ SOURCE=..\..\..\source\frontend\start.cpp SOURCE=..\..\..\source\frontend\start.h # End Source File # End Group +# Begin Group "fx" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\..\..\source\fx\fx.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\source\fx\fx.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\source\fx\fxbaseanim.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\source\fx\fxbaseanim.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\source\fx\fxbaseemitter.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\source\fx\fxbaseemitter.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\source\fx\fxbasetrail.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\source\fx\fxbasetrail.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\source\fx\fxbubble.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\source\fx\fxbubble.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\source\fx\fxfallingtile.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\source\fx\fxfallingtile.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\source\fx\fxjfish.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\source\fx\fxjfish.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\source\fx\fxnrgbar.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\source\fx\fxnrgbar.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\source\fx\fxsteam.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\source\fx\fxsteam.h +# End Source File +# End Group # Begin Group "game" # PROP Default_Filter "" @@ -1004,6 +1092,18 @@ SOURCE=..\..\..\source\hazard\hspikes.h SOURCE=..\..\..\source\hazard\hstatic.h # End Source File # End Group +# Begin Group "jellfish" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\..\..\source\jellfish\jellfish.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\source\jellfish\jellfish.h +# End Source File +# End Group # Begin Group "level" # PROP Default_Filter "" @@ -1776,6 +1876,18 @@ SOURCE=..\..\..\source\script\script.cpp SOURCE=..\..\..\source\script\script.h # End Source File # End Group +# Begin Group "shop" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\..\..\source\shop\shop.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\source\shop\shop.h +# End Source File +# End Group # Begin Group "sound" # PROP Default_Filter "" @@ -2128,94 +2240,6 @@ SOURCE=..\..\..\source\utils\utils.cpp SOURCE=..\..\..\source\utils\utils.h # End Source File # End Group -# Begin Group "fx" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\source\fx\fx.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\source\fx\fx.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\source\fx\fxbaseanim.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\source\fx\fxbaseanim.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\source\fx\fxbaseemitter.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\source\fx\fxbaseemitter.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\source\fx\fxbasetrail.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\source\fx\fxbasetrail.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\source\fx\fxbubble.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\source\fx\fxbubble.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\source\fx\fxfallingtile.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\source\fx\fxfallingtile.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\source\fx\fxjfish.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\source\fx\fxjfish.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\source\fx\fxnrgbar.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\source\fx\fxnrgbar.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\source\fx\fxsteam.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\source\fx\fxsteam.h -# End Source File -# End Group -# Begin Group "jellfish" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\source\jellfish\jellfish.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\source\jellfish\jellfish.h -# End Source File -# End Group # End Group # Begin Group "makefiles" @@ -2484,6 +2508,10 @@ SOURCE=..\..\..\out\USA\include\BigLump.h # End Source File # Begin Source File +SOURCE=..\..\..\out\USA\include\shop.h +# End Source File +# Begin Source File + SOURCE=..\..\..\out\USA\include\Sprites.h # End Source File # Begin Source File