summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSteven Fuller <relnev@icculus.org>2001-08-12 21:29:20 +0000
committerPatryk Obara <dreamer.tan@gmail.com>2019-08-20 02:22:36 +0200
commita5c6d1b5ebf78cbd050b7b9f9547191820301a51 (patch)
tree9df4f2f3f0b5cdaee30f03424a23a30703158b02 /src
parent3ec3df2e66e591d483444ebe3d2ea76a9c5fddbf (diff)
Added code for Alien's special vision mode.
Marine HUD numbers are now drawn. Disabled the "Press Any Key" in the progress bar code for now.
Diffstat (limited to 'src')
-rw-r--r--src/avp/win95/d3d_hud.cpp5
-rw-r--r--src/avp/win95/progress_bar.cpp5
-rw-r--r--src/opengl.c119
-rw-r--r--src/stubs.c11
-rw-r--r--src/stubs2.cpp11
5 files changed, 130 insertions, 21 deletions
diff --git a/src/avp/win95/d3d_hud.cpp b/src/avp/win95/d3d_hud.cpp
index 85baf15..854e8e4 100644
--- a/src/avp/win95/d3d_hud.cpp
+++ b/src/avp/win95/d3d_hud.cpp
@@ -29,6 +29,8 @@ extern "C" {
#include "language.h"
+extern void D3D_RenderHUDString_Centred(char *stringPtr, int centreX, int y, int colour);
+extern void D3D_RenderHUDNumber_Centred(unsigned int number,int x,int y,int colour);
extern "C++"
{
@@ -36,9 +38,6 @@ extern "C++"
#include "pcmenus.h"
//#include "projload.hpp" // c++ header which ignores class definitions/member functions if __cplusplus is not defined ?
#include "chnkload.hpp" // c++ header which ignores class definitions/member functions if __cplusplus is not defined ?
-extern void D3D_RenderHUDString_Centred(char *stringPtr, int centreX, int y, int colour);
-extern void D3D_RenderHUDNumber_Centred(unsigned int number,int x,int y,int colour);
-
};
#include "d3d_hud.h"
diff --git a/src/avp/win95/progress_bar.cpp b/src/avp/win95/progress_bar.cpp
index 752cdc4..9ec23ad 100644
--- a/src/avp/win95/progress_bar.cpp
+++ b/src/avp/win95/progress_bar.cpp
@@ -324,8 +324,11 @@ void Game_Has_Loaded(void)
}
}
+#if 0 /* TODO: disabled for port */
while(!DebouncedGotAnyKey);
-
+#endif
+ while (0);
+
FadingGameInAfterLoading=ONE_FIXED;
#if 0 /* TODO: disabled for port */
diff --git a/src/opengl.c b/src/opengl.c
index 0a2e563..7c68287 100644
--- a/src/opengl.c
+++ b/src/opengl.c
@@ -18,6 +18,7 @@
#include "kshape.h"
#include "prototyp.h"
#include "d3d_hud.h"
+#include "hud_layout.h"
#include "avp_userprofile.h"
#include "aw.h"
@@ -26,8 +27,13 @@ extern IMAGEHEADER ImageHeaderArray[];
extern VIEWDESCRIPTORBLOCK *Global_VDB_Ptr;
extern unsigned char GammaValues[256];
extern SCREENDESCRIPTORBLOCK ScreenDescriptorBlock;
+
extern int SpecialFXImageNumber;
extern int StaticImageNumber;
+extern int HUDFontsImageNumber;
+
+extern int HUDScaleFactor;
+extern int CloakingPhase;
static D3DTexture *CurrTextureHandle;
@@ -667,6 +673,68 @@ void DrawNoiseOverlay(int tr)
glDepthFunc(GL_LEQUAL);
}
+void D3D_ScreenInversionOverlay()
+{
+ D3DTexture *tex;
+ int theta[2];
+ int i;
+
+ theta[0] = (CloakingPhase/8)&4095;
+ theta[1] = (800-CloakingPhase/8)&4095;
+
+ tex = ImageHeaderArray[SpecialFXImageNumber].D3DTexture;
+
+ CheckTranslucencyModeIsCorrect(TRANSLUCENCY_DARKENINGCOLOUR);
+// CheckFilteringModeIsCorrect(FILTERING_BILINEAR_ON);
+ CheckBoundTextureIsCorrect(tex->id);
+
+ glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
+
+ for (i = 0; i < 2; i++) {
+ GLfloat x[4], y[4], s[4], t[4];
+
+ float sin = (GetSin(theta[i]))/65536.0f/16.0f;
+ float cos = (GetCos(theta[i]))/65536.0f/16.0f;
+
+ x[0] = -1.0f;
+ y[0] = -1.0f;
+ s[0] = 0.375f + (cos*(-1) - sin*(-1));
+ t[0] = 0.375f + (sin*(-1) + cos*(-1));
+ x[1] = 1.0f;
+ y[1] = -1.0f;
+ s[1] = 0.375f + (cos*(+1) - sin*(-1));
+ t[1] = 0.375f + (sin*(+1) + cos*(-1));
+ x[2] = 1.0f;
+ y[2] = 1.0f;
+ s[2] = 0.375f + (cos*(+1) - sin*(+1));
+ t[2] = 0.375f + (sin*(+1) + cos*(+1));
+ x[3] = -1.0f;
+ y[3] = 1.0f;
+ s[3] = 0.375f + (cos*(-1) - sin*(+1));
+ t[3] = 0.375f + (sin*(-1) + cos*(+1));
+
+ SelectPolygonBeginType(3); /* triangles */
+
+ glTexCoord2f(s[0], t[0]);
+ glVertex3f(x[0], y[0], 1.0f);
+ glTexCoord2f(s[1], t[1]);
+ glVertex3f(x[1], y[1], 1.0f);
+ glTexCoord2f(s[3], t[3]);
+ glVertex3f(x[3], y[3], 1.0f);
+
+ glTexCoord2f(s[1], t[1]);
+ glVertex3f(x[1], y[1], 1.0f);
+ glTexCoord2f(s[2], t[2]);
+ glVertex3f(x[2], y[2], 1.0f);
+ glTexCoord2f(s[3], t[3]);
+ glVertex3f(x[3], y[3], 1.0f);
+
+ glEnd();
+
+ CheckTranslucencyModeIsCorrect(TRANSLUCENCY_COLOUR);
+ }
+}
+
void D3D_PredatorScreenInversionOverlay()
{
CheckTranslucencyModeIsCorrect(TRANSLUCENCY_DARKENINGCOLOUR);
@@ -756,3 +824,54 @@ void D3D_HUDQuad_Output(int imageNumber, struct VertexTag *quadVerticesPtr, unsi
glEnd();
}
+
+void D3D_RenderHUDNumber_Centred(unsigned int number,int x,int y,int colour)
+{
+ struct VertexTag quadVertices[4];
+ int noOfDigits=3;
+ int h = MUL_FIXED(HUDScaleFactor,HUD_DIGITAL_NUMBERS_HEIGHT);
+ int w = MUL_FIXED(HUDScaleFactor,HUD_DIGITAL_NUMBERS_WIDTH);
+
+ quadVertices[0].Y = y;
+ quadVertices[1].Y = y;
+ quadVertices[2].Y = y + h;
+ quadVertices[3].Y = y + h;
+
+ x += (3*w)/2;
+
+// CheckFilteringModeIsCorrect(FILTERING_BILINEAR_OFF);
+
+ do {
+ int topLeftU, topLeftV;
+
+ int digit = number%10;
+ number/=10;
+
+ if (digit<8) {
+ topLeftU = 1+(digit)*16;
+ topLeftV = 1;
+ } else {
+ topLeftU = 1+(digit-8)*16;
+ topLeftV = 1+24;
+ }
+ if (AvP.PlayerType == I_Marine) topLeftV+=80;
+
+ quadVertices[0].U = topLeftU;
+ quadVertices[0].V = topLeftV;
+ quadVertices[1].U = topLeftU + HUD_DIGITAL_NUMBERS_WIDTH;
+ quadVertices[1].V = topLeftV;
+ quadVertices[2].U = topLeftU + HUD_DIGITAL_NUMBERS_WIDTH;
+ quadVertices[2].V = topLeftV + HUD_DIGITAL_NUMBERS_HEIGHT;
+ quadVertices[3].U = topLeftU;
+ quadVertices[3].V = topLeftV + HUD_DIGITAL_NUMBERS_HEIGHT;
+
+ x -= 1+w;
+ quadVertices[0].X = x;
+ quadVertices[3].X = x;
+ quadVertices[1].X = x + w;
+ quadVertices[2].X = x + w;
+
+ D3D_HUDQuad_Output(HUDFontsImageNumber, quadVertices, colour);
+
+ } while (--noOfDigits);
+}
diff --git a/src/stubs.c b/src/stubs.c
index 438c58a..ba36e93 100644
--- a/src/stubs.c
+++ b/src/stubs.c
@@ -495,11 +495,6 @@ void D3D_SkyPolygon_Output(POLYHEADER *inputPolyPtr,RENDERVERTEX *renderVertices
fprintf(stderr, "D3D_SkyPolygon_Output(%p, %p)\n", inputPolyPtr, renderVerticesPtr);
}
-void D3D_ScreenInversionOverlay()
-{
- fprintf(stderr, "D3D_ScreenInversionOverlay()\n");
-}
-
void D3D_PlayerOnFireOverlay()
{
fprintf(stderr, "D3D_PlayerOnFireOverlay()\n");
@@ -540,7 +535,11 @@ void D3D_BackdropPolygon_Output(POLYHEADER *inputPolyPtr,RENDERVERTEX *renderVer
fprintf(stderr, "D3D_BackdropPolygon_Output(%p, %p)\n", inputPolyPtr, renderVerticesPtr);
}
-
+void D3D_RenderHUDString_Centred(char *stringPtr, int centreX, int y, int colour)
+{
+ fprintf(stderr, "D3D_RenderHUDString_Centred(%s, %d, %d, %d)\n", stringPtr, centreX, y, colour);
+}
+
/* dd_func.cpp */
long BackBufferPitch;
int VideoModeColourDepth;
diff --git a/src/stubs2.cpp b/src/stubs2.cpp
index e2c8d8c..35610f2 100644
--- a/src/stubs2.cpp
+++ b/src/stubs2.cpp
@@ -15,17 +15,6 @@ void r2rect::AlphaFill(unsigned char R, unsigned char G, unsigned char B, unsign
fprintf(stderr, "r2rect::AlphaFill(%d, %d, %d, %d)\n", R, G, B, translucency);
}
-void D3D_RenderHUDNumber_Centred(unsigned int number,int x,int y,int colour)
-{
- fprintf(stderr, "D3D_RenderHUDNumber_Centred(%d, %d, %d, %d)\n", number, x, y, colour);
-}
-
-void D3D_RenderHUDString_Centred(char *stringPtr, int centreX, int y, int colour)
-{
- fprintf(stderr, "D3D_RenderHUDString_Centred(%s, %d, %d, %d)\n", stringPtr, centreX, y, colour);
-}
-
-
/* indexfnt.cpp */
IndexedFont* IndexedFont :: pIndexedFont[ IndexedFonts_MAX_NUMBER_OF_FONTS ];