working on fixing up extra loads when entering play mode in the editor
This commit is contained in:
@@ -609,6 +609,15 @@ float GameSoundManager::GetPlayLatency() const
|
|||||||
return SOUNDMAN->GetPlayLatency();
|
return SOUNDMAN->GetPlayLatency();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GameSoundManager::SetPlayerBalance( PlayerNumber pn, RageSoundParams ¶ms )
|
||||||
|
{
|
||||||
|
/* If two players are active, play sounds on each players' side. */
|
||||||
|
if( GAMESTATE->GetNumPlayersEnabled() == 2 )
|
||||||
|
params.m_Balance = (pn == PLAYER_1)? -1.0f:1.0f;
|
||||||
|
else
|
||||||
|
params.m_Balance = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2003-2004 Glenn Maynard
|
* Copyright (c) 2003-2004 Glenn Maynard
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|||||||
@@ -3,8 +3,11 @@
|
|||||||
#ifndef RAGE_SOUNDS_H
|
#ifndef RAGE_SOUNDS_H
|
||||||
#define RAGE_SOUNDS_H
|
#define RAGE_SOUNDS_H
|
||||||
|
|
||||||
|
#include "PlayerNumber.h"
|
||||||
|
|
||||||
class TimingData;
|
class TimingData;
|
||||||
class RageSound;
|
class RageSound;
|
||||||
|
struct RageSoundParams;
|
||||||
class GameSoundManager
|
class GameSoundManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -26,6 +29,8 @@ public:
|
|||||||
float GetPlayLatency() const;
|
float GetPlayLatency() const;
|
||||||
void HandleSongTimer( bool on=true );
|
void HandleSongTimer( bool on=true );
|
||||||
float GetFrameTimingAdjustment( float fDeltaTime );
|
float GetFrameTimingAdjustment( float fDeltaTime );
|
||||||
|
|
||||||
|
static void SetPlayerBalance( PlayerNumber pn, RageSoundParams ¶ms );
|
||||||
};
|
};
|
||||||
|
|
||||||
extern GameSoundManager *SOUND;
|
extern GameSoundManager *SOUND;
|
||||||
|
|||||||
+41
-33
@@ -32,6 +32,7 @@
|
|||||||
#include "ThemeMetric.h"
|
#include "ThemeMetric.h"
|
||||||
#include "PlayerState.h"
|
#include "PlayerState.h"
|
||||||
#include "GameplayMessages.h"
|
#include "GameplayMessages.h"
|
||||||
|
#include "GameSoundManager.h"
|
||||||
|
|
||||||
ThemeMetric<float> GRAY_ARROWS_Y_STANDARD ("Player","ReceptorArrowsYStandard");
|
ThemeMetric<float> GRAY_ARROWS_Y_STANDARD ("Player","ReceptorArrowsYStandard");
|
||||||
ThemeMetric<float> GRAY_ARROWS_Y_REVERSE ("Player","ReceptorArrowsYReverse");
|
ThemeMetric<float> GRAY_ARROWS_Y_REVERSE ("Player","ReceptorArrowsYReverse");
|
||||||
@@ -94,9 +95,9 @@ Player::~Player()
|
|||||||
delete m_pNoteField;
|
delete m_pNoteField;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::Load(
|
/* Init() does the expensive stuff: load sounds and note skins. Load() just loads a NoteData. */
|
||||||
|
void Player::Init(
|
||||||
PlayerState* pPlayerState,
|
PlayerState* pPlayerState,
|
||||||
const NoteData& noteData,
|
|
||||||
PlayerStageStats* pPlayerStageStats,
|
PlayerStageStats* pPlayerStageStats,
|
||||||
LifeMeter* pLM,
|
LifeMeter* pLM,
|
||||||
CombinedLifeMeter* pCombinedLM,
|
CombinedLifeMeter* pCombinedLM,
|
||||||
@@ -106,8 +107,6 @@ void Player::Load(
|
|||||||
ScoreKeeper* pPrimaryScoreKeeper,
|
ScoreKeeper* pPrimaryScoreKeeper,
|
||||||
ScoreKeeper* pSecondaryScoreKeeper )
|
ScoreKeeper* pSecondaryScoreKeeper )
|
||||||
{
|
{
|
||||||
m_iDCState = AS2D_IDLE;
|
|
||||||
|
|
||||||
m_pPlayerState = pPlayerState;
|
m_pPlayerState = pPlayerState;
|
||||||
m_pPlayerStageStats = pPlayerStageStats;
|
m_pPlayerStageStats = pPlayerStageStats;
|
||||||
m_pLifeMeter = pLM;
|
m_pLifeMeter = pLM;
|
||||||
@@ -117,11 +116,44 @@ void Player::Load(
|
|||||||
m_pInventory = pInventory;
|
m_pInventory = pInventory;
|
||||||
m_pPrimaryScoreKeeper = pPrimaryScoreKeeper;
|
m_pPrimaryScoreKeeper = pPrimaryScoreKeeper;
|
||||||
m_pSecondaryScoreKeeper = pSecondaryScoreKeeper;
|
m_pSecondaryScoreKeeper = pSecondaryScoreKeeper;
|
||||||
|
|
||||||
|
m_soundMine.Load( THEME->GetPathToS("Player mine"), true );
|
||||||
|
|
||||||
|
/* Attacks can be launched in course modes and in battle modes. They both come
|
||||||
|
* here to play, but allow loading a different sound for different modes. */
|
||||||
|
switch( GAMESTATE->m_PlayMode )
|
||||||
|
{
|
||||||
|
case PLAY_MODE_RAVE:
|
||||||
|
case PLAY_MODE_BATTLE:
|
||||||
|
m_soundAttackLaunch.Load( THEME->GetPathToS("Player battle attack launch"), true );
|
||||||
|
m_soundAttackEnding.Load( THEME->GetPathToS("Player battle attack ending"), true );
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
m_soundAttackLaunch.Load( THEME->GetPathToS("Player course attack launch"), true );
|
||||||
|
m_soundAttackEnding.Load( THEME->GetPathToS("Player course attack ending"), true );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Remove use of PlayerNumber.
|
||||||
|
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
||||||
|
|
||||||
|
RageSoundParams p;
|
||||||
|
GameSoundManager::SetPlayerBalance( pn, p );
|
||||||
|
|
||||||
|
m_soundMine.SetParams( p );
|
||||||
|
m_soundAttackLaunch.SetParams( p );
|
||||||
|
m_soundAttackEnding.SetParams( p );
|
||||||
|
}
|
||||||
|
|
||||||
|
void Player::Load( const NoteData& noteData )
|
||||||
|
{
|
||||||
|
m_iDCState = AS2D_IDLE;
|
||||||
|
|
||||||
m_iRowLastCrossed = BeatToNoteRowNotRounded( GAMESTATE->m_fSongBeat ) - 1; // why this?
|
m_iRowLastCrossed = BeatToNoteRowNotRounded( GAMESTATE->m_fSongBeat ) - 1; // why this?
|
||||||
m_iMineRowLastCrossed = BeatToNoteRowNotRounded( GAMESTATE->m_fSongBeat ) - 1; // why this?
|
m_iMineRowLastCrossed = BeatToNoteRowNotRounded( GAMESTATE->m_fSongBeat ) - 1; // why this?
|
||||||
|
|
||||||
// TODO: Remove use of PlayerNumber.
|
// TODO: Remove use of PlayerNumber.
|
||||||
PlayerNumber pn = pPlayerState->m_PlayerNumber;
|
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
||||||
|
|
||||||
GAMESTATE->ResetNoteSkinsForPlayer( pn );
|
GAMESTATE->ResetNoteSkinsForPlayer( pn );
|
||||||
|
|
||||||
@@ -228,40 +260,16 @@ void Player::Load(
|
|||||||
// Need to set Y positions of all these elements in Update since
|
// Need to set Y positions of all these elements in Update since
|
||||||
// they change depending on PlayerOptions.
|
// they change depending on PlayerOptions.
|
||||||
|
|
||||||
RageSoundParams p;
|
|
||||||
m_soundMine.Load( THEME->GetPathToS("Player mine"), true );
|
|
||||||
|
|
||||||
/* Attacks can be launched in course modes and in battle modes. They both come
|
|
||||||
* here to play, but allow loading a different sound for different modes. */
|
|
||||||
switch( GAMESTATE->m_PlayMode )
|
|
||||||
{
|
|
||||||
case PLAY_MODE_RAVE:
|
|
||||||
case PLAY_MODE_BATTLE:
|
|
||||||
m_soundAttackLaunch.Load( THEME->GetPathToS("Player battle attack launch"), true );
|
|
||||||
m_soundAttackEnding.Load( THEME->GetPathToS("Player battle attack ending"), true );
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
m_soundAttackLaunch.Load( THEME->GetPathToS("Player course attack launch"), true );
|
|
||||||
m_soundAttackEnding.Load( THEME->GetPathToS("Player course attack ending"), true );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( GAMESTATE->GetNumPlayersEnabled() == 2 )
|
|
||||||
{
|
|
||||||
/* Two players are active. Play sounds on this player's side. */
|
|
||||||
p.m_Balance = (pn == PLAYER_1)? -1.0f:1.0f;
|
|
||||||
}
|
|
||||||
m_soundMine.SetParams( p );
|
|
||||||
m_soundAttackLaunch.SetParams( p );
|
|
||||||
m_soundAttackEnding.SetParams( p );
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Load keysounds
|
// Load keysounds
|
||||||
//
|
//
|
||||||
Song* pSong = GAMESTATE->m_pCurSong;
|
const Song* pSong = GAMESTATE->m_pCurSong;
|
||||||
CString sSongDir = pSong->GetSongDir();
|
CString sSongDir = pSong->GetSongDir();
|
||||||
m_vKeysounds.clear();
|
m_vKeysounds.clear();
|
||||||
m_vKeysounds.resize( pSong->m_vsKeysoundFile.size() );
|
m_vKeysounds.resize( pSong->m_vsKeysoundFile.size() );
|
||||||
|
|
||||||
|
RageSoundParams p;
|
||||||
|
GameSoundManager::SetPlayerBalance( pn, p );
|
||||||
for( unsigned i=0; i<m_vKeysounds.size(); i++ )
|
for( unsigned i=0; i<m_vKeysounds.size(); i++ )
|
||||||
{
|
{
|
||||||
CString sKeysoundFilePath = sSongDir + pSong->m_vsKeysoundFile[i];
|
CString sKeysoundFilePath = sSongDir + pSong->m_vsKeysoundFile[i];
|
||||||
|
|||||||
@@ -33,9 +33,8 @@ public:
|
|||||||
virtual void Update( float fDeltaTime );
|
virtual void Update( float fDeltaTime );
|
||||||
virtual void DrawPrimitives();
|
virtual void DrawPrimitives();
|
||||||
|
|
||||||
void Load(
|
void Init(
|
||||||
PlayerState* pPlayerState,
|
PlayerState* pPlayerState,
|
||||||
const NoteData& noteData,
|
|
||||||
PlayerStageStats* pPlayerStageStats,
|
PlayerStageStats* pPlayerStageStats,
|
||||||
LifeMeter* pLM,
|
LifeMeter* pLM,
|
||||||
CombinedLifeMeter* pCombinedLM,
|
CombinedLifeMeter* pCombinedLM,
|
||||||
@@ -44,6 +43,7 @@ public:
|
|||||||
Inventory* pInventory,
|
Inventory* pInventory,
|
||||||
ScoreKeeper* pPrimaryScoreKeeper,
|
ScoreKeeper* pPrimaryScoreKeeper,
|
||||||
ScoreKeeper* pSecondaryScoreKeeper );
|
ScoreKeeper* pSecondaryScoreKeeper );
|
||||||
|
void Load( const NoteData& noteData );
|
||||||
void CrossedRow( int iNoteRow );
|
void CrossedRow( int iNoteRow );
|
||||||
void CrossedMineRow( int iNoteRow );
|
void CrossedMineRow( int iNoteRow );
|
||||||
void Step( int col, RageTimer tm );
|
void Step( int col, RageTimer tm );
|
||||||
|
|||||||
@@ -552,9 +552,8 @@ ScreenEdit::ScreenEdit( CString sName ) : Screen( sName )
|
|||||||
|
|
||||||
/* XXX: Do we actually have to send real note data here, and to m_NoteFieldRecord?
|
/* XXX: Do we actually have to send real note data here, and to m_NoteFieldRecord?
|
||||||
* (We load again on play/record.) */
|
* (We load again on play/record.) */
|
||||||
m_Player.Load(
|
m_Player.Init(
|
||||||
GAMESTATE->m_pPlayerState[PLAYER_1],
|
GAMESTATE->m_pPlayerState[PLAYER_1],
|
||||||
noteData,
|
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
@@ -563,6 +562,7 @@ ScreenEdit::ScreenEdit( CString sName ) : Screen( sName )
|
|||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL );
|
NULL );
|
||||||
|
m_Player.Load( noteData );
|
||||||
GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerController = PC_HUMAN;
|
GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerController = PC_HUMAN;
|
||||||
m_Player.SetXY( PLAYER_X, PLAYER_Y );
|
m_Player.SetXY( PLAYER_X, PLAYER_Y );
|
||||||
|
|
||||||
@@ -2177,9 +2177,11 @@ void ScreenEdit::HandleAreaMenuChoice( AreaMenuChoice c, int* iAnswers )
|
|||||||
float fSeconds = m_pSong->m_Timing.GetElapsedTimeFromBeat( m_NoteFieldEdit.m_fBeginMarker - 4 );
|
float fSeconds = m_pSong->m_Timing.GetElapsedTimeFromBeat( m_NoteFieldEdit.m_fBeginMarker - 4 );
|
||||||
GAMESTATE->UpdateSongPosition( fSeconds, m_pSong->m_Timing );
|
GAMESTATE->UpdateSongPosition( fSeconds, m_pSong->m_Timing );
|
||||||
|
|
||||||
|
/* If we're in course display mode, set that up. */
|
||||||
SetupCourseAttacks();
|
SetupCourseAttacks();
|
||||||
|
|
||||||
m_Player.Load( GAMESTATE->m_pPlayerState[PLAYER_1], m_NoteFieldEdit, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL );
|
m_Player.Init( GAMESTATE->m_pPlayerState[PLAYER_1], NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL );
|
||||||
|
m_Player.Load( m_NoteFieldEdit );
|
||||||
GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerController = PREFSMAN->m_bAutoPlay?PC_AUTOPLAY:PC_HUMAN;
|
GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerController = PREFSMAN->m_bAutoPlay?PC_AUTOPLAY:PC_HUMAN;
|
||||||
|
|
||||||
m_rectRecordBack.StopTweening();
|
m_rectRecordBack.StopTweening();
|
||||||
|
|||||||
@@ -831,9 +831,8 @@ void ScreenGameplay::SetupSong( PlayerNumber p, int iSongIndex )
|
|||||||
{
|
{
|
||||||
NoteData nd = ndTransformed;
|
NoteData nd = ndTransformed;
|
||||||
NoteDataUtil::RemoveAllTapsOfType( nd, TapNote::autoKeysound );
|
NoteDataUtil::RemoveAllTapsOfType( nd, TapNote::autoKeysound );
|
||||||
m_Player[p].Load(
|
m_Player[p].Init(
|
||||||
GAMESTATE->m_pPlayerState[p],
|
GAMESTATE->m_pPlayerState[p],
|
||||||
nd,
|
|
||||||
&g_CurStageStats.m_player[p],
|
&g_CurStageStats.m_player[p],
|
||||||
m_pLifeMeter[p],
|
m_pLifeMeter[p],
|
||||||
m_pCombinedLifeMeter,
|
m_pCombinedLifeMeter,
|
||||||
@@ -842,6 +841,7 @@ void ScreenGameplay::SetupSong( PlayerNumber p, int iSongIndex )
|
|||||||
m_pInventory[p],
|
m_pInventory[p],
|
||||||
m_pPrimaryScoreKeeper[p],
|
m_pPrimaryScoreKeeper[p],
|
||||||
m_pSecondaryScoreKeeper[p] );
|
m_pSecondaryScoreKeeper[p] );
|
||||||
|
m_Player[p].Load( nd );
|
||||||
}
|
}
|
||||||
|
|
||||||
// load auto keysounds
|
// load auto keysounds
|
||||||
|
|||||||
@@ -308,9 +308,8 @@ void ScreenGameplayMultiplayer::SetupSong( MultiPlayer p, int iSongIndex )
|
|||||||
{
|
{
|
||||||
NoteData nd = ndTransformed;
|
NoteData nd = ndTransformed;
|
||||||
NoteDataUtil::RemoveAllTapsOfType( nd, TapNote::autoKeysound );
|
NoteDataUtil::RemoveAllTapsOfType( nd, TapNote::autoKeysound );
|
||||||
m_AutoPlayer.Load(
|
m_AutoPlayer.Init(
|
||||||
GAMESTATE->m_pPlayerState[ GAMESTATE->m_MasterPlayerNumber ],
|
GAMESTATE->m_pPlayerState[ GAMESTATE->m_MasterPlayerNumber ],
|
||||||
nd,
|
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
@@ -319,10 +318,10 @@ void ScreenGameplayMultiplayer::SetupSong( MultiPlayer p, int iSongIndex )
|
|||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL );
|
NULL );
|
||||||
|
m_AutoPlayer.Load( nd );
|
||||||
|
|
||||||
m_HumanPlayer[p].Load(
|
m_HumanPlayer[p].Init(
|
||||||
&m_PlayerState[p],
|
&m_PlayerState[p],
|
||||||
nd,
|
|
||||||
&m_PlayerStageStats[p],
|
&m_PlayerStageStats[p],
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
@@ -331,6 +330,7 @@ void ScreenGameplayMultiplayer::SetupSong( MultiPlayer p, int iSongIndex )
|
|||||||
NULL,
|
NULL,
|
||||||
m_pPrimaryScoreKeeper[p],
|
m_pPrimaryScoreKeeper[p],
|
||||||
NULL );
|
NULL );
|
||||||
|
m_HumanPlayer[p].Load( nd );
|
||||||
}
|
}
|
||||||
|
|
||||||
// load auto keysounds
|
// load auto keysounds
|
||||||
|
|||||||
@@ -151,9 +151,8 @@ ScreenHowToPlay::ScreenHowToPlay( CString sName ) : ScreenAttract( sName )
|
|||||||
GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerController = PC_AUTOPLAY;
|
GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerController = PC_AUTOPLAY;
|
||||||
|
|
||||||
m_pPlayer = new Player;
|
m_pPlayer = new Player;
|
||||||
m_pPlayer->Load(
|
m_pPlayer->Init(
|
||||||
GAMESTATE->m_pPlayerState[PLAYER_1],
|
GAMESTATE->m_pPlayerState[PLAYER_1],
|
||||||
m_NoteData,
|
|
||||||
NULL,
|
NULL,
|
||||||
m_pLifeMeterBar,
|
m_pLifeMeterBar,
|
||||||
NULL,
|
NULL,
|
||||||
@@ -162,6 +161,7 @@ ScreenHowToPlay::ScreenHowToPlay( CString sName ) : ScreenAttract( sName )
|
|||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL );
|
NULL );
|
||||||
|
m_pPlayer->Load( m_NoteData );
|
||||||
m_pPlayer->SetName( "Player" );
|
m_pPlayer->SetName( "Player" );
|
||||||
this->AddChild( m_pPlayer );
|
this->AddChild( m_pPlayer );
|
||||||
SET_XY_AND_ON_COMMAND( m_pPlayer );
|
SET_XY_AND_ON_COMMAND( m_pPlayer );
|
||||||
|
|||||||
Reference in New Issue
Block a user