From df2df4bcfcbed4a32375207390874b656a7b0894 Mon Sep 17 00:00:00 2001 From: Titus Tscharntke Date: Sat, 26 Mar 2011 21:38:26 +0000 Subject: [PATCH] some rearrangement in options, player names in chat with colors again --- source/glest_game/game/console.cpp | 28 ++++++++++++++++--- source/glest_game/menu/menu_state_options.cpp | 18 ++++++------ 2 files changed, 34 insertions(+), 12 deletions(-) diff --git a/source/glest_game/game/console.cpp b/source/glest_game/game/console.cpp index f61834bc..d6f82025 100644 --- a/source/glest_game/game/console.cpp +++ b/source/glest_game/game/console.cpp @@ -46,16 +46,36 @@ void Console::addStdMessage(const string &s) { addLine(Lang::getInstance().get(s)); } -void Console::addLine(string line, bool playSound,int playerIndex, Vec3f textColor) { +void Console::addLine(string line, bool playSound, int playerIndex, Vec3f textColor) { try { - string playername=""; + if(playSound == true) { + SoundRenderer::getInstance().playFx(CoreData::getInstance().getClickSoundA()); + } + ConsoleLineInfo info; + info.text = line; + info.timeStamp = timeElapsed; + info.PlayerIndex = playerIndex; + info.originalPlayerName = ""; + info.color = textColor; if(playerIndex >= 0) { GameNetworkInterface *gameNetworkInterface= NetworkManager::getInstance().getGameNetworkInterface(); if(gameNetworkInterface != NULL) { - playername=gameNetworkInterface->getGameSettings()->getNetworkPlayerNameByPlayerIndex(playerIndex); + info.originalPlayerName = gameNetworkInterface->getGameSettings()->getNetworkPlayerNameByPlayerIndex(playerIndex); + //for(int i = 0; i < GameConstants::maxPlayers; ++i) { + // printf("i = %d, playerName = [%s]\n",i,gameNetworkInterface->getGameSettings()->getNetworkPlayerName(i).c_str()); + //} } } - addLine(line, playSound,playername, textColor); + //printf("info.PlayerIndex = %d, line [%s]\n",info.PlayerIndex,info.originalPlayerName.c_str()); + + lines.insert(lines.begin(), info); + if(lines.size() > maxLines) { + lines.pop_back(); + } + storedLines.insert(storedLines.begin(), info); + if(storedLines.size() > maxStoredLines) { + storedLines.pop_back(); + } } catch(const exception &ex) { char szBuf[1024]=""; diff --git a/source/glest_game/menu/menu_state_options.cpp b/source/glest_game/menu/menu_state_options.cpp index 6f4f8ad5..6e3dca99 100644 --- a/source/glest_game/menu/menu_state_options.cpp +++ b/source/glest_game/menu/menu_state_options.cpp @@ -39,11 +39,12 @@ MenuStateOptions::MenuStateOptions(Program *program, MainMenu *mainMenu): Shared::PlatformCommon::getFullscreenVideoModes(&modeInfos); activeInputLabel=NULL; - int leftLabelStart=150; + int leftLabelStart=130; int leftColumnStart=leftLabelStart+150; - int rightLabelStart=550; - int rightColumnStart=rightLabelStart+150; + int rightLabelStart=530; + int rightColumnStart=rightLabelStart+200; int buttonRowPos=80; + int buttonStartPos=170; int captionOffset=75; int currentLabelStart=leftLabelStart; int currentColumnStart=leftColumnStart; @@ -273,6 +274,7 @@ MenuStateOptions::MenuStateOptions(Program *program, MainMenu *mainMenu): labelPlayerName.registerGraphicComponent(containerName,"labelPlayerName"); labelPlayerName.init(currentColumnStart,currentLine); labelPlayerName.setText(config.getString("NetPlayerName",Socket::getHostName().c_str())); + labelPlayerName.setFont(CoreData::getInstance().getMenuFontBig()); currentLine-=30; //FontSizeAdjustment @@ -414,24 +416,24 @@ MenuStateOptions::MenuStateOptions(Program *program, MainMenu *mainMenu): // buttons buttonOk.registerGraphicComponent(containerName,"buttonOk"); - buttonOk.init(200, buttonRowPos, 100); + buttonOk.init(buttonStartPos, buttonRowPos, 100); buttonOk.setText(lang.get("Ok")); buttonAbort.setText(lang.get("Abort")); buttonAbort.registerGraphicComponent(containerName,"buttonAbort"); - buttonAbort.init(310, buttonRowPos, 100); + buttonAbort.init(buttonStartPos+110, buttonRowPos, 100); buttonAutoConfig.setText(lang.get("AutoConfig")); buttonAutoConfig.registerGraphicComponent(containerName,"buttonAutoConfig"); - buttonAutoConfig.init(450, buttonRowPos, 125); + buttonAutoConfig.init(buttonStartPos+250, buttonRowPos, 125); buttonVideoInfo.setText(lang.get("VideoInfo")); buttonVideoInfo.registerGraphicComponent(containerName,"buttonVideoInfo"); - buttonVideoInfo.init(585, buttonRowPos, 125); // was 620 + buttonVideoInfo.init(buttonStartPos+385, buttonRowPos, 125); // was 620 buttonKeyboardSetup.setText(lang.get("Keyboardsetup")); buttonKeyboardSetup.registerGraphicComponent(containerName,"buttonKeyboardSetup"); - buttonKeyboardSetup.init(720, buttonRowPos, 125); + buttonKeyboardSetup.init(buttonStartPos+520, buttonRowPos, 125); GraphicComponent::applyAllCustomProperties(containerName); }