From 3ec3df2e66e591d483444ebe3d2ea76a9c5fddbf Mon Sep 17 00:00:00 2001 From: Steven Fuller Date: Sun, 12 Aug 2001 19:48:15 +0000 Subject: Added noise overlay (for marine image enhancer). --- src/avp/win95/progress_bar.cpp | 47 +++++++++++++++---------------- src/main.c | 22 ++++++++------- src/opengl.c | 64 ++++++++++++++++++++++++++++++++++++++++++ src/stubs.c | 22 --------------- 4 files changed, 99 insertions(+), 56 deletions(-) (limited to 'src') diff --git a/src/avp/win95/progress_bar.cpp b/src/avp/win95/progress_bar.cpp index f714121..752cdc4 100644 --- a/src/avp/win95/progress_bar.cpp +++ b/src/avp/win95/progress_bar.cpp @@ -13,7 +13,7 @@ extern "C" { #include "language.h" extern SCREENDESCRIPTORBLOCK ScreenDescriptorBlock; -extern LPDIRECTDRAWSURFACE lpDDSBack; // DirectDraw back surface +//extern LPDIRECTDRAWSURFACE lpDDSBack; // DirectDraw back surface extern int DebouncedGotAnyKey; extern void MinimalNetCollectMessages(void); @@ -50,7 +50,8 @@ RECT LoadingBarFull_SrcRect; void Start_Progress_Bar() { AAFontImageNumber = CL_LoadImageOnce("Common\\aa_font.RIM",LIO_D3DTEXTURE|LIO_RELATIVEPATH|LIO_RESTORABLE); - + +#if 0 /* TODO: disabled for port */ /* load other graphics */ { char buffer[100]; @@ -113,7 +114,7 @@ void Start_Progress_Bar() } } DDSurface* image=0; - + //set progress bar dimensions BarLeft=ScreenDescriptorBlock.SDB_Width/6; BarRight=(ScreenDescriptorBlock.SDB_Width*5)/6; @@ -150,19 +151,8 @@ void Start_Progress_Bar() 0 ); } - #if 0 - if(image) - { - //draw background image - lpDDSBack->Blt(0,image,0,DDBLT_WAIT,0); - } - else - { - //failed to load background graphic , make do with black background - ColourFillBackBuffer(0); - } - #endif - // RenderGrabbedScreen(); +#endif + //draw initial progress bar LoadingBarEmpty_SrcRect.left=0; @@ -178,13 +168,10 @@ void Start_Progress_Bar() for (int i=0; i<2; i++) { ColourFillBackBuffer(0); +#if 0 /* TODO: disabled for port */ if (LoadingBarEmpty) lpDDSBack->Blt(&LoadingBarEmpty_DestRect,LoadingBarEmpty,&LoadingBarEmpty_SrcRect,DDBLT_WAIT,0); - - #if SOFTWARE_RENDERER - FlushSoftwareZBuffer(); - #else +#endif FlushD3DZBuffer(); - #endif ThisFramesRenderingHasBegun(); @@ -195,6 +182,7 @@ void Start_Progress_Bar() FlipBuffers(); } +#if 0 /* TODO: disabled for port */ if(image) { ReleaseDDSurface(image); @@ -203,6 +191,7 @@ void Start_Progress_Bar() { ReleaseDDSurface(LoadingBarEmpty); } +#endif CurrentPosition=0; @@ -225,7 +214,9 @@ void Set_Progress_Bar_Position(int pos) LoadingBarFull_DestRect.top=(ScreenDescriptorBlock.SDB_Height *11)/12; LoadingBarFull_DestRect.bottom=ScreenDescriptorBlock.SDB_Height-1; +#if 0 /* TODO: disabled for port */ if (LoadingBarFull) lpDDSBack->Blt(&LoadingBarFull_DestRect,LoadingBarFull,&LoadingBarFull_SrcRect,DDBLT_WAIT,0); +#endif FlipBuffers(); /* @@ -243,7 +234,9 @@ void Set_Progress_Bar_Position(int pos) { //time to check our messages LastSendTime=time; +#if 0 /* TODO: disabled for port */ MinimalNetCollectMessages(); +#endif //send messages , mainly needed so that the host will send the game description //allowing people to join while the host is loading NetSendMessages(); @@ -274,6 +267,7 @@ void Game_Has_Loaded(void) // FlipBuffers(); +#if 0 /* TODO: disabled for port */ ColourFillBackBufferQuad ( 0, @@ -282,7 +276,7 @@ void Game_Has_Loaded(void) ScreenDescriptorBlock.SDB_Width-1, ScreenDescriptorBlock.SDB_Height-1 ); - +#endif if (f) { LoadingBarFull_SrcRect.left=0; @@ -295,8 +289,10 @@ void Game_Has_Loaded(void) int h = MUL_FIXED((ScreenDescriptorBlock.SDB_Height)/24,ONE_FIXED-f); LoadingBarFull_DestRect.top=(ScreenDescriptorBlock.SDB_Height *11)/12+h; LoadingBarFull_DestRect.bottom=ScreenDescriptorBlock.SDB_Height-1-h; - + +#if 0 /* TODO: disabled for port */ if (LoadingBarFull) lpDDSBack->Blt(&LoadingBarFull_DestRect,LoadingBarFull,&LoadingBarFull_SrcRect,DDBLT_WAIT,0); +#endif f-=NormalFrameTime; if (f<0) f=0; } @@ -318,7 +314,9 @@ void Game_Has_Loaded(void) /* If in a network game then we may as well check the network messages while waiting*/ if(AvP.Network != I_No_Network) { +#if 0 /* TODO: disabled for port */ MinimalNetCollectMessages(); +#endif //send messages , mainly needed so that the host will send the game description //allowing people to join while the host is loading NetSendMessages(); @@ -330,11 +328,12 @@ void Game_Has_Loaded(void) FadingGameInAfterLoading=ONE_FIXED; - +#if 0 /* TODO: disabled for port */ if (LoadingBarFull) { ReleaseDDSurface(LoadingBarFull); } +#endif } diff --git a/src/main.c b/src/main.c index c63e04e..414f75f 100644 --- a/src/main.c +++ b/src/main.c @@ -357,9 +357,12 @@ void CheckForWindowsMessages() void InGameFlipBuffers() { -#if 1 SDL_GL_SwapBuffers(); -#endif +} + +void FlipBuffers() +{ + SDL_GL_SwapBuffers(); } void ThisFramesRenderingHasBegun() @@ -383,9 +386,8 @@ void ThisFramesRenderingHasFinished() int ExitWindowsSystem() { -#if 1 SDL_Quit(); -#endif + return 0; } @@ -446,16 +448,16 @@ int main(int argc, char *argv[]) AvP.CurrentEnv = AvP.StartingEnv = 0; /* are these even used? */ - AvP.PlayerType = I_Alien; - SetLevelToLoad(AVP_ENVIRONMENT_FERARCO); /* starting alien level */ +// AvP.PlayerType = I_Alien; +// SetLevelToLoad(AVP_ENVIRONMENT_FERARCO); /* starting alien level */ -// AvP.PlayerType = I_Marine; + AvP.PlayerType = I_Marine; // 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_E3DEMOSP); /* demo level */ @@ -497,8 +499,8 @@ int main(int argc, char *argv[]) /* ScanImagesForFMVs(); NOT YET */ ResetFrameCounter(); - -/* Game_Has_Loaded(); NOT YET */ + + Game_Has_Loaded(); ResetFrameCounter(); diff --git a/src/opengl.c b/src/opengl.c index 4da2b6c..0a2e563 100644 --- a/src/opengl.c +++ b/src/opengl.c @@ -27,6 +27,7 @@ extern VIEWDESCRIPTORBLOCK *Global_VDB_Ptr; extern unsigned char GammaValues[256]; extern SCREENDESCRIPTORBLOCK ScreenDescriptorBlock; extern int SpecialFXImageNumber; +extern int StaticImageNumber; static D3DTexture *CurrTextureHandle; @@ -603,6 +604,69 @@ void D3D_PredatorThermalVisionPolygon_Output(POLYHEADER *inputPolyPtr, RENDERVER glEnd(); } +void DrawNoiseOverlay(int tr) +{ + GLfloat x[4], y[4], s[4], t[4], u, v; + int r, g, b; + D3DTexture *tex; + int size; + + r = 255; + g = 255; + b = 255; + + size = 256; + + tex = ImageHeaderArray[StaticImageNumber].D3DTexture; + + CheckTranslucencyModeIsCorrect(TRANSLUCENCY_GLOWING); + // CheckFilteringModeIsCorrect(FILTERING_BILINEAR_ON); + CheckBoundTextureIsCorrect(tex->id); + // CheckDepthFuncIsCorrect(GL_ALWAYS); + glDepthFunc(GL_ALWAYS); + + u = FastRandom()&255; + v = FastRandom()&255; + + x[0] = -1.0f; + y[0] = -1.0f; + s[0] = u / 256.0f; + t[0] = v / 256.0f; + x[1] = 1.0f; + y[1] = -1.0f; + s[1] = (u + size) / 256.0f; + t[1] = v / 256.0f; + x[2] = 1.0f; + y[2] = 1.0f; + s[2] = (u + size) / 256.0f; + t[2] = (v + size) / 256.0f; + x[3] = -1.0f; + y[3] = 1.0f; + s[3] = u / 256.0f; + t[3] = (v + size) / 256.0f; + + SelectPolygonBeginType(3); /* triangles */ + glColor4ub(r, g, b, tr); + + 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(); + + glDepthFunc(GL_LEQUAL); +} + void D3D_PredatorScreenInversionOverlay() { CheckTranslucencyModeIsCorrect(TRANSLUCENCY_DARKENINGCOLOUR); diff --git a/src/stubs.c b/src/stubs.c index 4933646..438c58a 100644 --- a/src/stubs.c +++ b/src/stubs.c @@ -85,18 +85,6 @@ void CheckCDVolume() } -/* progress_bar.cpp */ -void Start_Progress_Bar() -{ - fprintf(stderr, "Start_Progress_Bar()\n"); -} - -void Set_Progress_Bar_Position(int pos) -{ - fprintf(stderr, "Set_Progress_Bar_Position(%d)\n", pos); -} - - /* smacker.c */ int FmvColourRed; int FmvColourGreen; @@ -409,11 +397,6 @@ void InitForceField() fprintf(stderr, "InitForceField()\n"); } -void DrawNoiseOverlay(int t) -{ - fprintf(stderr, "DrawNoiseOverlay(%d)\n", t); -} - void DrawScanlinesOverlay(float level) { fprintf(stderr, "DrawScanlinesOverlay(%f)\n", level); @@ -562,11 +545,6 @@ void D3D_BackdropPolygon_Output(POLYHEADER *inputPolyPtr,RENDERVERTEX *renderVer long BackBufferPitch; int VideoModeColourDepth; -void FlipBuffers() -{ - fprintf(stderr, "FlipBuffers()\n"); -} - int ChangePalette (unsigned char* NewPalette) { fprintf(stderr, "ChangePalette(%p)\n", NewPalette); -- cgit v1.3