Fixed water drawing.
Added a better hack to the Text loader (for Alien demo). Fixed water texture paths for Alien Demo.
This commit is contained in:
parent
acbc8ea8b8
commit
39a1a56772
5 changed files with 93 additions and 70 deletions
25
README
25
README
|
@ -13,6 +13,8 @@ end users." Hopefully this status will change in the not-so-distant future.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Obviously this README is totally incomplete, and will probably remain so for
|
Obviously this README is totally incomplete, and will probably remain so for
|
||||||
quite a while, so I'll just try to list a few important notes.
|
quite a while, so I'll just try to list a few important notes.
|
||||||
|
|
||||||
|
@ -28,6 +30,26 @@ You can find the original source code and other related tools at:
|
||||||
http://www.avpnews.com/mods/tools/
|
http://www.avpnews.com/mods/tools/
|
||||||
|
|
||||||
|
|
||||||
|
Yes, the code does currently do something. No, it's not ready for a release.
|
||||||
|
No, it is not vaporware. I hope to at least complete the single portion of
|
||||||
|
the game before making an official release.
|
||||||
|
|
||||||
|
|
||||||
|
If you are really itching to try this out, either install the Gold Ed. in
|
||||||
|
windows/vmware (read below to find out why), or download the AvP Alien demo.
|
||||||
|
If you are wanting to run the Alien demo (the installer is an .exe but you
|
||||||
|
can just use unzip to extract the files from the .exe), add -DALIEN_DEMO to
|
||||||
|
CFLAGS (the one that's uncommented). Rename all game files lowercase.
|
||||||
|
|
||||||
|
relnev:~/avp/AvP Demo 3 - Alien$ ls
|
||||||
|
aenglish.txt alienavp_huds/ alienfastfile/ avp_rifs/
|
||||||
|
relnev:~/avp/Gold Edition$ ls
|
||||||
|
avp_huds/ avp_rifs/ cd tracks.txt default.cfg fastfile/ language.txt
|
||||||
|
|
||||||
|
Support for the demo is not quite complete (some sounds are missing and some
|
||||||
|
text is incorrect/missing).
|
||||||
|
|
||||||
|
|
||||||
The source code that was released only works with Aliens vs Predator Gold.
|
The source code that was released only works with Aliens vs Predator Gold.
|
||||||
In the future I'd like this port to support Gold, Regular and the three
|
In the future I'd like this port to support Gold, Regular and the three
|
||||||
demos. Plus, I am told that the Regular edition does seem to work by
|
demos. Plus, I am told that the Regular edition does seem to work by
|
||||||
|
@ -72,3 +94,6 @@ Last, but surely not least:
|
||||||
Thanks go out to Chuck Mason for testing and the OpenAL code, Dan Olson for
|
Thanks go out to Chuck Mason for testing and the OpenAL code, Dan Olson for
|
||||||
trying the code out with the Regular version, and Ryan C. Gordon for hosting
|
trying the code out with the Regular version, and Ryan C. Gordon for hosting
|
||||||
this project.
|
this project.
|
||||||
|
|
||||||
|
---
|
||||||
|
Steven Fuller <relnev@icculus.org>
|
||||||
|
|
3
TODO
3
TODO
|
@ -6,11 +6,12 @@
|
||||||
config handling (~/.avp/{ge, re, ad, md, pd}/?)
|
config handling (~/.avp/{ge, re, ad, md, pd}/?)
|
||||||
* Command line options.
|
* Command line options.
|
||||||
* CD Audio.
|
* CD Audio.
|
||||||
|
* Joystick support.
|
||||||
* Try to get demos and regular edition to work.
|
* Try to get demos and regular edition to work.
|
||||||
* See what FOX/Rebellion has to say (if anything) about redistribution of the
|
* See what FOX/Rebellion has to say (if anything) about redistribution of the
|
||||||
demos and if its possible to create an installer for regular/gold edition
|
demos and if its possible to create an installer for regular/gold edition
|
||||||
CDs.
|
CDs.
|
||||||
* Put together a workaround if RGT plan fails.
|
* Put together a workaround if RGT plan fails. Might just leave as-is.
|
||||||
* See if the build process can be made easier for those who download the
|
* See if the build process can be made easier for those who download the
|
||||||
source.
|
source.
|
||||||
* Write documentation.
|
* Write documentation.
|
||||||
|
|
|
@ -71,10 +71,8 @@ void InitTextStrings(void)
|
||||||
for (i=1; i<MAX_NO_OF_TEXTSTRINGS; i++)
|
for (i=1; i<MAX_NO_OF_TEXTSTRINGS; i++)
|
||||||
{
|
{
|
||||||
/* scan for a quote mark */
|
/* scan for a quote mark */
|
||||||
if (*textPtr == 0) /* TODO: probably a broken hack (added for predator demo)... */
|
while (*textPtr++ != '"')
|
||||||
break;
|
if (*textPtr == '@') return; /* '@' should be EOF */
|
||||||
|
|
||||||
while (*textPtr++ != '"');
|
|
||||||
|
|
||||||
/* now pointing to a text string after quote mark*/
|
/* now pointing to a text string after quote mark*/
|
||||||
TextStringPtr[i] = textPtr;
|
TextStringPtr[i] = textPtr;
|
||||||
|
@ -94,6 +92,7 @@ void InitTextStrings(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void KillTextStrings(void)
|
void KillTextStrings(void)
|
||||||
{
|
{
|
||||||
UnloadTextFile(LanguageFilename[AvP.Language],TextBufferPtr);
|
UnloadTextFile(LanguageFilename[AvP.Language],TextBufferPtr);
|
||||||
|
|
|
@ -292,8 +292,13 @@ void LoadCommonTextures(void)
|
||||||
extern char LevelName[];
|
extern char LevelName[];
|
||||||
if (!strcmp(LevelName,"invasion_a"))
|
if (!strcmp(LevelName,"invasion_a"))
|
||||||
{
|
{
|
||||||
|
#if !ALIEN_DEMO
|
||||||
ChromeImageNumber = CL_LoadImageOnce("Envrnmts\\Invasion\\water2.RIM",LIO_D3DTEXTURE|LIO_RELATIVEPATH|LIO_RESTORABLE|LIO_TRANSPARENT);
|
ChromeImageNumber = CL_LoadImageOnce("Envrnmts\\Invasion\\water2.RIM",LIO_D3DTEXTURE|LIO_RELATIVEPATH|LIO_RESTORABLE|LIO_TRANSPARENT);
|
||||||
WaterShaftImageNumber = CL_LoadImageOnce("Envrnmts\\Invasion\\water-shaft.RIM",LIO_D3DTEXTURE|LIO_RELATIVEPATH|LIO_RESTORABLE|LIO_TRANSPARENT);
|
WaterShaftImageNumber = CL_LoadImageOnce("Envrnmts\\Invasion\\water-shaft.RIM",LIO_D3DTEXTURE|LIO_RELATIVEPATH|LIO_RESTORABLE|LIO_TRANSPARENT);
|
||||||
|
#else /* alien demo has these in common */
|
||||||
|
ChromeImageNumber = CL_LoadImageOnce("Common\\water2.RIM",LIO_D3DTEXTURE|LIO_RELATIVEPATH|LIO_RESTORABLE|LIO_TRANSPARENT);
|
||||||
|
WaterShaftImageNumber = CL_LoadImageOnce("Common\\water-shaft.RIM",LIO_D3DTEXTURE|LIO_RELATIVEPATH|LIO_RESTORABLE|LIO_TRANSPARENT);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else if (!strcmp(LevelName,"genshd1"))
|
else if (!strcmp(LevelName,"genshd1"))
|
||||||
{
|
{
|
||||||
|
|
123
src/opengl.c
123
src/opengl.c
|
@ -2679,14 +2679,13 @@ void D3D_DrawWaterTest(MODULE *testModulePtr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* TODO: doubled this from 256 to 512 because of overflows in DrawMoltenMetal_Clipped */
|
VECTORCH MeshVertex[256];
|
||||||
VECTORCH MeshVertex[512];
|
|
||||||
#define TEXTURE_WATER 0
|
#define TEXTURE_WATER 0
|
||||||
|
|
||||||
VECTORCH MeshWorldVertex[512];
|
VECTORCH MeshWorldVertex[256];
|
||||||
unsigned int MeshVertexColour[512];
|
unsigned int MeshVertexColour[256];
|
||||||
unsigned int MeshVertexSpecular[512];
|
unsigned int MeshVertexSpecular[256];
|
||||||
char MeshVertexOutcode[512];
|
char MeshVertexOutcode[256];
|
||||||
|
|
||||||
void D3D_DrawWaterPatch(int xOrigin, int yOrigin, int zOrigin)
|
void D3D_DrawWaterPatch(int xOrigin, int yOrigin, int zOrigin)
|
||||||
{
|
{
|
||||||
|
@ -3782,7 +3781,7 @@ void D3D_DrawMoltenMetalMesh_Unclipped(void)
|
||||||
int i, x, y, z;
|
int i, x, y, z;
|
||||||
int start;
|
int start;
|
||||||
|
|
||||||
CheckTriangleBuffer( /*256*/ 273, 0, 450, 0, (D3DTexture *)-1, -1, -1);
|
CheckTriangleBuffer(256, 0, 450, 0, (D3DTexture *)-1, -1, -1);
|
||||||
|
|
||||||
start = varrc;
|
start = varrc;
|
||||||
for (i=0; i<256; i++) {
|
for (i=0; i<256; i++) {
|
||||||
|
@ -3792,36 +3791,22 @@ void D3D_DrawMoltenMetalMesh_Unclipped(void)
|
||||||
|
|
||||||
if (point->vz < 1) point->vz = 1;
|
if (point->vz < 1) point->vz = 1;
|
||||||
|
|
||||||
x = (point->vx*(Global_VDB_Ptr->VDB_ProjX+1))/point->vz+Global_VDB_Ptr->VDB_CentreX;
|
xf = ((float)point->vx*((float)Global_VDB_Ptr->VDB_ProjX+1.0f))/((float)point->vz*(float)ScreenDescriptorBlock.SDB_CentreX);
|
||||||
y = (point->vy*(Global_VDB_Ptr->VDB_ProjY+1))/point->vz+Global_VDB_Ptr->VDB_CentreY;
|
yf = -((float)point->vy*((float)Global_VDB_Ptr->VDB_ProjY+1.0f))/((float)point->vz*(float)ScreenDescriptorBlock.SDB_CentreY);
|
||||||
|
|
||||||
if (x<Global_VDB_Ptr->VDB_ClipLeft) {
|
z = point->vz + HeadUpDisplayZOffset;
|
||||||
x=Global_VDB_Ptr->VDB_ClipLeft;
|
rhw = 1.0f / (float)point->vz;
|
||||||
} else if (x>Global_VDB_Ptr->VDB_ClipRight) {
|
zf = 1.0f - 2.0f*ZNear/(float)z;
|
||||||
x=Global_VDB_Ptr->VDB_ClipRight;
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
sf = pointWS->vx*WaterUScale+(1.0f/256.0f);
|
sf = pointWS->vx*WaterUScale+(1.0f/256.0f);
|
||||||
tf = pointWS->vy*WaterVScale+(1.0f/256.0f);
|
tf = pointWS->vy*WaterVScale+(1.0f/256.0f);
|
||||||
|
|
||||||
z = point->vz + HeadUpDisplayZOffset;
|
|
||||||
rhw = 1.0f / (float)point->vz;
|
|
||||||
|
|
||||||
b = (MeshVertexColour[i] >> 0) & 0xFF;
|
b = (MeshVertexColour[i] >> 0) & 0xFF;
|
||||||
g = (MeshVertexColour[i] >> 8) & 0xFF;
|
g = (MeshVertexColour[i] >> 8) & 0xFF;
|
||||||
r = (MeshVertexColour[i] >> 16) & 0xFF;
|
r = (MeshVertexColour[i] >> 16) & 0xFF;
|
||||||
a = (MeshVertexColour[i] >> 24) & 0xFF;
|
a = (MeshVertexColour[i] >> 24) & 0xFF;
|
||||||
|
|
||||||
xf = ((float)x - (float)ScreenDescriptorBlock.SDB_CentreX - 0.5f) / ((float)ScreenDescriptorBlock.SDB_CentreX - 0.5f);
|
|
||||||
yf = -((float)y - (float)ScreenDescriptorBlock.SDB_CentreY - 0.5f) / ((float)ScreenDescriptorBlock.SDB_CentreY - 0.5f);
|
|
||||||
zf = 1.0f - 2.0f*ZNear/(float)z;
|
|
||||||
|
|
||||||
varrp->v[0] = xf/rhw;
|
varrp->v[0] = xf/rhw;
|
||||||
varrp->v[1] = yf/rhw;
|
varrp->v[1] = yf/rhw;
|
||||||
varrp->v[2] = zf/rhw;
|
varrp->v[2] = zf/rhw;
|
||||||
|
@ -3865,17 +3850,32 @@ void D3D_DrawMoltenMetalMesh_Unclipped(void)
|
||||||
|
|
||||||
void D3D_DrawMoltenMetalMesh_Clipped(void)
|
void D3D_DrawMoltenMetalMesh_Clipped(void)
|
||||||
{
|
{
|
||||||
/* clipping unnecessary. */
|
|
||||||
D3D_DrawMoltenMetalMesh_Unclipped();
|
D3D_DrawMoltenMetalMesh_Unclipped();
|
||||||
|
return;
|
||||||
#if 0
|
#if 0
|
||||||
int i, x, y, z;
|
int i, x, y, z, c, start;
|
||||||
|
|
||||||
float ZNear = (float) (Global_VDB_Ptr->VDB_ClipZ * GlobalScale);
|
float ZNear = (float) (Global_VDB_Ptr->VDB_ClipZ * GlobalScale);
|
||||||
|
|
||||||
VECTORCH *point = MeshVertex;
|
VECTORCH *point = MeshVertex;
|
||||||
VECTORCH *pointWS = MeshWorldVertex;
|
VECTORCH *pointWS = MeshWorldVertex;
|
||||||
|
|
||||||
CheckTriangleBuffer(256, 0, 450, 0, (D3DTexture *)-1, -1, -1);
|
/* how many triangles drawn the first time, (450-c the second time) */
|
||||||
|
c = 0;
|
||||||
|
for (x=0; x<15; x++) {
|
||||||
|
for(y=0; y<15; y++) {
|
||||||
|
int p1 = 0+x+(16*y);
|
||||||
|
int p2 = 1+x+(16*y);
|
||||||
|
int p3 = 16+x+(16*y);
|
||||||
|
int p4 = 17+x+(16*y);
|
||||||
|
|
||||||
|
if (MeshVertexOutcode[p1]&&MeshVertexOutcode[p2]&&MeshVertexOutcode[p3]&&MeshVertexOutcode[p4])
|
||||||
|
c += 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CheckTriangleBuffer(256, 0, c, 0, (D3DTexture *)-1, -1, -1);
|
||||||
|
start = varrc;
|
||||||
|
|
||||||
for (i=0; i<256; i++)
|
for (i=0; i<256; i++)
|
||||||
{
|
{
|
||||||
|
@ -3915,27 +3915,28 @@ void D3D_DrawMoltenMetalMesh_Clipped(void)
|
||||||
yf = -((float)y - (float)ScreenDescriptorBlock.SDB_CentreY - 0.5f) / ((float)ScreenDescriptorBlock.SDB_CentreY - 0.5f);
|
yf = -((float)y - (float)ScreenDescriptorBlock.SDB_CentreY - 0.5f) / ((float)ScreenDescriptorBlock.SDB_CentreY - 0.5f);
|
||||||
zf = 1.0f - 2.0f*ZNear/(float)z;
|
zf = 1.0f - 2.0f*ZNear/(float)z;
|
||||||
|
|
||||||
tarr[i].v[0] = xf/rhw;
|
varrp->v[0] = xf/rhw;
|
||||||
tarr[i].v[1] = yf/rhw;
|
varrp->v[1] = yf/rhw;
|
||||||
tarr[i].v[2] = zf/rhw;
|
varrp->v[2] = zf/rhw;
|
||||||
tarr[i].v[3] = 1.0f/rhw;
|
varrp->v[3] = 1.0f/rhw;
|
||||||
|
|
||||||
tarr[i].t[0] = sf;
|
varrp->t[0] = sf;
|
||||||
tarr[i].t[1] = tf;
|
varrp->t[1] = tf;
|
||||||
|
|
||||||
|
varrp->c[0] = r;
|
||||||
|
varrp->c[1] = g;
|
||||||
|
varrp->c[2] = b;
|
||||||
|
varrp->c[3] = a;
|
||||||
|
|
||||||
|
varrp++;
|
||||||
|
varrc++;
|
||||||
|
|
||||||
tarr[i].c[0] = r;
|
|
||||||
tarr[i].c[1] = g;
|
|
||||||
tarr[i].c[2] = b;
|
|
||||||
tarr[i].c[3] = a;
|
|
||||||
|
|
||||||
point++;
|
point++;
|
||||||
pointWS++;
|
pointWS++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* CONSTRUCT POLYS */
|
/* CONSTRUCT POLYS */
|
||||||
{
|
{
|
||||||
int tc = 0;
|
|
||||||
|
|
||||||
for (x=0; x<15; x++)
|
for (x=0; x<15; x++)
|
||||||
{
|
{
|
||||||
for(y=0; y<15; y++)
|
for(y=0; y<15; y++)
|
||||||
|
@ -3945,8 +3946,6 @@ void D3D_DrawMoltenMetalMesh_Clipped(void)
|
||||||
int p3 = 16+x+(16*y);
|
int p3 = 16+x+(16*y);
|
||||||
int p4 = 17+x+(16*y);
|
int p4 = 17+x+(16*y);
|
||||||
|
|
||||||
if (p3 > 255)
|
|
||||||
continue;
|
|
||||||
#if 0
|
#if 0
|
||||||
#if 0
|
#if 0
|
||||||
if (MeshVertexOutcode[p1]&&MeshVertexOutcode[p2]&&MeshVertexOutcode[p3])
|
if (MeshVertexOutcode[p1]&&MeshVertexOutcode[p2]&&MeshVertexOutcode[p3])
|
||||||
|
@ -3970,15 +3969,15 @@ void D3D_DrawMoltenMetalMesh_Clipped(void)
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
if (MeshVertexOutcode[p1]&&MeshVertexOutcode[p2]&&MeshVertexOutcode[p3]&&MeshVertexOutcode[p4]) {
|
if (MeshVertexOutcode[p1]&&MeshVertexOutcode[p2]&&MeshVertexOutcode[p3]&&MeshVertexOutcode[p4]) {
|
||||||
#if 0
|
tarrp[0].a = start+p1;
|
||||||
tris[tc+0].a = p1;
|
tarrp[0].b = start+p2;
|
||||||
tris[tc+0].b = p2;
|
tarrp[0].c = start+p3;
|
||||||
tris[tc+0].c = p3;
|
tarrp[1].a = start+p2;
|
||||||
tris[tc+1].a = p2;
|
tarrp[1].b = start+p4;
|
||||||
tris[tc+1].b = p4;
|
tarrp[1].c = start+p3;
|
||||||
tris[tc+1].c = p3;
|
|
||||||
#endif
|
tarrp += 2;
|
||||||
tc += 2;
|
tarrc += 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4000,9 +3999,6 @@ void D3D_DrawMoltenMetalMesh_Clipped(void)
|
||||||
p[2] = 17+x+(16*y);
|
p[2] = 17+x+(16*y);
|
||||||
p[3] = 16+x+(16*y);
|
p[3] = 16+x+(16*y);
|
||||||
|
|
||||||
if (p[3] > 255)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (!(MeshVertexOutcode[p[0]]&&MeshVertexOutcode[p[1]]&&MeshVertexOutcode[p[2]]&&MeshVertexOutcode[p[3]]))
|
if (!(MeshVertexOutcode[p[0]]&&MeshVertexOutcode[p[1]]&&MeshVertexOutcode[p[2]]&&MeshVertexOutcode[p[3]]))
|
||||||
{
|
{
|
||||||
for (i=0; i<4; i++)
|
for (i=0; i<4; i++)
|
||||||
|
@ -4035,11 +4031,8 @@ void D3D_DrawMoltenMetalMesh_Clipped(void)
|
||||||
if(RenderPolygon.NumberOfVertices<3) continue;
|
if(RenderPolygon.NumberOfVertices<3) continue;
|
||||||
GouraudTexturedPolygon_ClipWithPositiveX();
|
GouraudTexturedPolygon_ClipWithPositiveX();
|
||||||
if(RenderPolygon.NumberOfVertices<3) continue;
|
if(RenderPolygon.NumberOfVertices<3) continue;
|
||||||
|
|
||||||
if (CurrTextureHandle == NULL)
|
/* draw polygon */
|
||||||
D3D_ZBufferedGouraudPolygon_Output(&fakeHeader,RenderPolygon.Vertices);
|
|
||||||
else
|
|
||||||
D3D_ZBufferedGouraudTexturedPolygon_Output(&fakeHeader,RenderPolygon.Vertices);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue