mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2024-11-27 11:34:14 +01:00
Merge branch 'miami' of https://github.com/GTAmodding/re3 into new
This commit is contained in:
commit
342da2430b
@ -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"
|
||||||
|
|
||||||
|
@ -7,29 +7,38 @@
|
|||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
#include "Script.h"
|
#include "Script.h"
|
||||||
#include "OnscreenTimer.h"
|
#include "OnscreenTimer.h"
|
||||||
|
#include "Camera.h"
|
||||||
|
|
||||||
|
// --MIAMI: file done
|
||||||
|
|
||||||
void COnscreenTimer::Init() {
|
void COnscreenTimer::Init() {
|
||||||
m_bDisabled = false;
|
m_bDisabled = false;
|
||||||
for(uint32 i = 0; i < NUMONSCREENTIMERENTRIES; i++) {
|
for(uint32 i = 0; i < NUMONSCREENCOUNTERS; i++) {
|
||||||
m_sEntries[i].m_nTimerOffset = 0;
|
m_sCounters[i].m_nCounterOffset = 0;
|
||||||
m_sEntries[i].m_nCounterOffset = 0;
|
|
||||||
|
|
||||||
for(uint32 j = 0; j < 10; j++) {
|
for(uint32 j = 0; j < ARRAY_SIZE(COnscreenCounterEntry::m_aCounterText); j++) {
|
||||||
m_sEntries[i].m_aTimerText[j] = 0;
|
m_sCounters[i].m_aCounterText[j] = 0;
|
||||||
m_sEntries[i].m_aCounterText[j] = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sEntries[i].m_nType = COUNTER_DISPLAY_NUMBER;
|
m_sCounters[i].m_nType = COUNTER_DISPLAY_NUMBER;
|
||||||
m_sEntries[i].m_bTimerProcessed = false;
|
m_sCounters[i].m_bCounterProcessed = false;
|
||||||
m_sEntries[i].m_bCounterProcessed = false;
|
}
|
||||||
m_sEntries[i].m_bTimerGoingDown = true;
|
for(uint32 i = 0; i < NUMONSCREENCLOCKS; i++) {
|
||||||
|
m_sClocks[i].m_nClockOffset = 0;
|
||||||
|
|
||||||
|
for(uint32 j = 0; j < ARRAY_SIZE(COnscreenTimerEntry::m_aClockText); j++) {
|
||||||
|
m_sClocks[i].m_aClockText[j] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_sClocks[i].m_bClockProcessed = false;
|
||||||
|
m_sClocks[i].m_bClockGoingDown = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void COnscreenTimer::Process() {
|
void COnscreenTimer::Process() {
|
||||||
if(!CReplay::IsPlayingBack() && !m_bDisabled) {
|
if(!CReplay::IsPlayingBack() && !m_bDisabled) {
|
||||||
for(uint32 i = 0; i < NUMONSCREENTIMERENTRIES; i++) {
|
for(uint32 i = 0; i < NUMONSCREENCLOCKS; i++) {
|
||||||
m_sEntries[i].Process();
|
m_sClocks[i].Process();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -37,8 +46,19 @@ void COnscreenTimer::Process() {
|
|||||||
void COnscreenTimer::ProcessForDisplay() {
|
void COnscreenTimer::ProcessForDisplay() {
|
||||||
if(CHud::m_Wants_To_Draw_Hud) {
|
if(CHud::m_Wants_To_Draw_Hud) {
|
||||||
m_bProcessed = false;
|
m_bProcessed = false;
|
||||||
for(uint32 i = 0; i < NUMONSCREENTIMERENTRIES; i++) {
|
for(uint32 i = 0; i < NUMONSCREENCLOCKS; i++) {
|
||||||
if(m_sEntries[i].ProcessForDisplay()) {
|
m_sClocks[i].m_bClockProcessed = false;
|
||||||
|
if (m_sClocks[i].m_nClockOffset != 0) {
|
||||||
|
m_sClocks[i].ProcessForDisplayClock();
|
||||||
|
m_sClocks[i].m_bClockProcessed = true;
|
||||||
|
m_bProcessed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(uint32 i = 0; i < NUMONSCREENCOUNTERS; i++) {
|
||||||
|
m_sCounters[i].m_bCounterProcessed = false;
|
||||||
|
if (m_sCounters[i].m_nCounterOffset != 0) {
|
||||||
|
m_sCounters[i].ProcessForDisplayCounter();
|
||||||
|
m_sCounters[i].m_bCounterProcessed = true;
|
||||||
m_bProcessed = true;
|
m_bProcessed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -46,77 +66,81 @@ void COnscreenTimer::ProcessForDisplay() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void COnscreenTimer::ClearCounter(uint32 offset) {
|
void COnscreenTimer::ClearCounter(uint32 offset) {
|
||||||
for(uint32 i = 0; i < NUMONSCREENTIMERENTRIES; i++) {
|
for(uint32 i = 0; i < NUMONSCREENCOUNTERS; i++) {
|
||||||
if(offset == m_sEntries[i].m_nCounterOffset) {
|
if(offset == m_sCounters[i].m_nCounterOffset) {
|
||||||
m_sEntries[i].m_nCounterOffset = 0;
|
m_sCounters[i].m_nCounterOffset = 0;
|
||||||
m_sEntries[i].m_aCounterText[0] = 0;
|
m_sCounters[i].m_aCounterText[0] = 0;
|
||||||
m_sEntries[i].m_nType = COUNTER_DISPLAY_NUMBER;
|
m_sCounters[i].m_nType = COUNTER_DISPLAY_NUMBER;
|
||||||
m_sEntries[i].m_bCounterProcessed = 0;
|
m_sCounters[i].m_bCounterProcessed = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void COnscreenTimer::ClearClock(uint32 offset) {
|
void COnscreenTimer::ClearClock(uint32 offset) {
|
||||||
for(uint32 i = 0; i < NUMONSCREENTIMERENTRIES; i++) {
|
for(uint32 i = 0; i < NUMONSCREENCLOCKS; i++) {
|
||||||
if(offset == m_sEntries[i].m_nTimerOffset) {
|
if(offset == m_sClocks[i].m_nClockOffset) {
|
||||||
m_sEntries[i].m_nTimerOffset = 0;
|
m_sClocks[i].m_nClockOffset = 0;
|
||||||
m_sEntries[i].m_aTimerText[0] = 0;
|
m_sClocks[i].m_aClockText[0] = 0;
|
||||||
m_sEntries[i].m_bTimerProcessed = 0;
|
m_sClocks[i].m_bClockProcessed = 0;
|
||||||
|
m_sClocks[i].m_bClockGoingDown = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void COnscreenTimer::AddCounter(uint32 offset, uint16 type, char* text, uint16 pos) {
|
void COnscreenTimer::AddCounter(uint32 offset, uint16 type, char* text, uint16 pos) {
|
||||||
|
|
||||||
m_sEntries[pos].m_nCounterOffset = offset;
|
if (m_sCounters[pos].m_aCounterText[0] != '\0')
|
||||||
if (m_sEntries[pos].m_aCounterText[0] != '\0')
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
m_sCounters[pos].m_nCounterOffset = offset;
|
||||||
if(text) {
|
if(text) {
|
||||||
strncpy(m_sEntries[pos].m_aCounterText, text, 10);
|
strncpy(m_sCounters[pos].m_aCounterText, text, ARRAY_SIZE(COnscreenCounterEntry::m_aCounterText));
|
||||||
} else {
|
} else {
|
||||||
m_sEntries[pos].m_aCounterText[0] = 0;
|
m_sCounters[pos].m_aCounterText[0] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sEntries[pos].m_nType = type;
|
m_sCounters[pos].m_nType = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
void COnscreenTimer::AddClock(uint32 offset, char* text, bool bGoingDown) {
|
void COnscreenTimer::AddClock(uint32 offset, char* text, bool bGoingDown) {
|
||||||
uint32 i = 0;
|
|
||||||
for(uint32 i = 0; i < NUMONSCREENTIMERENTRIES; i++) {
|
// dead code in here
|
||||||
if(m_sEntries[i].m_nTimerOffset == 0) {
|
uint32 i;
|
||||||
|
for(i = 0; i < NUMONSCREENCLOCKS; i++) {
|
||||||
|
if(m_sClocks[i].m_nClockOffset == 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sEntries[i].m_nTimerOffset = offset;
|
m_sClocks[i].m_nClockOffset = offset;
|
||||||
m_sEntries[i].m_bTimerGoingDown = bGoingDown;
|
m_sClocks[i].m_bClockGoingDown = bGoingDown;
|
||||||
if(text) {
|
if(text) {
|
||||||
strncpy(m_sEntries[i].m_aTimerText, text, 10);
|
strncpy(m_sClocks[i].m_aClockText, text, ARRAY_SIZE(COnscreenTimerEntry::m_aClockText));
|
||||||
} else {
|
} else {
|
||||||
m_sEntries[i].m_aTimerText[0] = 0;
|
m_sClocks[i].m_aClockText[0] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void COnscreenTimerEntry::Process() {
|
void COnscreenTimerEntry::Process() {
|
||||||
if(m_nTimerOffset == 0) {
|
if(m_nClockOffset == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32* timerPtr = CTheScripts::GetPointerToScriptVariable(m_nTimerOffset);
|
int32* timerPtr = CTheScripts::GetPointerToScriptVariable(m_nClockOffset);
|
||||||
int32 oldTime = *timerPtr;
|
int32 oldTime = *timerPtr;
|
||||||
if (m_bTimerGoingDown) {
|
if (m_bClockGoingDown) {
|
||||||
int32 newTime = oldTime - int32(CTimer::GetTimeStepInMilliseconds());
|
int32 newTime = oldTime - int32(CTimer::GetTimeStepInMilliseconds());
|
||||||
|
*timerPtr = newTime;
|
||||||
if (newTime < 0) {
|
if (newTime < 0) {
|
||||||
*timerPtr = 0;
|
*timerPtr = 0;
|
||||||
m_bTimerProcessed = 0;
|
m_bClockProcessed = 0;
|
||||||
m_nTimerOffset = 0;
|
m_nClockOffset = 0;
|
||||||
m_aTimerText[0] = 0;
|
m_aClockText[0] = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
*timerPtr = newTime;
|
|
||||||
int32 oldTimeSeconds = oldTime / 1000;
|
int32 oldTimeSeconds = oldTime / 1000;
|
||||||
if (oldTimeSeconds < 12 && newTime / 1000 != oldTimeSeconds) {
|
if (oldTimeSeconds < 12 && newTime / 1000 != oldTimeSeconds && !TheCamera.m_WideScreenOn) {
|
||||||
DMAudio.PlayFrontEndSound(SOUND_CLOCK_TICK, newTime / 1000);
|
DMAudio.PlayFrontEndSound(SOUND_CLOCK_TICK, newTime / 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -125,33 +149,13 @@ void COnscreenTimerEntry::Process() {
|
|||||||
*timerPtr = oldTime + int32(CTimer::GetTimeStepInMilliseconds());
|
*timerPtr = oldTime + int32(CTimer::GetTimeStepInMilliseconds());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool COnscreenTimerEntry::ProcessForDisplay() {
|
|
||||||
m_bTimerProcessed = false;
|
|
||||||
m_bCounterProcessed = false;
|
|
||||||
|
|
||||||
if(m_nTimerOffset == 0 && m_nCounterOffset == 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(m_nTimerOffset != 0) {
|
|
||||||
m_bTimerProcessed = true;
|
|
||||||
ProcessForDisplayClock();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(m_nCounterOffset != 0) {
|
|
||||||
m_bCounterProcessed = true;
|
|
||||||
ProcessForDisplayCounter();
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void COnscreenTimerEntry::ProcessForDisplayClock() {
|
void COnscreenTimerEntry::ProcessForDisplayClock() {
|
||||||
uint32 time = *CTheScripts::GetPointerToScriptVariable(m_nTimerOffset);
|
uint32 time = *CTheScripts::GetPointerToScriptVariable(m_nClockOffset);
|
||||||
sprintf(m_bTimerBuffer, "%02d:%02d", time / 1000 / 60,
|
sprintf(m_aClockBuffer, "%02d:%02d", time / 1000 / 60 % 100,
|
||||||
time / 1000 % 60);
|
time / 1000 % 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
void COnscreenTimerEntry::ProcessForDisplayCounter() {
|
void COnscreenCounterEntry::ProcessForDisplayCounter() {
|
||||||
uint32 counter = *CTheScripts::GetPointerToScriptVariable(m_nCounterOffset);
|
uint32 counter = *CTheScripts::GetPointerToScriptVariable(m_nCounterOffset);
|
||||||
sprintf(m_bCounterBuffer, "%d", counter);
|
sprintf(m_aCounterBuffer, "%d", counter);
|
||||||
}
|
}
|
||||||
|
@ -9,30 +9,37 @@ enum
|
|||||||
class COnscreenTimerEntry
|
class COnscreenTimerEntry
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
uint32 m_nTimerOffset;
|
uint32 m_nClockOffset;
|
||||||
uint32 m_nCounterOffset;
|
char m_aClockText[10];
|
||||||
char m_aTimerText[10];
|
char m_aClockBuffer[40];
|
||||||
char m_aCounterText[10];
|
bool m_bClockProcessed;
|
||||||
uint16 m_nType;
|
bool m_bClockGoingDown;
|
||||||
char m_bCounterBuffer[42];
|
|
||||||
char m_bTimerBuffer[42];
|
|
||||||
bool m_bTimerProcessed;
|
|
||||||
bool m_bTimerGoingDown;
|
|
||||||
bool m_bCounterProcessed;
|
|
||||||
|
|
||||||
void Process();
|
void Process();
|
||||||
bool ProcessForDisplay();
|
|
||||||
|
|
||||||
void ProcessForDisplayClock();
|
void ProcessForDisplayClock();
|
||||||
|
};
|
||||||
|
|
||||||
|
VALIDATE_SIZE(COnscreenTimerEntry, 0x3C);
|
||||||
|
|
||||||
|
class COnscreenCounterEntry
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
uint32 m_nCounterOffset;
|
||||||
|
char m_aCounterText[10];
|
||||||
|
uint16 m_nType;
|
||||||
|
char m_aCounterBuffer[40];
|
||||||
|
bool m_bCounterProcessed;
|
||||||
|
|
||||||
void ProcessForDisplayCounter();
|
void ProcessForDisplayCounter();
|
||||||
};
|
};
|
||||||
|
|
||||||
VALIDATE_SIZE(COnscreenTimerEntry, 0x74);
|
VALIDATE_SIZE(COnscreenCounterEntry, 0x3C);
|
||||||
|
|
||||||
class COnscreenTimer
|
class COnscreenTimer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
COnscreenTimerEntry m_sEntries[NUMONSCREENTIMERENTRIES];
|
COnscreenTimerEntry m_sClocks[NUMONSCREENCLOCKS];
|
||||||
|
COnscreenCounterEntry m_sCounters[NUMONSCREENCOUNTERS];
|
||||||
bool m_bProcessed;
|
bool m_bProcessed;
|
||||||
bool m_bDisabled;
|
bool m_bDisabled;
|
||||||
|
|
||||||
@ -47,4 +54,4 @@ public:
|
|||||||
void AddClock(uint32 offset, char* text, bool bGoingDown);
|
void AddClock(uint32 offset, char* text, bool bGoingDown);
|
||||||
};
|
};
|
||||||
|
|
||||||
VALIDATE_SIZE(COnscreenTimer, 0x78);
|
VALIDATE_SIZE(COnscreenTimer, 0xF4);
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
#include "Camera.h"
|
#include "Camera.h"
|
||||||
#include "Radar.h"
|
#include "Radar.h"
|
||||||
#include "Fluff.h"
|
#include "Fluff.h"
|
||||||
|
#include "WaterCreatures.h"
|
||||||
|
|
||||||
uint8 CReplay::Mode;
|
uint8 CReplay::Mode;
|
||||||
CAddressInReplayBuffer CReplay::Record;
|
CAddressInReplayBuffer CReplay::Record;
|
||||||
@ -1300,7 +1301,7 @@ void CReplay::TriggerPlayback(uint8 cam_mode, float cam_x, float cam_y, float ca
|
|||||||
DMAudio.SetEffectsFadeVol(0);
|
DMAudio.SetEffectsFadeVol(0);
|
||||||
DMAudio.SetMusicFadeVol(0);
|
DMAudio.SetMusicFadeVol(0);
|
||||||
CEscalators::Shutdown();
|
CEscalators::Shutdown();
|
||||||
// TODO(MIAMI): CWaterCreatures::RemoveAll();
|
CWaterCreatures::RemoveAll();
|
||||||
int current;
|
int current;
|
||||||
for (current = 0; current < NUM_REPLAYBUFFERS; current++)
|
for (current = 0; current < NUM_REPLAYBUFFERS; current++)
|
||||||
if (BufferStatus[current] == REPLAYBUFFER_RECORD)
|
if (BufferStatus[current] == REPLAYBUFFER_RECORD)
|
||||||
|
@ -240,9 +240,8 @@ CdStreamRead(int32 channel, void *buffer, uint32 offset, uint32 size)
|
|||||||
CdReadInfo *pChannel = &gpReadInfo[channel];
|
CdReadInfo *pChannel = &gpReadInfo[channel];
|
||||||
ASSERT( pChannel != nil );
|
ASSERT( pChannel != nil );
|
||||||
|
|
||||||
|
|
||||||
if ( pChannel->nSectorsToRead != 0 || pChannel->bReading ) {
|
if ( pChannel->nSectorsToRead != 0 || pChannel->bReading ) {
|
||||||
if (pChannel->nSectorOffset == _GET_OFFSET(offset) && pChannel->nSectorsToRead >= size)
|
if (pChannel->hFile == hImage - 1 && pChannel->nSectorOffset == _GET_OFFSET(offset) && pChannel->nSectorsToRead >= size)
|
||||||
return STREAM_SUCCESS;
|
return STREAM_SUCCESS;
|
||||||
|
|
||||||
flushStream[channel] = 1;
|
flushStream[channel] = 1;
|
||||||
@ -293,7 +292,6 @@ CdStreamGetStatus(int32 channel)
|
|||||||
if ( pChannel->nStatus != STREAM_NONE )
|
if ( pChannel->nStatus != STREAM_NONE )
|
||||||
{
|
{
|
||||||
int32 status = pChannel->nStatus;
|
int32 status = pChannel->nStatus;
|
||||||
|
|
||||||
pChannel->nStatus = STREAM_NONE;
|
pChannel->nStatus = STREAM_NONE;
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
@ -322,15 +320,16 @@ CdStreamSync(int32 channel)
|
|||||||
pthread_kill(pChannel->pChannelThread, SIGUSR1);
|
pthread_kill(pChannel->pChannelThread, SIGUSR1);
|
||||||
if (pChannel->bReading) {
|
if (pChannel->bReading) {
|
||||||
pChannel->bLocked = true;
|
pChannel->bLocked = true;
|
||||||
sem_wait(pChannel->pDoneSemaphore);
|
while (pChannel->bLocked)
|
||||||
|
sem_wait(pChannel->pDoneSemaphore);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
pChannel->nSectorsToRead = 0;
|
pChannel->nSectorsToRead = 0;
|
||||||
if (pChannel->bReading) {
|
if (pChannel->bReading) {
|
||||||
pChannel->bLocked = true;
|
pChannel->bLocked = true;
|
||||||
pthread_kill(_gCdStreamThread, SIGUSR1);
|
pthread_kill(_gCdStreamThread, SIGUSR1);
|
||||||
sem_wait(pChannel->pDoneSemaphore);
|
while (pChannel->bLocked)
|
||||||
|
sem_wait(pChannel->pDoneSemaphore);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
pChannel->bReading = false;
|
pChannel->bReading = false;
|
||||||
@ -341,8 +340,8 @@ CdStreamSync(int32 channel)
|
|||||||
if ( pChannel->nSectorsToRead != 0 )
|
if ( pChannel->nSectorsToRead != 0 )
|
||||||
{
|
{
|
||||||
pChannel->bLocked = true;
|
pChannel->bLocked = true;
|
||||||
|
while (pChannel->bLocked)
|
||||||
sem_wait(pChannel->pDoneSemaphore);
|
sem_wait(pChannel->pDoneSemaphore);
|
||||||
}
|
}
|
||||||
|
|
||||||
pChannel->bReading = false;
|
pChannel->bReading = false;
|
||||||
@ -443,9 +442,9 @@ void *CdStreamThread(void *param)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
pChannel->nSectorsToRead = 0;
|
pChannel->nSectorsToRead = 0;
|
||||||
|
|
||||||
if ( pChannel->bLocked )
|
if ( pChannel->bLocked )
|
||||||
{
|
{
|
||||||
|
pChannel->bLocked = 0;
|
||||||
sem_post(pChannel->pDoneSemaphore);
|
sem_post(pChannel->pDoneSemaphore);
|
||||||
}
|
}
|
||||||
pChannel->bReading = false;
|
pChannel->bReading = false;
|
||||||
|
@ -16,6 +16,9 @@
|
|||||||
#include "Ped.h"
|
#include "Ped.h"
|
||||||
#include "Fire.h"
|
#include "Fire.h"
|
||||||
#include "GameLogic.h"
|
#include "GameLogic.h"
|
||||||
|
#include "CarAI.h"
|
||||||
|
|
||||||
|
// --MIAMI: file done
|
||||||
|
|
||||||
CFireManager gFireManager;
|
CFireManager gFireManager;
|
||||||
|
|
||||||
@ -26,14 +29,13 @@ CFire::CFire()
|
|||||||
m_bPropagationFlag = true;
|
m_bPropagationFlag = true;
|
||||||
m_bAudioSet = true;
|
m_bAudioSet = true;
|
||||||
m_vecPos = CVector(0.0f, 0.0f, 0.0f);
|
m_vecPos = CVector(0.0f, 0.0f, 0.0f);
|
||||||
m_pEntity = nil;
|
|
||||||
m_pSource = nil;
|
|
||||||
m_nFiremenPuttingOut = 0;
|
|
||||||
m_nExtinguishTime = 0;
|
m_nExtinguishTime = 0;
|
||||||
m_nStartTime = 0;
|
m_nStartTime = 0;
|
||||||
field_20 = 1;
|
m_pEntity = nil;
|
||||||
m_nNextTimeToAddFlames = 0;
|
m_pSource = nil;
|
||||||
m_fStrength = 0.8f;
|
m_fStrength = 0.8f;
|
||||||
|
m_fWaterExtinguishCountdown = 1.0f;
|
||||||
|
m_bExtinguishedWithWater = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
CFire::~CFire() {}
|
CFire::~CFire() {}
|
||||||
@ -52,6 +54,8 @@ CFire::ProcessFire(void)
|
|||||||
CPed *ped = (CPed *)m_pEntity;
|
CPed *ped = (CPed *)m_pEntity;
|
||||||
CVehicle *veh = (CVehicle*)m_pEntity;
|
CVehicle *veh = (CVehicle*)m_pEntity;
|
||||||
|
|
||||||
|
m_fWaterExtinguishCountdown = Min(1.0f, 0.002f * CTimer::GetTimeStep() + m_fWaterExtinguishCountdown);
|
||||||
|
|
||||||
if (m_pEntity) {
|
if (m_pEntity) {
|
||||||
m_vecPos = m_pEntity->GetPosition();
|
m_vecPos = m_pEntity->GetPosition();
|
||||||
|
|
||||||
@ -109,7 +113,7 @@ CFire::ProcessFire(void)
|
|||||||
gFireManager.StartFire(FindPlayerPed(), m_pSource, 0.8f, 1);
|
gFireManager.StartFire(FindPlayerPed(), m_pSource, 0.8f, 1);
|
||||||
}
|
}
|
||||||
if (CTimer::GetTimeInMilliseconds() > m_nNextTimeToAddFlames) {
|
if (CTimer::GetTimeInMilliseconds() > m_nNextTimeToAddFlames) {
|
||||||
m_nNextTimeToAddFlames = CTimer::GetTimeInMilliseconds() + 80;
|
m_nNextTimeToAddFlames = CTimer::GetTimeInMilliseconds() + (m_fWaterExtinguishCountdown < 0.3f ? 400 : (m_fWaterExtinguishCountdown < 0.7f ? 200 : 80));
|
||||||
firePos = m_vecPos;
|
firePos = m_vecPos;
|
||||||
|
|
||||||
if (veh && veh->IsVehicle() && veh->IsCar()) {
|
if (veh && veh->IsVehicle() && veh->IsCar()) {
|
||||||
@ -170,11 +174,23 @@ CFire::Extinguish(void)
|
|||||||
|
|
||||||
m_nExtinguishTime = 0;
|
m_nExtinguishTime = 0;
|
||||||
m_bIsOngoing = false;
|
m_bIsOngoing = false;
|
||||||
|
m_bExtinguishedWithWater = false;
|
||||||
|
|
||||||
if (m_pEntity) {
|
if (m_pEntity) {
|
||||||
if (m_pEntity->IsPed()) {
|
if (m_pEntity->IsPed()) {
|
||||||
((CPed *)m_pEntity)->RestorePreviousState();
|
CPed *ped = (CPed*)m_pEntity;
|
||||||
((CPed *)m_pEntity)->m_pFire = nil;
|
if (ped->CanSetPedState()) {
|
||||||
|
if (ped->m_nPedState != PED_DRIVING && ped->m_nPedState != PED_FALL) {
|
||||||
|
if (ped->IsPlayer()) {
|
||||||
|
ped->SetIdle();
|
||||||
|
} else {
|
||||||
|
ped->m_nLastPedState = PED_NONE;
|
||||||
|
ped->SetWanderPath(0);
|
||||||
|
ped->SetWaitState(WAITSTATE_FINISH_FLEE, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ped->m_pFire = nil;
|
||||||
} else if (m_pEntity->IsVehicle()) {
|
} else if (m_pEntity->IsVehicle()) {
|
||||||
((CVehicle *)m_pEntity)->m_pCarFire = nil;
|
((CVehicle *)m_pEntity)->m_pCarFire = nil;
|
||||||
}
|
}
|
||||||
@ -184,7 +200,7 @@ CFire::Extinguish(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CFireManager::StartFire(CVector pos, float size, bool propagation)
|
CFireManager::StartFire(CVector pos, float size, uint8 propagation)
|
||||||
{
|
{
|
||||||
CFire *fire = GetNextFreeFire();
|
CFire *fire = GetNextFreeFire();
|
||||||
|
|
||||||
@ -201,11 +217,12 @@ CFireManager::StartFire(CVector pos, float size, bool propagation)
|
|||||||
fire->m_nNextTimeToAddFlames = 0;
|
fire->m_nNextTimeToAddFlames = 0;
|
||||||
fire->ReportThisFire();
|
fire->ReportThisFire();
|
||||||
fire->m_fStrength = size;
|
fire->m_fStrength = size;
|
||||||
|
fire->m_bExtinguishedWithWater = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CFire *
|
CFire *
|
||||||
CFireManager::StartFire(CEntity *entityOnFire, CEntity *fleeFrom, float strength, bool propagation)
|
CFireManager::StartFire(CEntity *entityOnFire, CEntity *fleeFrom, float strength, uint8 propagation)
|
||||||
{
|
{
|
||||||
CPed *ped = (CPed *)entityOnFire;
|
CPed *ped = (CPed *)entityOnFire;
|
||||||
CVehicle *veh = (CVehicle *)entityOnFire;
|
CVehicle *veh = (CVehicle *)entityOnFire;
|
||||||
@ -234,10 +251,11 @@ CFireManager::StartFire(CEntity *entityOnFire, CEntity *fleeFrom, float strength
|
|||||||
ped->SetFlee(pos, 10000);
|
ped->SetFlee(pos, 10000);
|
||||||
ped->m_fleeFrom = nil;
|
ped->m_fleeFrom = nil;
|
||||||
}
|
}
|
||||||
|
ped->m_fleeTimer = CTimer::GetTimeInMilliseconds() + 10000;
|
||||||
ped->bDrawLast = false;
|
ped->bDrawLast = false;
|
||||||
ped->SetMoveState(PEDMOVE_SPRINT);
|
ped->SetMoveState(PEDMOVE_SPRINT);
|
||||||
ped->SetMoveAnim();
|
ped->SetMoveAnim();
|
||||||
ped->m_nPedState = PED_ON_FIRE;
|
ped->SetPedState(PED_ON_FIRE);
|
||||||
}
|
}
|
||||||
if (fleeFrom) {
|
if (fleeFrom) {
|
||||||
if (ped->m_nPedType == PEDTYPE_COP) {
|
if (ped->m_nPedType == PEDTYPE_COP) {
|
||||||
@ -251,6 +269,9 @@ CFireManager::StartFire(CEntity *entityOnFire, CEntity *fleeFrom, float strength
|
|||||||
} else {
|
} else {
|
||||||
if (entityOnFire->IsVehicle()) {
|
if (entityOnFire->IsVehicle()) {
|
||||||
veh->m_pCarFire = fire;
|
veh->m_pCarFire = fire;
|
||||||
|
if (CModelInfo::IsBikeModel(veh->GetModelIndex()) || CModelInfo::IsCarModel(veh->GetModelIndex()))
|
||||||
|
CCarAI::TellOccupantsToFleeCar(veh);
|
||||||
|
|
||||||
if (fleeFrom) {
|
if (fleeFrom) {
|
||||||
CEventList::RegisterEvent(EVENT_CAR_SET_ON_FIRE, EVENT_ENTITY_VEHICLE,
|
CEventList::RegisterEvent(EVENT_CAR_SET_ON_FIRE, EVENT_ENTITY_VEHICLE,
|
||||||
entityOnFire, (CPed *)fleeFrom, 10000);
|
entityOnFire, (CPed *)fleeFrom, 10000);
|
||||||
@ -259,6 +280,7 @@ CFireManager::StartFire(CEntity *entityOnFire, CEntity *fleeFrom, float strength
|
|||||||
}
|
}
|
||||||
|
|
||||||
fire->m_bIsOngoing = true;
|
fire->m_bIsOngoing = true;
|
||||||
|
fire->m_bExtinguishedWithWater = false;
|
||||||
fire->m_bIsScriptFire = false;
|
fire->m_bIsScriptFire = false;
|
||||||
fire->m_vecPos = entityOnFire->GetPosition();
|
fire->m_vecPos = entityOnFire->GetPosition();
|
||||||
|
|
||||||
@ -297,26 +319,23 @@ CFireManager::Update(void)
|
|||||||
|
|
||||||
CFire* CFireManager::FindNearestFire(CVector vecPos, float *pDistance)
|
CFire* CFireManager::FindNearestFire(CVector vecPos, float *pDistance)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < MAX_FIREMEN_ATTENDING; i++) {
|
int fireId = -1;
|
||||||
int fireId = -1;
|
float minDistance = 999999;
|
||||||
float minDistance = 999999;
|
for (int j = 0; j < NUM_FIRES; j++) {
|
||||||
for (int j = 0; j < NUM_FIRES; j++) {
|
if (!m_aFires[j].m_bIsOngoing)
|
||||||
if (!m_aFires[j].m_bIsOngoing)
|
continue;
|
||||||
continue;
|
if (m_aFires[j].m_bIsScriptFire)
|
||||||
if (m_aFires[j].m_bIsScriptFire)
|
continue;
|
||||||
continue;
|
float distance = (m_aFires[j].m_vecPos - vecPos).Magnitude2D();
|
||||||
if (m_aFires[j].m_nFiremenPuttingOut != i)
|
if (distance < minDistance) {
|
||||||
continue;
|
minDistance = distance;
|
||||||
float distance = (m_aFires[j].m_vecPos - vecPos).Magnitude2D();
|
fireId = j;
|
||||||
if (distance < minDistance) {
|
|
||||||
minDistance = distance;
|
|
||||||
fireId = j;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
*pDistance = minDistance;
|
|
||||||
if (fireId != -1)
|
|
||||||
return &m_aFires[fireId];
|
|
||||||
}
|
}
|
||||||
|
*pDistance = minDistance;
|
||||||
|
if (fireId != -1)
|
||||||
|
return &m_aFires[fireId];
|
||||||
|
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -369,8 +388,39 @@ CFireManager::ExtinguishPoint(CVector point, float range)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
CFireManager::ExtinguishPointWithWater(CVector point, float range)
|
||||||
|
{
|
||||||
|
int fireI = 0;
|
||||||
|
for (int i = 0; i < NUM_FIRES; i++) {
|
||||||
|
if (m_aFires[i].m_bIsOngoing) {
|
||||||
|
if ((point - m_aFires[i].m_vecPos).MagnitudeSqr() < sq(range)) {
|
||||||
|
fireI = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (fireI == NUM_FIRES)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
CFire *fireToExtinguish = &m_aFires[fireI];
|
||||||
|
fireToExtinguish->m_fWaterExtinguishCountdown -= 0.012f * CTimer::GetTimeStep();
|
||||||
|
CVector steamPos = fireToExtinguish->m_vecPos +
|
||||||
|
CVector((CGeneral::GetRandomNumber() - 128) * 31.f / 200.f,
|
||||||
|
(CGeneral::GetRandomNumber() - 128) * 31.f / 200.f,
|
||||||
|
CGeneral::GetRandomNumber() / 200.f);
|
||||||
|
|
||||||
|
CParticle::AddParticle(PARTICLE_STEAM_NY_SLOWMOTION, steamPos, CVector(0.f, 0.f, 0.2f), nil, 0.5f);
|
||||||
|
CParticle::AddParticle(PARTICLE_STEAM_NY_SLOWMOTION, steamPos, CVector(0.f, 0.f, 0.1f), nil, 0.8f);
|
||||||
|
fireToExtinguish->m_bExtinguishedWithWater = true;
|
||||||
|
if (fireToExtinguish->m_fWaterExtinguishCountdown < 0.0f )
|
||||||
|
fireToExtinguish->Extinguish();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
int32
|
int32
|
||||||
CFireManager::StartScriptFire(const CVector &pos, CEntity *target, float strength, bool propagation)
|
CFireManager::StartScriptFire(const CVector &pos, CEntity *target, float strength, uint8 propagation)
|
||||||
{
|
{
|
||||||
CFire *fire;
|
CFire *fire;
|
||||||
CPed *ped = (CPed *)target;
|
CPed *ped = (CPed *)target;
|
||||||
@ -397,12 +447,15 @@ CFireManager::StartScriptFire(const CVector &pos, CEntity *target, float strengt
|
|||||||
fire->m_vecPos = pos;
|
fire->m_vecPos = pos;
|
||||||
fire->m_nStartTime = CTimer::GetTimeInMilliseconds() + 400;
|
fire->m_nStartTime = CTimer::GetTimeInMilliseconds() + 400;
|
||||||
fire->m_pEntity = target;
|
fire->m_pEntity = target;
|
||||||
|
fire->m_bExtinguishedWithWater = false;
|
||||||
|
|
||||||
if (target)
|
if (target)
|
||||||
target->RegisterReference(&fire->m_pEntity);
|
target->RegisterReference(&fire->m_pEntity);
|
||||||
fire->m_pSource = nil;
|
fire->m_pSource = nil;
|
||||||
fire->m_nNextTimeToAddFlames = 0;
|
fire->m_nNextTimeToAddFlames = 0;
|
||||||
fire->m_fStrength = strength;
|
fire->m_fStrength = strength;
|
||||||
|
fire->m_fWaterExtinguishCountdown = 1.0f;
|
||||||
|
|
||||||
if (target) {
|
if (target) {
|
||||||
if (target->IsPed()) {
|
if (target->IsPed()) {
|
||||||
ped->m_pFire = fire;
|
ped->m_pFire = fire;
|
||||||
@ -410,7 +463,7 @@ CFireManager::StartScriptFire(const CVector &pos, CEntity *target, float strengt
|
|||||||
CVector2D pos = target->GetPosition();
|
CVector2D pos = target->GetPosition();
|
||||||
ped->SetFlee(pos, 10000);
|
ped->SetFlee(pos, 10000);
|
||||||
ped->SetMoveAnim();
|
ped->SetMoveAnim();
|
||||||
ped->m_nPedState = PED_ON_FIRE;
|
ped->SetPedState(PED_ON_FIRE);
|
||||||
}
|
}
|
||||||
} else if (target->IsVehicle()) {
|
} else if (target->IsVehicle()) {
|
||||||
veh->m_pCarFire = fire;
|
veh->m_pCarFire = fire;
|
||||||
@ -430,8 +483,7 @@ CFireManager::RemoveAllScriptFires(void)
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < NUM_FIRES; i++) {
|
for (int i = 0; i < NUM_FIRES; i++) {
|
||||||
if (m_aFires[i].m_bIsScriptFire) {
|
if (m_aFires[i].m_bIsScriptFire) {
|
||||||
m_aFires[i].Extinguish();
|
RemoveScriptFire(i);
|
||||||
m_aFires[i].m_bIsScriptFire = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,10 +14,10 @@ public:
|
|||||||
CEntity *m_pSource;
|
CEntity *m_pSource;
|
||||||
uint32 m_nExtinguishTime;
|
uint32 m_nExtinguishTime;
|
||||||
uint32 m_nStartTime;
|
uint32 m_nStartTime;
|
||||||
int32 field_20;
|
|
||||||
uint32 m_nNextTimeToAddFlames;
|
uint32 m_nNextTimeToAddFlames;
|
||||||
uint32 m_nFiremenPuttingOut;
|
|
||||||
float m_fStrength;
|
float m_fStrength;
|
||||||
|
float m_fWaterExtinguishCountdown;
|
||||||
|
bool m_bExtinguishedWithWater;
|
||||||
|
|
||||||
CFire();
|
CFire();
|
||||||
~CFire();
|
~CFire();
|
||||||
@ -34,15 +34,17 @@ class CFireManager
|
|||||||
public:
|
public:
|
||||||
uint32 m_nTotalFires;
|
uint32 m_nTotalFires;
|
||||||
CFire m_aFires[NUM_FIRES];
|
CFire m_aFires[NUM_FIRES];
|
||||||
void StartFire(CVector pos, float size, bool propagation);
|
|
||||||
CFire *StartFire(CEntity *entityOnFire, CEntity *fleeFrom, float strength, bool propagation);
|
void StartFire(CVector pos, float size, uint8 propagation);
|
||||||
|
CFire *StartFire(CEntity *entityOnFire, CEntity *fleeFrom, float strength, uint8 propagation);
|
||||||
void Update(void);
|
void Update(void);
|
||||||
CFire *FindFurthestFire_NeverMindFireMen(CVector coords, float minRange, float maxRange);
|
CFire *FindFurthestFire_NeverMindFireMen(CVector coords, float minRange, float maxRange);
|
||||||
CFire *FindNearestFire(CVector vecPos, float *pDistance);
|
CFire *FindNearestFire(CVector vecPos, float *pDistance);
|
||||||
CFire *GetNextFreeFire(void);
|
CFire *GetNextFreeFire(void);
|
||||||
uint32 GetTotalActiveFires() const;
|
uint32 GetTotalActiveFires() const;
|
||||||
void ExtinguishPoint(CVector point, float range);
|
void ExtinguishPoint(CVector point, float range);
|
||||||
int32 StartScriptFire(const CVector &pos, CEntity *target, float strength, bool propagation);
|
bool ExtinguishPointWithWater(CVector point, float range);
|
||||||
|
int32 StartScriptFire(const CVector &pos, CEntity *target, float strength, uint8 propagation);
|
||||||
bool IsScriptFireExtinguish(int16 index);
|
bool IsScriptFireExtinguish(int16 index);
|
||||||
void RemoveAllScriptFires(void);
|
void RemoveAllScriptFires(void);
|
||||||
void RemoveScriptFire(int16 index);
|
void RemoveScriptFire(int16 index);
|
||||||
|
@ -90,6 +90,7 @@
|
|||||||
#include "debugmenu.h"
|
#include "debugmenu.h"
|
||||||
#include "Ropes.h"
|
#include "Ropes.h"
|
||||||
#include "WindModifiers.h"
|
#include "WindModifiers.h"
|
||||||
|
#include "WaterCreatures.h"
|
||||||
#include "postfx.h"
|
#include "postfx.h"
|
||||||
#include "custompipes.h"
|
#include "custompipes.h"
|
||||||
|
|
||||||
@ -478,8 +479,7 @@ bool CGame::ShutDown(void)
|
|||||||
CPlane::Shutdown();
|
CPlane::Shutdown();
|
||||||
CTrain::Shutdown();
|
CTrain::Shutdown();
|
||||||
CScriptPaths::Shutdown();
|
CScriptPaths::Shutdown();
|
||||||
// TODO(Miami)
|
CWaterCreatures::RemoveAll();
|
||||||
// CWaterCreatures::RemoveAll();
|
|
||||||
CSpecialFX::Shutdown();
|
CSpecialFX::Shutdown();
|
||||||
#ifndef PS2
|
#ifndef PS2
|
||||||
CGarages::Shutdown();
|
CGarages::Shutdown();
|
||||||
@ -650,7 +650,7 @@ void CGame::ShutDownForRestart(void)
|
|||||||
CRadar::RemoveRadarSections();
|
CRadar::RemoveRadarSections();
|
||||||
FrontEndMenuManager.UnloadTextures();
|
FrontEndMenuManager.UnloadTextures();
|
||||||
CParticleObject::RemoveAllExpireableParticleObjects();
|
CParticleObject::RemoveAllExpireableParticleObjects();
|
||||||
//CWaterCreatures::RemoveAll(); //TODO(Miami)
|
CWaterCreatures::RemoveAll();
|
||||||
CSetPieces::Init();
|
CSetPieces::Init();
|
||||||
CPedType::Shutdown();
|
CPedType::Shutdown();
|
||||||
CSpecialFX::Shutdown();
|
CSpecialFX::Shutdown();
|
||||||
|
@ -10,6 +10,8 @@
|
|||||||
#include "World.h"
|
#include "World.h"
|
||||||
#include "Zones.h"
|
#include "Zones.h"
|
||||||
|
|
||||||
|
// --MIAMI: file done
|
||||||
|
|
||||||
CPlaceName CUserDisplay::PlaceName;
|
CPlaceName CUserDisplay::PlaceName;
|
||||||
COnscreenTimer CUserDisplay::OnscnTimer;
|
COnscreenTimer CUserDisplay::OnscnTimer;
|
||||||
CPager CUserDisplay::Pager;
|
CPager CUserDisplay::Pager;
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include "World.h"
|
#include "World.h"
|
||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
|
|
||||||
//--MIAMI: file almost done (loading/saving will perhaps stay different)
|
//--MIAMI: file done
|
||||||
|
|
||||||
eLevelName CTheZones::m_CurrLevel;
|
eLevelName CTheZones::m_CurrLevel;
|
||||||
int16 CTheZones::FindIndex;
|
int16 CTheZones::FindIndex;
|
||||||
@ -638,127 +638,132 @@ CTheZones::SaveAllZones(uint8 *buffer, uint32 *size)
|
|||||||
+ sizeof(int16) // padding
|
+ sizeof(int16) // padding
|
||||||
+ sizeof(NavigationZoneArray) + sizeof(InfoZoneArray) + sizeof(ZoneInfoArray)
|
+ sizeof(NavigationZoneArray) + sizeof(InfoZoneArray) + sizeof(ZoneInfoArray)
|
||||||
+ sizeof(TotalNumberOfNavigationZones) + sizeof(TotalNumberOfInfoZones) + sizeof(TotalNumberOfZoneInfos)
|
+ sizeof(TotalNumberOfNavigationZones) + sizeof(TotalNumberOfInfoZones) + sizeof(TotalNumberOfZoneInfos)
|
||||||
|
+ sizeof(int16) // padding
|
||||||
+ sizeof(MapZoneArray) + sizeof(AudioZoneArray)
|
+ sizeof(MapZoneArray) + sizeof(AudioZoneArray)
|
||||||
+ sizeof(TotalNumberOfMapZones) + sizeof(NumberOfAudioZones);
|
+ sizeof(TotalNumberOfMapZones) + sizeof(NumberOfAudioZones);
|
||||||
|
|
||||||
WriteSaveHeader(buffer, 'Z', 'N', 'S', '\0', *size - SAVE_HEADER_SIZE);
|
uint32 length = 0;
|
||||||
|
WriteSaveHeaderWithLength(buffer, length, 'Z', 'N', 'S', '\0', *size - SAVE_HEADER_SIZE);
|
||||||
|
|
||||||
WriteSaveBuf(buffer, m_CurrLevel);
|
WriteSaveBuf(buffer, length, m_CurrLevel);
|
||||||
WriteSaveBuf(buffer, FindIndex);
|
WriteSaveBuf(buffer, length, FindIndex);
|
||||||
WriteSaveBuf(buffer, (int16)0); // padding
|
WriteSaveBuf(buffer, length, (int16)0); // padding
|
||||||
|
|
||||||
// TODO(MIAMI) ? implement SaveOneZone
|
for(i = 0; i < ARRAY_SIZE(NavigationZoneArray); i++)
|
||||||
for(i = 0; i < ARRAY_SIZE(NavigationZoneArray); i++){
|
SaveOneZone(&NavigationZoneArray[i], &buffer, &length, ZONE_NAVIG);
|
||||||
CZone *zone = WriteSaveBuf(buffer, NavigationZoneArray[i]);
|
|
||||||
zone->child = (CZone*)GetIndexForZonePointer(NavigationZoneArray[i].child);
|
|
||||||
zone->parent = (CZone*)GetIndexForZonePointer(NavigationZoneArray[i].parent);
|
|
||||||
zone->next = (CZone*)GetIndexForZonePointer(NavigationZoneArray[i].next);
|
|
||||||
}
|
|
||||||
|
|
||||||
for(i = 0; i < ARRAY_SIZE(InfoZoneArray); i++){
|
for(i = 0; i < ARRAY_SIZE(InfoZoneArray); i++)
|
||||||
CZone *zone = WriteSaveBuf(buffer, InfoZoneArray[i]);
|
SaveOneZone(&InfoZoneArray[i], &buffer, &length, ZONE_INFO);
|
||||||
/*
|
|
||||||
The call of GetIndexForZonePointer is wrong, as it is
|
|
||||||
meant for a different array, but the game doesn't brake
|
|
||||||
if those fields are nil. Let's make sure they are.
|
|
||||||
*/
|
|
||||||
assert(InfoZoneArray[i].child == nil);
|
|
||||||
assert(InfoZoneArray[i].parent == nil);
|
|
||||||
assert(InfoZoneArray[i].next == nil);
|
|
||||||
zone->child = (CZone*)GetIndexForZonePointer(InfoZoneArray[i].child);
|
|
||||||
zone->parent = (CZone*)GetIndexForZonePointer(InfoZoneArray[i].parent);
|
|
||||||
zone->next = (CZone*)GetIndexForZonePointer(InfoZoneArray[i].next);
|
|
||||||
}
|
|
||||||
|
|
||||||
for(i = 0; i < ARRAY_SIZE(ZoneInfoArray); i++)
|
for(i = 0; i < ARRAY_SIZE(ZoneInfoArray); i++)
|
||||||
WriteSaveBuf(buffer, ZoneInfoArray[i]);
|
WriteSaveBuf(buffer, length, ZoneInfoArray[i]);
|
||||||
|
|
||||||
WriteSaveBuf(buffer, TotalNumberOfNavigationZones);
|
WriteSaveBuf(buffer, length, TotalNumberOfNavigationZones);
|
||||||
WriteSaveBuf(buffer, TotalNumberOfInfoZones);
|
WriteSaveBuf(buffer, length, TotalNumberOfInfoZones);
|
||||||
WriteSaveBuf(buffer, TotalNumberOfZoneInfos);
|
WriteSaveBuf(buffer, length, TotalNumberOfZoneInfos);
|
||||||
|
WriteSaveBuf(buffer, length, (int16)0); // padding
|
||||||
|
|
||||||
for(i = 0; i < ARRAY_SIZE(MapZoneArray); i++) {
|
for(i = 0; i < ARRAY_SIZE(MapZoneArray); i++)
|
||||||
CZone* zone = WriteSaveBuf(buffer, MapZoneArray[i]);
|
SaveOneZone(&MapZoneArray[i], &buffer, &length, ZONE_MAPZONE);
|
||||||
|
|
||||||
// see above
|
|
||||||
assert(MapZoneArray[i].child == nil);
|
|
||||||
assert(MapZoneArray[i].parent == nil);
|
|
||||||
assert(MapZoneArray[i].next == nil);
|
|
||||||
zone->child = (CZone*)GetIndexForZonePointer(MapZoneArray[i].child);
|
|
||||||
zone->parent = (CZone*)GetIndexForZonePointer(MapZoneArray[i].parent);
|
|
||||||
zone->next = (CZone*)GetIndexForZonePointer(MapZoneArray[i].next);
|
|
||||||
}
|
|
||||||
|
|
||||||
for(i = 0; i < ARRAY_SIZE(AudioZoneArray); i++)
|
for(i = 0; i < ARRAY_SIZE(AudioZoneArray); i++)
|
||||||
WriteSaveBuf(buffer, AudioZoneArray[i]);
|
WriteSaveBuf(buffer, length, AudioZoneArray[i]);
|
||||||
|
|
||||||
WriteSaveBuf(buffer, TotalNumberOfMapZones);
|
WriteSaveBuf(buffer, length, TotalNumberOfMapZones);
|
||||||
WriteSaveBuf(buffer, NumberOfAudioZones);
|
WriteSaveBuf(buffer, length, NumberOfAudioZones);
|
||||||
|
|
||||||
VALIDATESAVEBUF(*size)
|
VALIDATESAVEBUF(*size)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CTheZones::SaveOneZone(CZone *zone, uint8 **buffer, uint32 *length, eZoneType zoneType)
|
||||||
|
{
|
||||||
|
WriteSaveBuf(*buffer, *length, *(uint32*)&zone->name[0]);
|
||||||
|
WriteSaveBuf(*buffer, *length, *(uint32*)&zone->name[4]);
|
||||||
|
|
||||||
|
WriteSaveBuf(*buffer, *length, zone->minx);
|
||||||
|
WriteSaveBuf(*buffer, *length, zone->miny);
|
||||||
|
WriteSaveBuf(*buffer, *length, zone->minz);
|
||||||
|
WriteSaveBuf(*buffer, *length, zone->maxx);
|
||||||
|
WriteSaveBuf(*buffer, *length, zone->maxy);
|
||||||
|
WriteSaveBuf(*buffer, *length, zone->maxz);
|
||||||
|
|
||||||
|
WriteSaveBuf(*buffer, *length, zone->type);
|
||||||
|
WriteSaveBuf(*buffer, *length, zone->level);
|
||||||
|
WriteSaveBuf(*buffer, *length, zone->zoneinfoDay);
|
||||||
|
WriteSaveBuf(*buffer, *length, zone->zoneinfoNight);
|
||||||
|
|
||||||
|
int32 zoneId;
|
||||||
|
zoneId = GetIndexForZonePointer(zone->child);
|
||||||
|
WriteSaveBuf(*buffer, *length, zoneId);
|
||||||
|
zoneId = GetIndexForZonePointer(zone->parent);
|
||||||
|
WriteSaveBuf(*buffer, *length, zoneId);
|
||||||
|
zoneId = GetIndexForZonePointer(zone->next);
|
||||||
|
WriteSaveBuf(*buffer, *length, zoneId);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CTheZones::LoadAllZones(uint8 *buffer, uint32 size)
|
CTheZones::LoadAllZones(uint8 *buffer, uint32 size)
|
||||||
{
|
{
|
||||||
INITSAVEBUF
|
INITSAVEBUF
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
CheckSaveHeader(buffer, 'Z', 'N', 'S', '\0', size - SAVE_HEADER_SIZE);
|
uint32 length = 0;
|
||||||
|
CheckSaveHeaderWithLength(buffer, length, 'Z', 'N', 'S', '\0', size - SAVE_HEADER_SIZE);
|
||||||
|
|
||||||
m_CurrLevel = ReadSaveBuf<eLevelName>(buffer);
|
m_CurrLevel = ReadSaveBuf<eLevelName>(buffer, length);
|
||||||
FindIndex = ReadSaveBuf<int16>(buffer);
|
FindIndex = ReadSaveBuf<int16>(buffer, length);
|
||||||
ReadSaveBuf<int16>(buffer);
|
ReadSaveBuf<int16>(buffer, length);
|
||||||
|
|
||||||
// TODO(MIAMI) ? implement LoadOneZone
|
for(i = 0; i < ARRAY_SIZE(NavigationZoneArray); i++)
|
||||||
for(i = 0; i < ARRAY_SIZE(NavigationZoneArray); i++){
|
LoadOneZone(&NavigationZoneArray[i], &buffer, &length, ZONE_NAVIG);
|
||||||
NavigationZoneArray[i] = ReadSaveBuf<CZone>(buffer);
|
|
||||||
|
|
||||||
NavigationZoneArray[i].child = GetPointerForZoneIndex((uintptr)NavigationZoneArray[i].child);
|
for (i = 0; i < ARRAY_SIZE(InfoZoneArray); i++)
|
||||||
NavigationZoneArray[i].parent = GetPointerForZoneIndex((uintptr)NavigationZoneArray[i].parent);
|
LoadOneZone(&InfoZoneArray[i], &buffer, &length, ZONE_INFO);
|
||||||
NavigationZoneArray[i].next = GetPointerForZoneIndex((uintptr)NavigationZoneArray[i].next);
|
|
||||||
}
|
|
||||||
|
|
||||||
for(i = 0; i < ARRAY_SIZE(InfoZoneArray); i++){
|
|
||||||
InfoZoneArray[i] = ReadSaveBuf<CZone>(buffer);
|
|
||||||
|
|
||||||
/*
|
|
||||||
The call of GetPointerForZoneIndex is wrong, as it is
|
|
||||||
meant for a different array, but the game doesn't brake
|
|
||||||
if save data stored is -1.
|
|
||||||
*/
|
|
||||||
InfoZoneArray[i].child = GetPointerForZoneIndex((uintptr)InfoZoneArray[i].child);
|
|
||||||
InfoZoneArray[i].parent = GetPointerForZoneIndex((uintptr)InfoZoneArray[i].parent);
|
|
||||||
InfoZoneArray[i].next = GetPointerForZoneIndex((uintptr)InfoZoneArray[i].next);
|
|
||||||
assert(InfoZoneArray[i].child == nil);
|
|
||||||
assert(InfoZoneArray[i].parent == nil);
|
|
||||||
assert(InfoZoneArray[i].next == nil);
|
|
||||||
}
|
|
||||||
|
|
||||||
for(i = 0; i < ARRAY_SIZE(ZoneInfoArray); i++)
|
for(i = 0; i < ARRAY_SIZE(ZoneInfoArray); i++)
|
||||||
ZoneInfoArray[i] = ReadSaveBuf<CZoneInfo>(buffer);
|
ZoneInfoArray[i] = ReadSaveBuf<CZoneInfo>(buffer, length);
|
||||||
|
|
||||||
TotalNumberOfNavigationZones = ReadSaveBuf<int16>(buffer);
|
TotalNumberOfNavigationZones = ReadSaveBuf<int16>(buffer, length);
|
||||||
TotalNumberOfInfoZones = ReadSaveBuf<int16>(buffer);
|
TotalNumberOfInfoZones = ReadSaveBuf<int16>(buffer, length);
|
||||||
TotalNumberOfZoneInfos = ReadSaveBuf<int16>(buffer);
|
TotalNumberOfZoneInfos = ReadSaveBuf<int16>(buffer, length);
|
||||||
|
ReadSaveBuf<int16>(buffer, length);
|
||||||
|
|
||||||
for(i = 0; i < ARRAY_SIZE(MapZoneArray); i++){
|
for(i = 0; i < ARRAY_SIZE(MapZoneArray); i++)
|
||||||
MapZoneArray[i] = ReadSaveBuf<CZone>(buffer);
|
LoadOneZone(&MapZoneArray[i], &buffer, &length, ZONE_MAPZONE);
|
||||||
|
|
||||||
// see above
|
|
||||||
MapZoneArray[i].child = GetPointerForZoneIndex((uintptr)MapZoneArray[i].child);
|
|
||||||
MapZoneArray[i].parent = GetPointerForZoneIndex((uintptr)MapZoneArray[i].parent);
|
|
||||||
MapZoneArray[i].next = GetPointerForZoneIndex((uintptr)MapZoneArray[i].next);
|
|
||||||
assert(MapZoneArray[i].child == nil);
|
|
||||||
assert(MapZoneArray[i].parent == nil);
|
|
||||||
assert(MapZoneArray[i].next == nil);
|
|
||||||
}
|
|
||||||
|
|
||||||
for(i = 0; i < ARRAY_SIZE(AudioZoneArray); i++)
|
for(i = 0; i < ARRAY_SIZE(AudioZoneArray); i++)
|
||||||
AudioZoneArray[i] = ReadSaveBuf<int16>(buffer);
|
AudioZoneArray[i] = ReadSaveBuf<int16>(buffer, length);
|
||||||
|
|
||||||
TotalNumberOfMapZones = ReadSaveBuf<uint16>(buffer);
|
TotalNumberOfMapZones = ReadSaveBuf<uint16>(buffer, length);
|
||||||
NumberOfAudioZones = ReadSaveBuf<uint16>(buffer);
|
NumberOfAudioZones = ReadSaveBuf<uint16>(buffer, length);
|
||||||
|
|
||||||
VALIDATESAVEBUF(size)
|
VALIDATESAVEBUF(size)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CTheZones::LoadOneZone(CZone *zone, uint8 **buffer, uint32 *length, eZoneType zoneType)
|
||||||
|
{
|
||||||
|
*(uint32*)&zone->name[0] = ReadSaveBuf<uint32>(*buffer, *length);
|
||||||
|
*(uint32*)&zone->name[4] = ReadSaveBuf<uint32>(*buffer, *length);
|
||||||
|
|
||||||
|
zone->minx = ReadSaveBuf<float>(*buffer, *length);
|
||||||
|
zone->miny = ReadSaveBuf<float>(*buffer, *length);
|
||||||
|
zone->minz = ReadSaveBuf<float>(*buffer, *length);
|
||||||
|
zone->maxx = ReadSaveBuf<float>(*buffer, *length);
|
||||||
|
zone->maxy = ReadSaveBuf<float>(*buffer, *length);
|
||||||
|
zone->maxz = ReadSaveBuf<float>(*buffer, *length);
|
||||||
|
|
||||||
|
zone->type = ReadSaveBuf<eZoneType>(*buffer, *length);
|
||||||
|
zone->level = ReadSaveBuf<eLevelName>(*buffer, *length);
|
||||||
|
zone->zoneinfoDay = ReadSaveBuf<int16>(*buffer, *length);
|
||||||
|
zone->zoneinfoNight = ReadSaveBuf<int16>(*buffer, *length);
|
||||||
|
|
||||||
|
int32 zoneId;
|
||||||
|
zoneId = ReadSaveBuf<int32>(*buffer, *length);
|
||||||
|
zone->child = GetPointerForZoneIndex(zoneId);
|
||||||
|
zoneId = ReadSaveBuf<int32>(*buffer, *length);
|
||||||
|
zone->parent = GetPointerForZoneIndex(zoneId);
|
||||||
|
zoneId = ReadSaveBuf<int32>(*buffer, *length);
|
||||||
|
zone->next = GetPointerForZoneIndex(zoneId);
|
||||||
|
}
|
@ -108,5 +108,7 @@ public:
|
|||||||
static void AddZoneToAudioZoneArray(CZone *zone);
|
static void AddZoneToAudioZoneArray(CZone *zone);
|
||||||
static void InitialiseAudioZoneArray(void);
|
static void InitialiseAudioZoneArray(void);
|
||||||
static void SaveAllZones(uint8 *buffer, uint32 *length);
|
static void SaveAllZones(uint8 *buffer, uint32 *length);
|
||||||
|
static void SaveOneZone(CZone *zone, uint8 **buffer, uint32 *length, eZoneType zoneType);
|
||||||
static void LoadAllZones(uint8 *buffer, uint32 length);
|
static void LoadAllZones(uint8 *buffer, uint32 length);
|
||||||
|
static void LoadOneZone(CZone *zone, uint8 **buffer, uint32 *length, eZoneType zoneType);
|
||||||
};
|
};
|
||||||
|
@ -412,6 +412,15 @@ inline void SkipSaveBuf(uint8 *&buf, int32 skip)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void SkipSaveBuf(uint8*& buf, uint32 &length, int32 skip)
|
||||||
|
{
|
||||||
|
buf += skip;
|
||||||
|
length += skip;
|
||||||
|
#ifdef VALIDATE_SAVE_SIZE
|
||||||
|
_saveBufCount += skip;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline const T ReadSaveBuf(uint8 *&buf)
|
inline const T ReadSaveBuf(uint8 *&buf)
|
||||||
{
|
{
|
||||||
@ -420,6 +429,14 @@ inline const T ReadSaveBuf(uint8 *&buf)
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
inline const T ReadSaveBuf(uint8 *&buf, uint32 &length)
|
||||||
|
{
|
||||||
|
T &value = *(T*)buf;
|
||||||
|
SkipSaveBuf(buf, length, sizeof(T));
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline T *WriteSaveBuf(uint8 *&buf, const T &value)
|
inline T *WriteSaveBuf(uint8 *&buf, const T &value)
|
||||||
{
|
{
|
||||||
@ -429,6 +446,15 @@ inline T *WriteSaveBuf(uint8 *&buf, const T &value)
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
inline T *WriteSaveBuf(uint8 *&buf, uint32 &length, const T &value)
|
||||||
|
{
|
||||||
|
T *p = (T*)buf;
|
||||||
|
*p = value;
|
||||||
|
SkipSaveBuf(buf, length, sizeof(T));
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#define SAVE_HEADER_SIZE (4*sizeof(char)+sizeof(uint32))
|
#define SAVE_HEADER_SIZE (4*sizeof(char)+sizeof(uint32))
|
||||||
|
|
||||||
@ -439,6 +465,13 @@ inline T *WriteSaveBuf(uint8 *&buf, const T &value)
|
|||||||
WriteSaveBuf(buf, d);\
|
WriteSaveBuf(buf, d);\
|
||||||
WriteSaveBuf<uint32>(buf, size);
|
WriteSaveBuf<uint32>(buf, size);
|
||||||
|
|
||||||
|
#define WriteSaveHeaderWithLength(buf,len,a,b,c,d,size) \
|
||||||
|
WriteSaveBuf(buf, len, a);\
|
||||||
|
WriteSaveBuf(buf, len, b);\
|
||||||
|
WriteSaveBuf(buf, len, c);\
|
||||||
|
WriteSaveBuf(buf, len, d);\
|
||||||
|
WriteSaveBuf<uint32>(buf, len, size);
|
||||||
|
|
||||||
#define CheckSaveHeader(buf,a,b,c,d,size)\
|
#define CheckSaveHeader(buf,a,b,c,d,size)\
|
||||||
assert(ReadSaveBuf<char>(buf) == a);\
|
assert(ReadSaveBuf<char>(buf) == a);\
|
||||||
assert(ReadSaveBuf<char>(buf) == b);\
|
assert(ReadSaveBuf<char>(buf) == b);\
|
||||||
@ -446,5 +479,12 @@ inline T *WriteSaveBuf(uint8 *&buf, const T &value)
|
|||||||
assert(ReadSaveBuf<char>(buf) == d);\
|
assert(ReadSaveBuf<char>(buf) == d);\
|
||||||
assert(ReadSaveBuf<uint32>(buf) == size);
|
assert(ReadSaveBuf<uint32>(buf) == size);
|
||||||
|
|
||||||
|
#define CheckSaveHeaderWithLength(buf,len,a,b,c,d,size)\
|
||||||
|
assert(ReadSaveBuf<char>(buf,len) == a);\
|
||||||
|
assert(ReadSaveBuf<char>(buf,len) == b);\
|
||||||
|
assert(ReadSaveBuf<char>(buf,len) == c);\
|
||||||
|
assert(ReadSaveBuf<char>(buf,len) == d);\
|
||||||
|
assert(ReadSaveBuf<uint32>(buf,len) == size);
|
||||||
|
|
||||||
|
|
||||||
void cprintf(char*, ...);
|
void cprintf(char*, ...);
|
@ -87,7 +87,8 @@ enum Config {
|
|||||||
NUMMBLURSTREAKS = 4,
|
NUMMBLURSTREAKS = 4,
|
||||||
NUMSKIDMARKS = 32,
|
NUMSKIDMARKS = 32,
|
||||||
|
|
||||||
NUMONSCREENTIMERENTRIES = 1,
|
NUMONSCREENCLOCKS = 1,
|
||||||
|
NUMONSCREENCOUNTERS = 3,
|
||||||
NUMRADARBLIPS = 75,
|
NUMRADARBLIPS = 75,
|
||||||
NUMGENERALPICKUPS = 320,
|
NUMGENERALPICKUPS = 320,
|
||||||
NUMSCRIPTEDPICKUPS = 16,
|
NUMSCRIPTEDPICKUPS = 16,
|
||||||
@ -137,6 +138,7 @@ enum Config {
|
|||||||
|
|
||||||
NUM_CRANES = 8,
|
NUM_CRANES = 8,
|
||||||
NUM_ESCALATORS = 22,
|
NUM_ESCALATORS = 22,
|
||||||
|
NUM_WATER_CREATURES = 8,
|
||||||
|
|
||||||
NUM_EXPLOSIONS = 48,
|
NUM_EXPLOSIONS = 48,
|
||||||
|
|
||||||
@ -260,7 +262,6 @@ enum Config {
|
|||||||
//#define BIND_VEHICLE_FIREWEAPON // Adds ability to rebind fire key for 'in vehicle' controls
|
//#define BIND_VEHICLE_FIREWEAPON // Adds ability to rebind fire key for 'in vehicle' controls
|
||||||
|
|
||||||
// Hud, frontend and radar
|
// Hud, frontend and radar
|
||||||
#define HUD_ENHANCEMENTS // Adjusts some aspects to make the HUD look/behave a little bit better.
|
|
||||||
//#define BETA_SLIDING_TEXT
|
//#define BETA_SLIDING_TEXT
|
||||||
#define TRIANGULAR_BLIPS // height indicating triangular radar blips, as in VC
|
#define TRIANGULAR_BLIPS // height indicating triangular radar blips, as in VC
|
||||||
#define PC_MENU
|
#define PC_MENU
|
||||||
|
@ -1208,3 +1208,36 @@ bool CEntity::IsEntityOccluded(void) {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
0x487A10 - SetAtomicAlphaCB
|
||||||
|
0x4879E0 - SetClumpAlphaCB
|
||||||
|
*/
|
||||||
|
|
||||||
|
RpMaterial* SetAtomicAlphaCB(RpMaterial *material, void *data) {
|
||||||
|
((RwRGBA*)RpMaterialGetColor(material))->alpha = (uint8)(uintptr)data;
|
||||||
|
return material;
|
||||||
|
}
|
||||||
|
|
||||||
|
RpAtomic* SetClumpAlphaCB(RpAtomic *atomic, void *data) {
|
||||||
|
RpGeometry *geometry = RpAtomicGetGeometry(atomic);
|
||||||
|
RpGeometrySetFlags(geometry, RpGeometryGetFlags(geometry) | rpGEOMETRYMODULATEMATERIALCOLOR);
|
||||||
|
RpGeometryForAllMaterials(geometry, SetAtomicAlphaCB, (void*)data);
|
||||||
|
return atomic;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEntity::SetRwObjectAlpha(int32 alpha) {
|
||||||
|
if (m_rwObject != nil) {
|
||||||
|
switch (RwObjectGetType(m_rwObject)) {
|
||||||
|
case rpATOMIC: {
|
||||||
|
RpGeometry *geometry = RpAtomicGetGeometry((RpAtomic*)m_rwObject);
|
||||||
|
RpGeometrySetFlags(geometry, RpGeometryGetFlags(geometry) | rpGEOMETRYMODULATEMATERIALCOLOR);
|
||||||
|
RpGeometryForAllMaterials(geometry, SetAtomicAlphaCB, (void*)alpha);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case rpCLUMP:
|
||||||
|
RpClumpForAllAtomics((RpClump*)m_rwObject, SetClumpAlphaCB, (void*)alpha);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -179,6 +179,7 @@ public:
|
|||||||
void ModifyMatrixForTreeInWind(void);
|
void ModifyMatrixForTreeInWind(void);
|
||||||
void ModifyMatrixForBannerInWind(void);
|
void ModifyMatrixForBannerInWind(void);
|
||||||
void ProcessLightsForEntity(void);
|
void ProcessLightsForEntity(void);
|
||||||
|
void SetRwObjectAlpha(int32 alpha);
|
||||||
|
|
||||||
static void AddSteamsFromGround(CPtrList& list);
|
static void AddSteamsFromGround(CPtrList& list);
|
||||||
};
|
};
|
||||||
|
@ -104,7 +104,6 @@ CEmergencyPed::FiremanAI(void)
|
|||||||
m_pAttendedFire = nearestFire;
|
m_pAttendedFire = nearestFire;
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
bIsRunning = true;
|
bIsRunning = true;
|
||||||
++nearestFire->m_nFiremenPuttingOut;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -116,10 +115,6 @@ CEmergencyPed::FiremanAI(void)
|
|||||||
SetMoveState(PEDMOVE_RUN);
|
SetMoveState(PEDMOVE_RUN);
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
bIsRunning = true;
|
bIsRunning = true;
|
||||||
if (m_pAttendedFire) {
|
|
||||||
--m_pAttendedFire->m_nFiremenPuttingOut;
|
|
||||||
}
|
|
||||||
++nearestFire->m_nFiremenPuttingOut;
|
|
||||||
m_pAttendedFire = nearestFire;
|
m_pAttendedFire = nearestFire;
|
||||||
} else if (!nearestFire) {
|
} else if (!nearestFire) {
|
||||||
#else
|
#else
|
||||||
@ -153,10 +148,7 @@ CEmergencyPed::FiremanAI(void)
|
|||||||
case EMERGENCY_PED_STOP:
|
case EMERGENCY_PED_STOP:
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
bIsRunning = false;
|
bIsRunning = false;
|
||||||
if (m_pAttendedFire)
|
|
||||||
#endif
|
#endif
|
||||||
--m_pAttendedFire->m_nFiremenPuttingOut;
|
|
||||||
|
|
||||||
m_nPedState = PED_NONE;
|
m_nPedState = PED_NONE;
|
||||||
SetWanderPath(CGeneral::GetRandomNumber() & 7);
|
SetWanderPath(CGeneral::GetRandomNumber() & 7);
|
||||||
m_pAttendedFire = nil;
|
m_pAttendedFire = nil;
|
||||||
|
@ -24,12 +24,17 @@ float
|
|||||||
CDraw::CalculateAspectRatio(void)
|
CDraw::CalculateAspectRatio(void)
|
||||||
{
|
{
|
||||||
if (FrontEndMenuManager.m_PrefsUseWideScreen) {
|
if (FrontEndMenuManager.m_PrefsUseWideScreen) {
|
||||||
|
#ifdef ASPECT_RATIO_SCALE
|
||||||
|
if (TheCamera.m_WideScreenOn)
|
||||||
|
CDraw::ms_fAspectRatio = FrontEndMenuManager.m_PrefsUseWideScreen == AR_AUTO ?
|
||||||
|
(5.f / 3.f) * (SCREEN_WIDTH / SCREEN_HEIGHT) / (16.f / 9.f) :
|
||||||
|
5.f / 3.f; // It's used on theatrical showings according to Wiki
|
||||||
|
else
|
||||||
|
CDraw::ms_fAspectRatio = FrontEndMenuManager.m_PrefsUseWideScreen == AR_AUTO ? SCREEN_WIDTH / SCREEN_HEIGHT : 16.f / 9.f;
|
||||||
|
#else
|
||||||
if (TheCamera.m_WideScreenOn)
|
if (TheCamera.m_WideScreenOn)
|
||||||
CDraw::ms_fAspectRatio = 5.f / 3.f; // It's used on theatrical showings according to Wiki
|
CDraw::ms_fAspectRatio = 5.f / 3.f; // It's used on theatrical showings according to Wiki
|
||||||
else
|
else
|
||||||
#ifdef ASPECT_RATIO_SCALE
|
|
||||||
CDraw::ms_fAspectRatio = FrontEndMenuManager.m_PrefsUseWideScreen == AR_AUTO ? SCREEN_WIDTH / SCREEN_HEIGHT : 16.f / 9.f;
|
|
||||||
#else
|
|
||||||
CDraw::ms_fAspectRatio = 16.f / 9.f;
|
CDraw::ms_fAspectRatio = 16.f / 9.f;
|
||||||
#endif
|
#endif
|
||||||
} else if (TheCamera.m_WideScreenOn) {
|
} else if (TheCamera.m_WideScreenOn) {
|
||||||
|
@ -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];
|
||||||
@ -1102,6 +1142,7 @@ CFont::ParseToken(wchar *s)
|
|||||||
switch(*s){
|
switch(*s){
|
||||||
case 'B':
|
case 'B':
|
||||||
Details.bBold = !Details.bBold;
|
Details.bBold = !Details.bBold;
|
||||||
|
break;
|
||||||
case 'N':
|
case 'N':
|
||||||
case 'n':
|
case 'n':
|
||||||
NewLine = 1;
|
NewLine = 1;
|
||||||
@ -1109,7 +1150,7 @@ CFont::ParseToken(wchar *s)
|
|||||||
case 'b': SetColor(CRGBA(27, 89, 130, 255)); Details.anonymous_23 = true; break;
|
case 'b': SetColor(CRGBA(27, 89, 130, 255)); Details.anonymous_23 = true; break;
|
||||||
case 'f':
|
case 'f':
|
||||||
Details.bFlash = !Details.bFlash;
|
Details.bFlash = !Details.bFlash;
|
||||||
if (Details.bFlash)
|
if (!Details.bFlash)
|
||||||
Details.color.a = 255;
|
Details.color.a = 255;
|
||||||
break;
|
break;
|
||||||
case 'g': SetColor(CRGBA(255, 150, 225, 255)); Details.anonymous_23 = true; break;
|
case 'g': SetColor(CRGBA(255, 150, 225, 255)); Details.anonymous_23 = true; break;
|
||||||
|
@ -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;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "Sprite2d.h"
|
#include "Sprite2d.h"
|
||||||
|
|
||||||
|
#define HELP_MSG_LENGTH 256
|
||||||
|
|
||||||
|
#define HUD_TEXT_SCALE_X 0.7f
|
||||||
|
#define HUD_TEXT_SCALE_Y 1.25f
|
||||||
|
|
||||||
enum eItems
|
enum eItems
|
||||||
{
|
{
|
||||||
ITEM_NONE = -1,
|
ITEM_NONE = -1,
|
||||||
@ -31,41 +36,29 @@ enum eFadeOperation
|
|||||||
enum eSprites
|
enum eSprites
|
||||||
{
|
{
|
||||||
HUD_FIST,
|
HUD_FIST,
|
||||||
HUD_BAT,
|
HUD_SITEROCKET = 41,
|
||||||
HUD_PISTOL,
|
HUD_RADARDISC = 50,
|
||||||
HUD_UZI,
|
HUD_SITESNIPER = 63,
|
||||||
HUD_SHOTGUN,
|
|
||||||
HUD_AK47,
|
|
||||||
HUD_M16,
|
|
||||||
HUD_SNIPER,
|
|
||||||
HUD_ROCKET,
|
|
||||||
HUD_FLAME,
|
|
||||||
HUD_MOLOTOV,
|
|
||||||
HUD_GRENADE,
|
|
||||||
HUD_DETONATOR,
|
|
||||||
HUD_RADARDISC = 15,
|
|
||||||
HUD_PAGER = 16,
|
|
||||||
HUD_SITESNIPER = 20,
|
|
||||||
HUD_SITEM16,
|
HUD_SITEM16,
|
||||||
HUD_SITEROCKET,
|
HUD_SITELASER,
|
||||||
NUM_HUD_SPRITES,
|
HUD_LASERDOT,
|
||||||
|
HUD_VIEWFINDER,
|
||||||
|
HUD_BLEEDER,
|
||||||
|
NUM_HUD_SPRITES = 69,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define HUD_TEXT_SCALE_X 0.7f
|
|
||||||
#define HUD_TEXT_SCALE_Y 1.25f
|
|
||||||
|
|
||||||
class CHud
|
class CHud
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static CSprite2d Sprites[NUM_HUD_SPRITES];
|
static CSprite2d Sprites[NUM_HUD_SPRITES];
|
||||||
static wchar m_HelpMessage[256];
|
static wchar m_HelpMessage[HELP_MSG_LENGTH];
|
||||||
static wchar m_LastHelpMessage[256];
|
static wchar m_LastHelpMessage[HELP_MSG_LENGTH];
|
||||||
static uint32 m_HelpMessageState;
|
static uint32 m_HelpMessageState;
|
||||||
static uint32 m_HelpMessageTimer;
|
static uint32 m_HelpMessageTimer;
|
||||||
static int32 m_HelpMessageFadeTimer;
|
static int32 m_HelpMessageFadeTimer;
|
||||||
static wchar m_HelpMessageToPrint[256];
|
static wchar m_HelpMessageToPrint[HELP_MSG_LENGTH];
|
||||||
static float &m_HelpMessageDisplayTime;
|
static float m_HelpMessageDisplayTime;
|
||||||
static float m_fHelpMessageTime;
|
static bool m_HelpMessageDisplayForever;
|
||||||
static bool m_HelpMessageQuick;
|
static bool m_HelpMessageQuick;
|
||||||
static uint32 m_ZoneState;
|
static uint32 m_ZoneState;
|
||||||
static int32 m_ZoneFadeTimer;
|
static int32 m_ZoneFadeTimer;
|
||||||
@ -86,16 +79,16 @@ public:
|
|||||||
static wchar m_BigMessage[6][128];
|
static wchar m_BigMessage[6][128];
|
||||||
static int16 m_ItemToFlash;
|
static int16 m_ItemToFlash;
|
||||||
static bool m_HideRadar;
|
static bool m_HideRadar;
|
||||||
static int32 m_DrawClock;
|
static int32 m_ClockState;
|
||||||
|
|
||||||
// These aren't really in CHud
|
// These aren't really in CHud
|
||||||
static float BigMessageInUse[6];
|
static float BigMessageInUse[6];
|
||||||
static float BigMessageAlpha[6];
|
static float BigMessageAlpha[6];
|
||||||
static float BigMessageX[6];
|
static float BigMessageX[6];
|
||||||
static float OddJob2OffTimer;
|
static float OddJob2OffTimer;
|
||||||
static bool CounterOnLastFrame;
|
static bool CounterOnLastFrame[NUMONSCREENCOUNTERS];
|
||||||
static float OddJob2XOffset;
|
static float OddJob2XOffset;
|
||||||
static uint16 CounterFlashTimer;
|
static uint16 CounterFlashTimer[NUMONSCREENCOUNTERS];
|
||||||
static uint16 OddJob2Timer;
|
static uint16 OddJob2Timer;
|
||||||
static bool TimerOnLastFrame;
|
static bool TimerOnLastFrame;
|
||||||
static int16 OddJob2On;
|
static int16 OddJob2On;
|
||||||
@ -121,6 +114,8 @@ public:
|
|||||||
|
|
||||||
static uint32 m_LastDisplayScore;
|
static uint32 m_LastDisplayScore;
|
||||||
static uint32 m_LastWanted;
|
static uint32 m_LastWanted;
|
||||||
|
static uint32 m_LastWeapon;
|
||||||
|
static uint32 m_LastTimeEnergyLost;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void Draw();
|
static void Draw();
|
||||||
@ -131,8 +126,8 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
static void Initialise();
|
static void Initialise();
|
||||||
static void ReInitialise();
|
static void ReInitialise();
|
||||||
static void SetBigMessage(wchar *message, int16 style);
|
static void SetBigMessage(wchar *message, uint16 style);
|
||||||
static void SetHelpMessage(wchar *message, bool quick);
|
static void SetHelpMessage(wchar *message, bool quick, bool displayForever = false);
|
||||||
static bool IsHelpMessageBeingDisplayed(void);
|
static bool IsHelpMessageBeingDisplayed(void);
|
||||||
static void SetMessage(wchar *message);
|
static void SetMessage(wchar *message);
|
||||||
static void SetPagerMessage(wchar *message);
|
static void SetPagerMessage(wchar *message);
|
||||||
|
@ -77,9 +77,13 @@ void CWaterCannon::Update_OncePerFrame(int16 index)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 extinguishingPoint = CGeneral::GetRandomNumber() & (NUM_SEGMENTPOINTS - 1);
|
for ( int32 i = 0; i < NUM_SEGMENTPOINTS; i++ )
|
||||||
if ( m_abUsed[extinguishingPoint] )
|
{
|
||||||
gFireManager.ExtinguishPoint(m_avecPos[extinguishingPoint], 3.0f);
|
if ( m_abUsed[i] && gFireManager.ExtinguishPointWithWater(m_avecPos[i], 4.0f) )
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( ((index + CTimer::GetFrameCounter()) & 3) == 0 )
|
if ( ((index + CTimer::GetFrameCounter()) & 3) == 0 )
|
||||||
PushPeds();
|
PushPeds();
|
||||||
|
267
src/render/WaterCreatures.cpp
Normal file
267
src/render/WaterCreatures.cpp
Normal file
@ -0,0 +1,267 @@
|
|||||||
|
#include "WaterCreatures.h"
|
||||||
|
#include "ModelIndices.h"
|
||||||
|
#include "World.h"
|
||||||
|
#include "WaterLevel.h"
|
||||||
|
#include "Camera.h"
|
||||||
|
#include "PlayerPed.h"
|
||||||
|
#include "config.h"
|
||||||
|
#include "General.h"
|
||||||
|
|
||||||
|
int CWaterCreatures::nNumActiveSeaLifeForms;
|
||||||
|
CWaterCreature CWaterCreatures::aWaterCreatures[NUM_WATER_CREATURES];
|
||||||
|
|
||||||
|
struct WaterCreatureProperties aProperties[65] = {
|
||||||
|
{ &MI_FISH1SINGLE, 0.04f, 3.0f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH2S, 0.04f, 1.5f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH2SINGLE, 0.04f, 3.0f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH2S, 0.04f, 1.5f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH3SINGLE, 0.04f, 3.0f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH3S, 0.04f, 1.5f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH1SINGLE, 0.04f, 3.0f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH2S, 0.04f, 1.5f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH2SINGLE, 0.04f, 3.0f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH2S, 0.04f, 1.5f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH3SINGLE, 0.04f, 3.0f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH3S, 0.04f, 1.5f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_JELLYFISH, 0.01f, 2.2f, 0.0005f, 3.5f },
|
||||||
|
{ &MI_JELLYFISH01, 0.01f, 2.2f, 0.0005f, 3.5f },
|
||||||
|
{ &MI_FISH1SINGLE, 0.04f, 3.0f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH2S, 0.04f, 1.5f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH2SINGLE, 0.04f, 3.0f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH2S, 0.04f, 1.5f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH3SINGLE, 0.04f, 3.0f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH3S, 0.04f, 1.5f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH1SINGLE, 0.04f, 3.0f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH2S, 0.04f, 1.5f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH2SINGLE, 0.04f, 3.0f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH2S, 0.04f, 1.5f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH3SINGLE, 0.04f, 3.0f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH3S, 0.04f, 1.5f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_TURTLE, 0.01f, 2.0f, 0.0005f, 4.0f },
|
||||||
|
{ &MI_FISH1SINGLE, 0.04f, 3.0f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH2S, 0.04f, 1.5f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH2SINGLE, 0.04f, 3.0f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH2S, 0.04f, 1.5f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH3SINGLE, 0.04f, 3.0f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH3S, 0.04f, 1.5f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH1SINGLE, 0.04f, 3.0f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH2S, 0.04f, 1.5f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH2SINGLE, 0.04f, 3.0f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH2S, 0.04f, 1.5f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH3SINGLE, 0.04f, 3.0f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH3S, 0.04f, 1.5f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_DOLPHIN, 0.03f, 1.5f, 0.0005f, 4.0f },
|
||||||
|
{ &MI_FISH1SINGLE, 0.04f, 3.0f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH2S, 0.04f, 1.5f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH2SINGLE, 0.04f, 3.0f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH2S, 0.04f, 1.5f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH3SINGLE, 0.04f, 3.0f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH3S, 0.04f, 1.5f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH1SINGLE, 0.04f, 3.0f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH2S, 0.04f, 1.5f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH2SINGLE, 0.04f, 3.0f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH2S, 0.04f, 1.5f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH3SINGLE, 0.04f, 3.0f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH3S, 0.04f, 1.5f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_SHARK, 0.03f, 0.4f, 0.0005f, 4.0f },
|
||||||
|
{ &MI_FISH1SINGLE, 0.04f, 3.0f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH2S, 0.04f, 1.5f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH2SINGLE, 0.04f, 3.0f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH2S, 0.04f, 1.5f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH3SINGLE, 0.04f, 3.0f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH3S, 0.04f, 1.5f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH1SINGLE, 0.04f, 3.0f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH2S, 0.04f, 1.5f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH2SINGLE, 0.04f, 3.0f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH2S, 0.04f, 1.5f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH3SINGLE, 0.04f, 3.0f, 0.0008f, 3.0f },
|
||||||
|
{ &MI_FISH3S, 0.04f, 1.5f, 0.0008f, 3.0f },
|
||||||
|
};
|
||||||
|
|
||||||
|
CWaterCreature::CWaterCreature() {
|
||||||
|
Free();
|
||||||
|
}
|
||||||
|
|
||||||
|
CWaterCreature::~CWaterCreature() {
|
||||||
|
//looks like unused
|
||||||
|
}
|
||||||
|
|
||||||
|
void CWaterCreature::Initialise(CObject *pObj, float fRightMult, float fZTurnSpeed, float fWaterDepth, uint32 alpha, eFishSlotState state) {
|
||||||
|
this->m_pObj = pObj;
|
||||||
|
this->m_fRightMult = fRightMult;
|
||||||
|
this->m_fZTurnSpeed = fZTurnSpeed;
|
||||||
|
this->m_fWaterDepth = fWaterDepth;
|
||||||
|
this->m_alpha = alpha;
|
||||||
|
this->m_state = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CWaterCreature::Allocate(CObject *pObj, float fRightMult, float fZTurnSpeed, float fWaterDepth, uint32 alpha, eFishSlotState state) {
|
||||||
|
CWaterCreature::Initialise(pObj, fRightMult, fZTurnSpeed, fWaterDepth, alpha, state);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CWaterCreature::Free() {
|
||||||
|
CWaterCreature::Initialise(nil, 0.0f, 0.0f, 0.0f, 0, WATER_CREATURE_DISABLED);
|
||||||
|
}
|
||||||
|
|
||||||
|
CWaterCreature *CWaterCreatures::GetFishStructSlot() {
|
||||||
|
for (int i = 0; i < NUM_WATER_CREATURES; i++)
|
||||||
|
if (aWaterCreatures[i].m_state == WATER_CREATURE_DISABLED)
|
||||||
|
return &aWaterCreatures[i];
|
||||||
|
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
CObject *CWaterCreatures::CreateSeaLifeForm(CVector const& pos, int16 modelID, int32 zRotAngle) {
|
||||||
|
if (CObject::nNoTempObjects >= 40)
|
||||||
|
return nil;
|
||||||
|
|
||||||
|
CObject *pObj = new CObject(modelID, true);
|
||||||
|
|
||||||
|
if (!pObj) return nil;
|
||||||
|
|
||||||
|
pObj->GetMatrix().GetPosition() = pos;
|
||||||
|
pObj->GetMatrix().UpdateRW();
|
||||||
|
pObj->m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
|
||||||
|
pObj->m_vecTurnSpeed = CVector(0.0f, 0.0f, 0.0f);
|
||||||
|
pObj->GetMatrix().SetRotateZOnly(DEGTORAD(zRotAngle));
|
||||||
|
pObj->GetMatrix().UpdateRW();
|
||||||
|
pObj->ObjectCreatedBy = CONTROLLED_SUB_OBJECT;
|
||||||
|
pObj->bIsStatic = false;
|
||||||
|
|
||||||
|
if (pObj->ObjectCreatedBy == TEMP_OBJECT) {
|
||||||
|
CObject::nNoTempObjects++;
|
||||||
|
pObj->m_nEndOfLifeTime = CTimer::GetTimeInMilliseconds() + 60000;
|
||||||
|
}
|
||||||
|
|
||||||
|
pObj->bTouchingWater = true;
|
||||||
|
pObj->bUnderwater = true;
|
||||||
|
CWorld::Add(pObj);
|
||||||
|
|
||||||
|
return pObj;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CWaterCreatures::IsSpaceForMoreWaterCreatures() {
|
||||||
|
return nNumActiveSeaLifeForms < NUM_WATER_CREATURES;
|
||||||
|
}
|
||||||
|
|
||||||
|
float CWaterCreatures::CalculateFishHeading(CVector const& pos1, CVector const& pos2) {
|
||||||
|
CVector delta = pos1 - pos2;
|
||||||
|
delta.Normalise();
|
||||||
|
|
||||||
|
return Atan2(-delta.x, delta.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CWaterCreatures::CreateOne(CVector const& pos, int32 modelID) {
|
||||||
|
if (!IsSpaceForMoreWaterCreatures())
|
||||||
|
return;
|
||||||
|
|
||||||
|
CVector storedPos = pos;
|
||||||
|
float fDepth, fLevelNoWaves;
|
||||||
|
if (!TheCamera.IsSphereVisible(storedPos, 3.0f)
|
||||||
|
&& CWaterLevel::GetWaterDepth(storedPos, &fDepth, &fLevelNoWaves, nil) && fDepth > 4.5f) {
|
||||||
|
|
||||||
|
if (modelID == -1 || modelID < 0 || modelID > 64)
|
||||||
|
modelID = CGeneral::GetRandomNumberInRange(0, 64);
|
||||||
|
|
||||||
|
WaterCreatureProperties *creature = &aProperties[modelID];
|
||||||
|
storedPos.z = fLevelNoWaves - creature->fLevel;
|
||||||
|
float fRightMult = CGeneral::GetRandomNumberInRange(0.0f, creature->fRightMult) + 0.01f;
|
||||||
|
float angle = CWaterCreatures::CalculateFishHeading(FindPlayerPed()->GetPosition(), storedPos);
|
||||||
|
|
||||||
|
CObject *fish = CreateSeaLifeForm(storedPos, *(int16*)creature->modelID, angle);
|
||||||
|
if (!fish) return;
|
||||||
|
|
||||||
|
fish->SetRwObjectAlpha(255);
|
||||||
|
CWaterCreature *wc = GetFishStructSlot();
|
||||||
|
wc->Allocate(fish, fRightMult, 0.0f, creature->fWaterDepth, 255, WATER_CREATURE_ALLOCATED);
|
||||||
|
nNumActiveSeaLifeForms++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CWaterCreatures::FreeFishStructSlot(CWaterCreature *wc) {
|
||||||
|
wc->Free();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CWaterCreatures::UpdateAll() {
|
||||||
|
if (nNumActiveSeaLifeForms == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CVector playerPos = FindPlayerPed()->GetPosition();
|
||||||
|
for (int i = 0; i < NUM_WATER_CREATURES; i++) {
|
||||||
|
switch (aWaterCreatures[i].m_state) {
|
||||||
|
case WATER_CREATURE_ACTIVE:
|
||||||
|
aWaterCreatures[i].m_pObj->m_nEndOfLifeTime = CTimer::GetTimeInMilliseconds() + 40000;
|
||||||
|
if (!aWaterCreatures[i].m_pObj->GetIsOnScreen()) {
|
||||||
|
aWaterCreatures[i].m_pObj->SetRwObjectAlpha(0);
|
||||||
|
aWaterCreatures[i].m_state = WATER_CREATURE_TO_REMOVE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case WATER_CREATURE_ALLOCATED: {
|
||||||
|
if ((playerPos - aWaterCreatures[i].m_pObj->GetPosition()).Magnitude() < SQR(75.0f)) {
|
||||||
|
if (aWaterCreatures[i].m_alpha < 255)
|
||||||
|
aWaterCreatures[i].m_alpha = Min(aWaterCreatures[i].m_alpha + 4, 255);
|
||||||
|
aWaterCreatures[i].m_pObj->SetRwObjectAlpha(aWaterCreatures[i].m_alpha);
|
||||||
|
CVector newRight = aWaterCreatures[i].m_pObj->GetRight();
|
||||||
|
newRight.Normalise();
|
||||||
|
aWaterCreatures[i].m_pObj->m_vecMoveSpeed = newRight * aWaterCreatures[i].m_fRightMult;
|
||||||
|
aWaterCreatures[i].m_pObj->m_vecTurnSpeed = CVector(0.0f, 0.0f, aWaterCreatures[i].m_fZTurnSpeed);
|
||||||
|
aWaterCreatures[i].m_pObj->bIsStatic = false;
|
||||||
|
float fDepth = 0.0;
|
||||||
|
CWaterLevel::GetWaterDepth(aWaterCreatures[i].m_pObj->GetPosition(), &fDepth, nil, nil);
|
||||||
|
if (aWaterCreatures[i].m_fWaterDepth < fDepth) {
|
||||||
|
if (aWaterCreatures[i].m_pObj->m_nEndOfLifeTime - 40000 <= CTimer::GetTimeInMilliseconds())
|
||||||
|
aWaterCreatures[i].m_state = WATER_CREATURE_ACTIVE;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
aWaterCreatures[i].m_state = WATER_CREATURE_UPDATE;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
aWaterCreatures[i].m_state = WATER_CREATURE_TO_REMOVE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case WATER_CREATURE_UPDATE: {
|
||||||
|
aWaterCreatures[i].m_pObj->m_nEndOfLifeTime = CTimer::GetTimeInMilliseconds() + 40000;
|
||||||
|
if (aWaterCreatures[i].m_alpha <= 0) {
|
||||||
|
aWaterCreatures[i].m_state = WATER_CREATURE_TO_REMOVE;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
aWaterCreatures[i].m_alpha = Max(aWaterCreatures[i].m_alpha - 6, 0);
|
||||||
|
aWaterCreatures[i].m_pObj->SetRwObjectAlpha(aWaterCreatures[i].m_alpha);
|
||||||
|
CVector newRight = aWaterCreatures[i].m_pObj->GetRight();
|
||||||
|
newRight.Normalise();
|
||||||
|
newRight.x *= aWaterCreatures[i].m_fRightMult;
|
||||||
|
newRight.y *= aWaterCreatures[i].m_fRightMult;
|
||||||
|
newRight.z -= 0.015f;
|
||||||
|
aWaterCreatures[i].m_pObj->m_vecMoveSpeed = newRight;
|
||||||
|
|
||||||
|
if (!aWaterCreatures[i].m_pObj->GetIsOnScreen())
|
||||||
|
aWaterCreatures[i].m_state = WATER_CREATURE_TO_REMOVE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case WATER_CREATURE_TO_REMOVE:
|
||||||
|
if (aWaterCreatures[i].m_pObj)
|
||||||
|
CWorld::Remove(aWaterCreatures[i].m_pObj);
|
||||||
|
FreeFishStructSlot(&aWaterCreatures[i]);
|
||||||
|
nNumActiveSeaLifeForms--;
|
||||||
|
aWaterCreatures[i].m_state = WATER_CREATURE_DISABLED;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CWaterCreatures::RemoveAll() {
|
||||||
|
for (int i = 0; i < NUM_WATER_CREATURES; i++) {
|
||||||
|
if (aWaterCreatures[i].m_state != WATER_CREATURE_DISABLED) {
|
||||||
|
CWorld::Remove(aWaterCreatures[i].m_pObj);
|
||||||
|
FreeFishStructSlot(&aWaterCreatures[i]);
|
||||||
|
aWaterCreatures[i].m_state = WATER_CREATURE_DISABLED;
|
||||||
|
nNumActiveSeaLifeForms--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
49
src/render/WaterCreatures.h
Normal file
49
src/render/WaterCreatures.h
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "Object.h"
|
||||||
|
|
||||||
|
enum eFishSlotState {
|
||||||
|
WATER_CREATURE_ALLOCATED = 0,
|
||||||
|
WATER_CREATURE_ACTIVE,
|
||||||
|
WATER_CREATURE_UPDATE,
|
||||||
|
WATER_CREATURE_TO_REMOVE,
|
||||||
|
WATER_CREATURE_DISABLED
|
||||||
|
};
|
||||||
|
|
||||||
|
class CWaterCreature {
|
||||||
|
public:
|
||||||
|
CObject *m_pObj;
|
||||||
|
float m_fRightMult;
|
||||||
|
float m_fZTurnSpeed;
|
||||||
|
int32 m_alpha;
|
||||||
|
float m_fWaterDepth;
|
||||||
|
int32 m_state;
|
||||||
|
|
||||||
|
CWaterCreature();
|
||||||
|
~CWaterCreature();
|
||||||
|
void Allocate(CObject *pObj, float fRightMult, float fZTurnSpeed, float fWaterDepth, uint32 alpha, eFishSlotState state);
|
||||||
|
void Free();
|
||||||
|
void Initialise(CObject *pObj, float fRightMult, float fZTurnSpeed, float fWaterDepth, uint32 alpha, eFishSlotState state);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CWaterCreatures {
|
||||||
|
|
||||||
|
public:
|
||||||
|
static CWaterCreature aWaterCreatures[NUM_WATER_CREATURES];
|
||||||
|
static int32 nNumActiveSeaLifeForms;
|
||||||
|
static CObject *CreateSeaLifeForm(CVector const& pos, int16 modelID, int32 zRotAngle);
|
||||||
|
static void CreateOne(CVector const& pos, int32 modelID);
|
||||||
|
static void UpdateAll();
|
||||||
|
static void FreeFishStructSlot(CWaterCreature *wc);
|
||||||
|
static bool IsSpaceForMoreWaterCreatures();
|
||||||
|
static float CalculateFishHeading(CVector const& pos1, CVector const& pos2);
|
||||||
|
static void RemoveAll();
|
||||||
|
static CWaterCreature* GetFishStructSlot();
|
||||||
|
};
|
||||||
|
|
||||||
|
struct WaterCreatureProperties {
|
||||||
|
int16 *modelID;
|
||||||
|
float fRightMult;
|
||||||
|
float fLevel;
|
||||||
|
float fUnknown; //unused
|
||||||
|
float fWaterDepth;
|
||||||
|
};
|
@ -27,6 +27,7 @@
|
|||||||
#include "Replay.h"
|
#include "Replay.h"
|
||||||
#include "WaterLevel.h"
|
#include "WaterLevel.h"
|
||||||
#include "SurfaceTable.h"
|
#include "SurfaceTable.h"
|
||||||
|
#include "WaterCreatures.h"
|
||||||
|
|
||||||
#define RwIm3DVertexSet_RGBA(vert, rgba) RwIm3DVertexSetRGBA(vert, rgba.red, rgba.green, rgba.blue, rgba.alpha) // (RwRGBAAssign(&(_dst)->color, &_src))
|
#define RwIm3DVertexSet_RGBA(vert, rgba) RwIm3DVertexSetRGBA(vert, rgba.red, rgba.green, rgba.blue, rgba.alpha) // (RwRGBAAssign(&(_dst)->color, &_src))
|
||||||
|
|
||||||
@ -2821,8 +2822,7 @@ CWaterLevel::HandleSeaLifeForms()
|
|||||||
}
|
}
|
||||||
else if ( (CTimer::GetTimeInMilliseconds() - timecounter) > 5000 )
|
else if ( (CTimer::GetTimeInMilliseconds() - timecounter) > 5000 )
|
||||||
{
|
{
|
||||||
//TODO(MIAMI)
|
if ( CWaterCreatures::IsSpaceForMoreWaterCreatures() )
|
||||||
// if ( CWaterCreatures::IsSpaceForMoreWaterCreatures() )
|
|
||||||
{
|
{
|
||||||
for ( int32 i = 0; i < 3; i++ )
|
for ( int32 i = 0; i < 3; i++ )
|
||||||
{
|
{
|
||||||
@ -2838,14 +2838,12 @@ CWaterLevel::HandleSeaLifeForms()
|
|||||||
vecPos.x += (fCos - fSin) * fAngle;
|
vecPos.x += (fCos - fSin) * fAngle;
|
||||||
vecPos.y += (fSin + fCos) * fAngle;
|
vecPos.y += (fSin + fCos) * fAngle;
|
||||||
|
|
||||||
//TODO(MIAMI)
|
CWaterCreatures::CreateOne(vecPos, -1);
|
||||||
//CWaterCreatures::CreateOne(vecPos, 0xFFFFFFFF);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO(MIAMI)
|
CWaterCreatures::UpdateAll();
|
||||||
//CWaterCreatures::UpdateAll();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -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
|
||||||
|
@ -27,13 +27,28 @@ void GetLocalTime_CP(SYSTEMTIME *out) {
|
|||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
HANDLE FindFirstFile(const char* pathname, WIN32_FIND_DATA* firstfile) {
|
HANDLE FindFirstFile(const char* pathname, WIN32_FIND_DATA* firstfile) {
|
||||||
char newpathname[32];
|
char newpathname[32];
|
||||||
|
|
||||||
strncpy(newpathname, pathname, 32);
|
strncpy(newpathname, pathname, 32);
|
||||||
char* path = strtok(newpathname, "\\*");
|
char* path = strtok(newpathname, "*");
|
||||||
|
|
||||||
|
// Case-sensitivity and backslashes...
|
||||||
|
char *real = casepath(path);
|
||||||
|
if (real) {
|
||||||
|
real[strlen(real)] = '*';
|
||||||
|
char *extension = strtok(NULL, "*");
|
||||||
|
if (extension)
|
||||||
|
strcat(real, extension);
|
||||||
|
|
||||||
|
strncpy(newpathname, real, 32);
|
||||||
|
free(real);
|
||||||
|
path = strtok(newpathname, "*");
|
||||||
|
}
|
||||||
|
|
||||||
strncpy(firstfile->folder, path, sizeof(firstfile->folder));
|
strncpy(firstfile->folder, path, sizeof(firstfile->folder));
|
||||||
|
|
||||||
// Both w/ extension and w/o extension is ok
|
// Both w/ extension and w/o extension is ok
|
||||||
if (strlen(path) + 2 != strlen(pathname))
|
if (strlen(path) + 1 != strlen(pathname))
|
||||||
strncpy(firstfile->extension, strtok(NULL, "\\*"), sizeof(firstfile->extension));
|
strncpy(firstfile->extension, strtok(NULL, "*"), sizeof(firstfile->extension));
|
||||||
else
|
else
|
||||||
strncpy(firstfile->extension, "", sizeof(firstfile->extension));
|
strncpy(firstfile->extension, "", sizeof(firstfile->extension));
|
||||||
|
|
||||||
@ -53,7 +68,7 @@ bool FindNextFile(HANDLE d, WIN32_FIND_DATA* finddata) {
|
|||||||
|
|
||||||
// We only want "DT_REG"ular Files, but reportedly some FS and OSes gives DT_UNKNOWN as type.
|
// We only want "DT_REG"ular Files, but reportedly some FS and OSes gives DT_UNKNOWN as type.
|
||||||
if ((file->d_type == DT_UNKNOWN || file->d_type == DT_REG || file->d_type == DT_LNK) &&
|
if ((file->d_type == DT_UNKNOWN || file->d_type == DT_REG || file->d_type == DT_LNK) &&
|
||||||
(extensionLen == 0 || strncmp(&file->d_name[strlen(file->d_name) - extensionLen], finddata->extension, extensionLen) == 0)) {
|
(extensionLen == 0 || strncasecmp(&file->d_name[strlen(file->d_name) - extensionLen], finddata->extension, extensionLen) == 0)) {
|
||||||
|
|
||||||
sprintf(relativepath, "%s/%s", finddata->folder, file->d_name);
|
sprintf(relativepath, "%s/%s", finddata->folder, file->d_name);
|
||||||
realpath(relativepath, path);
|
realpath(relativepath, path);
|
||||||
|
@ -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
|
||||||
{
|
{
|
||||||
|
2
vendor/librw
vendored
2
vendor/librw
vendored
@ -1 +1 @@
|
|||||||
Subproject commit edc77742c512b85ad35544b2cfbe3f359dc75805
|
Subproject commit 30b77b0b32b4113b5dce2b67813ce9b85d1e1e57
|
Loading…
Reference in New Issue
Block a user