Implemented sky drawing and a few other routines (cloaked polygon,
rectangle, etc). Worked around a V5 DRI issue(?) by breaking up some drawing into triangles.
This commit is contained in:
parent
4e94ccc65f
commit
7460e9acd0
5 changed files with 581 additions and 231 deletions
|
@ -26,29 +26,6 @@
|
||||||
/* Imported function prototypes ************************************/
|
/* Imported function prototypes ************************************/
|
||||||
|
|
||||||
/* Imported data ***************************************************/
|
/* Imported data ***************************************************/
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern int D3DDriverMode;
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
extern OurBool DaveDebugOn;
|
|
||||||
extern FDIEXTENSIONTAG FDIET_Dummy;
|
|
||||||
extern IFEXTENSIONTAG IFET_Dummy;
|
|
||||||
extern FDIQUAD FDIQuad_WholeScreen;
|
|
||||||
extern FDIPOS FDIPos_Origin;
|
|
||||||
extern FDIPOS FDIPos_ScreenCentre;
|
|
||||||
extern IFOBJECTLOCATION IFObjLoc_Origin;
|
|
||||||
extern UncompressedGlobalPlotAtomID UGPAID_StandardNull;
|
|
||||||
extern IFCOLOUR IFColour_Dummy;
|
|
||||||
extern IFVECTOR IFVec_Zero;
|
|
||||||
#endif
|
|
||||||
#ifdef __cplusplus
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Exported globals ************************************************/
|
/* Exported globals ************************************************/
|
||||||
|
@ -77,9 +54,10 @@ r2pos r2pos :: FixP_Scale
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
void D3D_Rectangle(int x0, int y0, int x1, int y1, int r, int g, int b, int a);
|
||||||
|
};
|
||||||
|
|
||||||
// Repository for code that ought to be in D3_FUNC.CPP
|
|
||||||
#if 0
|
|
||||||
void r2rect :: AlphaFill
|
void r2rect :: AlphaFill
|
||||||
(
|
(
|
||||||
unsigned char R,
|
unsigned char R,
|
||||||
|
@ -93,140 +71,8 @@ void r2rect :: AlphaFill
|
||||||
bValidPhys()
|
bValidPhys()
|
||||||
);
|
);
|
||||||
|
|
||||||
#if 0
|
D3D_Rectangle(x0, y0, x1, y1, R, G, B, translucency);
|
||||||
float RecipW, RecipH;
|
|
||||||
|
|
||||||
// Check for textures that have not loaded properly
|
|
||||||
LOCALASSERT(TextureHandle != (D3DTEXTUREHANDLE) 0);
|
|
||||||
|
|
||||||
if(ImageHeaderArray[imageNumber].ImageWidth==128)
|
|
||||||
{
|
|
||||||
RecipW = 1.0 /128.0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
float width = (float) ImageHeaderArray[imageNumber].ImageWidth;
|
|
||||||
RecipW = (1.0 / width);
|
|
||||||
}
|
|
||||||
if(ImageHeaderArray[imageNumber].ImageHeight==128)
|
|
||||||
{
|
|
||||||
RecipH = 1.0 / 128.0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
float height = (float) ImageHeaderArray[imageNumber].ImageHeight;
|
|
||||||
RecipH = (1.0 / height);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* OUTPUT quadVerticesPtr TO EXECUTE BUFFER */
|
|
||||||
{
|
|
||||||
D3DCOLOR Colour;
|
|
||||||
|
|
||||||
switch (D3DDriverMode)
|
|
||||||
{
|
|
||||||
case D3DSoftwareRGBDriver:
|
|
||||||
{
|
|
||||||
Colour = RGBLIGHT_MAKE(R,G,B);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case D3DSoftwareRampDriver:
|
|
||||||
{
|
|
||||||
Colour = RGB_MAKE(0,0,B);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
|
||||||
case D3DHardwareRGBDriver:
|
|
||||||
{
|
|
||||||
Colour = RGBALIGHT_MAKE(R,G,B,translucency);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 1
|
|
||||||
{
|
|
||||||
D3DTLVERTEX *vertexPtr = &((LPD3DTLVERTEX)ExecuteBufferDataArea)[NumVertices];
|
|
||||||
|
|
||||||
/* Vertex 0 = Top left */
|
|
||||||
vertexPtr->sx= x0;
|
|
||||||
vertexPtr->sy= y0;
|
|
||||||
vertexPtr->color = Colour;
|
|
||||||
|
|
||||||
NumVertices++;
|
|
||||||
vertexPtr++;
|
|
||||||
|
|
||||||
/* Vertex 1 = Top right */
|
|
||||||
vertexPtr->sx=( x1 - 1);
|
|
||||||
vertexPtr->sy=( y0 );
|
|
||||||
vertexPtr->color = Colour;
|
|
||||||
|
|
||||||
NumVertices++;
|
|
||||||
vertexPtr++;
|
|
||||||
|
|
||||||
/* Vertex 2 = Bottom right */
|
|
||||||
vertexPtr->sx=( x1 - 1);
|
|
||||||
vertexPtr->sy=( y1 - 1);
|
|
||||||
vertexPtr->color = Colour;
|
|
||||||
|
|
||||||
NumVertices++;
|
|
||||||
vertexPtr++;
|
|
||||||
|
|
||||||
/* Vertex 3 = Bottom left */
|
|
||||||
vertexPtr->sx=x0;
|
|
||||||
vertexPtr->sy=( y1 - 1);
|
|
||||||
vertexPtr->color = Colour;
|
|
||||||
|
|
||||||
NumVertices++;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
int i = 4;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
D3DTLVERTEX *vertexPtr = &((LPD3DTLVERTEX)ExecuteBufferDataArea)[NumVertices];
|
|
||||||
|
|
||||||
// textprint("x %d, y %d, u %d, v %d\n",quadVerticesPtr->X,quadVerticesPtr->Y,quadVerticesPtr->U,quadVerticesPtr->V);
|
|
||||||
vertexPtr->sx=quadVerticesPtr->X;
|
|
||||||
vertexPtr->sy=quadVerticesPtr->Y;
|
|
||||||
#if 0
|
|
||||||
vertexPtr->tu = ((float)(quadVerticesPtr->U)) * RecipW;
|
|
||||||
vertexPtr->tv = ((float)(quadVerticesPtr->V)) * RecipH;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
vertexPtr->color = Colour;
|
|
||||||
}
|
|
||||||
quadVerticesPtr++;
|
|
||||||
NumVertices++;
|
|
||||||
}
|
|
||||||
while(--i);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
// set correct texture handle
|
|
||||||
if (0 != CurrTextureHandle)
|
|
||||||
{
|
|
||||||
OP_STATE_RENDER(1, ExecBufInstPtr);
|
|
||||||
STATE_DATA(D3DRENDERSTATE_TEXTUREHANDLE, 0, ExecBufInstPtr);
|
|
||||||
CurrTextureHandle = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* output triangles to execute buffer */
|
|
||||||
OP_TRIANGLE_LIST(2, ExecBufInstPtr);
|
|
||||||
OUTPUT_TRIANGLE(0,1,3, 4);
|
|
||||||
OUTPUT_TRIANGLE(1,2,3, 4);
|
|
||||||
|
|
||||||
/* check to see if buffer is getting full */
|
|
||||||
if (NumVertices > (MaxD3DVertices-12))
|
|
||||||
{
|
|
||||||
WriteEndCodeToExecuteBuffer();
|
|
||||||
UnlockExecuteBufferAndPrepareForUse();
|
|
||||||
ExecuteBuffer();
|
|
||||||
LockExecuteBuffer();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
r2pos operator+ ( const r2pos& R2Pos_1, const r2pos& R2Pos_2 )
|
r2pos operator+ ( const r2pos& R2Pos_1, const r2pos& R2Pos_2 )
|
||||||
{
|
{
|
||||||
|
|
23
src/main.c
23
src/main.c
|
@ -44,6 +44,8 @@ extern int NormalFrameTime;
|
||||||
|
|
||||||
static SDL_Surface *surface;
|
static SDL_Surface *surface;
|
||||||
|
|
||||||
|
/* ** */
|
||||||
|
|
||||||
void DirectReadKeyboard()
|
void DirectReadKeyboard()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -56,6 +58,8 @@ void ReadJoysticks()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ** */
|
||||||
|
|
||||||
PROCESSORTYPES ReadProcessorType()
|
PROCESSORTYPES ReadProcessorType()
|
||||||
{
|
{
|
||||||
return PType_PentiumMMX;
|
return PType_PentiumMMX;
|
||||||
|
@ -104,6 +108,10 @@ int InitialiseWindowsSystem()
|
||||||
|
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
|
|
||||||
|
glPolygonMode(GL_FRONT, GL_FILL);
|
||||||
|
glPolygonMode(GL_BACK, GL_FILL);
|
||||||
|
glDisable(GL_CULL_FACE);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
|
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
|
||||||
*/
|
*/
|
||||||
|
@ -483,16 +491,11 @@ void FlipBuffers()
|
||||||
|
|
||||||
void ThisFramesRenderingHasBegun()
|
void ThisFramesRenderingHasBegun()
|
||||||
{
|
{
|
||||||
/* fprintf(stderr, "ThisFramesRenderingHasBegun()\n"); */
|
/* sets scene defaults */
|
||||||
|
|
||||||
/* TODO: this should be in D3D_DrawBackdrop */
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThisFramesRenderingHasFinished()
|
void ThisFramesRenderingHasFinished()
|
||||||
{
|
{
|
||||||
/* fprintf(stderr, "ThisFramesRenderingHasFinished()\n"); */
|
|
||||||
|
|
||||||
/* This is where the queued drawing commands' execution takes place */
|
/* This is where the queued drawing commands' execution takes place */
|
||||||
|
|
||||||
LightBlockDeallocation();
|
LightBlockDeallocation();
|
||||||
|
@ -569,13 +572,13 @@ int main(int argc, char *argv[])
|
||||||
// AvP.PlayerType = I_Alien;
|
// AvP.PlayerType = I_Alien;
|
||||||
// SetLevelToLoad(AVP_ENVIRONMENT_FERARCO); /* starting alien level */
|
// SetLevelToLoad(AVP_ENVIRONMENT_FERARCO); /* starting alien level */
|
||||||
|
|
||||||
AvP.PlayerType = I_Marine;
|
// AvP.PlayerType = I_Marine;
|
||||||
// SetLevelToLoad(AVP_ENVIRONMENT_DERELICT); /* starting marine level */
|
// SetLevelToLoad(AVP_ENVIRONMENT_DERELICT); /* starting marine level */
|
||||||
|
|
||||||
// AvP.PlayerType = I_Predator;
|
AvP.PlayerType = I_Predator;
|
||||||
// SetLevelToLoad(AVP_ENVIRONMENT_WATERFALL); /* starting predator level */
|
SetLevelToLoad(AVP_ENVIRONMENT_WATERFALL); /* starting predator level */
|
||||||
|
|
||||||
SetLevelToLoad(AVP_ENVIRONMENT_LEADWORKS_MP); /* multiplayer */
|
// SetLevelToLoad(AVP_ENVIRONMENT_LEADWORKS_MP); /* multiplayer */
|
||||||
|
|
||||||
// SetLevelToLoad(AVP_ENVIRONMENT_E3DEMOSP); /* demo level */
|
// SetLevelToLoad(AVP_ENVIRONMENT_E3DEMOSP); /* demo level */
|
||||||
|
|
||||||
|
|
584
src/opengl.c
584
src/opengl.c
|
@ -17,6 +17,8 @@
|
||||||
#include "krender.h"
|
#include "krender.h"
|
||||||
#include "kshape.h"
|
#include "kshape.h"
|
||||||
#include "prototyp.h"
|
#include "prototyp.h"
|
||||||
|
#include "bh_types.h"
|
||||||
|
#include "showcmds.h"
|
||||||
#include "d3d_hud.h"
|
#include "d3d_hud.h"
|
||||||
#include "hud_layout.h"
|
#include "hud_layout.h"
|
||||||
#include "avp_userprofile.h"
|
#include "avp_userprofile.h"
|
||||||
|
@ -30,6 +32,7 @@ extern SCREENDESCRIPTORBLOCK ScreenDescriptorBlock;
|
||||||
|
|
||||||
extern int SpecialFXImageNumber;
|
extern int SpecialFXImageNumber;
|
||||||
extern int StaticImageNumber;
|
extern int StaticImageNumber;
|
||||||
|
extern int PredatorNumbersImageNumber;
|
||||||
extern int BurningImageNumber;
|
extern int BurningImageNumber;
|
||||||
extern int HUDFontsImageNumber;
|
extern int HUDFontsImageNumber;
|
||||||
|
|
||||||
|
@ -97,24 +100,103 @@ static void CheckTranslucencyModeIsCorrect(enum TRANSLUCENCY_TYPE mode)
|
||||||
CurrentTranslucencyMode = mode;
|
CurrentTranslucencyMode = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define TA_MAXVERTICES 8
|
||||||
|
typedef struct TriangleArray
|
||||||
|
{
|
||||||
|
int elements;
|
||||||
|
|
||||||
|
GLfloat v[TA_MAXVERTICES*4];
|
||||||
|
|
||||||
|
GLfloat t[TA_MAXVERTICES*4];
|
||||||
|
|
||||||
|
GLubyte c[TA_MAXVERTICES*4];
|
||||||
|
} TriangleArray;
|
||||||
|
|
||||||
|
TriangleArray tarr;
|
||||||
|
|
||||||
|
static void DrawTriangles_T2F_C4UB_V4F()
|
||||||
|
{
|
||||||
|
|
||||||
|
#define OUTPUT_VERTEX(d) \
|
||||||
|
{ \
|
||||||
|
glColor4ubv (&tarr.c[(d) * 4]); \
|
||||||
|
glTexCoord2fv (&tarr.t[(d) * 4]); \
|
||||||
|
glVertex4fv (&tarr.v[(d) * 4]); \
|
||||||
|
}
|
||||||
|
#define OUTPUT_TRIANGLE(a, b, c) \
|
||||||
|
{ \
|
||||||
|
OUTPUT_VERTEX((a)); \
|
||||||
|
OUTPUT_VERTEX((b)); \
|
||||||
|
OUTPUT_VERTEX((c)); \
|
||||||
|
}
|
||||||
|
|
||||||
|
glBegin(GL_TRIANGLES);
|
||||||
|
switch(tarr.elements) {
|
||||||
|
case 3:
|
||||||
|
OUTPUT_TRIANGLE(0, 2, 1);
|
||||||
|
break;
|
||||||
|
#if 0
|
||||||
|
case 4:
|
||||||
|
OUTPUT_TRIANGLE(0, 1, 2);
|
||||||
|
OUTPUT_TRIANGLE(0, 2, 3);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
case 5:
|
||||||
|
OUTPUT_TRIANGLE(0, 1, 4);
|
||||||
|
OUTPUT_TRIANGLE(1, 3, 4);
|
||||||
|
OUTPUT_TRIANGLE(1, 2, 3);
|
||||||
|
break;
|
||||||
|
#if 0
|
||||||
|
case 6:
|
||||||
|
OUTPUT_TRIANGLE(0, 4, 5);
|
||||||
|
OUTPUT_TRIANGLE(0, 3, 4);
|
||||||
|
OUTPUT_TRIANGLE(0, 2, 3);
|
||||||
|
OUTPUT_TRIANGLE(0, 1, 2);
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
OUTPUT_TRIANGLE(0, 5, 6);
|
||||||
|
OUTPUT_TRIANGLE(0, 4, 5);
|
||||||
|
OUTPUT_TRIANGLE(0, 3, 4);
|
||||||
|
OUTPUT_TRIANGLE(0, 2, 3);
|
||||||
|
OUTPUT_TRIANGLE(0, 1, 2);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
case 8:
|
||||||
|
OUTPUT_TRIANGLE(0, 6, 7);
|
||||||
|
case 7:
|
||||||
|
OUTPUT_TRIANGLE(0, 5, 6);
|
||||||
|
case 6:
|
||||||
|
OUTPUT_TRIANGLE(0, 4, 5);
|
||||||
|
OUTPUT_TRIANGLE(0, 3, 4);
|
||||||
|
case 4:
|
||||||
|
OUTPUT_TRIANGLE(0, 2, 3);
|
||||||
|
OUTPUT_TRIANGLE(0, 1, 2);
|
||||||
|
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fprintf(stderr, "DrawTriangles_T2F_C4UB_V4F: tarr.elements = %d\n", tarr.elements);
|
||||||
|
}
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
#undef OUTPUT_TRIANGLE
|
||||||
|
#undef OUTPUT_VERTEX
|
||||||
|
}
|
||||||
|
|
||||||
static void SelectPolygonBeginType(int points)
|
static void SelectPolygonBeginType(int points)
|
||||||
{
|
{
|
||||||
/* switch code that uses this to a triangle only drawer */
|
|
||||||
switch(points) {
|
switch(points) {
|
||||||
case 1:
|
|
||||||
glBegin(GL_POINTS);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
glBegin(GL_LINES);
|
|
||||||
break;
|
|
||||||
case 3:
|
case 3:
|
||||||
glBegin(GL_TRIANGLES);
|
glBegin(GL_TRIANGLES);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
glBegin(GL_QUADS);
|
case 5:
|
||||||
|
case 6:
|
||||||
|
case 7:
|
||||||
|
case 8:
|
||||||
|
glBegin(GL_TRIANGLE_FAN);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
glBegin(GL_POLYGON);
|
fprintf(stderr, "SelectPolygonBeginType: points = %d\n", points);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -174,12 +256,59 @@ void D3D_DecalSystem_End()
|
||||||
|
|
||||||
/* ** */
|
/* ** */
|
||||||
|
|
||||||
|
void D3D_Rectangle(int x0, int y0, int x1, int y1, int r, int g, int b, int a)
|
||||||
|
{
|
||||||
|
GLfloat x[4], y[4];
|
||||||
|
|
||||||
|
if (y1 <= y0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CheckTranslucencyModeIsCorrect(TRANSLUCENCY_GLOWING);
|
||||||
|
CheckBoundTextureIsCorrect(0);
|
||||||
|
|
||||||
|
glColor4ub(r, g, b, a);
|
||||||
|
|
||||||
|
x[0] = x0;
|
||||||
|
x[0] = (x[0] - ScreenDescriptorBlock.SDB_CentreX)/ScreenDescriptorBlock.SDB_CentreX;
|
||||||
|
y[0] = y0;
|
||||||
|
y[0] = -(y[0] - ScreenDescriptorBlock.SDB_CentreY)/ScreenDescriptorBlock.SDB_CentreY;
|
||||||
|
|
||||||
|
x[1] = x1 - 1;
|
||||||
|
x[1] = (x[1] - ScreenDescriptorBlock.SDB_CentreX)/ScreenDescriptorBlock.SDB_CentreX;
|
||||||
|
y[1] = y0;
|
||||||
|
y[1] = -(y[1] - ScreenDescriptorBlock.SDB_CentreY)/ScreenDescriptorBlock.SDB_CentreY;
|
||||||
|
|
||||||
|
x[2] = x1 - 1;
|
||||||
|
x[2] = (x[2] - ScreenDescriptorBlock.SDB_CentreX)/ScreenDescriptorBlock.SDB_CentreX;
|
||||||
|
y[2] = y1 - 1;
|
||||||
|
y[2] = -(y[2] - ScreenDescriptorBlock.SDB_CentreY)/ScreenDescriptorBlock.SDB_CentreY;
|
||||||
|
|
||||||
|
x[3] = x0;
|
||||||
|
x[3] = (x[3] - ScreenDescriptorBlock.SDB_CentreX)/ScreenDescriptorBlock.SDB_CentreX;
|
||||||
|
y[3] = y1 - 1;
|
||||||
|
y[3] = -(y[3] - ScreenDescriptorBlock.SDB_CentreY)/ScreenDescriptorBlock.SDB_CentreY;
|
||||||
|
|
||||||
|
SelectPolygonBeginType(3); /* triangles */
|
||||||
|
|
||||||
|
glVertex3f(x[0], y[0], -1.0f);
|
||||||
|
glVertex3f(x[1], y[1], -1.0f);
|
||||||
|
glVertex3f(x[3], y[3], -1.0f);
|
||||||
|
|
||||||
|
glVertex3f(x[1], y[1], -1.0f);
|
||||||
|
glVertex3f(x[2], y[2], -1.0f);
|
||||||
|
glVertex3f(x[3], y[3], -1.0f);
|
||||||
|
|
||||||
|
glEnd();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ** */
|
||||||
|
|
||||||
void D3D_ZBufferedGouraudTexturedPolygon_Output(POLYHEADER *inputPolyPtr, RENDERVERTEX *renderVerticesPtr)
|
void D3D_ZBufferedGouraudTexturedPolygon_Output(POLYHEADER *inputPolyPtr, RENDERVERTEX *renderVerticesPtr)
|
||||||
{
|
{
|
||||||
int texoffset;
|
int texoffset;
|
||||||
D3DTexture *TextureHandle;
|
D3DTexture *TextureHandle;
|
||||||
int i;
|
int i;
|
||||||
GLfloat ZNear, zvalue;
|
GLfloat ZNear;
|
||||||
float RecipW, RecipH;
|
float RecipW, RecipH;
|
||||||
|
|
||||||
|
|
||||||
|
@ -199,14 +328,13 @@ void D3D_ZBufferedGouraudTexturedPolygon_Output(POLYHEADER *inputPolyPtr, RENDER
|
||||||
|
|
||||||
CheckBoundTextureIsCorrect(TextureHandle->id);
|
CheckBoundTextureIsCorrect(TextureHandle->id);
|
||||||
|
|
||||||
// glBegin(GL_POLYGON);
|
// SelectPolygonBeginType(RenderPolygon.NumberOfVertices);
|
||||||
SelectPolygonBeginType(RenderPolygon.NumberOfVertices);
|
|
||||||
for (i = 0; i < RenderPolygon.NumberOfVertices; i++) {
|
for (i = 0; i < RenderPolygon.NumberOfVertices; i++) {
|
||||||
RENDERVERTEX *vertices = &renderVerticesPtr[i];
|
RENDERVERTEX *vertices = &renderVerticesPtr[i];
|
||||||
GLfloat x, y, z;
|
GLfloat x, y, z;
|
||||||
int x1, y1;
|
int x1, y1;
|
||||||
GLfloat s, t;
|
GLfloat s, t;
|
||||||
GLfloat rhw = 1.0/(float)vertices->Z;
|
GLfloat rhw = 1.0/(float)vertices->Z, zvalue;
|
||||||
|
|
||||||
s = ((float)vertices->U) * RecipW + (1.0f/256.0f);
|
s = ((float)vertices->U) * RecipW + (1.0f/256.0f);
|
||||||
t = ((float)vertices->V) * RecipH + (1.0f/256.0f);
|
t = ((float)vertices->V) * RecipH + (1.0f/256.0f);
|
||||||
|
@ -216,7 +344,6 @@ void D3D_ZBufferedGouraudTexturedPolygon_Output(POLYHEADER *inputPolyPtr, RENDER
|
||||||
|
|
||||||
x1 = (vertices->X*(Global_VDB_Ptr->VDB_ProjX+1))/vertices->Z+Global_VDB_Ptr->VDB_CentreX;
|
x1 = (vertices->X*(Global_VDB_Ptr->VDB_ProjX+1))/vertices->Z+Global_VDB_Ptr->VDB_CentreX;
|
||||||
y1 = (vertices->Y*(Global_VDB_Ptr->VDB_ProjY+1))/vertices->Z+Global_VDB_Ptr->VDB_CentreY;
|
y1 = (vertices->Y*(Global_VDB_Ptr->VDB_ProjY+1))/vertices->Z+Global_VDB_Ptr->VDB_CentreY;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (x1<Global_VDB_Ptr->VDB_ClipLeft) {
|
if (x1<Global_VDB_Ptr->VDB_ClipLeft) {
|
||||||
x1=Global_VDB_Ptr->VDB_ClipLeft;
|
x1=Global_VDB_Ptr->VDB_ClipLeft;
|
||||||
|
@ -239,6 +366,7 @@ void D3D_ZBufferedGouraudTexturedPolygon_Output(POLYHEADER *inputPolyPtr, RENDER
|
||||||
zvalue = vertices->Z+HeadUpDisplayZOffset;
|
zvalue = vertices->Z+HeadUpDisplayZOffset;
|
||||||
z = 1.0 - 2*ZNear/zvalue;
|
z = 1.0 - 2*ZNear/zvalue;
|
||||||
|
|
||||||
|
#if 0
|
||||||
glColor4ub(GammaValues[vertices->R], GammaValues[vertices->G], GammaValues[vertices->B], vertices->A);
|
glColor4ub(GammaValues[vertices->R], GammaValues[vertices->G], GammaValues[vertices->B], vertices->A);
|
||||||
|
|
||||||
/* they both work. */
|
/* they both work. */
|
||||||
|
@ -250,8 +378,229 @@ void D3D_ZBufferedGouraudTexturedPolygon_Output(POLYHEADER *inputPolyPtr, RENDER
|
||||||
glVertex4f(x/rhw, y/rhw, z/rhw, 1/rhw);
|
glVertex4f(x/rhw, y/rhw, z/rhw, 1/rhw);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
tarr.v[4*i+0] = x/rhw;
|
||||||
|
tarr.v[4*i+1] = y/rhw;
|
||||||
|
tarr.v[4*i+2] = z/rhw;
|
||||||
|
tarr.v[4*i+3] = 1/rhw;
|
||||||
|
|
||||||
|
tarr.t[4*i+0] = s;
|
||||||
|
tarr.t[4*i+1] = t;
|
||||||
|
|
||||||
|
tarr.c[4*i+0] = GammaValues[vertices->R];
|
||||||
|
tarr.c[4*i+1] = GammaValues[vertices->G];
|
||||||
|
tarr.c[4*i+2] = GammaValues[vertices->B];
|
||||||
|
tarr.c[4*i+3] = vertices->A;
|
||||||
}
|
}
|
||||||
glEnd();
|
// glEnd();
|
||||||
|
|
||||||
|
tarr.elements = RenderPolygon.NumberOfVertices;
|
||||||
|
DrawTriangles_T2F_C4UB_V4F();
|
||||||
|
|
||||||
|
CurrTextureHandle = TextureHandle;
|
||||||
|
}
|
||||||
|
|
||||||
|
void D3D_SkyPolygon_Output(POLYHEADER *inputPolyPtr, RENDERVERTEX *renderVerticesPtr)
|
||||||
|
{
|
||||||
|
int texoffset;
|
||||||
|
D3DTexture *TextureHandle;
|
||||||
|
int i;
|
||||||
|
GLfloat ZNear;
|
||||||
|
float RecipW, RecipH;
|
||||||
|
|
||||||
|
|
||||||
|
ZNear = (GLfloat) (Global_VDB_Ptr->VDB_ClipZ * GlobalScale);
|
||||||
|
|
||||||
|
texoffset = inputPolyPtr->PolyColour & ClrTxDefn;
|
||||||
|
if (texoffset) {
|
||||||
|
TextureHandle = (void *)ImageHeaderArray[texoffset].D3DTexture;
|
||||||
|
} else {
|
||||||
|
TextureHandle = CurrTextureHandle;
|
||||||
|
}
|
||||||
|
|
||||||
|
CheckTranslucencyModeIsCorrect(RenderPolygon.TranslucencyMode);
|
||||||
|
|
||||||
|
RecipW = (1.0f/65536.0f)/128.0f;
|
||||||
|
RecipH = (1.0f/65536.0f)/128.0f;
|
||||||
|
|
||||||
|
CheckBoundTextureIsCorrect(TextureHandle->id);
|
||||||
|
|
||||||
|
// SelectPolygonBeginType(RenderPolygon.NumberOfVertices);
|
||||||
|
for (i = 0; i < RenderPolygon.NumberOfVertices; i++) {
|
||||||
|
RENDERVERTEX *vertices = &renderVerticesPtr[i];
|
||||||
|
GLfloat x, y, z;
|
||||||
|
int x1, y1;
|
||||||
|
GLfloat s, t;
|
||||||
|
GLfloat rhw = 1.0/(float)vertices->Z;
|
||||||
|
|
||||||
|
s = ((float)vertices->U) * RecipW + (1.0f/256.0f);
|
||||||
|
t = ((float)vertices->V) * RecipH + (1.0f/256.0f);
|
||||||
|
|
||||||
|
// if (s < 0.0 || t < 0.0 || s >= 1.0 || t >= 1.0)
|
||||||
|
// fprintf(stderr, "HEY! s = %f, t = %f (%d, %d)\n", s, t, vertices->U, vertices->V);
|
||||||
|
|
||||||
|
x1 = (vertices->X*(Global_VDB_Ptr->VDB_ProjX+1))/vertices->Z+Global_VDB_Ptr->VDB_CentreX;
|
||||||
|
y1 = (vertices->Y*(Global_VDB_Ptr->VDB_ProjY+1))/vertices->Z+Global_VDB_Ptr->VDB_CentreY;
|
||||||
|
#if 0
|
||||||
|
if (x1<Global_VDB_Ptr->VDB_ClipLeft) {
|
||||||
|
x1=Global_VDB_Ptr->VDB_ClipLeft;
|
||||||
|
} else if (x1>Global_VDB_Ptr->VDB_ClipRight) {
|
||||||
|
x1=Global_VDB_Ptr->VDB_ClipRight;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (y1<Global_VDB_Ptr->VDB_ClipUp) {
|
||||||
|
y1=Global_VDB_Ptr->VDB_ClipUp;
|
||||||
|
} else if (y1>Global_VDB_Ptr->VDB_ClipDown) {
|
||||||
|
y1=Global_VDB_Ptr->VDB_ClipDown;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
x = x1;
|
||||||
|
y = y1;
|
||||||
|
|
||||||
|
x = (x - ScreenDescriptorBlock.SDB_CentreX)/ScreenDescriptorBlock.SDB_CentreX;
|
||||||
|
y = -(y - ScreenDescriptorBlock.SDB_CentreY)/ScreenDescriptorBlock.SDB_CentreY;
|
||||||
|
|
||||||
|
// zvalue = vertices->Z+HeadUpDisplayZOffset;
|
||||||
|
// z = 1.0 - 2*ZNear/zvalue;
|
||||||
|
z = 1.0f;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
glColor4ub(vertices->R, vertices->G, vertices->B, vertices->A);
|
||||||
|
|
||||||
|
/* they both work. */
|
||||||
|
#if 0
|
||||||
|
glTexCoord4f(s*rhw, t*rhw, 0, rhw);
|
||||||
|
glVertex3f(x, y, z);
|
||||||
|
#else
|
||||||
|
glTexCoord2f(s, t);
|
||||||
|
glVertex4f(x/rhw, y/rhw, z/rhw, 1/rhw);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
tarr.v[4*i+0] = x/rhw;
|
||||||
|
tarr.v[4*i+1] = y/rhw;
|
||||||
|
tarr.v[4*i+2] = z/rhw;
|
||||||
|
tarr.v[4*i+3] = 1/rhw;
|
||||||
|
|
||||||
|
tarr.t[4*i+0] = s;
|
||||||
|
tarr.t[4*i+1] = t;
|
||||||
|
|
||||||
|
tarr.c[4*i+0] = vertices->R;
|
||||||
|
tarr.c[4*i+1] = vertices->G;
|
||||||
|
tarr.c[4*i+2] = vertices->B;
|
||||||
|
tarr.c[4*i+3] = vertices->A;
|
||||||
|
}
|
||||||
|
// glEnd();
|
||||||
|
|
||||||
|
tarr.elements = RenderPolygon.NumberOfVertices;
|
||||||
|
DrawTriangles_T2F_C4UB_V4F();
|
||||||
|
|
||||||
|
CurrTextureHandle = TextureHandle;
|
||||||
|
}
|
||||||
|
|
||||||
|
void D3D_ZBufferedCloakedPolygon_Output(POLYHEADER *inputPolyPtr, RENDERVERTEX *renderVerticesPtr)
|
||||||
|
{
|
||||||
|
int flags;
|
||||||
|
int texoffset;
|
||||||
|
int i;
|
||||||
|
D3DTexture *TextureHandle;
|
||||||
|
|
||||||
|
float ZNear;
|
||||||
|
float RecipW, RecipH;
|
||||||
|
|
||||||
|
ZNear = (float) (Global_VDB_Ptr->VDB_ClipZ * GlobalScale);
|
||||||
|
|
||||||
|
flags = inputPolyPtr->PolyFlags;
|
||||||
|
texoffset = (inputPolyPtr->PolyColour & ClrTxDefn);
|
||||||
|
|
||||||
|
TextureHandle = ImageHeaderArray[texoffset].D3DTexture;
|
||||||
|
|
||||||
|
CheckBoundTextureIsCorrect(TextureHandle->id);
|
||||||
|
CheckTranslucencyModeIsCorrect(TRANSLUCENCY_NORMAL);
|
||||||
|
|
||||||
|
if (TextureHandle->w == 128) {
|
||||||
|
RecipW = 1.0f / 128.0f;
|
||||||
|
} else {
|
||||||
|
float width = (float) TextureHandle->w;
|
||||||
|
RecipW = 1.0f / width;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TextureHandle->h == 128) {
|
||||||
|
RecipH = 1.0f / 128.0f;
|
||||||
|
} else {
|
||||||
|
float height = (float) TextureHandle->h;
|
||||||
|
RecipH = 1.0f / height;
|
||||||
|
}
|
||||||
|
|
||||||
|
// SelectPolygonBeginType(RenderPolygon.NumberOfVertices);
|
||||||
|
for (i = 0; i < RenderPolygon.NumberOfVertices; i++) {
|
||||||
|
RENDERVERTEX *vertices = &renderVerticesPtr[i];
|
||||||
|
|
||||||
|
GLfloat x, y, z;
|
||||||
|
int x1, y1;
|
||||||
|
GLfloat s, t;
|
||||||
|
GLfloat rhw = 1.0/(float)vertices->Z;
|
||||||
|
GLfloat zvalue;
|
||||||
|
|
||||||
|
s = ((float)(vertices->U>>16)+0.5) * RecipW;
|
||||||
|
t = ((float)(vertices->V>>16)+0.5) * RecipH;
|
||||||
|
|
||||||
|
// if (s < 0.0 || t < 0.0 || s >= 1.0 || t >= 1.0)
|
||||||
|
// fprintf(stderr, "HEY! s = %f, t = %f (%d, %d)\n", s, t, vertices->U, vertices->V);
|
||||||
|
|
||||||
|
x1 = (vertices->X*(Global_VDB_Ptr->VDB_ProjX+1))/vertices->Z+Global_VDB_Ptr->VDB_CentreX;
|
||||||
|
y1 = (vertices->Y*(Global_VDB_Ptr->VDB_ProjY+1))/vertices->Z+Global_VDB_Ptr->VDB_CentreY;
|
||||||
|
#if 0
|
||||||
|
if (x1<Global_VDB_Ptr->VDB_ClipLeft) {
|
||||||
|
x1=Global_VDB_Ptr->VDB_ClipLeft;
|
||||||
|
} else if (x1>Global_VDB_Ptr->VDB_ClipRight) {
|
||||||
|
x1=Global_VDB_Ptr->VDB_ClipRight;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (y1<Global_VDB_Ptr->VDB_ClipUp) {
|
||||||
|
y1=Global_VDB_Ptr->VDB_ClipUp;
|
||||||
|
} else if (y1>Global_VDB_Ptr->VDB_ClipDown) {
|
||||||
|
y1=Global_VDB_Ptr->VDB_ClipDown;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
x = x1;
|
||||||
|
y = y1;
|
||||||
|
|
||||||
|
x = (x - ScreenDescriptorBlock.SDB_CentreX)/ScreenDescriptorBlock.SDB_CentreX;
|
||||||
|
y = -(y - ScreenDescriptorBlock.SDB_CentreY)/ScreenDescriptorBlock.SDB_CentreY;
|
||||||
|
|
||||||
|
zvalue = vertices->Z+HeadUpDisplayZOffset;
|
||||||
|
z = 1.0 - 2*ZNear/zvalue;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
glColor4ub(vertices->R, vertices->G, vertices->B, vertices->A);
|
||||||
|
|
||||||
|
/* they both work. */
|
||||||
|
#if 0
|
||||||
|
glTexCoord4f(s*rhw, t*rhw, 0, rhw);
|
||||||
|
glVertex3f(x, y, z);
|
||||||
|
#else
|
||||||
|
glTexCoord2f(s, t);
|
||||||
|
glVertex4f(x/rhw, y/rhw, z/rhw, 1/rhw);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
tarr.v[4*i+0] = x/rhw;
|
||||||
|
tarr.v[4*i+1] = y/rhw;
|
||||||
|
tarr.v[4*i+2] = z/rhw;
|
||||||
|
tarr.v[4*i+3] = 1/rhw;
|
||||||
|
|
||||||
|
tarr.t[4*i+0] = s;
|
||||||
|
tarr.t[4*i+1] = t;
|
||||||
|
|
||||||
|
tarr.c[4*i+0] = vertices->R;
|
||||||
|
tarr.c[4*i+1] = vertices->G;
|
||||||
|
tarr.c[4*i+2] = vertices->B;
|
||||||
|
tarr.c[4*i+3] = vertices->A;
|
||||||
|
}
|
||||||
|
// glEnd();
|
||||||
|
|
||||||
|
tarr.elements = RenderPolygon.NumberOfVertices;
|
||||||
|
DrawTriangles_T2F_C4UB_V4F();
|
||||||
|
|
||||||
CurrTextureHandle = TextureHandle;
|
CurrTextureHandle = TextureHandle;
|
||||||
}
|
}
|
||||||
|
@ -456,7 +805,6 @@ void D3D_Particle_Output(PARTICLE *particlePtr, RENDERVERTEX *renderVerticesPtr)
|
||||||
glColor4ub(FastRandom()&255, FastRandom()&255, FastRandom()&255, particleDescPtr->Alpha);
|
glColor4ub(FastRandom()&255, FastRandom()&255, FastRandom()&255, particleDescPtr->Alpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
//glBegin(GL_POLYGON);
|
|
||||||
SelectPolygonBeginType(RenderPolygon.NumberOfVertices);
|
SelectPolygonBeginType(RenderPolygon.NumberOfVertices);
|
||||||
for (i = 0; i < RenderPolygon.NumberOfVertices; i++) {
|
for (i = 0; i < RenderPolygon.NumberOfVertices; i++) {
|
||||||
RENDERVERTEX *vertices = &renderVerticesPtr[i];
|
RENDERVERTEX *vertices = &renderVerticesPtr[i];
|
||||||
|
@ -531,7 +879,6 @@ void D3D_PredatorThermalVisionPolygon_Output(POLYHEADER *inputPolyPtr, RENDERVER
|
||||||
|
|
||||||
x1 = (vertices->X*(Global_VDB_Ptr->VDB_ProjX+1))/vertices->Z+Global_VDB_Ptr->VDB_CentreX;
|
x1 = (vertices->X*(Global_VDB_Ptr->VDB_ProjX+1))/vertices->Z+Global_VDB_Ptr->VDB_CentreX;
|
||||||
y1 = (vertices->Y*(Global_VDB_Ptr->VDB_ProjY+1))/vertices->Z+Global_VDB_Ptr->VDB_CentreY;
|
y1 = (vertices->Y*(Global_VDB_Ptr->VDB_ProjY+1))/vertices->Z+Global_VDB_Ptr->VDB_CentreY;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (x1<Global_VDB_Ptr->VDB_ClipLeft) {
|
if (x1<Global_VDB_Ptr->VDB_ClipLeft) {
|
||||||
x1=Global_VDB_Ptr->VDB_ClipLeft;
|
x1=Global_VDB_Ptr->VDB_ClipLeft;
|
||||||
|
@ -566,6 +913,65 @@ void D3D_PredatorThermalVisionPolygon_Output(POLYHEADER *inputPolyPtr, RENDERVER
|
||||||
glEnd();
|
glEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void D3D_ZBufferedGouraudPolygon_Output(POLYHEADER *inputPolyPtr, RENDERVERTEX *renderVerticesPtr)
|
||||||
|
{
|
||||||
|
int flags, i;
|
||||||
|
float ZNear;
|
||||||
|
|
||||||
|
ZNear = (float) (Global_VDB_Ptr->VDB_ClipZ * GlobalScale);
|
||||||
|
|
||||||
|
flags = inputPolyPtr->PolyFlags;
|
||||||
|
|
||||||
|
CheckTranslucencyModeIsCorrect(RenderPolygon.TranslucencyMode);
|
||||||
|
CheckBoundTextureIsCorrect(0);
|
||||||
|
|
||||||
|
SelectPolygonBeginType(RenderPolygon.NumberOfVertices);
|
||||||
|
for (i = 0; i < RenderPolygon.NumberOfVertices; i++) {
|
||||||
|
RENDERVERTEX *vertices = &renderVerticesPtr[i];
|
||||||
|
int x1, y1;
|
||||||
|
GLfloat x, y, z;
|
||||||
|
float rhw, zvalue;
|
||||||
|
|
||||||
|
x1 = (vertices->X*(Global_VDB_Ptr->VDB_ProjX+1))/vertices->Z+Global_VDB_Ptr->VDB_CentreX;
|
||||||
|
y1 = (vertices->Y*(Global_VDB_Ptr->VDB_ProjY+1))/vertices->Z+Global_VDB_Ptr->VDB_CentreY;
|
||||||
|
#if 0
|
||||||
|
if (x1<Global_VDB_Ptr->VDB_ClipLeft) {
|
||||||
|
x1=Global_VDB_Ptr->VDB_ClipLeft;
|
||||||
|
} else if (x1>Global_VDB_Ptr->VDB_ClipRight) {
|
||||||
|
x1=Global_VDB_Ptr->VDB_ClipRight;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (y1<Global_VDB_Ptr->VDB_ClipUp) {
|
||||||
|
y1=Global_VDB_Ptr->VDB_ClipUp;
|
||||||
|
} else if (y1>Global_VDB_Ptr->VDB_ClipDown) {
|
||||||
|
y1=Global_VDB_Ptr->VDB_ClipDown;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
x = x1;
|
||||||
|
y = y1;
|
||||||
|
|
||||||
|
x = (x - ScreenDescriptorBlock.SDB_CentreX)/ScreenDescriptorBlock.SDB_CentreX;
|
||||||
|
y = -(y - ScreenDescriptorBlock.SDB_CentreY)/ScreenDescriptorBlock.SDB_CentreY;
|
||||||
|
|
||||||
|
zvalue = vertices->Z+HeadUpDisplayZOffset;
|
||||||
|
z = 1.0 - 2*ZNear/zvalue;
|
||||||
|
|
||||||
|
// zvalue = vertices->Z+HeadUpDisplayZOffset;
|
||||||
|
// zvalue = ((zvalue-ZNear)/zvalue);
|
||||||
|
|
||||||
|
rhw = 1.0/(float)vertices->Z;
|
||||||
|
|
||||||
|
if (flags & iflag_transparent)
|
||||||
|
glColor4ub(vertices->R, vertices->G, vertices->B, vertices->A);
|
||||||
|
else
|
||||||
|
glColor4ub(vertices->R, vertices->G, vertices->B, 255);
|
||||||
|
|
||||||
|
glVertex4f(x/rhw, y/rhw, z/rhw, 1/rhw);
|
||||||
|
}
|
||||||
|
glEnd();
|
||||||
|
}
|
||||||
|
|
||||||
void D3D_PlayerOnFireOverlay()
|
void D3D_PlayerOnFireOverlay()
|
||||||
{
|
{
|
||||||
int c = 128;
|
int c = 128;
|
||||||
|
@ -739,7 +1145,6 @@ void DrawNoiseOverlay(int tr)
|
||||||
CheckTranslucencyModeIsCorrect(TRANSLUCENCY_GLOWING);
|
CheckTranslucencyModeIsCorrect(TRANSLUCENCY_GLOWING);
|
||||||
// CheckFilteringModeIsCorrect(FILTERING_BILINEAR_ON);
|
// CheckFilteringModeIsCorrect(FILTERING_BILINEAR_ON);
|
||||||
CheckBoundTextureIsCorrect(tex->id);
|
CheckBoundTextureIsCorrect(tex->id);
|
||||||
// CheckDepthFuncIsCorrect(GL_ALWAYS);
|
|
||||||
glDepthFunc(GL_ALWAYS);
|
glDepthFunc(GL_ALWAYS);
|
||||||
|
|
||||||
u = FastRandom()&255;
|
u = FastRandom()&255;
|
||||||
|
@ -859,15 +1264,75 @@ void D3D_PredatorScreenInversionOverlay()
|
||||||
glVertex3f( 1.0f, -1.0f, 1.0f);
|
glVertex3f( 1.0f, -1.0f, 1.0f);
|
||||||
glVertex3f(-1.0f, 1.0f, 1.0f);
|
glVertex3f(-1.0f, 1.0f, 1.0f);
|
||||||
|
|
||||||
glVertex3f( 1.0f, -1.0f, 0.0f);
|
glVertex3f( 1.0f, -1.0f, 1.0f);
|
||||||
glVertex3f( 1.0f, 1.0f, 0.0f);
|
glVertex3f( 1.0f, 1.0f, 1.0f);
|
||||||
glVertex3f(-1.0f, 1.0f, 0.0f);
|
glVertex3f(-1.0f, 1.0f, 1.0f);
|
||||||
|
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
glDepthFunc(GL_LEQUAL);
|
glDepthFunc(GL_LEQUAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DrawScanlinesOverlay(float level)
|
||||||
|
{
|
||||||
|
D3DTexture *tex;
|
||||||
|
GLfloat x[4], y[4], s[4], t[4];
|
||||||
|
float v, size;
|
||||||
|
int c;
|
||||||
|
int a;
|
||||||
|
|
||||||
|
tex = ImageHeaderArray[PredatorNumbersImageNumber].D3DTexture;
|
||||||
|
|
||||||
|
CheckTranslucencyModeIsCorrect(TRANSLUCENCY_NORMAL);
|
||||||
|
//CheckFilteringModeIsCorrect(FILTERING_BILINEAR_ON);
|
||||||
|
CheckBoundTextureIsCorrect(tex->id);
|
||||||
|
glDepthFunc(GL_ALWAYS);
|
||||||
|
|
||||||
|
c = 255;
|
||||||
|
a = 64.0f+level*64.0f;
|
||||||
|
|
||||||
|
v = 128.0f;
|
||||||
|
size = 128.0f*(1.0f-level*0.8f);
|
||||||
|
|
||||||
|
glColor4ub(c, c, c, a);
|
||||||
|
|
||||||
|
x[0] = -1.0f;
|
||||||
|
y[0] = -1.0f;
|
||||||
|
s[0] = (v - size) / 256.0f;
|
||||||
|
t[0] = 1.0f;
|
||||||
|
x[1] = 1.0f;
|
||||||
|
y[1] = -1.0f;
|
||||||
|
s[1] = (v - size) / 256.0f;
|
||||||
|
t[1] = 1.0f;
|
||||||
|
x[2] = 1.0f;
|
||||||
|
y[2] = 1.0f;
|
||||||
|
s[2] = (v + size) / 256.0f;
|
||||||
|
t[2] = 1.0f;
|
||||||
|
x[3] = -1.0f;
|
||||||
|
y[3] = 1.0f;
|
||||||
|
s[3] = (v + size) / 256.0f;
|
||||||
|
t[3] = 1.0f;
|
||||||
|
|
||||||
|
SelectPolygonBeginType(3); /* triangles */
|
||||||
|
|
||||||
|
glTexCoord2f(s[0], t[0]);
|
||||||
|
glVertex3f(x[0], y[0], 1.0f);
|
||||||
|
glTexCoord2f(s[1], t[1]);
|
||||||
|
glVertex3f(x[1], y[1], 1.0f);
|
||||||
|
glTexCoord2f(s[3], t[3]);
|
||||||
|
glVertex3f(x[3], y[3], 1.0f);
|
||||||
|
|
||||||
|
glTexCoord2f(s[1], t[1]);
|
||||||
|
glVertex3f(x[1], y[1], 1.0f);
|
||||||
|
glTexCoord2f(s[2], t[2]);
|
||||||
|
glVertex3f(x[2], y[2], 1.0f);
|
||||||
|
glTexCoord2f(s[3], t[3]);
|
||||||
|
glVertex3f(x[3], y[3], 1.0f);
|
||||||
|
|
||||||
|
glEnd();
|
||||||
|
glDepthFunc(GL_LEQUAL);
|
||||||
|
}
|
||||||
|
|
||||||
void D3D_FadeDownScreen(int brightness, int colour)
|
void D3D_FadeDownScreen(int brightness, int colour)
|
||||||
{
|
{
|
||||||
int t, r, g, b, a;
|
int t, r, g, b, a;
|
||||||
|
@ -924,6 +1389,8 @@ void D3D_HUDQuad_Output(int imageNumber, struct VertexTag *quadVerticesPtr, unsi
|
||||||
GLfloat x[4], y[4], s[4], t[4];
|
GLfloat x[4], y[4], s[4], t[4];
|
||||||
int r, g, b, a;
|
int r, g, b, a;
|
||||||
|
|
||||||
|
/* possibly use polygon offset? (predator hud) */
|
||||||
|
|
||||||
CheckTranslucencyModeIsCorrect(TRANSLUCENCY_GLOWING);
|
CheckTranslucencyModeIsCorrect(TRANSLUCENCY_GLOWING);
|
||||||
CheckBoundTextureIsCorrect(tex->id);
|
CheckBoundTextureIsCorrect(tex->id);
|
||||||
|
|
||||||
|
@ -931,14 +1398,14 @@ void D3D_HUDQuad_Output(int imageNumber, struct VertexTag *quadVerticesPtr, unsi
|
||||||
RecipW = 1.0f / 128.0f;
|
RecipW = 1.0f / 128.0f;
|
||||||
} else {
|
} else {
|
||||||
float width = (float) tex->w;
|
float width = (float) tex->w;
|
||||||
RecipW = (1.0f / width);
|
RecipW = 1.0f / width;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tex->h == 128) {
|
if (tex->h == 128) {
|
||||||
RecipH = 1.0f / 128.0f;
|
RecipH = 1.0f / 128.0f;
|
||||||
} else {
|
} else {
|
||||||
float height = (float) tex->h;
|
float height = (float) tex->h;
|
||||||
RecipH = (1.0f / height);
|
RecipH = 1.0f / height;
|
||||||
}
|
}
|
||||||
|
|
||||||
b = (colour >> 0) & 0xFF;
|
b = (colour >> 0) & 0xFF;
|
||||||
|
@ -1027,3 +1494,74 @@ void D3D_RenderHUDNumber_Centred(unsigned int number,int x,int y,int colour)
|
||||||
|
|
||||||
} while (--noOfDigits);
|
} while (--noOfDigits);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ColourFillBackBuffer(int FillColour)
|
||||||
|
{
|
||||||
|
float r, g, b, a;
|
||||||
|
|
||||||
|
b = ((FillColour >> 0) & 0xFF) / 255.0f;
|
||||||
|
g = ((FillColour >> 8) & 0xFF) / 255.0f;
|
||||||
|
r = ((FillColour >> 16) & 0xFF) / 255.0f;
|
||||||
|
a = ((FillColour >> 24) & 0xFF) / 255.0f;
|
||||||
|
|
||||||
|
glClearColor(r, g, b, a);
|
||||||
|
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
void D3D_DrawBackdrop()
|
||||||
|
{
|
||||||
|
extern int NumActiveBlocks;
|
||||||
|
extern DISPLAYBLOCK *ActiveBlockList[];
|
||||||
|
extern MODULE *playerPherModule;
|
||||||
|
|
||||||
|
PLAYER_STATUS *playerStatusPtr;
|
||||||
|
int numOfObjects = NumActiveBlocks;
|
||||||
|
int needToDrawBackdrop = 0;
|
||||||
|
|
||||||
|
if (TRIPTASTIC_CHEATMODE||MOTIONBLUR_CHEATMODE)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (ShowDebuggingText.Tears) {
|
||||||
|
ColourFillBackBuffer((63<<5));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
while(numOfObjects--) {
|
||||||
|
DISPLAYBLOCK *objectPtr = ActiveBlockList[numOfObjects];
|
||||||
|
MODULE *modulePtr = objectPtr->ObMyModule;
|
||||||
|
|
||||||
|
if (modulePtr && (ModuleCurrVisArray[modulePtr->m_index] == 2) && modulePtr->m_flags&MODULEFLAG_SKY) {
|
||||||
|
needToDrawBackdrop = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (needToDrawBackdrop) {
|
||||||
|
extern BOOL LevelHasStars;
|
||||||
|
extern void RenderSky(void);
|
||||||
|
extern void RenderStarfield(void);
|
||||||
|
|
||||||
|
ColourFillBackBuffer(0);
|
||||||
|
|
||||||
|
if (LevelHasStars) {
|
||||||
|
RenderStarfield();
|
||||||
|
} else {
|
||||||
|
RenderSky();
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!playerPherModule) {
|
||||||
|
ColourFillBackBuffer(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
playerStatusPtr = (PLAYER_STATUS *) (Player->ObStrategyBlock->SBdataptr);
|
||||||
|
|
||||||
|
if (!playerStatusPtr->IsAlive || FREEFALL_CHEATMODE) {
|
||||||
|
ColourFillBackBuffer(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
30
src/stubs.c
30
src/stubs.c
|
@ -277,11 +277,6 @@ void InitForceField()
|
||||||
fprintf(stderr, "InitForceField()\n");
|
fprintf(stderr, "InitForceField()\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawScanlinesOverlay(float level)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "DrawScanlinesOverlay(%f)\n", level);
|
|
||||||
}
|
|
||||||
|
|
||||||
void RenderString(char *stringPtr, int x, int y, int colour)
|
void RenderString(char *stringPtr, int x, int y, int colour)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "RenderString(%s, %d, %d, %d)\n", stringPtr, x, y, colour);
|
fprintf(stderr, "RenderString(%s, %d, %d, %d)\n", stringPtr, x, y, colour);
|
||||||
|
@ -360,21 +355,6 @@ BOOL EndD3DScene()
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void D3D_ZBufferedGouraudPolygon_Output(POLYHEADER *inputPolyPtr,RENDERVERTEX *renderVerticesPtr)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "D3D_ZBufferedGouraudPolygon_Output(%p, %p)\n", inputPolyPtr, renderVerticesPtr);
|
|
||||||
}
|
|
||||||
|
|
||||||
void D3D_ZBufferedCloakedPolygon_Output(POLYHEADER *inputPolyPtr,RENDERVERTEX *renderVerticesPtr)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "D3D_ZBufferedCloakedPolygon_Output(%p, %p)\n", inputPolyPtr, renderVerticesPtr);
|
|
||||||
}
|
|
||||||
|
|
||||||
void D3D_SkyPolygon_Output(POLYHEADER *inputPolyPtr,RENDERVERTEX *renderVerticesPtr)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "D3D_SkyPolygon_Output(%p, %p)\n", inputPolyPtr, renderVerticesPtr);
|
|
||||||
}
|
|
||||||
|
|
||||||
void D3D_DrawWaterTest(MODULE *testModulePtr)
|
void D3D_DrawWaterTest(MODULE *testModulePtr)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "D3D_DrawWaterTest(%p)\n", testModulePtr);
|
fprintf(stderr, "D3D_DrawWaterTest(%p)\n", testModulePtr);
|
||||||
|
@ -390,11 +370,6 @@ void D3D_DrawCable(VECTORCH *centrePtr, MATRIXCH *orientationPtr)
|
||||||
fprintf(stderr, "D3D_DrawCable(%p, %p)\n", centrePtr, orientationPtr);
|
fprintf(stderr, "D3D_DrawCable(%p, %p)\n", centrePtr, orientationPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void D3D_DrawBackdrop()
|
|
||||||
{
|
|
||||||
fprintf(stderr, "D3D_DrawBackdrop()\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
void D3D_BackdropPolygon_Output(POLYHEADER *inputPolyPtr,RENDERVERTEX *renderVerticesPtr)
|
void D3D_BackdropPolygon_Output(POLYHEADER *inputPolyPtr,RENDERVERTEX *renderVerticesPtr)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "D3D_BackdropPolygon_Output(%p, %p)\n", inputPolyPtr, renderVerticesPtr);
|
fprintf(stderr, "D3D_BackdropPolygon_Output(%p, %p)\n", inputPolyPtr, renderVerticesPtr);
|
||||||
|
@ -421,11 +396,6 @@ void BlitWin95Char(int x, int y, unsigned char toprint)
|
||||||
fprintf(stderr, "BlitWin95Char(%d, %d, %d)\n", x, y, toprint);
|
fprintf(stderr, "BlitWin95Char(%d, %d, %d)\n", x, y, toprint);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColourFillBackBuffer(int FillColour)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "ColourFillBackBuffer(%d)\n", FillColour);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LockSurfaceAndGetBufferPointer()
|
void LockSurfaceAndGetBufferPointer()
|
||||||
{
|
{
|
||||||
fprintf(stderr, "LockSurfaceAndGetBufferPointer()\n");
|
fprintf(stderr, "LockSurfaceAndGetBufferPointer()\n");
|
||||||
|
|
|
@ -6,15 +6,8 @@
|
||||||
|
|
||||||
#include "3dc.h"
|
#include "3dc.h"
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
#include "r2base.h"
|
|
||||||
#include "indexfnt.hpp"
|
#include "indexfnt.hpp"
|
||||||
|
|
||||||
/* d3d_render.cpp */
|
|
||||||
void r2rect::AlphaFill(unsigned char R, unsigned char G, unsigned char B, unsigned char translucency) const
|
|
||||||
{
|
|
||||||
fprintf(stderr, "r2rect::AlphaFill(%d, %d, %d, %d)\n", R, G, B, translucency);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* indexfnt.cpp */
|
/* indexfnt.cpp */
|
||||||
IndexedFont* IndexedFont :: pIndexedFont[ IndexedFonts_MAX_NUMBER_OF_FONTS ];
|
IndexedFont* IndexedFont :: pIndexedFont[ IndexedFonts_MAX_NUMBER_OF_FONTS ];
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue