#pragma once /* ----------------------------------------------------------------------------- File: GameConstantsAndTypes.h Desc: These things don't change very often. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ ///////////////////////////// // Screen Dimensions ///////////////////////////// #define SCREEN_WIDTH (640) #define SCREEN_HEIGHT (480) #define SCREEN_LEFT (0) #define SCREEN_RIGHT (SCREEN_WIDTH) #define SCREEN_TOP (0) #define SCREEN_BOTTOM (SCREEN_HEIGHT) #define CENTER_X (SCREEN_LEFT + (SCREEN_RIGHT - SCREEN_LEFT)/2.0f) #define CENTER_Y (SCREEN_TOP + (SCREEN_BOTTOM - SCREEN_TOP)/2.0f) ///////////////////////// // Note definitions ///////////////////////// typedef unsigned char TapNote; enum { TRACK_1 = 0, TRACK_2, TRACK_3, TRACK_4, TRACK_5, TRACK_6, TRACK_7, TRACK_8, TRACK_9, TRACK_10, TRACK_11, TRACK_12, TRACK_13, TRACK_14, TRACK_15, TRACK_16, MAX_NOTE_TRACKS // leave this at the end }; const int MAX_MEASURES = 200; // this should be long enough to hold 10:00 minute songs ( const int BEATS_PER_MEASURE = 4; const int MAX_BEATS = MAX_MEASURES * BEATS_PER_MEASURE; const int ELEMENTS_PER_BEAT = 12; // It is important that this number is evenly divisible by 2, 3, and 4. const int ELEMENTS_PER_MEASURE = ELEMENTS_PER_BEAT * BEATS_PER_MEASURE; const int MAX_TAP_NOTE_ROWS = MAX_BEATS*ELEMENTS_PER_BEAT; const int MAX_HOLD_NOTE_ELEMENTS = 200; enum NoteType { NOTE_4TH, // quarter notes NOTE_8TH, // eighth notes NOTE_12TH, // triplets NOTE_16TH, // sixteenth notes NUM_NOTE_TYPES }; inline D3DXCOLOR NoteTypeToColor( NoteType nt ) { switch( nt ) { case NOTE_4TH: return D3DXCOLOR(1,0,0,1); // red case NOTE_8TH: return D3DXCOLOR(0,0,1,1); // blue case NOTE_12TH: return D3DXCOLOR(1,0,1,1); // purple case NOTE_16TH: return D3DXCOLOR(1,1,0,1); // yellow default: ASSERT( false ); return D3DXCOLOR(1,1,1,1); } }; inline float NoteTypeToBeat( NoteType nt ) { switch( nt ) { case NOTE_4TH: return 1.0f; // quarter notes case NOTE_8TH: return 1.0f/2; // eighth notes case NOTE_12TH: return 1.0f/3; // triplets case NOTE_16TH: return 1.0f/4; // sixteenth notes default: ASSERT( false ); return 0; } }; inline bool IsNoteOfType( int iNoteIndex, NoteType t ) { switch( t ) { case NOTE_4TH: return iNoteIndex % (ELEMENTS_PER_MEASURE/4) == 0; case NOTE_8TH: return iNoteIndex % (ELEMENTS_PER_MEASURE/8) == 0; case NOTE_12TH: return iNoteIndex % (ELEMENTS_PER_MEASURE/12) == 0; case NOTE_16TH: return iNoteIndex % (ELEMENTS_PER_MEASURE/16) == 0; default: ASSERT( false ); return false; } }; inline D3DXCOLOR GetNoteColorFromIndex( int iStepIndex ) { for( int t=0; t 2 ) sReturn.Delete( sReturn.GetLength()-2, 2 ); // delete the trailing ", " return sReturn; } }; struct SongOptions { SongOptions() { m_FailType = FAIL_ARCADE; m_AssistType = ASSIST_NONE; m_fMusicRate = 1.0f; }; enum FailType { FAIL_ARCADE=0, FAIL_END_OF_SONG, FAIL_OFF }; FailType m_FailType; enum AssistType { ASSIST_NONE=0, ASSIST_TICK }; AssistType m_AssistType; float m_fMusicRate; }; /////////////////////////// // Scoring stuff /////////////////////////// enum TapNoteScore { TNS_NONE, TNS_MISS, TNS_BOO, TNS_GOOD, TNS_GREAT, TNS_PERFECT, }; inline int TapNoteScoreToDancePoints( TapNoteScore tns ) { // What "Aaron in Japan" says: /* switch( tns ) { case TNS_PERFECT: return +2; case TNS_GREAT: return +1; case TNS_GOOD: return +0; case TNS_BOO: return -4; case TNS_MISS: return -8; case TNS_NONE: return -8; default: ASSERT(0); } */ // What seems more realistic to me: switch( tns ) { case TNS_PERFECT: return +2; case TNS_GREAT: return +1; case TNS_GOOD: return +0; case TNS_BOO: return 0; case TNS_MISS: return -2; case TNS_NONE: return -4; default: ASSERT(0); return 0; } } //enum TapNoteTiming { // TNT_NONE, // TNT_EARLY, // TNT_LATE //}; enum HoldNoteScore { HNS_NONE, // this HoldNote has not been scored yet HNS_OK, // the HoldNote has passed and was successfully held all the way through HNS_NG // the HoldNote has passed and they missed it }; inline int HoldNoteScoreToDancePoints( HoldNoteScore hns ) { switch( hns ) { case HNS_OK: return +6; case HNS_NG: return +0; default: ASSERT(0); return 0; } }