island load screen, some more CText

This commit is contained in:
aap 2019-06-28 22:23:55 +02:00
parent 0711bfacd4
commit 38a7b74b1a
4 changed files with 72 additions and 8 deletions

View File

@ -132,7 +132,7 @@ CCollision::LoadCollisionWhenINeedIt(bool forceChange)
FindPlayerCoors(playerCoors); FindPlayerCoors(playerCoors);
sx = CWorld::GetSectorIndexX(playerCoors.x); sx = CWorld::GetSectorIndexX(playerCoors.x);
sy = CWorld::GetSectorIndexX(playerCoors.y); sy = CWorld::GetSectorIndexY(playerCoors.y);
multipleLevels = false; multipleLevels = false;
veh = FindPlayerVehicle(); veh = FindPlayerVehicle();

View File

@ -15,7 +15,7 @@ CText::CText(void)
keyArray.numEntries = 0; keyArray.numEntries = 0;
data.chars = nil; data.chars = nil;
data.numChars = 0; data.numChars = 0;
unknown = 101; // What's this? version number? encoding = 101;
memset(WideErrorString, 0, sizeof(WideErrorString)); memset(WideErrorString, 0, sizeof(WideErrorString));
} }
@ -96,6 +96,25 @@ CText::Get(const char *key)
return keyArray.Search(key); return keyArray.Search(key);
} }
wchar
CText::GetUpperCase(wchar c)
{
// TODO: do this depending on encoding
if(islower(c))
return toupper(c);
return c;
}
void
CText::UpperCase(wchar *s)
{
while(*s){
*s = GetUpperCase(*s);
s++;
}
}
void void
CKeyArray::Load(uint32 length, uint8 *data, int *offset) CKeyArray::Load(uint32 length, uint8 *data, int *offset)
{ {
@ -186,9 +205,15 @@ CData::Unload(void)
} }
void void
AsciiToUnicode(const char *cs, uint16 *ws) AsciiToUnicode(const char *src, uint16 *dst)
{ {
while((*ws++ = *cs++) != '\0'); while((*dst++ = *src++) != '\0');
}
void
TextCopy(wchar *dst, const wchar *src)
{
while((*dst++ = *src++) != '\0');
} }
STARTPATCHES STARTPATCHES

View File

@ -1,6 +1,7 @@
#pragma once #pragma once
void AsciiToUnicode(const char *cs, wchar *ws); void AsciiToUnicode(const char *src, wchar *dst);
void TextCopy(wchar *dst, const wchar *src);
struct CKeyEntry struct CKeyEntry
{ {
@ -37,13 +38,15 @@ class CText
{ {
CKeyArray keyArray; CKeyArray keyArray;
CData data; CData data;
int8 unknown; int8 encoding;
public: public:
CText(void); CText(void);
~CText(void); ~CText(void);
void Load(void); void Load(void);
void Unload(void); void Unload(void);
wchar *Get(const char *key); wchar *Get(const char *key);
wchar GetUpperCase(wchar c);
void UpperCase(wchar *s);
}; };
extern CText &TheText; extern CText &TheText;

View File

@ -598,10 +598,46 @@ ResetLoadingScreenBar(void)
NumberOfChunksLoaded = 0.0f; NumberOfChunksLoaded = 0.0f;
} }
WRAPPER void void
LoadingIslandScreen(const char *levelName) LoadingIslandScreen(const char *levelName)
{ {
EAXJMP(0x48DA50); CSprite2d *splash;
wchar *name;
char str[100];
wchar wstr[80];
CRGBA col;
splash = LoadSplash(nil);
name = TheText.Get(levelName);
if(!DoRWStuffStartOfFrame(0, 0, 0, 0, 0, 0, 255))
return;
CSprite2d::SetRecipNearClip();
CSprite2d::InitPerFrame();
CFont::InitPerFrame();
DefinedState();
col = CRGBA(255, 255, 255, 255);
splash->Draw(CRect(0.0f, 0.0f, SCREENW, SCREENH), col, col, col, col);
CFont::SetBackgroundOff();
CFont::SetScale(1.5f, 1.5f);
CFont::SetPropOn();
CFont::SetRightJustifyOn();
CFont::SetRightJustifyWrap(150.0f);
CFont::SetFontStyle(FONT_HEADING);
sprintf(str, "WELCOME TO");
AsciiToUnicode(str, wstr);
CFont::SetDropColor(CRGBA(0, 0, 0, 255));
CFont::SetDropShadowPosition(3);
CFont::SetColor(CRGBA(243, 237, 71, 255));
CFont::SetScale(SCREEN_STRETCH_X(1.2f), SCREEN_STRETCH_Y(1.2f));
CFont::PrintString(SCREENW - 20, SCREEN_STRETCH_FROM_BOTTOM(110.0f), TheText.Get("WELCOME"));
TextCopy(wstr, name);
TheText.UpperCase(wstr);
CFont::SetColor(CRGBA(243, 237, 71, 255));
CFont::SetScale(SCREEN_STRETCH_X(1.2f), SCREEN_STRETCH_Y(1.2f));
CFont::PrintString(SCREENW-20, SCREEN_STRETCH_FROM_BOTTOM(80.0f), wstr);
CFont::DrawFonts();
DoRWStuffEndOfFrame();
} }
char* char*