Removed/disabled some unused code.

Readded second pass specular drawing.

Fixed particle drawing (lights had mysteriously stopped showing up for a
while).
This commit is contained in:
Steven Fuller 2001-08-18 01:04:24 +00:00 committed by Patryk Obara
parent c7f0dd737a
commit c12ec5ff7e
10 changed files with 163 additions and 394 deletions

View file

@ -37,7 +37,7 @@ void EmptyCDTrackList()
}
}
#define CDTrackFileName "CD Tracks.txt"
#define CDTrackFileName "cd tracks.txt"
static void ExtractTracksForLevel(char* & buffer,List<int> & track_list)
@ -221,4 +221,4 @@ void ResetCDPlayForLevel()
CDDA_Stop();
}
};
};

View file

@ -28,8 +28,6 @@
#include "iofocus.h"
//#include "statpane.h"
#include "font.h"
#include "hudgadg.hpp"
@ -39,7 +37,6 @@
#include "missions.hpp"
#include "rebmenus.hpp"
#include "indexfnt.hpp"
// Includes for console variables:
#include "textexp.hpp"
@ -61,10 +58,6 @@
/* Version settings ************************************************/
/* Constants *******************************************************/
#define DEFAULT_KEY_STATUS_PANEL_WEAPONS ( KEY_TAB )
#define DEFAULT_KEY_STATUS_PANEL_INVENTORY ( KEY_V )
#define DEFAULT_KEY_STATUS_PANEL_OBJECTIVES ( KEY_O )
#define DEFAULT_KEY_STATUS_PANEL_GAMESTATS ( KEY_G )
/* Macros **********************************************************/
@ -85,19 +78,6 @@
extern int bEnableTextprintXY;
extern signed int HUDTranslucencyLevel;
#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
@ -123,8 +103,6 @@
void DumpVideoMode(void);
};
static void davehook_HandleStatusPanelControls(void);
static int bFirstFrame = No;
/* Internal globals ************************************************/
@ -323,7 +301,7 @@
void DAVEHOOK_Init(void)
{
SCString* pSCString_TestLeak = new SCString("this is a test memory leak");
static SCString* pSCString_TestLeak = new SCString("this is a test memory leak");
MissionHacks :: TestInit();
@ -342,21 +320,10 @@ void DAVEHOOK_Init(void)
ConsoleCommand :: CreateAll();
#endif
#if 0//UseRebMenus
{
RebMenus :: Init();
}
#endif
}
void DAVEHOOK_UnInit(void)
{
#if 0//UseRebMenus
{
RebMenus :: UnInit();
}
#endif
IndexedFont :: UnloadFont(DATABASE_MESSAGE_FONT);
GADGET_UnInit();
@ -379,10 +346,6 @@ void DAVEHOOK_Maintain(void)
// Hacked in input support:
#if SupportWindows95
{
#if EnableStatusPanels
davehook_HandleStatusPanelControls();
#endif
#if 0
if ( KeyboardInput[ KEY_J ] )
{
@ -427,14 +390,6 @@ void DAVEHOOK_Maintain(void)
// RE_ENTRANT_QUEUE_WinMain_FlushMessages();
}
#endif // SupportWindows95
/* KJL 20:14:23 28/03/98 - for now I've disabled the calls to the menus while in-game */
#if 0//UseRebMenus
{
RebMenus :: Maintain();
RebMenus :: Render();
}
#endif
}
void DAVEHOOK_ScreenModeChange_Setup(void)
@ -446,10 +401,6 @@ void DAVEHOOK_ScreenModeChange_Cleanup(void)
R2BASE_ScreenModeChange_Cleanup();
GADGET_ScreenModeChange_Cleanup();
#if 0
LoadPFFont(MENU_FONT_1);
#endif
bFirstFrame = Yes;
// to ensure a flush without processing of messages in first frame, so as to
// avoid carriage returns/enter from menu selections triggering typing mode
@ -524,73 +475,3 @@ void Testing :: DumpVideoMode(void)
pSCString_Feedback -> SendToScreen();
pSCString_Feedback -> R_Release();
}
#if EnableStatusPanels
static void davehook_HandleStatusPanelControls(void)
{
/*
DHM 27/1/98:
------------
This code ought to be rewritten in terms of the PLAYER_INPUT_CONFIGURATION
code in USR_IO.C
I've done it as a bit of a hack here to avoid messing up people's saved
control config files, and because there's no more room on the control config
screen for redefining these keys.
It will depend on whether the status panels stay in the final version.
*/
if ( IOFOCUS_AcceptControls())
{
if
(
KeyboardInput[ DEFAULT_KEY_STATUS_PANEL_WEAPONS ]
)
{
STATPANE_RequestStatusPanel
(
I_StatusPanel_Weapons
);
return;
}
if
(
KeyboardInput[ DEFAULT_KEY_STATUS_PANEL_INVENTORY ]
)
{
STATPANE_RequestStatusPanel
(
I_StatusPanel_Inventory
);
return;
}
if
(
KeyboardInput[ DEFAULT_KEY_STATUS_PANEL_OBJECTIVES ]
)
{
STATPANE_RequestStatusPanel
(
I_StatusPanel_Objectives
);
return;
}
if
(
KeyboardInput[ DEFAULT_KEY_STATUS_PANEL_GAMESTATS ]
)
{
STATPANE_RequestStatusPanel
(
I_StatusPanel_GameStats
);
return;
}
}
STATPANE_NoRequestedPanel();
}
#endif // EnableStatusPanels

