Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Merge branch 'master' into master
  • Loading branch information
Fire-Head committed Jun 2, 2019
2 parents b1f9e28 + b63c87e commit 809c81ea9ce66b998e0ebaf17965843337c4fdd9
@@ -69,6 +69,17 @@ CCamera::IsBoxVisible(RwV3d *box, const CMatrix *mat)
return true;
}

int
CCamera::GetLookDirection(void)
{
if(Cams[ActiveCam].Mode == CCam::MODE_CAMONASTRING ||
Cams[ActiveCam].Mode == CCam::MODE_FIRSTPERSON ||
Cams[ActiveCam].Mode == CCam::MODE_BEHINDBOAT ||
Cams[ActiveCam].Mode == CCam::MODE_FOLLOWPED)
return Cams[ActiveCam].DirectionWasLooking;
return LOOKING_FORWARD;;
}

WRAPPER void CCamera::Fade(float timeout, int16 direction) { EAXJMP(0x46B3A0); }
WRAPPER void CCamera::ProcessFade(void) { EAXJMP(0x46F080); }
WRAPPER void CCamera::ProcessMusicFade(void) { EAXJMP(0x46F1E0); }
@@ -444,6 +444,7 @@ int m_iModeObbeCamIsInForCar;
bool IsPointVisible(const CVector &center, const CMatrix *mat);
bool IsSphereVisible(const CVector &center, float radius, const CMatrix *mat);
bool IsBoxVisible(RwV3d *box, const CMatrix *mat);
int GetLookDirection(void);

void Fade(float timeout, int16 direction);
int GetScreenFadeStatus(void);
@@ -5,7 +5,7 @@
#include "Messages.h"
#include "Text.h"

static wchar_t WideErrorString[25];
static wchar WideErrorString[25];

CText &TheText = *(CText*)0x941520;

@@ -90,7 +90,7 @@ CText::Unload(void)
keyArray.Unload();
}

wchar_t*
wchar*
CText::Get(const char *key)
{
return keyArray.Search(key);
@@ -119,11 +119,11 @@ CKeyArray::Unload(void)
}

void
CKeyArray::Update(wchar_t *chars)
CKeyArray::Update(wchar *chars)
{
int i;
for(i = 0; i < numEntries; i++)
entries[i].value = (wchar_t*)((uint8*)chars + (uintptr)entries[i].value);
entries[i].value = (wchar*)((uint8*)chars + (uintptr)entries[i].value);
}

CKeyEntry*
@@ -146,7 +146,7 @@ CKeyArray::BinarySearch(const char *key, CKeyEntry *entries, int16 low, int16 hi
return nil;
}

wchar_t*
wchar*
CKeyArray::Search(const char *key)
{
CKeyEntry *found;
@@ -169,8 +169,8 @@ CData::Load(uint32 length, uint8 *data, int *offset)
uint32 i;
uint8 *rawbytes;

numChars = length / sizeof(wchar_t);
chars = new wchar_t[numChars];
numChars = length / sizeof(wchar);
chars = new wchar[numChars];
rawbytes = (uint8*)chars;

for(i = 0; i < length; i++)
@@ -185,6 +185,12 @@ CData::Unload(void)
numChars = 0;
}

void
AsciiToUnicode(const char *cs, uint16 *ws)
{
while((*ws++ = *cs++) != '\0');
}

STARTPATCHES
InjectHook(0x52C3C0, &CText::Load, PATCH_JUMP);
InjectHook(0x52C580, &CText::Unload, PATCH_JUMP);
@@ -1,8 +1,10 @@
#pragma once

void AsciiToUnicode(const char *cs, wchar *ws);

struct CKeyEntry
{
wchar_t *value;
wchar *value;
char key[8];
};
// If this fails, CKeyArray::Load will have to be fixed
@@ -16,15 +18,15 @@ class CKeyArray

void Load(uint32 length, uint8 *data, int *offset);
void Unload(void);
void Update(wchar_t *chars);
void Update(wchar *chars);
CKeyEntry *BinarySearch(const char *key, CKeyEntry *entries, int16 low, int16 high);
wchar_t *Search(const char *key);
wchar *Search(const char *key);
};

