2009-04-16 14:14:13 +03:00
|
|
|
#ifndef __CPREGAME_H__
|
|
|
|
#define __CPREGAME_H__
|
2009-05-20 13:08:56 +03:00
|
|
|
#include "../global.h"
|
2009-04-16 14:14:13 +03:00
|
|
|
#include <set>
|
|
|
|
#include <SDL.h>
|
2009-05-20 13:08:56 +03:00
|
|
|
#include "../StartInfo.h"
|
2009-08-17 11:50:31 +03:00
|
|
|
#include "GUIBase.h"
|
2009-08-27 11:04:32 +03:00
|
|
|
#include "FunctionList.h"
|
2010-10-24 14:35:14 +03:00
|
|
|
#include "../lib/CMapInfo.h"
|
2009-04-16 14:14:13 +03:00
|
|
|
|
2009-04-15 17:03:31 +03:00
|
|
|
/*
|
|
|
|
* CPreGame.h, part of VCMI engine
|
|
|
|
*
|
|
|
|
* Authors: listed in file AUTHORS in main folder
|
|
|
|
*
|
|
|
|
* License: GNU General Public License v2.0 or later
|
|
|
|
* Full text of license available in license.txt file, in main folder
|
|
|
|
*
|
2009-04-16 14:14:13 +03:00
|
|
|
*/
|
|
|
|
|
2010-10-31 00:53:41 +03:00
|
|
|
class CMusicHandler;
|
2010-02-08 16:38:06 +02:00
|
|
|
class CMapHeader;
|
2010-02-13 18:26:47 +02:00
|
|
|
class CCampaignHeader;
|
2010-02-15 08:54:57 +02:00
|
|
|
class CTextInput;
|
2010-02-15 14:12:21 +02:00
|
|
|
class CCampaign;
|
2010-02-15 13:37:47 +02:00
|
|
|
class CGStatusBar;
|
2010-07-06 05:10:26 +03:00
|
|
|
class CTextBox;
|
2010-08-04 14:18:13 +03:00
|
|
|
class CCampaignState;
|
2010-09-03 21:42:54 +03:00
|
|
|
class CConnection;
|
2010-10-31 00:53:41 +03:00
|
|
|
struct CPackForSelectionScreen;
|
|
|
|
struct PlayerInfo;
|
2009-04-16 14:14:13 +03:00
|
|
|
|
2010-10-24 14:35:14 +03:00
|
|
|
namespace boost{ class thread; class recursive_mutex;}
|
2009-04-16 14:14:13 +03:00
|
|
|
|
2010-02-15 15:28:33 +02:00
|
|
|
enum ESortBy{_playerAm, _size, _format, _name, _viccon, _loscon, _numOfMaps}; //_numOfMaps is for campaigns
|
2010-02-08 16:38:06 +02:00
|
|
|
|
|
|
|
class mapSorter
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ESortBy sortBy;
|
2010-02-13 18:26:47 +02:00
|
|
|
bool operator()(const CMapInfo *aaa, const CMapInfo *bbb);
|
2010-02-08 16:38:06 +02:00
|
|
|
mapSorter(ESortBy es):sortBy(es){};
|
|
|
|
};
|
2009-04-16 14:14:13 +03:00
|
|
|
|
2009-08-17 11:50:31 +03:00
|
|
|
class CMenuScreen : public CIntObject
|
2009-04-16 14:14:13 +03:00
|
|
|
{
|
|
|
|
public:
|
2010-02-13 18:26:47 +02:00
|
|
|
enum EState { //where are we?
|
2010-02-24 15:03:36 +02:00
|
|
|
mainMenu, newGame, loadGame, campaignMain, saveGame, scenarioInfo, campaignList
|
2010-02-13 18:26:47 +02:00
|
|
|
};
|
|
|
|
|
2010-09-03 21:42:54 +03:00
|
|
|
enum EMultiMode {
|
2010-10-24 14:35:14 +03:00
|
|
|
SINGLE_PLAYER = 0, MULTI_HOT_SEAT, MULTI_NETWORK_HOST, MULTI_NETWORK_GUEST
|
2010-09-03 21:42:54 +03:00
|
|
|
};
|
|
|
|
|
2009-08-17 11:50:31 +03:00
|
|
|
CPicture *bgAd;
|
|
|
|
AdventureMapButton *buttons[5];
|
|
|
|
|
|
|
|
CMenuScreen(EState which);
|
|
|
|
~CMenuScreen();
|
|
|
|
void showAll(SDL_Surface * to);
|
|
|
|
void show(SDL_Surface * to);
|
|
|
|
void moveTo(CMenuScreen *next);
|
2009-04-16 14:14:13 +03:00
|
|
|
};
|
2009-08-17 11:50:31 +03:00
|
|
|
|
|
|
|
|
|
|
|
struct FileInfo
|
2009-04-16 14:14:13 +03:00
|
|
|
{
|
2009-10-10 04:42:33 +03:00
|
|
|
std::string name; // file name with full path and extension
|
2009-08-17 11:50:31 +03:00
|
|
|
std::time_t date;
|
2010-02-18 14:34:44 +02:00
|
|
|
bool inLod; //tells if this file is located in Lod
|
2009-04-16 14:14:13 +03:00
|
|
|
};
|
|
|
|
|
2010-09-03 21:42:54 +03:00
|
|
|
class CChatBox : public CIntObject
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CTextBox *chatHistory;
|
|
|
|
CTextInput *inputBox;
|
|
|
|
|
|
|
|
CChatBox(const Rect &rect);
|
2010-10-24 14:35:14 +03:00
|
|
|
|
|
|
|
void keyPressed(const SDL_KeyboardEvent & key);
|
|
|
|
|
|
|
|
void addNewMessage(const std::string &text);
|
2010-09-03 21:42:54 +03:00
|
|
|
};
|
|
|
|
|
2009-08-17 11:50:31 +03:00
|
|
|
class InfoCard : public CIntObject
|
2009-04-16 14:14:13 +03:00
|
|
|
{
|
2009-08-17 11:50:31 +03:00
|
|
|
CPicture *bg;
|
2010-02-18 14:34:44 +02:00
|
|
|
public:
|
2010-02-13 18:26:47 +02:00
|
|
|
CMenuScreen::EState type;
|
2009-08-17 11:50:31 +03:00
|
|
|
|
2010-10-24 14:35:14 +03:00
|
|
|
bool network;
|
2010-09-03 21:42:54 +03:00
|
|
|
bool chatOn; //if chat is shown, then description is hidden
|
2010-07-06 05:10:26 +03:00
|
|
|
CTextBox *mapDescription;
|
2010-09-03 21:42:54 +03:00
|
|
|
CChatBox *chat;
|
2010-10-24 14:35:14 +03:00
|
|
|
CPicture *playerListBg;
|
2010-09-03 21:42:54 +03:00
|
|
|
|
2009-08-17 11:50:31 +03:00
|
|
|
CHighlightableButtonsGroup *difficulty;
|
|
|
|
CDefHandler *sizes, *sFlags;;
|
|
|
|
|
|
|
|
void changeSelection(const CMapInfo *to);
|
|
|
|
void showAll(SDL_Surface * to);
|
2009-08-22 16:59:15 +03:00
|
|
|
void clickRight(tribool down, bool previousState);
|
|
|
|
void showTeamsPopup();
|
2010-09-03 21:42:54 +03:00
|
|
|
void toggleChat();
|
|
|
|
void setChat(bool activateChat);
|
2010-10-24 14:35:14 +03:00
|
|
|
InfoCard(bool Network = false);
|
2009-08-17 11:50:31 +03:00
|
|
|
~InfoCard();
|
2009-04-16 14:14:13 +03:00
|
|
|
};
|
2009-08-17 11:50:31 +03:00
|
|
|
|
|
|
|
class SelectionTab : public CIntObject
|
2009-04-16 14:14:13 +03:00
|
|
|
{
|
2010-02-13 18:26:47 +02:00
|
|
|
private:
|
|
|
|
CDefHandler *format; //map size
|
|
|
|
|
|
|
|
void parseMaps(std::vector<FileInfo> &files, int start = 0, int threads = 1);
|
2010-02-24 15:03:36 +02:00
|
|
|
void parseGames(std::vector<FileInfo> &files, bool multi);
|
2010-02-13 18:26:47 +02:00
|
|
|
void parseCampaigns( std::vector<FileInfo> & files );
|
|
|
|
void getFiles(std::vector<FileInfo> &out, const std::string &dirname, const std::string &ext);
|
|
|
|
CMenuScreen::EState tabType;
|
2009-04-16 14:14:13 +03:00
|
|
|
public:
|
2009-08-17 11:50:31 +03:00
|
|
|
int positions; //how many entries (games/maps) can be shown
|
|
|
|
CPicture *bg; //general bg image
|
|
|
|
CSlider *slider;
|
|
|
|
std::vector<CMapInfo> allItems;
|
|
|
|
std::vector<CMapInfo*> curItems;
|
|
|
|
size_t selectionPos;
|
|
|
|
boost::function<void(CMapInfo *)> onSelect;
|
|
|
|
|
|
|
|
ESortBy sortingBy;
|
|
|
|
bool ascending;
|
|
|
|
|
2009-08-27 11:04:32 +03:00
|
|
|
CTextInput *txt;
|
|
|
|
|
2010-02-13 18:26:47 +02:00
|
|
|
|
2009-08-27 11:04:32 +03:00
|
|
|
void filter(int size, bool selectFirst = false); //0 - all
|
2009-08-17 11:50:31 +03:00
|
|
|
void select(int position); //position: <0 - positions> position on the screen
|
2009-08-27 11:04:32 +03:00
|
|
|
void selectAbs(int position); //position: absolute position in curItems vector
|
2009-08-17 11:50:31 +03:00
|
|
|
int getPosition(int x, int y); //convert mouse coords to entry position; -1 means none
|
|
|
|
void sliderMove(int slidPos);
|
|
|
|
void sortBy(int criteria);
|
|
|
|
void sort();
|
|
|
|
void printMaps(SDL_Surface *to);
|
2009-08-27 11:04:32 +03:00
|
|
|
int getLine();
|
|
|
|
void selectFName(const std::string &fname);
|
2009-08-17 11:50:31 +03:00
|
|
|
|
|
|
|
void showAll(SDL_Surface * to);
|
|
|
|
void clickLeft(tribool down, bool previousState);
|
2009-08-23 21:01:08 +03:00
|
|
|
void keyPressed(const SDL_KeyboardEvent & key);
|
|
|
|
void onDoubleClick();
|
2010-10-24 14:35:14 +03:00
|
|
|
SelectionTab(CMenuScreen::EState Type, const boost::function<void(CMapInfo *)> &OnSelect, CMenuScreen::EMultiMode MultiPlayer = CMenuScreen::SINGLE_PLAYER);
|
2009-08-17 11:50:31 +03:00
|
|
|
~SelectionTab();
|
2009-04-16 14:14:13 +03:00
|
|
|
};
|
2009-08-17 11:50:31 +03:00
|
|
|
|
|
|
|
class OptionsTab : public CIntObject
|
2009-04-16 14:14:13 +03:00
|
|
|
{
|
2010-02-18 14:34:44 +02:00
|
|
|
CPicture *bg;
|
2009-04-16 14:14:13 +03:00
|
|
|
public:
|
2009-08-17 11:50:31 +03:00
|
|
|
enum SelType {TOWN, HERO, BONUS};
|
|
|
|
struct SelectedBox : public CIntObject //img with current town/hero/bonus
|
2009-04-16 14:14:13 +03:00
|
|
|
{
|
2009-08-17 11:50:31 +03:00
|
|
|
SelType which;
|
|
|
|
ui8 player; //serial nr
|
2009-08-22 16:59:15 +03:00
|
|
|
|
|
|
|
SDL_Surface *getImg() const;
|
|
|
|
const std::string *getText() const;
|
|
|
|
|
2009-08-17 11:50:31 +03:00
|
|
|
SelectedBox(SelType Which, ui8 Player);
|
2009-08-22 16:59:15 +03:00
|
|
|
void showAll(SDL_Surface * to);
|
|
|
|
void clickRight(tribool down, bool previousState);
|
2009-04-16 14:14:13 +03:00
|
|
|
};
|
2009-08-17 11:50:31 +03:00
|
|
|
|
|
|
|
struct PlayerOptionsEntry : public CIntObject
|
2009-04-16 14:14:13 +03:00
|
|
|
{
|
2010-10-24 14:35:14 +03:00
|
|
|
PlayerInfo π
|
2009-08-17 11:50:31 +03:00
|
|
|
PlayerSettings &s;
|
|
|
|
CPicture *bg;
|
|
|
|
AdventureMapButton *btns[6]; //left and right for town, hero, bonus
|
|
|
|
AdventureMapButton *flag;
|
|
|
|
SelectedBox *town;
|
|
|
|
SelectedBox *hero;
|
|
|
|
SelectedBox *bonus;
|
2010-03-08 00:56:51 +02:00
|
|
|
enum {HUMAN_OR_CPU, HUMAN, CPU} whoCanPlay;
|
2009-08-17 11:50:31 +03:00
|
|
|
|
|
|
|
PlayerOptionsEntry(OptionsTab *owner, PlayerSettings &S);
|
2009-08-18 11:22:56 +03:00
|
|
|
void selectButtons(bool onlyHero = true); //hides unavailable buttons
|
2009-08-17 11:50:31 +03:00
|
|
|
void showAll(SDL_Surface * to);
|
2009-04-16 14:14:13 +03:00
|
|
|
};
|
2010-10-24 14:35:14 +03:00
|
|
|
|
2009-08-17 11:50:31 +03:00
|
|
|
CSlider *turnDuration;
|
|
|
|
|
2009-04-16 14:14:13 +03:00
|
|
|
std::set<int> usedHeroes;
|
2009-08-17 11:50:31 +03:00
|
|
|
|
2010-10-24 14:35:14 +03:00
|
|
|
struct PlayerToRestore
|
|
|
|
{
|
|
|
|
int color, id;
|
|
|
|
void reset() { color = id = -1; }
|
|
|
|
PlayerToRestore(){ reset(); }
|
|
|
|
} playerToRestore;
|
|
|
|
|
|
|
|
|
2010-08-03 14:36:52 +03:00
|
|
|
std::map<int, PlayerOptionsEntry *> entries; //indexed by color
|
2009-08-17 11:50:31 +03:00
|
|
|
|
|
|
|
void nextCastle(int player, int dir); //dir == -1 or +1
|
|
|
|
void nextHero(int player, int dir); //dir == -1 or +1
|
|
|
|
void nextBonus(int player, int dir); //dir == -1 or +1
|
|
|
|
void setTurnLength(int npos);
|
|
|
|
void flagPressed(int player);
|
|
|
|
|
2010-10-24 14:35:14 +03:00
|
|
|
void recreate();
|
|
|
|
OptionsTab();
|
2009-08-17 11:50:31 +03:00
|
|
|
~OptionsTab();
|
|
|
|
void showAll(SDL_Surface * to);
|
|
|
|
|
|
|
|
int nextAllowedHero( int min, int max, int incl, int dir );
|
|
|
|
|
|
|
|
bool canUseThisHero( int ID );
|
2009-04-16 14:14:13 +03:00
|
|
|
};
|
2009-08-17 11:50:31 +03:00
|
|
|
|
2010-10-24 14:35:14 +03:00
|
|
|
class ISelectionScreenInfo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CMenuScreen::EMultiMode multiPlayer;
|
|
|
|
CMenuScreen::EState screenType; //new/save/load#Game
|
|
|
|
const CMapInfo *current;
|
|
|
|
StartInfo sInfo;
|
|
|
|
std::map<ui32, std::string> playerNames; // id of player <-> player name; 0 is reserved as ID of AI "players"
|
|
|
|
|
|
|
|
ISelectionScreenInfo(const std::map<ui32, std::string> *Names = NULL);
|
|
|
|
virtual ~ISelectionScreenInfo();
|
|
|
|
virtual void update(){};
|
|
|
|
virtual void propagateOptions() {};
|
|
|
|
virtual void postRequest(ui8 what, ui8 dir) {};
|
|
|
|
virtual void postChatMessage(const std::string &txt){};
|
|
|
|
|
|
|
|
void setPlayer(PlayerSettings &pset, unsigned player);
|
|
|
|
void updateStartInfo( std::string filename, StartInfo & sInfo, const CMapHeader * mapHeader );
|
|
|
|
|
|
|
|
int getIdOfFirstUnallocatedPlayer(); //returns 0 if none
|
|
|
|
bool isGuest() const;
|
|
|
|
bool isHost() const;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
class CSelectionScreen : public CIntObject, public ISelectionScreenInfo
|
2009-04-16 14:14:13 +03:00
|
|
|
{
|
2010-07-06 05:10:26 +03:00
|
|
|
public:
|
2009-08-17 11:50:31 +03:00
|
|
|
CPicture *bg; //general bg image
|
|
|
|
InfoCard *card;
|
|
|
|
OptionsTab *opt;
|
2010-02-18 14:34:44 +02:00
|
|
|
AdventureMapButton *start, *back;
|
2009-08-17 11:50:31 +03:00
|
|
|
|
2010-02-18 14:34:44 +02:00
|
|
|
SelectionTab *sel;
|
2009-08-17 11:50:31 +03:00
|
|
|
CIntObject *curTab;
|
2010-10-24 14:35:14 +03:00
|
|
|
|
|
|
|
boost::thread *serverHandlingThread;
|
|
|
|
boost::recursive_mutex *mx;
|
|
|
|
std::list<CPackForSelectionScreen *> upcomingPacks; //protected by mx
|
2009-08-17 11:50:31 +03:00
|
|
|
|
2010-09-03 21:42:54 +03:00
|
|
|
CConnection *serv; //connection to server, used in MP mode
|
2010-10-24 14:35:14 +03:00
|
|
|
bool ongoingClosing;
|
|
|
|
ui8 myNameID; //used when networking - otherwise all player are "mine"
|
2010-09-03 21:42:54 +03:00
|
|
|
|
2010-10-24 14:35:14 +03:00
|
|
|
CSelectionScreen(CMenuScreen::EState Type, CMenuScreen::EMultiMode MultiPlayer = CMenuScreen::SINGLE_PLAYER, const std::map<ui32, std::string> *Names = NULL);
|
2009-08-17 11:50:31 +03:00
|
|
|
~CSelectionScreen();
|
|
|
|
void toggleTab(CIntObject *tab);
|
|
|
|
void changeSelection(const CMapInfo *to);
|
2010-02-15 14:12:21 +02:00
|
|
|
void startCampaign();
|
2009-08-17 11:50:31 +03:00
|
|
|
void startGame();
|
|
|
|
void difficultyChange(int to);
|
2010-09-03 21:42:54 +03:00
|
|
|
|
|
|
|
void handleConnection();
|
2010-10-24 14:35:14 +03:00
|
|
|
|
|
|
|
void processPacks();
|
|
|
|
void setSInfo(const StartInfo &si);
|
|
|
|
void update() OVERRIDE;
|
|
|
|
void propagateOptions() OVERRIDE;
|
|
|
|
void postRequest(ui8 what, ui8 dir) OVERRIDE;
|
|
|
|
void postChatMessage(const std::string &txt) OVERRIDE;
|
|
|
|
void propagateNames();
|
2009-04-16 14:14:13 +03:00
|
|
|
};
|
2009-08-17 11:50:31 +03:00
|
|
|
|
2010-03-08 00:56:51 +02:00
|
|
|
class CSavingScreen : public CSelectionScreen
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
const CMapInfo *ourGame;
|
|
|
|
|
|
|
|
|
2010-05-27 00:59:58 +03:00
|
|
|
CSavingScreen(bool hotseat = false);
|
2010-03-08 00:56:51 +02:00
|
|
|
~CSavingScreen();
|
|
|
|
};
|
|
|
|
|
2010-10-24 14:35:14 +03:00
|
|
|
//scenario information screen shown during the game (thus not really a "pre-game" but fits here anyway)
|
|
|
|
class CScenarioInfo : public CIntObject, public ISelectionScreenInfo
|
2009-08-27 11:04:32 +03:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
AdventureMapButton *back;
|
|
|
|
InfoCard *card;
|
|
|
|
OptionsTab *opt;
|
|
|
|
|
2010-03-08 00:56:51 +02:00
|
|
|
CScenarioInfo(const CMapHeader *mapHeader, const StartInfo *startInfo);
|
2009-08-27 11:04:32 +03:00
|
|
|
~CScenarioInfo();
|
|
|
|
};
|
|
|
|
|
2010-02-15 08:54:57 +02:00
|
|
|
class CMultiMode : public CIntObject
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CPicture *bg;
|
|
|
|
CTextInput *txt;
|
|
|
|
AdventureMapButton *btns[7]; //0 - hotseat, 6 - cancel
|
2010-02-15 13:37:47 +02:00
|
|
|
CGStatusBar *bar;
|
2010-02-15 08:54:57 +02:00
|
|
|
|
|
|
|
CMultiMode();
|
|
|
|
void openHotseat();
|
2010-09-03 21:42:54 +03:00
|
|
|
void hostTCP();
|
|
|
|
void joinTCP();
|
2010-02-15 08:54:57 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class CHotSeatPlayers : public CIntObject
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CPicture *bg;
|
|
|
|
CTextInput *txt[8];
|
|
|
|
AdventureMapButton *ok, *cancel;
|
2010-02-15 13:37:47 +02:00
|
|
|
CGStatusBar *bar;
|
2010-02-15 08:54:57 +02:00
|
|
|
|
|
|
|
CHotSeatPlayers(const std::string &firstPlayer);
|
2010-02-15 13:37:47 +02:00
|
|
|
void enterSelectionScreen();
|
2010-02-15 08:54:57 +02:00
|
|
|
};
|
|
|
|
|
2010-02-15 14:12:21 +02:00
|
|
|
class CBonusSelection : public CIntObject
|
|
|
|
{
|
|
|
|
SDL_Surface * background;
|
|
|
|
AdventureMapButton * startB, * backB;
|
2010-02-16 19:28:56 +02:00
|
|
|
|
2010-07-29 20:00:34 +03:00
|
|
|
//campaign & map descriptions:
|
|
|
|
CTextBox * cmpgDesc, * mapDesc;
|
|
|
|
|
2010-02-16 19:28:56 +02:00
|
|
|
struct SCampPositions
|
|
|
|
{
|
|
|
|
std::string campPrefix;
|
|
|
|
int colorSuffixLength;
|
|
|
|
|
|
|
|
struct SRegionDesc
|
|
|
|
{
|
|
|
|
std::string infix;
|
|
|
|
int xpos, ypos;
|
|
|
|
};
|
|
|
|
|
|
|
|
std::vector<SRegionDesc> regions;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
std::vector<SCampPositions> campDescriptions;
|
|
|
|
|
|
|
|
class CRegion : public CIntObject
|
|
|
|
{
|
|
|
|
CBonusSelection * owner;
|
|
|
|
SDL_Surface * graphics[3]; //[0] - not selected, [1] - selected, [2] - striped
|
|
|
|
bool accessible; //false if region should be striped
|
|
|
|
bool selectable; //true if region should be selectable
|
|
|
|
int myNumber; //number of region
|
|
|
|
public:
|
2010-02-18 14:34:44 +02:00
|
|
|
std::string rclickText;
|
2010-02-16 19:28:56 +02:00
|
|
|
CRegion(CBonusSelection * _owner, bool _accessible, bool _selectable, int _myNumber);
|
|
|
|
~CRegion();
|
|
|
|
|
|
|
|
void clickLeft(tribool down, bool previousState);
|
|
|
|
void clickRight(tribool down, bool previousState);
|
|
|
|
void show(SDL_Surface * to);
|
|
|
|
};
|
|
|
|
|
|
|
|
std::vector<CRegion *> regions;
|
|
|
|
CRegion * highlightedRegion;
|
|
|
|
|
|
|
|
void loadPositionsOfGraphics();
|
2010-08-04 14:18:13 +03:00
|
|
|
CCampaignState * ourCampaign;
|
2010-02-18 14:34:44 +02:00
|
|
|
CMapHeader *ourHeader;
|
|
|
|
CDefHandler *sizes; //icons of map sizes
|
2010-08-01 17:40:34 +03:00
|
|
|
SDL_Surface * diffPics[5]; //pictures of difficulties, user-selectable (or not if campaign locks this)
|
|
|
|
AdventureMapButton * diffLb, * diffRb; //buttons for changing difficulty
|
|
|
|
void changeDiff(bool increase); //if false, then decrease
|
2010-02-23 17:39:31 +02:00
|
|
|
|
|
|
|
//bonus selection
|
|
|
|
void updateBonusSelection();
|
|
|
|
CHighlightableButtonsGroup * bonuses;
|
|
|
|
|
2010-02-15 14:12:21 +02:00
|
|
|
public:
|
2010-09-04 17:49:15 +03:00
|
|
|
void bonusSelectionChanges(int choosenBonus);
|
|
|
|
|
2010-02-18 14:34:44 +02:00
|
|
|
StartInfo sInfo;
|
2010-07-31 16:55:05 +03:00
|
|
|
CDefHandler *sFlags;
|
|
|
|
|
2010-02-18 14:34:44 +02:00
|
|
|
void selectMap(int whichOne);
|
2010-07-31 16:55:05 +03:00
|
|
|
void selectBonus(int id);
|
2010-02-18 14:34:44 +02:00
|
|
|
|
2010-08-04 14:18:13 +03:00
|
|
|
CBonusSelection(CCampaignState * _ourCampaign);
|
2010-02-15 14:12:21 +02:00
|
|
|
~CBonusSelection();
|
|
|
|
|
|
|
|
void showAll(SDL_Surface * to);
|
2010-02-18 14:34:44 +02:00
|
|
|
void show(SDL_Surface * to);
|
2010-02-15 14:12:21 +02:00
|
|
|
|
|
|
|
void goBack();
|
|
|
|
void startMap();
|
|
|
|
};
|
|
|
|
|
2009-12-28 06:08:24 +02:00
|
|
|
class CGPreGame : public CIntObject, public IUpdateable
|
2009-04-16 14:14:13 +03:00
|
|
|
{
|
|
|
|
public:
|
2009-08-17 11:50:31 +03:00
|
|
|
SDL_Surface *mainbg;
|
2010-02-08 16:38:06 +02:00
|
|
|
CMenuScreen *scrs[4];
|
2009-08-17 11:50:31 +03:00
|
|
|
|
|
|
|
SDL_Surface *nHero, *rHero, *nTown, *rTown; // none/random hero/town imgs
|
|
|
|
CDefHandler *bonuses;
|
|
|
|
CDefHandler *victory, *loss;
|
|
|
|
|
|
|
|
CGPreGame();
|
|
|
|
~CGPreGame();
|
2009-12-28 06:08:24 +02:00
|
|
|
void update();
|
2010-09-03 21:42:54 +03:00
|
|
|
void openSel(CMenuScreen::EState type, CMenuScreen::EMultiMode multi = CMenuScreen::SINGLE_PLAYER);
|
2010-08-20 16:34:39 +03:00
|
|
|
|
2009-08-17 11:50:31 +03:00
|
|
|
void loadGraphics();
|
|
|
|
void disposeGraphics();
|
2009-04-16 14:14:13 +03:00
|
|
|
};
|
|
|
|
|
2009-08-17 11:50:31 +03:00
|
|
|
extern CGPreGame *CGP;
|
2009-04-16 14:14:13 +03:00
|
|
|
|
|
|
|
#endif // __CPREGAME_H__
|