2003-02-16 04:01:45 +00:00
|
|
|
#include "global.h"
|
2002-03-19 07:09:49 +00:00
|
|
|
/*
|
|
|
|
|
-----------------------------------------------------------------------------
|
2002-08-13 23:26:46 +00:00
|
|
|
Class: StyleDef
|
2002-03-19 07:09:49 +00:00
|
|
|
|
|
|
|
|
Desc: A data structure that holds the definition of a GameMode.
|
|
|
|
|
|
2002-05-19 01:59:48 +00:00
|
|
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
2002-08-13 23:26:46 +00:00
|
|
|
Chris Danford
|
2002-03-19 07:09:49 +00:00
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "StyleDef.h"
|
2002-05-01 19:14:55 +00:00
|
|
|
#include "RageLog.h"
|
2002-04-01 02:04:43 +00:00
|
|
|
#include "RageUtil.h"
|
2002-04-28 20:42:32 +00:00
|
|
|
#include "GameDef.h"
|
|
|
|
|
#include "IniFile.h"
|
2002-08-20 21:00:56 +00:00
|
|
|
#include "GameState.h"
|
2002-12-17 21:49:14 +00:00
|
|
|
#include "NoteData.h"
|
2002-03-19 07:09:49 +00:00
|
|
|
|
|
|
|
|
|
2003-10-04 05:04:31 +00:00
|
|
|
void StyleDef::GetTransformedNoteDataForStyle( PlayerNumber pn, const NoteData* pOriginal, NoteData* pNoteDataOut ) const
|
2002-05-01 19:14:55 +00:00
|
|
|
{
|
2002-05-27 08:23:27 +00:00
|
|
|
int iNewToOriginalTrack[MAX_COLS_PER_PLAYER];
|
2002-05-01 19:14:55 +00:00
|
|
|
for( int col=0; col<m_iColsPerPlayer; col++ )
|
|
|
|
|
{
|
2002-09-04 03:49:08 +00:00
|
|
|
ColumnInfo colInfo = m_ColumnInfo[pn][col];
|
2002-05-27 08:23:27 +00:00
|
|
|
int originalTrack = colInfo.track;
|
2002-05-01 19:14:55 +00:00
|
|
|
|
|
|
|
|
iNewToOriginalTrack[col] = originalTrack;
|
|
|
|
|
}
|
|
|
|
|
|
2002-06-24 22:04:31 +00:00
|
|
|
pNoteDataOut->LoadTransformed( pOriginal, m_iColsPerPlayer, iNewToOriginalTrack );
|
2002-07-31 19:40:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2002-08-22 22:59:19 +00:00
|
|
|
GameInput StyleDef::StyleInputToGameInput( const StyleInput StyleI ) const
|
2002-07-31 19:40:40 +00:00
|
|
|
{
|
2004-05-30 22:44:03 +00:00
|
|
|
ASSERT_M( StyleI.player < NUM_PLAYERS, ssprintf("P%i", StyleI.player) );
|
|
|
|
|
ASSERT_M( StyleI.col < MAX_COLS_PER_PLAYER, ssprintf("C%i", StyleI.col) );
|
2002-07-31 19:40:40 +00:00
|
|
|
GameController c = m_ColumnInfo[StyleI.player][StyleI.col].controller;
|
|
|
|
|
GameButton b = m_ColumnInfo[StyleI.player][StyleI.col].button;
|
|
|
|
|
return GameInput( c, b );
|
|
|
|
|
};
|
|
|
|
|
|
2002-08-22 22:59:19 +00:00
|
|
|
StyleInput StyleDef::GameInputToStyleInput( const GameInput &GameI ) const
|
2002-07-31 19:40:40 +00:00
|
|
|
{
|
2002-08-20 21:00:56 +00:00
|
|
|
StyleInput SI;
|
|
|
|
|
|
2004-05-24 06:10:11 +00:00
|
|
|
FOREACH_PlayerNumber( p )
|
2002-07-31 19:40:40 +00:00
|
|
|
{
|
2003-11-02 01:27:11 +00:00
|
|
|
for( int t=0; t<m_iColsPerPlayer; t++ )
|
2002-07-31 19:40:40 +00:00
|
|
|
{
|
|
|
|
|
if( m_ColumnInfo[p][t].controller == GameI.controller &&
|
|
|
|
|
m_ColumnInfo[p][t].button == GameI.button )
|
|
|
|
|
{
|
2002-08-20 21:00:56 +00:00
|
|
|
SI = StyleInput( (PlayerNumber)p, t );
|
|
|
|
|
|
|
|
|
|
// HACK: Looking up the player number using m_ColumnInfo
|
|
|
|
|
// returns the wrong answer for ONE_PLAYER_TWO_CREDITS styles
|
|
|
|
|
if( m_StyleType == ONE_PLAYER_TWO_CREDITS )
|
|
|
|
|
SI.player = GAMESTATE->m_MasterPlayerNumber;
|
|
|
|
|
|
|
|
|
|
return SI;
|
2002-07-31 19:40:40 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2002-08-20 21:00:56 +00:00
|
|
|
return SI; // Didn't find a match. Return invalid.
|
2002-07-31 19:40:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2002-09-02 21:59:58 +00:00
|
|
|
PlayerNumber StyleDef::ControllerToPlayerNumber( GameController controller ) const
|
|
|
|
|
{
|
|
|
|
|
switch( m_StyleType )
|
|
|
|
|
{
|
|
|
|
|
case ONE_PLAYER_ONE_CREDIT:
|
|
|
|
|
case TWO_PLAYERS_TWO_CREDITS:
|
|
|
|
|
return (PlayerNumber)controller;
|
|
|
|
|
case ONE_PLAYER_TWO_CREDITS:
|
|
|
|
|
return GAMESTATE->m_MasterPlayerNumber;
|
|
|
|
|
default:
|
|
|
|
|
ASSERT(0);
|
|
|
|
|
return PLAYER_INVALID;
|
|
|
|
|
}
|
|
|
|
|
}
|
2002-09-06 08:56:28 +00:00
|
|
|
|
2003-08-07 06:16:17 +00:00
|
|
|
bool StyleDef::MatchesNotesType( StepsType type ) const
|
2002-09-06 08:56:28 +00:00
|
|
|
{
|
2003-08-07 06:36:34 +00:00
|
|
|
if(type == m_StepsType) return true;
|
2002-09-06 08:56:28 +00:00
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2003-02-19 07:59:00 +00:00
|
|
|
void StyleDef::GetMinAndMaxColX( PlayerNumber pn, float& fMixXOut, float& fMaxXOut ) const
|
|
|
|
|
{
|
|
|
|
|
fMixXOut = +100000;
|
|
|
|
|
fMaxXOut = -100000;
|
|
|
|
|
for( int i=0; i<m_iColsPerPlayer; i++ )
|
|
|
|
|
{
|
|
|
|
|
fMixXOut = min( fMixXOut, m_ColumnInfo[pn][i].fXOffset );
|
|
|
|
|
fMaxXOut = max( fMaxXOut, m_ColumnInfo[pn][i].fXOffset );
|
|
|
|
|
}
|
|
|
|
|
}
|
2003-09-23 03:55:18 +00:00
|
|
|
|