extern int netdatanew;
extern float mapinfo;
extern bool stillloading;
-extern TGAImageRec texture;
+extern ImageRec texture;
extern short vRefNum;
extern long dirID;
extern int mainmenu;
float temptexdetail = texdetail;
texdetail = 1;
- // Converting file to something os specific
- char * fixedFN = ConvertFileName(fileName);
-
- //Load Image
- unsigned char fileNamep[256];
- CopyCStringToPascal(fixedFN, fileNamep);
//Load Image
- upload_image( fileNamep , 0);
+ upload_image(ConvertFileName(fileName));
texdetail = temptexdetail;
int bytesPerPixel = texture.bpp / 8;
extern int maptype;
extern int editoractive;
extern int editorpathtype;
-extern TGAImageRec texture;
+extern ImageRec texture;
extern float hostiletime;
{
LOGFUNC;
//Load Image
- unsigned char fileNamep[256];
- CopyCStringToPascal(fileName, fileNamep);
- bool opened;
- opened = upload_image(fileNamep, 1);
+ bool opened = upload_image(fileName);
float alphanum;
//Is it valid?
bool midweird = false;
bool proportionweird = false;
bool vertexweird[6] = {0};
-TGAImageRec texture;
+ImageRec texture;
bool debugmode = false;
};
static AppTime g_appTime;
-
-void CopyCStringToPascal( const char* src, unsigned char dst[256])
-{
- int len = strlen( src);
- dst[ 0] = len;
- memcpy( dst + 1, src, len);
-}
-
-
-void CopyPascalStringToC( const unsigned char* src, char* dst)
-{
- int len = src[ 0];
- memcpy( dst, src + 1, len);
- dst[ len] = 0;
-}
-
-
AbsoluteTime UpTime()
{
__int64 counter;
#include "Random.h"
-
-void CopyCStringToPascal( const char* src, unsigned char dst[256]);
-void CopyPascalStringToC( const unsigned char* src, char* dst);
-
-
typedef struct AbsoluteTime {
unsigned long hi;
unsigned long lo;
using namespace Game;
-static bool load_image(const char * fname, TGAImageRec & tex);
-static bool load_png(const char * fname, TGAImageRec & tex);
-static bool load_jpg(const char * fname, TGAImageRec & tex);
+bool load_image(const char * fname, ImageRec & tex);
+static bool load_png(const char * fname, ImageRec & tex);
+static bool load_jpg(const char * fname, ImageRec & tex);
bool save_image(const char * fname);
static bool save_png(const char * fname);
extern float slomospeed;
extern float slomofreq;
+extern bool visibleloading;
// --------------------------------------------------------------------------
-
-bool LoadImage(const char * fname, TGAImageRec & tex)
+bool load_image(const char *file_name, ImageRec &tex)
{
+ if (visibleloading)
+ Game::LoadingScreen();
+
if ( tex.data == NULL )
return false;
- else
- return load_image(fname, tex);
-}
-static bool load_image(const char *file_name, TGAImageRec &tex)
-{
const char *ptr = strrchr((char *)file_name, '.');
if (ptr) {
if (strcasecmp(ptr + 1, "png") == 0)
return false;
}
-
struct my_error_mgr {
struct jpeg_error_mgr pub; /* "public" fields */
jmp_buf setjmp_buffer; /* for return to caller */
}
/* stolen from public domain example.c code in libjpg distribution. */
-static bool load_jpg(const char *file_name, TGAImageRec &tex)
+static bool load_jpg(const char *file_name, ImageRec &tex)
{
struct jpeg_decompress_struct cinfo;
struct my_error_mgr jerr;
/* stolen from public domain example.c code in libpng distribution. */
-static bool load_png(const char *file_name, TGAImageRec &tex)
+static bool load_png(const char *file_name, ImageRec &tex)
{
bool hasalpha = false;
png_structp png_ptr = NULL;
#include "Game.h"
#include "TGALoader.h"
-extern float texdetail;
-extern TGAImageRec texture;
-extern short vRefNum;
-extern long dirID;
-extern bool visibleloading;
-
-extern bool LoadImage(const char * fname, TGAImageRec & tex);
-/********************> LoadTGA() <*****/
-bool upload_image(const unsigned char* filePath, bool hasalpha)
-{
- if (visibleloading)
- Game::LoadingScreen();
+extern ImageRec texture;
+
+extern bool load_image(const char * fname, ImageRec & tex);
- // for Windows, just use TGA loader for now
- char fileName[256];
- CopyPascalStringToC( filePath, fileName);
- return (LoadImage(fileName, texture));
+bool upload_image(const char* fileName)
+{
+ return load_image(fileName, texture);
}
#include "GL/gl.h"
#else
#include "gamegl.h"
-// #include "MoreFilesX.h"
#endif
-//#include <stdbool.h>
-//#include <QuickTime.h>
-
/**> DATA STRUCTURES <**/
-typedef struct TGAImageRec {
+typedef struct ImageRec {
GLubyte *data; // Image Data (Up To 32 Bits)
GLuint bpp; // Image Color Depth In Bits Per Pixel.
GLuint sizeX;
GLuint sizeY;
-} TGAImageRec;
+} ImageRec;
-bool upload_image(const unsigned char* filePath, bool hasalpha);
+bool upload_image(const char* filePath);
#endif
extern float blurness;
extern float targetblurness;
extern Objects objects;
-extern TGAImageRec texture;
+extern ImageRec texture;
extern bool visibleloading;
extern bool skyboxtexture;
extern int tutoriallevel;
static float patch_size;
float temptexdetail = texdetail;
- //LoadTGA( fileName );
- // Fixing filename so that it works with its own os
- char * FixedFN = ConvertFileName(fileName);
-
- unsigned char fileNamep[256];
- CopyCStringToPascal(FixedFN, fileNamep);
//Load Image
- upload_image( fileNamep , 0);
+ upload_image(ConvertFileName(fileName));
//Is it valid?
if (texture.bpp > 24) {
/**> HEADER FILES <**/
#include "Text.h"
#include "Game.h"
-extern TGAImageRec texture;
void Text::LoadFontTexture(const char *fileName)
{
using namespace std;
-extern TGAImageRec texture;
+extern ImageRec texture;
extern bool trilinear;
{
//load image into 'texture' global var
if (!skindata) {
- unsigned char filenamep[256];
- CopyCStringToPascal(ConvertFileName(filename.c_str()), filenamep);
- upload_image(filenamep, hasAlpha);
+ upload_image(ConvertFileName(filename.c_str()));
}
skinsize = texture.sizeX;
}
-
-
void Texture::load(const string& filename, bool hasMipmap, bool hasAlpha)
{
destroy();
};
static AppTime g_appTime;
-
-
-void CopyCStringToPascal( const char* src, unsigned char dst[256])
-{
- int len = strlen( src);
- dst[0] = len;
- memcpy( dst + 1, src, len);
-}
-
-
-void CopyPascalStringToC( const unsigned char* src, char* dst)
-{
- int len = src[0];
- memcpy( dst, src + 1, len);
- dst[len] = 0;
-}
-
-
AbsoluteTime UpTime()
{
__int64 counter;
#include "Random.h"
-void CopyCStringToPascal( const char* src, unsigned char dst[256]);
-void CopyPascalStringToC( const unsigned char* src, char* dst);
-
-
typedef struct AbsoluteTime {
unsigned long hi;
unsigned long lo;