2010-04-08 00:20:28 +02:00
|
|
|
// ==============================================================
|
|
|
|
// This file is part of Glest (www.glest.org)
|
|
|
|
//
|
2011-12-14 08:40:48 +01:00
|
|
|
// Copyright (C) 2001-2008 Martiño Figueroa
|
2010-04-08 00:20:28 +02:00
|
|
|
//
|
|
|
|
// You can redistribute this code and/or modify it under
|
|
|
|
// the terms of the GNU General Public License as published
|
|
|
|
// by the Free Software Foundation; either version 2 of the
|
|
|
|
// License, or (at your option) any later version
|
|
|
|
// ==============================================================
|
|
|
|
|
|
|
|
#ifndef _GLEST_GAME_COREDATA_H_
|
|
|
|
#define _GLEST_GAME_COREDATA_H_
|
|
|
|
|
2012-04-20 03:04:05 +02:00
|
|
|
#ifdef WIN32
|
|
|
|
#include <winsock2.h>
|
|
|
|
#include <winsock.h>
|
|
|
|
#endif
|
2010-04-08 00:20:28 +02:00
|
|
|
|
2012-04-20 03:04:05 +02:00
|
|
|
#include <string>
|
2010-04-08 00:20:28 +02:00
|
|
|
#include "sound.h"
|
|
|
|
#include "font.h"
|
|
|
|
#include "texture.h"
|
|
|
|
#include "sound_container.h"
|
2010-09-07 07:25:40 +02:00
|
|
|
#include "leak_dumper.h"
|
2010-04-08 00:20:28 +02:00
|
|
|
|
|
|
|
namespace Glest{ namespace Game{
|
|
|
|
|
|
|
|
using Shared::Graphics::Texture2D;
|
|
|
|
using Shared::Graphics::Texture3D;
|
|
|
|
using Shared::Graphics::Font2D;
|
2011-06-08 09:18:06 +02:00
|
|
|
using Shared::Graphics::Font3D;
|
2010-04-08 00:20:28 +02:00
|
|
|
using Shared::Sound::StrSound;
|
|
|
|
using Shared::Sound::StaticSound;
|
|
|
|
|
|
|
|
// =====================================================
|
|
|
|
// class CoreData
|
|
|
|
//
|
2011-12-03 09:17:49 +01:00
|
|
|
/// Data shared among all the ProgramStates
|
2010-04-08 00:20:28 +02:00
|
|
|
// =====================================================
|
|
|
|
|
2011-12-03 09:17:49 +01:00
|
|
|
class GameSettings;
|
|
|
|
|
2011-10-25 20:39:11 +02:00
|
|
|
class CoreData {
|
2010-04-08 00:20:28 +02:00
|
|
|
private:
|
|
|
|
StrSound introMusic;
|
|
|
|
StrSound menuMusic;
|
|
|
|
StaticSound clickSoundA;
|
|
|
|
StaticSound clickSoundB;
|
2010-05-16 18:40:21 +02:00
|
|
|
StaticSound clickSoundC;
|
|
|
|
StaticSound attentionSound;
|
2011-01-01 21:31:25 +01:00
|
|
|
StaticSound highlightSound;
|
2012-07-15 23:01:56 +02:00
|
|
|
StaticSound markerSound;
|
2010-04-08 00:20:28 +02:00
|
|
|
SoundContainer waterSounds;
|
|
|
|
|
|
|
|
Texture2D *logoTexture;
|
2010-08-06 00:27:26 +02:00
|
|
|
std::vector<Texture2D *> logoTextureList;
|
2010-04-08 00:20:28 +02:00
|
|
|
Texture2D *backgroundTexture;
|
|
|
|
Texture2D *fireTexture;
|
2011-07-07 00:02:38 +02:00
|
|
|
Texture2D *teamColorTexture;
|
2010-04-08 00:20:28 +02:00
|
|
|
Texture2D *snowTexture;
|
|
|
|
Texture2D *waterSplashTexture;
|
|
|
|
Texture2D *customTexture;
|
|
|
|
Texture2D *buttonSmallTexture;
|
|
|
|
Texture2D *buttonBigTexture;
|
2010-12-27 01:59:57 +01:00
|
|
|
Texture2D *horizontalLineTexture;
|
|
|
|
Texture2D *verticalLineTexture;
|
|
|
|
Texture2D *checkBoxTexture;
|
|
|
|
Texture2D *checkedCheckBoxTexture;
|
2011-04-05 15:34:54 +02:00
|
|
|
Texture2D *gameWinnerTexture;
|
2011-08-31 23:51:46 +02:00
|
|
|
Texture2D *notOnServerTexture;
|
|
|
|
Texture2D *onServerDifferentTexture;
|
|
|
|
Texture2D *onServerTexture;
|
|
|
|
Texture2D *onServerInstalledTexture;
|
|
|
|
|
2011-10-07 19:21:09 +02:00
|
|
|
std::vector<Texture2D *> miscTextureList;
|
2010-04-08 00:20:28 +02:00
|
|
|
|
|
|
|
Font2D *displayFont;
|
|
|
|
Font2D *menuFontNormal;
|
|
|
|
Font2D *displayFontSmall;
|
|
|
|
Font2D *menuFontBig;
|
|
|
|
Font2D *menuFontVeryBig;
|
|
|
|
Font2D *consoleFont;
|
|
|
|
|
2011-06-08 09:18:06 +02:00
|
|
|
Font3D *displayFont3D;
|
|
|
|
Font3D *menuFontNormal3D;
|
|
|
|
Font3D *displayFontSmall3D;
|
|
|
|
Font3D *menuFontBig3D;
|
|
|
|
Font3D *menuFontVeryBig3D;
|
|
|
|
Font3D *consoleFont3D;
|
|
|
|
|
2012-05-19 10:40:49 +02:00
|
|
|
string introVideoFilename;
|
2012-05-25 18:33:34 +02:00
|
|
|
string introVideoFilenameFallback;
|
2012-09-25 03:52:09 +02:00
|
|
|
|
2012-05-19 10:40:49 +02:00
|
|
|
string mainMenuVideoFilename;
|
2012-05-25 18:33:34 +02:00
|
|
|
string mainMenuVideoFilenameFallback;
|
2012-09-25 03:52:09 +02:00
|
|
|
|
2012-09-25 02:23:25 +02:00
|
|
|
string battleEndWinVideoFilename;
|
|
|
|
string battleEndWinVideoFilenameFallback;
|
2012-09-25 03:52:09 +02:00
|
|
|
string battleEndWinMusicFilename;
|
|
|
|
|
2012-09-25 02:23:25 +02:00
|
|
|
string battleEndLoseVideoFilename;
|
|
|
|
string battleEndLoseVideoFilenameFallback;
|
2012-09-25 03:52:09 +02:00
|
|
|
string battleEndLoseMusicFilename;
|
2012-05-19 10:40:49 +02:00
|
|
|
|
2012-03-19 22:35:54 +01:00
|
|
|
public:
|
|
|
|
|
|
|
|
enum TextureSystemType {
|
|
|
|
tsyst_NONE,
|
|
|
|
tsyst_logoTexture,
|
|
|
|
//std::vector<Texture2D *> logoTextureList;
|
|
|
|
tsyst_backgroundTexture,
|
|
|
|
tsyst_fireTexture,
|
|
|
|
tsyst_teamColorTexture,
|
|
|
|
tsyst_snowTexture,
|
|
|
|
tsyst_waterSplashTexture,
|
|
|
|
tsyst_customTexture,
|
|
|
|
tsyst_buttonSmallTexture,
|
|
|
|
tsyst_buttonBigTexture,
|
|
|
|
tsyst_horizontalLineTexture,
|
|
|
|
tsyst_verticalLineTexture,
|
|
|
|
tsyst_checkBoxTexture,
|
|
|
|
tsyst_checkedCheckBoxTexture,
|
|
|
|
tsyst_gameWinnerTexture,
|
|
|
|
tsyst_notOnServerTexture,
|
|
|
|
tsyst_onServerDifferentTexture,
|
|
|
|
tsyst_onServerTexture,
|
|
|
|
tsyst_onServerInstalledTexture
|
|
|
|
|
|
|
|
//std::vector<Texture2D *> miscTextureList;
|
|
|
|
};
|
|
|
|
|
2010-04-08 00:20:28 +02:00
|
|
|
public:
|
2011-10-25 20:39:11 +02:00
|
|
|
|
2010-04-08 00:20:28 +02:00
|
|
|
~CoreData();
|
2011-10-25 20:39:11 +02:00
|
|
|
static CoreData &getInstance();
|
2010-04-08 00:20:28 +02:00
|
|
|
|
|
|
|
void load();
|
2011-12-02 17:07:59 +01:00
|
|
|
void cleanup();
|
2011-10-25 20:39:11 +02:00
|
|
|
void loadFonts();
|
2010-04-08 00:20:28 +02:00
|
|
|
|
2012-03-19 22:35:54 +01:00
|
|
|
Texture2D *getTextureBySystemId(TextureSystemType type) const;
|
|
|
|
|
2010-04-08 00:20:28 +02:00
|
|
|
Texture2D *getBackgroundTexture() const {return backgroundTexture;}
|
|
|
|
Texture2D *getFireTexture() const {return fireTexture;}
|
2011-07-07 00:02:38 +02:00
|
|
|
Texture2D *getTeamColorTexture() const {return teamColorTexture;}
|
2010-04-08 00:20:28 +02:00
|
|
|
Texture2D *getSnowTexture() const {return snowTexture;}
|
|
|
|
Texture2D *getLogoTexture() const {return logoTexture;}
|
|
|
|
Texture2D *getWaterSplashTexture() const {return waterSplashTexture;}
|
|
|
|
Texture2D *getCustomTexture() const {return customTexture;}
|
|
|
|
Texture2D *getButtonSmallTexture() const {return buttonSmallTexture;}
|
|
|
|
Texture2D *getButtonBigTexture() const {return buttonBigTexture;}
|
2010-12-27 01:59:57 +01:00
|
|
|
Texture2D *getHorizontalLineTexture() const {return horizontalLineTexture;}
|
|
|
|
Texture2D *getVerticalLineTexture() const {return verticalLineTexture;}
|
|
|
|
Texture2D *getCheckBoxTexture() const {return checkBoxTexture;}
|
|
|
|
Texture2D *getCheckedCheckBoxTexture() const {return checkedCheckBoxTexture;}
|
2011-08-31 23:51:46 +02:00
|
|
|
Texture2D *getNotOnServerTexture() const {return notOnServerTexture;}
|
|
|
|
Texture2D *getOnServerDifferentTexture() const {return onServerDifferentTexture;}
|
|
|
|
Texture2D *getOnServerTexture() const {return onServerTexture;}
|
|
|
|
Texture2D *getOnServerInstalledTexture() const {return onServerInstalledTexture;}
|
2010-04-08 00:20:28 +02:00
|
|
|
|
2011-04-05 15:34:54 +02:00
|
|
|
Texture2D *getGameWinnerTexture() const {return gameWinnerTexture;}
|
|
|
|
|
2010-10-21 09:20:17 +02:00
|
|
|
size_t getLogoTextureExtraCount() const {return logoTextureList.size();}
|
2010-08-06 00:27:26 +02:00
|
|
|
Texture2D *getLogoTextureExtra(int idx) const {return logoTextureList[idx];}
|
|
|
|
|
2011-10-07 19:21:09 +02:00
|
|
|
std::vector<Texture2D *> & getMiscTextureList() { return miscTextureList; }
|
|
|
|
|
2010-04-08 00:20:28 +02:00
|
|
|
StrSound *getIntroMusic() {return &introMusic;}
|
|
|
|
StrSound *getMenuMusic() {return &menuMusic;}
|
|
|
|
StaticSound *getClickSoundA() {return &clickSoundA;}
|
|
|
|
StaticSound *getClickSoundB() {return &clickSoundB;}
|
|
|
|
StaticSound *getClickSoundC() {return &clickSoundC;}
|
2010-05-16 18:40:21 +02:00
|
|
|
StaticSound *getAttentionSound() {return &attentionSound;}
|
2011-01-01 21:31:25 +01:00
|
|
|
StaticSound *getHighlightSound() {return &highlightSound;}
|
2012-07-15 23:01:56 +02:00
|
|
|
StaticSound *getMarkerSound() {return &markerSound;}
|
2010-04-08 00:20:28 +02:00
|
|
|
StaticSound *getWaterSound() {return waterSounds.getRandSound();}
|
|
|
|
|
|
|
|
Font2D *getDisplayFont() const {return displayFont;}
|
|
|
|
Font2D *getDisplayFontSmall() const {return displayFontSmall;}
|
|
|
|
Font2D *getMenuFontNormal() const {return menuFontNormal;}
|
|
|
|
Font2D *getMenuFontBig() const {return menuFontBig;}
|
|
|
|
Font2D *getMenuFontVeryBig() const {return menuFontVeryBig;}
|
|
|
|
Font2D *getConsoleFont() const {return consoleFont;}
|
|
|
|
|
2011-06-08 09:18:06 +02:00
|
|
|
Font3D *getDisplayFont3D() const {return displayFont3D;}
|
|
|
|
Font3D *getDisplayFontSmall3D() const {return displayFontSmall3D;}
|
|
|
|
Font3D *getMenuFontNormal3D() const {return menuFontNormal3D;}
|
|
|
|
Font3D *getMenuFontBig3D() const {return menuFontBig3D;}
|
|
|
|
Font3D *getMenuFontVeryBig3D() const {return menuFontVeryBig3D;}
|
|
|
|
Font3D *getConsoleFont3D() const {return consoleFont3D;}
|
|
|
|
|
2012-05-19 10:40:49 +02:00
|
|
|
string getMainMenuVideoFilename() const { return mainMenuVideoFilename; }
|
|
|
|
bool hasMainMenuVideoFilename() const;
|
2012-05-25 18:33:34 +02:00
|
|
|
string getMainMenuVideoFilenameFallback() const { return mainMenuVideoFilenameFallback; }
|
|
|
|
bool hasMainMenuVideoFilenameFallback() const;
|
2012-05-19 10:40:49 +02:00
|
|
|
|
|
|
|
string getIntroVideoFilename() const { return introVideoFilename; }
|
|
|
|
bool hasIntroVideoFilename() const;
|
2012-05-25 18:33:34 +02:00
|
|
|
string getIntroVideoFilenameFallback() const { return introVideoFilenameFallback; }
|
|
|
|
bool hasIntroVideoFilenameFallback() const;
|
2012-05-19 10:40:49 +02:00
|
|
|
|
2012-09-25 02:23:25 +02:00
|
|
|
string getBattleEndVideoFilename(bool won) const { return won == true ? battleEndWinVideoFilename : battleEndLoseVideoFilename; }
|
|
|
|
bool hasBattleEndVideoFilename(bool won) const;
|
|
|
|
string getBattleEndVideoFilenameFallback(bool won) const { return won == true ? battleEndWinVideoFilenameFallback : battleEndLoseVideoFilenameFallback; }
|
|
|
|
bool hasBattleEndVideoFilenameFallback(bool won) const;
|
|
|
|
|
2012-09-25 03:52:09 +02:00
|
|
|
string getBattleEndMusicFilename(bool won) const { return won == true ? battleEndWinMusicFilename : battleEndLoseMusicFilename; }
|
|
|
|
|
2011-12-03 09:17:49 +01:00
|
|
|
void saveGameSettingsToFile(std::string fileName, GameSettings *gameSettings,int advancedIndex=0);
|
2012-03-17 09:20:17 +01:00
|
|
|
bool loadGameSettingsFromFile(std::string fileName, GameSettings *gameSettings);
|
2011-12-03 09:17:49 +01:00
|
|
|
|
2010-04-08 00:20:28 +02:00
|
|
|
private:
|
2011-10-25 20:39:11 +02:00
|
|
|
CoreData();
|
2010-04-08 00:20:28 +02:00
|
|
|
|
|
|
|
int computeFontSize(int size);
|
|
|
|
};
|
|
|
|
|
|
|
|
}} //end namespace
|
|
|
|
|
|
|
|
#endif
|