View file

@ -1,63 +0,0 @@
/*
statpane.h
Created 18/11/97 by DHM: status panels for Marine HUD
*/
#ifndef _statpane_h
#define _statpane_h 1
#ifdef __cplusplus
extern "C" {
#endif
/* Version settings *****************************************************/
/* Constants ***********************************************************/
/* Macros ***************************************************************/
/* Type definitions *****************************************************/
enum StatusPanelIndex
{
I_StatusPanel_Weapons,
// assumed to be the first
I_StatusPanel_Inventory,
I_StatusPanel_Objectives,
I_StatusPanel_GameStats,
NUM_STATUS_PANELS
}; /* suggested naming: "I_StatusPanel" */
/* Exported globals *****************************************************/
/* Function prototypes **************************************************/
void STATPANE_RequestStatusPanel
(
enum StatusPanelIndex I_StatusPanel
);
/* this should be called once per frame, or else call STATPANE_NoRequestedIndex()
Call it if the button for a panel is in a "down" state.
Currently the system has an internal order of precedence using the
enum StatusPanelIndex; the earlier entries have greater priority.
*/
void STATPANE_NoRequestedPanel(void);
/*
Makes the status panel retreats off the screen; call if none of the buttons
for selecting status panels are depressed
*/
/* End of the header ****************************************************/
#ifdef __cplusplus
};
#endif
#endif

View file

@ -122,6 +122,11 @@ extern void LoadCommonTextures(void);
****************************************************************************************KJL*/
void LoadDDGraphic(struct DDGraphicTag *DDGfxPtr, char *Filename)
{
fprintf(stderr, "LoadDDGraphic(%p, %s)\n", DDGfxPtr, Filename);
}
/****************************************
* SETTING UP THE HUD *
****************************************/
@ -137,8 +142,6 @@ void PlatformSpecificInitMarineHUD(void)
//SelectGenTexDirectory(ITI_TEXTURE);
extern unsigned char *ScreenBuffer;
/* set game mode: different, though for multiplayer game */
if(AvP.Network==I_No_Network)
cl_pszGameMode = "marine";
@ -605,6 +608,8 @@ extern void BLTMarineNumericsToHUD(enum MARINE_HUD_DIGIT digitsToDraw)
}
while(digit--);
}
#if 0 /* TODO: remove */
static void BLTDigitToHUD(char digit, int x, int y, int font)
{
// HRESULT ddrval;
@ -674,7 +679,7 @@ static void BLTDigitToHUD(char digit, int x, int y, int font)
*/
fprintf(stderr, "BLTDigitToHUD(%d, %d, %d, %d)\n", digit, x, y, font);
}
#endif
void BLTGunSightToScreen(int screenX, int screenY, enum GUNSIGHT_SHAPE gunsightShape)
@ -686,6 +691,10 @@ void BLTGunSightToScreen(int screenX, int screenY, enum GUNSIGHT_SHAPE gunsightS
}
}
#if 0 /* TODO: remove this directdraw code */
/*KJL************************
* PREDATOR DRAWING ROUTINES *
************************KJL*/
@ -1187,8 +1196,6 @@ void BLTGraphicToScreen(HUDGRAPHIC* hgptr)
/************************** FONTS *************************/
/**********************************************************/
/**********************************************************/
@ -1415,7 +1422,7 @@ int BLTFontOffsetToHUD(PFFONT* font , int xdest, int ydest, int offset)
#endif

