cleanup
This commit is contained in:
@@ -1,130 +0,0 @@
|
||||
#include "global.h"
|
||||
#include "Game.h"
|
||||
#include "RageLog.h"
|
||||
#include "RageUtil.h"
|
||||
#include "IniFile.h"
|
||||
#include "Style.h"
|
||||
#include "RageException.h"
|
||||
#include "GameState.h"
|
||||
#include "InputMapper.h"
|
||||
#include "PrefsManager.h"
|
||||
|
||||
int Game::GetNumGameplayButtons() const
|
||||
{
|
||||
int iIndexOfStart = ButtonNameToIndex( "Start" );
|
||||
ASSERT( iIndexOfStart != GAME_BUTTON_INVALID );
|
||||
return iIndexOfStart;
|
||||
}
|
||||
|
||||
GameButton Game::ButtonNameToIndex( const CString &sButtonName ) const
|
||||
{
|
||||
for( int i=0; i<m_iButtonsPerController; i++ )
|
||||
if( stricmp(m_szButtonNames[i], sButtonName) == 0 )
|
||||
return i;
|
||||
|
||||
return GAME_BUTTON_INVALID;
|
||||
}
|
||||
|
||||
MenuInput Game::GameInputToMenuInput( GameInput GameI ) const
|
||||
{
|
||||
PlayerNumber pn;
|
||||
|
||||
Style::StyleType type = Style::TWO_PLAYERS_TWO_CREDITS;
|
||||
if( GAMESTATE->GetCurrentStyle() )
|
||||
type = GAMESTATE->GetCurrentStyle()->m_StyleType;
|
||||
switch( type )
|
||||
{
|
||||
case Style::ONE_PLAYER_ONE_CREDIT:
|
||||
case Style::TWO_PLAYERS_TWO_CREDITS:
|
||||
pn = (PlayerNumber)GameI.controller;
|
||||
break;
|
||||
case Style::ONE_PLAYER_TWO_CREDITS:
|
||||
pn = GAMESTATE->m_MasterPlayerNumber;
|
||||
break;
|
||||
default:
|
||||
ASSERT(0); return MenuInput(); // invalid m_StyleType
|
||||
};
|
||||
|
||||
int i;
|
||||
for( i=0; i<NUM_MENU_BUTTONS; i++ )
|
||||
if( m_DedicatedMenuButton[i] == GameI.button )
|
||||
return MenuInput( pn, (MenuButton)i );
|
||||
|
||||
if( !PREFSMAN->m_bOnlyDedicatedMenuButtons )
|
||||
{
|
||||
for( i=0; i<NUM_MENU_BUTTONS; i++ )
|
||||
if( m_SecondaryMenuButton[i] == GameI.button )
|
||||
return MenuInput( pn, (MenuButton)i );
|
||||
}
|
||||
|
||||
return MenuInput(); // invalid GameInput
|
||||
}
|
||||
|
||||
void Game::MenuInputToGameInput( MenuInput MenuI, GameInput GameIout[4] ) const
|
||||
{
|
||||
ASSERT( MenuI.IsValid() );
|
||||
|
||||
GameIout[0].MakeInvalid(); // initialize
|
||||
GameIout[1].MakeInvalid();
|
||||
GameIout[2].MakeInvalid();
|
||||
GameIout[3].MakeInvalid();
|
||||
|
||||
GameController controller[2];
|
||||
Style::StyleType type = Style::TWO_PLAYERS_TWO_CREDITS;
|
||||
if( GAMESTATE->GetCurrentStyle() )
|
||||
type = GAMESTATE->GetCurrentStyle()->m_StyleType;
|
||||
|
||||
int iNumSidesUsing = 1;
|
||||
switch( type )
|
||||
{
|
||||
case Style::ONE_PLAYER_ONE_CREDIT:
|
||||
case Style::TWO_PLAYERS_TWO_CREDITS:
|
||||
controller[0] = (GameController)MenuI.player;
|
||||
iNumSidesUsing = 1;
|
||||
break;
|
||||
case Style::ONE_PLAYER_TWO_CREDITS:
|
||||
controller[0] = GAME_CONTROLLER_1;
|
||||
controller[1] = GAME_CONTROLLER_2;
|
||||
iNumSidesUsing = 2;
|
||||
break;
|
||||
default:
|
||||
ASSERT(0); // invalid m_StyleType
|
||||
};
|
||||
|
||||
GameButton button[2] = { m_DedicatedMenuButton[MenuI.button], m_SecondaryMenuButton[MenuI.button] };
|
||||
int iNumButtonsUsing = PREFSMAN->m_bOnlyDedicatedMenuButtons ? 1 : 2;
|
||||
|
||||
for( int i=0; i<iNumSidesUsing; i++ )
|
||||
{
|
||||
for( int j=0; j<iNumButtonsUsing; j++ )
|
||||
{
|
||||
GameIout[i*2+j].controller = controller[i];
|
||||
GameIout[i*2+j].button = button[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (c) 2001-2002 Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||
* whom the Software is furnished to do so, provided that the above
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
@@ -1,89 +0,0 @@
|
||||
/* Game - Holds information about a particular style of a game (e.g. "single", "double"). */
|
||||
|
||||
#ifndef GAMEDEF_H
|
||||
#define GAMEDEF_H
|
||||
|
||||
#include "GameInput.h"
|
||||
#include "MenuInput.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
|
||||
|
||||
const int MAX_STYLES_PER_GAME = 10;
|
||||
|
||||
//
|
||||
// PrimaryMenuButton and SecondaryMenuButton are used to support using DeviceInputs that only
|
||||
// navigate the menus.
|
||||
//
|
||||
// A button being a primary menu button means that this GameButton will generate a the
|
||||
// corresponding MenuInput.
|
||||
// A button being a primary menu button means that this GameButton will generate a the
|
||||
// corresponding MenuInput IF AND ONLY IF the GameButton corresponding to the pimary input
|
||||
// is not mapped.
|
||||
//
|
||||
// Example 1: A user is using a an arcade DDR machine as their controllre. This machine has
|
||||
// MenuLeft, MenuStart, and MenuRight buttons on the cabinet, so they should be used to navigate menus.
|
||||
// The user will map these DeviceInputs to the GameButtons "MenuLeft (optional)", "MenuStart", and
|
||||
// "MenuRight (optional)".
|
||||
//
|
||||
// Example 2: A user is using PlayStation DDR soft pads to play. His controller doesn't have dedicated
|
||||
// DeviceInputs for MenuLeft and MenuRight. The user maps Up, Down, Left, and Right as normal.
|
||||
// Since the Left and Right GameButtons have the flag FLAG_SECONDARY_MENU_*, they will function as
|
||||
// MenuLeft and MenuRight as long as "MenuLeft (optional)" and "MenuRight (optional)" are not mapped.
|
||||
//
|
||||
|
||||
class Style;
|
||||
|
||||
#define NO_DEFAULT_KEY -1
|
||||
|
||||
class Game
|
||||
{
|
||||
public:
|
||||
const char *m_szName;
|
||||
const char *m_szDescription;
|
||||
|
||||
int m_iNumControllers;
|
||||
int m_iButtonsPerController;
|
||||
int GetNumGameplayButtons() const;
|
||||
char m_szButtonNames[MAX_GAME_BUTTONS][60]; // The name used by the button graphics system. e.g. "left", "right", "middle C", "snare"
|
||||
char m_szSecondaryFunction[MAX_GAME_BUTTONS][60]; // displayed on the mapping screen
|
||||
GameButton m_DedicatedMenuButton[NUM_MENU_BUTTONS];
|
||||
GameButton m_SecondaryMenuButton[NUM_MENU_BUTTONS];
|
||||
int m_iDefaultKeyboardKey[MAX_GAME_CONTROLLERS][MAX_GAME_BUTTONS]; // default keyboard keys only have an effect the current game is this game
|
||||
|
||||
GameButton ButtonNameToIndex( const CString &sButtonName ) const;
|
||||
MenuInput GameInputToMenuInput( GameInput GameI ) const;
|
||||
void MenuInputToGameInput( MenuInput MenuI, GameInput GameIout[4] ) const;
|
||||
|
||||
TapNoteScore m_mapMarvelousTo;
|
||||
TapNoteScore m_mapPerfectTo;
|
||||
TapNoteScore m_mapGreatTo;
|
||||
TapNoteScore m_mapGoodTo;
|
||||
TapNoteScore m_mapBooTo;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* (c) 2001-2002 Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||
* whom the Software is furnished to do so, provided that the above
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
Reference in New Issue
Block a user