This commit is contained in:
parent
6e15a583c0
commit
d4b15b57a2
@ -223,7 +223,8 @@ gui_src := gbubbles \
|
|||||||
greadout \
|
greadout \
|
||||||
gsprite \
|
gsprite \
|
||||||
gtextbox \
|
gtextbox \
|
||||||
gui
|
gui \
|
||||||
|
pointer
|
||||||
|
|
||||||
jellfish_src := jellfish
|
jellfish_src := jellfish
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ void CPointerIcon::render()
|
|||||||
fh=sb->getFrameHeader(FRM__MAPPOINTER);
|
fh=sb->getFrameHeader(FRM__MAPPOINTER);
|
||||||
x=m_pointerPos.vx-(fh->W/2);
|
x=m_pointerPos.vx-(fh->W/2);
|
||||||
y=m_pointerPos.vy-(fh->H/2);
|
y=m_pointerPos.vy-(fh->H/2);
|
||||||
ft4=sb->printFT4(fh,x,y,0,0,9);
|
ft4=sb->printFT4(fh,x,y,0,0,0);
|
||||||
if(!m_pointerArrivedAtTarget)
|
if(!m_pointerArrivedAtTarget)
|
||||||
{
|
{
|
||||||
setSemiTrans(ft4,true);
|
setSemiTrans(ft4,true);
|
||||||
|
@ -58,6 +58,10 @@
|
|||||||
#include "sound\sound.h"
|
#include "sound\sound.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __GUI_POINTER_H__
|
||||||
|
#include "gui\pointer.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Std Lib
|
/* Std Lib
|
||||||
------- */
|
------- */
|
||||||
@ -195,8 +199,9 @@ void CMapScene::init()
|
|||||||
m_currentChapterSelection=s_chapterToStartOn;
|
m_currentChapterSelection=s_chapterToStartOn;
|
||||||
generateMapScreenImage();
|
generateMapScreenImage();
|
||||||
m_currentLevelSelection=s_levelToStartOn;
|
m_currentLevelSelection=s_levelToStartOn;
|
||||||
m_pointerPos=getPointerTargetPosition();
|
|
||||||
m_pointerArrivedAtTarget=true;
|
m_pointerIcon=new ("MapPointer") CPointerIcon();
|
||||||
|
m_pointerIcon->snapToTarget(getPointerTargetPosition());
|
||||||
|
|
||||||
SetScreenImage((u8*)m_screenImage);
|
SetScreenImage((u8*)m_screenImage);
|
||||||
|
|
||||||
@ -214,6 +219,7 @@ void CMapScene::init()
|
|||||||
void CMapScene::shutdown()
|
void CMapScene::shutdown()
|
||||||
{
|
{
|
||||||
ClearScreenImage();
|
ClearScreenImage();
|
||||||
|
delete m_pointerIcon;
|
||||||
MemFree(m_screenImage);
|
MemFree(m_screenImage);
|
||||||
m_font->dump(); delete m_font;
|
m_font->dump(); delete m_font;
|
||||||
}
|
}
|
||||||
@ -232,6 +238,8 @@ void CMapScene::render()
|
|||||||
int i;
|
int i;
|
||||||
char buf[100];
|
char buf[100];
|
||||||
|
|
||||||
|
m_pointerIcon->render();
|
||||||
|
|
||||||
sb=CGameScene::getSpriteBank();
|
sb=CGameScene::getSpriteBank();
|
||||||
level=&s_mapLevelData[m_currentChapterSelection][0];
|
level=&s_mapLevelData[m_currentChapterSelection][0];
|
||||||
|
|
||||||
@ -271,7 +279,6 @@ void CMapScene::render()
|
|||||||
level++;
|
level++;
|
||||||
}
|
}
|
||||||
|
|
||||||
renderPointer();
|
|
||||||
renderInstructions();
|
renderInstructions();
|
||||||
|
|
||||||
|
|
||||||
@ -283,28 +290,6 @@ m_font->print(25,25,buf);
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------
|
|
||||||
Function:
|
|
||||||
Purpose:
|
|
||||||
Params:
|
|
||||||
Returns:
|
|
||||||
---------------------------------------------------------------------- */
|
|
||||||
void CMapScene::renderPointer()
|
|
||||||
{
|
|
||||||
SpriteBank *sb;
|
|
||||||
sFrameHdr *fh;
|
|
||||||
POLY_FT4 *ft4;
|
|
||||||
|
|
||||||
sb=CGameScene::getSpriteBank();
|
|
||||||
fh=sb->getFrameHeader(FRM__MAPPOINTER);
|
|
||||||
ft4=sb->printFT4(fh,m_pointerPos.vx-(fh->W/2),m_pointerPos.vy-(fh->H/2),0,0,9);
|
|
||||||
if(!m_pointerArrivedAtTarget)
|
|
||||||
{
|
|
||||||
setSemiTrans(ft4,true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------
|
/*----------------------------------------------------------------------
|
||||||
Function:
|
Function:
|
||||||
Purpose:
|
Purpose:
|
||||||
@ -428,6 +413,7 @@ void CMapScene::think(int _frames)
|
|||||||
if(--m_currentLevelSelection<0)m_currentLevelSelection=MAP_NUM_LEVELS_PER_CHAPTER-1;
|
if(--m_currentLevelSelection<0)m_currentLevelSelection=MAP_NUM_LEVELS_PER_CHAPTER-1;
|
||||||
}
|
}
|
||||||
while(!isLevelOpen(m_currentChapterSelection,m_currentLevelSelection));
|
while(!isLevelOpen(m_currentChapterSelection,m_currentLevelSelection));
|
||||||
|
m_pointerIcon->setTarget(getPointerTargetPosition());
|
||||||
}
|
}
|
||||||
else if(pad&PAD_RIGHT)
|
else if(pad&PAD_RIGHT)
|
||||||
{
|
{
|
||||||
@ -436,22 +422,24 @@ void CMapScene::think(int _frames)
|
|||||||
if(++m_currentLevelSelection>=MAP_NUM_LEVELS_PER_CHAPTER)m_currentLevelSelection=0;
|
if(++m_currentLevelSelection>=MAP_NUM_LEVELS_PER_CHAPTER)m_currentLevelSelection=0;
|
||||||
}
|
}
|
||||||
while(!isLevelOpen(m_currentChapterSelection,m_currentLevelSelection));
|
while(!isLevelOpen(m_currentChapterSelection,m_currentLevelSelection));
|
||||||
|
m_pointerIcon->setTarget(getPointerTargetPosition());
|
||||||
}
|
}
|
||||||
if(lastLevel!=m_currentLevelSelection)
|
if(lastLevel!=m_currentLevelSelection)
|
||||||
{
|
{
|
||||||
CSoundMediator::playSfx(CSoundMediator::SFX_FRONT_END__MOVE_CURSOR);
|
CSoundMediator::playSfx(CSoundMediator::SFX_FRONT_END__MOVE_CURSOR);
|
||||||
m_pointerArrivedAtTarget=false;
|
// m_pointerArrivedAtTarget=false;
|
||||||
m_pointerSin=0;
|
// m_pointerSin=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calc where the pointer should be
|
// Calc where the pointer should be
|
||||||
if(m_pointerArrivedAtTarget)
|
// if(m_pointerArrivedAtTarget)
|
||||||
{
|
// {
|
||||||
m_pointerSin=(m_pointerSin+(_frames*70))&4095;
|
// m_pointerSin=(m_pointerSin+(_frames*70))&4095;
|
||||||
}
|
// }
|
||||||
m_pointerTarget=getPointerTargetPosition();
|
// m_pointerIcon->setTarget(getPointerTargetPosition());
|
||||||
|
|
||||||
// Move the pointer
|
// Move the pointer
|
||||||
|
/*
|
||||||
for(int i=0;i<_frames;i++)
|
for(int i=0;i<_frames;i++)
|
||||||
{
|
{
|
||||||
int delta;
|
int delta;
|
||||||
@ -488,8 +476,10 @@ void CMapScene::think(int _frames)
|
|||||||
m_pointerArrivedAtTarget=true;
|
m_pointerArrivedAtTarget=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
m_pointerIcon->think(_frames);
|
||||||
|
|
||||||
if(m_pointerArrivedAtTarget&&
|
if(m_pointerIcon->canPointerSelect()&&
|
||||||
pad&PAD_CROSS)
|
pad&PAD_CROSS)
|
||||||
{
|
{
|
||||||
CSoundMediator::playSfx(CSoundMediator::SFX_FRONT_END__OK);
|
CSoundMediator::playSfx(CSoundMediator::SFX_FRONT_END__OK);
|
||||||
@ -535,8 +525,9 @@ void CMapScene::generateMapScreenImage()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_pointerPos=getPointerTargetPosition();
|
m_pointerIcon->snapToTarget(getPointerTargetPosition());
|
||||||
m_pointerArrivedAtTarget=true;
|
// m_pointerPos=getPointerTargetPosition();
|
||||||
|
// m_pointerArrivedAtTarget=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -578,7 +569,7 @@ DVECTOR CMapScene::getPointerTargetPosition()
|
|||||||
|
|
||||||
pos=s_mapLevelPositions[m_currentLevelSelection];
|
pos=s_mapLevelPositions[m_currentLevelSelection];
|
||||||
pos.vx+=(MAP_LEVEL_WIDTH/2);
|
pos.vx+=(MAP_LEVEL_WIDTH/2);
|
||||||
pos.vy+=MAP_LEVEL_HEIGHT;//+(msin(m_pointerSin)*4>>12);
|
pos.vy+=MAP_LEVEL_HEIGHT;
|
||||||
|
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
@ -104,10 +104,7 @@ private:
|
|||||||
|
|
||||||
int m_currentChapterSelection;
|
int m_currentChapterSelection;
|
||||||
int m_currentLevelSelection;
|
int m_currentLevelSelection;
|
||||||
DVECTOR m_pointerPos;
|
class CPointerIcon *m_pointerIcon;
|
||||||
DVECTOR m_pointerTarget;
|
|
||||||
int m_pointerSin;
|
|
||||||
int m_pointerArrivedAtTarget;
|
|
||||||
|
|
||||||
static sMapLevelData s_mapLevelData[MAP_NUM_CHAPTERS][MAP_NUM_LEVELS_PER_CHAPTER];
|
static sMapLevelData s_mapLevelData[MAP_NUM_CHAPTERS][MAP_NUM_LEVELS_PER_CHAPTER];
|
||||||
static DVECTOR s_mapLevelPositions[MAP_NUM_LEVELS_PER_CHAPTER];
|
static DVECTOR s_mapLevelPositions[MAP_NUM_LEVELS_PER_CHAPTER];
|
||||||
|
@ -78,6 +78,10 @@
|
|||||||
#include "backend\party.h"
|
#include "backend\party.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __GUI_POINTER_H__
|
||||||
|
#include "gui\pointer.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Std Lib
|
/* Std Lib
|
||||||
------- */
|
------- */
|
||||||
@ -205,6 +209,9 @@ void CShopScene::init()
|
|||||||
m_state=SHOP_STATE__FADING_IN;
|
m_state=SHOP_STATE__FADING_IN;
|
||||||
|
|
||||||
m_mainUiYOffset=SHOP_STATE__SELECT_ITEM;
|
m_mainUiYOffset=SHOP_STATE__SELECT_ITEM;
|
||||||
|
|
||||||
|
m_pointerIcon=new ("MapPointer") CPointerIcon();
|
||||||
|
m_pointerIcon->snapToTarget(getPointerTarget());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -216,6 +223,8 @@ void CShopScene::init()
|
|||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
void CShopScene::shutdown()
|
void CShopScene::shutdown()
|
||||||
{
|
{
|
||||||
|
delete m_pointerIcon;
|
||||||
|
|
||||||
m_guiCannotAffordFrame->shutdown();
|
m_guiCannotAffordFrame->shutdown();
|
||||||
m_guiConfirmPurchaseFrame->shutdown();
|
m_guiConfirmPurchaseFrame->shutdown();
|
||||||
m_guiFrame->shutdown();
|
m_guiFrame->shutdown();
|
||||||
@ -259,9 +268,7 @@ void CShopScene::render()
|
|||||||
{
|
{
|
||||||
if(m_state==SHOP_STATE__SELECT_ITEM)
|
if(m_state==SHOP_STATE__SELECT_ITEM)
|
||||||
{
|
{
|
||||||
SpriteBank *sb=CGameScene::getSpriteBank();
|
m_pointerIcon->render();
|
||||||
sFrameHdr *fh=sb->getFrameHeader(FRM__MAPPOINTER);
|
|
||||||
sb->printFT4(fh,x-fh->W,y+30,0,0,5);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flash selected item
|
// Flash selected item
|
||||||
@ -289,6 +296,41 @@ void CShopScene::render()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Function:
|
||||||
|
Purpose:
|
||||||
|
Params:
|
||||||
|
Returns:
|
||||||
|
---------------------------------------------------------------------- */
|
||||||
|
DVECTOR CShopScene::getPointerTarget()
|
||||||
|
{
|
||||||
|
int i,x,y,gap;
|
||||||
|
|
||||||
|
x=SHOP_ICON_XBASE;
|
||||||
|
y=SHOP_ICON_YBASE;
|
||||||
|
gap=SHOP_ICON_WIDTH/(SHOP_ICON_ITEMS_PER_ROW-1);
|
||||||
|
|
||||||
|
for(i=0;i<NUM_SHOP_ITEM_IDS;i++)
|
||||||
|
{
|
||||||
|
if(i==m_currentlySelectedItem)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(i%SHOP_ICON_ITEMS_PER_ROW==SHOP_ICON_ITEMS_PER_ROW-1)
|
||||||
|
{
|
||||||
|
x=SHOP_ICON_XBASE;
|
||||||
|
y+=SHOP_ICON_Y_GAP;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
x+=gap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DVECTOR ret={x-5,y+30};
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/*----------------------------------------------------------------------
|
/*----------------------------------------------------------------------
|
||||||
Function:
|
Function:
|
||||||
@ -309,6 +351,8 @@ void CShopScene::think(int _frames)
|
|||||||
{
|
{
|
||||||
int pad;
|
int pad;
|
||||||
|
|
||||||
|
m_pointerIcon->think(_frames);
|
||||||
|
|
||||||
pad=PadGetDown(0);
|
pad=PadGetDown(0);
|
||||||
if(pad&PAD_LEFT)
|
if(pad&PAD_LEFT)
|
||||||
{
|
{
|
||||||
@ -319,6 +363,7 @@ void CShopScene::think(int _frames)
|
|||||||
}
|
}
|
||||||
m_flashSin=0;
|
m_flashSin=0;
|
||||||
playSound(CSoundMediator::SFX_FRONT_END__MOVE_CURSOR);
|
playSound(CSoundMediator::SFX_FRONT_END__MOVE_CURSOR);
|
||||||
|
m_pointerIcon->setTarget(getPointerTarget());
|
||||||
}
|
}
|
||||||
else if(pad&PAD_RIGHT)
|
else if(pad&PAD_RIGHT)
|
||||||
{
|
{
|
||||||
@ -329,8 +374,9 @@ void CShopScene::think(int _frames)
|
|||||||
}
|
}
|
||||||
m_flashSin=0;
|
m_flashSin=0;
|
||||||
playSound(CSoundMediator::SFX_FRONT_END__MOVE_CURSOR);
|
playSound(CSoundMediator::SFX_FRONT_END__MOVE_CURSOR);
|
||||||
|
m_pointerIcon->setTarget(getPointerTarget());
|
||||||
}
|
}
|
||||||
else if(pad&PAD_CROSS)
|
else if(m_pointerIcon->canPointerSelect()&&pad&PAD_CROSS)
|
||||||
{
|
{
|
||||||
if(isItemAvailableToBuy(m_currentlySelectedItem))
|
if(isItemAvailableToBuy(m_currentlySelectedItem))
|
||||||
{
|
{
|
||||||
|
@ -22,6 +22,10 @@
|
|||||||
#include "system\gstate.h"
|
#include "system\gstate.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef _GLOBAL_HEADER_
|
||||||
|
#include "system\global.h" // Doh.. just for DVECTOR :/
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Std Lib
|
/* Std Lib
|
||||||
------- */
|
------- */
|
||||||
@ -62,6 +66,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void renderUi();
|
void renderUi();
|
||||||
|
DVECTOR getPointerTarget();
|
||||||
|
|
||||||
int isItemAvailableToBuy(int _itemNumber);
|
int isItemAvailableToBuy(int _itemNumber);
|
||||||
void playSound(int _sfxId);
|
void playSound(int _sfxId);
|
||||||
@ -158,6 +163,9 @@ private:
|
|||||||
};
|
};
|
||||||
int m_mainUiYOffset;
|
int m_mainUiYOffset;
|
||||||
|
|
||||||
|
|
||||||
|
class CPointerIcon *m_pointerIcon;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -923,6 +923,14 @@ SOURCE=..\..\..\source\gui\gui.cpp
|
|||||||
|
|
||||||
SOURCE=..\..\..\source\gui\gui.h
|
SOURCE=..\..\..\source\gui\gui.h
|
||||||
# End Source File
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\..\source\gui\pointer.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\..\source\gui\pointer.h
|
||||||
|
# End Source File
|
||||||
# End Group
|
# End Group
|
||||||
# Begin Group "hazard"
|
# Begin Group "hazard"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user