*** empty log message ***
This commit is contained in:
11
src/bmp.cpp
11
src/bmp.cpp
@@ -105,7 +105,9 @@ namespace OpenArena{
|
||||
uint32 palletteEntries = 0;
|
||||
|
||||
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
|
||||
bmpHeader.type = ((bmpHeader.type & 0xff00) >> 8) |
|
||||
((bmpHeader.type & 0x00ff) << 8);
|
||||
@@ -121,11 +123,12 @@ namespace OpenArena{
|
||||
(bmpHeader.offset & 0x00ff0000) >> 8 |
|
||||
(bmpHeader.offset & 0x0000ff00) << 8 |
|
||||
(bmpHeader.offset & 0x000000ff) << 24;
|
||||
#endif
|
||||
}
|
||||
PrintBMPHeader(bmpHeader);
|
||||
|
||||
fread(&bmpInfo, sizeof(bmpInfo), 1, f);
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
if( *((short*)t) !=1)
|
||||
{
|
||||
//If big endian reorder bytes
|
||||
bmpInfo.size = (bmpInfo.size & 0xff000000) >> 24 |
|
||||
(bmpInfo.size & 0x00ff0000) >> 8 |
|
||||
@@ -167,7 +170,7 @@ namespace OpenArena{
|
||||
(bmpInfo.clrImportant & 0x00ff0000) >> 8 |
|
||||
(bmpInfo.clrImportant & 0x0000ff00) << 8 |
|
||||
(bmpInfo.clrImportant & 0x000000ff) << 24;
|
||||
#endif
|
||||
}
|
||||
PrintBMPInfo(bmpInfo);
|
||||
|
||||
|
||||
|
||||
@@ -40,7 +40,6 @@ namespace OpenArena
|
||||
_window = NULL;
|
||||
textureNames = NULL;
|
||||
numTextures = 0;
|
||||
textures = NULL;
|
||||
|
||||
screen.SetName(OPENARENA_VERSION);
|
||||
|
||||
@@ -298,7 +297,7 @@ namespace OpenArena
|
||||
|
||||
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);
|
||||
// glNormal3f((GLfloat)triangles[i].normal.x, (GLfloat)triangles[i].normal.y, (GLfloat)triangles[i].normal.z);
|
||||
for (uint32 i2=0; i2<3; i2++)
|
||||
@@ -417,11 +416,11 @@ namespace OpenArena
|
||||
}
|
||||
|
||||
//Free all map textures
|
||||
if(textures)
|
||||
if(!textures.IsEmpty())
|
||||
{
|
||||
delete [] textures;
|
||||
textures = NULL;
|
||||
//TODOiterate over list and delete all entries
|
||||
}
|
||||
textures.Clear();
|
||||
|
||||
//Free the array of texture names
|
||||
if (textureNames)
|
||||
@@ -443,17 +442,14 @@ namespace OpenArena
|
||||
glEnable(GL_LIGHTING);
|
||||
*/
|
||||
|
||||
if(textures != NULL)
|
||||
{
|
||||
delete [] textures;
|
||||
}
|
||||
|
||||
textures = new Texture[numTextures];
|
||||
textures.Clear();
|
||||
|
||||
for(uint32 i=0; i<numTextures; i++)
|
||||
{
|
||||
if(!textures[i].Load(gamedir + "textures/" + textureNames[i]))
|
||||
textures[i].Load(DEFAULT_TEXTURE_NAME);
|
||||
Texture* texture = new Texture();
|
||||
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()))
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include "tga.h"
|
||||
#include "list.h"
|
||||
#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
|
||||
#include "vector.h"
|
||||
#include "camera.h"
|
||||
@@ -104,8 +104,7 @@ namespace OpenArena
|
||||
uint32 numTriangles;
|
||||
list<Player> players;
|
||||
list<ENTITY> ents;
|
||||
//list<GL_MY_TEXTURE> textures;
|
||||
Texture* textures;
|
||||
list<Texture*> textures;
|
||||
Texture menuTextures[NUM_MENU_TEXTURES];
|
||||
Window* _window;
|
||||
|
||||
|
||||
26
src/tga.cpp
26
src/tga.cpp
@@ -34,32 +34,6 @@ TextureImage* LoadTGA(const char * filename)
|
||||
fclose(file);
|
||||
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)
|
||||
image = LoadUncompressedTGA(file);
|
||||
|
||||
@@ -433,7 +433,7 @@ bool OpenArena::Window::Open()
|
||||
ShowWindow(window,SW_SHOW);
|
||||
SetForegroundWindow(window);
|
||||
SetFocus(window);
|
||||
OnResize(_width, _height);
|
||||
_resizer->Resize(_width, _height);
|
||||
|
||||
if (!_initializer->Initialize())
|
||||
{
|
||||
|
||||
@@ -239,6 +239,14 @@ int WINAPI WinMain( HINSTANCE hInstance,
|
||||
|
||||
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.BuildFont("oa\\textures\\menu\\font.bmp");//(level.gamedir + "\\textures\\menu\\font.bmp").c_str());
|
||||
if (level.nextLevel == "")
|
||||
@@ -250,15 +258,6 @@ int WINAPI WinMain( HINSTANCE hInstance,
|
||||
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 (PeekMessage(&msg,NULL,0,0,PM_REMOVE))
|
||||
|
||||
Reference in New Issue
Block a user