class CData
{
public:
wchar_t *chars;
wchar *chars;
int numChars;

void Load(uint32 length, uint8 *data, int *offset);
@@ -41,7 +43,7 @@ class CText
~CText(void);
void Load(void);
void Unload(void);
wchar_t *Get(const char *key);
wchar *Get(const char *key);
};

extern CText &TheText;
@@ -104,6 +104,13 @@ class CTimeCycle
static int GetSkyBottomRed(void) { return m_nCurrentSkyBottomRed; }
static int GetSkyBottomGreen(void) { return m_nCurrentSkyBottomGreen; }
static int GetSkyBottomBlue(void) { return m_nCurrentSkyBottomBlue; }
static int GetSunCoreRed(void) { return m_nCurrentSunCoreRed; }
static int GetSunCoreGreen(void) { return m_nCurrentSunCoreGreen; }
static int GetSunCoreBlue(void) { return m_nCurrentSunCoreBlue; }
static int GetSunCoronaRed(void) { return m_nCurrentSunCoronaRed; }
static int GetSunCoronaGreen(void) { return m_nCurrentSunCoronaGreen; }
static int GetSunCoronaBlue(void) { return m_nCurrentSunCoronaBlue; }
static float GetSunSize(void) { return m_fCurrentSunSize; }
static float GetFarClip(void) { return m_fCurrentFarClip; }
static float GetFogStart(void) { return m_fCurrentFogStart; }

@@ -119,4 +126,6 @@ class CTimeCycle
static int GetFogRed(void) { return m_nCurrentFogColourRed; }
static int GetFogGreen(void) { return m_nCurrentFogColourGreen; }
static int GetFogBlue(void) { return m_nCurrentFogColourBlue; }

static const CVector &GetSunPosition(void) { return m_VectorToSun[m_CurrentStoredValue]; }
};
@@ -19,6 +19,26 @@ CZoneInfo *CTheZones::ZoneInfoArray = (CZoneInfo*)0x714400;

#define SWAPF(a, b) { float t; t = a; a = b; b = t; }

static void
CheckZoneInfo(CZoneInfo *info)
{
assert(info->carThreshold[0] >= 0);
assert(info->carThreshold[0] <= info->carThreshold[1]);
assert(info->carThreshold[1] <= info->carThreshold[2]);
assert(info->carThreshold[2] <= info->carThreshold[3]);
assert(info->carThreshold[3] <= info->carThreshold[4]);
assert(info->carThreshold[4] <= info->carThreshold[5]);
assert(info->carThreshold[5] <= info->copThreshold);
assert(info->copThreshold <= info->gangThreshold[0]);
assert(info->gangThreshold[0] <= info->gangThreshold[1]);
assert(info->gangThreshold[1] <= info->gangThreshold[2]);
assert(info->gangThreshold[2] <= info->gangThreshold[3]);
assert(info->gangThreshold[3] <= info->gangThreshold[4]);
assert(info->gangThreshold[4] <= info->gangThreshold[5]);
assert(info->gangThreshold[5] <= info->gangThreshold[6]);
assert(info->gangThreshold[6] <= info->gangThreshold[7]);
assert(info->gangThreshold[7] <= info->gangThreshold[8]);
}

void
CTheZones::Init(void)
@@ -49,6 +69,7 @@ CTheZones::Init(void)
zonei->gangThreshold[6] = zonei->gangThreshold[5];
zonei->gangThreshold[7] = zonei->gangThreshold[6];
zonei->gangThreshold[8] = zonei->gangThreshold[7];
CheckZoneInfo(zonei);
}
TotalNumberOfZoneInfos = 1; // why 1?

@@ -360,10 +381,12 @@ CTheZones::GetZoneInfoForTimeOfDay(const CVector *pos, CZoneInfo *info)
else{
if(CClock::GetIsTimeInRange(19, 22)){
n = (CClock::GetHours() - 19) / 3.0f;
d = n - 1.0f;
assert(n >= 0.0f && n <= 1.0f);
d = 1.0f - n;
}else{
d = (CClock::GetHours() - 5) / 3.0f;
n = d - 1.0f;
assert(d >= 0.0f && d <= 1.0f);
n = 1.0f - d;
}
info->carDensity = day->carDensity * d + night->carDensity * n;
info->carThreshold[0] = day->carThreshold[0] * d + night->carThreshold[0] * n;
@@ -399,6 +422,8 @@ CTheZones::GetZoneInfoForTimeOfDay(const CVector *pos, CZoneInfo *info)
info->pedGroup = day->pedGroup;
else
info->pedGroup = night->pedGroup;

CheckZoneInfo(info);
}

