Removed more unused code.
Implemented console input.
This commit is contained in:
parent
96a5583f3b
commit
d6cb06cd9e
11 changed files with 136 additions and 1061 deletions
2
Makefile
2
Makefile
|
@ -13,7 +13,7 @@ AFLAGS = -g -Iinclude/ -w+macro-params -w+orphan-labels -w+number-overflow
|
|||
ROOT = main.c mathline.c math.asm net.c render.c opengl.c openal.c winapi.c stubs.c frustum.c kshape.c map.c maths.c md5.c mem3dc.c mem3dcpp.cpp module.c morph.c object.c shpanim.c sphere.c tables.c vdb.c version.c
|
||||
AVP = ai_sight.c avpview.c bh_agun.c bh_ais.c bh_alien.c bh_binsw.c bh_cable.c bh_corpse.c bh_deathvol.c bh_debri.c bh_dummy.c bh_fan.c bh_far.c bh_fhug.c bh_gener.c bh_ldoor.c bh_lift.c bh_light.c bh_lnksw.c bh_ltfx.c bh_marin.c bh_mission.c bh_near.c bh_pargen.c bh_plachier.c bh_plift.c bh_pred.c bh_queen.c bh_rubberduck.c bh_selfdest.c bh_snds.c bh_spcl.c bh_swdor.c bh_track.c bh_types.c bh_videoscreen.c bh_waypt.c bh_weap.c bh_xeno.c bonusabilities.c cconvars.cpp cdtrackselection.cpp cheatmodes.c comp_map.c comp_shp.c consolelog.cpp davehook.cpp deaths.c decal.c detaillevels.c dynamics.c dynblock.c equipmnt.c equiputl.cpp extents.c game.c game_statistics.c gamecmds.cpp gamevars.cpp hmodel.c hud.c inventry.c language.c lighting.c load_shp.c los.c maps.c mempool.c messagehistory.c missions.cpp movement.c paintball.c particle.c pfarlocs.c pheromon.c player.c pmove.c psnd.c psndproj.c pvisible.c savegame.c scream.cpp secstats.c sfx.c stratdef.c targeting.c track.c triggers.c weapons.c
|
||||
SHAPES = cube.c
|
||||
SUPPORT = consbind.cpp consbtch.cpp coordstr.cpp daemon.cpp indexfnt.cpp r2base.cpp r2pos666.cpp reflist.cpp refobj.cpp scstring.cpp strtab.cpp strutil.c trig666.cpp wrapstr.cpp
|
||||
SUPPORT = consbind.cpp consbtch.cpp coordstr.cpp daemon.cpp indexfnt.cpp r2base.cpp r2pos666.cpp reflist.cpp refobj.cpp rentrntq.cpp scstring.cpp strtab.cpp strutil.c trig666.cpp wrapstr.cpp
|
||||
AVPWIN95 = avpchunk.cpp cheat.c chtcodes.cpp d3d_hud.cpp ddplat.cpp endianio.c ffread.cpp ffstdio.cpp gammacontrol.cpp hierplace.cpp iofocus.cpp jsndsup.cpp kzsort.c langplat.c modcmds.cpp npcsetup.cpp objsetup.cpp pathchnk.cpp platsup.c pldghost.c progress_bar.cpp projload.cpp scrshot.cpp strachnk.cpp system.c usr_io.c vision.c
|
||||
FRONTEND = avp_envinfo.c avp_intro.cpp avp_menudata.c
|
||||
GADGETS = ahudgadg.cpp conscmnd.cpp conssym.cpp consvar.cpp gadget.cpp hudgadg.cpp rootgadg.cpp t_ingadg.cpp teletype.cpp textexp.cpp textin.cpp trepgadg.cpp
|
||||
|
|
|
@ -620,11 +620,7 @@ void ReflectObject(DISPLAYBLOCK *dPtr)
|
|||
void CheckIfMirroringIsRequired(void);
|
||||
void AvpShowViews(void)
|
||||
{
|
||||
#if SOFTWARE_RENDERER
|
||||
FlushSoftwareZBuffer();
|
||||
#else
|
||||
FlushD3DZBuffer();
|
||||
#endif
|
||||
|
||||
UpdateAllFMVTextures();
|
||||
|
||||
|
@ -636,11 +632,6 @@ void AvpShowViews(void)
|
|||
// GlobalAmbience=655;
|
||||
// textprint("Global Ambience: %d\n",GlobalAmbience);
|
||||
|
||||
#if PSX
|
||||
// For PSX, GlobalAmbience is used in the render files
|
||||
GlobalAmbience = Global_VDB_Ptr->VDB_Ambience >> 8;
|
||||
#endif
|
||||
|
||||
/* Prepare the View Descriptor Block for use in ShowView() */
|
||||
|
||||
PrepareVDBForShowView(Global_VDB_Ptr);
|
||||
|
@ -697,9 +688,6 @@ void AvpShowViews(void)
|
|||
/* KJL 12:13:26 02/05/97 - divert rendering for AvP */
|
||||
KRenderItems(Global_VDB_Ptr);
|
||||
}
|
||||
#if 0
|
||||
RenderDungeon();
|
||||
#endif
|
||||
|
||||
PlatformSpecificShowViewExit(Global_VDB_Ptr, &ScreenDescriptorBlock);
|
||||
|
||||
|
|
|
@ -377,7 +377,7 @@ void DAVEHOOK_Maintain(void)
|
|||
#if SupportWindows95
|
||||
if ( bFirstFrame )
|
||||
{
|
||||
// RE_ENTRANT_QUEUE_WinMain_FlushMessagesWithoutProcessing();
|
||||
RE_ENTRANT_QUEUE_WinMain_FlushMessagesWithoutProcessing();
|
||||
// this is a hack to ensure that none of the keypresses used
|
||||
// in the menu get through to the first frame of the game and
|
||||
// for example, switch to typing mode (for CR presses)
|
||||
|
@ -387,7 +387,7 @@ void DAVEHOOK_Maintain(void)
|
|||
else
|
||||
{
|
||||
// Flush the WinProc messages:
|
||||
// RE_ENTRANT_QUEUE_WinMain_FlushMessages();
|
||||
RE_ENTRANT_QUEUE_WinMain_FlushMessages();
|
||||
}
|
||||
#endif // SupportWindows95
|
||||
}
|
||||
|
@ -407,10 +407,10 @@ void DAVEHOOK_ScreenModeChange_Cleanup(void)
|
|||
|
||||
// Run program-generated batch file:
|
||||
#if !(PREDATOR_DEMO|MARINE_DEMO||ALIEN_DEMO||DEATHMATCH_DEMO)
|
||||
BatchFileProcessing :: Run("CONFIG.CFG");
|
||||
BatchFileProcessing :: Run("config.cfg");
|
||||
|
||||
// Run user-generated batch file:
|
||||
BatchFileProcessing :: Run("STARTUP.CFG");
|
||||
BatchFileProcessing :: Run("startup.cfg");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -294,22 +294,6 @@ static void MakeRotatingLight(void)
|
|||
{
|
||||
MakeLightElement(&Player->ObWorld,LIGHTELEMENT_ROTATING);
|
||||
}
|
||||
VECTORCH boing = {12345,12345,12345};
|
||||
VECTORCH boing2 = {23451,34512,45123};
|
||||
|
||||
static void Trash_Frame_Rate(void)
|
||||
{
|
||||
int i=0;
|
||||
|
||||
for (i=0; i<10000000; i++)
|
||||
{
|
||||
// Normalise(&boing);
|
||||
boing.vx += boing2.vx+FastRandom();
|
||||
boing.vy += boing2.vy;
|
||||
boing.vz += boing2.vz;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void RestartMultiplayer(void)
|
||||
{
|
||||
|
@ -547,14 +531,7 @@ void CreateGameSpecificConsoleCommands(void)
|
|||
"RESTARTS A NETWORK GAME FROM SCRATCH",
|
||||
RestartMultiplayer
|
||||
);
|
||||
#if 0
|
||||
ConsoleCommand::Make
|
||||
(
|
||||
"NEWPLANET",
|
||||
"",
|
||||
NewPlanet
|
||||
);
|
||||
#endif
|
||||
|
||||
ConsoleCommand::Make
|
||||
(
|
||||
"PAINTBALL",
|
||||
|
@ -679,13 +656,6 @@ void CreateGameSpecificConsoleCommands(void)
|
|||
|
||||
|
||||
#if 1
|
||||
ConsoleCommand::Make
|
||||
(
|
||||
"TRASH_FRAME_RATE",
|
||||
"",
|
||||
Trash_Frame_Rate
|
||||
);
|
||||
|
||||
ConsoleCommand::Make
|
||||
(
|
||||
"COMPLETE_LEVEL",
|
||||
|
@ -694,6 +664,7 @@ void CreateGameSpecificConsoleCommands(void)
|
|||
);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* KJL 15:52:41 29/03/98 - version info */
|
||||
ConsoleCommand::Make
|
||||
(
|
||||
|
|
|
@ -940,7 +940,7 @@ int KeyBinding :: bEcho = No;
|
|||
void CONSBIND_WriteKeyBindingsToConfigFile(void)
|
||||
{
|
||||
#if !(PREDATOR_DEMO|MARINE_DEMO||ALIEN_DEMO||DEATHMATCH_DEMO)
|
||||
KeyBinding :: WriteToConfigFile("CONFIG.CFG");
|
||||
KeyBinding :: WriteToConfigFile("config.cfg");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
#include "3dc.h"
|
||||
#include "gadget.h"
|
||||
|
||||
#include "fixer.h"
|
||||
|
||||
#if SupportWindows95
|
||||
|
||||
#include "rentrntq.h"
|
||||
|
@ -33,68 +35,11 @@
|
|||
/* Constants *******************************************************/
|
||||
#define MAX_Q_MESSAGES (256)
|
||||
|
||||
#if 0
|
||||
#if 1
|
||||
#define METACHAR_CHANGEFOCUS '~'
|
||||
#else
|
||||
#define METACHAR_CHANGEFOCUS '\r'
|
||||
#endif
|
||||
|
||||
#define METAKEY_CHANGEFOCUS_VK (0xdf)
|
||||
/*
|
||||
DHM 14/1/98:
|
||||
------------
|
||||
|
||||
I have been asked to make this key the
|
||||
|
||||
"you know, the tilde key, the one in the top left of everyone's
|
||||
keyboards, like Quake does"
|
||||
|
||||
However, I have yet to find a keyboard for which the tilde key is in the
|
||||
top left.
|
||||
|
||||
I obtained the value (0xdf) by experiment on my keyboard. According to
|
||||
the Petzold book:
|
||||
|
||||
"Although all keys cause keystroke messages, the table does not
|
||||
include any symbol keys (such as the key with the / and ? symbols).
|
||||
These keys have virtual key codes of 128 and above, and they are often
|
||||
defined differently for international keyboards. You can determine the
|
||||
values of these virtual key codes using the KEYLOOK program that is shown
|
||||
later in this chapter, but normally you should not process keystroke
|
||||
messages for these keys."
|
||||
|
||||
What about DirectInput?
|
||||
|
||||
*/
|
||||
#endif
|
||||
|
||||
/* Macros **********************************************************/
|
||||
|
||||
/* Imported function prototypes ************************************/
|
||||
|
||||
/* Imported data ***************************************************/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
#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 ************************************************/
|
||||
|
||||
|
@ -127,6 +72,11 @@
|
|||
static struct Q_Entry OurQ[MAX_Q_MESSAGES];
|
||||
static unsigned int NumQMessages = 0;
|
||||
|
||||
extern "C" {
|
||||
void RE_ENTRANT_QUEUE_WinProc_AddMessage_WM_CHAR(char Ch);
|
||||
void RE_ENTRANT_QUEUE_WinProc_AddMessage_WM_KEYDOWN(WPARAM wParam);
|
||||
};
|
||||
|
||||
/* Exported function definitions ***********************************/
|
||||
/* Functions callable within the Windows procedure */
|
||||
void RE_ENTRANT_QUEUE_WinProc_AddMessage_WM_CHAR
|
||||
|
@ -269,7 +219,9 @@ void RE_ENTRANT_QUEUE_WinMain_FlushMessages(void)
|
|||
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -145,9 +145,9 @@ typedef struct
|
|||
|
||||
|
||||
|
||||
|
||||
#define USER_PROFILES_PATH "User_Profiles\\"
|
||||
#define USER_PROFILES_WILDCARD_NAME "User_Profiles\\*.prf"
|
||||
/* TODO: dir separator */
|
||||
#define USER_PROFILES_PATH "User_Profiles/"
|
||||
#define USER_PROFILES_WILDCARD_NAME "User_Profiles/*.prf"
|
||||
#define USER_PROFILES_SUFFIX ".prf"
|
||||
|
||||
|
||||
|
@ -174,10 +174,8 @@ extern int CheatMode_Species;
|
|||
extern int CheatMode_Environment;
|
||||
|
||||
|
||||
extern int EdmondsTest();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}; // extern "C"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
11
src/fixer.h
11
src/fixer.h
|
@ -91,6 +91,17 @@ typedef struct SYSTEMTIME
|
|||
int wDay;
|
||||
} SYSTEMTIME;
|
||||
|
||||
#define VK_BACK 1
|
||||
#define VK_END 2
|
||||
#define VK_HOME 3
|
||||
#define VK_LEFT 4
|
||||
#define VK_UP 5
|
||||
#define VK_RIGHT 6
|
||||
#define VK_DOWN 7
|
||||
#define VK_INSERT 8
|
||||
#define VK_DELETE 9
|
||||
#define VK_TAB 10
|
||||
|
||||
#define INVALID_HANDLE_VALUE -1
|
||||
#define GENERIC_WRITE 0x0001
|
||||
#define CREATE_ALWAYS 0x0002
|
||||
|
|
890
src/kshape.c
890
src/kshape.c
|
@ -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
|
73
src/main.c
73
src/main.c
|
@ -348,11 +348,53 @@ static int KeySymToKey(int keysym)
|
|||
}
|
||||
}
|
||||
|
||||
static void handle_keypress(int key, int press)
|
||||
static void handle_keypress(int key, int unicode, int press)
|
||||
{
|
||||
void RE_ENTRANT_QUEUE_WinProc_AddMessage_WM_CHAR(char Ch);
|
||||
void RE_ENTRANT_QUEUE_WinProc_AddMessage_WM_KEYDOWN(int wParam);
|
||||
|
||||
if (key == -1)
|
||||
return;
|
||||
|
||||
if (press) {
|
||||
switch(key) {
|
||||
case KEY_BACKSPACE:
|
||||
RE_ENTRANT_QUEUE_WinProc_AddMessage_WM_KEYDOWN(VK_BACK);
|
||||
break;
|
||||
case KEY_END:
|
||||
RE_ENTRANT_QUEUE_WinProc_AddMessage_WM_KEYDOWN(VK_END);
|
||||
break;
|
||||
case KEY_HOME:
|
||||
RE_ENTRANT_QUEUE_WinProc_AddMessage_WM_KEYDOWN(VK_HOME);
|
||||
break;
|
||||
case KEY_LEFT:
|
||||
RE_ENTRANT_QUEUE_WinProc_AddMessage_WM_KEYDOWN(VK_LEFT);
|
||||
break;
|
||||
case KEY_UP:
|
||||
RE_ENTRANT_QUEUE_WinProc_AddMessage_WM_KEYDOWN(VK_UP);
|
||||
break;
|
||||
case KEY_RIGHT:
|
||||
RE_ENTRANT_QUEUE_WinProc_AddMessage_WM_KEYDOWN(VK_RIGHT);
|
||||
break;
|
||||
case KEY_DOWN:
|
||||
RE_ENTRANT_QUEUE_WinProc_AddMessage_WM_KEYDOWN(VK_DOWN);
|
||||
break;
|
||||
case KEY_INS:
|
||||
RE_ENTRANT_QUEUE_WinProc_AddMessage_WM_KEYDOWN(VK_INSERT);
|
||||
break;
|
||||
case KEY_DEL:
|
||||
RE_ENTRANT_QUEUE_WinProc_AddMessage_WM_KEYDOWN(VK_DELETE);
|
||||
break;
|
||||
case KEY_TAB:
|
||||
RE_ENTRANT_QUEUE_WinProc_AddMessage_WM_KEYDOWN(VK_TAB);
|
||||
break;
|
||||
default:
|
||||
if (unicode && !(unicode & 0xFF80))
|
||||
RE_ENTRANT_QUEUE_WinProc_AddMessage_WM_CHAR(unicode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (press && !KeyboardInput[key]) {
|
||||
DebouncedKeyboardInput[key] = 1;
|
||||
DebouncedGotAnyKey = 1;
|
||||
|
@ -387,7 +429,7 @@ static void handle_buttonpress(int button, int press)
|
|||
|
||||
KeyboardInput[key] = press;
|
||||
}
|
||||
|
||||
|
||||
void CheckForWindowsMessages()
|
||||
{
|
||||
SDL_Event event;
|
||||
|
@ -413,10 +455,10 @@ void CheckForWindowsMessages()
|
|||
case SDL_MOUSEBUTTONUP:
|
||||
break;
|
||||
case SDL_KEYDOWN:
|
||||
handle_keypress(KeySymToKey(event.key.keysym.sym), 1);
|
||||
handle_keypress(KeySymToKey(event.key.keysym.sym), event.key.keysym.unicode, 1);
|
||||
break;
|
||||
case SDL_KEYUP:
|
||||
handle_keypress(KeySymToKey(event.key.keysym.sym), 0);
|
||||
handle_keypress(KeySymToKey(event.key.keysym.sym), 0, 0);
|
||||
break;
|
||||
case SDL_QUIT:
|
||||
// SDL_Quit();
|
||||
|
@ -431,17 +473,17 @@ void CheckForWindowsMessages()
|
|||
|
||||
if (wantmouse) {
|
||||
if (buttons & SDL_BUTTON(1))
|
||||
handle_keypress(KEY_LMOUSE, 1);
|
||||
handle_keypress(KEY_LMOUSE, 0, 1);
|
||||
else
|
||||
handle_keypress(KEY_LMOUSE, 0);
|
||||
handle_keypress(KEY_LMOUSE, 0, 0);
|
||||
if (buttons & SDL_BUTTON(2))
|
||||
handle_keypress(KEY_MMOUSE, 1);
|
||||
handle_keypress(KEY_MMOUSE, 0, 1);
|
||||
else
|
||||
handle_keypress(KEY_MMOUSE, 0);
|
||||
handle_keypress(KEY_MMOUSE, 0, 0);
|
||||
if (buttons & SDL_BUTTON(3))
|
||||
handle_keypress(KEY_RMOUSE, 1);
|
||||
handle_keypress(KEY_RMOUSE, 0, 1);
|
||||
else
|
||||
handle_keypress(KEY_RMOUSE, 0);
|
||||
handle_keypress(KEY_RMOUSE, 0, 0);
|
||||
|
||||
MouseVelX = DIV_FIXED(x, NormalFrameTime);
|
||||
MouseVelY = DIV_FIXED(y, NormalFrameTime);
|
||||
|
@ -512,6 +554,11 @@ int main(int argc, char *argv[])
|
|||
|
||||
GetPathFromRegistry();
|
||||
|
||||
{
|
||||
extern int DebuggingCommandsActive;
|
||||
DebuggingCommandsActive = 1;
|
||||
}
|
||||
|
||||
#if MARINE_DEMO
|
||||
ffInit("fastfile/mffinfo.txt","fastfile/");
|
||||
#elif ALIEN_DEMO
|
||||
|
@ -560,9 +607,7 @@ int main(int argc, char *argv[])
|
|||
LoadSounds("PLAYER");
|
||||
|
||||
{
|
||||
extern int DebuggingCommandsActive;
|
||||
// AvP.Network = I_Host; /* for exploring */
|
||||
DebuggingCommandsActive = 1;
|
||||
}
|
||||
|
||||
AvP.CurrentEnv = AvP.StartingEnv = 0; /* are these even used? */
|
||||
|
@ -581,12 +626,12 @@ 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 */
|
||||
|
|
88
src/opengl.c
88
src/opengl.c
|
@ -2,7 +2,6 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <SDL.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glext.h>
|
||||
|
||||
|
@ -17,6 +16,7 @@
|
|||
#include "krender.h"
|
||||
#include "kshape.h"
|
||||
#include "prototyp.h"
|
||||
#include "lighting.h"
|
||||
#include "bh_types.h"
|
||||
#include "showcmds.h"
|
||||
#include "d3d_hud.h"
|
||||
|
@ -24,6 +24,7 @@
|
|||
#include "avp_userprofile.h"
|
||||
#include "aw.h"
|
||||
|
||||
int LightIntensityAtPoint(VECTORCH *pointPtr);
|
||||
|
||||
extern IMAGEHEADER ImageHeaderArray[];
|
||||
extern VIEWDESCRIPTORBLOCK *Global_VDB_Ptr;
|
||||
|
@ -163,8 +164,7 @@ typedef struct TriangleArray
|
|||
TriangleArray tarr;
|
||||
|
||||
static void DrawTriangles_T2F_C4UB_V4F()
|
||||
{
|
||||
|
||||
{
|
||||
#define OUTPUT_VERTEX(d) \
|
||||
{ \
|
||||
glColor4ubv (&tarr.c[(d) * 4]); \
|
||||
|
@ -209,8 +209,7 @@ static void DrawTriangles_T2F_C4UB_V4F()
|
|||
}
|
||||
|
||||
static void DrawTriangles_T2F_V4F()
|
||||
{
|
||||
|
||||
{
|
||||
#define OUTPUT_VERTEX(d) \
|
||||
{ \
|
||||
glTexCoord2fv (&tarr.t[(d) * 4]); \
|
||||
|
@ -254,8 +253,7 @@ static void DrawTriangles_T2F_V4F()
|
|||
}
|
||||
|
||||
static void DrawTriangles_C4UB_V4F()
|
||||
{
|
||||
|
||||
{
|
||||
#define OUTPUT_VERTEX(d) \
|
||||
{ \
|
||||
glColor4ubv (&tarr.c[(d) * 4]); \
|
||||
|
@ -622,9 +620,7 @@ void D3D_SkyPolygon_Output(POLYHEADER *inputPolyPtr, RENDERVERTEX *renderVertice
|
|||
}
|
||||
|
||||
tarr.elements = RenderPolygon.NumberOfVertices;
|
||||
DrawTriangles_T2F_C4UB_V4F();
|
||||
|
||||
|
||||
DrawTriangles_T2F_C4UB_V4F();
|
||||
}
|
||||
|
||||
void D3D_ZBufferedCloakedPolygon_Output(POLYHEADER *inputPolyPtr, RENDERVERTEX *renderVerticesPtr)
|
||||
|
@ -788,7 +784,6 @@ void D3D_Decal_Output(DECAL *decalPtr, RENDERVERTEX *renderVerticesPtr)
|
|||
|
||||
glColor4ub(r, g, b, a);
|
||||
|
||||
SelectPolygonBeginType(RenderPolygon.NumberOfVertices);
|
||||
for (i = 0; i < RenderPolygon.NumberOfVertices; i++) {
|
||||
RENDERVERTEX *vertices = &renderVerticesPtr[i];
|
||||
|
||||
|
@ -825,19 +820,17 @@ void D3D_Decal_Output(DECAL *decalPtr, RENDERVERTEX *renderVerticesPtr)
|
|||
zvalue = vertices->Z+HeadUpDisplayZOffset;
|
||||
z = 1.0 - 2*ZNear/zvalue;
|
||||
|
||||
// zvalue = vertices->Z+HeadUpDisplayZOffset;
|
||||
// zvalue = ((zvalue-ZNear)/zvalue);
|
||||
|
||||
#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
|
||||
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();
|
||||
|
||||
tarr.elements = RenderPolygon.NumberOfVertices;
|
||||
DrawTriangles_T2F_V4F();
|
||||
}
|
||||
|
||||
void D3D_Particle_Output(PARTICLE *particlePtr, RENDERVERTEX *renderVerticesPtr)
|
||||
|
@ -982,7 +975,6 @@ void D3D_PredatorThermalVisionPolygon_Output(POLYHEADER *inputPolyPtr, RENDERVER
|
|||
CheckBoundTextureIsCorrect(NULL); /* disable texturing */
|
||||
CheckTranslucencyModeIsCorrect(TRANSLUCENCY_OFF);
|
||||
|
||||
SelectPolygonBeginType(RenderPolygon.NumberOfVertices);
|
||||
for (i = 0; i < RenderPolygon.NumberOfVertices; i++) {
|
||||
RENDERVERTEX *vertices = &renderVerticesPtr[i];
|
||||
|
||||
|
@ -992,7 +984,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 1
|
||||
|
||||
if (x1<Global_VDB_Ptr->VDB_ClipLeft) {
|
||||
x1=Global_VDB_Ptr->VDB_ClipLeft;
|
||||
} else if (x1>Global_VDB_Ptr->VDB_ClipRight) {
|
||||
|
@ -1004,7 +996,6 @@ void D3D_PredatorThermalVisionPolygon_Output(POLYHEADER *inputPolyPtr, RENDERVER
|
|||
} else if (y1>Global_VDB_Ptr->VDB_ClipDown) {
|
||||
y1=Global_VDB_Ptr->VDB_ClipDown;
|
||||
}
|
||||
#endif
|
||||
|
||||
x = x1;
|
||||
y = y1;
|
||||
|
@ -1015,15 +1006,21 @@ void D3D_PredatorThermalVisionPolygon_Output(POLYHEADER *inputPolyPtr, RENDERVER
|
|||
zvalue = vertices->Z+HeadUpDisplayZOffset;
|
||||
z = 1.0 - 2*ZNear/zvalue;
|
||||
|
||||
// zvalue = vertices->Z+HeadUpDisplayZOffset;
|
||||
// zvalue = ((zvalue-ZNear)/zvalue);
|
||||
|
||||
rhw = 1.0/(float)vertices->Z;
|
||||
|
||||
glColor4ub(vertices->R, vertices->G, vertices->B, vertices->A);
|
||||
glVertex4f(x/rhw, y/rhw, z/rhw, 1/rhw);
|
||||
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.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_C4UB_V4F();
|
||||
}
|
||||
|
||||
void D3D_ZBufferedGouraudPolygon_Output(POLYHEADER *inputPolyPtr, RENDERVERTEX *renderVerticesPtr)
|
||||
|
@ -1038,7 +1035,6 @@ void D3D_ZBufferedGouraudPolygon_Output(POLYHEADER *inputPolyPtr, RENDERVERTEX *
|
|||
CheckTranslucencyModeIsCorrect(RenderPolygon.TranslucencyMode);
|
||||
CheckBoundTextureIsCorrect(NULL);
|
||||
|
||||
SelectPolygonBeginType(RenderPolygon.NumberOfVertices);
|
||||
for (i = 0; i < RenderPolygon.NumberOfVertices; i++) {
|
||||
RENDERVERTEX *vertices = &renderVerticesPtr[i];
|
||||
int x1, y1;
|
||||
|
@ -1047,7 +1043,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 1
|
||||
|
||||
if (x1<Global_VDB_Ptr->VDB_ClipLeft) {
|
||||
x1=Global_VDB_Ptr->VDB_ClipLeft;
|
||||
} else if (x1>Global_VDB_Ptr->VDB_ClipRight) {
|
||||
|
@ -1059,7 +1055,6 @@ void D3D_ZBufferedGouraudPolygon_Output(POLYHEADER *inputPolyPtr, RENDERVERTEX *
|
|||
} else if (y1>Global_VDB_Ptr->VDB_ClipDown) {
|
||||
y1=Global_VDB_Ptr->VDB_ClipDown;
|
||||
}
|
||||
#endif
|
||||
|
||||
x = x1;
|
||||
y = y1;
|
||||
|
@ -1069,20 +1064,25 @@ void D3D_ZBufferedGouraudPolygon_Output(POLYHEADER *inputPolyPtr, RENDERVERTEX *
|
|||
|
||||
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);
|
||||
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;
|
||||
|
||||
glVertex4f(x/rhw, y/rhw, z/rhw, 1/rhw);
|
||||
tarr.c[4*i+0] = vertices->R;
|
||||
tarr.c[4*i+1] = vertices->G;
|
||||
tarr.c[4*i+2] = vertices->B;
|
||||
if (flags & iflag_transparent)
|
||||
tarr.c[4*i+3] = vertices->A;
|
||||
else
|
||||
tarr.c[4*i+3] = 255;
|
||||
}
|
||||
glEnd();
|
||||
|
||||
tarr.elements = RenderPolygon.NumberOfVertices;
|
||||
DrawTriangles_C4UB_V4F();
|
||||
}
|
||||
|
||||
void D3D_PlayerOnFireOverlay()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue