*** empty log message ***

This commit is contained in:
2006-07-03 17:22:10 -04:00
parent ce72675d16
commit 12ff23fe50
6 changed files with 27 additions and 56 deletions

View File

@@ -105,7 +105,9 @@ namespace OpenArena{
uint32 palletteEntries = 0; uint32 palletteEntries = 0;
fread(&bmpHeader, sizeof(bmpHeader), 1, f); fread(&bmpHeader, sizeof(bmpHeader), 1, f);
#if __BYTE_ORDER == __BIG_ENDIAN byte t[2] = {1,0};
if( *((short*)t) !=1)
{
//If big endian reorder bytes //If big endian reorder bytes
bmpHeader.type = ((bmpHeader.type & 0xff00) >> 8) | bmpHeader.type = ((bmpHeader.type & 0xff00) >> 8) |
((bmpHeader.type & 0x00ff) << 8); ((bmpHeader.type & 0x00ff) << 8);
@@ -121,11 +123,12 @@ namespace OpenArena{
(bmpHeader.offset & 0x00ff0000) >> 8 | (bmpHeader.offset & 0x00ff0000) >> 8 |
(bmpHeader.offset & 0x0000ff00) << 8 | (bmpHeader.offset & 0x0000ff00) << 8 |
(bmpHeader.offset & 0x000000ff) << 24; (bmpHeader.offset & 0x000000ff) << 24;
#endif }
PrintBMPHeader(bmpHeader); PrintBMPHeader(bmpHeader);
fread(&bmpInfo, sizeof(bmpInfo), 1, f); fread(&bmpInfo, sizeof(bmpInfo), 1, f);
#if __BYTE_ORDER == __BIG_ENDIAN if( *((short*)t) !=1)
{
//If big endian reorder bytes //If big endian reorder bytes
bmpInfo.size = (bmpInfo.size & 0xff000000) >> 24 | bmpInfo.size = (bmpInfo.size & 0xff000000) >> 24 |
(bmpInfo.size & 0x00ff0000) >> 8 | (bmpInfo.size & 0x00ff0000) >> 8 |
@@ -167,7 +170,7 @@ namespace OpenArena{
(bmpInfo.clrImportant & 0x00ff0000) >> 8 | (bmpInfo.clrImportant & 0x00ff0000) >> 8 |
(bmpInfo.clrImportant & 0x0000ff00) << 8 | (bmpInfo.clrImportant & 0x0000ff00) << 8 |
(bmpInfo.clrImportant & 0x000000ff) << 24; (bmpInfo.clrImportant & 0x000000ff) << 24;
#endif }
PrintBMPInfo(bmpInfo); PrintBMPInfo(bmpInfo);

View File

@@ -40,7 +40,6 @@ namespace OpenArena
_window = NULL; _window = NULL;
textureNames = NULL; textureNames = NULL;
numTextures = 0; numTextures = 0;
textures = NULL;
screen.SetName(OPENARENA_VERSION); screen.SetName(OPENARENA_VERSION);
@@ -298,7 +297,7 @@ namespace OpenArena
for (uint32 i=0; i<numTriangles; i++) for (uint32 i=0; i<numTriangles; i++)
{ {
glBindTexture(GL_TEXTURE_2D, textures[triangles[i].texID].ID());//Bind this triangle's texture glBindTexture(GL_TEXTURE_2D, textures[triangles[i].texID]->ID());//Bind this triangle's texture
glBegin(GL_TRIANGLES); glBegin(GL_TRIANGLES);
// glNormal3f((GLfloat)triangles[i].normal.x, (GLfloat)triangles[i].normal.y, (GLfloat)triangles[i].normal.z); // glNormal3f((GLfloat)triangles[i].normal.x, (GLfloat)triangles[i].normal.y, (GLfloat)triangles[i].normal.z);
for (uint32 i2=0; i2<3; i2++) for (uint32 i2=0; i2<3; i2++)
@@ -417,11 +416,11 @@ namespace OpenArena
} }
//Free all map textures //Free all map textures
if(textures) if(!textures.IsEmpty())
{ {
delete [] textures; //TODOiterate over list and delete all entries
textures = NULL;
} }
textures.Clear();
//Free the array of texture names //Free the array of texture names
if (textureNames) if (textureNames)
@@ -443,17 +442,14 @@ namespace OpenArena
glEnable(GL_LIGHTING); glEnable(GL_LIGHTING);
*/ */
if(textures != NULL) textures.Clear();
{
delete [] textures;
}
textures = new Texture[numTextures];
for(uint32 i=0; i<numTextures; i++) for(uint32 i=0; i<numTextures; i++)
{ {
if(!textures[i].Load(gamedir + "textures/" + textureNames[i])) Texture* texture = new Texture();
textures[i].Load(DEFAULT_TEXTURE_NAME); if(!texture->Load(gamedir + "textures/" + textureNames[i]))
texture->Load(DEFAULT_TEXTURE_NAME);
textures[i] = texture;
} }
if(!glFont.BuildFont((gamedir + "textures/menu/font.bmp").c_str())) if(!glFont.BuildFont((gamedir + "textures/menu/font.bmp").c_str()))

View File

@@ -25,7 +25,7 @@
#include "tga.h" #include "tga.h"
#include "list.h" #include "list.h"
#ifdef WIN32 #ifdef WIN32
#include "bass.h" //for audio in windows only this should be replaced by oa_audio #include "../lib/bass.h" //for audio in windows only this should be replaced by oa_audio
#endif #endif
#include "vector.h" #include "vector.h"
#include "camera.h" #include "camera.h"
@@ -104,8 +104,7 @@ namespace OpenArena
uint32 numTriangles; uint32 numTriangles;
list<Player> players; list<Player> players;
list<ENTITY> ents; list<ENTITY> ents;
//list<GL_MY_TEXTURE> textures; list<Texture*> textures;
Texture* textures;
Texture menuTextures[NUM_MENU_TEXTURES]; Texture menuTextures[NUM_MENU_TEXTURES];
Window* _window; Window* _window;

View File

@@ -34,32 +34,6 @@ TextureImage* LoadTGA(const char * filename)
fclose(file); fclose(file);
return NULL; return NULL;
} }
#if __BYTE_ORDER == __BIG_ENDIAN
/* This doesnt need to be done for this structure as it is just a collection of bytes
//If big endian reorder bytes
uint32 i;
printf("\n%:X|", ((uint8*)&tgaheader)[1]);
for(i=1; i<sizeof(TGAHeader)-1; i++)
{
printf("%X|", ((uint8*)&tgaheader)[i]);
}
printf("%X:\n", ((uint8*)&tgaheader)[i]);
for(i=0; i<sizeof(TGAHeader)/2; i++)
{
GLubyte temp = tgaheader.Header[i];
tgaheader.Header[i] = tgaheader.Header[sizeof(TGAHeader) - i];
tgaheader.Header[sizeof(TGAHeader) - i] = temp;
}
printf("%:X|", ((uint8*)&tgaheader)[1]);
for(i=1; i<sizeof(TGAHeader)-1; i++)
{
printf("%X|", ((uint8*)&tgaheader)[i]);
}
printf("%X:\n", ((uint8*)&tgaheader)[i]);
*/
#endif
if(memcmp(uTGAcompare, &tgaheader, sizeof(tgaheader)) == 0) if(memcmp(uTGAcompare, &tgaheader, sizeof(tgaheader)) == 0)
image = LoadUncompressedTGA(file); image = LoadUncompressedTGA(file);

View File

@@ -433,7 +433,7 @@ bool OpenArena::Window::Open()
ShowWindow(window,SW_SHOW); ShowWindow(window,SW_SHOW);
SetForegroundWindow(window); SetForegroundWindow(window);
SetFocus(window); SetFocus(window);
OnResize(_width, _height); _resizer->Resize(_width, _height);
if (!_initializer->Initialize()) if (!_initializer->Initialize())
{ {

View File

@@ -239,6 +239,14 @@ int WINAPI WinMain( HINSTANCE hInstance,
InitControls(); InitControls();
g_Screen.SetInitializer(new OpenArena::Window::Initializer());
g_Screen.SetResizer(new OpenArena::Window::Resizer());
if (!g_Screen.Open(string(OPENARENA_VERSION), level.screen.GetWidth(), level.screen.GetHeight(), level.screen.GetColorDepth(), level.screen.GetFullscreen()))
{
return 0;
}
level.SetWindow(&g_Screen);
level.glFont.SetScreenDimensions(level.screen.GetWidth()*2, level.screen.GetHeight()*2); level.glFont.SetScreenDimensions(level.screen.GetWidth()*2, level.screen.GetHeight()*2);
//level.glFont.BuildFont("oa\\textures\\menu\\font.bmp");//(level.gamedir + "\\textures\\menu\\font.bmp").c_str()); //level.glFont.BuildFont("oa\\textures\\menu\\font.bmp");//(level.gamedir + "\\textures\\menu\\font.bmp").c_str());
if (level.nextLevel == "") if (level.nextLevel == "")
@@ -250,15 +258,6 @@ int WINAPI WinMain( HINSTANCE hInstance,
level.LoadMap(); level.LoadMap();
} }
g_Screen.SetOnInit(InitGL);
g_Screen.SetOnResize(ReSizeGLScene);
if (!g_Screen.Open(string(OPENARENA_VERSION), level.screen.GetWidth(), level.screen.GetHeight(), level.screen.GetColorDepth(), level.screen.GetFullscreen()))
{
return 0;
}
level.SetWindow(g_Screen);
while(!done) while(!done)
{ {
while (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) while (PeekMessage(&msg,NULL,0,0,PM_REMOVE))