Changed: Updated to compile under linux

~g2k
This commit is contained in:
2005-06-20 03:03:16 -04:00
parent e2ca6ca672
commit a0b8ce778b
27 changed files with 603 additions and 236 deletions

View File

@@ -3,7 +3,7 @@
// Module: bmp.cpp
// Author: Tom Hicks
// Creation: 09-01-2003
// LastEdit: 10-09-2003
// LastEdit: 06-20-2005
// Editors: Tom Hicks
//
// Purpose:
@@ -18,8 +18,45 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cstdio>
#include "../include/bmp.h"
#pragma pack(push,1)
struct BITMAP_HEADER
{
uint16 type;
uint32 size;
uint16 reserved1;
uint16 reserved2;
uint32 offset;
};
struct BITMAP_INFO
{
uint32 size;
uint32 width;
uint32 height;
uint16 planes;
uint16 bitCount;
uint32 compression;
uint32 sizeImage;
uint32 xPelsPerMeter;
uint32 yPelsPerMeter;
uint32 clrUsed;
uint32 clrImportant;
};
struct BITMAP_QUAD
{
uint8 blue;
uint8 green;
uint8 red;
uint8 reserved;
};
#pragma pack(pop)
#define BITMAP_MAGIC 19778
TextureImage* LoadBMP(const char* fn)
{
//If anything is not perfect return NULL after cleaning up our mess
@@ -30,34 +67,128 @@ TextureImage* LoadBMP(const char* fn)
if(!fn)
return NULL;
//Try to open our file and if successfull...
f=fopen(fn, "r");
f=fopen(fn, "rb");
if(f)
{
//close the file
fclose(f);
//Load our bitmap structure from the file.
AUX_RGBImageRec* bmp = auxDIBImageLoad(fn);
//If the load was successfull.
if(bmp)
BITMAP_HEADER bmpHeader;
BITMAP_INFO bmpInfo;
BITMAP_QUAD* bmpPallette = NULL;
uint32 palletteEntries = 0;
fread(&bmpHeader, sizeof(bmpHeader), 1, f);
fread(&bmpInfo, sizeof(bmpInfo), 1, f);
if(bmpInfo.width < 0)
{
//Allocate memory for a TextureImage Structure.
TextureImage* tex = new TextureImage;
//Convert the bitmap to a TextureImage.
tex->data = bmp->data;
tex->sizeX = bmp->sizeX;
tex->sizeY = bmp->sizeY;
tex->type = GL_RGB;
tex->bpp = 3;
//Free the bitmap but not it's data and return our TextureImage.
free(bmp);
return tex;
//This needs to be abstracted somehow
#ifdef WIN32
MessageBox(NULL, "Image width is negative", "ERROR", MB_OK);
#endif
fclose(f);
return NULL;
}
if(bmpInfo.width % 4 != 0)
{
//This needs to be abstracted somehow
#ifdef WIN32
MessageBox(NULL, "Image width must be a multiple of 8", "ERROR", MB_OK);
#endif
fclose(f);
return NULL;
}
if(bmpInfo.height < 0)
{
//This needs to be abstracted somehow
#ifdef WIN32
MessageBox(NULL, "Image height is negative", "ERROR", MB_OK);
#endif
fclose(f);
return NULL;
}
if(bmpInfo.height % 4 != 0)
{
//This needs to be abstracted somehow
#ifdef WIN32
MessageBox(NULL, "Image height must be a multiple of 8", "ERROR", MB_OK);
#endif
fclose(f);
return NULL;
}
if((bmpInfo.bitCount != 8 && bmpInfo.bitCount != 24) || bmpInfo.compression != 0)
{
//This needs to be abstracted somehow
#ifdef WIN32
MessageBox(NULL, "Only 8 and 24 bit uncompressed windows bmp files are currently supported", "ERROR", MB_OK);
#endif
fclose(f);
return NULL;
}
//Allocate memory for a TextureImage structure
TextureImage* tex = new TextureImage;
tex->sizeX = bmpInfo.width;
tex->sizeY = bmpInfo.height;
if(bmpInfo.bitCount >= 8)
{
tex->bpp = bmpInfo.bitCount >> 3;
}
tex->type = GL_RGB;
uint32 pixels = tex->sizeX * tex->sizeY;
uint32 bytes = pixels * tex->bpp;
tex->data = new uint8[bytes];
if(bmpInfo.bitCount == 8)
{
//Load the pallette
palletteEntries = bmpInfo.bitCount << 8;
bmpPallette = new BITMAP_QUAD[palletteEntries];
fread(bmpPallette, sizeof(BITMAP_QUAD), palletteEntries, f);
}
fseek(f, bmpHeader.offset, SEEK_SET);
fread(tex->data, bytes, 1, f);
if(bmpInfo.bitCount == 8)
{
//Apply the pallette
uint8* image = tex->data;
tex->bpp = 24;
bytes = pixels * tex->bpp;
tex->data = new uint8[bytes];
uint32 i;
uint32 i2;
for(i=0; i<pixels; i++)
{
i2 = i << 1 + 1;
//Should make sure image[i] < palletteEntries
tex->data[i2] = bmpPallette[image[i]].red;
tex->data[i2 + 1] = bmpPallette[image[i]].blue;
tex->data[i2 + 2] = bmpPallette[image[i]].green;
}
delete [] image;
image = NULL;
}
else if(bmpInfo.bitCount == 24)
{
uint32 i;
uint8 t;
for(i=0; i<bytes; i+=3)
{
t = tex->data[i];
tex->data[i] = tex->data[i+2];
tex->data[i+2] = t;
}
}
return tex;
}
return NULL;
}