void
@@ -415,6 +440,8 @@ CTheZones::SetZoneCarInfo(uint16 zoneid, uint8 day, int16 carDensity,
zone = GetZone(zoneid);
info = &ZoneInfoArray[day ? zone->zoneinfoDay : zone->zoneinfoNight];

CheckZoneInfo(info);

if(carDensity != -1) info->carDensity = carDensity;
int16 oldCar1Num = info->carThreshold[1] - info->carThreshold[0];
int16 oldCar2Num = info->carThreshold[2] - info->carThreshold[1];
@@ -463,6 +490,8 @@ CTheZones::SetZoneCarInfo(uint16 zoneid, uint8 day, int16 carDensity,
else info->gangThreshold[7] = info->gangThreshold[6] + oldGang7Num;
if(gang8Num != -1) info->gangThreshold[8] = info->gangThreshold[7] + gang8Num;
else info->gangThreshold[8] = info->gangThreshold[7] + oldGang8Num;

CheckZoneInfo(info);
}

void
@@ -477,15 +506,15 @@ CTheZones::SetZonePedInfo(uint16 zoneid, uint8 day, int16 pedDensity,
info = &ZoneInfoArray[day ? zone->zoneinfoDay : zone->zoneinfoNight];
if(pedDensity != -1) info->pedDensity = pedDensity;
if(copDensity != -1) info->copDensity = copDensity;
if(gang0Density != -1) info->gangThreshold[0] = gang0Density;
if(gang1Density != -1) info->gangThreshold[1] = gang1Density;
if(gang2Density != -1) info->gangThreshold[2] = gang2Density;
if(gang3Density != -1) info->gangThreshold[3] = gang3Density;
if(gang4Density != -1) info->gangThreshold[4] = gang4Density;
if(gang5Density != -1) info->gangThreshold[5] = gang5Density;
if(gang6Density != -1) info->gangThreshold[6] = gang6Density;
if(gang7Density != -1) info->gangThreshold[7] = gang7Density;
if(gang8Density != -1) info->gangThreshold[8] = gang8Density;
if(gang0Density != -1) info->gangDensity[0] = gang0Density;
if(gang1Density != -1) info->gangDensity[1] = gang1Density;
if(gang2Density != -1) info->gangDensity[2] = gang2Density;
if(gang3Density != -1) info->gangDensity[3] = gang3Density;
if(gang4Density != -1) info->gangDensity[4] = gang4Density;
if(gang5Density != -1) info->gangDensity[5] = gang5Density;
if(gang6Density != -1) info->gangDensity[6] = gang6Density;
if(gang7Density != -1) info->gangDensity[7] = gang7Density;
if(gang8Density != -1) info->gangDensity[8] = gang8Density;
}

void
@@ -33,10 +33,10 @@ class CZoneInfo
{
public:
// Car data
uint16 carDensity;
uint16 carThreshold[6];
uint16 copThreshold;
uint16 gangThreshold[9];
int16 carDensity;
int16 carThreshold[6];
int16 copThreshold;
int16 gangThreshold[9];

// Ped data
uint16 pedDensity;
@@ -40,12 +40,13 @@ typedef int32_t int32, Int32;
typedef uintptr_t uintptr;
typedef uint64_t uint64, UInt64;
typedef int64_t int64, Int64;
// hardcode ucs-2
typedef uint16_t wchar, WChar;

typedef float Float;
typedef double Double;
typedef bool Bool;
typedef char Char;
typedef wchar_t WChar;

#define nil NULL

@@ -51,8 +51,13 @@ enum Config {
NUMWEATHERS = 4,
NUMHOURS = 24,

NUMEXTRADIRECTIONALS = 4,
NUMANTENNAS = 8,
NUMCORONAS = 56,
NUMPOINTLIGHTS = 32
};

#define GTA3_1_1_PATCH FALSE
#define USE_PS2_RAND FALSE
#define USE_PS2_RAND FALSE
#define RANDOMSPLASH
#define CHATTYSPLASH

0 comments on commit 809c81e

Please sign in to comment.