Remove more unused code. This includes iV_GetMouseFrame, which returned an undefined value before. scriptextern.c might want to be adapted.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1865 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
b2b33bbed4
commit
e40c830278
|
@ -524,43 +524,36 @@ void *resGetData(const char *pType, const char *pID)
|
|||
{
|
||||
RES_TYPE *psT;
|
||||
RES_DATA *psRes;
|
||||
UDWORD HashedType;
|
||||
// Find the correct type
|
||||
|
||||
HashedType=HashString(pType); // la da la
|
||||
//printf("[resGetData] entering with %s / %s = %0x\n",pID,pType,HashedType);
|
||||
UDWORD HashedType = HashString(pType);
|
||||
UDWORD HashedID = HashStringIgnoreCase(pID);
|
||||
|
||||
for(psT = psResTypes; psT != NULL; psT = psT->psNext )
|
||||
{
|
||||
if (psT->HashedType==HashedType)
|
||||
if (psT->HashedType == HashedType)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (psT == NULL)
|
||||
{
|
||||
ASSERT( FALSE, "resGetData: Unknown type: %s", pType );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for(psRes = psT->psRes; psRes != NULL; psRes = psRes->psNext)
|
||||
{
|
||||
UDWORD HashedID=HashStringIgnoreCase(pID);
|
||||
for(psRes = psT->psRes; psRes; psRes = psRes->psNext)
|
||||
if (psRes->HashedID == HashedID)
|
||||
{
|
||||
if (psRes->HashedID==HashedID)
|
||||
{
|
||||
/* We found it */
|
||||
// printf("[resGetData] looking for %s = %0x ******found!\n",pID,HashedID);
|
||||
break;
|
||||
}
|
||||
/* We found it */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (psRes == NULL)
|
||||
{
|
||||
ASSERT( psRes != NULL, "resGetData: Unknown ID: %s", pID );
|
||||
// resLoadFile(pType,pID);
|
||||
// resGetData(pType,pID);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
noinst_LIBRARIES = libivis_common.a
|
||||
noinst_HEADERS = bitimage.h imd.h ivi.h ivisdef.h \
|
||||
ivispatch.h pieblitfunc.h pieclip.h piedef.h piefunc.h piemode.h piepalette.h \
|
||||
piestate.h pietypes.h png_util.h rendfunc.h rendmode.h tex.h textdraw.h
|
||||
piestate.h pietypes.h png_util.h rendmode.h tex.h textdraw.h
|
||||
|
||||
libivis_common_a_SOURCES = bitimage.c imd.c imdload.c png_util.c pieclip.c \
|
||||
piestate.c
|
||||
|
|
|
@ -1,80 +0,0 @@
|
|||
/*
|
||||
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
|
||||
*/
|
||||
/***************************************************************************/
|
||||
/*
|
||||
* rendfunc.h
|
||||
*
|
||||
* render functions for base render library.
|
||||
*
|
||||
*/
|
||||
/***************************************************************************/
|
||||
|
||||
#ifndef _rendFunc_h
|
||||
#define _rendFunc_h
|
||||
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
#include "lib/framework/frame.h"
|
||||
#include "piedef.h"
|
||||
|
||||
/***************************************************************************/
|
||||
/*
|
||||
* Global Definitions
|
||||
*/
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
/***************************************************************************/
|
||||
/*
|
||||
* Global Variables
|
||||
*/
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
/***************************************************************************/
|
||||
/*
|
||||
* Global ProtoTypes
|
||||
*/
|
||||
/***************************************************************************/
|
||||
//*************************************************************************
|
||||
// functions accessed dirtectly from rendmode
|
||||
//*************************************************************************
|
||||
extern void SetTransFilter(UDWORD rgb,UDWORD tablenumber);
|
||||
extern void TransBoxFill(UDWORD x0, UDWORD y0, UDWORD x1, UDWORD y1);
|
||||
extern void DrawImage(IMAGEFILE *ImageFile,UWORD ID,int x,int y);
|
||||
extern void DrawImageRect(IMAGEFILE *ImageFile,UWORD ID,int x,int y,int x0,int y0,int Width,int Height);
|
||||
extern void DrawTransImage(IMAGEFILE *ImageFile,UWORD ID,int x,int y);
|
||||
extern void DrawTransImageRect(IMAGEFILE *ImageFile,UWORD ID,int x,int y,int x0,int y0,int Width,int Height);
|
||||
extern void iV_SetMousePointer(IMAGEFILE *ImageFile,UWORD ImageID);
|
||||
extern void iV_DrawMousePointer(int x,int y);
|
||||
|
||||
|
||||
extern UDWORD iV_GetMouseFrame(void);
|
||||
|
||||
//*************************************************************************
|
||||
// functions accessed indirectly from rendmode
|
||||
//*************************************************************************
|
||||
extern void (*iV_pBox)(int x0, int y0, int x1, int y1, Uint32 colour);
|
||||
extern void (*iV_pBoxFill)(int x0, int y0, int x1, int y1, Uint32 colour);
|
||||
|
||||
|
||||
//*************************************************************************
|
||||
#endif // _rendFunc_h
|
|
@ -20,6 +20,7 @@
|
|||
// vid.c 0.1 10-01-96.22-11-96
|
||||
#ifndef _rendmode_h_
|
||||
#define _rendmode_h_
|
||||
|
||||
#include "ivisdef.h"
|
||||
#include "pieblitfunc.h"
|
||||
#include "bitimage.h"
|
||||
|
@ -50,56 +51,15 @@
|
|||
#define REND_SURFACE_SCREEN 1
|
||||
#define REND_SURFACE_USR 2
|
||||
|
||||
#define iV_SCREEN_WIDTH (rendSurface.width)
|
||||
//*************************************************************************
|
||||
|
||||
extern iSurface rendSurface;
|
||||
extern iSurface *psRendSurface;
|
||||
|
||||
//*************************************************************************
|
||||
|
||||
extern iSurface rendSurface;
|
||||
extern iSurface *psRendSurface;
|
||||
|
||||
//*************************************************************************
|
||||
|
||||
extern void rend_AssignScreen(void);
|
||||
extern void rend_Assign(iSurface *s);
|
||||
extern void iV_RenderAssign(iSurface *s);
|
||||
extern void iV_SurfaceDestroy(iSurface *s);
|
||||
extern iSurface *iV_SurfaceCreate(Uint32 flags, int width, int height, int xp, int yp, Uint8 *buffer);
|
||||
|
||||
//*************************************************************************
|
||||
|
||||
extern int iV_GetDisplayWidth(void);
|
||||
extern int iV_GetDisplayHeight(void);
|
||||
|
||||
//*************************************************************************
|
||||
// vid stuff still to be cut down
|
||||
//*************************************************************************
|
||||
|
||||
extern char* (*iV_ScreenDumpToDisk)(void);
|
||||
extern void (*iV_ppBitmap)(iBitmap *bmp, int x, int y, int w, int h, int ow);
|
||||
extern void (*iV_ppBitmapTrans)(iBitmap *bmp, int x, int y, int w, int h, int ow);
|
||||
extern void (*iV_SetTransFilter)(UDWORD rgb,UDWORD tablenumber);
|
||||
extern void (*iV_UniBitmapDepth)(int texPage, int u, int v, int srcWidth, int srcHeight,
|
||||
int x, int y, int destWidth, int destHeight, unsigned char brightness, int depth);
|
||||
|
||||
extern void (*iV_SetTransImds)(BOOL trans);
|
||||
|
||||
//mapdisplay
|
||||
|
||||
/* Blit a transparent rectangle to the back buffer */
|
||||
extern void iVBlitTransRect(UDWORD x0, UDWORD x1, UDWORD y0, UDWORD y1);
|
||||
|
||||
/* Optimised DWORD read/write to memory */
|
||||
extern void iVFBlitTransRect(UDWORD x0, UDWORD y0, UDWORD x1, UDWORD y1);
|
||||
|
||||
/* Possible filter colours for the transparency rectangle blit */
|
||||
#define TINT_BLUE 0
|
||||
#define TRANS_GREY 1
|
||||
#define TRANS_BLUE 2
|
||||
#define TRANS_BRITE 3
|
||||
#define TINT_DEEPBLUE 4
|
||||
|
||||
extern void iV_DrawMousePointer(int x,int y);
|
||||
extern void iV_SetMousePointer(IMAGEFILE *ImageFile,UWORD ImageID);
|
||||
extern void (*iV_ppBitmapColourTrans)(iBitmap *bmp, int x, int y, int w, int h, int ow,int ColourIndex);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -78,8 +78,6 @@ extern UDWORD pie_DrawFormattedText(char *String, UDWORD x, UDWORD y, UDWORD Wid
|
|||
|
||||
extern void pie_DrawText(const char *string, UDWORD x, UDWORD y);
|
||||
extern void pie_DrawText270(const char *String, int XPos, int YPos);
|
||||
extern void pie_RenderBlueTintedBitmap(iBitmap *bmp, int x, int y, int w, int h, int ow);
|
||||
extern void pie_RenderDeepBlueTintedBitmap(iBitmap *bmp, int x, int y, int w, int h, int ow);
|
||||
|
||||
typedef void (*RENDERTEXT_CALLBACK)(const char *String, UDWORD X, UDWORD Y);
|
||||
// routines used for textdraw
|
||||
|
|
|
@ -2,7 +2,7 @@ noinst_LIBRARIES = libivis_opengl.a
|
|||
noinst_HEADERS = piematrix.h pietexture.h screen.h
|
||||
|
||||
libivis_opengl_a_SOURCES = ivi.c pieblitfunc.c piedraw.c piefunc.c \
|
||||
piematrix.c piemode.c piepalette.c piestate.c pietexture.c rendfunc.c rendmode.c \
|
||||
piematrix.c piemode.c piepalette.c piestate.c pietexture.c rendmode.c \
|
||||
screen.c tex.c textdraw.c
|
||||
|
||||
libivis_opengl_a_LIBADD = $(top_builddir)/lib/ivis_common/libivis_common.a \
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
#include "lib/ivis_common/piedef.h"
|
||||
#include "lib/ivis_common/piemode.h"
|
||||
#include "lib/ivis_common/piestate.h"
|
||||
#include "lib/ivis_common/rendfunc.h"
|
||||
#include "lib/ivis_common/rendmode.h"
|
||||
#include "lib/ivis_common/pieclip.h"
|
||||
#include "lib/ivis_common/piefunc.h"
|
||||
|
|
|
@ -881,17 +881,21 @@ void pie_DrawImage(PIEIMAGE *image, PIERECT *dest, PIESTYLE *style)
|
|||
style->colour.argb = pie_GetColour();
|
||||
style->specular.argb = 0x00000000;
|
||||
|
||||
glBegin(GL_TRIANGLE_STRIP);
|
||||
glColor4ub(style->colour.byte.r, style->colour.byte.g, style->colour.byte.b, style->colour.byte.a);
|
||||
//set up 4 pie verts
|
||||
glTexCoord2f(image->tu, image->tv);
|
||||
glVertex2f(dest->x, dest->y);
|
||||
glTexCoord2f(image->tu + image->tw, image->tv);
|
||||
glVertex2f(dest->x + dest->w, dest->y);
|
||||
glTexCoord2f(image->tu, image->tv + image->th);
|
||||
glVertex2f(dest->x, dest->y + dest->h);
|
||||
glTexCoord2f(image->tu + image->tw, image->tv + image->th);
|
||||
glVertex2f(dest->x + dest->w, dest->y + dest->h);
|
||||
|
||||
glBegin(GL_TRIANGLE_STRIP);
|
||||
//set up 4 pie verts
|
||||
glTexCoord2f(image->tu, image->tv);
|
||||
glVertex2f(dest->x, dest->y);
|
||||
|
||||
glTexCoord2f(image->tu + image->tw, image->tv);
|
||||
glVertex2f(dest->x + dest->w, dest->y);
|
||||
|
||||
glTexCoord2f(image->tu, image->tv + image->th);
|
||||
glVertex2f(dest->x, dest->y + dest->h);
|
||||
|
||||
glTexCoord2f(image->tu + image->tw, image->tv + image->th);
|
||||
glVertex2f(dest->x + dest->w, dest->y + dest->h);
|
||||
glEnd();
|
||||
}
|
||||
|
||||
|
@ -915,16 +919,20 @@ void pie_DrawImage270( PIEIMAGE *image, PIERECT *dest )
|
|||
|
||||
colour.argb = pie_GetColour();
|
||||
|
||||
glBegin(GL_TRIANGLE_FAN);
|
||||
glColor4ub(colour.byte.r, colour.byte.g, colour.byte.b, colour.byte.a);
|
||||
glTexCoord2f(image->tu+image->tw, image->tv);
|
||||
glVertex2f(dest->x, dest->y);
|
||||
glTexCoord2f(image->tu+image->tw, image->tv+image->th);
|
||||
glVertex2f(dest->x+dest->h, dest->y);
|
||||
glTexCoord2f(image->tu, image->tv+image->th);
|
||||
glVertex2f(dest->x+dest->h, dest->y+dest->w);
|
||||
glTexCoord2f(image->tu, image->tv);
|
||||
glVertex2f(dest->x, dest->y+dest->w);
|
||||
|
||||
glBegin(GL_TRIANGLE_FAN);
|
||||
glTexCoord2f(image->tu + image->tw, image->tv);
|
||||
glVertex2f(dest->x, dest->y);
|
||||
|
||||
glTexCoord2f(image->tu + image->tw, image->tv + image->th);
|
||||
glVertex2f(dest->x + dest->h, dest->y);
|
||||
|
||||
glTexCoord2f(image->tu, image->tv + image->th);
|
||||
glVertex2f(dest->x + dest->h, dest->y + dest->w);
|
||||
|
||||
glTexCoord2f(image->tu, image->tv);
|
||||
glVertex2f(dest->x, dest->y + dest->w);
|
||||
glEnd();
|
||||
}
|
||||
|
||||
|
@ -1060,12 +1068,12 @@ void pie_DrawTexTriangle(PIEVERTEX *aVrts, void* psEffects)
|
|||
pie_SetBilinear(TRUE);
|
||||
|
||||
glBegin(GL_TRIANGLE_FAN);
|
||||
for ( i = 0; i < 3; i++ )
|
||||
{
|
||||
glColor4ub( aVrts[i].light.byte.r, aVrts[i].light.byte.g, aVrts[i].light.byte.b, aVrts[i].light.byte.a );
|
||||
glTexCoord2f( aVrts[i].tu, aVrts[i].tv + offset );
|
||||
glVertex3f( aVrts[i].sx, aVrts[i].sy, aVrts[i].sz );
|
||||
}
|
||||
for ( i = 0; i < 3; i++ )
|
||||
{
|
||||
glColor4ub( aVrts[i].light.byte.r, aVrts[i].light.byte.g, aVrts[i].light.byte.b, aVrts[i].light.byte.a );
|
||||
glTexCoord2f( aVrts[i].tu, aVrts[i].tv + offset );
|
||||
glVertex3f( aVrts[i].sx, aVrts[i].sy, aVrts[i].sz );
|
||||
}
|
||||
glEnd();
|
||||
|
||||
if (psEffects != NULL)
|
||||
|
|
|
@ -1,463 +0,0 @@
|
|||
/*
|
||||
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
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "lib/ivis_common/rendfunc.h"
|
||||
#include "lib/ivis_common/rendmode.h"
|
||||
#include "lib/ivis_common/piepalette.h"
|
||||
#include "lib/ivis_common/ivispatch.h"
|
||||
#include "lib/framework/fractions.h"
|
||||
#include "lib/ivis_common/pieclip.h"
|
||||
|
||||
/***************************************************************************/
|
||||
/*
|
||||
* Local Variables
|
||||
*/
|
||||
/***************************************************************************/
|
||||
|
||||
UBYTE aTransTable[256];
|
||||
UBYTE aTransTable2[256]; // 2 trans tabels so we can have 2 transparancy colours without slowdown.
|
||||
UBYTE aTransTable3[256]; // 3 trans tabels so we can have 3 transparancy colours without slowdown.
|
||||
UBYTE aTransTable4[256]; // 4 trans tabels so we can have 4 transparancy colours without slowdown.
|
||||
/* Set default transparency filter to green pass */
|
||||
UDWORD transFilter = TRANS_GREY;
|
||||
//static int g_mode = REND_UNDEFINED;
|
||||
static IMAGEFILE *MouseImageFile;
|
||||
static UWORD MouseImageID;
|
||||
|
||||
/***************************************************************************/
|
||||
/*
|
||||
* Local ProtoTypes
|
||||
*/
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
void iVBlitPixelTransRect(UDWORD x0, UDWORD y0, UDWORD x1, UDWORD y1);
|
||||
|
||||
/* Build a transparency look up table for the interface */
|
||||
static void pie_BuildTransTable(UDWORD tableNo);
|
||||
|
||||
// dummy prototypes for pointer build functions
|
||||
void (*iV_pBox)(int x0, int y0, int x1, int y1, Uint32 colour);
|
||||
void (*iV_pBoxFill)(int x0, int y0, int x1, int y1, Uint32 colour);
|
||||
|
||||
//*************************************************************************
|
||||
//*************************************************************************
|
||||
//*************************************************************************
|
||||
//*************************************************************************
|
||||
/***************************************************************************/
|
||||
/*
|
||||
* Source
|
||||
*/
|
||||
/***************************************************************************/
|
||||
|
||||
//*************************************************************************
|
||||
|
||||
void SetTransFilter(UDWORD rgb,UDWORD tablenumber)
|
||||
{
|
||||
transFilter = rgb;
|
||||
pie_BuildTransTable(tablenumber); /* Need to recalculate the transparency table */
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
|
||||
void TransBoxFill(UDWORD x0, UDWORD y0, UDWORD x1, UDWORD y1)
|
||||
{
|
||||
UDWORD *screen;
|
||||
UDWORD fourPixels;
|
||||
UDWORD output;
|
||||
UDWORD width;
|
||||
UDWORD i,j;
|
||||
|
||||
/* Note x1 must be greater than x0 */
|
||||
width = x1-x0;
|
||||
|
||||
/* Not worth it, so use pixel version */
|
||||
if( (width) < 8)
|
||||
{
|
||||
iVBlitPixelTransRect(x0,y0,x1,y1);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Get a handle on the current back buffer */
|
||||
|
||||
for(i=y0; i<y1; i++)
|
||||
{
|
||||
screen = (UDWORD *)(psRendSurface->buffer+psRendSurface->scantable[i] + x0);
|
||||
|
||||
/* We need to go through width/4 times */
|
||||
for (j=x0; j<x1; j+=4)
|
||||
{
|
||||
fourPixels = *screen;
|
||||
output = (UDWORD)aTransTable[(UBYTE)((fourPixels & 0xff000000)>>24)];
|
||||
output = output<<8;
|
||||
output = output ^ (UDWORD)aTransTable[(UBYTE)((fourPixels & 0x00ff0000)>>16)];
|
||||
output = output<<8;
|
||||
output = output ^ (UDWORD)aTransTable[(UBYTE)((fourPixels & 0x0000ff00)>>8)];
|
||||
output = output<<8;
|
||||
output = output ^ (UDWORD)aTransTable[(UBYTE)(fourPixels & 0x000000ff)];
|
||||
*screen++ = output;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
|
||||
void DrawImage(IMAGEFILE *ImageFile,UWORD ID,int x,int y)
|
||||
{
|
||||
IMAGEDEF *Image;
|
||||
iBitmap *Bmp;
|
||||
UDWORD Modulus;
|
||||
|
||||
assert(ID < ImageFile->Header.NumImages);
|
||||
Image = &ImageFile->ImageDefs[ID];
|
||||
|
||||
Modulus = ImageFile->TexturePages[Image->TPageID].width;
|
||||
Bmp = ImageFile->TexturePages[Image->TPageID].bmp;
|
||||
|
||||
Bmp += ((UDWORD)Image->Tu) + ((UDWORD)Image->Tv) * Modulus;
|
||||
|
||||
iV_ppBitmap(Bmp,
|
||||
x+Image->XOffset,y+Image->YOffset,
|
||||
Image->Width,Image->Height,Modulus);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
|
||||
void DrawImageRect(IMAGEFILE *ImageFile,UWORD ID,int x,int y,int x0,int y0,int Width,int Height)
|
||||
{
|
||||
UDWORD RepWidth = 1;
|
||||
UDWORD RepWidthRemain = 0;
|
||||
UDWORD RepHeight = 1;
|
||||
UDWORD RepHeightRemain = 0;
|
||||
BOOL Tiled = FALSE;
|
||||
UDWORD w,h;
|
||||
UDWORD tx,ty;
|
||||
|
||||
IMAGEDEF *Image;
|
||||
iBitmap *Bmp;
|
||||
UDWORD Modulus;
|
||||
|
||||
assert(ID < ImageFile->Header.NumImages);
|
||||
Image = &ImageFile->ImageDefs[ID];
|
||||
|
||||
Modulus = ImageFile->TexturePages[Image->TPageID].width;
|
||||
Bmp = ImageFile->TexturePages[Image->TPageID].bmp;
|
||||
|
||||
Bmp += ((UDWORD)Image->Tu) + ((UDWORD)Image->Tv) * Modulus;
|
||||
|
||||
if(Width + x0 > Image->Width) {
|
||||
RepWidth = Width / Image->Width;
|
||||
RepWidthRemain = Width - RepWidth * Image->Width;
|
||||
Width = Image->Width;
|
||||
Tiled = TRUE;
|
||||
}
|
||||
|
||||
if(Height+ y0 > Image->Height) {
|
||||
RepHeight = Height / Image->Height;
|
||||
RepHeightRemain = Height - RepHeight * Image->Height;
|
||||
Height = Image->Height;
|
||||
Tiled = TRUE;
|
||||
}
|
||||
|
||||
|
||||
if(Tiled) {
|
||||
ty = y;
|
||||
for(h=0; h<RepHeight; h++) {
|
||||
tx = x;
|
||||
for(w=0; w<RepWidth; w++) {
|
||||
iV_ppBitmap(Bmp,
|
||||
tx+Image->XOffset,ty+Image->YOffset,
|
||||
Width,Height,Modulus);
|
||||
tx += Width;
|
||||
}
|
||||
if(RepWidthRemain) {
|
||||
iV_ppBitmap(Bmp,
|
||||
tx+Image->XOffset,ty+Image->YOffset,
|
||||
RepWidthRemain,Height,Modulus);
|
||||
}
|
||||
ty += Height;
|
||||
}
|
||||
|
||||
if(RepHeightRemain) {
|
||||
tx = x;
|
||||
for(w=0; w<RepWidth; w++) {
|
||||
iV_ppBitmap(Bmp,
|
||||
tx+Image->XOffset,ty+Image->YOffset,
|
||||
Width,RepHeightRemain,Modulus);
|
||||
tx += Width;
|
||||
}
|
||||
if(RepWidthRemain) {
|
||||
iV_ppBitmap(Bmp,
|
||||
tx+Image->XOffset,ty+Image->YOffset,
|
||||
RepWidthRemain,RepHeightRemain,Modulus);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
iV_ppBitmap(Bmp,
|
||||
x+Image->XOffset,y+Image->YOffset,
|
||||
Width,Height,Modulus);
|
||||
}
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
|
||||
void DrawTransImage(IMAGEFILE *ImageFile,UWORD ID,int x,int y)
|
||||
{
|
||||
IMAGEDEF *Image;
|
||||
iBitmap *Bmp;
|
||||
UDWORD Modulus;
|
||||
|
||||
assert(ID < ImageFile->Header.NumImages);
|
||||
Image = &ImageFile->ImageDefs[ID];
|
||||
|
||||
Modulus = ImageFile->TexturePages[Image->TPageID].width;
|
||||
Bmp = ImageFile->TexturePages[Image->TPageID].bmp;
|
||||
|
||||
Bmp += ((UDWORD)Image->Tu) + ((UDWORD)Image->Tv) * Modulus;
|
||||
|
||||
iV_ppBitmapTrans(Bmp,x+Image->XOffset,y+Image->YOffset,
|
||||
Image->Width,Image->Height,Modulus);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
|
||||
void DrawTransImageRect(IMAGEFILE *ImageFile,UWORD ID,int x,int y,int x0,int y0,int Width,int Height)
|
||||
{
|
||||
UDWORD RepWidth = 1;
|
||||
UDWORD RepWidthRemain = 0;
|
||||
UDWORD RepHeight = 1;
|
||||
UDWORD RepHeightRemain = 0;
|
||||
BOOL Tiled = FALSE;
|
||||
UDWORD w,h;
|
||||
UDWORD tx,ty;
|
||||
|
||||
IMAGEDEF *Image;
|
||||
iBitmap *Bmp;
|
||||
UDWORD Modulus;
|
||||
|
||||
assert(ID < ImageFile->Header.NumImages);
|
||||
Image = &ImageFile->ImageDefs[ID];
|
||||
|
||||
Modulus = ImageFile->TexturePages[Image->TPageID].width;
|
||||
Bmp = ImageFile->TexturePages[Image->TPageID].bmp;
|
||||
|
||||
Bmp += ((UDWORD)Image->Tu) + ((UDWORD)Image->Tv) * Modulus;
|
||||
|
||||
if(Width + x0 > Image->Width) {
|
||||
RepWidth = Width / Image->Width;
|
||||
RepWidthRemain = Width - RepWidth * Image->Width;
|
||||
Width = Image->Width;
|
||||
Tiled = TRUE;
|
||||
}
|
||||
|
||||
if(Height+ y0 > Image->Height) {
|
||||
RepHeight = Height / Image->Height;
|
||||
RepHeightRemain = Height - RepHeight * Image->Height;
|
||||
Height = Image->Height;
|
||||
Tiled = TRUE;
|
||||
}
|
||||
|
||||
if(Tiled) {
|
||||
ty = y;
|
||||
for(h=0; h<RepHeight; h++) {
|
||||
tx = x;
|
||||
for(w=0; w<RepWidth; w++) {
|
||||
iV_ppBitmapTrans(Bmp,
|
||||
|
||||
tx+Image->XOffset,ty+Image->YOffset,
|
||||
Width,Height,Modulus);
|
||||
tx += Width;
|
||||
}
|
||||
if(RepWidthRemain) {
|
||||
iV_ppBitmapTrans(Bmp,
|
||||
tx+Image->XOffset,ty+Image->YOffset,
|
||||
RepWidthRemain,Height,Modulus);
|
||||
}
|
||||
ty += Height;
|
||||
}
|
||||
|
||||
if(RepHeightRemain) {
|
||||
tx = x;
|
||||
for(w=0; w<RepWidth; w++) {
|
||||
iV_ppBitmapTrans(Bmp,
|
||||
tx+Image->XOffset,ty+Image->YOffset,
|
||||
Width,RepHeightRemain,Modulus);
|
||||
tx += Width;
|
||||
}
|
||||
if(RepWidthRemain) {
|
||||
iV_ppBitmapTrans(Bmp,
|
||||
tx+Image->XOffset,ty+Image->YOffset,
|
||||
RepWidthRemain,RepHeightRemain,Modulus);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
iV_ppBitmapTrans(Bmp,
|
||||
x+Image->XOffset,y+Image->YOffset,
|
||||
Width,Height,Modulus);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//*************************************************************************
|
||||
|
||||
void iV_SetMousePointer(IMAGEFILE *ImageFile,UWORD ImageID)
|
||||
{
|
||||
ASSERT( ImageID < ImageFile->Header.NumImages,"iV_SetMousePointer : Invalid image id" );
|
||||
|
||||
MouseImageFile = ImageFile;
|
||||
MouseImageID = ImageID;
|
||||
}
|
||||
|
||||
|
||||
UDWORD iV_GetMouseFrame(void)
|
||||
{
|
||||
return MouseImageID;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void iV_DrawMousePointer(int x,int y)
|
||||
{
|
||||
iV_DrawImage(MouseImageFile,MouseImageID,x,y);
|
||||
}
|
||||
|
||||
|
||||
//*************************************************************************
|
||||
//
|
||||
// local functions
|
||||
//
|
||||
//*************************************************************************
|
||||
|
||||
void iVBlitPixelTransRect(UDWORD x0, UDWORD y0, UDWORD x1, UDWORD y1)
|
||||
{
|
||||
|
||||
UBYTE *screen;
|
||||
UBYTE present;
|
||||
UDWORD i,j;
|
||||
/* Do a horizontal strip at a time. We're going x inside y to take advantage of the scan table */
|
||||
for (i=y0; i<y1; i++)
|
||||
{
|
||||
/* Get this outside loop cos it's invariant to each scan line */
|
||||
screen = (UBYTE *)psRendSurface->buffer + psRendSurface->scantable[i] + x0;
|
||||
|
||||
for(j=x0; j<x1; j++)
|
||||
{
|
||||
/* What colour is there at the moment? */
|
||||
present = *screen;
|
||||
/* Write in the new improved greener version */
|
||||
*screen++ = aTransTable[present];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
|
||||
static void pie_BuildTransTable(UDWORD tableNo)
|
||||
{
|
||||
UDWORD i;
|
||||
UBYTE red = 0, green = 0, blue = 0;
|
||||
iColour* psPalette = pie_GetGamePal();
|
||||
|
||||
// Step through all the palette entries for the currently selected iVPALETTE
|
||||
for(i=0; i<256; i++)
|
||||
{
|
||||
switch (transFilter)
|
||||
{
|
||||
case TINT_BLUE:
|
||||
red = (psPalette[i].r * 5) / 8;
|
||||
blue = (psPalette[i].b * 7) / 8;
|
||||
green = (psPalette[i].g * 5) / 8;
|
||||
break;
|
||||
|
||||
case TINT_DEEPBLUE:
|
||||
red = (psPalette[i].r * 3) / 8;
|
||||
blue = (psPalette[i].b * 5) / 8;
|
||||
green = (psPalette[i].g * 3) / 8;
|
||||
break;
|
||||
|
||||
case TRANS_GREY:
|
||||
red = psPalette[i].r/2;
|
||||
blue = psPalette[i].b/2;
|
||||
green = psPalette[i].g/2;
|
||||
break;
|
||||
|
||||
case TRANS_BLUE:
|
||||
red = psPalette[i].r/2;
|
||||
blue = psPalette[i].b;
|
||||
green = psPalette[i].g/2;
|
||||
break;
|
||||
|
||||
case TRANS_BRITE:
|
||||
if( ((UDWORD)psPalette[i].r) + 50 >255)
|
||||
{
|
||||
red = 255;
|
||||
}
|
||||
else
|
||||
{
|
||||
red = (psPalette[i].r+50);
|
||||
}
|
||||
|
||||
if( ((UDWORD)psPalette[i].b) + 50 >255)
|
||||
{
|
||||
blue = 255;
|
||||
}
|
||||
else
|
||||
{
|
||||
blue = (psPalette[i].b+50);
|
||||
}
|
||||
|
||||
if( ((UDWORD)psPalette[i].g)+50 >255)
|
||||
{
|
||||
green = 255;
|
||||
}
|
||||
else
|
||||
{
|
||||
green = (psPalette[i].g+50);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
ASSERT( FALSE,"Invalid transparency filter selection" );
|
||||
break;
|
||||
}
|
||||
|
||||
if(tableNo == 0)
|
||||
{
|
||||
aTransTable[i] = pal_GetNearestColour(red,green,blue);
|
||||
}
|
||||
else if(tableNo == 1)
|
||||
{
|
||||
aTransTable2[i] = pal_GetNearestColour(red,green,blue);
|
||||
}
|
||||
else if(tableNo == 2)
|
||||
{
|
||||
aTransTable3[i] = pal_GetNearestColour(red,green,blue);
|
||||
}
|
||||
else
|
||||
{
|
||||
aTransTable4[i] = pal_GetNearestColour(red,green,blue);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -23,7 +23,6 @@
|
|||
#include "lib/ivis_common/ivi.h"
|
||||
#include "lib/ivis_common/rendmode.h"
|
||||
#include "lib/ivis_common/pieclip.h"
|
||||
#include "lib/ivis_common/rendfunc.h"
|
||||
#include "lib/ivis_common/textdraw.h"
|
||||
#include "lib/ivis_common/piepalette.h"
|
||||
#include "lib/ivis_common/piestate.h"
|
||||
|
@ -86,48 +85,6 @@ void iV_SurfaceDestroy(iSurface *s)
|
|||
free(s);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
//*** assign renderer
|
||||
//*
|
||||
//******
|
||||
|
||||
void rend_Assign(iSurface *s)
|
||||
{
|
||||
iV_RenderAssign(s);
|
||||
|
||||
/* Need to look into this - won't the unwanted called still set render surface? */
|
||||
psRendSurface = s;
|
||||
}
|
||||
|
||||
|
||||
// pre VideoOpen
|
||||
void rend_AssignScreen(void)
|
||||
{
|
||||
iV_RenderAssign(&rendSurface);
|
||||
}
|
||||
|
||||
int iV_GetDisplayWidth(void)
|
||||
{
|
||||
return rendSurface.width;
|
||||
}
|
||||
|
||||
int iV_GetDisplayHeight(void)
|
||||
{
|
||||
return rendSurface.height;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
//
|
||||
// function pointers for render assign
|
||||
//
|
||||
//*************************************************************************
|
||||
|
||||
void (*iV_ppBitmap)(iBitmap *bmp, int x, int y, int w, int h, int ow);
|
||||
void (*iV_ppBitmapTrans)(iBitmap *bmp, int x, int y, int w, int h, int ow);
|
||||
void (*iV_SetTransFilter)(UDWORD rgb,UDWORD tablenumber);
|
||||
void (*iV_UniBitmapDepth)(int texPage, int u, int v, int srcWidth, int srcHeight,
|
||||
int x, int y, int destWidth, int destHeight, unsigned char brightness, int depth);
|
||||
void (*iV_SetTransImds)(BOOL trans);
|
||||
|
||||
//*************************************************************************
|
||||
//
|
||||
|
@ -140,8 +97,6 @@ void iV_RenderAssign(iSurface *s)
|
|||
/* Need to look into this - won't the unwanted called still set render surface? */
|
||||
psRendSurface = s;
|
||||
|
||||
iV_SetTransFilter = SetTransFilter;
|
||||
|
||||
iV_DEBUG0("vid[RenderAssign] = assigned renderer :\n");
|
||||
iV_DEBUG5("usr %d\nflags %x\nxcentre, ycentre %d\nbuffer %p\n",
|
||||
s->usr,s->flags,s->xcentre,s->ycentre,s->buffer);
|
||||
|
|
|
@ -17,13 +17,12 @@
|
|||
along with Warzone 2100; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
#include <stdio.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "lib/ivis_common/ivisdef.h"
|
||||
#include "lib/ivis_common/piestate.h"
|
||||
#include "lib/ivis_common/rendmode.h"
|
||||
#include "lib/ivis_common/rendfunc.h"
|
||||
#include "lib/ivis_common/pieclip.h"
|
||||
#include "lib/ivis_common/pieblitfunc.h"
|
||||
#include "lib/ivis_common/piepalette.h"
|
||||
|
@ -31,21 +30,6 @@
|
|||
#include "lib/ivis_common/textdraw.h"
|
||||
#include "lib/ivis_common/bitimage.h"
|
||||
|
||||
/***************************************************************************/
|
||||
/*
|
||||
* Global Variables
|
||||
*/
|
||||
/***************************************************************************/
|
||||
/***************************************************************************/
|
||||
/*
|
||||
* Globally Imported Variables (well dodgy)
|
||||
*/
|
||||
/***************************************************************************/
|
||||
extern UBYTE aTransTable[256];//from rendfunc
|
||||
extern UBYTE aTransTable2[256];//from rendfunc
|
||||
extern UBYTE aTransTable3[256];//from rendfunc
|
||||
extern UBYTE aTransTable4[256];//from rendfunc
|
||||
|
||||
/***************************************************************************/
|
||||
/*
|
||||
* Local Definitions
|
||||
|
@ -580,58 +564,6 @@ void pie_DrawText(const char *string, UDWORD x, UDWORD y)
|
|||
}
|
||||
}
|
||||
|
||||
//draw Blue tinted bitmap
|
||||
void pie_RenderBlueTintedBitmap(iBitmap *bmp, int x, int y, int w, int h, int ow)
|
||||
{
|
||||
int i, j, lineSkip;
|
||||
Uint8 *bp;
|
||||
Uint8 present;
|
||||
|
||||
|
||||
bp = (Uint8 *) psRendSurface->buffer + x + psRendSurface->scantable[y];
|
||||
|
||||
lineSkip = psRendSurface->width - w;
|
||||
for (i=0; i<h; i++)
|
||||
{
|
||||
for (j=0; j<w; j++)
|
||||
{
|
||||
present = *bmp++;
|
||||
if(present)
|
||||
{
|
||||
*bp = aTransTable3[present]; // Write in the new version (blue tinted)
|
||||
}
|
||||
bp++;
|
||||
}
|
||||
bmp += (ow - w);
|
||||
bp += lineSkip;
|
||||
}
|
||||
}
|
||||
|
||||
void pie_RenderDeepBlueTintedBitmap(iBitmap *bmp, int x, int y, int w, int h, int ow)
|
||||
{
|
||||
int i, j, lineSkip;
|
||||
Uint8 *bp;
|
||||
Uint8 present;
|
||||
|
||||
|
||||
bp = (Uint8 *) psRendSurface->buffer + x + psRendSurface->scantable[y];
|
||||
|
||||
lineSkip = psRendSurface->width - w;
|
||||
for (i=0; i<h; i++)
|
||||
{
|
||||
for (j=0; j<w; j++)
|
||||
{
|
||||
present = *bmp++;
|
||||
if(present)
|
||||
{
|
||||
*bp = aTransTable4[present]; // Write in the new version (blue tinted)
|
||||
}
|
||||
bp++;
|
||||
}
|
||||
bmp += (ow - w);
|
||||
bp += lineSkip;
|
||||
}
|
||||
}
|
||||
|
||||
void pie_DrawText270(const char *String, int XPos, int YPos)
|
||||
{
|
||||
|
|
|
@ -421,20 +421,6 @@ BOOL LoadLevelGraphics(UBYTE LevelNumber)
|
|||
/* Initialise the display system */
|
||||
BOOL dispInitialise(void)
|
||||
{
|
||||
/* UBYTE *pFileData, *pImageData;
|
||||
UDWORD fileSize, width,height;
|
||||
UDWORD i;*/
|
||||
|
||||
|
||||
/* Build the transparency table that's
|
||||
used for the rgb filter rectangle plotter in ivis */
|
||||
iV_SetTransFilter(TRANS_BLUE,0); // set the table.
|
||||
iV_SetTransFilter(TRANS_BRITE,1); // set the other table.
|
||||
iV_SetTransFilter(TINT_BLUE,2); // set the other other table.
|
||||
iV_SetTransFilter(TINT_DEEPBLUE,3); // set the other other table.
|
||||
|
||||
// screenSetTextColour(0xff,0xff,0xff);
|
||||
|
||||
noDrag3D = FALSE;
|
||||
RadarZoomLevel = 0;
|
||||
|
||||
|
|
|
@ -371,7 +371,7 @@ void draw3DScene( void )
|
|||
|
||||
pie_Begin3DScene();
|
||||
/* Set 3D world origins */
|
||||
pie_SetGeometricOffset((iV_SCREEN_WIDTH>>1), geoOffset);
|
||||
pie_SetGeometricOffset((rendSurface.width >> 1), geoOffset);
|
||||
|
||||
// draw sky and fogbox
|
||||
renderSurroundings();
|
||||
|
|
|
@ -1163,7 +1163,7 @@ BOOL frontendInitialise(const char *ResourceFile)
|
|||
}
|
||||
#endif
|
||||
|
||||
FrontImages = (IMAGEFILE*)resGetData("IMG","frend.img");
|
||||
FrontImages = (IMAGEFILE*)resGetData("IMG", "frend.img");
|
||||
FEFont = iV_CreateFontIndirect(FrontImages,FEAsciiLookup,4);
|
||||
|
||||
/* Shift the interface initialisation here temporarily so that it
|
||||
|
|
|
@ -239,7 +239,7 @@ TABDEF SmallTab = {
|
|||
//
|
||||
BOOL imageInitBitmaps(void)
|
||||
{
|
||||
IntImages = (IMAGEFILE*)resGetData("IMG","intfac.img");
|
||||
IntImages = (IMAGEFILE*)resGetData("IMG", "intfac.img");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#include "scripttabs.h"
|
||||
#include "scriptextern.h"
|
||||
|
||||
#include "lib/ivis_common/rendfunc.h"
|
||||
#include "display.h"
|
||||
|
||||
#include "multiplay.h"
|
||||
|
@ -111,8 +110,7 @@ BOOL scrGenExternGet(UDWORD index)
|
|||
break;
|
||||
case EXTID_CURSOR:
|
||||
type = VAL_INT;
|
||||
scrFunctionResult.v.ival = iV_GetMouseFrame(); // from rendfunc.c
|
||||
// DBPRINTF(("CURSOR = %d val\n",val));
|
||||
scrFunctionResult.v.ival = 0; // FIXME Set to 0 since function returned undef value
|
||||
break;
|
||||
case EXTID_INTMODE:
|
||||
type=VAL_INT;
|
||||
|
@ -220,6 +218,3 @@ BOOL scrGenExternSet(UDWORD index)
|
|||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue