add basic bookkeeping
This commit is contained in:
@@ -0,0 +1,253 @@
|
||||
#include "global.h"
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
Class: Bookkeeper
|
||||
|
||||
Desc: See header.
|
||||
|
||||
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||
Chris Danford
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "Bookkeeper.h"
|
||||
#include "RageUtil.h"
|
||||
#include "arch/arch.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "RageLog.h"
|
||||
#include "IniFile.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "SongManager.h"
|
||||
#include <time.h>
|
||||
#include <fstream>
|
||||
|
||||
|
||||
Bookkeeper* BOOKKEEPER = NULL; // global and accessable from anywhere in our program
|
||||
|
||||
const CString BOOKKEEPING_INI = BASE_PATH "Data\\Bookkeeping.ini";
|
||||
const CString COINS_DAT = BASE_PATH "Data\\Coins.dat";
|
||||
|
||||
|
||||
|
||||
tm GetDaysAgo( tm start, int iDaysAgo )
|
||||
{
|
||||
start.tm_mday -= iDaysAgo;
|
||||
time_t seconds = mktime( &start );
|
||||
ASSERT( seconds != (time_t)-1 );
|
||||
tm time = *localtime( &seconds );
|
||||
return time;
|
||||
}
|
||||
|
||||
tm GetYesterday( tm start )
|
||||
{
|
||||
return GetDaysAgo( start, -1 );
|
||||
}
|
||||
|
||||
int GetDayOfWeek( tm time )
|
||||
{
|
||||
return time.tm_wday;
|
||||
}
|
||||
|
||||
tm GetLastSunday( tm start )
|
||||
{
|
||||
return GetDaysAgo( start, -GetDayOfWeek(start) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
Bookkeeper::Bookkeeper()
|
||||
{
|
||||
int i, j;
|
||||
|
||||
m_iLastSeenTime = time(NULL);
|
||||
m_iTotalCoins = 0;
|
||||
m_iTotalUptimeSeconds = 0;
|
||||
m_iTotalPlaySeconds = 0;
|
||||
m_iTotalPlays = 0;
|
||||
for( i=0; i<DAYS_PER_YEAR; i++ )
|
||||
for( j=0; j<HOURS_PER_DAY; j++ )
|
||||
m_iCoinsByHourForYear[i][j] = 0;
|
||||
|
||||
ReadFromDisk();
|
||||
|
||||
UpdateLastSeenTime();
|
||||
}
|
||||
|
||||
Bookkeeper::~Bookkeeper()
|
||||
{
|
||||
WriteToDisk();
|
||||
}
|
||||
|
||||
void Bookkeeper::ReadFromDisk()
|
||||
{
|
||||
// read ini
|
||||
IniFile ini;
|
||||
ini.SetPath( BOOKKEEPING_INI );
|
||||
ini.ReadFile();
|
||||
|
||||
ini.GetValue( "MachineStatistics", "LastSeenTime", m_iLastSeenTime );
|
||||
ini.GetValue( "MachineStatistics", "TotalCoins", m_iTotalCoins );
|
||||
ini.GetValue( "MachineStatistics", "TotalUptimeSeconds", m_iTotalUptimeSeconds );
|
||||
ini.GetValue( "MachineStatistics", "TotalPlaySeconds", m_iTotalPlaySeconds );
|
||||
ini.GetValue( "MachineStatistics", "TotalPlays", m_iTotalPlays );
|
||||
|
||||
// read dat
|
||||
FILE* fp = fopen( COINS_DAT, "r" );
|
||||
if( fp )
|
||||
{
|
||||
for( int i=0; i<DAYS_PER_YEAR; i++ )
|
||||
for( int j=0; j<HOURS_PER_DAY; j++ )
|
||||
fscanf( fp, "%d ", &m_iCoinsByHourForYear[i][j] );
|
||||
fclose( fp );
|
||||
}
|
||||
}
|
||||
|
||||
void Bookkeeper::WriteToDisk()
|
||||
{
|
||||
// write ini
|
||||
IniFile ini;
|
||||
ini.SetPath( BOOKKEEPING_INI );
|
||||
|
||||
ini.SetValue( "MachineStatistics", "LastSeenTime", m_iLastSeenTime );
|
||||
ini.SetValue( "MachineStatistics", "TotalCoins", m_iTotalCoins );
|
||||
ini.SetValue( "MachineStatistics", "TotalUptimeSeconds", m_iTotalUptimeSeconds );
|
||||
ini.SetValue( "MachineStatistics", "TotalPlaySeconds", m_iTotalPlaySeconds );
|
||||
ini.SetValue( "MachineStatistics", "TotalPlays", m_iTotalPlays );
|
||||
|
||||
ini.WriteFile();
|
||||
|
||||
// write dat
|
||||
FILE* fp = fopen( COINS_DAT, "w" );
|
||||
if( fp )
|
||||
{
|
||||
for( int i=0; i<DAYS_PER_YEAR; i++ )
|
||||
for( int j=0; j<HOURS_PER_DAY; j++ )
|
||||
fprintf( fp, "%d ", m_iCoinsByHourForYear[i][j] );
|
||||
fclose( fp );
|
||||
}
|
||||
}
|
||||
|
||||
void Bookkeeper::UpdateLastSeenTime()
|
||||
{
|
||||
// clear all coin counts from (lOldTime,lNewTime]
|
||||
|
||||
long lOldTime = m_iLastSeenTime;
|
||||
long lNewTime = time(NULL);
|
||||
|
||||
if( lNewTime < lOldTime )
|
||||
{
|
||||
LOG->Warn( "The new time is older than the last seen time. Is someone fiddling with the system clock?" );
|
||||
m_iLastSeenTime = lNewTime;
|
||||
return;
|
||||
}
|
||||
|
||||
tm tOld = *localtime( &lOldTime );
|
||||
tm tNew = *localtime( &lNewTime );
|
||||
|
||||
CLAMP( tOld.tm_year, tNew.tm_year-1, tNew.tm_year );
|
||||
|
||||
while(
|
||||
tOld.tm_year != tNew.tm_year ||
|
||||
tOld.tm_yday != tNew.tm_yday ||
|
||||
tOld.tm_hour != tNew.tm_hour )
|
||||
{
|
||||
tOld.tm_hour++;
|
||||
if( tOld.tm_hour == HOURS_PER_DAY )
|
||||
{
|
||||
tOld.tm_hour = 0;
|
||||
tOld.tm_yday++;
|
||||
}
|
||||
if( tOld.tm_yday == DAYS_PER_YEAR )
|
||||
{
|
||||
tOld.tm_yday = 0;
|
||||
tOld.tm_year++;
|
||||
}
|
||||
|
||||
m_iCoinsByHourForYear[tOld.tm_yday][tOld.tm_hour] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void Bookkeeper::CoinInserted()
|
||||
{
|
||||
UpdateLastSeenTime();
|
||||
|
||||
long lOldTime = m_iLastSeenTime;
|
||||
tm *pNewTime = localtime( &lOldTime );
|
||||
|
||||
m_iCoinsByHourForYear[pNewTime->tm_yday][pNewTime->tm_hour]++;
|
||||
}
|
||||
|
||||
int Bookkeeper::GetCoinsForDay( int iDayOfYear )
|
||||
{
|
||||
int iCoins = 0;
|
||||
for( int i=0; i<HOURS_PER_DAY; i++ )
|
||||
iCoins += m_iCoinsByHourForYear[iDayOfYear][i];
|
||||
return iCoins;
|
||||
}
|
||||
|
||||
|
||||
void Bookkeeper::GetCoinsLast7Days( int coins[7] )
|
||||
{
|
||||
UpdateLastSeenTime();
|
||||
|
||||
long lOldTime = m_iLastSeenTime;
|
||||
tm time = *localtime( &lOldTime );
|
||||
|
||||
for( int i=0; i<7; i++ )
|
||||
{
|
||||
time = GetYesterday( time );
|
||||
coins[i] = GetCoinsForDay( time.tm_yday );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Bookkeeper::GetCoinsLast52Weeks( int coins[52] )
|
||||
{
|
||||
UpdateLastSeenTime();
|
||||
|
||||
long lOldTime = m_iLastSeenTime;
|
||||
tm time = *localtime( &lOldTime );
|
||||
|
||||
time = GetLastSunday( time );
|
||||
|
||||
for( int w=0; w<52; w++ )
|
||||
{
|
||||
coins[w] = 0;
|
||||
|
||||
for( int d=0; d<DAYS_IN_WEEK; d++ )
|
||||
{
|
||||
time = GetYesterday( time );
|
||||
coins[w] += GetCoinsForDay( time.tm_yday );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Bookkeeper::GetCoinsByDayOfWeek( int coins[DAYS_IN_WEEK] )
|
||||
{
|
||||
UpdateLastSeenTime();
|
||||
|
||||
for( int i=0; i<DAYS_IN_WEEK; i++ )
|
||||
coins[i] = 0;
|
||||
|
||||
long lOldTime = m_iLastSeenTime;
|
||||
tm time = *localtime( &lOldTime );
|
||||
|
||||
for( int d=0; d<DAYS_PER_YEAR; d++ )
|
||||
{
|
||||
time = GetYesterday( time );
|
||||
coins[GetDayOfWeek(time)] += GetCoinsForDay( time.tm_yday );
|
||||
}
|
||||
}
|
||||
|
||||
void Bookkeeper::GetCoinsByHour( int coins[HOURS_PER_DAY] )
|
||||
{
|
||||
UpdateLastSeenTime();
|
||||
|
||||
for( int h=0; h<HOURS_PER_DAY; h++ )
|
||||
{
|
||||
coins[h] = 0;
|
||||
|
||||
for( int d=0; d<DAYS_PER_YEAR; d++ )
|
||||
coins[h] += m_iCoinsByHourForYear[d][h];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
#ifndef Bookkeeper_H
|
||||
#define Bookkeeper_H
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
Class: Bookkeeper
|
||||
|
||||
Desc: Interface to profiles that exist on the machine or a memory card
|
||||
plugged into the machine.
|
||||
|
||||
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||
Chris Danford
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "Style.h"
|
||||
#include "SDL_Types.h"
|
||||
|
||||
const int DAYS_PER_YEAR = 365;
|
||||
const int HOURS_PER_DAY = 24;
|
||||
const int DAYS_IN_WEEK = 7;
|
||||
|
||||
class Bookkeeper
|
||||
{
|
||||
public:
|
||||
Bookkeeper();
|
||||
~Bookkeeper();
|
||||
|
||||
void CoinInserted();
|
||||
void UpdateLastSeenTime();
|
||||
|
||||
void GetCoinsLast7Days( int coins[7] );
|
||||
void GetCoinsLast52Weeks( int coins[52] );
|
||||
void GetCoinsByDayOfWeek( int coins[DAYS_IN_WEEK] );
|
||||
void GetCoinsByHour( int coins[HOURS_PER_DAY] );
|
||||
|
||||
void ReadFromDisk();
|
||||
void WriteToDisk();
|
||||
|
||||
private:
|
||||
|
||||
int GetCoinsForDay( int iDayOfYear );
|
||||
|
||||
int m_iLastSeenTime;
|
||||
int m_iTotalCoins;
|
||||
int m_iTotalUptimeSeconds;
|
||||
int m_iTotalPlaySeconds;
|
||||
int m_iTotalPlays;
|
||||
int m_iCoinsByHourForYear[DAYS_PER_YEAR][HOURS_PER_DAY];
|
||||
};
|
||||
|
||||
|
||||
extern Bookkeeper* BOOKKEEPER; // global and accessable from anywhere in our program
|
||||
|
||||
#endif
|
||||
@@ -290,6 +290,7 @@ void Screen::ClearMessageQueue( const ScreenMessage SM )
|
||||
#include "ScreenOptionsMaster.h"
|
||||
#include "ScreenCenterImage.h"
|
||||
#include "ScreenTestInput.h"
|
||||
#include "ScreenBookkeeping.h"
|
||||
|
||||
Screen* Screen::Create( CString sClassName )
|
||||
{
|
||||
@@ -389,6 +390,7 @@ Screen* Screen::Create( CString sClassName )
|
||||
IF_RETURN( ScreenOptionsMaster );
|
||||
IF_RETURN( ScreenCenterImage );
|
||||
IF_RETURN( ScreenTestInput );
|
||||
IF_RETURN( ScreenBookkeeping );
|
||||
|
||||
RageException::Throw( "Invalid Screen class name '%s'", sClassName.c_str() );
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ void ScreenAttract::AttractInput( const DeviceInput& DeviceI, const InputEventTy
|
||||
case COIN_HOME:
|
||||
case COIN_FREE:
|
||||
SOUND->StopMusic();
|
||||
/* We already played the it was a coin was inserted. Don't play it again. */
|
||||
/* We already played the coin sound. Don't play it again. */
|
||||
if( MenuI.button != MENU_BUTTON_COIN )
|
||||
SOUND->PlayOnce( THEME->GetPathToS("Common coin") );
|
||||
SDL_Delay( 800 ); // do a little pause, like the arcade does
|
||||
|
||||
@@ -0,0 +1,254 @@
|
||||
#include "global.h"
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
Class: ScreenBookkeeping
|
||||
|
||||
Desc: Where the player maps device input to pad input.
|
||||
|
||||
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||
Chris Danford
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "ScreenBookkeeping.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "ScreenManager.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "RageLog.h"
|
||||
#include "InputMapper.h"
|
||||
#include "GameManager.h"
|
||||
#include "GameState.h"
|
||||
#include "RageSounds.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "RageDisplay.h"
|
||||
#include "Bookkeeper.h"
|
||||
|
||||
const CString LAST_7_DAYS_NAME[7] =
|
||||
{
|
||||
"Yesterday",
|
||||
"2 Days Ago",
|
||||
"3 Days Ago",
|
||||
"4 Days Ago",
|
||||
"5 Days Ago",
|
||||
"6 Days Ago",
|
||||
"7 Days Ago",
|
||||
};
|
||||
|
||||
const CString DAY_TO_NAME[DAYS_IN_WEEK] =
|
||||
{
|
||||
"Sunday",
|
||||
"Monday",
|
||||
"Tuesday",
|
||||
"Wednesday",
|
||||
"Thursday",
|
||||
"Friday",
|
||||
"Saturday",
|
||||
};
|
||||
|
||||
CString HourToString( int iHourIndex )
|
||||
{
|
||||
return ssprintf("%02d:00", iHourIndex);
|
||||
}
|
||||
|
||||
|
||||
ScreenBookkeeping::ScreenBookkeeping( CString sClassName ) : Screen( sClassName )
|
||||
{
|
||||
LOG->Trace( "ScreenBookkeeping::ScreenBookkeeping()" );
|
||||
|
||||
m_textTitle.LoadFromFont( THEME->GetPathToF("Common title") );
|
||||
m_textTitle.SetText( "header" );
|
||||
m_textTitle.SetXY( CENTER_X, 60 );
|
||||
m_textTitle.SetDiffuse( RageColor(1,1,1,1) );
|
||||
m_textTitle.SetZoom( 0.8f );
|
||||
this->AddChild( &m_textTitle );
|
||||
|
||||
for( int i=0; i<NUM_BOOKKEEPING_COLS; i++ )
|
||||
{
|
||||
float fX = SCALE( i, 0.f, NUM_BOOKKEEPING_COLS-1, SCREEN_LEFT+50, SCREEN_RIGHT-50 );
|
||||
float fY = CENTER_Y+16;
|
||||
m_textCols[i].LoadFromFont( THEME->GetPathToF("Common normal") );
|
||||
m_textCols[i].SetText( ssprintf("%d",i) );
|
||||
m_textCols[i].SetXY( fX, fY );
|
||||
m_textCols[i].SetDiffuse( RageColor(1,1,1,1) );
|
||||
m_textCols[i].SetZoom( 0.6f );
|
||||
this->AddChild( &m_textCols[i] );
|
||||
}
|
||||
|
||||
m_Menu.Load( "ScreenBookkeeping" );
|
||||
this->AddChild( &m_Menu );
|
||||
|
||||
ChangeView( (View)0 );
|
||||
|
||||
SOUND->PlayMusic( THEME->GetPathToS("ScreenBookkeeping music") );
|
||||
}
|
||||
|
||||
ScreenBookkeeping::~ScreenBookkeeping()
|
||||
{
|
||||
LOG->Trace( "ScreenBookkeeping::~ScreenBookkeeping()" );
|
||||
}
|
||||
|
||||
void ScreenBookkeeping::DrawPrimitives()
|
||||
{
|
||||
m_Menu.DrawBottomLayer();
|
||||
Screen::DrawPrimitives();
|
||||
m_Menu.DrawTopLayer();
|
||||
}
|
||||
|
||||
void ScreenBookkeeping::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
|
||||
{
|
||||
if( type != IET_FIRST_PRESS && type != IET_SLOW_REPEAT )
|
||||
return; // ignore
|
||||
|
||||
Screen::Input( DeviceI, type, GameI, MenuI, StyleI ); // default handler
|
||||
}
|
||||
|
||||
void ScreenBookkeeping::HandleScreenMessage( const ScreenMessage SM )
|
||||
{
|
||||
switch( SM )
|
||||
{
|
||||
case SM_GoToNextScreen:
|
||||
case SM_GoToPrevScreen:
|
||||
SCREENMAN->SetNewScreen( "ScreenOptionsMenu" );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenBookkeeping::MenuLeft( PlayerNumber pn )
|
||||
{
|
||||
m_View = (View)(m_View-1);
|
||||
CLAMP( (int&)m_View, 0, NUM_VIEWS-1 );
|
||||
ChangeView( m_View );
|
||||
}
|
||||
|
||||
void ScreenBookkeeping::MenuRight( PlayerNumber pn )
|
||||
{
|
||||
m_View = (View)(m_View+1);
|
||||
CLAMP( (int&)m_View, 0, NUM_VIEWS-1 );
|
||||
ChangeView( m_View );
|
||||
}
|
||||
|
||||
void ScreenBookkeeping::MenuStart( PlayerNumber pn )
|
||||
{
|
||||
if( !m_Menu.IsTransitioning() )
|
||||
{
|
||||
SOUND->PlayOnce( THEME->GetPathToS("Common start") );
|
||||
m_Menu.StartTransitioning( SM_GoToNextScreen );
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenBookkeeping::MenuBack( PlayerNumber pn )
|
||||
{
|
||||
if(!m_Menu.IsTransitioning())
|
||||
{
|
||||
SOUND->PlayOnce( THEME->GetPathToS("Common start") );
|
||||
m_Menu.StartTransitioning( SM_GoToPrevScreen );
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenBookkeeping::ChangeView( View newView )
|
||||
{
|
||||
m_View = newView;
|
||||
|
||||
switch( m_View )
|
||||
{
|
||||
case LAST_7_DAYS:
|
||||
{
|
||||
m_textTitle.SetText( "Coin Data of Last 7 days" );
|
||||
|
||||
int coins[7];
|
||||
BOOKKEEPER->GetCoinsLast7Days( coins );
|
||||
int iTotalLast7 = 0;
|
||||
|
||||
CString sTitle, sData;
|
||||
for( int i=0; i<7; i++ )
|
||||
{
|
||||
sTitle += LAST_7_DAYS_NAME[i] + "\n";
|
||||
sData += ssprintf("%d",coins[i]) + "\n";
|
||||
iTotalLast7 += coins[i];
|
||||
}
|
||||
|
||||
sTitle += "\n";
|
||||
sData += "\n";
|
||||
|
||||
sTitle += "Average\n";
|
||||
sData += ssprintf("%d\n",iTotalLast7/7);
|
||||
|
||||
m_textCols[0].SetHorizAlign( Actor::align_left );
|
||||
m_textCols[0].SetText( sTitle );
|
||||
m_textCols[1].SetText( "" );
|
||||
m_textCols[2].SetText( "" );
|
||||
m_textCols[3].SetHorizAlign( Actor::align_right );
|
||||
m_textCols[3].SetText( sData );
|
||||
}
|
||||
break;
|
||||
case LAST_52_WEEKS:
|
||||
{
|
||||
m_textTitle.SetText( "Last 52 weeks" );
|
||||
|
||||
int coins[52];
|
||||
BOOKKEEPER->GetCoinsLast52Weeks( coins );
|
||||
|
||||
CString sTitle, sData;
|
||||
for( int col=0; col<4; col++ )
|
||||
{
|
||||
CString sTemp;
|
||||
for( int row=0; row<52/4; row++ )
|
||||
{
|
||||
int week = row*4+col;
|
||||
sTemp += ssprintf("%d ago: %d\n", week+1, coins[week]);
|
||||
}
|
||||
|
||||
m_textCols[col].SetHorizAlign( Actor::align_left );
|
||||
m_textCols[col].SetText( sTemp );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DAY_OF_WEEK:
|
||||
{
|
||||
m_textTitle.SetText( "Day of week" );
|
||||
|
||||
int coins[DAYS_IN_WEEK];
|
||||
BOOKKEEPER->GetCoinsByDayOfWeek( coins );
|
||||
|
||||
CString sTitle, sData;
|
||||
for( int i=0; i<DAYS_IN_WEEK; i++ )
|
||||
{
|
||||
sTitle += DAY_TO_NAME[i] + "\n";
|
||||
sData += ssprintf("%d",coins[i]) + "\n";
|
||||
}
|
||||
|
||||
m_textCols[0].SetHorizAlign( Actor::align_left );
|
||||
m_textCols[0].SetText( sTitle );
|
||||
m_textCols[1].SetText( "" );
|
||||
m_textCols[2].SetText( "" );
|
||||
m_textCols[3].SetHorizAlign( Actor::align_right );
|
||||
m_textCols[3].SetText( sData );
|
||||
}
|
||||
break;
|
||||
case HOUR_OF_DAY:
|
||||
{
|
||||
m_textTitle.SetText( "Hour of day" );
|
||||
|
||||
int coins[HOURS_PER_DAY];
|
||||
BOOKKEEPER->GetCoinsByHour( coins );
|
||||
|
||||
CString sTitle, sData;
|
||||
for( int i=0; i<HOURS_PER_DAY; i++ )
|
||||
{
|
||||
sTitle += HourToString(i) + "\n";
|
||||
sData += ssprintf("%d",coins[i]) + "\n";
|
||||
}
|
||||
|
||||
m_textCols[0].SetHorizAlign( Actor::align_left );
|
||||
m_textCols[0].SetText( sTitle );
|
||||
m_textCols[1].SetText( "" );
|
||||
m_textCols[2].SetText( "" );
|
||||
m_textCols[3].SetHorizAlign( Actor::align_right );
|
||||
m_textCols[3].SetText( sData );
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ASSERT(0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
Class: ScreenBookkeeping
|
||||
|
||||
Desc: Where the player maps device input to instrument buttons.
|
||||
|
||||
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||
Chris Danford
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "Screen.h"
|
||||
#include "Sprite.h"
|
||||
#include "BitmapText.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "GrayArrow.h"
|
||||
#include "InputMapper.h"
|
||||
#include "MenuElements.h"
|
||||
#include "RageInputDevice.h"
|
||||
|
||||
const int NUM_BOOKKEEPING_COLS = 4;
|
||||
|
||||
class ScreenBookkeeping : public Screen
|
||||
{
|
||||
public:
|
||||
ScreenBookkeeping( CString sName );
|
||||
virtual ~ScreenBookkeeping();
|
||||
|
||||
virtual void DrawPrimitives();
|
||||
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
|
||||
virtual void HandleScreenMessage( const ScreenMessage SM );
|
||||
|
||||
virtual void MenuLeft( PlayerNumber pn );
|
||||
virtual void MenuRight( PlayerNumber pn );
|
||||
virtual void MenuStart( PlayerNumber pn );
|
||||
virtual void MenuBack( PlayerNumber pn );
|
||||
|
||||
private:
|
||||
enum View { LAST_7_DAYS, LAST_52_WEEKS, DAY_OF_WEEK, HOUR_OF_DAY, NUM_VIEWS };
|
||||
|
||||
void ChangeView( View newView );
|
||||
|
||||
View m_View;
|
||||
BitmapText m_textTitle;
|
||||
BitmapText m_textCols[NUM_BOOKKEEPING_COLS];
|
||||
|
||||
MenuElements m_Menu;
|
||||
};
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
#include "UnlockSystem.h"
|
||||
#include "arch/ArchHooks/ArchHooks.h"
|
||||
#include "RageFile.h"
|
||||
#include "Bookkeeper.h"
|
||||
|
||||
|
||||
#if defined(_XBOX)
|
||||
@@ -807,6 +808,7 @@ int main(int argc, char* argv[])
|
||||
SOUNDMAN->SetPrefs(PREFSMAN->m_fSoundVolume);
|
||||
SOUND = new RageSounds;
|
||||
PROFILEMAN = new ProfileManager;
|
||||
BOOKKEEPER = new Bookkeeper;
|
||||
INPUTFILTER = new InputFilter;
|
||||
INPUTMAPPER = new InputMapper;
|
||||
INPUTQUEUE = new InputQueue;
|
||||
@@ -909,6 +911,7 @@ int main(int argc, char* argv[])
|
||||
SAFE_DELETE( THEME );
|
||||
SAFE_DELETE( ANNOUNCER );
|
||||
SAFE_DELETE( PROFILEMAN );
|
||||
SAFE_DELETE( BOOKKEEPER );
|
||||
SAFE_DELETE( SOUND );
|
||||
SAFE_DELETE( SOUNDMAN );
|
||||
SAFE_DELETE( FONT );
|
||||
@@ -942,6 +945,7 @@ bool HandleGlobalInputs( DeviceInput DeviceI, InputEventType type, GameInput Gam
|
||||
if( !GAMESTATE->m_bIsOnSystemMenu )
|
||||
{
|
||||
SCREENMAN->SystemMessage( "OPERATOR" );
|
||||
GAMESTATE->Reset();
|
||||
SCREENMAN->SetNewScreen( "ScreenOptionsMenu" );
|
||||
}
|
||||
return true;
|
||||
@@ -951,6 +955,7 @@ bool HandleGlobalInputs( DeviceInput DeviceI, InputEventType type, GameInput Gam
|
||||
if( GAMESTATE->m_bEditing ) // no coins while editing
|
||||
break;
|
||||
GAMESTATE->m_iCoins++;
|
||||
BOOKKEEPER->CoinInserted();
|
||||
SCREENMAN->RefreshCreditsMessages();
|
||||
SOUND->PlayOnce( THEME->GetPathToS("Common coin") );
|
||||
return false; // Attract need to know because they go to TitleMenu on > 1 credit
|
||||
|
||||
@@ -65,7 +65,8 @@ IntDir=.\../Debug6
|
||||
TargetDir=\stepmania\stepmania
|
||||
TargetName=StepMania-debug
|
||||
SOURCE="$(InputPath)"
|
||||
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
|
||||
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp \
|
||||
/Fo$(IntDir)\
|
||||
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi
|
||||
# End Special Build Tool
|
||||
|
||||
@@ -102,8 +103,8 @@ IntDir=.\Debug
|
||||
TargetDir=\stepmania\stepmania
|
||||
TargetName=default
|
||||
SOURCE="$(InputPath)"
|
||||
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp \
|
||||
/Fo$(IntDir)\
|
||||
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp \
|
||||
/Fo$(IntDir)\
|
||||
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi
|
||||
# End Special Build Tool
|
||||
|
||||
@@ -143,7 +144,8 @@ IntDir=.\../Release6
|
||||
TargetDir=\stepmania\stepmania
|
||||
TargetName=StepMania
|
||||
SOURCE="$(InputPath)"
|
||||
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
|
||||
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp \
|
||||
/Fo$(IntDir)\
|
||||
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi
|
||||
# End Special Build Tool
|
||||
|
||||
@@ -184,8 +186,8 @@ IntDir=.\StepMania___Xbox_Release
|
||||
TargetDir=\stepmania\stepmania
|
||||
TargetName=default
|
||||
SOURCE="$(InputPath)"
|
||||
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp \
|
||||
/Fo$(IntDir)\
|
||||
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp \
|
||||
/Fo$(IntDir)\
|
||||
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi
|
||||
# End Special Build Tool
|
||||
|
||||
@@ -4044,6 +4046,25 @@ SOURCE=.\ScreenAttract.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ScreenBookkeeping.cpp
|
||||
|
||||
!IF "$(CFG)" == "StepMania - Win32 Debug"
|
||||
|
||||
!ELSEIF "$(CFG)" == "StepMania - Xbox Debug"
|
||||
|
||||
!ELSEIF "$(CFG)" == "StepMania - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "StepMania - Xbox Release"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ScreenBookkeeping.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ScreenCaution.cpp
|
||||
|
||||
!IF "$(CFG)" == "StepMania - Win32 Debug"
|
||||
@@ -5089,6 +5110,25 @@ SOURCE=.\AnnouncerManager.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Bookkeeper.cpp
|
||||
|
||||
!IF "$(CFG)" == "StepMania - Win32 Debug"
|
||||
|
||||
!ELSEIF "$(CFG)" == "StepMania - Xbox Debug"
|
||||
|
||||
!ELSEIF "$(CFG)" == "StepMania - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "StepMania - Xbox Release"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Bookkeeper.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\FontManager.cpp
|
||||
|
||||
!IF "$(CFG)" == "StepMania - Win32 Debug"
|
||||
|
||||
Reference in New Issue
Block a user