watersounds playing all over the map is fixed.
'M' key shows faded console messages again (currently ingame only )
This commit is contained in:
parent
4c8e4eaccb
commit
e5d9631a9f
|
@ -31,6 +31,7 @@ namespace Glest{ namespace Game{
|
||||||
Console::Console(){
|
Console::Console(){
|
||||||
//config
|
//config
|
||||||
maxLines= Config::getInstance().getInt("ConsoleMaxLines");
|
maxLines= Config::getInstance().getInt("ConsoleMaxLines");
|
||||||
|
maxStoredLines= Config::getInstance().getInt("ConsoleMaxLinesStored");
|
||||||
timeout= Config::getInstance().getInt("ConsoleTimeout");
|
timeout= Config::getInstance().getInt("ConsoleTimeout");
|
||||||
|
|
||||||
timeElapsed= 0.0f;
|
timeElapsed= 0.0f;
|
||||||
|
@ -50,6 +51,10 @@ void Console::addLine(string line, bool playSound){
|
||||||
if(lines.size()>maxLines){
|
if(lines.size()>maxLines){
|
||||||
lines.pop_back();
|
lines.pop_back();
|
||||||
}
|
}
|
||||||
|
storedLines.insert(storedLines.begin(), StringTimePair(line, timeElapsed));
|
||||||
|
if(storedLines.size()>maxStoredLines){
|
||||||
|
storedLines.pop_back();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch(const exception &ex) {
|
catch(const exception &ex) {
|
||||||
char szBuf[1024]="";
|
char szBuf[1024]="";
|
||||||
|
@ -58,6 +63,12 @@ void Console::addLine(string line, bool playSound){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Console::clearStoredLines(){
|
||||||
|
while(!storedLines.empty()){
|
||||||
|
storedLines.pop_back();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Console::update(){
|
void Console::update(){
|
||||||
timeElapsed+= 1.f/GameConstants::updateFps;
|
timeElapsed+= 1.f/GameConstants::updateFps;
|
||||||
|
|
||||||
|
|
|
@ -42,21 +42,25 @@ public:
|
||||||
private:
|
private:
|
||||||
float timeElapsed;
|
float timeElapsed;
|
||||||
Lines lines;
|
Lines lines;
|
||||||
|
Lines storedLines;
|
||||||
|
|
||||||
//this should be deleted from here someday
|
//this should be deleted from here someday
|
||||||
bool won, lost;
|
bool won, lost;
|
||||||
|
|
||||||
//config
|
//config
|
||||||
int maxLines;
|
int maxLines;
|
||||||
|
int maxStoredLines;
|
||||||
float timeout;
|
float timeout;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Console();
|
Console();
|
||||||
|
|
||||||
|
int getStoredLineCount() const {return storedLines.size();}
|
||||||
int getLineCount() const {return lines.size();}
|
int getLineCount() const {return lines.size();}
|
||||||
string getLine(int i) const { if(i < 0 || i >= lines.size()) throw runtime_error("i >= Lines.size()"); return lines[i].first;}
|
string getLine(int i) const { if(i < 0 || i >= lines.size()) throw runtime_error("i >= Lines.size()"); return lines[i].first;}
|
||||||
|
string getStoredLine(int i) const { if(i < 0 || i >= storedLines.size()) throw runtime_error("i >= storedLines.size()"); return storedLines[i].first;}
|
||||||
|
|
||||||
|
void clearStoredLines();
|
||||||
void addStdMessage(const string &s);
|
void addStdMessage(const string &s);
|
||||||
void addLine(string line, bool playSound= false);
|
void addLine(string line, bool playSound= false);
|
||||||
void update();
|
void update();
|
||||||
|
|
|
@ -57,6 +57,7 @@ Game::Game(Program *program, const GameSettings *gameSettings):
|
||||||
gameOver= false;
|
gameOver= false;
|
||||||
renderNetworkStatus= false;
|
renderNetworkStatus= false;
|
||||||
speed= sNormal;
|
speed= sNormal;
|
||||||
|
showFullConsole= false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::~Game(){
|
Game::~Game(){
|
||||||
|
@ -236,6 +237,7 @@ void Game::init()
|
||||||
world.init(this, gameSettings.getDefaultUnits());
|
world.init(this, gameSettings.getDefaultUnits());
|
||||||
gui.init(this);
|
gui.init(this);
|
||||||
chatManager.init(&console, world.getThisTeamIndex());
|
chatManager.init(&console, world.getThisTeamIndex());
|
||||||
|
console.clearStoredLines();
|
||||||
const Vec2i &v= map->getStartLocation(world.getThisFaction()->getStartLocationIndex());
|
const Vec2i &v= map->getStartLocation(world.getThisFaction()->getStartLocationIndex());
|
||||||
gameCamera.init(map->getW(), map->getH());
|
gameCamera.init(map->getW(), map->getH());
|
||||||
gameCamera.setPos(Vec2f(v.x, v.y));
|
gameCamera.setPos(Vec2f(v.x, v.y));
|
||||||
|
@ -597,6 +599,9 @@ void Game::keyDown(char key){
|
||||||
if(key=='N'){
|
if(key=='N'){
|
||||||
renderNetworkStatus= true;
|
renderNetworkStatus= true;
|
||||||
}
|
}
|
||||||
|
else if(key=='M'){
|
||||||
|
showFullConsole= true;
|
||||||
|
}
|
||||||
else if(key=='E'){
|
else if(key=='E'){
|
||||||
for(int i=0; i<100; ++i){
|
for(int i=0; i<100; ++i){
|
||||||
string path= "screens/screen" + intToStr(i) + ".tga";
|
string path= "screens/screen" + intToStr(i) + ".tga";
|
||||||
|
@ -726,6 +731,9 @@ void Game::keyUp(char key){
|
||||||
case 'N':
|
case 'N':
|
||||||
renderNetworkStatus= false;
|
renderNetworkStatus= false;
|
||||||
break;
|
break;
|
||||||
|
case 'M':
|
||||||
|
showFullConsole= false;
|
||||||
|
break;
|
||||||
case 'A':
|
case 'A':
|
||||||
case 'D':
|
case 'D':
|
||||||
gameCamera.setRotate(0);
|
gameCamera.setRotate(0);
|
||||||
|
@ -889,7 +897,7 @@ void Game::render2d(){
|
||||||
//resource info
|
//resource info
|
||||||
if(!config.getBool("PhotoMode")){
|
if(!config.getBool("PhotoMode")){
|
||||||
renderer.renderResourceStatus();
|
renderer.renderResourceStatus();
|
||||||
renderer.renderConsole(&console);
|
renderer.renderConsole(&console,showFullConsole);
|
||||||
}
|
}
|
||||||
|
|
||||||
//2d mouse
|
//2d mouse
|
||||||
|
|
|
@ -68,6 +68,7 @@ private:
|
||||||
bool paused;
|
bool paused;
|
||||||
bool gameOver;
|
bool gameOver;
|
||||||
bool renderNetworkStatus;
|
bool renderNetworkStatus;
|
||||||
|
bool showFullConsole;
|
||||||
float scrollSpeed;
|
float scrollSpeed;
|
||||||
Speed speed;
|
Speed speed;
|
||||||
GraphicMessageBox mainMessageBox;
|
GraphicMessageBox mainMessageBox;
|
||||||
|
|
|
@ -688,7 +688,7 @@ void Renderer::renderTextureQuad(int x, int y, int w, int h, const Texture2D *te
|
||||||
assertGl();
|
assertGl();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::renderConsole(const Console *console){
|
void Renderer::renderConsole(const Console *console,const bool showFullConsole){
|
||||||
glPushAttrib(GL_ENABLE_BIT);
|
glPushAttrib(GL_ENABLE_BIT);
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
Vec4f fontColor;
|
Vec4f fontColor;
|
||||||
|
@ -700,15 +700,25 @@ void Renderer::renderConsole(const Console *console){
|
||||||
// white shadowed is default ( in the menu for example )
|
// white shadowed is default ( in the menu for example )
|
||||||
fontColor=Vec4f(1.f, 1.f, 1.f, 0.0f);
|
fontColor=Vec4f(1.f, 1.f, 1.f, 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i=0; i<console->getLineCount(); ++i){
|
|
||||||
renderTextShadow(
|
|
||||||
console->getLine(i),
|
|
||||||
CoreData::getInstance().getConsoleFont(),
|
|
||||||
fontColor,
|
|
||||||
20, i*20+20);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if(showFullConsole){
|
||||||
|
for(int i=0; i<console->getStoredLineCount(); ++i){
|
||||||
|
renderTextShadow(
|
||||||
|
console->getStoredLine(i),
|
||||||
|
CoreData::getInstance().getConsoleFont(),
|
||||||
|
fontColor,
|
||||||
|
20, i*20+20);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
for(int i=0; i<console->getLineCount(); ++i){
|
||||||
|
renderTextShadow(
|
||||||
|
console->getLine(i),
|
||||||
|
CoreData::getInstance().getConsoleFont(),
|
||||||
|
fontColor,
|
||||||
|
20, i*20+20);
|
||||||
|
}
|
||||||
|
}
|
||||||
glPopAttrib();
|
glPopAttrib();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -225,7 +225,7 @@ public:
|
||||||
void renderMouse3d();
|
void renderMouse3d();
|
||||||
void renderBackground(const Texture2D *texture);
|
void renderBackground(const Texture2D *texture);
|
||||||
void renderTextureQuad(int x, int y, int w, int h, const Texture2D *texture, float alpha=1.f);
|
void renderTextureQuad(int x, int y, int w, int h, const Texture2D *texture, float alpha=1.f);
|
||||||
void renderConsole(const Console *console);
|
void renderConsole(const Console *console, const bool showAll=false);
|
||||||
void renderChatManager(const ChatManager *chatManager);
|
void renderChatManager(const ChatManager *chatManager);
|
||||||
void renderResourceStatus();
|
void renderResourceStatus();
|
||||||
void renderSelectionQuad();
|
void renderSelectionQuad();
|
||||||
|
|
|
@ -100,7 +100,11 @@ void UnitUpdater::updateUnit(Unit *unit){
|
||||||
|
|
||||||
//play water sound
|
//play water sound
|
||||||
if(map->getCell(unit->getPos())->getHeight()<map->getWaterLevel() && unit->getCurrField()==fLand){
|
if(map->getCell(unit->getPos())->getHeight()<map->getWaterLevel() && unit->getCurrField()==fLand){
|
||||||
soundRenderer.playFx(CoreData::getInstance().getWaterSound());
|
soundRenderer.playFx(
|
||||||
|
CoreData::getInstance().getWaterSound(),
|
||||||
|
unit->getCurrVector(),
|
||||||
|
gameCamera->getPos()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user