--- deliantra/Deliantra-Client/Client.xs 2006/04/23 21:47:30 1.61 +++ deliantra/Deliantra-Client/Client.xs 2006/04/25 11:18:48 1.67 @@ -42,7 +42,22 @@ #define MAP_EXTEND_X 32 #define MAP_EXTEND_Y 512 -#define MIN_FONT_HEIGHT 8 +#define MIN_FONT_HEIGHT 10 + +#define GL_CALL(type,func,args) \ + { \ + static int init_; \ + static type fptr_; \ + \ + if (!init_) \ + { \ + init_ = 1; \ + fptr_ = (type)SDL_GL_GetProcAddress (# func); \ + } \ + \ + if (fptr_) \ + fptr_ args; \ + } typedef Mix_Chunk *CFClient__MixChunk; typedef Mix_Music *CFClient__MixMusic; @@ -393,7 +408,7 @@ SDL_GL_SetAttribute (SDL_GL_RED_SIZE, 5); SDL_GL_SetAttribute (SDL_GL_GREEN_SIZE, 5); SDL_GL_SetAttribute (SDL_GL_BLUE_SIZE, 5); - SDL_GL_SetAttribute (SDL_GL_ALPHA_SIZE, 1); + SDL_GL_SetAttribute (SDL_GL_ALPHA_SIZE, 0); SDL_GL_SetAttribute (SDL_GL_ACCUM_RED_SIZE, 0); SDL_GL_SetAttribute (SDL_GL_ACCUM_GREEN_SIZE, 0); @@ -606,6 +621,15 @@ } void +error (char *message) + CODE: +#ifdef _WIN32 + MessageBox (0, message, "Crossfire+ Error", MB_OK | MB_ICONERROR | MB_SETFOREGROUND); +#else + fprintf (stderr, "ERROR: %s\n", message); +#endif + +void fatal (char *message) CODE: #ifdef _WIN32 @@ -1328,12 +1352,15 @@ const_iv (GL_FLAT), const_iv (GL_BLEND), const_iv (GL_AND), + const_iv (GL_ONE), + const_iv (GL_ZERO), const_iv (GL_SRC_ALPHA), + const_iv (GL_SRC_ALPHA_SATURATE), const_iv (GL_ONE_MINUS_SRC_ALPHA), + const_iv (GL_ONE_MINUS_DST_ALPHA), const_iv (GL_RGB), const_iv (GL_RGBA), const_iv (GL_UNSIGNED_BYTE), - const_iv (GL_ALPHA4), const_iv (GL_ALPHA), const_iv (GL_FLOAT), const_iv (GL_UNSIGNED_INT_8_8_8_8_REV), @@ -1355,7 +1382,6 @@ const_iv (GL_NEAREST_MIPMAP_LINEAR), const_iv (GL_LINEAR_MIPMAP_LINEAR), const_iv (GL_GENERATE_MIPMAP), - const_iv (GL_LINEAR), const_iv (GL_MODULATE), const_iv (GL_REPLACE), const_iv (GL_COLOR_BUFFER_BIT), @@ -1404,7 +1430,8 @@ void glLoadIdentity () -void glOrtho (double left, double right, double bottom, double top, double near, double far) +# near and far are due to microsofts buggy c compiler +void glOrtho (double left, double right, double bottom, double top, double near_, double far_) void glViewport (int x, int y, int width, int height) @@ -1412,7 +1439,7 @@ CODE: glTranslatef (x, y, z); -void glScale (float x, float y, float z) +void glScale (float x, float y, float z = 1.) CODE: glScalef (x, y, z); @@ -1449,9 +1476,12 @@ void glConvolutionParameter (int target, int pname, float params) CODE: - glConvolutionParameterf (target, pname, params); + GL_CALL (PFNGLCONVOLUTIONPARAMETERFEXTPROC, glConvolutionParameterf, (target, pname, params)); void glConvolutionFilter2D (int target, int internalformat, int width, int height, int format, int type, char *data) + CODE: + GL_CALL (PFNGLCONVOLUTIONFILTER2DEXTPROC, glConvolutionFilter2D, + (target, internalformat, width, height, format, type, data)); void glTexImage2D (int target, int level, int internalformat, int width, int height, int border, int format, int type, char *data)