summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorFire_Head <Fire-Head@users.noreply.github.com>2019-10-27 04:39:56 +0100
committerGitHub <noreply@github.com>2019-10-27 04:39:56 +0100
commitc39cf2d960ce546c544872a732560b731d8c3897 (patch)
treed7a4b2ec22bcb6a9f6d8ef2602c7fdbac417d18b /src/core
parentControllerConfig done (diff)
parentMerge branch 'master' into master (diff)
downloadre3-c39cf2d960ce546c544872a732560b731d8c3897.tar
re3-c39cf2d960ce546c544872a732560b731d8c3897.tar.gz
re3-c39cf2d960ce546c544872a732560b731d8c3897.tar.bz2
re3-c39cf2d960ce546c544872a732560b731d8c3897.tar.lz
re3-c39cf2d960ce546c544872a732560b731d8c3897.tar.xz
re3-c39cf2d960ce546c544872a732560b731d8c3897.tar.zst
re3-c39cf2d960ce546c544872a732560b731d8c3897.zip
Diffstat (limited to '')
-rw-r--r--src/core/ControllerConfig.h2
-rw-r--r--src/core/CutsceneMgr.cpp5
-rw-r--r--src/core/FileLoader.h2
-rw-r--r--src/core/Frontend.cpp7
-rw-r--r--src/core/Game.cpp3
-rw-r--r--src/core/Lists.h2
-rw-r--r--src/core/Messages.cpp26
-rw-r--r--src/core/Messages.h56
-rw-r--r--src/core/RwTexRead.cpp18
-rw-r--r--src/core/User.cpp2
-rw-r--r--src/core/User.h8
-rw-r--r--src/core/common.h22
-rw-r--r--src/core/config.h1
-rw-r--r--src/core/re3.cpp2
-rw-r--r--src/text/Text.cpp (renamed from src/core/Text.cpp)85
-rw-r--r--src/text/Text.h (renamed from src/core/Text.h)7
16 files changed, 113 insertions, 135 deletions
diff --git a/src/core/ControllerConfig.h b/src/core/ControllerConfig.h
index 150a76d4..e7abb21d 100644
--- a/src/core/ControllerConfig.h
+++ b/src/core/ControllerConfig.h
@@ -94,6 +94,8 @@ class CControllerState;
#define JOY_BUTTONS 16
#define MAX_BUTTONS (JOY_BUTTONS+1)
+#define ACTIONNAME_LENGTH 40
+
class CControllerConfigManager
{
public:
diff --git a/src/core/CutsceneMgr.cpp b/src/core/CutsceneMgr.cpp
index 95abfcc9..f147e8c9 100644
--- a/src/core/CutsceneMgr.cpp
+++ b/src/core/CutsceneMgr.cpp
@@ -17,7 +17,6 @@
#include "RpAnimBlend.h"
#include "ModelIndices.h"
#include "TempColModels.h"
-#include "MusicManager.h"
const struct {
const char *szTrackName;
@@ -209,7 +208,7 @@ CCutsceneMgr::LoadCutsceneData(const char *szCutsceneName)
CFileMgr::CloseFile(file);
if (strcmpi(ms_cutsceneName, "end")) {
- DMAudio.ChangeMusicMode(2);
+ DMAudio.ChangeMusicMode(MUSICMODE_CUTSCENE);
int trackId = FindCutsceneAudioTrackId(szCutsceneName);
if (trackId != -1) {
printf("Start preload audio %s\n", szCutsceneName);
@@ -368,7 +367,7 @@ CCutsceneMgr::DeleteCutsceneData(void)
if (strcmpi(ms_cutsceneName, "end")) {
DMAudio.StopCutSceneMusic();
if (strcmpi(ms_cutsceneName, "bet"))
- DMAudio.ChangeMusicMode(1);
+ DMAudio.ChangeMusicMode(MUSICMODE_GAME);
}
CTimer::Stop();
//TheCamera.GetScreenFadeStatus() == 2; // what for??
diff --git a/src/core/FileLoader.h b/src/core/FileLoader.h
index c3f5fe52..7ef96da3 100644
--- a/src/core/FileLoader.h
+++ b/src/core/FileLoader.h
@@ -9,7 +9,7 @@ public:
static char *LoadLine(int fd);
static RwTexDictionary *LoadTexDictionary(const char *filename);
static void LoadCollisionFile(const char *filename);
- static void LoadCollisionModel(uint8 *buf, CColModel &model, char *name);
+ static void LoadCollisionModel(uint8 *buf, struct CColModel &model, char *name);
static void LoadModelFile(const char *filename);
static RpAtomic *FindRelatedModelInfoCB(RpAtomic *atomic, void *data);
static void LoadClumpFile(const char *filename);
diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp
index 35302238..984e693f 100644
--- a/src/core/Frontend.cpp
+++ b/src/core/Frontend.cpp
@@ -11,7 +11,6 @@
#include "Timer.h"
#include "Game.h"
#include "DMAudio.h"
-#include "MusicManager.h"
#include "FileMgr.h"
#include "Streaming.h"
#include "TxdStore.h"
@@ -535,7 +534,7 @@ void CMenuManager::Draw()
if (m_nPrefsAudio3DProviderIndex == -1)
textToPrint[MENUCOLUMN_RIGHT] = TheText.Get("FEA_NAH");
else {
- char *provider = MusicManager.Get3DProviderName(m_nPrefsAudio3DProviderIndex);
+ char *provider = DMAudio.Get3DProviderName(m_nPrefsAudio3DProviderIndex);
AsciiToUnicode(provider, gUString);
textToPrint[MENUCOLUMN_RIGHT] = gUString;
}
@@ -1086,7 +1085,7 @@ void CMenuManager::LoadAllTextures()
{
if (!m_bSpritesLoaded) {
CMenuManager::CentreMousePointer();
- DMAudio.ChangeMusicMode(0);
+ DMAudio.ChangeMusicMode(MUSICMODE_FRONTEND);
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_STARTING, 0);
m_nCurrOption = 0;
m_PrefsRadioStation = DMAudio.GetRadioInCar();
@@ -2133,7 +2132,7 @@ WRAPPER void CMenuManager::RequestFrontEndShutdown() { EAXJMP(0x488750); }
void CMenuManager::RequestFrontEndShutdown()
{
m_bShutDownFrontEndRequested = true;
- DMAudio.ChangeMusicMode(1);
+ DMAudio.ChangeMusicMode(MUSICMODE_GAME);
}
#endif
diff --git a/src/core/Game.cpp b/src/core/Game.cpp
index 00d50fa8..b2bac8dd 100644
--- a/src/core/Game.cpp
+++ b/src/core/Game.cpp
@@ -80,12 +80,15 @@ WRAPPER void CGame::Initialise(const char *datFile) { EAXJMP(0x48BED0); }
#if 0
WRAPPER void CGame::Process(void) { EAXJMP(0x48C850); }
#else
+extern void (*DebugMenuProcess)(void);
void CGame::Process(void)
{
CPad::UpdatePads();
TheCamera.SetMotionBlurAlpha(0);
if (TheCamera.m_BlurType == MBLUR_NONE || TheCamera.m_BlurType == MBLUR_SNIPER || TheCamera.m_BlurType == MBLUR_NORMAL)
TheCamera.SetMotionBlur(0, 0, 0, 0, MBLUR_NONE);
+
+ DebugMenuProcess();
CCutsceneMgr::Update();
if (!CCutsceneMgr::IsCutsceneProcessing() && !CTimer::GetIsCodePaused())
FrontEndMenuManager.Process();
diff --git a/src/core/Lists.h b/src/core/Lists.h
index 7572e882..ecf24740 100644
--- a/src/core/Lists.h
+++ b/src/core/Lists.h
@@ -1,5 +1,7 @@
#pragma once
+#include "common.h"
+
class CPtrNode
{
public:
diff --git a/src/core/Messages.cpp b/src/core/Messages.cpp
deleted file mode 100644
index 9b5342ac..00000000
--- a/src/core/Messages.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-#include "common.h"
-#include "patcher.h"
-#include "Messages.h"
-
-WRAPPER void CMessages::Display(void) { EAXJMP(0x529800); }
-WRAPPER void CMessages::ClearAllMessagesDisplayedByGame(void) { EAXJMP(0x52B670); }
-WRAPPER int CMessages::WideStringCopy(wchar* dst, wchar* src, unsigned short size) { EAXJMP(0x5294B0); }
-WRAPPER char CMessages::WideStringCompare(wchar* str1, wchar* str2, unsigned short size) { EAXJMP(0x529510); }
-WRAPPER void CMessages::InsertNumberInString(wchar* src, int n1, int n2, int n3, int n4, int n5, int n6, wchar* dst) { EAXJMP(0x52A1A0); }
-WRAPPER void CMessages::InsertPlayerControlKeysInString(wchar* src) { EAXJMP(0x52A490); }
-WRAPPER int CMessages::GetWideStringLength(wchar* src) { EAXJMP(0x529490); }
-WRAPPER void CMessages::AddBigMessage(wchar* key, uint32 time, uint16 pos) { EAXJMP(0x529EB0); }
-WRAPPER void CMessages::AddBigMessageWithNumber(wchar* key, uint32 time, uint16 pos, int n1, int n2, int n3, int n4, int n5, int n6) { EAXJMP(0x52AD10); }
-WRAPPER void CMessages::AddBigMessageWithNumberQ(wchar* key, uint32 time, uint16 pos, int n1, int n2, int n3, int n4, int n5, int n6) { EAXJMP(0x52AE00); }
-WRAPPER void CMessages::AddMessage(wchar* key, uint32 time, uint16 pos) { EAXJMP(0x529900); }
-WRAPPER void CMessages::AddMessageJumpQ(wchar* key, uint32 time, uint16 pos) { EAXJMP(0x529A10); }
-WRAPPER void CMessages::AddMessageSoon(wchar* key, uint32 time, uint16 pos) { EAXJMP(0x529AF0); }
-WRAPPER void CMessages::AddMessageWithNumber(wchar* key, uint32 time, uint16 pos, int n1, int n2, int n3, int n4, int n5, int n6) { EAXJMP(0x52A850); }
-WRAPPER void CMessages::AddMessageJumpQWithNumber(wchar* key, uint32 time, uint16 pos, int n1, int n2, int n3, int n4, int n5, int n6) { EAXJMP(0x52A9A0); }
-WRAPPER void CMessages::AddMessageSoonWithNumber(wchar* key, uint32 time, uint16 pos, int n1, int n2, int n3, int n4, int n5, int n6) { EAXJMP(0x52AAC0); }
-WRAPPER void CMessages::ClearMessages() { EAXJMP(0x529CE0); }
-WRAPPER void CMessages::Init() { EAXJMP(0x529310); }
-WRAPPER void CMessages::Process() { EAXJMP(0x529580); }
-tPreviousBrief *CMessages::PreviousBriefs = (tPreviousBrief *)0x713C08;
-tMessage *CMessages::BriefMessages = (tMessage *)0x8786E0;
-tBigMessage *CMessages::BIGMessages = (tBigMessage *)0x773628;
diff --git a/src/core/Messages.h b/src/core/Messages.h
deleted file mode 100644
index 7caf5786..00000000
--- a/src/core/Messages.h
+++ /dev/null
@@ -1,56 +0,0 @@
-#pragma once
-
-struct tMessage
-{
- wchar *m_pText;
- uint16 m_nFlag;
-private:
- int8 _pad6[2];
-public:
- uint32 m_nTime;
- uint32 m_nStartTime;
- int32 m_nNumber[6];
- wchar *m_pString;
-};
-
-struct tBigMessage
-{
- tMessage m_Current;
- tMessage m_Stack[3];
-};
-
-struct tPreviousBrief
-{
- wchar *m_pText;
- int32 m_nNumber[6];
- wchar *m_pString;
-};
-
-class CMessages
-{
-public:
- static tPreviousBrief *PreviousBriefs;
- static tMessage *BriefMessages;
- static tBigMessage *BIGMessages;
-
-public:
- static void Display(void);
- static void ClearAllMessagesDisplayedByGame(void);
- static int WideStringCopy(wchar* dst, wchar* src, unsigned short size);
- static char WideStringCompare(wchar* str1, wchar* str2, unsigned short size);
- static void InsertNumberInString(wchar* src, int n1, int n2, int n3, int n4, int n5, int n6, wchar* dst);
- static void InsertPlayerControlKeysInString(wchar* src);
- static int GetWideStringLength(wchar *src);
- static void AddBigMessage(wchar* key, uint32 time, uint16 pos);
- static void AddBigMessageWithNumber(wchar* key, uint32 time, uint16 pos, int n1, int n2, int n3, int n4, int n5, int n6);
- static void AddBigMessageWithNumberQ(wchar* key, uint32 time, uint16 pos, int n1, int n2, int n3, int n4, int n5, int n6);
- static void AddMessage(wchar* key, uint32 time, uint16 pos);
- static void AddMessageJumpQ(wchar* key, uint32 time, uint16 pos);
- static void AddMessageSoon(wchar* key, uint32 time, uint16 pos);
- static void AddMessageWithNumber(wchar* key, uint32 time, uint16 pos, int n1, int n2, int n3, int n4, int n5, int n6);
- static void AddMessageJumpQWithNumber(wchar* key, uint32 time, uint16 pos, int n1, int n2, int n3, int n4, int n5, int n6);
- static void AddMessageSoonWithNumber(wchar* key, uint32 time, uint16 pos, int n1, int n2, int n3, int n4, int n5, int n6);
- static void ClearMessages();
- static void Init();
- static void Process();
-};
diff --git a/src/core/RwTexRead.cpp b/src/core/RwTexRead.cpp
index a1a7050a..6b717b34 100644
--- a/src/core/RwTexRead.cpp
+++ b/src/core/RwTexRead.cpp
@@ -1,5 +1,15 @@
+#pragma warning( push )
+#pragma warning( disable : 4005)
+#define DIRECTINPUT_VERSION 0x0800
+#include <dinput.h>
+#pragma warning( pop )
#include "common.h"
+#include "win.h"
#include "patcher.h"
+#include "Timer.h"
+
+float &texLoadTime = *(float*)0x8F1B50;
+int32 &texNumLoaded = *(int32*)0x8F252C;
RwTexture*
RwTextureGtaStreamRead(RwStream *stream)
@@ -10,11 +20,15 @@ RwTextureGtaStreamRead(RwStream *stream)
if(!RwStreamFindChunk(stream, rwID_TEXTURENATIVE, &size, &version))
return nil;
- // TODO: unused timing
+ float preloadTime = (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond();
if(!RWSRCGLOBAL(stdFunc[rwSTANDARDNATIVETEXTUREREAD](stream, &tex, size)))
return nil;
-
+
+ if (gGameState == GS_INIT_PLAYING_GAME) {
+ texLoadTime = (texNumLoaded * texLoadTime + (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond() - preloadTime) / (float)(texNumLoaded+1);
+ texNumLoaded++;
+ }
return tex;
}
diff --git a/src/core/User.cpp b/src/core/User.cpp
index 693333b7..600fa443 100644
--- a/src/core/User.cpp
+++ b/src/core/User.cpp
@@ -13,8 +13,6 @@ COnscreenTimer& CUserDisplay::OnscnTimer = *(COnscreenTimer*)0x862238;
CPager& CUserDisplay::Pager = *(CPager*)0x8F2744;
CCurrentVehicle& CUserDisplay::CurrentVehicle = *(CCurrentVehicle*)0x8F5FE8;
-WRAPPER void CPager::AddMessage(wchar*, uint16, uint16, uint16) { EAXJMP(0x52B940); }
-
WRAPPER void CUserDisplay::Process(void) { EAXJMP(0x4AD690); }
void COnscreenTimer::Init() {
diff --git a/src/core/User.h b/src/core/User.h
index 27bb7f9e..90b2da55 100644
--- a/src/core/User.h
+++ b/src/core/User.h
@@ -1,5 +1,7 @@
#pragma once
+#include "Pager.h"
+
class COnscreenTimerEntry
{
public:
@@ -50,12 +52,6 @@ class CCurrentVehicle
{
};
-class CPager
-{
-public:
- void AddMessage(wchar*, uint16, uint16, uint16);
-};
-
class CUserDisplay
{
public:
diff --git a/src/core/common.h b/src/core/common.h
index 920b7108..a538ddb6 100644
--- a/src/core/common.h
+++ b/src/core/common.h
@@ -121,7 +121,7 @@ public:
CRGBA(void) { }
CRGBA(uint8 r, uint8 g, uint8 b, uint8 a) : r(r), g(g), b(b), a(a) { }
- CRGBA &CRGBA::operator =(const CRGBA &right)
+ CRGBA &operator =(const CRGBA &right)
{
this->r = right.r;
this->g = right.g;
@@ -142,7 +142,7 @@ public:
return rwRGBA;
}
- CRGBA &CRGBA::operator =(const RwRGBA &right)
+ CRGBA &operator =(const RwRGBA &right)
{
this->r = right.red;
this->g = right.green;
@@ -197,8 +197,6 @@ void re3_assert(const char *expr, const char *filename, unsigned int lineno, con
#define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0]))
#define BIT(num) (1<<(num))
-#define max(a, b) (((a) > (b)) ? (a) : (b))
-#define min(a, b) (((a) < (b)) ? (a) : (b))
#define ABS(a) (((a) < 0) ? (-(a)) : (a))
#define norm(value, min, max) (((value) < (min)) ? 0 : (((value) > (max)) ? 1 : (((value) - (min)) / ((max) - (min)))))
@@ -337,7 +335,7 @@ inline void SkipSaveBuf(uint8 *&buf, int32 skip)
template<typename T>
inline const T ReadSaveBuf(uint8 *&buf)
-{
+{
T &value = *(T*)buf;
SkipSaveBuf(buf, sizeof(T));
return value;
@@ -345,8 +343,8 @@ inline const T ReadSaveBuf(uint8 *&buf)
template<typename T>
inline T *WriteSaveBuf(uint8 *&buf, const T &value)
-{
- T *p = (T*)buf;
+{
+ T *p = (T*)buf;
*p = value;
SkipSaveBuf(buf, sizeof(T));
return p;
@@ -355,11 +353,11 @@ inline T *WriteSaveBuf(uint8 *&buf, const T &value)
#define SAVE_HEADER_SIZE (4*sizeof(char)+sizeof(uint32))
-#define WriteSaveHeader(buf,a,b,c,d,size) \
- WriteSaveBuf(buf, a);\
- WriteSaveBuf(buf, b);\
- WriteSaveBuf(buf, c);\
- WriteSaveBuf(buf, d);\
+#define WriteSaveHeader(buf,a,b,c,d,size) \
+ WriteSaveBuf(buf, a);\
+ WriteSaveBuf(buf, b);\
+ WriteSaveBuf(buf, c);\
+ WriteSaveBuf(buf, d);\
WriteSaveBuf(buf, size);
#define CheckSaveHeader(buf,a,b,c,d,size)\
diff --git a/src/core/config.h b/src/core/config.h
index 08ddd007..12cb7be8 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -67,6 +67,7 @@ enum Config {
NUMANTENNAS = 8,
NUMCORONAS = 56,
NUMPOINTLIGHTS = 32,
+ NUM3DMARKERS = 32,
NUMMONEYMESSAGES = 16,
NUMPICKUPMESSAGES = 16,
diff --git a/src/core/re3.cpp b/src/core/re3.cpp
index c8b50d55..62e9a040 100644
--- a/src/core/re3.cpp
+++ b/src/core/re3.cpp
@@ -18,6 +18,7 @@
#include "Automobile.h"
#include "Ped.h"
#include "debugmenu_public.h"
+#include "Particle.h"
#include <vector>
#include <list>
@@ -352,6 +353,7 @@ DebugMenuPopulate(void)
DebugMenuAddCmd("Debug", "Make peds follow you in formation", LetThemFollowYou);
#ifndef MASTER
DebugMenuAddVarBool8("Debug", "Toggle unused fight feature", (int8*)&CPed::bUnusedFightThingOnPlayer, nil);
+ DebugMenuAddVarBool8("Debug", "Toggle banned particles", (int8*)&CParticle::bEnableBannedParticles, nil);
#endif
DebugMenuAddCmd("Debug", "Start Credits", CCredits::Start);
diff --git a/src/core/Text.cpp b/src/text/Text.cpp
index dfa9815c..40717ed5 100644
--- a/src/core/Text.cpp
+++ b/src/text/Text.cpp
@@ -11,20 +11,10 @@ CText &TheText = *(CText*)0x941520;
CText::CText(void)
{
- keyArray.entries = nil;
- keyArray.numEntries = 0;
- data.chars = nil;
- data.numChars = 0;
- encoding = 101;
+ encoding = 'e';
memset(WideErrorString, 0, sizeof(WideErrorString));
}
-CText::~CText(void)
-{
- data.Unload();
- keyArray.Unload();
-}
-
void
CText::Load(void)
{
@@ -96,12 +86,64 @@ CText::Get(const char *key)
return keyArray.Search(key);
}
+wchar UpperCaseTable[128] = {
+ 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138,
+ 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
+ 150, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137,
+ 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148,
+ 149, 173, 173, 175, 176, 177, 178, 179, 180, 181, 182,
+ 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193,
+ 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204,
+ 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215,
+ 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226,
+ 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237,
+ 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248,
+ 249, 250, 251, 252, 253, 254, 255
+};
+
+wchar FrenchUpperCaseTable[128] = {
+ 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138,
+ 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
+ 150, 65, 65, 65, 65, 132, 133, 69, 69, 69, 69, 73, 73,
+ 73, 73, 79, 79, 79, 79, 85, 85, 85, 85, 173, 173, 175,
+ 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186,
+ 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197,
+ 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208,
+ 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219,
+ 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230,
+ 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241,
+ 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252,
+ 253, 254, 255
+};
+
wchar
CText::GetUpperCase(wchar c)
-{
- // TODO: do this depending on encoding
- if(islower(c))
- return toupper(c);
+{
+ switch (encoding)
+ {
+ case 'e':
+ if (c >= 'a' && c <= 'z')
+ return c - 32;
+ break;
+ case 'f':
+ if (c >= 'a' && c <= 'z')
+ return c - 32;
+
+ if (c >= 128 && c <= 255)
+ return FrenchUpperCaseTable[c-128];
+ break;
+ case 'g':
+ case 'i':
+ case 's':
+ if (c >= 'a' && c <= 'z')
+ return c - 32;
+
+ if (c >= 128 && c <= 255)
+ return UpperCaseTable[c-128];
+ break;
+ default:
+ break;
+ }
return c;
}
@@ -205,7 +247,7 @@ CData::Unload(void)
}
void
-AsciiToUnicode(const char *src, uint16 *dst)
+AsciiToUnicode(const char *src, wchar *dst)
{
while((*dst++ = *src++) != '\0');
}
@@ -215,8 +257,8 @@ UnicodeToAscii(wchar *src)
{
static char aStr[256];
int len;
- for(len = 0; src && *src != 0 && len < 256-1; len++, src++)
- if(*src < 256)
+ for(len = 0; *src != '\0' && len < 256-1; len++, src++)
+ if(*src < 128)
aStr[len] = *src;
else
aStr[len] = '#';
@@ -227,10 +269,9 @@ UnicodeToAscii(wchar *src)
char*
UnicodeToAsciiForSaveLoad(wchar *src)
{
- // exact same code as above
static char aStr[256];
int len;
- for(len = 0; src && *src != 0 && len < 256-1; len++, src++)
+ for(len = 0; *src != '\0' && len < 256-1; len++, src++)
if(*src < 256)
aStr[len] = *src;
else
@@ -249,7 +290,7 @@ int
UnicodeStrlen(const wchar *str)
{
int len;
- for(len = 0; *str != 0; len++, str++);
+ for(len = 0; *str != '\0'; len++, str++);
return len;
}
@@ -264,6 +305,8 @@ STARTPATCHES
InjectHook(0x52C3C0, &CText::Load, PATCH_JUMP);
InjectHook(0x52C580, &CText::Unload, PATCH_JUMP);
InjectHook(0x52C5A0, &CText::Get, PATCH_JUMP);
+ InjectHook(0x52C220, &CText::GetUpperCase, PATCH_JUMP);
+ InjectHook(0x52C2C0, &CText::UpperCase, PATCH_JUMP);
InjectHook(0x52BE70, &CKeyArray::Load, PATCH_JUMP);
InjectHook(0x52BF60, &CKeyArray::Unload, PATCH_JUMP);
diff --git a/src/core/Text.h b/src/text/Text.h
index f554628c..6f39ba49 100644
--- a/src/core/Text.h
+++ b/src/text/Text.h
@@ -21,6 +21,8 @@ public:
CKeyEntry *entries;
int numEntries;
+ CKeyArray(void) : entries(nil), numEntries(0) {}
+ ~CKeyArray(void) { Unload(); }
void Load(uint32 length, uint8 *data, int *offset);
void Unload(void);
void Update(wchar *chars);
@@ -34,6 +36,8 @@ public:
wchar *chars;
int numChars;
+ CData(void) : chars(nil), numChars(0) {}
+ ~CData(void) { Unload(); }
void Load(uint32 length, uint8 *data, int *offset);
void Unload(void);
};
@@ -42,10 +46,9 @@ class CText
{
CKeyArray keyArray;
CData data;
- int8 encoding;
+ char encoding;
public:
CText(void);
- ~CText(void);
void Load(void);
void Unload(void);
wchar *Get(const char *key);