View file

@ -43,10 +43,6 @@
#endif
#endif
#ifndef _statpane_h
#include "statpane.h"
#endif
class TextReportGadget; // fully declared in TREPGADG.HPP
// HUD Gadget is an abstract base class for 3 types of HUD; one for each species

View file

@ -1,83 +0,0 @@
/*-----------------------------Patrick 14/5/97------------------------------
Source for PC game pause stuff
--------------------------------------------------------------------------*/
#include "3dc.h"
#include "inline.h"
#include "module.h"
#include "stratdef.h"
#include "gamedef.h"
#include "gameplat.h"
#include "bh_types.h"
#include "menudefs.h"
#include "menugfx.h"
#include "pcmenus.h"
#include "usr_io.h"
#define UseLocalAssert Yes
#include "ourasert.h"
extern void CheckForGamePause(void);
extern void SaveGameToFile(void);
extern void AccessDatabase(void);
extern int ScanDrawMode;
void DoPcPause(void)
{
ReadUserInput();
ReadPlayerGameInput(Player->ObStrategyBlock);
if(AvP.Network!=I_No_Network)
{
// escape ends game for network play
AvP.MainLoopRunning = 0;
AvP.GameMode = I_GM_Playing;
return;
}
CheckForGamePause();
#if 0
FlushTextprintBuffer();
AvpShowViews();
/* KJL 11:25:33 7/29/97 - this needs to be changed if
the HUD goes all 3D accelerator drawn */
if (ScanDrawMode != ScanDrawDirectDraw)
{
WriteEndCodeToExecuteBuffer();
UnlockExecuteBufferAndPrepareForUse();
ExecuteBuffer();
EndD3DScene();
}
BLTPausedToScreen();
FlipBuffers();
#endif
AccessDatabase();
ResetFrameCounter();
AvP.GameMode = I_GM_Playing;
}
static int pauseOk = 1;
void CheckForGamePause(void)
{
/* check for pause key */
if(PlayerStatusPtr->Mvt_InputRequests.Flags.Rqst_PauseGame)
{
if(pauseOk)
{
/* switch state */
if(AvP.GameMode == I_GM_Playing) AvP.GameMode = I_GM_Paused;
else if(AvP.GameMode == I_GM_Paused) AvP.GameMode = I_GM_Playing;
pauseOk = 0;
}
}
else pauseOk = 1;
}

View file

@ -257,7 +257,6 @@ int AVP_ChangeDisplayMode
/* JH 3/6/97 - don't quit kill off the images - still keep buffers in system memory
that are not linked to direct draw */
MinimizeAllImages();
MinimizeAllDDGraphics();
ReleaseDirect3DNotDDOrImages();
finiObjectsExceptDD();

View file

@ -89,6 +89,10 @@ int InitialiseWindowsSystem()
SDL_WM_SetCaption("Aliens vs Predator", "Aliens vs Predator");
/* this is for supporting keyboard input processing with little hassle */
SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
SDL_EnableUNICODE(1); /* toggle it to ON */
/* -w will disable to first fullscreen, -f will turn it on */
// SDL_WM_ToggleFullScreen(surface);
// SDL_WM_GrabInput(SDL_GRAB_ON);
@ -105,6 +109,7 @@ int InitialiseWindowsSystem()
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glDepthRange(0.0, 1.0);
glEnable(GL_TEXTURE_2D);
@ -588,12 +593,15 @@ int main(int argc, char *argv[])
// SetLevelToLoad(AVP_ENVIRONMENT_TEMPLE); /* starting alien level */
AvP.PlayerType = I_Marine;
SetLevelToLoad(AVP_ENVIRONMENT_DERELICT); /* starting marine level */
// SetLevelToLoad(AVP_ENVIRONMENT_DERELICT); /* starting marine level */
// AvP.PlayerType = I_Predator;
// SetLevelToLoad(AVP_ENVIRONMENT_WATERFALL); /* starting predator level */
// SetLevelToLoad(AVP_ENVIRONMENT_LEADWORKS_MP); /* multiplayer */
SetLevelToLoad(AVP_ENVIRONMENT_LEADWORKS_MP); /* multiplayer */
// SetLevelToLoad(AVP_ENVIRONMENT_SUBWAY_MP);
// SetLevelToLoad(AVP_ENVIRONMENT_LEADWORKS_COOP); /* coop/skirmish */
// SetLevelToLoad(AVP_ENVIRONMENT_E3DEMOSP); /* demo level */
#endif

