loading screens

This commit is contained in:
aap 2020-05-17 19:45:21 +02:00
parent 3f2bdc096d
commit a0703fd9e1

View File

@ -81,7 +81,7 @@ RwRGBA gColourTop;
bool gameAlreadyInitialised; bool gameAlreadyInitialised;
float NumberOfChunksLoaded; float NumberOfChunksLoaded;
#define TOTALNUMCHUNKS 73.0f #define TOTALNUMCHUNKS 95.0f
bool g_SlowMode = false; bool g_SlowMode = false;
char version_name[64]; char version_name[64];
@ -356,6 +356,7 @@ Terminate3D(void)
CSprite2d splash; CSprite2d splash;
int splashTxdId = -1; int splashTxdId = -1;
//--MIAMI: done
CSprite2d* CSprite2d*
LoadSplash(const char *name) LoadSplash(const char *name)
{ {
@ -401,22 +402,23 @@ DestroySplashScreen(void)
splashTxdId = -1; splashTxdId = -1;
} }
//--MIAMI: done
Const char* Const char*
GetRandomSplashScreen(void) GetRandomSplashScreen(void)
{ {
int index; int index;
static int index2 = 0; static int index2 = 0;
static char splashName[128]; static char splashName[128];
static int splashIndex[24] = { static int splashIndex[12] = {
25, 22, 4, 13, 1, 2,
1, 21, 14, 16, 3, 4,
10, 12, 5, 9, 5, 11,
11, 18, 3, 2, 6, 8,
19, 23, 7, 17, 9, 10,
15, 6, 8, 20 7, 12
}; };
index = splashIndex[4*index2 + CGeneral::GetRandomNumberInRange(0, 3)]; index = splashIndex[2*index2 + CGeneral::GetRandomNumberInRange(0, 2)];
index2++; index2++;
if(index2 == 6) if(index2 == 6)
index2 = 0; index2 = 0;
@ -444,16 +446,14 @@ ResetLoadingScreenBar()
} }
// TODO: compare with PS2 // TODO: compare with PS2
//--MIAMI: done
void void
LoadingScreen(const char *str1, const char *str2, const char *splashscreen) LoadingScreen(const char *str1, const char *str2, const char *splashscreen)
{ {
CSprite2d *splash; CSprite2d *splash;
#ifndef RANDOMSPLASH #ifndef RANDOMSPLASH
if(CGame::frenchGame || CGame::germanGame || !CGame::nastyGame) splashscreen = "LOADSC0";
splashscreen = "mainsc2";
else
splashscreen = "mainsc1";
#endif #endif
splash = LoadSplash(splashscreen); splash = LoadSplash(splashscreen);
@ -474,36 +474,50 @@ LoadingScreen(const char *str1, const char *str2, const char *splashscreen)
if(str1){ if(str1){
NumberOfChunksLoaded += 1; NumberOfChunksLoaded += 1;
#ifndef RANDOMSPLASH
float hpos = SCREEN_SCALE_X(40); float hpos = SCREEN_SCALE_X(40);
float length = SCREEN_WIDTH - SCREEN_SCALE_X(100); float length = SCREEN_WIDTH - SCREEN_SCALE_X(80);
float vpos = SCREEN_HEIGHT - SCREEN_SCALE_Y(13); float top = SCREEN_HEIGHT - SCREEN_SCALE_Y(14);
float height = SCREEN_SCALE_Y(7); float bottom = top + SCREEN_SCALE_Y(5);
CSprite2d::DrawRect(CRect(hpos, vpos, hpos + length, vpos + height), CRGBA(40, 53, 68, 255)); #else
float hpos = SCREEN_STRETCH_X(40);
float length = SCREEN_STRETCH_X(440);
// this is rather weird
float top = SCREEN_STRETCH_Y(407.4f - 7.0f/3.0f);
float bottom = SCREEN_STRETCH_Y(407.4f + 7.0f/3.0f);
#endif
CSprite2d::DrawRect(CRect(hpos-1.0f, top-1.0f, hpos+length+1.0f, bottom+1.0f), CRGBA(40, 53, 68, 255));
CSprite2d::DrawRect(CRect(hpos, top, hpos+length, bottom), CRGBA(155, 50, 125, 255));
length *= NumberOfChunksLoaded/TOTALNUMCHUNKS; length *= NumberOfChunksLoaded/TOTALNUMCHUNKS;
CSprite2d::DrawRect(CRect(hpos, vpos, hpos + length, vpos + height), CRGBA(81, 106, 137, 255)); CSprite2d::DrawRect(CRect(hpos, top, hpos+length, bottom), CRGBA(255, 150, 225, 255));
// this is done by the game but is unused // this is done by the game but is unused
CFont::SetBackgroundOff();
CFont::SetScale(SCREEN_SCALE_X(2), SCREEN_SCALE_Y(2)); CFont::SetScale(SCREEN_SCALE_X(2), SCREEN_SCALE_Y(2));
CFont::SetPropOn(); CFont::SetPropOn();
CFont::SetRightJustifyOn(); CFont::SetRightJustifyOn();
CFont::SetDropShadowPosition(1);
CFont::SetDropColor(CRGBA(0, 0, 0, 255));
CFont::SetFontStyle(FONT_HEADING); CFont::SetFontStyle(FONT_HEADING);
#ifdef CHATTYSPLASH #ifdef CHATTYSPLASH
// my attempt // my attempt
static wchar tmpstr[80]; static wchar tmpstr[80];
float yscale = SCREEN_SCALE_Y(0.9f); float yscale = SCREEN_SCALE_Y(0.9f);
vpos -= 45*yscale; top -= 45*yscale;
CFont::SetScale(SCREEN_SCALE_X(0.75f), yscale); CFont::SetScale(SCREEN_SCALE_X(0.75f), yscale);
CFont::SetPropOn(); CFont::SetPropOn();
CFont::SetRightJustifyOff(); CFont::SetRightJustifyOff();
CFont::SetFontStyle(FONT_BANK); CFont::SetFontStyle(FONT_BANK);
CFont::SetColor(CRGBA(255, 255, 255, 255)); CFont::SetColor(CRGBA(255, 255, 255, 255));
AsciiToUnicode(str1, tmpstr); AsciiToUnicode(str1, tmpstr);
CFont::PrintString(hpos, vpos, tmpstr); CFont::PrintString(hpos, top, tmpstr);
vpos += 22*yscale; top += 22*yscale;
AsciiToUnicode(str2, tmpstr); AsciiToUnicode(str2, tmpstr);
CFont::PrintString(hpos, vpos, tmpstr); CFont::PrintString(hpos, top, tmpstr);
#endif #endif
} }