summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2020-10-11 09:34:47 +0200
committerSergeanur <s.anureev@yandex.ua>2020-10-11 09:34:47 +0200
commit9dba2386bb90a4d2cd9c0f530a78bbf15aa17b7b (patch)
treeec7218e56bc1bfca1061d6cd45c1c897ecfb8e77
parentMerge branch 'miami' into VC/TextFinish (diff)
parentSome unicode funcs belong to Font.cpp + small fix (diff)
downloadre3-9dba2386bb90a4d2cd9c0f530a78bbf15aa17b7b.tar
re3-9dba2386bb90a4d2cd9c0f530a78bbf15aa17b7b.tar.gz
re3-9dba2386bb90a4d2cd9c0f530a78bbf15aa17b7b.tar.bz2
re3-9dba2386bb90a4d2cd9c0f530a78bbf15aa17b7b.tar.lz
re3-9dba2386bb90a4d2cd9c0f530a78bbf15aa17b7b.tar.xz
re3-9dba2386bb90a4d2cd9c0f530a78bbf15aa17b7b.tar.zst
re3-9dba2386bb90a4d2cd9c0f530a78bbf15aa17b7b.zip
-rw-r--r--src/audio/DMAudio.cpp1
-rw-r--r--src/render/Font.cpp26
-rw-r--r--src/render/Font.h5
-rw-r--r--src/save/GenericGameStorage.cpp1
-rw-r--r--src/save/PCSave.cpp1
-rw-r--r--src/text/Text.cpp28
-rw-r--r--src/text/Text.h4
7 files changed, 35 insertions, 31 deletions
diff --git a/src/audio/DMAudio.cpp b/src/audio/DMAudio.cpp
index 486daebf..a4db2862 100644
--- a/src/audio/DMAudio.cpp
+++ b/src/audio/DMAudio.cpp
@@ -5,6 +5,7 @@
#include "AudioManager.h"
#include "AudioScriptObject.h"
#include "sampman.h"
+#include "Font.h"
#include "Text.h"
#include "crossplatform.h"
diff --git a/src/render/Font.cpp b/src/render/Font.cpp
index c0cc333a..7459c101 100644
--- a/src/render/Font.cpp
+++ b/src/render/Font.cpp
@@ -5,6 +5,32 @@
#include "Font.h"
#include "Timer.h"
+void
+AsciiToUnicode(const char *src, wchar *dst)
+{
+ while((*dst++ = (unsigned char)*src++) != '\0');
+}
+
+void
+UnicodeStrcat(wchar *dst, wchar *append)
+{
+ UnicodeStrcpy(&dst[UnicodeStrlen(dst)], append);
+}
+
+void
+UnicodeStrcpy(wchar *dst, const wchar *src)
+{
+ while((*dst++ = *src++) != '\0');
+}
+
+int
+UnicodeStrlen(const wchar *str)
+{
+ int len;
+ for(len = 0; *str != '\0'; len++, str++);
+ return len;
+}
+
CFontDetails CFont::Details;
int16 CFont::NewLine;
CSprite2d CFont::Sprite[MAX_FONTS];
diff --git a/src/render/Font.h b/src/render/Font.h
index ca0ed7d0..f0ca9760 100644
--- a/src/render/Font.h
+++ b/src/render/Font.h
@@ -1,5 +1,10 @@
#pragma once
+void AsciiToUnicode(const char *src, wchar *dst);
+void UnicodeStrcpy(wchar *dst, const wchar *src);
+void UnicodeStrcat(wchar *dst, wchar *append);
+int UnicodeStrlen(const wchar *str);
+
struct CFontDetails
{
CRGBA color;
diff --git a/src/save/GenericGameStorage.cpp b/src/save/GenericGameStorage.cpp
index b98b8243..18eecd95 100644
--- a/src/save/GenericGameStorage.cpp
+++ b/src/save/GenericGameStorage.cpp
@@ -11,6 +11,7 @@
#include "Clock.h"
#include "Date.h"
#include "FileMgr.h"
+#include "Font.h"
#include "Frontend.h"
#include "GameLogic.h"
#include "Gangs.h"
diff --git a/src/save/PCSave.cpp b/src/save/PCSave.cpp
index 6449d586..dd0926cf 100644
--- a/src/save/PCSave.cpp
+++ b/src/save/PCSave.cpp
@@ -3,6 +3,7 @@
#include "crossplatform.h"
#include "FileMgr.h"
+#include "Font.h"
#ifdef MORE_LANGUAGES
#include "Game.h"
#endif
diff --git a/src/text/Text.cpp b/src/text/Text.cpp
index a59516e3..a76bc404 100644
--- a/src/text/Text.cpp
+++ b/src/text/Text.cpp
@@ -431,7 +431,6 @@ CData::Unload(void)
numChars = 0;
}
-void
CMissionTextOffsets::Load(size_t table_size, int file, size_t *offset, int)
{
#if DUMB
@@ -459,11 +458,6 @@ CMissionTextOffsets::Load(size_t table_size, int file, size_t *offset, int)
}
void
-AsciiToUnicode(const char *src, wchar *dst)
-{
- while((*dst++ = (unsigned char)*src++) != '\0');
-}
-
char*
UnicodeToAscii(wchar *src)
{
@@ -522,7 +516,7 @@ UnicodeToAsciiForMemoryCard(wchar *src)
{
static char aStr[256];
int len;
- for(len = 0; *src != '\0' && len < 256-1; len++, src++)
+ for(len = 0; *src != '\0' && len < 256; len++, src++)
if(*src < 256)
aStr[len] = *src;
else
@@ -546,26 +540,6 @@ UnicodeMakeUpperCase(wchar *dst, wchar *src) //idk what to do with it, seems to
}
void
-UnicodeStrcpy(wchar *dst, const wchar *src)
-{
- while((*dst++ = *src++) != '\0');
-}
-
-void
-UnicodeStrcat(wchar *dst, wchar *append)
-{
- UnicodeStrcpy(&dst[UnicodeStrlen(dst)], append);
-}
-
-int
-UnicodeStrlen(const wchar *str)
-{
- int len;
- for(len = 0; *str != '\0'; len++, str++);
- return len;
-}
-
-void
TextCopy(wchar *dst, const wchar *src)
{
while((*dst++ = *src++) != '\0');
diff --git a/src/text/Text.h b/src/text/Text.h
index 0bad9a83..d18c564b 100644
--- a/src/text/Text.h
+++ b/src/text/Text.h
@@ -1,12 +1,8 @@
#pragma once
-void AsciiToUnicode(const char *src, wchar *dst);
char *UnicodeToAscii(wchar *src);
char *UnicodeToAsciiForSaveLoad(wchar *src);
char *UnicodeToAsciiForMemoryCard(wchar *src);
-void UnicodeStrcpy(wchar *dst, const wchar *src);
-void UnicodeStrcat(wchar *dst, wchar *append);
-int UnicodeStrlen(const wchar *str);
void TextCopy(wchar *dst, const wchar *src);
void UnicodeMakeUpperCase(wchar *dst, wchar *src);