View file

@ -636,32 +636,6 @@ __asm__("fld fti_fptmp \n\t"
#endif
}
#if 0
int FloatToInt(float fptmp)
{
#if 1
fti_fptmp = fptmp;
/*
_asm
{
fld fptmp
fistp itmp
}
*/
__asm__("fld fti_fptmp \n\t"
"fistp fti_itmp \n\t"
:
:
: "memory", "cc"
);
return fti_itmp;
#else
return fptmp;
#endif
}
#endif
void TranslatePoint(float *source, float *dest, float *matrix)
{
// fprintf(stderr, "TranslatePoint(%f, %f, %f)\n");

View file

@ -173,32 +173,11 @@ static void DrawTriangles_T2F_C4UB_V4F()
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:
@ -208,8 +187,7 @@ static void DrawTriangles_T2F_C4UB_V4F()
OUTPUT_TRIANGLE(0, 3, 4);
case 4:
OUTPUT_TRIANGLE(0, 2, 3);
OUTPUT_TRIANGLE(0, 1, 2);
OUTPUT_TRIANGLE(0, 1, 2);
break;
default:
fprintf(stderr, "DrawTriangles_T2F_C4UB_V4F: tarr.elements = %d\n", tarr.elements);
@ -219,6 +197,96 @@ static void DrawTriangles_T2F_C4UB_V4F()
#undef OUTPUT_TRIANGLE
#undef OUTPUT_VERTEX
}
static void DrawTriangles_T2F_V4F()
{
#define OUTPUT_VERTEX(d) \
{ \
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;
case 5:
OUTPUT_TRIANGLE(0, 1, 4);
OUTPUT_TRIANGLE(1, 3, 4);
OUTPUT_TRIANGLE(1, 2, 3);
break;
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_V4F: tarr.elements = %d\n", tarr.elements);
}
glEnd();
#undef OUTPUT_TRIANGLE
#undef OUTPUT_VERTEX
}
static void DrawTriangles_C4UB_V4F()
{
#define OUTPUT_VERTEX(d) \
{ \
glColor4ubv (&tarr.c[(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;
case 5:
OUTPUT_TRIANGLE(0, 1, 4);
OUTPUT_TRIANGLE(1, 3, 4);
OUTPUT_TRIANGLE(1, 2, 3);
break;
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_C4UB_V4F: tarr.elements = %d\n", tarr.elements);
}
glEnd();
#undef OUTPUT_TRIANGLE
#undef OUTPUT_VERTEX
}
static void SelectPolygonBeginType(int points)
{
@ -355,6 +423,8 @@ void D3D_ZBufferedGouraudTexturedPolygon_Output(POLYHEADER *inputPolyPtr, RENDER
texoffset = inputPolyPtr->PolyColour & ClrTxDefn;
if (texoffset) {
TextureHandle = (void *)ImageHeaderArray[texoffset].D3DTexture;
CurrTextureHandle = TextureHandle;
} else {
TextureHandle = CurrTextureHandle;
}
@ -366,7 +436,6 @@ void D3D_ZBufferedGouraudTexturedPolygon_Output(POLYHEADER *inputPolyPtr, RENDER
CheckBoundTextureIsCorrect(TextureHandle->id);
// SelectPolygonBeginType(RenderPolygon.NumberOfVertices);
for (i = 0; i < RenderPolygon.NumberOfVertices; i++) {
RENDERVERTEX *vertices = &renderVerticesPtr[i];
GLfloat x, y, z;
@ -379,10 +448,10 @@ void D3D_ZBufferedGouraudTexturedPolygon_Output(POLYHEADER *inputPolyPtr, RENDER
// 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) {
@ -394,29 +463,16 @@ void D3D_ZBufferedGouraudTexturedPolygon_Output(POLYHEADER *inputPolyPtr, RENDER
} 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;
x = (x - (float)ScreenDescriptorBlock.SDB_CentreX - 0.5f) / ((float)ScreenDescriptorBlock.SDB_CentreX - 0.5f);
y = -(y - (float)ScreenDescriptorBlock.SDB_CentreY - 0.5f) / ((float)ScreenDescriptorBlock.SDB_CentreY - 0.5f);
zvalue = vertices->Z+HeadUpDisplayZOffset;
z = 1.0 - 2*ZNear/zvalue;
#if 0
glColor4ub(GammaValues[vertices->R], GammaValues[vertices->G], GammaValues[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;
@ -431,12 +487,23 @@ void D3D_ZBufferedGouraudTexturedPolygon_Output(POLYHEADER *inputPolyPtr, RENDER
tarr.c[4*i+2] = GammaValues[vertices->B];
tarr.c[4*i+3] = vertices->A;
}
// glEnd();
tarr.elements = RenderPolygon.NumberOfVertices;
DrawTriangles_T2F_C4UB_V4F();
CheckBoundTextureIsCorrect(0);
CurrTextureHandle = TextureHandle;
CheckTranslucencyModeIsCorrect(TRANSLUCENCY_GLOWING);
for (i = 0; i < RenderPolygon.NumberOfVertices; i++) {
RENDERVERTEX *vertices = &renderVerticesPtr[i];
tarr.c[4*i+0] = GammaValues[vertices->SpecularR];
tarr.c[4*i+1] = GammaValues[vertices->SpecularG];
tarr.c[4*i+2] = GammaValues[vertices->SpecularB];
tarr.c[4*i+3] = 255;
}
DrawTriangles_C4UB_V4F();
}
void D3D_SkyPolygon_Output(POLYHEADER *inputPolyPtr, RENDERVERTEX *renderVerticesPtr)
@ -447,7 +514,6 @@ void D3D_SkyPolygon_Output(POLYHEADER *inputPolyPtr, RENDERVERTEX *renderVertice
GLfloat ZNear;
float RecipW, RecipH;
ZNear = (GLfloat) (Global_VDB_Ptr->VDB_ClipZ * GlobalScale);
texoffset = inputPolyPtr->PolyColour & ClrTxDefn;
@ -464,7 +530,6 @@ void D3D_SkyPolygon_Output(POLYHEADER *inputPolyPtr, RENDERVERTEX *renderVertice
CheckBoundTextureIsCorrect(TextureHandle->id);
// SelectPolygonBeginType(RenderPolygon.NumberOfVertices);
for (i = 0; i < RenderPolygon.NumberOfVertices; i++) {
RENDERVERTEX *vertices = &renderVerticesPtr[i];
GLfloat x, y, z;
@ -480,7 +545,7 @@ void D3D_SkyPolygon_Output(POLYHEADER *inputPolyPtr, RENDERVERTEX *renderVertice
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 1
if (x1<Global_VDB_Ptr->VDB_ClipLeft) {
x1=Global_VDB_Ptr->VDB_ClipLeft;
} else if (x1>Global_VDB_Ptr->VDB_ClipRight) {
@ -503,18 +568,6 @@ void D3D_SkyPolygon_Output(POLYHEADER *inputPolyPtr, RENDERVERTEX *renderVertice
// 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;
@ -528,7 +581,6 @@ void D3D_SkyPolygon_Output(POLYHEADER *inputPolyPtr, RENDERVERTEX *renderVertice
tarr.c[4*i+2] = vertices->B;
tarr.c[4*i+3] = vertices->A;
}
// glEnd();
tarr.elements = RenderPolygon.NumberOfVertices;
DrawTriangles_T2F_C4UB_V4F();
@ -570,7 +622,6 @@ void D3D_ZBufferedCloakedPolygon_Output(POLYHEADER *inputPolyPtr, RENDERVERTEX *
RecipH = 1.0f / height;
}
// SelectPolygonBeginType(RenderPolygon.NumberOfVertices);
for (i = 0; i < RenderPolygon.NumberOfVertices; i++) {
RENDERVERTEX *vertices = &renderVerticesPtr[i];
@ -588,7 +639,7 @@ void D3D_ZBufferedCloakedPolygon_Output(POLYHEADER *inputPolyPtr, RENDERVERTEX *
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 1
if (x1<Global_VDB_Ptr->VDB_ClipLeft) {
x1=Global_VDB_Ptr->VDB_ClipLeft;
} else if (x1>Global_VDB_Ptr->VDB_ClipRight) {
@ -610,18 +661,6 @@ void D3D_ZBufferedCloakedPolygon_Output(POLYHEADER *inputPolyPtr, RENDERVERTEX *
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;
@ -635,7 +674,6 @@ void D3D_ZBufferedCloakedPolygon_Output(POLYHEADER *inputPolyPtr, RENDERVERTEX *
tarr.c[4*i+2] = vertices->B;
tarr.c[4*i+3] = vertices->A;
}
// glEnd();
tarr.elements = RenderPolygon.NumberOfVertices;
DrawTriangles_T2F_C4UB_V4F();
@ -655,7 +693,7 @@ void D3D_Decal_Output(DECAL *decalPtr, RENDERVERTEX *renderVerticesPtr)
int r, g, b, a;
ZNear = (float) (Global_VDB_Ptr->VDB_ClipZ * GlobalScale);
CheckTranslucencyModeIsCorrect(decalDescPtr->TranslucencyType);
if (decalPtr->DecalID == DECAL_FMV) {
@ -723,7 +761,7 @@ void D3D_Decal_Output(DECAL *decalPtr, RENDERVERTEX *renderVerticesPtr)
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 1
if (x1<Global_VDB_Ptr->VDB_ClipLeft) {
x1=Global_VDB_Ptr->VDB_ClipLeft;
} else if (x1>Global_VDB_Ptr->VDB_ClipRight) {
@ -814,7 +852,7 @@ void D3D_Particle_Output(PARTICLE *particlePtr, RENDERVERTEX *renderVerticesPtr)
g = (particlePtr->Colour >> 8) & 0xFF;
b = (particlePtr->Colour >> 16) & 0xFF;
a = (particlePtr->Colour >> 24) & 0xFF;
glColor4ub(
MUL_FIXED(intensity,r),
MUL_FIXED(intensity,g),
@ -843,7 +881,7 @@ void D3D_Particle_Output(PARTICLE *particlePtr, RENDERVERTEX *renderVerticesPtr)
glColor4ub(FastRandom()&255, FastRandom()&255, FastRandom()&255, particleDescPtr->Alpha);
}
SelectPolygonBeginType(RenderPolygon.NumberOfVertices);
// SelectPolygonBeginType(RenderPolygon.NumberOfVertices);
for (i = 0; i < RenderPolygon.NumberOfVertices; i++) {
RENDERVERTEX *vertices = &renderVerticesPtr[i];
@ -859,7 +897,7 @@ void D3D_Particle_Output(PARTICLE *particlePtr, RENDERVERTEX *renderVerticesPtr)
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 1
if (x1<Global_VDB_Ptr->VDB_ClipLeft) {
x1=Global_VDB_Ptr->VDB_ClipLeft;
} else if (x1>Global_VDB_Ptr->VDB_ClipRight) {
@ -880,22 +918,34 @@ void D3D_Particle_Output(PARTICLE *particlePtr, RENDERVERTEX *renderVerticesPtr)
y = -(y - ScreenDescriptorBlock.SDB_CentreY)/ScreenDescriptorBlock.SDB_CentreY;
if (particleDescPtr->IsDrawnInFront) {
z = -1.0f;
z = -0.999f; /* ... */
} else if (particleDescPtr->IsDrawnAtBack) {
z = 1.0f;
z = 0.999f;
} else {
z = 1.0 - 2*ZNear/((float)vertices->Z); /* currently maps [ZNear, inf) to [-1, 1], probably could be more precise with a ZFar */
z = 1.0 - 2.0*ZNear/((float)vertices->Z); /* currently maps [ZNear, inf) to [-1, 1], probably could be more precise with a ZFar */
}
#if 0
#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
#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;
}
glEnd();
// glEnd();
tarr.elements = RenderPolygon.NumberOfVertices;
DrawTriangles_T2F_V4F();
}
void D3D_PredatorThermalVisionPolygon_Output(POLYHEADER *inputPolyPtr, RENDERVERTEX *renderVerticesPtr)
@ -917,7 +967,7 @@ void D3D_PredatorThermalVisionPolygon_Output(POLYHEADER *inputPolyPtr, RENDERVER
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 1
if (x1<Global_VDB_Ptr->VDB_ClipLeft) {
x1=Global_VDB_Ptr->VDB_ClipLeft;
} else if (x1>Global_VDB_Ptr->VDB_ClipRight) {
@ -972,7 +1022,7 @@ void D3D_ZBufferedGouraudPolygon_Output(POLYHEADER *inputPolyPtr, RENDERVERTEX *
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 1
if (x1<Global_VDB_Ptr->VDB_ClipLeft) {
x1=Global_VDB_Ptr->VDB_ClipLeft;
} else if (x1>Global_VDB_Ptr->VDB_ClipRight) {