2007-01-15 12:09:25 -08:00
|
|
|
/*
|
|
|
|
This file is part of Warzone 2100.
|
|
|
|
Copyright (C) 1999-2004 Eidos Interactive
|
|
|
|
Copyright (C) 2005-2007 Warzone Resurrection Project
|
|
|
|
|
|
|
|
Warzone 2100 is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
Warzone 2100 is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with Warzone 2100; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
2007-06-28 10:47:08 -07:00
|
|
|
/***************************************************************************/
|
|
|
|
/*
|
|
|
|
* pieBlitFunc.c
|
|
|
|
*
|
|
|
|
* patch for exisitng ivis rectangle draw functions.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
/***************************************************************************/
|
|
|
|
|
2007-04-11 07:21:45 -07:00
|
|
|
#include "lib/framework/frame.h"
|
|
|
|
|
2007-06-28 10:47:08 -07:00
|
|
|
#include <time.h>
|
2006-08-12 03:45:49 -07:00
|
|
|
#include <SDL/SDL_opengl.h>
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2006-06-02 12:34:58 -07:00
|
|
|
#include "lib/ivis_common/pieblitfunc.h"
|
|
|
|
#include "lib/ivis_common/piedef.h"
|
|
|
|
#include "lib/ivis_common/piemode.h"
|
|
|
|
#include "lib/ivis_common/piestate.h"
|
|
|
|
#include "lib/ivis_common/rendmode.h"
|
|
|
|
#include "lib/ivis_common/pieclip.h"
|
|
|
|
#include "lib/ivis_common/piefunc.h"
|
2007-06-28 10:47:08 -07:00
|
|
|
#include "piematrix.h"
|
|
|
|
#include "screen.h"
|
|
|
|
|
|
|
|
#define COLOURINTENSITY 0xffffffff
|
|
|
|
/***************************************************************************/
|
|
|
|
/*
|
|
|
|
* Local Variables
|
|
|
|
*/
|
|
|
|
/***************************************************************************/
|
|
|
|
|
2007-11-19 13:32:35 -08:00
|
|
|
#define RADARX 128
|
|
|
|
#define RADARY 128
|
|
|
|
|
2007-11-03 15:48:46 -07:00
|
|
|
static PIESTYLE rendStyle;
|
|
|
|
static UDWORD radarTexture;
|
2007-11-19 13:32:35 -08:00
|
|
|
static unsigned char radarBitmap[RADARX * RADARY * 4];
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
/***************************************************************************/
|
|
|
|
/*
|
|
|
|
* Source
|
|
|
|
*/
|
|
|
|
/***************************************************************************/
|
2007-03-16 09:20:16 -07:00
|
|
|
void pie_Line(int x0, int y0, int x1, int y1, Uint32 colour)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
pie_SetRendMode(REND_FLAT);
|
|
|
|
pie_SetColour(colour);
|
|
|
|
pie_SetTexturePage(-1);
|
|
|
|
pie_SetColourKeyedBlack(FALSE);
|
|
|
|
|
|
|
|
glBegin(GL_LINE_STRIP);
|
|
|
|
glVertex2f(x0, y0);
|
|
|
|
glVertex2f(x1, y1);
|
|
|
|
glEnd();
|
|
|
|
}
|
|
|
|
/***************************************************************************/
|
|
|
|
|
2007-03-16 09:20:16 -07:00
|
|
|
void pie_Box(int x0,int y0, int x1, int y1, Uint32 colour)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
pie_SetRendMode(REND_FLAT);
|
|
|
|
pie_SetColour(colour);
|
|
|
|
pie_SetTexturePage(-1);
|
|
|
|
pie_SetColourKeyedBlack(FALSE);
|
|
|
|
|
|
|
|
if (x0>psRendSurface->clip.right || x1<psRendSurface->clip.left ||
|
|
|
|
y0>psRendSurface->clip.bottom || y1<psRendSurface->clip.top)
|
2007-11-03 15:48:46 -07:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
if (x0<psRendSurface->clip.left)
|
|
|
|
x0 = psRendSurface->clip.left;
|
|
|
|
if (x1>psRendSurface->clip.right)
|
|
|
|
x1 = psRendSurface->clip.right;
|
|
|
|
if (y0<psRendSurface->clip.top)
|
|
|
|
y0 = psRendSurface->clip.top;
|
|
|
|
if (y1>psRendSurface->clip.bottom)
|
|
|
|
y1 = psRendSurface->clip.bottom;
|
|
|
|
|
|
|
|
glBegin(GL_LINE_STRIP);
|
|
|
|
glVertex2f(x0, y0);
|
|
|
|
glVertex2f(x1, y0);
|
|
|
|
glVertex2f(x1, y1);
|
|
|
|
glVertex2f(x0, y1);
|
|
|
|
glVertex2f(x0, y0);
|
|
|
|
glEnd();
|
|
|
|
}
|
|
|
|
|
|
|
|
/***************************************************************************/
|
|
|
|
|
|
|
|
void pie_BoxFillIndex(int x0,int y0, int x1, int y1, UBYTE colour)
|
|
|
|
{
|
|
|
|
PIELIGHT light;
|
|
|
|
iColour* psPalette;
|
|
|
|
|
|
|
|
pie_SetRendMode(REND_FLAT);
|
|
|
|
pie_SetTexturePage(-1);
|
|
|
|
|
|
|
|
if (x0>psRendSurface->clip.right || x1<psRendSurface->clip.left ||
|
|
|
|
y0>psRendSurface->clip.bottom || y1<psRendSurface->clip.top)
|
2007-11-03 15:48:46 -07:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
if (x0<psRendSurface->clip.left)
|
|
|
|
x0 = psRendSurface->clip.left;
|
|
|
|
if (x1>psRendSurface->clip.right)
|
|
|
|
x1 = psRendSurface->clip.right;
|
|
|
|
if (y0<psRendSurface->clip.top)
|
|
|
|
y0 = psRendSurface->clip.top;
|
|
|
|
if (y1>psRendSurface->clip.bottom)
|
|
|
|
y1 = psRendSurface->clip.bottom;
|
|
|
|
|
|
|
|
psPalette = pie_GetGamePal();
|
|
|
|
light.byte.r = psPalette[colour].r;
|
|
|
|
light.byte.g = psPalette[colour].g;
|
|
|
|
light.byte.b = psPalette[colour].b;
|
|
|
|
light.byte.a = MAX_UB_LIGHT;
|
2007-02-19 09:18:50 -08:00
|
|
|
pie_DrawRect( x0, y0, x1, y1, light.argb );
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
|
2007-03-16 09:20:16 -07:00
|
|
|
void pie_BoxFill(int x0,int y0, int x1, int y1, Uint32 colour)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
pie_SetRendMode(REND_FLAT);
|
|
|
|
pie_SetTexturePage(-1);
|
|
|
|
|
|
|
|
if (x0>psRendSurface->clip.right || x1<psRendSurface->clip.left ||
|
|
|
|
y0>psRendSurface->clip.bottom || y1<psRendSurface->clip.top)
|
2007-11-03 15:48:46 -07:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
if (x0<psRendSurface->clip.left)
|
|
|
|
x0 = psRendSurface->clip.left;
|
|
|
|
if (x1>psRendSurface->clip.right)
|
|
|
|
x1 = psRendSurface->clip.right;
|
|
|
|
if (y0<psRendSurface->clip.top)
|
|
|
|
y0 = psRendSurface->clip.top;
|
|
|
|
if (y1>psRendSurface->clip.bottom)
|
|
|
|
y1 = psRendSurface->clip.bottom;
|
|
|
|
|
2007-02-19 09:18:50 -08:00
|
|
|
pie_DrawRect( x0, y0, x1, y1, colour );
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
}
|
|
|
|
/***************************************************************************/
|
|
|
|
|
|
|
|
void pie_TransBoxFill(SDWORD x0, SDWORD y0, SDWORD x1, SDWORD y1)
|
|
|
|
{
|
|
|
|
UDWORD rgb;
|
|
|
|
UDWORD transparency;
|
2007-11-03 15:48:46 -07:00
|
|
|
|
2007-06-28 10:47:08 -07:00
|
|
|
rgb = (pie_FILLRED<<16) | (pie_FILLGREEN<<8) | pie_FILLBLUE;//blue
|
|
|
|
transparency = pie_FILLTRANS;
|
|
|
|
pie_UniTransBoxFill(x0, y0, x1, y1, rgb, transparency);
|
|
|
|
}
|
|
|
|
|
|
|
|
/***************************************************************************/
|
|
|
|
void pie_UniTransBoxFill(SDWORD x0,SDWORD y0, SDWORD x1, SDWORD y1, UDWORD rgb, UDWORD transparency)
|
|
|
|
{
|
|
|
|
UDWORD light;
|
|
|
|
|
|
|
|
if (x0>psRendSurface->clip.right || x1<psRendSurface->clip.left ||
|
|
|
|
y0>psRendSurface->clip.bottom || y1<psRendSurface->clip.top)
|
2007-11-03 15:48:46 -07:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
if (x0<psRendSurface->clip.left)
|
|
|
|
x0 = psRendSurface->clip.left;
|
|
|
|
if (x1>psRendSurface->clip.right)
|
|
|
|
x1 = psRendSurface->clip.right;
|
|
|
|
if (y0<psRendSurface->clip.top)
|
|
|
|
y0 = psRendSurface->clip.top;
|
|
|
|
if (y1>psRendSurface->clip.bottom)
|
|
|
|
y1 = psRendSurface->clip.bottom;
|
|
|
|
|
|
|
|
if (transparency == 0 ) {
|
|
|
|
transparency = 127;
|
|
|
|
}
|
|
|
|
pie_SetTexturePage(-1);
|
|
|
|
pie_SetRendMode(REND_ALPHA_FLAT);
|
|
|
|
light = (rgb & 0x00ffffff) + (transparency << 24);
|
2007-02-19 09:18:50 -08:00
|
|
|
pie_DrawRect( x0, y0, x1, y1, light );
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/***************************************************************************/
|
|
|
|
|
|
|
|
void pie_DrawImageFileID(IMAGEFILE *ImageFile, UWORD ID, int x, int y)
|
|
|
|
{
|
|
|
|
IMAGEDEF *Image;
|
|
|
|
PIEIMAGE pieImage;
|
|
|
|
PIERECT dest;
|
|
|
|
|
|
|
|
assert(ID < ImageFile->Header.NumImages);
|
|
|
|
Image = &ImageFile->ImageDefs[ID];
|
|
|
|
|
|
|
|
pieImage.texPage = ImageFile->TPageIDs[Image->TPageID];
|
|
|
|
pieImage.tu = Image->Tu;
|
|
|
|
pieImage.tv = Image->Tv;
|
2007-07-30 13:20:06 -07:00
|
|
|
pieImage.tw = Image->Width;
|
|
|
|
pieImage.th = Image->Height;
|
2007-06-18 07:25:06 -07:00
|
|
|
dest.x = x + Image->XOffset;
|
|
|
|
dest.y = y + Image->YOffset;
|
2007-06-28 10:47:08 -07:00
|
|
|
dest.w = Image->Width;
|
|
|
|
dest.h = Image->Height;
|
|
|
|
pie_DrawImage(&pieImage, &dest, &rendStyle);
|
|
|
|
}
|
|
|
|
|
|
|
|
void pie_ImageFileID(IMAGEFILE *ImageFile, UWORD ID, int x, int y)
|
|
|
|
{
|
|
|
|
IMAGEDEF *Image;
|
|
|
|
PIEIMAGE pieImage;
|
|
|
|
PIERECT dest;
|
|
|
|
|
|
|
|
assert(ID < ImageFile->Header.NumImages);
|
|
|
|
Image = &ImageFile->ImageDefs[ID];
|
|
|
|
|
2007-11-03 15:48:46 -07:00
|
|
|
pie_SetBilinear(FALSE);
|
|
|
|
pie_SetRendMode(REND_GOURAUD_TEX);
|
|
|
|
pie_SetColour(COLOURINTENSITY);
|
2007-06-28 10:47:08 -07:00
|
|
|
pie_SetColourKeyedBlack(TRUE);
|
|
|
|
|
|
|
|
pieImage.texPage = ImageFile->TPageIDs[Image->TPageID];
|
|
|
|
pieImage.tu = Image->Tu;
|
|
|
|
pieImage.tv = Image->Tv;
|
2007-07-30 13:20:06 -07:00
|
|
|
pieImage.tw = Image->Width;
|
|
|
|
pieImage.th = Image->Height;
|
2007-06-18 07:25:06 -07:00
|
|
|
dest.x = x + Image->XOffset;
|
|
|
|
dest.y = y + Image->YOffset;
|
2007-06-28 10:47:08 -07:00
|
|
|
dest.w = Image->Width;
|
|
|
|
dest.h = Image->Height;
|
|
|
|
pie_DrawImage(&pieImage, &dest, &rendStyle);
|
|
|
|
}
|
|
|
|
|
2007-06-18 07:25:06 -07:00
|
|
|
void pie_ImageFileIDTile(IMAGEFILE *ImageFile, UWORD ID, int x, int y, int Width, int Height)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
IMAGEDEF *Image;
|
|
|
|
SDWORD hRep, hRemainder, vRep, vRemainder;
|
|
|
|
PIEIMAGE pieImage;
|
|
|
|
PIERECT dest;
|
|
|
|
|
2007-06-18 07:25:06 -07:00
|
|
|
assert(ID < ImageFile->Header.NumImages);
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
Image = &ImageFile->ImageDefs[ID];
|
|
|
|
|
|
|
|
pie_SetBilinear(FALSE);
|
|
|
|
pie_SetRendMode(REND_GOURAUD_TEX);
|
|
|
|
pie_SetColour(COLOURINTENSITY);
|
|
|
|
pie_SetColourKeyedBlack(TRUE);
|
|
|
|
|
|
|
|
pieImage.texPage = ImageFile->TPageIDs[Image->TPageID];
|
|
|
|
pieImage.tu = Image->Tu;
|
|
|
|
pieImage.tv = Image->Tv;
|
2007-07-30 13:20:06 -07:00
|
|
|
pieImage.tw = Image->Width;
|
|
|
|
pieImage.th = Image->Height;
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2007-06-18 07:25:06 -07:00
|
|
|
dest.x = x + Image->XOffset;
|
|
|
|
dest.y = y + Image->YOffset;
|
2007-06-28 10:47:08 -07:00
|
|
|
dest.w = Image->Width;
|
|
|
|
dest.h = Image->Height;
|
|
|
|
|
2007-06-18 07:25:06 -07:00
|
|
|
vRemainder = Height % Image->Height;
|
|
|
|
hRemainder = Width % Image->Width;
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2007-06-18 07:25:06 -07:00
|
|
|
for (vRep = 0; vRep < Height/Image->Height; vRep++)
|
|
|
|
{
|
2007-07-30 13:20:06 -07:00
|
|
|
pieImage.tw = Image->Width;
|
2007-06-18 07:25:06 -07:00
|
|
|
dest.x = x + Image->XOffset;
|
2007-06-28 10:47:08 -07:00
|
|
|
dest.w = Image->Width;
|
2007-06-18 07:25:06 -07:00
|
|
|
|
|
|
|
for (hRep = 0; hRep < Width/Image->Width; hRep++)
|
|
|
|
{
|
2007-06-28 10:47:08 -07:00
|
|
|
pie_DrawImage(&pieImage, &dest, &rendStyle);
|
|
|
|
dest.x += Image->Width;
|
|
|
|
}
|
2007-06-18 07:25:06 -07:00
|
|
|
|
2007-06-28 10:47:08 -07:00
|
|
|
//draw remainder
|
2007-06-18 07:25:06 -07:00
|
|
|
if (hRemainder > 0)
|
|
|
|
{
|
2007-07-30 13:20:06 -07:00
|
|
|
pieImage.tw = hRemainder;
|
2007-06-28 10:47:08 -07:00
|
|
|
dest.w = hRemainder;
|
|
|
|
pie_DrawImage(&pieImage, &dest, &rendStyle);
|
|
|
|
}
|
2007-06-18 07:25:06 -07:00
|
|
|
|
2007-06-28 10:47:08 -07:00
|
|
|
dest.y += Image->Height;
|
|
|
|
}
|
2007-06-18 07:25:06 -07:00
|
|
|
|
2007-06-28 10:47:08 -07:00
|
|
|
//draw remainder
|
2007-06-18 07:25:06 -07:00
|
|
|
if (vRemainder > 0)
|
|
|
|
{
|
|
|
|
//as above
|
2007-07-30 13:20:06 -07:00
|
|
|
pieImage.tw = Image->Width;
|
2007-06-18 07:25:06 -07:00
|
|
|
dest.x = x + Image->XOffset;
|
|
|
|
dest.w = Image->Width;
|
|
|
|
|
2007-07-30 13:20:06 -07:00
|
|
|
pieImage.th = vRemainder;
|
2007-06-28 10:47:08 -07:00
|
|
|
dest.h = vRemainder;
|
2007-06-18 07:25:06 -07:00
|
|
|
|
|
|
|
for (hRep = 0; hRep < Width/Image->Width; hRep++)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
2007-06-18 07:25:06 -07:00
|
|
|
pie_DrawImage(&pieImage, &dest, &rendStyle);
|
|
|
|
dest.x += Image->Width;
|
|
|
|
}
|
|
|
|
|
|
|
|
//draw remainder
|
|
|
|
if (hRemainder > 0)
|
|
|
|
{
|
2007-07-30 13:20:06 -07:00
|
|
|
pieImage.tw = hRemainder;
|
2007-06-18 07:25:06 -07:00
|
|
|
dest.w = hRemainder;
|
|
|
|
pie_DrawImage(&pieImage, &dest, &rendStyle);
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-02-19 09:18:50 -08:00
|
|
|
/* FIXME: WTF is this supposed to do? Looks like some other functionality
|
|
|
|
* was retrofitted onto something else. - Per */
|
2007-06-27 05:30:29 -07:00
|
|
|
void pie_UploadDisplayBuffer()
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
screen_Upload(NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL pie_InitRadar(void)
|
|
|
|
{
|
|
|
|
glGenTextures(1, &radarTexture);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL pie_ShutdownRadar(void)
|
|
|
|
{
|
|
|
|
glDeleteTextures(1, &radarTexture);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2007-02-19 09:18:50 -08:00
|
|
|
void pie_DownLoadRadar( unsigned char *buffer )
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
unsigned int i, j;
|
|
|
|
iColour* psPalette = pie_GetGamePal();
|
|
|
|
|
2007-11-19 13:32:35 -08:00
|
|
|
for (i = 0, j = 0; i < RADARX * RADARY; ++i)
|
|
|
|
{
|
2007-06-28 10:47:08 -07:00
|
|
|
radarBitmap[j++] = psPalette[buffer[i]].r;
|
|
|
|
radarBitmap[j++] = psPalette[buffer[i]].g;
|
|
|
|
radarBitmap[j++] = psPalette[buffer[i]].b;
|
|
|
|
if (buffer[i] == 0) {
|
|
|
|
radarBitmap[j++] = 0;
|
|
|
|
} else {
|
|
|
|
radarBitmap[j++] = 255;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pie_SetTexturePage(radarTexture);
|
2007-11-19 13:32:35 -08:00
|
|
|
glTexImage2D(GL_TEXTURE_2D, 0, wz_texture_compression, RADARX, RADARY, 0,
|
2007-06-28 10:47:08 -07:00
|
|
|
GL_RGBA, GL_UNSIGNED_BYTE, radarBitmap);
|
|
|
|
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
|
|
|
|
}
|
|
|
|
|
2007-02-19 09:18:50 -08:00
|
|
|
void pie_RenderRadar( int x, int y )
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
PIEIMAGE pieImage;
|
|
|
|
PIERECT dest;
|
|
|
|
|
|
|
|
pie_SetBilinear(TRUE);
|
|
|
|
pie_SetRendMode(REND_GOURAUD_TEX);
|
|
|
|
pie_SetColour(COLOURINTENSITY);
|
|
|
|
pie_SetColourKeyedBlack(TRUE);
|
|
|
|
//special case function because texture is held outside of texture list
|
|
|
|
pieImage.texPage = radarTexture;
|
2007-07-30 13:20:06 -07:00
|
|
|
pieImage.tu = 0;
|
|
|
|
pieImage.tv = 0;
|
|
|
|
pieImage.tw = 256;
|
|
|
|
pieImage.th = 256;
|
2007-06-28 10:47:08 -07:00
|
|
|
dest.x = x;
|
|
|
|
dest.y = y;
|
2007-11-19 13:32:35 -08:00
|
|
|
dest.w = RADARX;
|
|
|
|
dest.h = RADARY;
|
2007-06-28 10:47:08 -07:00
|
|
|
pie_DrawImage(&pieImage, &dest, &rendStyle);
|
|
|
|
}
|
|
|
|
|
2007-02-07 07:27:17 -08:00
|
|
|
void pie_LoadBackDrop(SCREENTYPE screenType)
|
2006-12-31 10:19:19 -08:00
|
|
|
{
|
2006-11-03 17:11:26 -08:00
|
|
|
char backd[128];
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
//randomly load in a backdrop piccy.
|
2007-02-07 07:27:17 -08:00
|
|
|
srand( (unsigned)time(NULL) + 17 ); // Use offset since time alone doesn't work very well
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
switch (screenType)
|
|
|
|
{
|
|
|
|
case SCREEN_RANDOMBDROP:
|
2007-02-07 07:27:17 -08:00
|
|
|
if ( rand()%2 == 0 )
|
2007-10-24 14:11:29 -07:00
|
|
|
snprintf(backd, sizeof(backd), "texpages/bdrops/0%i-bdrop.png", rand()%7); // Range: 0-6
|
2007-02-07 07:27:17 -08:00
|
|
|
else
|
2007-10-24 14:11:29 -07:00
|
|
|
snprintf(backd, sizeof(backd), "texpages/bdrops/wzlogo_%i.png", rand()%5); // Range: 0-4
|
2007-06-28 10:47:08 -07:00
|
|
|
break;
|
|
|
|
case SCREEN_MISSIONEND:
|
2007-10-24 14:11:29 -07:00
|
|
|
snprintf(backd, sizeof(backd), "texpages/bdrops/missionend.png");
|
2007-06-28 10:47:08 -07:00
|
|
|
break;
|
|
|
|
|
2007-04-17 11:24:31 -07:00
|
|
|
case SCREEN_CREDITS:
|
2007-06-28 10:47:08 -07:00
|
|
|
default:
|
2007-10-24 14:11:29 -07:00
|
|
|
snprintf(backd, sizeof(backd), "texpages/bdrops/credits.png");
|
2007-06-28 10:47:08 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2007-10-24 14:11:29 -07:00
|
|
|
// Guarantee to nul-terminate
|
|
|
|
backd[sizeof(backd) - 1] = '\0';
|
|
|
|
|
2007-06-28 10:47:08 -07:00
|
|
|
screen_SetBackDropFromFile(backd);
|
|
|
|
}
|