View File

@@ -3,7 +3,7 @@
// Module: ctrls.cpp
// Author: Tom Hicks
// Creation: 09-01-2003
// LastEdit: 10-20-2003
// LastEdit: 06-19-2005
// Editors: Tom Hicks
//
// Purpose:
@@ -69,15 +69,15 @@
void ControlSchemeClass::LoadDefaultControlScheme()
{
forward.Insert(VK_LBUTTON);
backward.Insert(VK_RBUTTON);
lookLeft.Insert(VK_LEFT);
lookRight.Insert(VK_RIGHT);
lookUp.Insert(VK_UP);
lookDown.Insert(VK_DOWN);
forward.Insert(KEY_LBUTTON);
backward.Insert(KEY_RBUTTON);
lookLeft.Insert(KEY_LEFT);
lookRight.Insert(KEY_RIGHT);
lookUp.Insert(KEY_UP);
lookDown.Insert(KEY_DOWN);
moveLeft.Insert('S');
moveRight.Insert('D');
moveUp.Insert(VK_SPACE);
moveUp.Insert(KEY_SPACE);
moveDown.Insert('A');
firePrimary.Insert('F');
fireSecondary.Insert('G');
@@ -269,4 +269,4 @@ bool ControlSchemeClass::Bind(uint32 action, uint8 key)
default:
return false;
}
}
}

View File

@@ -1,12 +1,12 @@
#include "../include/myGL.h"
#include "../include/mygl.h"
void FreeGLTexture(unsigned int& texture)
void FreeGLTexture(GLuint& texture)
{
glDeleteTextures(1, &texture);
}
bool LoadGLTexture(string fn, unsigned int& texture, int mag, int min)
bool LoadGLTexture(string fn, GLuint& texture, GLuint mag, GLuint min)
{
if(Right(tolower(fn), 4) == ".bmp")
{

View File

@@ -3,7 +3,7 @@
// Module: myglFont.cpp
// Author: Tom Hicks
// Creation: 09-01-2003
// LastEdit: 09-01-2003
// LastEdit: 06-19-2005
// Editors: None
//
// Purpose:

View File

@@ -18,7 +18,7 @@ string GL_MY_TEXTURE::Filename()
return filename;
}
uint32 GL_MY_TEXTURE::ID()
GLuint GL_MY_TEXTURE::ID()
{
return id;
}
@@ -45,7 +45,7 @@ bool GL_MY_TEXTURE::Load(string fn)
}
}
bool GL_MY_TEXTURE::Load(string fn, uint32 min, uint32 mag)
bool GL_MY_TEXTURE::Load(string fn, GLuint min, GLuint mag)
{
if(Loaded())
Free();

View File

@@ -2,4 +2,4 @@
WORLD_PHYSICS::WORLD_PHYSICS()
{
}
}

