- bugfix 3dlists when showing keyboard menu in game (water was showing wrong)

This commit is contained in:
Mark Vejvoda 2011-10-05 03:42:29 +00:00
parent e8663b99bc
commit 5a7a37a678
4 changed files with 45 additions and 4 deletions

View File

@ -1197,6 +1197,10 @@ void Game::ReplaceDisconnectedNetworkPlayersWithAI(bool isNetworkGame, NetworkRo
}
void Game::updateCamera(){
if(currentUIState != NULL) {
currentUIState->updateCamera();
return;
}
gameCamera.update();
}
@ -1271,6 +1275,12 @@ void Game::renderWorker() {
currentUIState->render();
return;
}
else {
Renderer &renderer= Renderer::getInstance();
if(renderer.getCustom3dMenuList() != NULL) {
renderer.setCustom3dMenuList(NULL);
}
}
Chrono chrono;
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled) chrono.start();
@ -1436,6 +1446,11 @@ void Game::mouseDownLeft(int x, int y) {
else if(result.first == keyboardSetupPopupMenuIndex) {
MainMenu *newMenu = new MainMenu(program); // open keyboard shortcuts setup screen
currentUIState = newMenu;
Renderer &renderer= Renderer::getInstance();
renderer.setCustom3dMenuList(&statelist3dMenu);
//currentUIState->load();
currentUIState->init();
newMenu->setState(new MenuStateKeysetup(program, newMenu,&currentUIState)); // open keyboard shortcuts setup screen
}
else if(result.first == pauseGamePopupMenuIndex) {

View File

@ -137,6 +137,7 @@ private:
int joinTeamPopupMenuIndex;
int pauseGamePopupMenuIndex;
int keyboardSetupPopupMenuIndex;
GLuint statelist3dMenu;
ProgramState *currentUIState;
bool masterserverMode;

View File

@ -471,7 +471,13 @@ void Renderer::reset2d() {
void Renderer::reset3dMenu() {
assertGl();
glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SINGLE_COLOR);
glCallList(list3dMenu);
if(this->customlist3dMenu != NULL) {
glCallList(*this->customlist3dMenu);
}
else {
glCallList(list3dMenu);
}
assertGl();
}
@ -549,7 +555,12 @@ void Renderer::endMenu() {
fontManager[rsMenu]->end();
particleManager[rsMenu]->end();
glDeleteLists(list3dMenu, 1);
if(this->customlist3dMenu != NULL) {
glDeleteLists(*this->customlist3dMenu,1);
}
else {
glDeleteLists(list3dMenu, 1);
}
}
void Renderer::reloadResources() {
@ -5782,11 +5793,21 @@ void Renderer::init3dListMenu(const MainMenu *mm) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
list3dMenu= glGenLists(1);
if(this->customlist3dMenu != NULL) {
*this->customlist3dMenu = glGenLists(1);
}
else {
list3dMenu= glGenLists(1);
}
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
glNewList(list3dMenu, GL_COMPILE);
if(this->customlist3dMenu != NULL) {
glNewList(*this->customlist3dMenu, GL_COMPILE);
}
else {
glNewList(list3dMenu, GL_COMPILE);
}
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
//misc

View File

@ -238,6 +238,7 @@ private:
GLuint list3d;
GLuint list2d;
GLuint list3dMenu;
GLuint *customlist3dMenu;
//shadows
GLuint shadowMapHandle;
@ -521,6 +522,9 @@ public:
static Texture2D * preloadTexture(string logoFilename);
int getCachedSurfaceDataSize() const { return mapSurfaceData.size(); }
void setCustom3dMenuList(GLuint *customlist3dMenu) { this->customlist3dMenu = customlist3dMenu; }
GLuint * getCustom3dMenuList() const { return this->customlist3dMenu; }
private:
//private misc
float computeSunAngle(float time);