2010-04-01 02:13:28 +02:00
|
|
|
|
// ==============================================================
|
|
|
|
|
// This file is part of Glest (www.glest.org)
|
|
|
|
|
//
|
|
|
|
|
// Copyright (C) 2001-2008 Marti<74>o Figueroa
|
|
|
|
|
//
|
2010-12-09 21:41:11 +01: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
|
2010-04-01 02:13:28 +02:00
|
|
|
|
// License, or (at your option) any later version
|
|
|
|
|
// ==============================================================
|
|
|
|
|
|
|
|
|
|
#include "core_data.h"
|
|
|
|
|
|
|
|
|
|
#include "logger.h"
|
|
|
|
|
#include "renderer.h"
|
|
|
|
|
#include "graphics_interface.h"
|
|
|
|
|
#include "config.h"
|
|
|
|
|
#include "util.h"
|
2010-08-06 00:27:26 +02:00
|
|
|
|
#include "platform_util.h"
|
2010-12-09 21:41:11 +01:00
|
|
|
|
#include "game_constants.h"
|
|
|
|
|
#include "game_util.h"
|
2011-05-25 21:03:22 +02:00
|
|
|
|
#include "lang.h"
|
2010-04-01 02:13:28 +02:00
|
|
|
|
#include "leak_dumper.h"
|
|
|
|
|
|
|
|
|
|
using namespace Shared::Sound;
|
|
|
|
|
using namespace Shared::Graphics;
|
|
|
|
|
using namespace Shared::Util;
|
|
|
|
|
|
|
|
|
|
namespace Glest{ namespace Game{
|
|
|
|
|
|
|
|
|
|
// =====================================================
|
|
|
|
|
// class CoreData
|
|
|
|
|
// =====================================================
|
|
|
|
|
|
|
|
|
|
// ===================== PUBLIC ========================
|
|
|
|
|
|
2010-12-09 21:41:11 +01:00
|
|
|
|
CoreData &CoreData::getInstance() {
|
2010-04-01 02:13:28 +02:00
|
|
|
|
static CoreData coreData;
|
|
|
|
|
return coreData;
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-09 21:41:11 +01:00
|
|
|
|
CoreData::~CoreData() {
|
2010-04-01 02:13:28 +02:00
|
|
|
|
deleteValues(waterSounds.getSounds().begin(), waterSounds.getSounds().end());
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-09 21:41:11 +01:00
|
|
|
|
void CoreData::load() {
|
|
|
|
|
string data_path = getGameReadWritePath(GameConstants::path_data_CacheLookupKey);
|
2011-03-23 06:49:38 +01:00
|
|
|
|
if(data_path != "") {
|
|
|
|
|
endPathWithSlash(data_path);
|
|
|
|
|
}
|
2010-12-09 21:41:11 +01:00
|
|
|
|
|
|
|
|
|
const string dir = data_path + "data/core";
|
2010-04-01 02:13:28 +02:00
|
|
|
|
Logger::getInstance().add("Core data");
|
|
|
|
|
|
|
|
|
|
Renderer &renderer= Renderer::getInstance();
|
|
|
|
|
|
|
|
|
|
//textures
|
|
|
|
|
backgroundTexture= renderer.newTexture2D(rsGlobal);
|
|
|
|
|
backgroundTexture->setMipmap(false);
|
2010-12-09 21:41:11 +01:00
|
|
|
|
backgroundTexture->getPixmap()->load(dir+"/menu/textures/back.tga");
|
2010-04-01 02:13:28 +02:00
|
|
|
|
|
|
|
|
|
fireTexture= renderer.newTexture2D(rsGlobal);
|
|
|
|
|
fireTexture->setFormat(Texture::fAlpha);
|
|
|
|
|
fireTexture->getPixmap()->init(1);
|
|
|
|
|
fireTexture->getPixmap()->load(dir+"/misc_textures/fire_particle.tga");
|
|
|
|
|
|
2011-07-07 00:02:38 +02:00
|
|
|
|
teamColorTexture= renderer.newTexture2D(rsGlobal);
|
|
|
|
|
teamColorTexture->setFormat(Texture::fAlpha);
|
|
|
|
|
teamColorTexture->getPixmap()->init(1);
|
|
|
|
|
teamColorTexture->getPixmap()->load(dir+"/misc_textures/team_color_texture.tga");
|
|
|
|
|
|
2010-04-01 02:13:28 +02:00
|
|
|
|
snowTexture= renderer.newTexture2D(rsGlobal);
|
|
|
|
|
snowTexture->setMipmap(false);
|
|
|
|
|
snowTexture->setFormat(Texture::fAlpha);
|
|
|
|
|
snowTexture->getPixmap()->init(1);
|
|
|
|
|
snowTexture->getPixmap()->load(dir+"/misc_textures/snow_particle.tga");
|
2010-12-09 21:41:11 +01:00
|
|
|
|
|
2010-04-01 02:13:28 +02:00
|
|
|
|
customTexture= renderer.newTexture2D(rsGlobal);
|
2010-12-09 21:41:11 +01:00
|
|
|
|
customTexture->getPixmap()->load(dir+"/menu/textures/custom_texture.tga");
|
2010-04-01 02:13:28 +02:00
|
|
|
|
|
|
|
|
|
logoTexture= renderer.newTexture2D(rsGlobal);
|
|
|
|
|
logoTexture->setMipmap(false);
|
|
|
|
|
logoTexture->getPixmap()->load(dir+"/menu/textures/logo.tga");
|
|
|
|
|
|
2010-08-06 00:27:26 +02:00
|
|
|
|
logoTextureList.clear();
|
|
|
|
|
string logosPath= dir+"/menu/textures/logo*.*";
|
|
|
|
|
vector<string> logoFilenames;
|
|
|
|
|
findAll(logosPath, logoFilenames);
|
|
|
|
|
for(int i = 0; i < logoFilenames.size(); ++i) {
|
|
|
|
|
string logo = logoFilenames[i];
|
2010-08-07 00:19:48 +02:00
|
|
|
|
if(strcmp("logo.tga",logo.c_str()) != 0) {
|
2010-08-06 00:27:26 +02:00
|
|
|
|
Texture2D *logoTextureExtra= renderer.newTexture2D(rsGlobal);
|
2010-08-07 01:07:08 +02:00
|
|
|
|
logoTextureExtra->setMipmap(true);
|
2010-08-06 00:27:26 +02:00
|
|
|
|
logoTextureExtra->getPixmap()->load(dir+"/menu/textures/" + logo);
|
|
|
|
|
logoTextureList.push_back(logoTextureExtra);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-04-01 02:13:28 +02:00
|
|
|
|
waterSplashTexture= renderer.newTexture2D(rsGlobal);
|
|
|
|
|
waterSplashTexture->setFormat(Texture::fAlpha);
|
|
|
|
|
waterSplashTexture->getPixmap()->init(1);
|
|
|
|
|
waterSplashTexture->getPixmap()->load(dir+"/misc_textures/water_splash.tga");
|
|
|
|
|
|
|
|
|
|
buttonSmallTexture= renderer.newTexture2D(rsGlobal);
|
2010-10-28 08:59:43 +02:00
|
|
|
|
buttonSmallTexture->setForceCompressionDisabled(true);
|
2010-04-01 02:13:28 +02:00
|
|
|
|
buttonSmallTexture->getPixmap()->load(dir+"/menu/textures/button_small.tga");
|
|
|
|
|
|
|
|
|
|
buttonBigTexture= renderer.newTexture2D(rsGlobal);
|
2010-10-28 08:59:43 +02:00
|
|
|
|
buttonBigTexture->setForceCompressionDisabled(true);
|
2010-04-01 02:13:28 +02:00
|
|
|
|
buttonBigTexture->getPixmap()->load(dir+"/menu/textures/button_big.tga");
|
2010-12-09 21:41:11 +01:00
|
|
|
|
|
2010-12-27 01:59:57 +01:00
|
|
|
|
horizontalLineTexture= renderer.newTexture2D(rsGlobal);
|
|
|
|
|
horizontalLineTexture->setForceCompressionDisabled(true);
|
|
|
|
|
horizontalLineTexture->getPixmap()->load(dir+"/menu/textures/line_horizontal.tga");
|
|
|
|
|
|
|
|
|
|
verticalLineTexture= renderer.newTexture2D(rsGlobal);
|
|
|
|
|
verticalLineTexture->setForceCompressionDisabled(true);
|
|
|
|
|
verticalLineTexture->getPixmap()->load(dir+"/menu/textures/line_vertical.tga");
|
|
|
|
|
|
|
|
|
|
checkBoxTexture= renderer.newTexture2D(rsGlobal);
|
|
|
|
|
checkBoxTexture->setForceCompressionDisabled(true);
|
|
|
|
|
checkBoxTexture->getPixmap()->load(dir+"/menu/textures/checkbox.tga");
|
|
|
|
|
|
|
|
|
|
checkedCheckBoxTexture= renderer.newTexture2D(rsGlobal);
|
|
|
|
|
checkedCheckBoxTexture->setForceCompressionDisabled(true);
|
|
|
|
|
checkedCheckBoxTexture->getPixmap()->load(dir+"/menu/textures/checkbox_checked.tga");
|
|
|
|
|
|
2011-04-05 15:34:54 +02:00
|
|
|
|
gameWinnerTexture= renderer.newTexture2D(rsGlobal);
|
|
|
|
|
gameWinnerTexture->setForceCompressionDisabled(true);
|
|
|
|
|
gameWinnerTexture->getPixmap()->load(dir+"/misc_textures/game_winner.png");
|
|
|
|
|
|
2011-05-25 21:03:22 +02:00
|
|
|
|
Lang &lang= Lang::getInstance();
|
|
|
|
|
|
2010-04-01 02:13:28 +02:00
|
|
|
|
//display font
|
|
|
|
|
Config &config= Config::getInstance();
|
2011-05-25 21:03:22 +02:00
|
|
|
|
|
|
|
|
|
string displayFontNamePrefix = config.getString("FontDisplayPrefix");
|
|
|
|
|
string displayFontNamePostfix = config.getString("FontDisplayPostfix");
|
|
|
|
|
int displayFontSize = computeFontSize(config.getInt("FontDisplayBaseSize"));
|
|
|
|
|
|
2011-06-08 09:18:06 +02:00
|
|
|
|
//printf("Checking if langfile has custom FontDisplayPostfix\n");
|
|
|
|
|
|
2011-05-25 21:03:22 +02:00
|
|
|
|
if(lang.hasString("FontDisplayPrefix") == true) {
|
|
|
|
|
displayFontNamePrefix = lang.get("FontDisplayPrefix");
|
|
|
|
|
}
|
|
|
|
|
if(lang.hasString("FontDisplayPostfix") == true) {
|
|
|
|
|
displayFontNamePostfix = lang.get("FontDisplayPostfix");
|
|
|
|
|
}
|
|
|
|
|
if(lang.hasString("FontDisplayBaseSize") == true) {
|
|
|
|
|
displayFontSize = strToInt(lang.get("FontDisplayBaseSize"));
|
|
|
|
|
}
|
|
|
|
|
|
2011-06-08 09:18:06 +02:00
|
|
|
|
//printf("displayFontNamePostfix [%s]\n",displayFontNamePostfix.c_str());
|
|
|
|
|
|
|
|
|
|
string displayFontName = displayFontNamePrefix + intToStr(displayFontSize) + displayFontNamePostfix;
|
2011-05-25 21:03:22 +02:00
|
|
|
|
|
2010-04-01 02:13:28 +02:00
|
|
|
|
displayFont= renderer.newFont(rsGlobal);
|
2011-06-06 23:38:25 +02:00
|
|
|
|
displayFont->setType(displayFontName,config.getString("FontDisplay",""));
|
2010-04-01 20:59:05 +02:00
|
|
|
|
displayFont->setSize(displayFontSize);
|
2011-07-02 03:56:06 +02:00
|
|
|
|
//displayFont->setYOffsetFactor(config.getFloat("FontDisplayYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
2011-06-08 09:18:06 +02:00
|
|
|
|
|
|
|
|
|
displayFont3D= renderer.newFont3D(rsGlobal);
|
|
|
|
|
displayFont3D->setType(displayFontName,config.getString("FontDisplay",""));
|
|
|
|
|
displayFont3D->setSize(displayFontSize);
|
2011-07-02 03:56:06 +02:00
|
|
|
|
//displayFont3D->setYOffsetFactor(config.getFloat("FontDisplayYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
2010-04-01 02:13:28 +02:00
|
|
|
|
|
2011-03-28 05:54:23 +02:00
|
|
|
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] displayFontName = [%s] displayFontSize = %d\n",__FILE__,__FUNCTION__,__LINE__,displayFontName.c_str(),displayFontSize);
|
2010-04-11 03:25:06 +02:00
|
|
|
|
|
2010-04-01 20:59:05 +02:00
|
|
|
|
//menu fonts
|
2011-05-25 21:03:22 +02:00
|
|
|
|
string displayFontNameSmallPrefix = config.getString("FontDisplayPrefix");
|
|
|
|
|
string displayFontNameSmallPostfix = config.getString("FontDisplayPostfix");
|
|
|
|
|
int displayFontNameSmallSize = computeFontSize(config.getInt("FontDisplaySmallBaseSize"));
|
|
|
|
|
|
|
|
|
|
if(lang.hasString("FontDisplayPrefix") == true) {
|
|
|
|
|
displayFontNameSmallPrefix = lang.get("FontDisplayPrefix");
|
|
|
|
|
}
|
|
|
|
|
if(lang.hasString("FontDisplayPostfix") == true) {
|
|
|
|
|
displayFontNameSmallPostfix = lang.get("FontDisplayPostfix");
|
|
|
|
|
}
|
|
|
|
|
if(lang.hasString("FontDisplaySmallBaseSize") == true) {
|
|
|
|
|
displayFontNameSmallSize = strToInt(lang.get("FontDisplaySmallBaseSize"));
|
|
|
|
|
}
|
|
|
|
|
|
2011-06-08 09:18:06 +02:00
|
|
|
|
string displayFontNameSmall = displayFontNameSmallPrefix + intToStr(displayFontNameSmallSize) + displayFontNameSmallPostfix;
|
|
|
|
|
|
2010-04-08 00:20:28 +02:00
|
|
|
|
displayFontSmall= renderer.newFont(rsGlobal);
|
2011-06-08 09:18:06 +02:00
|
|
|
|
displayFontSmall->setType(displayFontNameSmall,config.getString("FontSmallDisplay",""));
|
2010-04-08 00:20:28 +02:00
|
|
|
|
displayFontSmall->setSize(displayFontNameSmallSize);
|
2011-07-02 03:56:06 +02:00
|
|
|
|
//displayFontSmall->setYOffsetFactor(config.getFloat("FontSmallDisplayYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
2011-06-08 09:18:06 +02:00
|
|
|
|
|
|
|
|
|
displayFontSmall3D= renderer.newFont3D(rsGlobal);
|
|
|
|
|
displayFontSmall3D->setType(displayFontNameSmall,config.getString("FontSmallDisplay",""));
|
|
|
|
|
displayFontSmall3D->setSize(displayFontNameSmallSize);
|
2011-07-02 03:56:06 +02:00
|
|
|
|
//displayFontSmall3D->setYOffsetFactor(config.getFloat("FontSmallDisplayYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
2010-12-09 21:41:11 +01:00
|
|
|
|
|
2011-03-28 05:54:23 +02:00
|
|
|
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] displayFontSmallName = [%s] displayFontSmallNameSize = %d\n",__FILE__,__FUNCTION__,__LINE__,displayFontNameSmall.c_str(),displayFontNameSmallSize);
|
2010-12-09 21:41:11 +01:00
|
|
|
|
|
2011-05-25 21:03:22 +02:00
|
|
|
|
string menuFontNameNormalPrefix = config.getString("FontMenuNormalPrefix");
|
|
|
|
|
string menuFontNameNormalPostfix = config.getString("FontMenuNormalPostfix");
|
|
|
|
|
int menuFontNameNormalSize = computeFontSize(config.getInt("FontMenuNormalBaseSize"));
|
|
|
|
|
|
|
|
|
|
if(lang.hasString("FontMenuNormalPrefix") == true) {
|
|
|
|
|
menuFontNameNormalPrefix = lang.get("FontMenuNormalPrefix");
|
|
|
|
|
}
|
|
|
|
|
if(lang.hasString("FontMenuNormalPostfix") == true) {
|
|
|
|
|
menuFontNameNormalPostfix = lang.get("FontMenuNormalPostfix");
|
|
|
|
|
}
|
|
|
|
|
if(lang.hasString("FontMenuNormalBaseSize") == true) {
|
|
|
|
|
menuFontNameNormalSize = strToInt(lang.get("FontMenuNormalBaseSize"));
|
|
|
|
|
}
|
|
|
|
|
|
2011-06-08 09:18:06 +02:00
|
|
|
|
string menuFontNameNormal= menuFontNameNormalPrefix + intToStr(menuFontNameNormalSize) + menuFontNameNormalPostfix;
|
|
|
|
|
|
2010-04-01 02:13:28 +02:00
|
|
|
|
menuFontNormal= renderer.newFont(rsGlobal);
|
2011-06-06 23:38:25 +02:00
|
|
|
|
menuFontNormal->setType(menuFontNameNormal,config.getString("FontMenuNormal",""));
|
2010-04-01 20:59:05 +02:00
|
|
|
|
menuFontNormal->setSize(menuFontNameNormalSize);
|
2010-04-01 02:13:28 +02:00
|
|
|
|
menuFontNormal->setWidth(Font::wBold);
|
2011-07-02 03:56:06 +02:00
|
|
|
|
//menuFontNormal->setYOffsetFactor(config.getFloat("FontMenuNormalYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
2011-06-08 09:18:06 +02:00
|
|
|
|
|
|
|
|
|
menuFontNormal3D= renderer.newFont3D(rsGlobal);
|
|
|
|
|
menuFontNormal3D->setType(menuFontNameNormal,config.getString("FontMenuNormal",""));
|
|
|
|
|
menuFontNormal3D->setSize(menuFontNameNormalSize);
|
|
|
|
|
menuFontNormal3D->setWidth(Font::wBold);
|
2011-07-02 03:56:06 +02:00
|
|
|
|
//menuFontNormal3D->setYOffsetFactor(config.getFloat("FontMenuNormalYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
2010-04-01 02:13:28 +02:00
|
|
|
|
|
2011-03-28 05:54:23 +02:00
|
|
|
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] menuFontNormalName = [%s] menuFontNormalNameSize = %d\n",__FILE__,__FUNCTION__,__LINE__,menuFontNameNormal.c_str(),menuFontNameNormalSize);
|
2010-04-01 20:59:05 +02:00
|
|
|
|
|
2011-05-25 21:03:22 +02:00
|
|
|
|
string menuFontNameBigPrefix = config.getString("FontMenuBigPrefix");
|
|
|
|
|
string menuFontNameBigPostfix = config.getString("FontMenuBigPostfix");
|
|
|
|
|
int menuFontNameBigSize = computeFontSize(config.getInt("FontMenuBigBaseSize"));
|
|
|
|
|
|
|
|
|
|
if(lang.hasString("FontMenuBigPrefix") == true) {
|
|
|
|
|
menuFontNameBigPrefix = lang.get("FontMenuBigPrefix");
|
|
|
|
|
}
|
|
|
|
|
if(lang.hasString("FontMenuBigPostfix") == true) {
|
|
|
|
|
menuFontNameBigPostfix = lang.get("FontMenuBigPostfix");
|
|
|
|
|
}
|
|
|
|
|
if(lang.hasString("FontMenuBigBaseSize") == true) {
|
|
|
|
|
menuFontNameBigSize = strToInt(lang.get("FontMenuBigBaseSize"));
|
|
|
|
|
}
|
|
|
|
|
|
2010-04-01 20:59:05 +02:00
|
|
|
|
string menuFontNameBig= menuFontNameBigPrefix+intToStr(menuFontNameBigSize)+menuFontNameBigPostfix;
|
2011-05-25 21:03:22 +02:00
|
|
|
|
|
2010-04-01 02:13:28 +02:00
|
|
|
|
menuFontBig= renderer.newFont(rsGlobal);
|
2011-06-06 23:38:25 +02:00
|
|
|
|
menuFontBig->setType(menuFontNameBig,config.getString("FontMenuBig",""));
|
2010-04-01 20:59:05 +02:00
|
|
|
|
menuFontBig->setSize(menuFontNameBigSize);
|
2011-07-02 03:56:06 +02:00
|
|
|
|
//menuFontBig->setYOffsetFactor(config.getFloat("FontMenuBigYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
2011-06-08 09:18:06 +02:00
|
|
|
|
|
|
|
|
|
menuFontBig3D= renderer.newFont3D(rsGlobal);
|
|
|
|
|
menuFontBig3D->setType(menuFontNameBig,config.getString("FontMenuBig",""));
|
|
|
|
|
menuFontBig3D->setSize(menuFontNameBigSize);
|
2011-07-02 03:56:06 +02:00
|
|
|
|
//menuFontBig3D->setYOffsetFactor(config.getFloat("FontMenuBigYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
2010-04-01 02:13:28 +02:00
|
|
|
|
|
2011-03-28 05:54:23 +02:00
|
|
|
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] menuFontNameBig = [%s] menuFontNameBigSize = %d\n",__FILE__,__FUNCTION__,__LINE__,menuFontNameBig.c_str(),menuFontNameBigSize);
|
2010-04-11 03:25:06 +02:00
|
|
|
|
|
2011-05-25 21:03:22 +02:00
|
|
|
|
string menuFontNameVeryBigPrefix = config.getString("FontMenuBigPrefix");
|
|
|
|
|
string menuFontNameVeryBigPostfix = config.getString("FontMenuBigPostfix");
|
|
|
|
|
int menuFontNameVeryBigSize = computeFontSize(config.getInt("FontMenuVeryBigBaseSize"));
|
|
|
|
|
|
|
|
|
|
if(lang.hasString("FontMenuBigPrefix") == true) {
|
|
|
|
|
menuFontNameVeryBigPrefix = lang.get("FontMenuBigPrefix");
|
|
|
|
|
}
|
|
|
|
|
if(lang.hasString("FontMenuBigPostfix") == true) {
|
|
|
|
|
menuFontNameVeryBigPostfix = lang.get("FontMenuBigPostfix");
|
|
|
|
|
}
|
|
|
|
|
if(lang.hasString("FontMenuVeryBigBaseSize") == true) {
|
|
|
|
|
menuFontNameVeryBigSize = strToInt(lang.get("FontMenuVeryBigBaseSize"));
|
|
|
|
|
}
|
|
|
|
|
|
2011-06-08 09:18:06 +02:00
|
|
|
|
string menuFontNameVeryBig= menuFontNameVeryBigPrefix + intToStr(menuFontNameVeryBigSize) + menuFontNameVeryBigPostfix;
|
2011-05-25 21:03:22 +02:00
|
|
|
|
|
2010-04-01 02:13:28 +02:00
|
|
|
|
menuFontVeryBig= renderer.newFont(rsGlobal);
|
2011-06-08 09:18:06 +02:00
|
|
|
|
menuFontVeryBig->setType(menuFontNameVeryBig,config.getString("FontMenuVeryBig",""));
|
2010-04-01 20:59:05 +02:00
|
|
|
|
menuFontVeryBig->setSize(menuFontNameVeryBigSize);
|
2011-07-02 03:56:06 +02:00
|
|
|
|
//menuFontVeryBig->setYOffsetFactor(config.getFloat("FontMenuVeryBigYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
2011-06-08 09:18:06 +02:00
|
|
|
|
|
|
|
|
|
menuFontVeryBig3D= renderer.newFont3D(rsGlobal);
|
|
|
|
|
menuFontVeryBig3D->setType(menuFontNameVeryBig,config.getString("FontMenuVeryBig",""));
|
|
|
|
|
menuFontVeryBig3D->setSize(menuFontNameVeryBigSize);
|
2011-07-02 03:56:06 +02:00
|
|
|
|
//menuFontVeryBig3D->setYOffsetFactor(config.getFloat("FontMenuVeryBigYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
2010-04-01 02:13:28 +02:00
|
|
|
|
|
2011-06-28 02:51:13 +02:00
|
|
|
|
//printf("CoreData menuFontVeryBig3D [%d] menuFontVeryBig3D [%p]\n",menuFontVeryBig3D->getSize(),menuFontVeryBig3D);
|
|
|
|
|
|
2011-03-28 05:54:23 +02:00
|
|
|
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] menuFontNameVeryBig = [%s] menuFontNameVeryBigSize = %d\n",__FILE__,__FUNCTION__,__LINE__,menuFontNameVeryBig.c_str(),menuFontNameVeryBigSize);
|
2010-04-11 03:25:06 +02:00
|
|
|
|
|
2010-04-01 02:13:28 +02:00
|
|
|
|
//console font
|
2011-05-25 21:03:22 +02:00
|
|
|
|
string consoleFontNamePrefix = config.getString("FontConsolePrefix");
|
|
|
|
|
string consoleFontNamePostfix = config.getString("FontConsolePostfix");
|
|
|
|
|
int consoleFontNameSize = computeFontSize(config.getInt("FontConsoleBaseSize"));
|
|
|
|
|
|
|
|
|
|
if(lang.hasString("FontConsolePrefix") == true) {
|
|
|
|
|
consoleFontNamePrefix = lang.get("FontConsolePrefix");
|
|
|
|
|
}
|
|
|
|
|
if(lang.hasString("FontConsolePostfix") == true) {
|
|
|
|
|
consoleFontNamePostfix = lang.get("FontConsolePostfix");
|
|
|
|
|
}
|
|
|
|
|
if(lang.hasString("FontConsoleBaseSize") == true) {
|
|
|
|
|
consoleFontNameSize = strToInt(lang.get("FontConsoleBaseSize"));
|
|
|
|
|
}
|
|
|
|
|
|
2011-06-08 09:18:06 +02:00
|
|
|
|
string consoleFontName= consoleFontNamePrefix + intToStr(consoleFontNameSize) + consoleFontNamePostfix;
|
2011-05-25 21:03:22 +02:00
|
|
|
|
|
2010-04-01 02:13:28 +02:00
|
|
|
|
consoleFont= renderer.newFont(rsGlobal);
|
2011-06-06 23:38:25 +02:00
|
|
|
|
consoleFont->setType(consoleFontName,config.getString("FontConsole",""));
|
2010-04-01 20:59:05 +02:00
|
|
|
|
consoleFont->setSize(consoleFontNameSize);
|
2011-07-02 03:56:06 +02:00
|
|
|
|
//consoleFont->setYOffsetFactor(config.getFloat("FontConsoleYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
2011-06-08 09:18:06 +02:00
|
|
|
|
|
|
|
|
|
consoleFont3D= renderer.newFont3D(rsGlobal);
|
|
|
|
|
consoleFont3D->setType(consoleFontName,config.getString("FontConsole",""));
|
|
|
|
|
consoleFont3D->setSize(consoleFontNameSize);
|
2011-07-02 03:56:06 +02:00
|
|
|
|
//consoleFont3D->setYOffsetFactor(config.getFloat("FontConsoleYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
2010-04-01 02:13:28 +02:00
|
|
|
|
|
2011-03-28 05:54:23 +02:00
|
|
|
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] consoleFontName = [%s] consoleFontNameSize = %d\n",__FILE__,__FUNCTION__,__LINE__,consoleFontName.c_str(),consoleFontNameSize);
|
2010-04-11 03:25:06 +02:00
|
|
|
|
|
2010-04-01 02:13:28 +02:00
|
|
|
|
//sounds
|
|
|
|
|
clickSoundA.load(dir+"/menu/sound/click_a.wav");
|
|
|
|
|
clickSoundB.load(dir+"/menu/sound/click_b.wav");
|
|
|
|
|
clickSoundC.load(dir+"/menu/sound/click_c.wav");
|
2010-05-16 18:40:21 +02:00
|
|
|
|
attentionSound.load(dir+"/menu/sound/attention.wav");
|
2011-01-01 21:31:25 +01:00
|
|
|
|
highlightSound.load(dir+"/menu/sound/highlight.wav");
|
2010-04-01 02:13:28 +02:00
|
|
|
|
introMusic.open(dir+"/menu/music/intro_music.ogg");
|
|
|
|
|
introMusic.setNext(&menuMusic);
|
|
|
|
|
menuMusic.open(dir+"/menu/music/menu_music.ogg");
|
|
|
|
|
menuMusic.setNext(&menuMusic);
|
|
|
|
|
waterSounds.resize(6);
|
2011-06-08 09:18:06 +02:00
|
|
|
|
|
2010-04-01 02:13:28 +02:00
|
|
|
|
for(int i=0; i<6; ++i){
|
|
|
|
|
waterSounds[i]= new StaticSound();
|
|
|
|
|
waterSounds[i]->load(dir+"/water_sounds/water"+intToStr(i)+".wav");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2011-06-11 10:52:49 +02:00
|
|
|
|
int CoreData::computeFontSize(int size) {
|
|
|
|
|
int rs = size;
|
2010-04-08 00:20:28 +02:00
|
|
|
|
Config &config= Config::getInstance();
|
2011-06-11 10:52:49 +02:00
|
|
|
|
if(Font::forceLegacyFonts == true) {
|
|
|
|
|
int screenH = config.getInt("ScreenHeight");
|
|
|
|
|
rs = size * screenH / 1024;
|
|
|
|
|
}
|
|
|
|
|
else {
|
2011-06-28 08:18:24 +02:00
|
|
|
|
if(Renderer::renderText3DEnabled) {
|
|
|
|
|
//rs = ((float)size * 0.85);
|
|
|
|
|
//rs = 24;
|
|
|
|
|
}
|
2011-06-28 02:51:13 +02:00
|
|
|
|
//int screenH = config.getInt("ScreenHeight");
|
|
|
|
|
//rs = size * screenH / 1024;
|
|
|
|
|
|
2011-06-11 10:52:49 +02:00
|
|
|
|
}
|
2010-04-08 00:20:28 +02:00
|
|
|
|
//FontSizeAdjustment
|
2011-06-11 10:52:49 +02:00
|
|
|
|
rs += config.getInt("FontSizeAdjustment");
|
2011-06-30 01:48:48 +02:00
|
|
|
|
if(Font::forceLegacyFonts == false) {
|
|
|
|
|
rs += Font::baseSize; //basesize only for new font system
|
|
|
|
|
}
|
2011-06-11 10:52:49 +02:00
|
|
|
|
if(Font::forceLegacyFonts == true) {
|
|
|
|
|
if(rs < 10) {
|
|
|
|
|
rs= 10;
|
|
|
|
|
}
|
2010-04-01 02:13:28 +02:00
|
|
|
|
}
|
2011-03-28 05:54:23 +02:00
|
|
|
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] fontsize orginal %d calculated:%d \n",__FILE__,__FUNCTION__,__LINE__,size,rs);
|
2010-04-01 02:13:28 +02:00
|
|
|
|
return rs;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ================== PRIVATE ========================
|
|
|
|
|
|
|
|
|
|
}}//end namespace
|