Changed: Updated to compile under linux

Changed: Changed console code so pressing the toggleconsole key no longer sends the keypress to the console.
~g2k
This commit is contained in:
2005-06-20 03:04:15 -04:00
parent a0b8ce778b
commit 65856a4ae1

View File

@@ -3,7 +3,7 @@
// Module: level.cpp // Module: level.cpp
// Author: Tom Hicks // Author: Tom Hicks
// Creation: 09-01-2003 // Creation: 09-01-2003
// LastEdit: 10-20-2003 // LastEdit: 06-20-2005
// Editors: Tom Hicks // Editors: Tom Hicks
// //
// Purpose: // Purpose:
@@ -40,6 +40,7 @@ LEVEL::LEVEL()
*/ */
textureNames = NULL; textureNames = NULL;
numTextures = 0; numTextures = 0;
textures = NULL;
screen.name = "OpenArena"; screen.name = "OpenArena";
@@ -69,13 +70,7 @@ LEVEL::~LEVEL()
{ {
if(defaultPlayer) if(defaultPlayer)
{ {
try delete defaultPlayer;
{
delete defaultPlayer;
}
catch(...)
{
}
defaultPlayer = NULL; defaultPlayer = NULL;
} }
} }
@@ -164,6 +159,7 @@ bool LEVEL::LoadMap(string mapname)
{ {
input >> textureNames[i]; input >> textureNames[i];
} }
LoadGLTextures();
char lpszNumTextures[6]; char lpszNumTextures[6];
sprintf(lpszNumTextures, "%d", numTextures); sprintf(lpszNumTextures, "%d", numTextures);
ConsolePrint(lpszNumTextures + string(" textures successfully read")); ConsolePrint(lpszNumTextures + string(" textures successfully read"));
@@ -171,8 +167,9 @@ bool LEVEL::LoadMap(string mapname)
//BGM //BGM
input >> bgm; input >> bgm;
//LoadGLTextures();
//Build display list //Build display list
//Sound
if (sound) if (sound)
{ {
ConsolePrint("Starting sound"); ConsolePrint("Starting sound");
@@ -391,24 +388,20 @@ void LEVEL::UnloadMap()
if(triangles) if(triangles)
{ {
try delete [] triangles;
{ triangles = NULL;
delete [] triangles; }
}
catch(...) if(textures)
{ {
} delete [] textures;
textures = NULL;
} }
if (textureNames) if (textureNames)
{ {
try
{
delete [] textureNames; delete [] textureNames;
} textureNames = NULL;
catch(...)
{
}
} }
} }
@@ -420,6 +413,10 @@ void LEVEL::LoadGLTextures()
glEnable(GL_LIGHT1); glEnable(GL_LIGHT1);
glEnable(GL_LIGHTING);*/ glEnable(GL_LIGHTING);*/
if(textures != NULL)
{
delete [] textures;
}
textures = new GL_MY_TEXTURE[numTextures]; textures = new GL_MY_TEXTURE[numTextures];
@@ -435,8 +432,6 @@ void LEVEL::LoadGLTextures()
//Load the console background image //Load the console background image
if(!menuTextures[GL_MY_TEXTURE_CONSOLEBACKGROUND].Load(gamedir + "textures/menu/con_back.tga")) if(!menuTextures[GL_MY_TEXTURE_CONSOLEBACKGROUND].Load(gamedir + "textures/menu/con_back.tga"))
menuTextures[GL_MY_TEXTURE_CONSOLEBACKGROUND].Load("oa/textures/menu/con_back.bmp"); menuTextures[GL_MY_TEXTURE_CONSOLEBACKGROUND].Load("oa/textures/menu/con_back.bmp");
} }
uint32 LEVEL::FPS() uint32 LEVEL::FPS()
@@ -1173,7 +1168,7 @@ void LEVEL::UpdateConsole(char newChar)
{ {
consoleHistory[0] = Left(consoleHistory[0], consoleHistory[0].length()-1); consoleHistory[0] = Left(consoleHistory[0], consoleHistory[0].length()-1);
} }
else else if(!(defaultPlayer->controls.toggleConsole.Contains(newChar)))
{ {
consoleHistory[0] = consoleHistory[0] + newChar; consoleHistory[0] = consoleHistory[0] + newChar;
/* /*