summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2019-06-28 22:23:55 +0200
committeraap <aap@papnet.eu>2019-06-28 22:23:55 +0200
commit38a7b74b1a10ec64b0ebac060cac92786081f3e0 (patch)
treecfa2f9a7bd82c20decb84f12dcd1fd99b6b7bf3c
parentfixed CFileMgr, the craziest bug i ever had (diff)
downloadre3-38a7b74b1a10ec64b0ebac060cac92786081f3e0.tar
re3-38a7b74b1a10ec64b0ebac060cac92786081f3e0.tar.gz
re3-38a7b74b1a10ec64b0ebac060cac92786081f3e0.tar.bz2
re3-38a7b74b1a10ec64b0ebac060cac92786081f3e0.tar.lz
re3-38a7b74b1a10ec64b0ebac060cac92786081f3e0.tar.xz
re3-38a7b74b1a10ec64b0ebac060cac92786081f3e0.tar.zst
re3-38a7b74b1a10ec64b0ebac060cac92786081f3e0.zip
-rw-r--r--src/Collision.cpp2
-rw-r--r--src/Text.cpp31
-rw-r--r--src/Text.h7
-rw-r--r--src/main.cpp40
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
diff --git a/src/Text.h b/src/Text.h
index 1aaef3b6..2592e6b8 100644
--- a/src/Text.h
+++ b/src/Text.h
@@ -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*