Implemented the Progress Bar during Loading.
This commit is contained in:
parent
9a32158ae8
commit
bdb3cff6fd
4 changed files with 86 additions and 24 deletions
2
TODO
2
TODO
|
@ -3,7 +3,7 @@
|
||||||
[DONE] [11/10/01] Save/Load Game support.
|
[DONE] [11/10/01] Save/Load Game support.
|
||||||
[DONE] [11/25/01] CD Audio.
|
[DONE] [11/25/01] CD Audio.
|
||||||
[DONE] [12/05/01] Menus.
|
[DONE] [12/05/01] Menus.
|
||||||
* Progress bar.
|
[DONE] [12/05/01] Progress bar.
|
||||||
* Make vidmodes work.
|
* Make vidmodes work.
|
||||||
* Debug "pure virtual method called"
|
* Debug "pure virtual method called"
|
||||||
* Proper file loading/saving (ignore case, search certain directories) and
|
* Proper file loading/saving (ignore case, search certain directories) and
|
||||||
|
|
|
@ -28,6 +28,8 @@ extern int FadingGameInAfterLoading;
|
||||||
extern void RenderBriefingText(int centreY, int brightness);
|
extern void RenderBriefingText(int centreY, int brightness);
|
||||||
|
|
||||||
extern void InGameFlipBuffers();
|
extern void InGameFlipBuffers();
|
||||||
|
|
||||||
|
extern void BltImage(RECT *dest, DDSurface *image, RECT *src);
|
||||||
};
|
};
|
||||||
|
|
||||||
static int CurrentPosition=0;
|
static int CurrentPosition=0;
|
||||||
|
@ -47,13 +49,10 @@ RECT LoadingBarEmpty_SrcRect;
|
||||||
RECT LoadingBarFull_DestRect;
|
RECT LoadingBarFull_DestRect;
|
||||||
RECT LoadingBarFull_SrcRect;
|
RECT LoadingBarFull_SrcRect;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Start_Progress_Bar()
|
void Start_Progress_Bar()
|
||||||
{
|
{
|
||||||
AAFontImageNumber = CL_LoadImageOnce("Common\\aa_font.RIM",LIO_D3DTEXTURE|LIO_RELATIVEPATH|LIO_RESTORABLE);
|
AAFontImageNumber = CL_LoadImageOnce("Common\\aa_font.RIM",LIO_D3DTEXTURE|LIO_RELATIVEPATH|LIO_RESTORABLE);
|
||||||
|
|
||||||
#if 0 /* TODO: disabled for port */
|
|
||||||
/* load other graphics */
|
/* load other graphics */
|
||||||
{
|
{
|
||||||
char buffer[100];
|
char buffer[100];
|
||||||
|
@ -153,7 +152,6 @@ void Start_Progress_Bar()
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
//draw initial progress bar
|
//draw initial progress bar
|
||||||
|
|
||||||
|
@ -170,9 +168,8 @@ void Start_Progress_Bar()
|
||||||
for (int i=0; i<2; i++)
|
for (int i=0; i<2; i++)
|
||||||
{
|
{
|
||||||
ColourFillBackBuffer(0);
|
ColourFillBackBuffer(0);
|
||||||
#if 0 /* TODO: disabled for port */
|
if (LoadingBarEmpty) BltImage(&LoadingBarEmpty_DestRect,LoadingBarEmpty,&LoadingBarEmpty_SrcRect);
|
||||||
if (LoadingBarEmpty) lpDDSBack->Blt(&LoadingBarEmpty_DestRect,LoadingBarEmpty,&LoadingBarEmpty_SrcRect,DDBLT_WAIT,0);
|
|
||||||
#endif
|
|
||||||
FlushD3DZBuffer();
|
FlushD3DZBuffer();
|
||||||
|
|
||||||
ThisFramesRenderingHasBegun();
|
ThisFramesRenderingHasBegun();
|
||||||
|
@ -185,7 +182,6 @@ void Start_Progress_Bar()
|
||||||
InGameFlipBuffers();
|
InGameFlipBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0 /* TODO: disabled for port */
|
|
||||||
if(image)
|
if(image)
|
||||||
{
|
{
|
||||||
ReleaseDDSurface(image);
|
ReleaseDDSurface(image);
|
||||||
|
@ -194,7 +190,7 @@ void Start_Progress_Bar()
|
||||||
{
|
{
|
||||||
ReleaseDDSurface(LoadingBarEmpty);
|
ReleaseDDSurface(LoadingBarEmpty);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
CurrentPosition=0;
|
CurrentPosition=0;
|
||||||
|
|
||||||
|
|
||||||
|
@ -217,9 +213,8 @@ void Set_Progress_Bar_Position(int pos)
|
||||||
LoadingBarFull_DestRect.top=(ScreenDescriptorBlock.SDB_Height *11)/12;
|
LoadingBarFull_DestRect.top=(ScreenDescriptorBlock.SDB_Height *11)/12;
|
||||||
LoadingBarFull_DestRect.bottom=ScreenDescriptorBlock.SDB_Height-1;
|
LoadingBarFull_DestRect.bottom=ScreenDescriptorBlock.SDB_Height-1;
|
||||||
|
|
||||||
#if 0 /* TODO: disabled for port */
|
if (LoadingBarFull) BltImage(&LoadingBarFull_DestRect,LoadingBarFull,&LoadingBarFull_SrcRect);
|
||||||
if (LoadingBarFull) lpDDSBack->Blt(&LoadingBarFull_DestRect,LoadingBarFull,&LoadingBarFull_SrcRect,DDBLT_WAIT,0);
|
|
||||||
#endif
|
|
||||||
/* FlipBuffers(); */
|
/* FlipBuffers(); */
|
||||||
InGameFlipBuffers();
|
InGameFlipBuffers();
|
||||||
|
|
||||||
|
@ -268,8 +263,6 @@ void Game_Has_Loaded(void)
|
||||||
CheckForWindowsMessages();
|
CheckForWindowsMessages();
|
||||||
ReadUserInput();
|
ReadUserInput();
|
||||||
|
|
||||||
// InGameFlipBuffers();
|
|
||||||
|
|
||||||
ColourFillBackBufferQuad
|
ColourFillBackBufferQuad
|
||||||
(
|
(
|
||||||
0,
|
0,
|
||||||
|
@ -292,9 +285,8 @@ void Game_Has_Loaded(void)
|
||||||
LoadingBarFull_DestRect.top=(ScreenDescriptorBlock.SDB_Height *11)/12+h;
|
LoadingBarFull_DestRect.top=(ScreenDescriptorBlock.SDB_Height *11)/12+h;
|
||||||
LoadingBarFull_DestRect.bottom=ScreenDescriptorBlock.SDB_Height-1-h;
|
LoadingBarFull_DestRect.bottom=ScreenDescriptorBlock.SDB_Height-1-h;
|
||||||
|
|
||||||
#if 0 /* TODO: disabled for port */
|
if (LoadingBarFull) BltImage(&LoadingBarFull_DestRect,LoadingBarFull,&LoadingBarFull_SrcRect);
|
||||||
if (LoadingBarFull) lpDDSBack->Blt(&LoadingBarFull_DestRect,LoadingBarFull,&LoadingBarFull_SrcRect,DDBLT_WAIT,0);
|
|
||||||
#endif
|
|
||||||
f-=NormalFrameTime;
|
f-=NormalFrameTime;
|
||||||
if (f<0) f=0;
|
if (f<0) f=0;
|
||||||
}
|
}
|
||||||
|
@ -333,13 +325,10 @@ void Game_Has_Loaded(void)
|
||||||
|
|
||||||
FadingGameInAfterLoading=ONE_FIXED;
|
FadingGameInAfterLoading=ONE_FIXED;
|
||||||
|
|
||||||
#if 0 /* TODO: disabled for port */
|
|
||||||
if (LoadingBarFull)
|
if (LoadingBarFull)
|
||||||
{
|
{
|
||||||
ReleaseDDSurface(LoadingBarFull);
|
ReleaseDDSurface(LoadingBarFull);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
77
src/opengl.c
77
src/opengl.c
|
@ -2388,16 +2388,55 @@ void ColourFillBackBuffer(int FillColour)
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColourFillBackBufferQuad(int FillColour, int LeftX, int TopY, int RightX, int BotY)
|
void ColourFillBackBufferQuad(int FillColour, int x0, int y0, int x1, int y1)
|
||||||
{
|
{
|
||||||
|
GLfloat x[4], y[4];
|
||||||
int r, g, b, a;
|
int r, g, b, a;
|
||||||
|
|
||||||
|
if (y1 <= y0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CheckTranslucencyModeIsCorrect(TRANSLUCENCY_OFF);
|
||||||
|
CheckBoundTextureIsCorrect(NULL);
|
||||||
|
|
||||||
b = ((FillColour >> 0) & 0xFF);
|
b = ((FillColour >> 0) & 0xFF);
|
||||||
g = ((FillColour >> 8) & 0xFF);
|
g = ((FillColour >> 8) & 0xFF);
|
||||||
r = ((FillColour >> 16) & 0xFF);
|
r = ((FillColour >> 16) & 0xFF);
|
||||||
a = ((FillColour >> 24) & 0xFF);
|
a = ((FillColour >> 24) & 0xFF);
|
||||||
|
|
||||||
|
glColor4ub(r, g, b, a);
|
||||||
|
|
||||||
|
x[0] = x0;
|
||||||
|
x[0] = (x[0] - ScreenDescriptorBlock.SDB_CentreX)/ScreenDescriptorBlock.SDB_CentreX;
|
||||||
|
y[0] = y0;
|
||||||
|
y[0] = -(y[0] - ScreenDescriptorBlock.SDB_CentreY)/ScreenDescriptorBlock.SDB_CentreY;
|
||||||
|
|
||||||
D3D_Rectangle(LeftX, TopY, RightX, BotY, r, g, b, a);
|
x[1] = x1 - 1;
|
||||||
|
x[1] = (x[1] - ScreenDescriptorBlock.SDB_CentreX)/ScreenDescriptorBlock.SDB_CentreX;
|
||||||
|
y[1] = y0;
|
||||||
|
y[1] = -(y[1] - ScreenDescriptorBlock.SDB_CentreY)/ScreenDescriptorBlock.SDB_CentreY;
|
||||||
|
|
||||||
|
x[2] = x1 - 1;
|
||||||
|
x[2] = (x[2] - ScreenDescriptorBlock.SDB_CentreX)/ScreenDescriptorBlock.SDB_CentreX;
|
||||||
|
y[2] = y1 - 1;
|
||||||
|
y[2] = -(y[2] - ScreenDescriptorBlock.SDB_CentreY)/ScreenDescriptorBlock.SDB_CentreY;
|
||||||
|
|
||||||
|
x[3] = x0;
|
||||||
|
x[3] = (x[3] - ScreenDescriptorBlock.SDB_CentreX)/ScreenDescriptorBlock.SDB_CentreX;
|
||||||
|
y[3] = y1 - 1;
|
||||||
|
y[3] = -(y[3] - ScreenDescriptorBlock.SDB_CentreY)/ScreenDescriptorBlock.SDB_CentreY;
|
||||||
|
|
||||||
|
SelectPolygonBeginType(3); /* triangles */
|
||||||
|
|
||||||
|
glVertex3f(x[0], y[0], -1.0f);
|
||||||
|
glVertex3f(x[1], y[1], -1.0f);
|
||||||
|
glVertex3f(x[3], y[3], -1.0f);
|
||||||
|
|
||||||
|
glVertex3f(x[1], y[1], -1.0f);
|
||||||
|
glVertex3f(x[2], y[2], -1.0f);
|
||||||
|
glVertex3f(x[3], y[3], -1.0f);
|
||||||
|
|
||||||
|
glEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
void D3D_DrawBackdrop()
|
void D3D_DrawBackdrop()
|
||||||
|
@ -2457,6 +2496,40 @@ void D3D_DrawBackdrop()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BltImage(RECT *dest, DDSurface *image, RECT *src)
|
||||||
|
{
|
||||||
|
int width1, width;
|
||||||
|
int height1, height;
|
||||||
|
|
||||||
|
width = dest->right - dest->left + 1;
|
||||||
|
width1 = src->right - src->left + 1;
|
||||||
|
height = dest->bottom - dest->top + 1;
|
||||||
|
height1 = src->bottom - src->top + 1;
|
||||||
|
|
||||||
|
glPushAttrib(GL_COLOR_BUFFER_BIT | GL_PIXEL_MODE_BIT);
|
||||||
|
glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
|
||||||
|
|
||||||
|
glDisable(GL_BLEND);
|
||||||
|
|
||||||
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||||
|
glPixelStorei(GL_UNPACK_ROW_LENGTH, image->w);
|
||||||
|
glPixelZoom((double)width/(double)width1, (double)height/(double)height1);
|
||||||
|
|
||||||
|
glMatrixMode(GL_PROJECTION);
|
||||||
|
glPushMatrix();
|
||||||
|
glLoadIdentity();
|
||||||
|
|
||||||
|
glOrtho(0.0, ScreenDescriptorBlock.SDB_Width, 0.0, ScreenDescriptorBlock.SDB_Height, -1.0, 1.0);
|
||||||
|
glRasterPos2i(dest->left, ScreenDescriptorBlock.SDB_Height-dest->bottom);
|
||||||
|
|
||||||
|
glDrawPixels(width1, height1, GL_RGBA, GL_UNSIGNED_BYTE, image->buf);
|
||||||
|
|
||||||
|
glPopMatrix();
|
||||||
|
|
||||||
|
glPopClientAttrib();
|
||||||
|
glPopAttrib();;
|
||||||
|
}
|
||||||
|
|
||||||
/* ** */
|
/* ** */
|
||||||
|
|
||||||
/* Hacked in special effects */
|
/* Hacked in special effects */
|
||||||
|
|
|
@ -6,6 +6,7 @@ typedef struct AwBackupTexture * AW_BACKUPTEXTUREHANDLE;
|
||||||
|
|
||||||
typedef struct DIRECTDRAWSURFACE
|
typedef struct DIRECTDRAWSURFACE
|
||||||
{
|
{
|
||||||
|
unsigned char *buf;
|
||||||
int id;
|
int id;
|
||||||
|
|
||||||
int w;
|
int w;
|
||||||
|
@ -20,7 +21,6 @@ typedef DIRECTDRAWSURFACE DDSurface;
|
||||||
typedef struct DIRECT3DTEXTURE
|
typedef struct DIRECT3DTEXTURE
|
||||||
{
|
{
|
||||||
unsigned char *buf;
|
unsigned char *buf;
|
||||||
|
|
||||||
int id;
|
int id;
|
||||||
|
|
||||||
int w;
|
int w;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue