diff options
Diffstat (limited to '')
-rw-r--r-- | src/Collision.cpp | 2 | ||||
-rw-r--r-- | src/Text.cpp | 31 | ||||
-rw-r--r-- | src/Text.h | 7 | ||||
-rw-r--r-- | src/main.cpp | 40 |
4 files changed, 72 insertions, 8 deletions
diff --git a/src/Collision.cpp b/src/Collision.cpp index 2ab609f1..95e6626a 100644 --- a/src/Collision.cpp +++ b/src/Collision.cpp @@ -132,7 +132,7 @@ CCollision::LoadCollisionWhenINeedIt(bool forceChange) FindPlayerCoors(playerCoors); sx = CWorld::GetSectorIndexX(playerCoors.x); - sy = CWorld::GetSectorIndexX(playerCoors.y); + sy = CWorld::GetSectorIndexY(playerCoors.y); multipleLevels = false; veh = FindPlayerVehicle(); diff --git a/src/Text.cpp b/src/Text.cpp index eeb46253..d7d63467 100644 --- a/src/Text.cpp +++ b/src/Text.cpp @@ -15,7 +15,7 @@ CText::CText(void) keyArray.numEntries = 0; data.chars = nil; data.numChars = 0; - unknown = 101; // What's this? version number? + encoding = 101; memset(WideErrorString, 0, sizeof(WideErrorString)); } @@ -96,6 +96,25 @@ CText::Get(const char *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 CKeyArray::Load(uint32 length, uint8 *data, int *offset) { @@ -186,9 +205,15 @@ CData::Unload(void) } void -AsciiToUnicode(const char *cs, uint16 *ws) +AsciiToUnicode(const char *src, uint16 *dst) +{ + while((*dst++ = *src++) != '\0'); +} + +void +TextCopy(wchar *dst, const wchar *src) { - while((*ws++ = *cs++) != '\0'); + while((*dst++ = *src++) != '\0'); } STARTPATCHES @@ -1,6 +1,7 @@ #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 { @@ -37,13 +38,15 @@ class CText { CKeyArray keyArray; CData data; - int8 unknown; + int8 encoding; public: CText(void); ~CText(void); void Load(void); void Unload(void); wchar *Get(const char *key); + wchar GetUpperCase(wchar c); + void UpperCase(wchar *s); }; extern CText &TheText; diff --git a/src/main.cpp b/src/main.cpp index 8835bee9..c8af9ae0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -598,10 +598,46 @@ ResetLoadingScreenBar(void) NumberOfChunksLoaded = 0.0f; } -WRAPPER void +void 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* |