2002-11-16 08:07:38 +00:00
|
|
|
#ifndef SCREENOPTIONS_H
|
|
|
|
|
#define SCREENOPTIONS_H
|
2002-05-20 08:59:37 +00:00
|
|
|
/*
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
File: ScreenOptions.h
|
|
|
|
|
|
|
|
|
|
Desc: A grid of options, and the selected option is drawn with a highlight rectangle.
|
|
|
|
|
|
|
|
|
|
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 "RandomSample.h"
|
|
|
|
|
#include "Quad.h"
|
|
|
|
|
#include "MenuElements.h"
|
2002-08-13 23:26:46 +00:00
|
|
|
#include "OptionsCursor.h"
|
2002-09-03 06:33:08 +00:00
|
|
|
#include "OptionIcon.h"
|
2002-05-20 08:59:37 +00:00
|
|
|
|
|
|
|
|
|
2003-08-23 22:04:57 +00:00
|
|
|
const unsigned MAX_OPTION_LINES = 40;
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2003-03-15 19:25:37 +00:00
|
|
|
struct OptionRow
|
|
|
|
|
{
|
|
|
|
|
CString name;
|
2003-08-23 22:04:57 +00:00
|
|
|
bool bOneChoiceForAllPlayers;
|
2003-03-15 19:25:37 +00:00
|
|
|
vector<CString> choices;
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2003-09-27 08:00:10 +00:00
|
|
|
OptionRow(): name(""), bOneChoiceForAllPlayers(false) { }
|
|
|
|
|
|
2003-09-19 01:45:45 +00:00
|
|
|
OptionRow( const char *n, int b, const char *c0=NULL, const char *c1=NULL, const char *c2=NULL, const char *c3=NULL, const char *c4=NULL, const char *c5=NULL, const char *c6=NULL, const char *c7=NULL, const char *c8=NULL, const char *c9=NULL, const char *c10=NULL, const char *c11=NULL, const char *c12=NULL, const char *c13=NULL, const char *c14=NULL, const char *c15=NULL, const char *c16=NULL, const char *c17=NULL, const char *c18=NULL, const char *c19=NULL )
|
2003-03-15 19:25:37 +00:00
|
|
|
{
|
|
|
|
|
name = n;
|
2003-08-23 22:04:57 +00:00
|
|
|
bOneChoiceForAllPlayers = !!b;
|
2003-09-19 01:45:45 +00:00
|
|
|
#define PUSH( c ) if(c) choices.push_back(c);
|
2003-08-16 18:40:05 +00:00
|
|
|
PUSH(c0);PUSH(c1);PUSH(c2);PUSH(c3);PUSH(c4);PUSH(c5);PUSH(c6);PUSH(c7);PUSH(c8);PUSH(c9);PUSH(c10);PUSH(c11);PUSH(c12);PUSH(c13);PUSH(c14);PUSH(c15);PUSH(c16);PUSH(c17);PUSH(c18);PUSH(c19);
|
2003-03-17 21:13:14 +00:00
|
|
|
#undef PUSH
|
2003-03-15 19:25:37 +00:00
|
|
|
}
|
2002-05-20 08:59:37 +00:00
|
|
|
};
|
|
|
|
|
|
2002-08-13 23:26:46 +00:00
|
|
|
enum InputMode
|
|
|
|
|
{
|
2003-08-23 22:04:57 +00:00
|
|
|
INPUTMODE_INDIVIDUAL, // each player controls their own cursor
|
|
|
|
|
INPUTMODE_TOGETHER // both players control the same cursor
|
2002-08-13 23:26:46 +00:00
|
|
|
};
|
2002-05-20 08:59:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
class ScreenOptions : public Screen
|
|
|
|
|
{
|
|
|
|
|
public:
|
2003-09-27 04:58:30 +00:00
|
|
|
ScreenOptions( CString sClassName );
|
2003-11-05 07:46:20 +00:00
|
|
|
void Init( InputMode im, OptionRow OptionRow[], int iNumOptionLines );
|
2002-05-20 08:59:37 +00:00
|
|
|
virtual ~ScreenOptions();
|
|
|
|
|
virtual void Update( float fDeltaTime );
|
|
|
|
|
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 );
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
virtual void ImportOptions() = 0;
|
|
|
|
|
virtual void ExportOptions() = 0;
|
|
|
|
|
void InitOptionsText();
|
2002-09-04 03:49:08 +00:00
|
|
|
void GetWidthXY( PlayerNumber pn, int iRow, int &iWidthOut, int &iXOut, int &iYOut );
|
2003-09-06 07:42:28 +00:00
|
|
|
BitmapText &GetTextItemForRow( PlayerNumber pn, int iRow );
|
2002-05-20 08:59:37 +00:00
|
|
|
void PositionUnderlines();
|
2002-09-03 06:33:08 +00:00
|
|
|
void PositionIcons();
|
2002-09-03 22:31:06 +00:00
|
|
|
void RefreshIcons();
|
2002-09-04 03:49:08 +00:00
|
|
|
void PositionCursors();
|
2003-06-16 03:29:59 +00:00
|
|
|
void PositionItems();
|
2002-09-04 03:49:08 +00:00
|
|
|
void TweenCursor( PlayerNumber player_no );
|
2003-08-23 22:13:06 +00:00
|
|
|
void UpdateText( PlayerNumber player_no, int row );
|
2002-09-04 03:49:08 +00:00
|
|
|
void UpdateEnabledDisabled();
|
2002-08-22 07:35:58 +00:00
|
|
|
virtual void OnChange();
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2003-02-12 00:41:56 +00:00
|
|
|
virtual void MenuBack( PlayerNumber pn );
|
|
|
|
|
virtual void MenuStart( PlayerNumber pn );
|
|
|
|
|
|
|
|
|
|
void StartGoToNextState();
|
2002-05-20 08:59:37 +00:00
|
|
|
|
|
|
|
|
virtual void GoToNextState() = 0;
|
|
|
|
|
virtual void GoToPrevState() = 0;
|
|
|
|
|
|
2003-08-23 22:04:57 +00:00
|
|
|
void MenuLeft( PlayerNumber pn ) { ChangeValue(pn,-1); }
|
|
|
|
|
void MenuRight( PlayerNumber pn ) { ChangeValue(pn,+1); }
|
|
|
|
|
void ChangeValue( PlayerNumber pn, int iDelta );
|
2002-09-04 03:49:08 +00:00
|
|
|
void MenuUp( PlayerNumber pn );
|
|
|
|
|
void MenuDown( PlayerNumber pn );
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2003-05-30 21:36:56 +00:00
|
|
|
int GetCurrentRow(PlayerNumber pn = PLAYER_1) const { return m_iCurrentRow[pn]; }
|
|
|
|
|
|
|
|
|
|
MenuElements m_Menu;
|
|
|
|
|
OptionRow* m_OptionRow;
|
|
|
|
|
|
2003-11-01 19:36:52 +00:00
|
|
|
protected: // derived classes need access to these
|
2003-05-30 21:36:56 +00:00
|
|
|
int m_iSelectedOption[NUM_PLAYERS][MAX_OPTION_LINES];
|
2003-11-01 19:36:52 +00:00
|
|
|
int m_iCurrentRow[NUM_PLAYERS];
|
2003-05-30 21:36:56 +00:00
|
|
|
|
|
|
|
|
private:
|
2002-08-13 23:26:46 +00:00
|
|
|
InputMode m_InputMode;
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2002-09-04 03:49:08 +00:00
|
|
|
int m_iNumOptionRows;
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2002-08-13 23:26:46 +00:00
|
|
|
ActorFrame m_framePage;
|
|
|
|
|
Sprite m_sprPage;
|
2003-03-31 14:02:39 +00:00
|
|
|
Sprite m_sprBullets[MAX_OPTION_LINES];
|
|
|
|
|
BitmapText m_textTitles[MAX_OPTION_LINES];
|
2003-09-04 19:53:07 +00:00
|
|
|
vector<BitmapText *> m_textItems[MAX_OPTION_LINES];
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2003-03-31 23:03:43 +00:00
|
|
|
bool m_bRowIsLong[MAX_OPTION_LINES]; // goes off edge of screen
|
2003-05-30 21:36:56 +00:00
|
|
|
|
2003-06-16 03:29:59 +00:00
|
|
|
/* True if the item is off of the screen. */
|
|
|
|
|
bool m_bRowIsHidden[MAX_OPTION_LINES];
|
|
|
|
|
float m_fRowY[MAX_OPTION_LINES];
|
|
|
|
|
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2002-08-13 23:26:46 +00:00
|
|
|
OptionsCursor m_Underline[NUM_PLAYERS][MAX_OPTION_LINES];
|
2002-09-03 06:33:08 +00:00
|
|
|
OptionIcon m_OptionIcons[NUM_PLAYERS][MAX_OPTION_LINES];
|
2002-08-13 23:26:46 +00:00
|
|
|
OptionsCursor m_Highlight[NUM_PLAYERS];
|
|
|
|
|
|
2003-11-05 07:46:20 +00:00
|
|
|
BitmapText m_textExplanation[NUM_PLAYERS];
|
2002-09-10 21:16:34 +00:00
|
|
|
|
2003-01-02 08:13:34 +00:00
|
|
|
RageSound m_SoundChangeCol;
|
|
|
|
|
RageSound m_SoundNextRow;
|
|
|
|
|
RageSound m_SoundPrevRow;
|
|
|
|
|
RageSound m_SoundStart;
|
2002-05-20 08:59:37 +00:00
|
|
|
};
|
|
|
|
|
|
2002-11-16 08:07:38 +00:00
|
|
|
|
|
|
|
|
#endif
|