This commit is contained in:
parent
fdebc2da27
commit
2668b7ca7a
20 changed files with 352 additions and 41 deletions
|
@ -89,7 +89,9 @@ eng=FIRE
|
|||
[STR__FRONTEND__CATCH]
|
||||
eng=CATCH
|
||||
[STR__FRONTEND__WEAPONCHANGE]
|
||||
eng=CHANGE WEAPON
|
||||
eng=WEAPON
|
||||
[STR__FRONTEND__VIBRATION]
|
||||
eng=VIBRATION
|
||||
|
||||
; Screen menu
|
||||
[STR__FRONTEND__HORIZONTAL_POSITION]
|
||||
|
|
|
@ -244,7 +244,8 @@ memcard_src := md5 \
|
|||
memcard \
|
||||
saveload
|
||||
|
||||
pad_src := pads
|
||||
pad_src := pads \
|
||||
vibe
|
||||
|
||||
paul_src := paul \
|
||||
scenesel \
|
||||
|
|
|
@ -13,6 +13,10 @@
|
|||
|
||||
#include "enemy\npc.h"
|
||||
|
||||
#ifndef __PAD_VIBE_H__
|
||||
#include "pad\vibe.h"
|
||||
#endif
|
||||
|
||||
#ifndef __LEVEL_LEVEL_H__
|
||||
#include "level\level.h"
|
||||
#endif
|
||||
|
@ -871,6 +875,7 @@ void CNpcEnemy::drawAttackEffect()
|
|||
thwakPos.vy = ( rect.y1 + rect.y2 ) >> 1;
|
||||
|
||||
CFX::Create( CFX::FX_TYPE_THWACK, thwakPos );
|
||||
CPadVibrationManager::setVibration(0,CPadVibrationManager::VIBE_CHOP);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -66,6 +66,10 @@
|
|||
#include "sound\sound.h"
|
||||
#endif
|
||||
|
||||
#ifndef __PAD_VIBE_H__
|
||||
#include "pad\vibe.h"
|
||||
#endif
|
||||
|
||||
|
||||
/* Std Lib
|
||||
------- */
|
||||
|
@ -108,6 +112,18 @@ CGUITextReadout::TextReadoutData CFrontEndOptions::s_controlStyleReadoutText[CPa
|
|||
};
|
||||
|
||||
|
||||
int CFrontEndOptions::s_vibrationValues[2+1]=
|
||||
{
|
||||
false,true,
|
||||
-1
|
||||
};
|
||||
CGUITextReadout::TextReadoutData CFrontEndOptions::s_vibrationReadoutText[2]=
|
||||
{
|
||||
{ false,STR__OFF },
|
||||
{ true,STR__ON },
|
||||
};
|
||||
|
||||
|
||||
int CFrontEndOptions::s_buttonOrder[]=
|
||||
{
|
||||
CPadConfig::PAD_CFG_UP,
|
||||
|
@ -255,20 +271,20 @@ void CFrontEndOptions::init()
|
|||
|
||||
// Populate CONTROLS menu
|
||||
CGUIFactory::createCycleButtonFrame(m_modeMenus[MODE__CONTROL],
|
||||
X_BORDER,Y_BORDER,OPTIONS_FRAME_W-(X_BORDER*2),40,
|
||||
X_BORDER,Y_BORDER,OPTIONS_FRAME_W-(X_BORDER*2),25,
|
||||
STR__FRONTEND__CONTROL_STYLE,
|
||||
&m_controlStyle,s_controlStyleValues,s_controlStyleReadoutText);
|
||||
fr=new ("frame") CGUIGroupFrame();
|
||||
fr->init(m_modeMenus[MODE__CONTROL]);
|
||||
fr->setObjectXYWH(X_BORDER*2,55,OPTIONS_FRAME_W-(X_BORDER*4),60); //292
|
||||
fr->setObjectXYWH(X_BORDER,40,OPTIONS_FRAME_W-(X_BORDER*2),60); //292
|
||||
sr=new ("spritereadout") CGUISpriteReadout();
|
||||
sr->init(fr);
|
||||
sr->setObjectXYWH(0,0,26,15); //146
|
||||
sr->setObjectXYWH(0,0,26,15); //176
|
||||
sr->setReadoutTarget(&m_controlIcons[CONTROL_UP]);
|
||||
sr->setReadoutData(s_controlReadoutSprites);
|
||||
tb=new ("textbox") CGUITextBox();
|
||||
tb->init(fr);
|
||||
tb->setObjectXYWH(26,0,120,15);
|
||||
tb->setObjectXYWH(26,0,150,15);
|
||||
tb->setText(STR__FRONTEND__UP);
|
||||
sr=new ("spritereadout") CGUISpriteReadout();
|
||||
sr->init(fr);
|
||||
|
@ -277,7 +293,7 @@ void CFrontEndOptions::init()
|
|||
sr->setReadoutData(s_controlReadoutSprites);
|
||||
tb=new ("textbox") CGUITextBox();
|
||||
tb->init(fr);
|
||||
tb->setObjectXYWH(26,15,120,15);
|
||||
tb->setObjectXYWH(26,15,150,15);
|
||||
tb->setText(STR__FRONTEND__DOWN);
|
||||
sr=new ("spritereadout") CGUISpriteReadout();
|
||||
sr->init(fr);
|
||||
|
@ -286,7 +302,7 @@ void CFrontEndOptions::init()
|
|||
sr->setReadoutData(s_controlReadoutSprites);
|
||||
tb=new ("textbox") CGUITextBox();
|
||||
tb->init(fr);
|
||||
tb->setObjectXYWH(26,30,120,15);
|
||||
tb->setObjectXYWH(26,30,150,15);
|
||||
tb->setText(STR__FRONTEND__LEFT);
|
||||
sr=new ("spritereadout") CGUISpriteReadout();
|
||||
sr->init(fr);
|
||||
|
@ -295,44 +311,48 @@ void CFrontEndOptions::init()
|
|||
sr->setReadoutData(s_controlReadoutSprites);
|
||||
tb=new ("textbox") CGUITextBox();
|
||||
tb->init(fr);
|
||||
tb->setObjectXYWH(26,45,120,15);
|
||||
tb->setObjectXYWH(26,45,150,15);
|
||||
tb->setText(STR__FRONTEND__RIGHT);
|
||||
sr=new ("spritereadout") CGUISpriteReadout();
|
||||
sr->init(fr);
|
||||
sr->setObjectXYWH(146,0,26,15);
|
||||
sr->setObjectXYWH(176,0,26,15);
|
||||
sr->setReadoutTarget(&m_controlIcons[CONTROL_JUMP]);
|
||||
sr->setReadoutData(s_controlReadoutSprites);
|
||||
tb=new ("textbox") CGUITextBox();
|
||||
tb->init(fr);
|
||||
tb->setObjectXYWH(146+26,0,120,15);
|
||||
tb->setObjectXYWH(176+26,0,150,15);
|
||||
tb->setText(STR__FRONTEND__JUMP);
|
||||
sr=new ("spritereadout") CGUISpriteReadout();
|
||||
sr->init(fr);
|
||||
sr->setObjectXYWH(146,15,26,15);
|
||||
sr->setObjectXYWH(176,15,26,15);
|
||||
sr->setReadoutTarget(&m_controlIcons[CONTROL_FIRE]);
|
||||
sr->setReadoutData(s_controlReadoutSprites);
|
||||
tb=new ("textbox") CGUITextBox();
|
||||
tb->init(fr);
|
||||
tb->setObjectXYWH(146+26,15,120,15);
|
||||
tb->setObjectXYWH(176+26,15,150,15);
|
||||
tb->setText(STR__FRONTEND__FIRE);
|
||||
sr=new ("spritereadout") CGUISpriteReadout();
|
||||
sr->init(fr);
|
||||
sr->setObjectXYWH(146,30,26,15);
|
||||
sr->setObjectXYWH(176,30,26,15);
|
||||
sr->setReadoutTarget(&m_controlIcons[CONTROL_CATCH]);
|
||||
sr->setReadoutData(s_controlReadoutSprites);
|
||||
tb=new ("textbox") CGUITextBox();
|
||||
tb->init(fr);
|
||||
tb->setObjectXYWH(146+26,30,120,15);
|
||||
tb->setObjectXYWH(176+26,30,150,15);
|
||||
tb->setText(STR__FRONTEND__CATCH);
|
||||
sr=new ("spritereadout") CGUISpriteReadout();
|
||||
sr->init(fr);
|
||||
sr->setObjectXYWH(146,45,26,15);
|
||||
sr->setObjectXYWH(176,45,26,15);
|
||||
sr->setReadoutTarget(&m_controlIcons[CONTROL_WEAPONCHANGE]);
|
||||
sr->setReadoutData(s_controlReadoutSprites);
|
||||
tb=new ("textbox") CGUITextBox();
|
||||
tb->init(fr);
|
||||
tb->setObjectXYWH(146+26,45,120,15);
|
||||
tb->setObjectXYWH(176+26,45,150,15);
|
||||
tb->setText(STR__FRONTEND__WEAPONCHANGE);
|
||||
CGUIFactory::createCycleButtonFrame(m_modeMenus[MODE__CONTROL],
|
||||
X_BORDER,Y_BORDER+90,OPTIONS_FRAME_W-(X_BORDER*2),25,
|
||||
STR__FRONTEND__VIBRATION,
|
||||
&m_vibrationStatus,s_vibrationValues,s_vibrationReadoutText);
|
||||
|
||||
|
||||
// Populate SCREEN menu
|
||||
|
@ -372,6 +392,7 @@ void CFrontEndOptions::init()
|
|||
m_sfxVolume=CSoundMediator::getVolume(CSoundMediator::VOL_SFX);
|
||||
m_speechVolume=CSoundMediator::getVolume(CSoundMediator::VOL_SPEECH);
|
||||
m_controlStyle=CPadConfig::getConfig();
|
||||
m_vibrationStatus=m_lastVibrationStatus=PadGetVibrationIsTurnedOn(0);
|
||||
m_screenXOff=VidGetXOfs();
|
||||
m_screenYOff=VidGetYOfs();
|
||||
}
|
||||
|
@ -487,7 +508,19 @@ void CFrontEndOptions::think(int _frames)
|
|||
}
|
||||
m_modeMenus[m_mode]->think(_frames);
|
||||
|
||||
if(m_mode==MODE__SOUND)
|
||||
if(m_mode==MODE__CONTROL)
|
||||
{
|
||||
if(m_vibrationStatus!=m_lastVibrationStatus)
|
||||
{
|
||||
m_lastVibrationStatus=m_vibrationStatus;
|
||||
PadSetVibrationIsTurnedOn(0,m_vibrationStatus);
|
||||
if(m_vibrationStatus==true)
|
||||
{
|
||||
CPadVibrationManager::setVibration(0,CPadVibrationManager::VIBE_MEDIUM);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(m_mode==MODE__SOUND)
|
||||
{
|
||||
if(m_bgmVolume!=CSoundMediator::getVolume(CSoundMediator::VOL_SONG))
|
||||
{
|
||||
|
|
|
@ -114,12 +114,16 @@ private:
|
|||
int m_sfxVolume;
|
||||
int m_speechVolume;
|
||||
int m_controlStyle;
|
||||
int m_vibrationStatus,m_lastVibrationStatus;
|
||||
int m_screenXOff;
|
||||
int m_screenYOff;
|
||||
|
||||
static int s_controlStyleValues[];
|
||||
static CGUITextReadout::TextReadoutData s_controlStyleReadoutText[];
|
||||
|
||||
static int s_vibrationValues[];
|
||||
static CGUITextReadout::TextReadoutData s_vibrationReadoutText[];
|
||||
|
||||
static int s_buttonOrder[];
|
||||
int m_controlIcons[CONTROL_COUNT];
|
||||
static CGUISpriteReadout::SpriteReadoutData s_controlReadoutSprites[ICON_COUNT];
|
||||
|
|
|
@ -241,13 +241,15 @@ bool Finished=false;
|
|||
/*****************************************************************************/
|
||||
void CLevel::DisplayLoadingScreen(sLvlTab *lvlTab)
|
||||
{
|
||||
FontBank font;
|
||||
char buf[256];
|
||||
u8 *s_image;
|
||||
int i;
|
||||
ScalableFontBank font;
|
||||
char buf[256];
|
||||
u8 *s_image;
|
||||
int i;
|
||||
|
||||
font.initialise(&standardFont);
|
||||
font.setJustification(FontBank::JUST_CENTRE);
|
||||
font.setScale(370);
|
||||
|
||||
sprintf(buf,"%s\n\n%s",TranslationDatabase::getString(lvlTab->ChapterLoadingText),TranslationDatabase::getString(lvlTab->LevelLoadingText));
|
||||
s_image=CFileIO::loadFile(loadingScreens[lvlTab->Chapter-1]);
|
||||
ASSERT(s_image);
|
||||
|
@ -255,16 +257,16 @@ int i;
|
|||
for(i=0;i<2;i++)
|
||||
{
|
||||
font.setColour(255,255,255);
|
||||
font.print(256 ,100 ,buf);
|
||||
font.print(256 ,90 ,buf);
|
||||
font.setColour(0,0,0);
|
||||
font.print(256-1,100-1,buf);
|
||||
font.print(256-1,100 ,buf);
|
||||
font.print(256-1,100+1,buf);
|
||||
font.print(256 ,100-1,buf);
|
||||
font.print(256 ,100+1,buf);
|
||||
font.print(256+1,100-1,buf);
|
||||
font.print(256+1,100 ,buf);
|
||||
font.print(256+1,100+1,buf);
|
||||
font.print(256-1,90-1,buf);
|
||||
font.print(256-1,90 ,buf);
|
||||
font.print(256-1,90+1,buf);
|
||||
font.print(256 ,90-1,buf);
|
||||
font.print(256 ,90+1,buf);
|
||||
font.print(256+1,90-1,buf);
|
||||
font.print(256+1,90 ,buf);
|
||||
font.print(256+1,90+1,buf);
|
||||
PrimDisplay();
|
||||
VSync(0);
|
||||
VidSwapDraw();
|
||||
|
|
|
@ -42,6 +42,10 @@
|
|||
#include <biglump.h>
|
||||
#endif
|
||||
|
||||
#ifndef __PAD_PADS_H__
|
||||
#include "pad\pads.h"
|
||||
#endif
|
||||
|
||||
|
||||
/* Std Lib
|
||||
------- */
|
||||
|
@ -455,6 +459,8 @@ void CSaveLoadDatabase::createData()
|
|||
{
|
||||
m_dataBuffer.m_systemDetails.m_volumes[i]=CSoundMediator::getVolume((CSoundMediator::VOLUMETYPE)i);
|
||||
}
|
||||
m_dataBuffer.m_systemDetails.m_controlStyle=CPadConfig::getConfig();;
|
||||
m_dataBuffer.m_systemDetails.m_vibrationIsTurnedOn=PadGetVibrationIsTurnedOn(0);
|
||||
m_dataBuffer.m_systemDetails.m_language=(char)TranslationDatabase::getLanguage();
|
||||
|
||||
// Game slots
|
||||
|
@ -481,6 +487,8 @@ void CSaveLoadDatabase::restoreData()
|
|||
{
|
||||
CSoundMediator::setVolume((CSoundMediator::VOLUMETYPE)i,m_dataBuffer.m_systemDetails.m_volumes[i]);
|
||||
}
|
||||
CPadConfig::setConfig(m_dataBuffer.m_systemDetails.m_controlStyle);
|
||||
PadSetVibrationIsTurnedOn(0,m_dataBuffer.m_systemDetails.m_vibrationIsTurnedOn);
|
||||
if(!TranslationDatabase::isLoaded())
|
||||
{
|
||||
TranslationDatabase::loadLanguage(m_dataBuffer.m_systemDetails.m_language);
|
||||
|
|
|
@ -42,6 +42,7 @@ struct SaveLoad_SystemDetails
|
|||
{
|
||||
char m_screenOffX,m_screenOffY;
|
||||
unsigned char m_volumes[CSoundMediator::NUM_VOLUMETYPES];
|
||||
unsigned char m_controlStyle,m_vibrationIsTurnedOn;
|
||||
unsigned char m_language;
|
||||
};
|
||||
|
||||
|
|
|
@ -10,6 +10,10 @@
|
|||
#include "system\gstate.h"
|
||||
#endif
|
||||
|
||||
#ifndef __PAD_VIBE_H__
|
||||
#include "pad\vibe.h"
|
||||
#endif
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
// Yay! Automatic key-repeat stuff!
|
||||
|
@ -25,6 +29,15 @@ u8 PadAlign[6]={0,1,0xFF,0xFF,0xFF,0xFF};
|
|||
u8 PadMotor[2][2];
|
||||
int PadRepeatTimers[2][16];
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int m_vibrationTurnedOn;
|
||||
u8 m_intensityValue;
|
||||
} PadVibeData;
|
||||
static PadVibeData s_padVibeData[2]={{false,0},{false,0}};
|
||||
int PadVibrationActive[2]={false,false};
|
||||
u8 PadVibrationIntensityValues[2];
|
||||
|
||||
/*****************************************************************************/
|
||||
// 701
|
||||
// 6 2
|
||||
|
@ -51,6 +64,10 @@ u16 PADAngeDirTable[16]=
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
void VibrationHandler(int _port);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
void PadInitShock(int Port)
|
||||
{
|
||||
int offs,maxID,set;
|
||||
|
@ -192,6 +209,7 @@ void ReadController(int Port)
|
|||
u8 *PadBuf=&PadBuffer[Port][0];
|
||||
sPadData *Pad=&PadData[Port];
|
||||
int PortShift=Port<<4;
|
||||
int intensity;
|
||||
|
||||
Pad->IsAnalogue=0;
|
||||
Pad->Status=PadGetState(PortShift);
|
||||
|
@ -232,8 +250,9 @@ int PortShift=Port<<4;
|
|||
break;
|
||||
|
||||
case PsxPadTypeStandard: // Standard Sony PAD controller
|
||||
// Pad->Motor0=PadMotor[Port][0];
|
||||
// Pad->Motor1=PadMotor[Port][1];
|
||||
intensity=s_padVibeData[Port].m_intensityValue;
|
||||
Pad->Motor0=intensity&1;
|
||||
Pad->Motor1=intensity&0xff;
|
||||
Pad2Digital(Pad);
|
||||
break;
|
||||
|
||||
|
@ -246,8 +265,9 @@ int PortShift=Port<<4;
|
|||
Pad->IsAnalogue=1;
|
||||
|
||||
// Set vibration values ( motor 0 is 0..1, motor 1 is 0..255 )
|
||||
// Pad->Motor0 = s_vibData[ Port ].CurrentIntensityValue & 1;
|
||||
// Pad->Motor1 = (s_vibData[ Port ].CurrentIntensityValue >> 1) & 0xff;
|
||||
intensity=s_padVibeData[Port].m_intensityValue;
|
||||
Pad->Motor0=intensity&1;
|
||||
Pad->Motor1=intensity&0xff;
|
||||
|
||||
Pad2Digital(Pad);
|
||||
break;
|
||||
|
@ -366,6 +386,9 @@ void PadUpdate()
|
|||
|
||||
UpdateRepeats(0);
|
||||
UpdateRepeats(1);
|
||||
|
||||
VibrationHandler(0);
|
||||
VibrationHandler(1);
|
||||
}
|
||||
|
||||
|
||||
|
@ -384,6 +407,41 @@ bool PadIsConnected(int port)
|
|||
return pad->Status!=PadStateDiscon&&pad->Type;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void PadSetVibrationIsTurnedOn(int _port,int _status)
|
||||
{
|
||||
s_padVibeData[_port].m_vibrationTurnedOn=_status;
|
||||
}
|
||||
int PadGetVibrationIsTurnedOn(int _port)
|
||||
{
|
||||
return s_padVibeData[_port].m_vibrationTurnedOn;
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function: VibrationHandler
|
||||
Purpose:
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void VibrationHandler(int _port)
|
||||
{
|
||||
PadVibeData *pvd;
|
||||
int i;
|
||||
|
||||
pvd=s_padVibeData;
|
||||
for(i=0;i<2;i++)
|
||||
{
|
||||
pvd->m_intensityValue=pvd->m_vibrationTurnedOn?CPadVibrationManager::getCurrentVibrationIntensity(i):0;
|
||||
pvd++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
int CPadConfig::s_configNumber=-1;
|
||||
|
|
|
@ -93,12 +93,12 @@ u16 PadGetPadAngle(u16 Pad, s16 angleAdjust);
|
|||
|
||||
bool PadIsConnected(int port);
|
||||
|
||||
bool PAD_IsRumbling( int port );
|
||||
void PAD_SetVibrationEnvelope( int Port, int count, const VIBE_DATA * data, int ferocity=255 );
|
||||
|
||||
void PadSetVibrationIsTurnedOn(int _port,int _status);
|
||||
int PadGetVibrationIsTurnedOn(int _port);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
class CPadConfig
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -18,6 +18,10 @@
|
|||
|
||||
#include "pad\vibe.h"
|
||||
|
||||
#ifndef __UTILS_HEADER__
|
||||
#include "utils\utils.h"
|
||||
#endif
|
||||
|
||||
|
||||
/* Std Lib
|
||||
------- */
|
||||
|
@ -41,13 +45,137 @@
|
|||
Vars
|
||||
---- */
|
||||
|
||||
s16 s_vibe_short[]= { 64,128,255,255,255,255,128, 64,-1 };
|
||||
s16 s_vibe_medium[]= { 64,128,255,255,255,255,255,255,255,255,255,255,255,255, 64,128,-1 };
|
||||
s16 s_vibe_long[]= { 64,128,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,128, 64,-1 };
|
||||
s16 s_vibe_long_strobey[]= { 64, 64, 64, 64,128,128,128,128,255,255,255,255,128,128,128,128, 64, 64, 64, 64,128,128,128,128,255,255,255,255,128,128,128,128, 64, 64, 64, 64,128,128,128,128,255,255,255,255,128,128,128,128, 64, 64, 64, 64,-1 };
|
||||
s16 s_vibe_coral_blower_suck[]= { 20, 40, 15, 50, 30, 40,-1 };
|
||||
s16 s_vibe_chop[]= { 255,255,255,200,200,200,-1 };
|
||||
|
||||
s16 *CPadVibrationManager::s_vibeData[VIBE_MAX_TYPES]=
|
||||
{
|
||||
s_vibe_short, // VIBE_SHORT
|
||||
s_vibe_medium, // VIBE_MEDIUM
|
||||
s_vibe_long, // VIBE_LONG
|
||||
s_vibe_long_strobey, // VIBE_LONG_STROBEY
|
||||
s_vibe_coral_blower_suck, // VIBE_CORAL_BLOWER_SUCK
|
||||
s_vibe_chop, // VIBE_CHOP
|
||||
};
|
||||
|
||||
CPadVibrationManager::VIBE_CONTROL CPadVibrationManager::s_vibeControls[2][MAX_VIBES_PER_PAD];
|
||||
u8 CPadVibrationManager::s_currentIntensityValues[2];
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CPadVibrationManager::init()
|
||||
{
|
||||
int i,j;
|
||||
|
||||
for(i=0;i<2;i++)
|
||||
{
|
||||
for(j=0;j<MAX_VIBES_PER_PAD;j++)
|
||||
{
|
||||
s_vibeControls[i][j].m_active=false;
|
||||
}
|
||||
s_currentIntensityValues[i]=0;
|
||||
}
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CPadVibrationManager::think(int _frames)
|
||||
{
|
||||
u8 *intensity;
|
||||
int tempIntensity;
|
||||
int i,j,f;
|
||||
VIBE_CONTROL *vc;
|
||||
|
||||
intensity=s_currentIntensityValues;
|
||||
for(i=0;i<2;i++)
|
||||
{
|
||||
*intensity=0;
|
||||
tempIntensity=0;
|
||||
vc=s_vibeControls[i];
|
||||
for(j=0;j<MAX_VIBES_PER_PAD;j++)
|
||||
{
|
||||
if(vc->m_active)
|
||||
{
|
||||
int amount=-1;
|
||||
for(f=0;f<_frames;f++)
|
||||
{
|
||||
if(*vc->m_vibeData==-1)
|
||||
{
|
||||
vc->m_active=false;
|
||||
amount=-1;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
amount=*(vc->m_vibeData++);
|
||||
}
|
||||
}
|
||||
if(amount!=-1)
|
||||
{
|
||||
tempIntensity+=(amount*vc->m_ferocity)>>8;
|
||||
}
|
||||
}
|
||||
vc++;
|
||||
}
|
||||
|
||||
if(tempIntensity>254)
|
||||
{
|
||||
tempIntensity=254;
|
||||
}
|
||||
*intensity=tempIntensity;
|
||||
intensity++;
|
||||
}
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CPadVibrationManager::setVibration(int _port,VIBE_TYPE _type,u8 _ferocity)
|
||||
{
|
||||
VIBE_CONTROL *vc;
|
||||
int i;
|
||||
int foundSlot=false;
|
||||
|
||||
// Look for a spare slot
|
||||
vc=s_vibeControls[_port];
|
||||
for(i=0;i<MAX_VIBES_PER_PAD;i++)
|
||||
{
|
||||
if(!vc->m_active)
|
||||
{
|
||||
foundSlot=true;
|
||||
break;
|
||||
}
|
||||
vc++;
|
||||
}
|
||||
|
||||
// No more slots so re-use one
|
||||
if(!foundSlot)
|
||||
{
|
||||
// Could probly find a better way to choose a spare slot, but shouldn't need to..
|
||||
vc=&s_vibeControls[_port][getRndRange(MAX_VIBES_PER_PAD)];
|
||||
}
|
||||
|
||||
// Fill in details
|
||||
vc->m_active=true;
|
||||
vc->m_vibeData=s_vibeData[_type];
|
||||
vc->m_ferocity=_ferocity;
|
||||
}
|
||||
|
||||
/*===========================================================================
|
||||
end */
|
|
@ -37,7 +37,22 @@
|
|||
class CPadVibrationManager
|
||||
{
|
||||
public:
|
||||
void init();
|
||||
typedef enum
|
||||
{
|
||||
VIBE_SHORT,
|
||||
VIBE_MEDIUM,
|
||||
VIBE_LONG,
|
||||
VIBE_LONG_STROBEY,
|
||||
VIBE_CORAL_BLOWER_SUCK,
|
||||
VIBE_CHOP,
|
||||
|
||||
VIBE_MAX_TYPES
|
||||
} VIBE_TYPE;
|
||||
|
||||
static void init();
|
||||
static void think(int _frames);
|
||||
static void setVibration(int _port,VIBE_TYPE _type,u8 _ferocity=255);
|
||||
static u8 getCurrentVibrationIntensity(int _port) {return s_currentIntensityValues[_port];}
|
||||
|
||||
private:
|
||||
enum
|
||||
|
@ -53,8 +68,11 @@ private:
|
|||
} VIBE_CONTROL;
|
||||
|
||||
|
||||
VIBE_CONTROLS m_vibeControls[2][MAX_VIBES_PER_PAD];
|
||||
}
|
||||
static s16 *s_vibeData[VIBE_MAX_TYPES];
|
||||
static VIBE_CONTROL s_vibeControls[2][MAX_VIBES_PER_PAD];
|
||||
static u8 s_currentIntensityValues[2];
|
||||
|
||||
};
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
|
|
|
@ -195,8 +195,13 @@ void CSceneSelector::render()
|
|||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
#include "pad\vibe.h"
|
||||
|
||||
void CSceneSelector::think(int _frames)
|
||||
{
|
||||
if(PadGetDown(0)&PAD_L1) CPadVibrationManager::setVibration(0,CPadVibrationManager::VIBE_LONG_STROBEY);
|
||||
if(PadGetDown(0)&PAD_L2) CPadVibrationManager::setVibration(0,CPadVibrationManager::VIBE_LONG_STROBEY,127);
|
||||
|
||||
switch(m_state)
|
||||
{
|
||||
case STATE_INIT:
|
||||
|
|
|
@ -22,6 +22,10 @@
|
|||
#include "pad\pads.h"
|
||||
#endif
|
||||
|
||||
#ifndef __PAD_VIBE_H__
|
||||
#include "pad\vibe.h"
|
||||
#endif
|
||||
|
||||
#ifndef __GAME_GAMESLOT_H__
|
||||
#include "game\gameslot.h"
|
||||
#endif
|
||||
|
@ -2084,6 +2088,7 @@ void CPlayer::takeDamage(DAMAGE_TYPE _damage,REACT_DIRECTION _reactDirection,CTh
|
|||
break;
|
||||
}
|
||||
dieYouPorousFreak(deathType);
|
||||
CPadVibrationManager::setVibration(0,CPadVibrationManager::VIBE_LONG_STROBEY);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2130,6 +2135,7 @@ void CPlayer::takeDamage(DAMAGE_TYPE _damage,REACT_DIRECTION _reactDirection,CTh
|
|||
m_currentPlayerModeClass->setState(STATE_JUMPBACK);
|
||||
}
|
||||
m_invincibleFrameCount=INVINCIBLE_FRAMES__HIT;
|
||||
CPadVibrationManager::setVibration(0,CPadVibrationManager::VIBE_SHORT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,10 @@
|
|||
|
||||
#include "player\pmbloon.h"
|
||||
|
||||
#ifndef __PAD_VIBE_H__
|
||||
#include "pad\vibe.h"
|
||||
#endif
|
||||
|
||||
#ifndef __GFX_SPRBANK_H__
|
||||
#include "gfx\sprbank.h"
|
||||
#endif
|
||||
|
@ -103,6 +107,7 @@ void CPlayerModeBalloon::think()
|
|||
if(!m_playedPopSound)
|
||||
{
|
||||
CSoundMediator::playSfx(CSoundMediator::SFX_BALLOON_POP);
|
||||
CPadVibrationManager::setVibration(0,CPadVibrationManager::VIBE_SHORT);
|
||||
}
|
||||
m_player->setMode(PLAYER_MODE_BASICUNARMED);
|
||||
}
|
||||
|
@ -136,6 +141,7 @@ void CPlayerModeBalloon::render(DVECTOR *_pos)
|
|||
if(!m_playedPopSound)
|
||||
{
|
||||
CSoundMediator::playSfx(CSoundMediator::SFX_BALLOON_POP);
|
||||
CPadVibrationManager::setVibration(0,CPadVibrationManager::VIBE_SHORT);
|
||||
m_playedPopSound=true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,10 @@
|
|||
#include "gfx\sprbank.h"
|
||||
#endif
|
||||
|
||||
#ifndef __PAD_VIBE_H__
|
||||
#include "pad\vibe.h"
|
||||
#endif
|
||||
|
||||
// States
|
||||
#ifndef __PLAYER__PSLOOK_H__
|
||||
#include "player\pslook.h"
|
||||
|
@ -240,6 +244,7 @@ void CPlayerModeCoralBlower::think()
|
|||
thing=CThingManager::checkCollisionAreaAgainstThings(&suckRect,CThing::TYPE_ENEMY,true);
|
||||
}
|
||||
}
|
||||
CPadVibrationManager::setVibration(0,CPadVibrationManager::VIBE_CORAL_BLOWER_SUCK);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -249,6 +254,7 @@ void CPlayerModeCoralBlower::think()
|
|||
m_enemyFrame = m_enemy->getFrame();
|
||||
m_blowerState=BLOWER_STATE__FULL;
|
||||
}
|
||||
CPadVibrationManager::setVibration(0,CPadVibrationManager::VIBE_CORAL_BLOWER_SUCK);
|
||||
}
|
||||
break;
|
||||
case BLOWER_STATE__FULL:
|
||||
|
@ -291,6 +297,8 @@ void CPlayerModeCoralBlower::think()
|
|||
//projectile->setGraphic( projectileGfx );
|
||||
projectile->setGraphic( m_enemyFrame );
|
||||
projectile->setHasRGB( false );
|
||||
|
||||
CPadVibrationManager::setVibration(0,CPadVibrationManager::VIBE_MEDIUM);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -17,6 +17,10 @@
|
|||
|
||||
#include "player\pmjelly.h"
|
||||
|
||||
#ifndef __PAD_VIBE_H__
|
||||
#include "pad\vibe.h"
|
||||
#endif
|
||||
|
||||
#ifndef __GFX_SPRBANK_H__
|
||||
#include "gfx\sprbank.h"
|
||||
#endif
|
||||
|
@ -198,10 +202,12 @@ void CPlayerModeJellyLauncher::think()
|
|||
frame=m_firingTime;
|
||||
}
|
||||
m_player->setAnimFrame(frame);
|
||||
CPadVibrationManager::setVibration(0,CPadVibrationManager::VIBE_MEDIUM,(m_firingTime*32)/TIMEOUT_FOR_BIG_SHOT);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_firingState=FIRING_STATE__FIRING;
|
||||
CPadVibrationManager::setVibration(0,CPadVibrationManager::VIBE_MEDIUM);
|
||||
m_player->setAnimNo(ANIM_SPONGEBOB_FIREEND);
|
||||
launchProjectile();
|
||||
}
|
||||
|
|
|
@ -18,6 +18,10 @@
|
|||
|
||||
#include "player\psbutt.h"
|
||||
|
||||
#ifndef __PAD_VIBE_H__
|
||||
#include "pad\vibe.h"
|
||||
#endif
|
||||
|
||||
#ifndef __PLAYER_PLAYER_H__
|
||||
#include "player\player.h"
|
||||
#endif
|
||||
|
@ -180,6 +184,10 @@ void CPlayerStateButtBounceLand::enter(CPlayerModeBase *_playerMode)
|
|||
m_bounceOffFloor=true;
|
||||
}
|
||||
}
|
||||
if(!m_bounceOffFloor)
|
||||
{
|
||||
CPadVibrationManager::setVibration(0,CPadVibrationManager::VIBE_SHORT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -217,6 +225,7 @@ void CPlayerStateButtBounceUp::enter(CPlayerModeBase *_playerMode)
|
|||
DVECTOR pos;
|
||||
pos=_playerMode->getPlayerPos();
|
||||
CGameBubicleFactory::spawnBubicles(pos.vx-20,pos.vy,40,10,CGameBubicleFactory::TYPE_MEDIUM);
|
||||
CPadVibrationManager::setVibration(0,CPadVibrationManager::VIBE_MEDIUM);
|
||||
}
|
||||
|
||||
_playerMode->setAnimNo(ANIM_SPONGEBOB_BUTTBOUNCEEND);
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "system\global.h"
|
||||
#include "fileio\fileio.h"
|
||||
#include "pad\pads.h"
|
||||
#include "pad\vibe.h"
|
||||
#include "system\vid.h"
|
||||
#include "gfx\prim.h"
|
||||
#include "gfx\tpage.h"
|
||||
|
@ -100,6 +101,7 @@ void InitSystem() // reordered to reduce black screen (hope all is well
|
|||
MemCardStart();
|
||||
PadsInit();
|
||||
MemCardStop();
|
||||
CPadVibrationManager::init();
|
||||
|
||||
CFileIO::Init();
|
||||
TranslationDatabase::initialise(false);
|
||||
|
@ -182,6 +184,7 @@ void MainLoop()
|
|||
VidSwapDraw();
|
||||
PrimDisplay();
|
||||
|
||||
CPadVibrationManager::think(frames);
|
||||
PadUpdate();
|
||||
|
||||
DbgPollHost();
|
||||
|
|
|
@ -1283,6 +1283,14 @@ SOURCE=..\..\..\source\pad\pads.cpp
|
|||
|
||||
SOURCE=..\..\..\source\pad\pads.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\pad\vibe.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\pad\vibe.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "paul"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue