Coding style:

* Fix indentation
 * Don't repeat function prototypes in their pre-leading comments
 * "Upgrade" some function comments to Doxygen comments
 * Remove whitespace from the end of lines
 * Reintroduce empty lines removed in r5733

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5769 4a71c877-e1ca-e34f-864e-861f7616d084
master
Giel van Schijndel 2008-08-03 21:06:39 +00:00
parent d54e360aa7
commit 83159f335d
6 changed files with 39 additions and 40 deletions

View File

@ -66,6 +66,7 @@
#define WZCOL_MENU_SHADOW psPalette[41] #define WZCOL_MENU_SHADOW psPalette[41]
#define WZCOL_DBLUE psPalette[42] #define WZCOL_DBLUE psPalette[42]
#define WZCOL_LBLUE psPalette[43] #define WZCOL_LBLUE psPalette[43]
#define WZCOL_MAX 44 #define WZCOL_MAX 44
//************************************************************************* //*************************************************************************

View File

@ -95,8 +95,8 @@ void pal_Init(void)
WZCOL_MAP_PREVIEW_AIPLAYER = pal_Colour(0, 0x7f, 0); WZCOL_MAP_PREVIEW_AIPLAYER = pal_Colour(0, 0x7f, 0);
WZCOL_GREY = pal_Colour(0x55, 0x55, 0x55); WZCOL_GREY = pal_Colour(0x55, 0x55, 0x55);
WZCOL_MENU_SHADOW = WZCOL_BLACK; WZCOL_MENU_SHADOW = WZCOL_BLACK;
WZCOL_DBLUE =pal_Colour(0x0f,0x08,0x56); WZCOL_DBLUE = pal_Colour(0x0f,0x08,0x56);
WZCOL_LBLUE =pal_Colour(0x1c,0x9f,0xfb); WZCOL_LBLUE = pal_Colour(0x1c,0x9f,0xfb);
} }
void pal_ShutDown(void) void pal_ShutDown(void)

View File

