Removed more unused code.

Implemented console input.
This commit is contained in:
Steven Fuller 2001-08-18 20:04:08 +00:00 committed by Patryk Obara
parent 96a5583f3b
commit d6cb06cd9e
11 changed files with 136 additions and 1061 deletions

View file

@ -7611,893 +7611,3 @@ void RenderStarfield(void)
}
}
}
#if 0
/* KJL 17:07:52 07/11/98 - experiment! */
extern unsigned char DebouncedKeyboardInput[];
#include "dungeon\angband.h"
char array[MAX_WID+1][MAX_HGT+1];
extern cave_type cave[MAX_HGT][MAX_WID];
void RenderDungeon(void)
{
int x,y;
int maxX=MAX_WID-1,maxY=MAX_HGT-1;
static int notMade=1;
if (notMade || DebouncedKeyboardInput[KEY_G])
{
for (x=0; x<=maxX; x++)
for (y=0; y<=maxY; y++)
{
cave[y][x].feat = FEAT_WALL_OUTER;
}
generate_cave();
for (x=0; x<=maxX; x++)
for (y=0; y<=maxY; y++)
{
array[x][y] = 1;
if (cave[y][x].feat == FEAT_FLOOR)
array[x][y] = 0;
}
notMade = 0;
}
for (x=0; x<=maxX; x++)
for (y=0; y<=maxY; y++)
{
if (!array[x][y])
{
if (x>0)
{
if (array[x-1][y]) RenderWallY(x,y);
}
else
{
RenderWallY(0,y);
}
if (x<maxX)
{
if (array[x+1][y]) RenderWallY(x+1,y);
}
else
{
RenderWallY(maxX+1,y);
}
if (y>0)
{
if (array[x][y-1]) RenderWallX(x,y);
}
else
{
RenderWallX(x,0);
}
if (y<maxY)
{
if (array[x][y+1]) RenderWallX(x,y+1);
}
else
{
RenderWallX(x,maxY+1);
}
RenderFloor(x,y);
}
}
}
void RenderFloor(int x,int y)
{
int mirrorUV[]=
{
127<<16, 0,
127<<16, 127<<16,
0, 127<<16,
0, 0
};
POLYHEADER fakeHeader;
{
extern int CloudyImageNumber;
fakeHeader.PolyFlags = 0;
fakeHeader.PolyColour = CloudyImageNumber;
}
{
{
VECTORCH translatedPts[4] =
{
{0,1000, 0},
{0,1000, 1000},
{1000,1000, 1000},
{1000,1000, 0},
};
int i;
for (i=0; i<4; i++)
{
translatedPts[i].vx+=x*1000;
translatedPts[i].vz+=y*1000;
TranslatePointIntoViewspace(&translatedPts[i]);
VerticesBuffer[i].X = translatedPts[i].vx;
VerticesBuffer[i].Y = translatedPts[i].vy;
VerticesBuffer[i].Z = translatedPts[i].vz;
VerticesBuffer[i].U = mirrorUV[i*2];
VerticesBuffer[i].V = mirrorUV[i*2+1];
VerticesBuffer[i].R = 255;
VerticesBuffer[i].G = 0;
VerticesBuffer[i].B = 0;
VerticesBuffer[i].SpecularR = 0;
VerticesBuffer[i].SpecularG = 0;
VerticesBuffer[i].SpecularB = 0;
}
RenderPolygon.NumberOfVertices=4;
RenderPolygon.TranslucencyMode = TRANSLUCENCY_OFF;
}
GouraudTexturedPolygon_ClipWithZ();
if(RenderPolygon.NumberOfVertices<3) return;
GouraudTexturedPolygon_ClipWithNegativeX();
if(RenderPolygon.NumberOfVertices<3) return;
GouraudTexturedPolygon_ClipWithPositiveY();
if(RenderPolygon.NumberOfVertices<3) return;
GouraudTexturedPolygon_ClipWithNegativeY();
if(RenderPolygon.NumberOfVertices<3) return;
GouraudTexturedPolygon_ClipWithPositiveX();
if(RenderPolygon.NumberOfVertices<3) return;
D3D_ZBufferedGouraudTexturedPolygon_Output(&fakeHeader,RenderPolygon.Vertices);
}
}
void RenderWallY(int x,int y)
{
int mirrorUV[]=
{
127<<16, 0,
127<<16, 127<<16,
0, 127<<16,
0, 0
};
POLYHEADER fakeHeader;
{
extern int CloudyImageNumber;
fakeHeader.PolyFlags = 0;
fakeHeader.PolyColour = CloudyImageNumber;
}
{
{
VECTORCH translatedPts[4] =
{
{0,0, 0},
{0,0, 1000},
{0,0+ 1000, 1000},
{0,0+ 1000, 0},
};
int i;
for (i=0; i<4; i++)
{
translatedPts[i].vx+=x*1000;
translatedPts[i].vz+=y*1000;
TranslatePointIntoViewspace(&translatedPts[i]);
VerticesBuffer[i].X = translatedPts[i].vx;
VerticesBuffer[i].Y = translatedPts[i].vy;
VerticesBuffer[i].Z = translatedPts[i].vz;
VerticesBuffer[i].U = mirrorUV[i*2];
VerticesBuffer[i].V = mirrorUV[i*2+1];
VerticesBuffer[i].R = 255;
VerticesBuffer[i].G = 255;
VerticesBuffer[i].B = 255;
VerticesBuffer[i].SpecularR = 0;
VerticesBuffer[i].SpecularG = 0;
VerticesBuffer[i].SpecularB = 0;
}
RenderPolygon.NumberOfVertices=4;
RenderPolygon.TranslucencyMode = TRANSLUCENCY_OFF;
}
GouraudTexturedPolygon_ClipWithZ();
if(RenderPolygon.NumberOfVertices<3) return;
GouraudTexturedPolygon_ClipWithNegativeX();
if(RenderPolygon.NumberOfVertices<3) return;
GouraudTexturedPolygon_ClipWithPositiveY();
if(RenderPolygon.NumberOfVertices<3) return;
GouraudTexturedPolygon_ClipWithNegativeY();
if(RenderPolygon.NumberOfVertices<3) return;
GouraudTexturedPolygon_ClipWithPositiveX();
if(RenderPolygon.NumberOfVertices<3) return;
D3D_ZBufferedGouraudTexturedPolygon_Output(&fakeHeader,RenderPolygon.Vertices);
}
}
void RenderWallX(int x,int y)
{
int mirrorUV[]=
{
127<<16, 0,
127<<16, 127<<16,
0, 127<<16,
0, 0
};
POLYHEADER fakeHeader;
{
extern int CloudyImageNumber;
fakeHeader.PolyFlags = 0;
fakeHeader.PolyColour = CloudyImageNumber;
}
{
{
VECTORCH translatedPts[4] =
{
{0,0, 0},
{1000,0, 0},
{1000, 1000, 0},
{0, 1000, 0},
};
int i;
for (i=0; i<4; i++)
{
translatedPts[i].vx+=x*1000;
translatedPts[i].vz+=y*1000;
TranslatePointIntoViewspace(&translatedPts[i]);
VerticesBuffer[i].X = translatedPts[i].vx;
VerticesBuffer[i].Y = translatedPts[i].vy;
VerticesBuffer[i].Z = translatedPts[i].vz;
VerticesBuffer[i].U = mirrorUV[i*2];
VerticesBuffer[i].V = mirrorUV[i*2+1];
VerticesBuffer[i].R = 255;
VerticesBuffer[i].G = 255;
VerticesBuffer[i].B = 255;
VerticesBuffer[i].SpecularR = 0;
VerticesBuffer[i].SpecularG = 0;
VerticesBuffer[i].SpecularB = 0;
}
RenderPolygon.NumberOfVertices=4;
RenderPolygon.TranslucencyMode = TRANSLUCENCY_OFF;
}
GouraudTexturedPolygon_ClipWithZ();
if(RenderPolygon.NumberOfVertices<3) return;
GouraudTexturedPolygon_ClipWithNegativeX();
if(RenderPolygon.NumberOfVertices<3) return;
GouraudTexturedPolygon_ClipWithPositiveY();
if(RenderPolygon.NumberOfVertices<3) return;
GouraudTexturedPolygon_ClipWithNegativeY();
if(RenderPolygon.NumberOfVertices<3) return;
GouraudTexturedPolygon_ClipWithPositiveX();
if(RenderPolygon.NumberOfVertices<3) return;
D3D_ZBufferedGouraudTexturedPolygon_Output(&fakeHeader,RenderPolygon.Vertices);
}
}
#endif
#if 0
static void ZBufferedTexturedPolygon_Output(POLYHEADER *inputPolyPtr,RENDERVERTEX *renderVerticesPtr)
{
int *itemDataPtr;
itemDataPtr = AllocateItemData(IHdrSize + RenderPolygon.NumberOfVertices*5 + ITrmSize);
if(itemDataPtr)
{
POLYHEADER *outputPolyPtr = (POLYHEADER*) itemDataPtr;
struct KItem * const currentItemPtr = &KItemList[ItemCount];
currentItemPtr->PolyPtr = outputPolyPtr;
{
int maxZ = smallint;
int minZ = bigint;
int i = RenderPolygon.NumberOfVertices;
RENDERVERTEX *vertices = renderVerticesPtr;
do
{
int z = vertices->Z;
if(z > maxZ) maxZ = z;
if(z < minZ) minZ = z;
vertices++;
}
while(--i);
if (inputPolyPtr->PolyFlags & iflag_sortnearz) currentItemPtr->SortKey = minZ;
else if (inputPolyPtr->PolyFlags & iflag_sortfarz) currentItemPtr->SortKey = maxZ +10;
else currentItemPtr->SortKey = maxZ;
}
ItemCount++;
/* Write out the Item Header */
outputPolyPtr->PolyItemType = I_ZB_2dTexturedPolygon;
outputPolyPtr->PolyNormalIndex = inputPolyPtr->PolyNormalIndex;
outputPolyPtr->PolyFlags = inputPolyPtr->PolyFlags;
if(Global_ShapeNormals)
outputPolyPtr->PolyColour = OldLightingModelForFlatShading((int *)inputPolyPtr);
else
outputPolyPtr->PolyColour = 0;
/* Write out the Item Points Array */
{
int i = RenderPolygon.NumberOfVertices;
RENDERVERTEX *vertices = renderVerticesPtr;
itemDataPtr = &outputPolyPtr->Poly1stPt;
do
{
*itemDataPtr++ = ProjectedAndClampedX(vertices);
*itemDataPtr++ = ProjectedAndClampedY(vertices);
*itemDataPtr++ = vertices->U;
*itemDataPtr++ = vertices->V;
{
float *fDataPtr = (float*)itemDataPtr;
*fDataPtr = 1.0/((float)(vertices->Z));
itemDataPtr++;
}
vertices++;
}
while(--i);
}
/* Write out the Item Terminator */
*itemDataPtr = Term;
}
}
/* TEXTURED POLYGONS */
static void TexturedPolygon_Construct(POLYHEADER *polyPtr)
{
int *texture_defn_ptr;
RENDERVERTEX *renderVerticesPtr = VerticesBuffer;
int i = RenderPolygon.NumberOfVertices;
/* get ptr to uv coords for this polygon */
{
int texture_defn_index = (polyPtr->PolyColour >> TxDefn);
texture_defn_ptr = Global_ShapeTextures[texture_defn_index];
}
VertexNumberPtr = &polyPtr->Poly1stPt;
/* If this texture is animated the UV array must be calculated */
if(polyPtr->PolyFlags & iflag_txanim)
{
/* Create the UV array */
int uv_array[maxpolypts * 2];
CreateTxAnimUVArray(texture_defn_ptr, uv_array, (int*)polyPtr);
texture_defn_ptr = uv_array;
do
{
renderVerticesPtr->X = RotatedPts[*VertexNumberPtr].vx;
renderVerticesPtr->Y = RotatedPts[*VertexNumberPtr].vy;
renderVerticesPtr->Z = RotatedPts[*VertexNumberPtr].vz;
renderVerticesPtr->U = texture_defn_ptr[0];
renderVerticesPtr->V = texture_defn_ptr[1];
renderVerticesPtr++;
VertexNumberPtr++;
texture_defn_ptr += 2;
}
while(--i);
}
else
{
do
{
renderVerticesPtr->X = RotatedPts[*VertexNumberPtr].vx;
renderVerticesPtr->Y = RotatedPts[*VertexNumberPtr].vy;
renderVerticesPtr->Z = RotatedPts[*VertexNumberPtr].vz;
renderVerticesPtr->U = texture_defn_ptr[0] << 16;
renderVerticesPtr->V = texture_defn_ptr[1] << 16;
renderVerticesPtr++;
VertexNumberPtr++;
texture_defn_ptr += 2;
}
while(--i);
}
}
static void TexturedPolygon_Output(POLYHEADER *inputPolyPtr, RENDERVERTEX *renderVerticesPtr)
{
int *itemDataPtr;
itemDataPtr = AllocateItemData(IHdrSize + RenderPolygon.NumberOfVertices*4 + ITrmSize);
if(itemDataPtr)
{
POLYHEADER *outputPolyPtr = (POLYHEADER*) itemDataPtr;
struct KItem * const currentItemPtr = &KItemList[ItemCount];
currentItemPtr->PolyPtr = outputPolyPtr;
{
int maxZ = smallint;
int minZ = bigint;
int i = RenderPolygon.NumberOfVertices;
RENDERVERTEX *vertices = renderVerticesPtr;
do
{
int z = vertices->Z;
if(z > maxZ) maxZ = z;
if(z < minZ) minZ = z;
vertices++;
}
while(--i);
if (inputPolyPtr->PolyFlags & iflag_sortnearz) currentItemPtr->SortKey = minZ;
else if (inputPolyPtr->PolyFlags & iflag_sortfarz) currentItemPtr->SortKey = maxZ +10;
else currentItemPtr->SortKey = maxZ;
}
ItemCount++;
/* Write out the Item Header */
outputPolyPtr->PolyItemType = I_2dTexturedPolygon;
outputPolyPtr->PolyNormalIndex = inputPolyPtr->PolyNormalIndex;
outputPolyPtr->PolyFlags = inputPolyPtr->PolyFlags;
if(Global_ShapeNormals)
outputPolyPtr->PolyColour = OldLightingModelForFlatShading((int *)inputPolyPtr);
else
outputPolyPtr->PolyColour = 0;
/* Write out the Item Points Array */
{
int i = RenderPolygon.NumberOfVertices;
RENDERVERTEX *vertices = renderVerticesPtr;
itemDataPtr = &outputPolyPtr->Poly1stPt;
do
{
*itemDataPtr++ = ProjectedAndClampedX(vertices);
*itemDataPtr++ = ProjectedAndClampedY(vertices);
*itemDataPtr++ = vertices->U;
*itemDataPtr++ = vertices->V;
vertices++;
}
while(--i);
}
/* Write out the Item Terminator */
*itemDataPtr = Term;
}
}
static void ZBufferedGouraudTexturedPolygon_Output(POLYHEADER *inputPolyPtr,RENDERVERTEX *renderVerticesPtr)
{
POLYHEADER *outputPolyPtr;
int *itemDataPtr;
struct KItem * const currentItemPtr = &KItemList[ItemCount];
{
int maxZ = smallint;
int minZ = bigint;
int i = RenderPolygon.NumberOfVertices;
RENDERVERTEX *vertices = renderVerticesPtr;
do
{
int z = vertices->Z;
if(z > maxZ) maxZ = z;
if(z < minZ) minZ = z;
vertices++;
}
while(--i);
if (inputPolyPtr->PolyFlags & iflag_sortnearz) currentItemPtr->SortKey = minZ;
else if (inputPolyPtr->PolyFlags & iflag_sortfarz) currentItemPtr->SortKey = maxZ +10;
else currentItemPtr->SortKey = maxZ;
}
/* draw in 3d */
{
itemDataPtr = AllocateItemData(IHdrSize + RenderPolygon.NumberOfVertices*6 + ITrmSize);
outputPolyPtr = (POLYHEADER*) itemDataPtr;
/* Write out the Item Header */
outputPolyPtr->PolyItemType = I_ZB_Gouraud3dTexturedPolygon;
/* Write out the Item Points Array */
{
int i = RenderPolygon.NumberOfVertices;
RENDERVERTEX *vertices = renderVerticesPtr;
itemDataPtr = &outputPolyPtr->Poly1stPt;
do
#if 1
{
float oneOverZ;
oneOverZ = (1.0)/vertices->Z;
{
int x = (vertices->X*(Global_VDB_Ptr->VDB_ProjX+1))/vertices->Z+Global_VDB_Ptr->VDB_CentreX;
if (x<Global_VDB_Ptr->VDB_ClipLeft)
{
x=Global_VDB_Ptr->VDB_ClipLeft;
}
else if (x>Global_VDB_Ptr->VDB_ClipRight)
{
x=Global_VDB_Ptr->VDB_ClipRight;
}
*itemDataPtr++=x;
}
{
int y = (vertices->Y*(Global_VDB_Ptr->VDB_ProjY+1))/vertices->Z+Global_VDB_Ptr->VDB_CentreY;
if (y<Global_VDB_Ptr->VDB_ClipUp)
{
y=Global_VDB_Ptr->VDB_ClipUp;
}
else if (y>Global_VDB_Ptr->VDB_ClipDown)
{
y=Global_VDB_Ptr->VDB_ClipDown;
}
*itemDataPtr++=y;
}
{
float *fDataPtr = (float*)itemDataPtr;
*fDataPtr++ = (float)(vertices->U>>16);
*fDataPtr++ = (float)(vertices->V>>16);
*fDataPtr++ = oneOverZ;
itemDataPtr = (int*)fDataPtr;
}
*itemDataPtr++ = vertices->I;
vertices++;
}
#else
{
*itemDataPtr++ = ProjectedAndClampedX(vertices);
*itemDataPtr++ = ProjectedAndClampedY(vertices);
{
float uf,vf,zf;
float *fDataPtr = (float*)itemDataPtr;
zf = (vertices->Z);
uf = vertices->U>>16;
*fDataPtr++ = uf;
vf = vertices->V>>16;
*fDataPtr++ = vf;
zf = 1.0/zf;
*fDataPtr++ = zf;
itemDataPtr = (int*)fDataPtr;
}
*itemDataPtr++ = vertices->I;
vertices++;
}
#endif
while(--i);
}
}
/* Write out the Item Terminator */
*itemDataPtr = Term;
currentItemPtr->PolyPtr = outputPolyPtr;
outputPolyPtr->PolyNormalIndex = inputPolyPtr->PolyNormalIndex;
outputPolyPtr->PolyFlags = inputPolyPtr->PolyFlags;
outputPolyPtr->PolyColour = inputPolyPtr->PolyColour;
ItemCount++;
}
static void GouraudPolygon_Output(POLYHEADER *inputPolyPtr, RENDERVERTEX *renderVerticesPtr)
{
int *itemDataPtr;
itemDataPtr = AllocateItemData(IHdrSize + RenderPolygon.NumberOfVertices*3 + ITrmSize);
if(itemDataPtr)
{
POLYHEADER *outputPolyPtr = (POLYHEADER*) itemDataPtr;
struct KItem * const currentItemPtr = &KItemList[ItemCount];
currentItemPtr->PolyPtr = outputPolyPtr;
{
int maxZ = smallint;
int minZ = bigint;
int i = RenderPolygon.NumberOfVertices;
RENDERVERTEX *vertices = renderVerticesPtr;
do
{
int z = vertices->Z;
if(z > maxZ) maxZ = z;
if(z < minZ) minZ = z;
vertices++;
}
while(--i);
if (inputPolyPtr->PolyFlags & iflag_sortnearz) currentItemPtr->SortKey = minZ;
else if (inputPolyPtr->PolyFlags & iflag_sortfarz) currentItemPtr->SortKey = maxZ +10;
else currentItemPtr->SortKey = maxZ;
}
ItemCount++;
/* Write out the Item Header */
outputPolyPtr->PolyItemType = I_GouraudPolygon;
outputPolyPtr->PolyNormalIndex = inputPolyPtr->PolyNormalIndex;
outputPolyPtr->PolyFlags = inputPolyPtr->PolyFlags;
#if 1//debug
if (inputPolyPtr->PolyItemType != I_GouraudPolygon)
{
int c = GetSin((inputPolyPtr->PolyColour>>5)&4095);
if (c<0) c=-c;
inputPolyPtr->PolyColour+=NormalFrameTime;
if (VideoModeType==VideoModeType_8) c<<=6;
{
int i = RenderPolygon.NumberOfVertices;
RENDERVERTEX *vertices = renderVerticesPtr;
do
{
vertices->I = c;
vertices++;
}
while(--i);
}
outputPolyPtr->PolyColour = 0xff;
}
else
#endif
outputPolyPtr->PolyColour = inputPolyPtr->PolyColour;
/* Write out the Item Points Array */
{
int i = RenderPolygon.NumberOfVertices;
RENDERVERTEX *vertices = renderVerticesPtr;
itemDataPtr = &outputPolyPtr->Poly1stPt;
do
{
*itemDataPtr++ = ProjectedAndClampedX(vertices);
*itemDataPtr++ = ProjectedAndClampedY(vertices);
*itemDataPtr++ = vertices->I;
vertices++;
}
while(--i);
}
/* Write out the Item Terminator */
*itemDataPtr = Term;
}
}
static void CloakedTexturedPolygon_Construct(POLYHEADER *polyPtr)
{
int cloakedU[] = { 248-8,256-8,256-8,248-8 };
int cloakedV[] = { 1,1,8,8 };
int *texture_defn_ptr;
RENDERVERTEX *renderVerticesPtr = VerticesBuffer;
int i = RenderPolygon.NumberOfVertices;
/* get ptr to uv coords for this polygon */
{
int texture_defn_index = (polyPtr->PolyColour >> TxDefn);
texture_defn_ptr = Global_ShapeTextures[texture_defn_index];
}
VertexNumberPtr = &polyPtr->Poly1stPt;
while(i--)
{
renderVerticesPtr->X = RotatedPts[*VertexNumberPtr].vx;
renderVerticesPtr->Y = RotatedPts[*VertexNumberPtr].vy;
renderVerticesPtr->Z = RotatedPts[*VertexNumberPtr].vz;
renderVerticesPtr->U = cloakedU[i];
renderVerticesPtr->V = cloakedV[i];
renderVerticesPtr++;
VertexNumberPtr++;
}
}
void GouraudTexturedPolygon_Output(POLYHEADER *inputPolyPtr,RENDERVERTEX *renderVerticesPtr)
{
POLYHEADER *outputPolyPtr;
int *itemDataPtr;
int drawIn2D;
struct KItem * const currentItemPtr = &KItemList[ItemCount];
{
int maxZ = smallint;
int minZ = bigint;
int i = RenderPolygon.NumberOfVertices;
RENDERVERTEX *vertices = renderVerticesPtr;
do
{
int z = vertices->Z;
if(z > maxZ) maxZ = z;
if(z < minZ) minZ = z;
vertices++;
}
while(--i);
if (inputPolyPtr->PolyFlags & iflag_sortnearz) currentItemPtr->SortKey = minZ;
else if (inputPolyPtr->PolyFlags & iflag_sortfarz) currentItemPtr->SortKey = maxZ +10;
else currentItemPtr->SortKey = maxZ;
drawIn2D = (maxZ*4 < minZ*5);
}
#if !Saturn
/* KJL 15:49:56 07/04/97 - draw all in 3D will become an option */
if ((ScanDrawMode == ScanDrawDirectDraw) && (drawIn2D))
#endif
{
itemDataPtr = AllocateItemData(IHdrSize + RenderPolygon.NumberOfVertices*5 + ITrmSize);
outputPolyPtr = (POLYHEADER*) itemDataPtr;
/* Write out the Item Header */
outputPolyPtr->PolyItemType = I_Gouraud2dTexturedPolygon;
/* Write out the Item Points Array */
{
int i = RenderPolygon.NumberOfVertices;
RENDERVERTEX *vertices = renderVerticesPtr;
itemDataPtr = &outputPolyPtr->Poly1stPt;
do
{
#if 1
{
int x = (vertices->X*(Global_VDB_Ptr->VDB_ProjX+1))/vertices->Z+Global_VDB_Ptr->VDB_CentreX;
if (x<Global_VDB_Ptr->VDB_ClipLeft)
{
x=Global_VDB_Ptr->VDB_ClipLeft;
}
else if (x>Global_VDB_Ptr->VDB_ClipRight)
{
x=Global_VDB_Ptr->VDB_ClipRight;
}
*itemDataPtr++=x;
}
{
int y = (vertices->Y*(Global_VDB_Ptr->VDB_ProjY+1))/vertices->Z+Global_VDB_Ptr->VDB_CentreY;
if (y<Global_VDB_Ptr->VDB_ClipUp)
{
y=Global_VDB_Ptr->VDB_ClipUp;
}
else if (y>Global_VDB_Ptr->VDB_ClipDown)
{
y=Global_VDB_Ptr->VDB_ClipDown;
}
*itemDataPtr++=y;
}
#endif
#if Saturn
*itemDataPtr++ = vertices->R;
*itemDataPtr++ = vertices->G;
*itemDataPtr++ = vertices->B;
#else
*itemDataPtr++ = vertices->U;
*itemDataPtr++ = vertices->V;
*itemDataPtr++ = vertices->I;
#endif
vertices++;
}
while(--i);
}
}
#if !Saturn
else /* draw in 3d */
{
itemDataPtr = AllocateItemData(IHdrSize + RenderPolygon.NumberOfVertices*6 + ITrmSize);
outputPolyPtr = (POLYHEADER*) itemDataPtr;
/* Write out the Item Header */
outputPolyPtr->PolyItemType = I_Gouraud3dTexturedPolygon;
/* Write out the Item Points Array */
{
int i = RenderPolygon.NumberOfVertices;
RENDERVERTEX *vertices = renderVerticesPtr;
itemDataPtr = &outputPolyPtr->Poly1stPt;
do
{
float oneOverZ,uf,vf;
uf = vertices->U>>16;
vf = vertices->V>>16;
oneOverZ = (1.0)/vertices->Z;
{
int x = (vertices->X*(Global_VDB_Ptr->VDB_ProjX+1))/vertices->Z+Global_VDB_Ptr->VDB_CentreX;
if (x<Global_VDB_Ptr->VDB_ClipLeft)
{
x=Global_VDB_Ptr->VDB_ClipLeft;
}
else if (x>Global_VDB_Ptr->VDB_ClipRight)
{
x=Global_VDB_Ptr->VDB_ClipRight;
}
*itemDataPtr++=x;
}
uf = uf*oneOverZ;
{
int y = (vertices->Y*(Global_VDB_Ptr->VDB_ProjY+1))/vertices->Z+Global_VDB_Ptr->VDB_CentreY;
if (y<Global_VDB_Ptr->VDB_ClipUp)
{
y=Global_VDB_Ptr->VDB_ClipUp;
}
else if (y>Global_VDB_Ptr->VDB_ClipDown)
{
y=Global_VDB_Ptr->VDB_ClipDown;
}
*itemDataPtr++=y;
}
vf = vf*oneOverZ;
{
float *fDataPtr = (float*)itemDataPtr;
*fDataPtr++ = uf;
*fDataPtr++ = vf;
*fDataPtr++ = oneOverZ;
itemDataPtr = (int*)fDataPtr;
}
*itemDataPtr++ = vertices->I;
vertices++;
}
while(--i);
}
}
#endif
/* Write out the Item Terminator */
*itemDataPtr = Term;
currentItemPtr->PolyPtr = outputPolyPtr;
outputPolyPtr->PolyNormalIndex = inputPolyPtr->PolyNormalIndex;
outputPolyPtr->PolyFlags = inputPolyPtr->PolyFlags;
outputPolyPtr->PolyColour = inputPolyPtr->PolyColour;
ItemCount++;
}
#endif