View File

@@ -18,31 +18,31 @@ int Integer(std::string str)
switch(str[x])
{
case '1':
number += (int)pow(10, last-x);
number += (int)pow(10.0, last-x);
break;
case '2':
number += 2 * (int)pow(10, last-x);
number += 2 * (int)pow(10.0, last-x);
break;
case '3':
number += 3 * (int)pow(10, last-x);
number += 3 * (int)pow(10.0, last-x);
break;
case '4':
number += 4 * (int)pow(10, last-x);
number += 4 * (int)pow(10.0, last-x);
break;
case '5':
number += 5 * (int)pow(10, last-x);
number += 5 * (int)pow(10.0, last-x);
break;
case '6':
number += 6 * (int)pow(10, last-x);
number += 6 * (int)pow(10.0, last-x);
break;
case '7':
number += 7 * (int)pow(10, last-x);
number += 7 * (int)pow(10.0, last-x);
break;
case '8':
number += 8 * (int)pow(10, last-x);
number += 8 * (int)pow(10.0, last-x);
break;
case '9':
number += 9 * (int)pow(10, last-x);
number += 9 * (int)pow(10.0, last-x);
}
}
return number;
@@ -61,36 +61,36 @@ float Floating(std::string str)
switch(str[x])
{
case '1':
number += (float)pow(10, last-x);
number += (float)pow(10.0, last-x);
break;
case '2':
number += 2 * (float)pow(10, last-x);
number += 2 * (float)pow(10.0, last-x);
break;
case '3':
number += 3 * (float)pow(10, last-x);
number += 3 * (float)pow(10.0, last-x);
break;
case '4':
number += 4 * (float)pow(10, last-x);
number += 4 * (float)pow(10.0, last-x);
break;
case '5':
number += 5 * (float)pow(10, last-x);
number += 5 * (float)pow(10.0, last-x);
break;
case '6':
number += 6 * (float)pow(10, last-x);
number += 6 * (float)pow(10.0, last-x);
break;
case '7':
number += 7 * (float)pow(10, last-x);
number += 7 * (float)pow(10.0, last-x);
break;
case '8':
number += 8 * (float)pow(10, last-x);
number += 8 * (float)pow(10.0, last-x);
break;
case '9':
number += 9 * (float)pow(10, last-x);
number += 9 * (float)pow(10.0, last-x);
break;
case '.':
if (!period)
{
number *= (float)pow(10, -(last-x));
number *= (float)pow(10.0, -(last-x));
last -= (x+1);
period = true;
}
@@ -110,111 +110,111 @@ string KeyString(uint8 key)
{
switch (key)
{
case VK_LBUTTON:
case KEY_LBUTTON:
return "mouse1";
case VK_RBUTTON:
case KEY_RBUTTON:
return "mouse2";
case VK_MBUTTON:
case KEY_MBUTTON:
return "mouse3";
case VK_TAB:
case KEY_TAB:
return "tab";
case VK_RETURN:
case KEY_RETURN:
return "enter";
case VK_SHIFT:
case KEY_SHIFT:
return "shift";
case VK_CONTROL:
case KEY_CONTROL:
return "control";
case VK_PAUSE:
case KEY_PAUSE:
return "pause";
case VK_CAPITAL:
case KEY_CAPITAL:
return "capslock";
case VK_ESCAPE:
case KEY_ESCAPE:
return "esc";
case VK_SPACE:
case KEY_SPACE:
return "space";
case VK_PRIOR:
case KEY_PRIOR:
return "pageup";
case VK_NEXT:
case KEY_NEXT:
return "pagedown";
case VK_END:
case KEY_END:
return "end";
case VK_HOME:
case KEY_HOME:
return "home";
case VK_LEFT:
case KEY_LEFT:
return "left";
case VK_UP:
case KEY_UP:
return "up";
case VK_RIGHT:
case KEY_RIGHT:
return "right";
case VK_DOWN:
case KEY_DOWN:
return "down";
case VK_INSERT:
case KEY_INSERT:
return "insert";
case VK_DELETE:
case KEY_DELETE:
return "delete";
case VK_LWIN:
case KEY_LWIN:
return "lwin";
case VK_RWIN:
case KEY_RWIN:
return "rwin";
case VK_APPS:
case KEY_APPS:
return "apps";
case VK_NUMPAD0:
case KEY_NUMPAD0:
return "numpad0";
case VK_NUMPAD1:
case KEY_NUMPAD1:
return "numpad1";
case VK_NUMPAD2:
case KEY_NUMPAD2:
return "numpad2";
case VK_NUMPAD3:
case KEY_NUMPAD3:
return "numpad3";
case VK_NUMPAD4:
case KEY_NUMPAD4:
return "numpad4";
case VK_NUMPAD5:
case KEY_NUMPAD5:
return "numpad5";
case VK_NUMPAD6:
case KEY_NUMPAD6:
return "numpad6";
case VK_NUMPAD7:
case KEY_NUMPAD7:
return "numpad7";
case VK_NUMPAD8:
case KEY_NUMPAD8:
return "numpad8";
case VK_NUMPAD9:
case KEY_NUMPAD9:
return "numpad9";
case VK_MULTIPLY:
case KEY_MULTIPLY:
return "numpad*";
case VK_ADD:
case KEY_ADD:
return "numpad+";
case VK_SUBTRACT:
case KEY_SUBTRACT:
return "numpad-";
case VK_DIVIDE:
case KEY_DIVIDE:
return "numpad/";
case VK_F1:
case KEY_F1:
return "f1";
case VK_F2:
case KEY_F2:
return "f2";
case VK_F3:
case KEY_F3:
return "f3";
case VK_F4:
case KEY_F4:
return "f4";
case VK_F5:
case KEY_F5:
return "f5";
case VK_F6:
case KEY_F6:
return "f6";
case VK_F7:
case KEY_F7:
return "f7";
case VK_F8:
case KEY_F8:
return "f8";
case VK_F9:
case KEY_F9:
return "f9";
case VK_F10:
case KEY_F10:
return "f10";
case VK_F11:
case KEY_F11:
return "f11";
case VK_F12:
case KEY_F12:
return "f2";
case VK_NUMLOCK:
case KEY_NUMLOCK:
return "numlock";
case VK_SCROLL:
case KEY_SCROLL:
return "scroll";
case VK_SEPARATOR:
case KEY_SEPARATOR:
return "separator";
default:
return "null";
@@ -225,147 +225,147 @@ uint8 KeyName(std::string str)
if (str.length() > 1)
{
if (str.substr(0,2) == "up")
return VK_UP;
return KEY_UP;
else if (str.substr(0,4) == "down")
return VK_DOWN;
return KEY_DOWN;
else if (str.substr(0,3) == "esc")
return VK_ESCAPE;
return KEY_ESCAPE;
else if (str.substr(0,6) == "pageup")
return VK_PRIOR;
return KEY_PRIOR;
else if (str.substr(0,8) == "pagedown")
return VK_NEXT;
return KEY_NEXT;
else if (str.substr(0,5) == "right")
return VK_RIGHT;
return KEY_RIGHT;
else if (str.substr(0,4) == "left")
return VK_LEFT;
return KEY_LEFT;
else if (str.substr(0,5) == "space")
return VK_SPACE;
return KEY_SPACE;
else if (str.substr(0,6) == "mouse1")
return VK_LBUTTON;
return KEY_LBUTTON;
else if (str.substr(0,6) == "mouse2")
return VK_RBUTTON;
return KEY_RBUTTON;
else if (str.substr(0,6) == "mouse3")
return VK_MBUTTON;
return KEY_MBUTTON;
else if (str.substr(0,4) == "home")
return VK_HOME;
return KEY_HOME;
else if (str.substr(0,3) == "end")
return VK_END;
return KEY_END;
else if (str.substr(0,3) == "tab")
return VK_TAB;
return KEY_TAB;
else if (str.substr(0,5) == "enter")
return VK_RETURN;
return KEY_RETURN;
else if (str.substr(0,6) == "insert")
return VK_INSERT;
return KEY_INSERT;
else if (str.substr(0,6) == "delete")
return VK_DELETE;
return KEY_DELETE;
else if (str.substr(0,7) == "control")
return VK_CONTROL;
return KEY_CONTROL;
else if (str.substr(0,5) == "shift")
return VK_SHIFT;
return KEY_SHIFT;
else if (str.substr(0,7) == "numpad0")
return VK_NUMPAD0;
return KEY_NUMPAD0;
else if (str.substr(0,7) == "numpad1")
return VK_NUMPAD1;
return KEY_NUMPAD1;
else if (str.substr(0,7) == "numpad2")
return VK_NUMPAD2;
return KEY_NUMPAD2;
else if (str.substr(0,7) == "numpad3")
return VK_NUMPAD3;
return KEY_NUMPAD3;
else if (str.substr(0,7) == "numpad4")
return VK_NUMPAD4;
return KEY_NUMPAD4;
else if (str.substr(0,7) == "numpad5")
return VK_NUMPAD5;
return KEY_NUMPAD5;
else if (str.substr(0,7) == "numpad6")
return VK_NUMPAD6;
return KEY_NUMPAD6;
else if (str.substr(0,7) == "numpad7")
return VK_NUMPAD7;
return KEY_NUMPAD7;
else if (str.substr(0,7) == "numpad8")
return VK_NUMPAD8;
return KEY_NUMPAD8;
else if (str.substr(0,7) == "numpad9")
return VK_NUMPAD9;
return KEY_NUMPAD9;
else if (str.substr(0,9) == "separator")
return VK_SEPARATOR;
return KEY_SEPARATOR;
else if (str.substr(0,4) == "lwin")
return VK_LWIN;
return KEY_LWIN;
else if (str.substr(0,4) == "rwin")
return VK_RWIN;
return KEY_RWIN;
else if (str.substr(0,4) == "apps")
return VK_APPS;
return KEY_APPS;
else if (str.substr(0,7) == "numpad*")
return VK_MULTIPLY;
return KEY_MULTIPLY;
else if (str.substr(0,7) == "numpad+")
return VK_ADD;
return KEY_ADD;
else if (str.substr(0,7) == "numpad/")
return VK_DIVIDE;
return KEY_DIVIDE;
else if (str.substr(0,7) == "numpad-")
return VK_SUBTRACT;
return KEY_SUBTRACT;
else if (str.substr(0,6) == "scroll")
return VK_SCROLL;
return KEY_SCROLL;
else if (str.substr(0,7) == "numlock")
return VK_NUMLOCK;
return KEY_NUMLOCK;
else if (str.substr(0,5) == "pause")
return VK_PAUSE;
return KEY_PAUSE;
else if (str.substr(0,8) == "capslock")
return VK_CAPITAL;
return KEY_CAPITAL;
/*uncomment this to enable f1 as a mappable key
else if(str.substr(0,2) == "f1")
return VK_F1;
return KEY_F1;
*/
else if (str.substr(0,2) == "f2")
return VK_F2;
return KEY_F2;
else if (str.substr(0,2) == "f3")
return VK_F3;
return KEY_F3;
else if (str.substr(0,2) == "f4")
return VK_F4;
return KEY_F4;
else if (str.substr(0,2) == "f5")
return VK_F5;
return KEY_F5;
else if (str.substr(0,2) == "f6")
return VK_F6;
return KEY_F6;
else if (str.substr(0,2) == "f7")
return VK_F7;
return KEY_F7;
else if (str.substr(0,2) == "f8")
return VK_F8;
return KEY_F8;
else if (str.substr(0,2) == "f9")
return VK_F9;
return KEY_F9;
else if (str.substr(0,2) == "f10")
return VK_F10;
return KEY_F10;
else if (str.substr(0,2) == "f11")
return VK_F11;
return KEY_F11;
else if (str.substr(0,2) == "f12")
return VK_F12;
return KEY_F12;
//Add Game specific keys here and e-mail headhunter45@hotmail.com subject OpenArena keys so I can add them please
else if (str.substr(0,4) == "null")
return NULL;
return (uint8)NULL;
else
return NULL;
return (uint8)NULL;
}
else
{
if(str[0] == '~' || str[0] == '`')
return VK_OEM_3;
return KEY_OEM_3;
else if (str[0] == '?' || str[0] == '/')
return VK_OEM_2;
return KEY_OEM_2;
else if (str[0] == '.' || str[0] == '>')
return VK_OEM_PERIOD;
return KEY_OEM_PERIOD;
else if (str[0] == '+' || str[0] == '=')
return VK_OEM_PLUS;
return KEY_OEM_PLUS;
else if (str[0] == ';' || str[0] == ':')
return VK_OEM_1;
return KEY_OEM_1;
else if (str[0] == ',' || str[0] == '<')
return VK_OEM_COMMA;
return KEY_OEM_COMMA;
else if (str[0] == '-' || str[0] == '_')
return VK_OEM_MINUS;
return KEY_OEM_MINUS;
else if (str[0] == '[' || str[0] == '{')
return VK_OEM_4;
return KEY_OEM_4;
else if (str[0] == ']' || str[0] == '}')
return VK_OEM_6;
return KEY_OEM_6;
else if (str[0] == '\\' || str[0] == '|')
return VK_OEM_5;
return KEY_OEM_5;
else if (str[0] == '\'' || str[0] == '"')
return VK_OEM_7;
return KEY_OEM_7;
else
return toupper(str[0]);
}
@@ -438,4 +438,4 @@ string word(string str, uint32 wordNum)
{
return "";
}
}
}

View File

@@ -12,13 +12,19 @@ TextureImage* LoadTGA(const char * filename)
{
errmsg = "Could not open texture file ";
errmsg = errmsg + filename;
//This needs to be abstracted somehow
#ifdef WIN32
MessageBox(NULL, errmsg.c_str(), "ERROR", MB_OK);
#endif
return NULL;
}
if(fread(&tgaheader, sizeof(TGAHeader), 1, file) == 0)
{
//This needs to be abstracted somehow
#ifdef WIN32
MessageBox(NULL, "Could not read file header", "ERROR", MB_OK);
#endif
if(file != NULL)
fclose(file);
return NULL;
@@ -30,7 +36,10 @@ TextureImage* LoadTGA(const char * filename)
image = LoadCompressedTGA(file);
else
{
//This needs to be abstracted somehow
#ifdef WIN32
MessageBox(NULL, "TGA file must be type 2 or type 10 ", "Invalid Image", MB_OK);
#endif
fclose(file);
return NULL;
}
@@ -44,7 +53,10 @@ TextureImage* LoadUncompressedTGA(FILE * fTGA)
if(fread(tga.header, sizeof(tga.header), 1, fTGA) == 0)
{
//This needs to be abstracted somehow
#ifdef WIN32
MessageBox(NULL, "Could not read info header", "ERROR", MB_OK);
#endif
if(fTGA != NULL)
{
fclose(fTGA);
@@ -61,7 +73,10 @@ TextureImage* LoadUncompressedTGA(FILE * fTGA)
if((image->sizeX <= 0) || (image->sizeY <= 0) || ((image->bpp != 24) && (image->bpp !=32)))
{
//This needs to be abstracted somehow
#ifdef WIN32
MessageBox(NULL, "Invalid texture information", "ERROR", MB_OK);
#endif
if(fTGA != NULL)
{
fclose(fTGA);
@@ -84,14 +99,20 @@ TextureImage* LoadUncompressedTGA(FILE * fTGA)
if(image->data == NULL)
{
//This needs to be abstracted somehow
#ifdef WIN32
MessageBox(NULL, "Could not allocate memory for image", "ERROR", MB_OK);
#endif
fclose(fTGA);
return NULL;
}
if(fread(image->data, 1, tga.imageSize, fTGA) != tga.imageSize)
{
//This needs to be abstracted somehow
#ifdef WIN32
MessageBox(NULL, "Could not read image data", "ERROR", MB_OK);
#endif
if(image->data != NULL)
{
free(image->data);
@@ -118,7 +139,10 @@ TextureImage* LoadCompressedTGA(FILE * fTGA)
if(fread(tga.header, sizeof(tga.header), 1, fTGA) == 0)
{
//This needs to be abstracted somehow
#ifdef WIN32
MessageBox(NULL, "Could not read info header", "ERROR", MB_OK);
#endif
if(fTGA != NULL)
{
fclose(fTGA);
@@ -135,7 +159,10 @@ TextureImage* LoadCompressedTGA(FILE * fTGA)
if((image->sizeX <= 0) || (image->sizeY <= 0) || ((image->bpp != 24) && (image->bpp !=32)))
{
//This needs to be abstracted somehow
#ifdef WIN32
MessageBox(NULL, "Invalid texture information", "ERROR", MB_OK);
#endif
if(fTGA != NULL)
{
fclose(fTGA);
@@ -149,7 +176,10 @@ TextureImage* LoadCompressedTGA(FILE * fTGA)
if(image->data == NULL)
{
//This needs to be abstracted somehow
#ifdef WIN32
MessageBox(NULL, "Could not allocate memory for image", "ERROR", MB_OK);
#endif
fclose(fTGA);
return NULL;
}
@@ -165,7 +195,10 @@ TextureImage* LoadCompressedTGA(FILE * fTGA)
if(fread(&chunkheader, sizeof(GLubyte), 1, fTGA) == 0)
{
//This needs to be abstracted somehow
#ifdef WIN32
MessageBox(NULL, "Could not read RLE header", "ERROR", MB_OK);
#endif
if(fTGA != NULL)
{
fclose(fTGA);
@@ -184,7 +217,10 @@ TextureImage* LoadCompressedTGA(FILE * fTGA)
{
if(fread(colorbuffer, 1, tga.bytesPerPixel, fTGA) != tga.bytesPerPixel)
{
//This needs to be abstracted somehow
#ifdef WIN32
MessageBox(NULL, "Could not read image data", "ERROR", MB_OK);
#endif
if(fTGA != NULL)
{
@@ -218,8 +254,11 @@ TextureImage* LoadCompressedTGA(FILE * fTGA)
if(currentpixel > pixelcount)
{
//This needs to be abstracted somehow
#ifdef WIN32
MessageBox(NULL, "Too many pixels read", "ERROR", NULL);
#endif
if(fTGA != NULL)
{
fclose(fTGA);
@@ -244,8 +283,11 @@ TextureImage* LoadCompressedTGA(FILE * fTGA)
chunkheader -= 127;
if(fread(colorbuffer, 1, tga.bytesPerPixel, fTGA) != tga.bytesPerPixel)
{
//This needs to be abstracted somehow
#ifdef WIN32
MessageBox(NULL, "Could not read from file", "ERROR", MB_OK);
#endif
if(fTGA != NULL)
{
fclose(fTGA);
@@ -280,8 +322,11 @@ TextureImage* LoadCompressedTGA(FILE * fTGA)
if(currentpixel > pixelcount)
{
//This needs to be abstracted somehow
#ifdef WIN32
MessageBox(NULL, "Too many pixels read", "ERROR", NULL);
#endif
if(fTGA != NULL)
{
fclose(fTGA);
@@ -616,4 +661,4 @@ TextureImage* LoadCompressedTGA(FILE * fTGA)
fclose(fTGA);
return image;
}
*/
*/

View File

@@ -160,4 +160,4 @@ Vec2f::Vec2f(double X, double Y)
{
x=(float)X;
y=(float)Y;
}
}