@ -390,26 +390,24 @@ void screenDumpToDisk(const char* path) {
if (screendump_num != 0) if (screendump_num != 0)
screendump_required = true; screendump_required = true;
} }
// checkGLErrors( char *label)
// /**
// if a openGL error has occured, we query the error code, and see what it was. * Checks if an OpenGL error has occurred.
* \param label Label to print when an OpenGL occurred.
*/
void checkGLErrors(const char *label) void checkGLErrors(const char *label)
{ {
GLenum errCode; const GLenum errCode = glGetError();
const GLubyte *errStr;
if ((errCode = glGetError()) != GL_NO_ERROR) if (errCode == GL_NO_ERROR)
{ return;
errStr = gluErrorString(errCode);
debug(LOG_ERROR,"OpenGL ERROR in %s: ",label); debug(LOG_ERROR, "OpenGL ERROR in %s: %s, (0x%0x)", label, gluErrorString(errCode), errCode);
debug(LOG_ERROR,"%s, %d(0x%0x)",(char*)errStr,errCode,errCode);
}
} }
// Init_FBO( int width, int height )
// FBO create routine
BOOL Init_FBO( int width, int height ) BOOL Init_FBO( int width, int height )
{ {
GLenum status; GLenum status;
// check to make sure user has FBO available, and we didn't create a FBO before. // check to make sure user has FBO available, and we didn't create a FBO before.
if(GLEE_EXT_framebuffer_object && !FBOinit) if(GLEE_EXT_framebuffer_object && !FBOinit)
{ {
@ -433,7 +431,7 @@ GLenum status;
// attach that texture to the color // attach that texture to the color
glFramebufferTexture2DEXT (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, glFramebufferTexture2DEXT (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
GL_TEXTURE_2D, FBOtexture, 0); GL_TEXTURE_2D, FBOtexture, 0);
glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0); // unbind FBO glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0); // unbind FBO
// make sure everything went OK // make sure everything went OK
@ -488,7 +486,7 @@ GLenum status;
return true; return true;
} }
// Delete_FBO()
void Delete_FBO(void) void Delete_FBO(void)
{ {
if(FBOinit) if(FBOinit)

View File

@ -59,6 +59,7 @@ extern void screenToggleMode(void);
extern int wz_texture_compression; extern int wz_texture_compression;
extern void screenDoDumpToDiskIfRequired(void); extern void screenDoDumpToDiskIfRequired(void);
extern BOOL Init_FBO( int width, int height ); extern BOOL Init_FBO( int width, int height );
extern void Delete_FBO(void); extern void Delete_FBO(void);
extern void checkGLErrors(const char *label); // reports what the openGL error was extern void checkGLErrors(const char *label); // reports what the openGL error was

View File

@ -11816,20 +11816,17 @@ static BOOL getNameFromComp(UDWORD compType, char *pDest, UDWORD compIndex)
} }
// ----------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------
// END // END
//======================================================
//BOOL plotStructurePreview16( /**
// char *backDropSprite, // the premade map texture * \param[out] backDropSprite The premade map texture.
// UBYTE scale, // scale of the map texture * \param scale Scale of the map texture.
// UDWORD offX, // X offset for map * \param offX,offY X and Y offset for map
// UDWORD offY, // Y offset for map * \param[out] playeridpos Will contain the position on the map where the player's HQ are located.
// Vector2i playeridpos[]) // holds the position on map that player's HQ is located *
// * Reads the current map and colours the map preview for any structures
// adds clancolors for the map preview texture. * present. Additionally we load the player's HQ location into playeridpos so
// What basically happens in this routine is we read the map, and then for * we know the player's starting location.
// every structure on said map, we either color it via clan colors (which */
// are the same as the radar colors), and it plots its pixel on the bitmap.
// Also added position number of starting location (which is determined by
// the map maker(!)) This info is needed so we can blit players location.
BOOL plotStructurePreview16(char *backDropSprite, UBYTE scale, UDWORD offX, UDWORD offY,Vector2i playeridpos[]) BOOL plotStructurePreview16(char *backDropSprite, UBYTE scale, UDWORD offX, UDWORD offY,Vector2i playeridpos[])
{ {
SAVE_STRUCTURE sSave; // close eyes now. SAVE_STRUCTURE sSave; // close eyes now.
@ -11937,6 +11934,7 @@ BOOL plotStructurePreview16(char *backDropSprite, UBYTE scale, UDWORD offX, UDWO
endian_udword(&psSaveStructure2->player); endian_udword(&psSaveStructure2->player);
endian_udword(&psSaveStructure2->burnStart); endian_udword(&psSaveStructure2->burnStart);
endian_udword(&psSaveStructure2->burnDamage); endian_udword(&psSaveStructure2->burnDamage);
// we are specifically looking for the HQ, and it seems this is the only way to // we are specifically looking for the HQ, and it seems this is the only way to
// find it via parsing map. // find it via parsing map.
// We store the coordinates of the structure, into a array for as many players as are on the map. // We store the coordinates of the structure, into a array for as many players as are on the map.
@ -12252,6 +12250,7 @@ BOOL plotStructurePreview16(char *backDropSprite, UBYTE scale, UDWORD offX, UDWO
{ // Use a dark green color for the AI { // Use a dark green color for the AI
color = WZCOL_MAP_PREVIEW_AIPLAYER ; color = WZCOL_MAP_PREVIEW_AIPLAYER ;
} }
if(HQ) if(HQ)
{ // This shows where the HQ is on the map in a special color. { // This shows where the HQ is on the map in a special color.
// We could do the same for anything else (oil/whatever) also. // We could do the same for anything else (oil/whatever) also.
@ -12270,10 +12269,9 @@ BOOL plotStructurePreview16(char *backDropSprite, UBYTE scale, UDWORD offX, UDWO
backDropSprite[3 * (((offY + y) * BACKDROP_HACK_WIDTH) + x + offX) + 1] = color.byte.g; backDropSprite[3 * (((offY + y) * BACKDROP_HACK_WIDTH) + x + offX) + 1] = color.byte.g;
backDropSprite[3 * (((offY + y) * BACKDROP_HACK_WIDTH) + x + offX) + 2] = color.byte.b; backDropSprite[3 * (((offY + y) * BACKDROP_HACK_WIDTH) + x + offX) + 2] = color.byte.b;
} }
} }
} }
// NOTE: would do fallback if FBO is not available here. // NOTE: would do fallback if FBO is not available here.
return true; return true;
} }

View File

@ -187,13 +187,13 @@ void loadMapPreview(void)
UDWORD fileSize; UDWORD fileSize;
char *pFileData = NULL; char *pFileData = NULL;
LEVEL_DATASET *psLevel = NULL; LEVEL_DATASET *psLevel = NULL;
UDWORD i, j, x, y, height, offX2, offY2; UDWORD i, j, x, y, height, offX2, offY2;
UBYTE scale,col; UBYTE scale,col;
MAPTILE *psTile,*WTile; MAPTILE *psTile,*WTile;
UDWORD oursize; UDWORD oursize;
Vector2i playerpos[MAX_PLAYERS]; // Will hold player positions Vector2i playerpos[MAX_PLAYERS]; // Will hold player positions
char *ptr = NULL, *imageData = NULL, *fboData = NULL; char *ptr = NULL, *imageData = NULL, *fboData = NULL;
//=============================
if(psMapTiles) if(psMapTiles)
{ {
@ -386,6 +386,7 @@ void loadMapPreview(void)
free(fboData); free(fboData);
free(imageData); free(imageData);
hideTime = gameTime; hideTime = gameTime;
mapShutdown(); mapShutdown();
Delete_FBO(); Delete_FBO();