mirror of
https://github.com/GTAmodding/re3.git
synced 2021-02-19 17:49:54 +01:00
commit
a5ea709edc
@ -5,6 +5,7 @@
|
|||||||
#include "AudioManager.h"
|
#include "AudioManager.h"
|
||||||
#include "AudioScriptObject.h"
|
#include "AudioScriptObject.h"
|
||||||
#include "sampman.h"
|
#include "sampman.h"
|
||||||
|
#include "Font.h"
|
||||||
#include "Text.h"
|
#include "Text.h"
|
||||||
#include "crossplatform.h"
|
#include "crossplatform.h"
|
||||||
|
|
||||||
|
@ -5,6 +5,46 @@
|
|||||||
#include "Font.h"
|
#include "Font.h"
|
||||||
#include "Timer.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;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
UnicodeMakeUpperCase(wchar *dst, const wchar *src) //idk what to do with it, seems to be incorrect implementation by R*
|
||||||
|
{
|
||||||
|
while (*src != '\0') {
|
||||||
|
if (*src < 'a' || *src > 'z')
|
||||||
|
*dst = *src;
|
||||||
|
else
|
||||||
|
*dst = *src - 32;
|
||||||
|
dst++;
|
||||||
|
src++;
|
||||||
|
}
|
||||||
|
*dst = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
CFontDetails CFont::Details;
|
CFontDetails CFont::Details;
|
||||||
int16 CFont::NewLine;
|
int16 CFont::NewLine;
|
||||||
CSprite2d CFont::Sprite[MAX_FONTS];
|
CSprite2d CFont::Sprite[MAX_FONTS];
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
#pragma once
|
#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);
|
||||||
|
void UnicodeMakeUpperCase(wchar *dst, const wchar *src);
|
||||||
|
|
||||||
struct CFontDetails
|
struct CFontDetails
|
||||||
{
|
{
|
||||||
CRGBA color;
|
CRGBA color;
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include "Clock.h"
|
#include "Clock.h"
|
||||||
#include "Date.h"
|
#include "Date.h"
|
||||||
#include "FileMgr.h"
|
#include "FileMgr.h"
|
||||||
|
#include "Font.h"
|
||||||
#include "Frontend.h"
|
#include "Frontend.h"
|
||||||
#include "GameLogic.h"
|
#include "GameLogic.h"
|
||||||
#include "Gangs.h"
|
#include "Gangs.h"
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include "crossplatform.h"
|
#include "crossplatform.h"
|
||||||
|
|
||||||
#include "FileMgr.h"
|
#include "FileMgr.h"
|
||||||
|
#include "Font.h"
|
||||||
#ifdef MORE_LANGUAGES
|
#ifdef MORE_LANGUAGES
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -9,11 +9,12 @@
|
|||||||
#include "Text.h"
|
#include "Text.h"
|
||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
|
|
||||||
|
//--MIAMI: file done
|
||||||
|
|
||||||
static wchar WideErrorString[25];
|
static wchar WideErrorString[25];
|
||||||
|
|
||||||
CText TheText;
|
CText TheText;
|
||||||
|
|
||||||
//--MIAMI: DONE
|
|
||||||
CText::CText(void)
|
CText::CText(void)
|
||||||
{
|
{
|
||||||
encoding = 'e';
|
encoding = 'e';
|
||||||
@ -23,7 +24,6 @@ CText::CText(void)
|
|||||||
memset(WideErrorString, 0, sizeof(WideErrorString));
|
memset(WideErrorString, 0, sizeof(WideErrorString));
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: DONE
|
|
||||||
void
|
void
|
||||||
CText::Load(void)
|
CText::Load(void)
|
||||||
{
|
{
|
||||||
@ -95,7 +95,6 @@ CText::Load(void)
|
|||||||
CFileMgr::SetDir("");
|
CFileMgr::SetDir("");
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: DONE
|
|
||||||
void
|
void
|
||||||
CText::Unload(void)
|
CText::Unload(void)
|
||||||
{
|
{
|
||||||
@ -108,7 +107,6 @@ CText::Unload(void)
|
|||||||
memset(szMissionTableName, 0, sizeof(szMissionTableName));
|
memset(szMissionTableName, 0, sizeof(szMissionTableName));
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: DONE
|
|
||||||
wchar*
|
wchar*
|
||||||
CText::Get(const char *key)
|
CText::Get(const char *key)
|
||||||
{
|
{
|
||||||
@ -158,7 +156,6 @@ wchar FrenchUpperCaseTable[128] = {
|
|||||||
253, 254, 255
|
253, 254, 255
|
||||||
};
|
};
|
||||||
|
|
||||||
//--MIAMI: TODO (check tables)
|
|
||||||
wchar
|
wchar
|
||||||
CText::GetUpperCase(wchar c)
|
CText::GetUpperCase(wchar c)
|
||||||
{
|
{
|
||||||
@ -190,7 +187,6 @@ CText::GetUpperCase(wchar c)
|
|||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: DONE
|
|
||||||
void
|
void
|
||||||
CText::UpperCase(wchar *s)
|
CText::UpperCase(wchar *s)
|
||||||
{
|
{
|
||||||
@ -200,23 +196,28 @@ CText::UpperCase(wchar *s)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: DONE
|
|
||||||
void
|
void
|
||||||
CText::GetNameOfLoadedMissionText(char *outName)
|
CText::GetNameOfLoadedMissionText(char *outName)
|
||||||
{
|
{
|
||||||
strcpy(outName, szMissionTableName);
|
strcpy(outName, szMissionTableName);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: DONE
|
|
||||||
void
|
void
|
||||||
CText::ReadChunkHeader(ChunkHeader *buf, int32 file, size_t *offset)
|
CText::ReadChunkHeader(ChunkHeader *buf, int32 file, size_t *offset)
|
||||||
{
|
{
|
||||||
|
#if DUMB
|
||||||
|
char *_buf = (char*)buf;
|
||||||
|
for (int i = 0; i < sizeof(ChunkHeader); i++) {
|
||||||
|
CFileMgr::Read(file, &_buf[i], 1);
|
||||||
|
(*offset)++;
|
||||||
|
}
|
||||||
|
#else
|
||||||
// original code loops 8 times to read 1 byte with CFileMgr::Read, that's retarded
|
// original code loops 8 times to read 1 byte with CFileMgr::Read, that's retarded
|
||||||
CFileMgr::Read(file, (char*)buf, sizeof(ChunkHeader));
|
CFileMgr::Read(file, (char*)buf, sizeof(ChunkHeader));
|
||||||
*offset += sizeof(ChunkHeader);
|
*offset += sizeof(ChunkHeader);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: DONE
|
|
||||||
void
|
void
|
||||||
CText::LoadMissionText(char *MissionTableName)
|
CText::LoadMissionText(char *MissionTableName)
|
||||||
{
|
{
|
||||||
@ -307,7 +308,6 @@ CText::LoadMissionText(char *MissionTableName)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//--MIAMI: DONE
|
|
||||||
void
|
void
|
||||||
CKeyArray::Load(size_t length, int file, size_t* offset)
|
CKeyArray::Load(size_t length, int file, size_t* offset)
|
||||||
{
|
{
|
||||||
@ -319,14 +319,16 @@ CKeyArray::Load(size_t length, int file, size_t* offset)
|
|||||||
rawbytes = (char*)entries;
|
rawbytes = (char*)entries;
|
||||||
|
|
||||||
#if DUMB
|
#if DUMB
|
||||||
for (uint32 i = 0; i < length; i++)
|
for (uint32 i = 0; i < length; i++) {
|
||||||
CFileMgr::Read(file, &rawbytes[i], 1);
|
CFileMgr::Read(file, &rawbytes[i], 1);
|
||||||
|
(*offset)++;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
CFileMgr::Read(file, rawbytes, length);
|
CFileMgr::Read(file, rawbytes, length);
|
||||||
|
*offset += length;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: DONE
|
|
||||||
void
|
void
|
||||||
CKeyArray::Unload(void)
|
CKeyArray::Unload(void)
|
||||||
{
|
{
|
||||||
@ -335,7 +337,6 @@ CKeyArray::Unload(void)
|
|||||||
numEntries = 0;
|
numEntries = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: DONE
|
|
||||||
void
|
void
|
||||||
CKeyArray::Update(wchar *chars)
|
CKeyArray::Update(wchar *chars)
|
||||||
{
|
{
|
||||||
@ -346,7 +347,6 @@ CKeyArray::Update(wchar *chars)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: DONE
|
|
||||||
CKeyEntry*
|
CKeyEntry*
|
||||||
CKeyArray::BinarySearch(const char *key, CKeyEntry *entries, int16 low, int16 high)
|
CKeyArray::BinarySearch(const char *key, CKeyEntry *entries, int16 low, int16 high)
|
||||||
{
|
{
|
||||||
@ -367,7 +367,6 @@ CKeyArray::BinarySearch(const char *key, CKeyEntry *entries, int16 low, int16 hi
|
|||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: DONE
|
|
||||||
wchar*
|
wchar*
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
CKeyArray::Search(const char *key, wchar *data, uint8 *result)
|
CKeyArray::Search(const char *key, wchar *data, uint8 *result)
|
||||||
@ -403,7 +402,6 @@ CKeyArray::Search(const char *key, uint8 *result)
|
|||||||
return WideErrorString;
|
return WideErrorString;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: DONE
|
|
||||||
void
|
void
|
||||||
CData::Load(size_t length, int file, size_t * offset)
|
CData::Load(size_t length, int file, size_t * offset)
|
||||||
{
|
{
|
||||||
@ -415,14 +413,16 @@ CData::Load(size_t length, int file, size_t * offset)
|
|||||||
rawbytes = (char*)chars;
|
rawbytes = (char*)chars;
|
||||||
|
|
||||||
#if DUMB
|
#if DUMB
|
||||||
for(uint32 i = 0; i < length; i++)
|
for(uint32 i = 0; i < length; i++){
|
||||||
CFileMgr::Read(file, &rawbytes[i], 1);
|
CFileMgr::Read(file, &rawbytes[i], 1);
|
||||||
|
(*offset)++;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
CFileMgr::Read(file, rawbytes, length);
|
CFileMgr::Read(file, rawbytes, length);
|
||||||
|
*offset += length;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: DONE
|
|
||||||
void
|
void
|
||||||
CData::Unload(void)
|
CData::Unload(void)
|
||||||
{
|
{
|
||||||
@ -431,22 +431,31 @@ CData::Unload(void)
|
|||||||
numChars = 0;
|
numChars = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: DONE
|
|
||||||
void
|
void
|
||||||
CMissionTextOffsets::Load(size_t table_size, int file, size_t *offset, int)
|
CMissionTextOffsets::Load(size_t table_size, int file, size_t *offset, int)
|
||||||
{
|
{
|
||||||
|
#if DUMB
|
||||||
|
size_t num_of_entries = table_size / sizeof(CMissionTextOffsets::Entry);
|
||||||
|
for (size_t mi = 0; mi < num_of_entries; mi++) {
|
||||||
|
for (uint32 i = 0; i < sizeof(data[mi].szMissionName); i++) {
|
||||||
|
CFileMgr::Read(file, &data[i].szMissionName[i], 1);
|
||||||
|
(*offset)++;
|
||||||
|
}
|
||||||
|
char* _buf = (char*)&data[mi].offset;
|
||||||
|
for (uint32 i = 0; i < sizeof(data[mi].offset); i++) {
|
||||||
|
CFileMgr::Read(file, &_buf[i], 1);
|
||||||
|
(*offset)++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
size = (uint16)num_of_entries;
|
||||||
|
#else
|
||||||
// not exact VC code but smaller and better :P
|
// not exact VC code but smaller and better :P
|
||||||
|
|
||||||
// You can make this size_t if you want to exceed 32-bit boundaries, everything else should be ready.
|
// You can make this size_t if you want to exceed 32-bit boundaries, everything else should be ready.
|
||||||
size = (uint16) (table_size / sizeof(CMissionTextOffsets::Entry));
|
size = (uint16) (table_size / sizeof(CMissionTextOffsets::Entry));
|
||||||
CFileMgr::Read(file, (char*)data, sizeof(CMissionTextOffsets::Entry) * size);
|
CFileMgr::Read(file, (char*)data, sizeof(CMissionTextOffsets::Entry) * size);
|
||||||
*offset += sizeof(CMissionTextOffsets::Entry) * size;
|
*offset += sizeof(CMissionTextOffsets::Entry) * size;
|
||||||
}
|
#endif
|
||||||
|
|
||||||
void
|
|
||||||
AsciiToUnicode(const char *src, wchar *dst)
|
|
||||||
{
|
|
||||||
while((*dst++ = (unsigned char)*src++) != '\0');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char*
|
char*
|
||||||
@ -461,8 +470,29 @@ UnicodeToAscii(wchar *src)
|
|||||||
if(*src < 128)
|
if(*src < 128)
|
||||||
#endif
|
#endif
|
||||||
aStr[len] = *src;
|
aStr[len] = *src;
|
||||||
else
|
// convert to CP1252
|
||||||
aStr[len] = '#';
|
else if(*src <= 131)
|
||||||
|
aStr[len] = *src + 64;
|
||||||
|
else if (*src <= 141)
|
||||||
|
aStr[len] = *src + 66;
|
||||||
|
else if (*src <= 145)
|
||||||
|
aStr[len] = *src + 68;
|
||||||
|
else if (*src <= 149)
|
||||||
|
aStr[len] = *src + 71;
|
||||||
|
else if (*src <= 154)
|
||||||
|
aStr[len] = *src + 73;
|
||||||
|
else if (*src <= 164)
|
||||||
|
aStr[len] = *src + 75;
|
||||||
|
else if (*src <= 168)
|
||||||
|
aStr[len] = *src + 77;
|
||||||
|
else if (*src <= 204)
|
||||||
|
aStr[len] = *src + 80;
|
||||||
|
else switch (*src) {
|
||||||
|
case 205: aStr[len] = 209; break;
|
||||||
|
case 206: aStr[len] = 241; break;
|
||||||
|
case 207: aStr[len] = 191; break;
|
||||||
|
default: aStr[len] = '#'; break;
|
||||||
|
}
|
||||||
aStr[len] = '\0';
|
aStr[len] = '\0';
|
||||||
return aStr;
|
return aStr;
|
||||||
}
|
}
|
||||||
@ -472,7 +502,7 @@ UnicodeToAsciiForSaveLoad(wchar *src)
|
|||||||
{
|
{
|
||||||
static char aStr[256];
|
static char aStr[256];
|
||||||
int len;
|
int len;
|
||||||
for(len = 0; *src != '\0' && len < 256-1; len++, src++)
|
for(len = 0; *src != '\0' && len < 256; len++, src++)
|
||||||
if(*src < 256)
|
if(*src < 256)
|
||||||
aStr[len] = *src;
|
aStr[len] = *src;
|
||||||
else
|
else
|
||||||
@ -486,7 +516,7 @@ UnicodeToAsciiForMemoryCard(wchar *src)
|
|||||||
{
|
{
|
||||||
static char aStr[256];
|
static char aStr[256];
|
||||||
int len;
|
int len;
|
||||||
for(len = 0; *src != '\0' && len < 256-1; len++, src++)
|
for(len = 0; *src != '\0' && len < 256; len++, src++)
|
||||||
if(*src < 256)
|
if(*src < 256)
|
||||||
aStr[len] = *src;
|
aStr[len] = *src;
|
||||||
else
|
else
|
||||||
@ -495,40 +525,6 @@ UnicodeToAsciiForMemoryCard(wchar *src)
|
|||||||
return aStr;
|
return aStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
UnicodeMakeUpperCase(wchar *dst, wchar *src) //idk what to do with it, seems to be incorrect implementation by R*
|
|
||||||
{
|
|
||||||
while (*src != '\0') {
|
|
||||||
if (*src < 'a' || *src > 'z')
|
|
||||||
*dst = *src;
|
|
||||||
else
|
|
||||||
*dst = *src - 32;
|
|
||||||
dst++;
|
|
||||||
src++;
|
|
||||||
}
|
|
||||||
*dst = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
void
|
||||||
TextCopy(wchar *dst, const wchar *src)
|
TextCopy(wchar *dst, const wchar *src)
|
||||||
{
|
{
|
||||||
|
@ -1,14 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
void AsciiToUnicode(const char *src, wchar *dst);
|
|
||||||
char *UnicodeToAscii(wchar *src);
|
char *UnicodeToAscii(wchar *src);
|
||||||
char *UnicodeToAsciiForSaveLoad(wchar *src);
|
char *UnicodeToAsciiForSaveLoad(wchar *src);
|
||||||
char *UnicodeToAsciiForMemoryCard(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 TextCopy(wchar *dst, const wchar *src);
|
||||||
void UnicodeMakeUpperCase(wchar *dst, wchar *src);
|
|
||||||
|
|
||||||
struct CKeyEntry
|
struct CKeyEntry
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user