sync
This commit is contained in:
@@ -245,7 +245,7 @@ CAnimViewer::Update(void)
|
||||
if (modelInfo->GetModelType() == MITYPE_PED) {
|
||||
int animGroup = ((CPedModelInfo*)modelInfo)->m_animGroup;
|
||||
|
||||
if (animId > ANIM_IDLE_STANCE)
|
||||
if (animId > ANIM_STD_IDLE)
|
||||
animGroup = ASSOCGRP_STD;
|
||||
|
||||
if (reloadIFP) {
|
||||
@@ -334,14 +334,14 @@ CAnimViewer::Update(void)
|
||||
CMessages::AddMessage(gUString, 1000, 0);
|
||||
|
||||
} else if (pad->GetCircleJustDown()) {
|
||||
PlayAnimation(pTarget->GetClump(), animGroup, ANIM_IDLE_STANCE);
|
||||
PlayAnimation(pTarget->GetClump(), animGroup, ANIM_STD_IDLE);
|
||||
AsciiToUnicode("Idle animation playing", gUString);
|
||||
CMessages::AddMessage(gUString, 1000, 0);
|
||||
|
||||
} else if (pad->GetDPadUpJustDown()) {
|
||||
animId--;
|
||||
if (animId < 0) {
|
||||
animId = NUM_STD_ANIMS - 1;
|
||||
animId = ANIM_STD_NUM - 1;
|
||||
}
|
||||
PlayAnimation(pTarget->GetClump(), animGroup, (AnimationId)animId);
|
||||
|
||||
@@ -350,7 +350,7 @@ CAnimViewer::Update(void)
|
||||
CMessages::AddMessage(gUString, 1000, 0);
|
||||
|
||||
} else if (pad->GetDPadDownJustDown()) {
|
||||
animId = (animId == (NUM_STD_ANIMS - 1) ? 0 : animId + 1);
|
||||
animId = (animId == (ANIM_STD_NUM - 1) ? 0 : animId + 1);
|
||||
PlayAnimation(pTarget->GetClump(), animGroup, (AnimationId)animId);
|
||||
|
||||
sprintf(gString, "Current anim: %d", animId);
|
||||
|
||||
@@ -4956,9 +4956,9 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
|
||||
AlphaSpeed = 0.0;
|
||||
Distance = 1000.0;
|
||||
|
||||
Front.x = -(cos(Beta) * cos(Alpha));
|
||||
Front.y = -(sin(Beta) * cos(Alpha));
|
||||
Front.z = sin(Alpha);
|
||||
Front.x = -(Cos(Beta) * Cos(Alpha));
|
||||
Front.y = -(Sin(Beta) * Cos(Alpha));
|
||||
Front.z = Sin(Alpha);
|
||||
|
||||
m_aTargetHistoryPosOne = TargetCoors - nextDistance * Front;
|
||||
|
||||
@@ -5232,9 +5232,9 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
|
||||
|
||||
lastBeta = Beta;
|
||||
|
||||
Front.x = -(cos(Beta) * cos(Alpha));
|
||||
Front.y = -(sin(Beta) * cos(Alpha));
|
||||
Front.z = sin(Alpha);
|
||||
Front.x = -(Cos(Beta) * Cos(Alpha));
|
||||
Front.y = -(Sin(Beta) * Cos(Alpha));
|
||||
Front.z = Sin(Alpha);
|
||||
GetVectorsReadyForRW();
|
||||
TheCamera.m_bCamDirectlyBehind = false;
|
||||
TheCamera.m_bCamDirectlyInFront = false;
|
||||
@@ -5244,9 +5244,9 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
|
||||
m_cvecTargetCoorsForFudgeInter = TargetCoors;
|
||||
m_aTargetHistoryPosThree = m_aTargetHistoryPosOne;
|
||||
float nextAlpha = alphaWithSpeedAccounted + zoomModeAlphaOffset;
|
||||
float nextFrontX = -(cos(Beta) * cos(nextAlpha));
|
||||
float nextFrontY = -(sin(Beta) * cos(nextAlpha));
|
||||
float nextFrontZ = sin(nextAlpha);
|
||||
float nextFrontX = -(Cos(Beta) * Cos(nextAlpha));
|
||||
float nextFrontY = -(Sin(Beta) * Cos(nextAlpha));
|
||||
float nextFrontZ = Sin(nextAlpha);
|
||||
|
||||
m_aTargetHistoryPosOne.x = TargetCoors.x - nextFrontX * nextDistance;
|
||||
m_aTargetHistoryPosOne.y = TargetCoors.y - nextFrontY * nextDistance;
|
||||
@@ -5399,7 +5399,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
|
||||
|
||||
float alphaToFace = Atan2(hi.z, hi.Magnitude2D()) + DEGTORAD(15.0f);
|
||||
float neededAlphaTurn = alphaToFace - carGunUD;
|
||||
float alphaTurnPerFrame = CTimer::GetTimeStep() * 0.02f;
|
||||
float alphaTurnPerFrame = CTimer::GetTimeStepInSeconds();
|
||||
|
||||
if (neededAlphaTurn > alphaTurnPerFrame) {
|
||||
neededTurn = alphaTurnPerFrame;
|
||||
|
||||
@@ -214,7 +214,7 @@ CCamera::Init(void)
|
||||
m_iModeToGoTo = CCam::MODE_FOLLOWPED;
|
||||
m_bJust_Switched = false;
|
||||
m_bUseTransitionBeta = false;
|
||||
m_matrix.SetScale(1.0f);
|
||||
GetMatrix().SetScale(1.0f);
|
||||
m_bTargetJustBeenOnTrain = false;
|
||||
m_bInitialNoNodeStaticsSet = false;
|
||||
m_uiLongestTimeInMill = 5000;
|
||||
@@ -1769,7 +1769,7 @@ CCamera::CamControl(void)
|
||||
(m_bLookingAtPlayer || WhoIsInControlOfTheCamera == CAMCONTROL_OBBE) &&
|
||||
!m_WideScreenOn &&
|
||||
(WhoIsInControlOfTheCamera != CAMCONTROL_OBBE || bSwitchedToObbeCam))
|
||||
DMAudio.PlayFrontEndSound(SOUND_HUD_SOUND, 0);
|
||||
DMAudio.PlayFrontEndSound(SOUND_HUD, 0);
|
||||
}
|
||||
|
||||
// What a mess!
|
||||
@@ -4019,7 +4019,7 @@ CCamera::SetRwCamera(RwCamera *cam)
|
||||
void
|
||||
CCamera::CalculateDerivedValues(void)
|
||||
{
|
||||
m_cameraMatrix = Invert(m_matrix);
|
||||
m_cameraMatrix = Invert(GetMatrix());
|
||||
|
||||
float hfov = DEGTORAD(CDraw::GetScaledFOV()/2.0f);
|
||||
float c = Cos(hfov);
|
||||
@@ -4103,16 +4103,11 @@ CCamera::IsSphereVisible(const CVector ¢er, float radius, const CMatrix *mat
|
||||
bool
|
||||
CCamera::IsSphereVisible(const CVector ¢er, float radius)
|
||||
{
|
||||
CMatrix mat = m_cameraMatrix;
|
||||
return IsSphereVisible(center, radius, &mat);
|
||||
return IsSphereVisible(center, radius, &GetCameraMatrix());
|
||||
}
|
||||
|
||||
bool
|
||||
#ifdef GTA_PS2
|
||||
CCamera::IsBoxVisible(CVuVector *box, const CMatrix *mat)
|
||||
#else
|
||||
CCamera::IsBoxVisible(CVector *box, const CMatrix *mat)
|
||||
#endif
|
||||
CCamera::IsBoxVisible(CVUVECTOR *box, const CMatrix *mat)
|
||||
{
|
||||
int i;
|
||||
int frustumTests[6] = { 0 };
|
||||
|
||||
@@ -634,11 +634,7 @@ public:
|
||||
bool IsPointVisible(const CVector ¢er, const CMatrix *mat);
|
||||
bool IsSphereVisible(const CVector ¢er, float radius, const CMatrix *mat);
|
||||
bool IsSphereVisible(const CVector ¢er, float radius);
|
||||
#ifdef GTA_PS2
|
||||
bool IsBoxVisible(CVuVector *box, const CMatrix *mat);
|
||||
#else
|
||||
bool IsBoxVisible(CVector *box, const CMatrix *mat);
|
||||
#endif
|
||||
bool IsBoxVisible(CVUVECTOR *box, const CMatrix *mat);
|
||||
};
|
||||
|
||||
VALIDATE_SIZE(CCamera, 0xE9D8);
|
||||
|
||||
@@ -14,9 +14,9 @@ struct CdReadInfo
|
||||
void *pBuffer;
|
||||
char field_C;
|
||||
bool bLocked;
|
||||
bool bInUse;
|
||||
bool bReading;
|
||||
int32 nStatus;
|
||||
HANDLE hSemaphore; // used for CdStreamSync
|
||||
HANDLE pDoneSemaphore; // used for CdStreamSync
|
||||
HANDLE hFile;
|
||||
OVERLAPPED Overlapped;
|
||||
};
|
||||
@@ -53,9 +53,9 @@ CdStreamInitThread(void)
|
||||
{
|
||||
for ( int32 i = 0; i < gNumChannels; i++ )
|
||||
{
|
||||
gpReadInfo[i].hSemaphore = CreateSemaphore(nil, 0, 2, nil);
|
||||
gpReadInfo[i].pDoneSemaphore = CreateSemaphore(nil, 0, 2, nil);
|
||||
|
||||
if ( gpReadInfo[i].hSemaphore == nil )
|
||||
if ( gpReadInfo[i].pDoneSemaphore == nil )
|
||||
{
|
||||
printf("%s: failed to create sync semaphore\n", "cdvd_stream");
|
||||
ASSERT(0);
|
||||
@@ -183,7 +183,7 @@ CdStreamShutdown(void)
|
||||
CloseHandle(_gCdStreamThread);
|
||||
|
||||
for ( int32 i = 0; i < gNumChannels; i++ )
|
||||
CloseHandle(gpReadInfo[i].hSemaphore);
|
||||
CloseHandle(gpReadInfo[i].pDoneSemaphore);
|
||||
}
|
||||
|
||||
LocalFree(gpReadInfo);
|
||||
@@ -213,7 +213,7 @@ CdStreamRead(int32 channel, void *buffer, uint32 offset, uint32 size)
|
||||
|
||||
if ( _gbCdStreamAsync )
|
||||
{
|
||||
if ( pChannel->nSectorsToRead != 0 || pChannel->bInUse )
|
||||
if ( pChannel->nSectorsToRead != 0 || pChannel->bReading )
|
||||
return STREAM_NONE;
|
||||
|
||||
pChannel->nStatus = STREAM_NONE;
|
||||
@@ -271,7 +271,7 @@ CdStreamGetStatus(int32 channel)
|
||||
|
||||
if ( _gbCdStreamAsync )
|
||||
{
|
||||
if ( pChannel->bInUse )
|
||||
if ( pChannel->bReading )
|
||||
return STREAM_READING;
|
||||
|
||||
if ( pChannel->nSectorsToRead != 0 )
|
||||
@@ -321,12 +321,21 @@ CdStreamSync(int32 channel)
|
||||
{
|
||||
pChannel->bLocked = true;
|
||||
|
||||
ASSERT( pChannel->hSemaphore != nil );
|
||||
ASSERT( pChannel->pDoneSemaphore != nil );
|
||||
|
||||
WaitForSingleObject(pChannel->hSemaphore, INFINITE);
|
||||
// Deadlock fix 1
|
||||
#ifdef FIX_BUGS
|
||||
// This is while loop on Posix streamer, for spurious wakeups
|
||||
if (pChannel->bLocked && pChannel->nSectorsToRead != 0){
|
||||
WaitForSingleObject(pChannel->pDoneSemaphore, INFINITE);
|
||||
}
|
||||
pChannel->bLocked = false;
|
||||
#else
|
||||
WaitForSingleObject(pChannel->pDoneSemaphore, INFINITE);
|
||||
#endif
|
||||
}
|
||||
|
||||
pChannel->bInUse = false;
|
||||
pChannel->bReading = false;
|
||||
|
||||
return pChannel->nStatus;
|
||||
}
|
||||
@@ -398,7 +407,7 @@ WINAPI CdStreamThread(LPVOID lpThreadParameter)
|
||||
CdReadInfo *pChannel = &gpReadInfo[channel];
|
||||
ASSERT( pChannel != nil );
|
||||
|
||||
pChannel->bInUse = true;
|
||||
pChannel->bReading = true;
|
||||
|
||||
if ( pChannel->nStatus == STREAM_NONE )
|
||||
{
|
||||
@@ -455,11 +464,15 @@ WINAPI CdStreamThread(LPVOID lpThreadParameter)
|
||||
|
||||
if ( pChannel->bLocked )
|
||||
{
|
||||
ASSERT( pChannel->hSemaphore != nil );
|
||||
ReleaseSemaphore(pChannel->hSemaphore, 1, NULL);
|
||||
ASSERT( pChannel->pDoneSemaphore != nil );
|
||||
// Deadlock fix 2
|
||||
#ifdef FIX_BUGS
|
||||
pChannel->bLocked = 0;
|
||||
#endif
|
||||
ReleaseSemaphore(pChannel->pDoneSemaphore, 1, NULL);
|
||||
}
|
||||
|
||||
pChannel->bInUse = false;
|
||||
pChannel->bReading = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,6 @@ char *CdStreamGetImageName(int32 cd);
|
||||
void CdStreamRemoveImages(void);
|
||||
int32 CdStreamGetNumImages(void);
|
||||
|
||||
#ifndef _WIN32
|
||||
#ifdef FLUSHABLE_STREAMING
|
||||
extern bool flushStream[MAX_CDCHANNELS];
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#ifndef _WIN32
|
||||
#include "common.h"
|
||||
#include "crossplatform.h"
|
||||
#include <pthread.h>
|
||||
#include <signal.h>
|
||||
#include <pthread.h>
|
||||
#include <semaphore.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
@@ -12,7 +12,11 @@
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/resource.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifdef __linux__
|
||||
#include <sys/syscall.h>
|
||||
#endif
|
||||
|
||||
#include "CdStream.h"
|
||||
#include "rwcore.h"
|
||||
@@ -21,9 +25,61 @@
|
||||
#define CDDEBUG(f, ...) debug ("%s: " f "\n", "cdvd_stream", ## __VA_ARGS__)
|
||||
#define CDTRACE(f, ...) printf("%s: " f "\n", "cdvd_stream", ## __VA_ARGS__)
|
||||
|
||||
// #define ONE_THREAD_PER_CHANNEL // Don't use if you're not on SSD/Flash. (Also you may want to benefit from this via using all channels in Streaming.cpp)
|
||||
|
||||
#ifdef FLUSHABLE_STREAMING
|
||||
bool flushStream[MAX_CDCHANNELS];
|
||||
#endif
|
||||
|
||||
#ifdef USE_UNNAMED_SEM
|
||||
|
||||
#define RE3_SEM_OPEN(name, ...) re3_sem_open()
|
||||
sem_t*
|
||||
re3_sem_open(void)
|
||||
{
|
||||
sem_t* sem = (sem_t*)malloc(sizeof(sem_t));
|
||||
if (sem_init(sem, 0, 1) == -1) {
|
||||
sem = SEM_FAILED;
|
||||
}
|
||||
|
||||
return sem;
|
||||
}
|
||||
|
||||
#define RE3_SEM_CLOSE(sem, format, ...) re3_sem_close(sem)
|
||||
void
|
||||
re3_sem_close(sem_t* sem)
|
||||
{
|
||||
sem_destroy(sem);
|
||||
free(sem);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define RE3_SEM_OPEN re3_sem_open
|
||||
sem_t*
|
||||
re3_sem_open(const char* format, ...)
|
||||
{
|
||||
char semName[21];
|
||||
va_list va;
|
||||
va_start(va, format);
|
||||
vsprintf(semName, format, va);
|
||||
|
||||
return sem_open(semName, O_CREAT, 0644, 1);
|
||||
}
|
||||
|
||||
#define RE3_SEM_CLOSE re3_sem_close
|
||||
void
|
||||
re3_sem_close(sem_t* sem, const char* format, ...)
|
||||
{
|
||||
sem_close(sem);
|
||||
|
||||
char semName[21];
|
||||
va_list va;
|
||||
va_start(va, format);
|
||||
vsprintf(semName, format, va);
|
||||
|
||||
sem_unlink(semName);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
struct CdReadInfo
|
||||
{
|
||||
@@ -69,14 +125,13 @@ void
|
||||
CdStreamInitThread(void)
|
||||
{
|
||||
int status;
|
||||
char semName[20];
|
||||
#ifndef ONE_THREAD_PER_CHANNEL
|
||||
gChannelRequestQ.items = (int32 *)calloc(gNumChannels + 1, sizeof(int32));
|
||||
gChannelRequestQ.head = 0;
|
||||
gChannelRequestQ.tail = 0;
|
||||
gChannelRequestQ.size = gNumChannels + 1;
|
||||
ASSERT(gChannelRequestQ.items != nil );
|
||||
gCdStreamSema = sem_open("/semaphore_cd_stream", O_CREAT, 0644, 1);
|
||||
gCdStreamSema = RE3_SEM_OPEN("/semaphore_cd_stream");
|
||||
|
||||
|
||||
if (gCdStreamSema == SEM_FAILED) {
|
||||
@@ -90,8 +145,7 @@ CdStreamInitThread(void)
|
||||
{
|
||||
for ( int32 i = 0; i < gNumChannels; i++ )
|
||||
{
|
||||
sprintf(semName,"/semaphore_done%d",i);
|
||||
gpReadInfo[i].pDoneSemaphore = sem_open(semName, O_CREAT, 0644, 1);
|
||||
gpReadInfo[i].pDoneSemaphore = RE3_SEM_OPEN("/semaphore_done%d", i);
|
||||
|
||||
if (gpReadInfo[i].pDoneSemaphore == SEM_FAILED)
|
||||
{
|
||||
@@ -99,9 +153,9 @@ CdStreamInitThread(void)
|
||||
ASSERT(0);
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef ONE_THREAD_PER_CHANNEL
|
||||
sprintf(semName,"/semaphore_start%d",i);
|
||||
gpReadInfo[i].pStartSemaphore = sem_open(semName, O_CREAT, 0644, 1);
|
||||
gpReadInfo[i].pStartSemaphore = RE3_SEM_OPEN("/semaphore_start%d", i);
|
||||
|
||||
if (gpReadInfo[i].pStartSemaphore == SEM_FAILED)
|
||||
{
|
||||
@@ -170,6 +224,7 @@ CdStreamInit(int32 numChannels)
|
||||
gNumImages = 0;
|
||||
|
||||
gNumChannels = numChannels;
|
||||
ASSERT( gNumChannels != 0 );
|
||||
|
||||
gpReadInfo = (CdReadInfo *)calloc(numChannels, sizeof(CdReadInfo));
|
||||
ASSERT( gpReadInfo != nil );
|
||||
@@ -245,10 +300,12 @@ CdStreamRead(int32 channel, void *buffer, uint32 offset, uint32 size)
|
||||
if ( pChannel->nSectorsToRead != 0 || pChannel->bReading ) {
|
||||
if (pChannel->hFile == hImage - 1 && pChannel->nSectorOffset == _GET_OFFSET(offset) && pChannel->nSectorsToRead >= size)
|
||||
return STREAM_SUCCESS;
|
||||
|
||||
#ifdef FLUSHABLE_STREAMING
|
||||
flushStream[channel] = 1;
|
||||
CdStreamSync(channel);
|
||||
//return STREAM_NONE;
|
||||
#else
|
||||
return STREAM_NONE;
|
||||
#endif
|
||||
}
|
||||
|
||||
pChannel->hFile = hImage - 1;
|
||||
@@ -316,34 +373,34 @@ CdStreamSync(int32 channel)
|
||||
CdReadInfo *pChannel = &gpReadInfo[channel];
|
||||
ASSERT( pChannel != nil );
|
||||
|
||||
#ifdef FLUSHABLE_STREAMING
|
||||
if (flushStream[channel]) {
|
||||
#ifdef ONE_THREAD_PER_CHANNEL
|
||||
pChannel->nSectorsToRead = 0;
|
||||
#ifdef ONE_THREAD_PER_CHANNEL
|
||||
pthread_kill(pChannel->pChannelThread, SIGUSR1);
|
||||
if (pChannel->bReading) {
|
||||
pChannel->bLocked = true;
|
||||
while (pChannel->bLocked)
|
||||
sem_wait(pChannel->pDoneSemaphore);
|
||||
}
|
||||
#else
|
||||
pChannel->nSectorsToRead = 0;
|
||||
if (pChannel->bReading) {
|
||||
pChannel->bLocked = true;
|
||||
pthread_kill(_gCdStreamThread, SIGUSR1);
|
||||
#endif
|
||||
while (pChannel->bLocked)
|
||||
sem_wait(pChannel->pDoneSemaphore);
|
||||
}
|
||||
#endif
|
||||
pChannel->bReading = false;
|
||||
flushStream[channel] = false;
|
||||
return STREAM_NONE;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( pChannel->nSectorsToRead != 0 )
|
||||
{
|
||||
pChannel->bLocked = true;
|
||||
while (pChannel->bLocked)
|
||||
while (pChannel->bLocked && pChannel->nSectorsToRead != 0){
|
||||
sem_wait(pChannel->pDoneSemaphore);
|
||||
}
|
||||
pChannel->bLocked = false;
|
||||
}
|
||||
|
||||
pChannel->bReading = false;
|
||||
@@ -395,7 +452,12 @@ void *CdStreamThread(void *param)
|
||||
#ifndef ONE_THREAD_PER_CHANNEL
|
||||
while (gCdStreamThreadStatus != 2) {
|
||||
sem_wait(gCdStreamSema);
|
||||
|
||||
int32 channel = GetFirstInQueue(&gChannelRequestQ);
|
||||
|
||||
// spurious wakeup
|
||||
if (channel == -1)
|
||||
continue;
|
||||
#else
|
||||
int channel = *((int*)param);
|
||||
while (gpReadInfo[channel].nThreadStatus != 2){
|
||||
@@ -447,7 +509,7 @@ void *CdStreamThread(void *param)
|
||||
if ( pChannel->bLocked )
|
||||
{
|
||||
pChannel->bLocked = 0;
|
||||
sem_post(pChannel->pDoneSemaphore);
|
||||
sem_post(pChannel->pDoneSemaphore);
|
||||
}
|
||||
pChannel->bReading = false;
|
||||
}
|
||||
@@ -455,21 +517,14 @@ void *CdStreamThread(void *param)
|
||||
#ifndef ONE_THREAD_PER_CHANNEL
|
||||
for ( int32 i = 0; i < gNumChannels; i++ )
|
||||
{
|
||||
sem_close(gpReadInfo[i].pDoneSemaphore);
|
||||
sprintf(semName,"/semaphore_done%d",i);
|
||||
sem_unlink(semName);
|
||||
RE3_SEM_CLOSE(gpReadInfo[i].pDoneSemaphore, "/semaphore_done%d", i);
|
||||
}
|
||||
sem_close(gCdStreamSema);
|
||||
sem_unlink("/semaphore_cd_stream");
|
||||
RE3_SEM_CLOSE(gCdStreamSema, "/semaphore_cd_stream");
|
||||
free(gChannelRequestQ.items);
|
||||
#else
|
||||
sem_close(gpReadInfo[channel].pStartSemaphore);
|
||||
sprintf(semName,"/semaphore_start%d",channel);
|
||||
sem_unlink(semName);
|
||||
RE3_SEM_CLOSE(gpReadInfo[channel].pStartSemaphore, "/semaphore_start%d", channel);
|
||||
|
||||
sem_close(gpReadInfo[channel].pDoneSemaphore);
|
||||
sprintf(semName,"/semaphore_done%d",channel);
|
||||
sem_unlink(semName);
|
||||
RE3_SEM_CLOSE(gpReadInfo[channel].pDoneSemaphore, "/semaphore_done%d", channel);
|
||||
#endif
|
||||
if (gpReadInfo)
|
||||
free(gpReadInfo);
|
||||
@@ -524,7 +579,9 @@ void
|
||||
CdStreamRemoveImages(void)
|
||||
{
|
||||
for ( int32 i = 0; i < gNumChannels; i++ ) {
|
||||
#ifdef FLUSHABLE_STREAMING
|
||||
flushStream[i] = 1;
|
||||
#endif
|
||||
CdStreamSync(i);
|
||||
}
|
||||
|
||||
|
||||
@@ -131,6 +131,9 @@ void CControllerConfigManager::LoadSettings(int32 file)
|
||||
{
|
||||
bool bValid = true;
|
||||
int nVersion = 0;
|
||||
#ifdef BIND_VEHICLE_FIREWEAPON
|
||||
bool skipVehicleFireWeapon = false;
|
||||
#endif
|
||||
|
||||
if (file)
|
||||
{
|
||||
@@ -148,11 +151,26 @@ void CControllerConfigManager::LoadSettings(int32 file)
|
||||
if (bValid && nVersion >= 3)
|
||||
{
|
||||
ControlsManager.MakeControllerActionsBlank();
|
||||
#ifdef BIND_VEHICLE_FIREWEAPON
|
||||
skipVehicleFireWeapon = nVersion < 4;
|
||||
// Set the default settings of VEHICLE_FIREWEAPON
|
||||
if (skipVehicleFireWeapon) {
|
||||
SetControllerKeyAssociatedWithAction(VEHICLE_FIREWEAPON, rsPADINS, KEYBOARD);
|
||||
SetControllerKeyAssociatedWithAction(VEHICLE_FIREWEAPON, rsLCTRL, OPTIONAL_EXTRA);
|
||||
if (m_bMouseAssociated)
|
||||
SetMouseButtonAssociatedWithAction(VEHICLE_FIREWEAPON, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
for (int32 i = 0; i < MAX_CONTROLLERTYPES; i++)
|
||||
{
|
||||
for (int32 j = 0; j < MAX_CONTROLLERACTIONS; j++)
|
||||
{
|
||||
#ifdef BIND_VEHICLE_FIREWEAPON
|
||||
// Skip file read
|
||||
if (skipVehicleFireWeapon && j == VEHICLE_FIREWEAPON)
|
||||
continue;
|
||||
#endif
|
||||
CFileMgr::Read(file, (char *)&ControlsManager.m_aSettings[j][i], sizeof(tControllerConfigBind));
|
||||
}
|
||||
}
|
||||
@@ -326,6 +344,11 @@ uint32 CControllerConfigManager::ms_padButtonsInited = 0;
|
||||
|
||||
void CControllerConfigManager::InitDefaultControlConfigJoyPad(uint32 buttons)
|
||||
{
|
||||
#ifdef XINPUT
|
||||
// No manual bindings for you, honey.
|
||||
return;
|
||||
#endif
|
||||
|
||||
m_bFirstCapture = true;
|
||||
|
||||
uint32 btn = buttons;
|
||||
@@ -1765,6 +1788,51 @@ void CControllerConfigManager::DeleteMatching1rstPersonControls(e_ControllerActi
|
||||
|
||||
#undef CLEAR_ACTION_IF_NEEDED
|
||||
|
||||
#ifdef RADIO_SCROLL_TO_PREV_STATION
|
||||
#define CHECK_ACTION(action) \
|
||||
if (key == GetControllerKeyAssociatedWithAction(action, type))\
|
||||
return true;
|
||||
|
||||
bool CControllerConfigManager::IsAnyVehicleActionAssignedToMouseKey(int32 key)
|
||||
{
|
||||
const eControllerType type = MOUSE;
|
||||
if (!GetIsKeyBlank(key, type))
|
||||
{
|
||||
#ifdef BIND_VEHICLE_FIREWEAPON
|
||||
CHECK_ACTION(VEHICLE_FIREWEAPON);
|
||||
#endif
|
||||
CHECK_ACTION(VEHICLE_LOOKBEHIND);
|
||||
CHECK_ACTION(VEHICLE_LOOKLEFT);
|
||||
CHECK_ACTION(VEHICLE_LOOKRIGHT);
|
||||
CHECK_ACTION(VEHICLE_HORN);
|
||||
CHECK_ACTION(VEHICLE_HANDBRAKE);
|
||||
CHECK_ACTION(VEHICLE_ACCELERATE);
|
||||
CHECK_ACTION(VEHICLE_BRAKE);
|
||||
CHECK_ACTION(VEHICLE_CHANGE_RADIO_STATION);
|
||||
CHECK_ACTION(TOGGLE_SUBMISSIONS);
|
||||
CHECK_ACTION(VEHICLE_TURRETLEFT);
|
||||
CHECK_ACTION(VEHICLE_TURRETRIGHT);
|
||||
CHECK_ACTION(VEHICLE_TURRETUP);
|
||||
CHECK_ACTION(VEHICLE_TURRETDOWN);
|
||||
CHECK_ACTION(VEHICLE_ENTER_EXIT);
|
||||
CHECK_ACTION(CAMERA_CHANGE_VIEW_ALL_SITUATIONS);
|
||||
#ifndef BIND_VEHICLE_FIREWEAPON
|
||||
CHECK_ACTION(PED_FIREWEAPON);
|
||||
#endif
|
||||
CHECK_ACTION(GO_LEFT);
|
||||
CHECK_ACTION(GO_RIGHT);
|
||||
CHECK_ACTION(NETWORK_TALK);
|
||||
CHECK_ACTION(SWITCH_DEBUG_CAM_ON);
|
||||
CHECK_ACTION(TOGGLE_DPAD);
|
||||
CHECK_ACTION(TAKE_SCREEN_SHOT);
|
||||
CHECK_ACTION(SHOW_MOUSE_POINTER_TOGGLE);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#undef CHECK_ACTION
|
||||
#endif
|
||||
|
||||
void CControllerConfigManager::DeleteMatchingActionInitiators(e_ControllerAction action, int32 key, eControllerType type)
|
||||
{
|
||||
if (!GetIsKeyBlank(key, type))
|
||||
@@ -2371,7 +2439,7 @@ int32 CControllerConfigManager::GetNumOfSettingsForAction(e_ControllerAction act
|
||||
#define VFB(b)
|
||||
#endif
|
||||
|
||||
#define CONTROLLER_BUTTONS(T, O, X, Q, L1, L2, L3, R1, R2, R3, SELECT, RSL, RSR) \
|
||||
#define CONTROLLER_BUTTONS(T, O, X, Q, L1, L2, L3, R1, R2, R3, SELECT, RSU, RSD, RSL, RSR) \
|
||||
{{ \
|
||||
O, /* PED_FIREWEAPON */ \
|
||||
R2, /* PED_CYCLE_WEAPON_RIGHT */ \
|
||||
@@ -2482,7 +2550,7 @@ int32 CControllerConfigManager::GetNumOfSettingsForAction(e_ControllerAction act
|
||||
O, /* PED_SPRINT */ \
|
||||
R3, /* PED_LOOKBEHIND */ \
|
||||
L3, /* PED_DUCK */ \
|
||||
L1, /* PED_ANSWER_PHONE */ \
|
||||
T, /* PED_ANSWER_PHONE */ \
|
||||
VFB(O) /* VEHICLE_FIREWEAPON */ \
|
||||
X, /* VEHICLE_ACCELERATE */ \
|
||||
Q, /* VEHICLE_BRAKE */ \
|
||||
@@ -2529,10 +2597,10 @@ int32 CControllerConfigManager::GetNumOfSettingsForAction(e_ControllerAction act
|
||||
X, /* PED_SPRINT */ \
|
||||
R3, /* PED_LOOKBEHIND */ \
|
||||
L3, /* PED_DUCK */ \
|
||||
L1, /* PED_ANSWER_PHONE */ \
|
||||
O, /* PED_ANSWER_PHONE */ \
|
||||
VFB(R1) /* VEHICLE_FIREWEAPON */ \
|
||||
nil, /* VEHICLE_ACCELERATE */ \
|
||||
nil, /* VEHICLE_BRAKE */ \
|
||||
RSU, /* VEHICLE_ACCELERATE */ \
|
||||
RSD, /* VEHICLE_BRAKE */ \
|
||||
O, /* VEHICLE_CHANGE_RADIO_STATION */ \
|
||||
L3, /* VEHICLE_HORN */ \
|
||||
Q, /* TOGGLE_SUBMISSIONS */ \
|
||||
@@ -2573,10 +2641,10 @@ int32 CControllerConfigManager::GetNumOfSettingsForAction(e_ControllerAction act
|
||||
#define RIGHT "RIGHT"
|
||||
#endif
|
||||
|
||||
const char *XboxButtons_noIcons[][MAX_CONTROLLERACTIONS] = CONTROLLER_BUTTONS("Y", "B", "A", "X", "LB", "LT", "LS", "RB", "RT", "RS", "BACK", "right stick left", "right stick right");
|
||||
const char *XboxButtons_noIcons[][MAX_CONTROLLERACTIONS] = CONTROLLER_BUTTONS("Y", "B", "A", "X", "LB", "LT", "LS", "RB", "RT", "RS", "BACK", "right stick up", "right stick down", "right stick left", "right stick right");
|
||||
|
||||
#ifdef BUTTON_ICONS
|
||||
const char *XboxButtons[][MAX_CONTROLLERACTIONS] = CONTROLLER_BUTTONS("~T~", "~O~", "~X~", "~Q~", "~K~", "~M~", "~A~", "~J~", "~V~", "~C~", "BACK", "~(~", "~)~");
|
||||
const char *XboxButtons[][MAX_CONTROLLERACTIONS] = CONTROLLER_BUTTONS("~T~", "~O~", "~X~", "~Q~", "~K~", "~M~", "~A~", "~J~", "~V~", "~C~", "BACK", "~H~", "~L~", "~(~", "~)~");
|
||||
#endif
|
||||
|
||||
|
||||
@@ -2585,11 +2653,6 @@ const char *XboxButtons[][MAX_CONTROLLERACTIONS] = CONTROLLER_BUTTONS("~T~", "~O
|
||||
#define PS2_CIRCLE "|"
|
||||
#define PS2_CROSS "/"
|
||||
#define PS2_SQUARE "^"
|
||||
#elif defined(BUTTON_ICONS)
|
||||
#define PS2_TRIANGLE "~T~"
|
||||
#define PS2_CIRCLE "~O~"
|
||||
#define PS2_CROSS "~X~"
|
||||
#define PS2_SQUARE "~Q~"
|
||||
#else
|
||||
#define PS2_TRIANGLE "TRIANGLE"
|
||||
#define PS2_CIRCLE "CIRCLE"
|
||||
@@ -2598,11 +2661,11 @@ const char *XboxButtons[][MAX_CONTROLLERACTIONS] = CONTROLLER_BUTTONS("~T~", "~O
|
||||
#endif
|
||||
|
||||
const char *PlayStationButtons_noIcons[][MAX_CONTROLLERACTIONS] =
|
||||
CONTROLLER_BUTTONS(PS2_TRIANGLE, PS2_CIRCLE, PS2_CROSS, PS2_SQUARE, "L1", "L2", "L3", "R1", "R2", "R3", "SELECT", "right stick left", "right stick right");
|
||||
CONTROLLER_BUTTONS(PS2_TRIANGLE, PS2_CIRCLE, PS2_CROSS, PS2_SQUARE, "L1", "L2", "L3", "R1", "R2", "R3", "SELECT", "right stick up", "right stick down", "right stick left", "right stick right");
|
||||
|
||||
#ifdef BUTTON_ICONS
|
||||
const char *PlayStationButtons[][MAX_CONTROLLERACTIONS] =
|
||||
CONTROLLER_BUTTONS(PS2_TRIANGLE, PS2_CIRCLE, PS2_CROSS, PS2_SQUARE, "~K~", "~M~", "~A~", "~J~", "~V~", "~C~", "SELECT", "~(~", "~)~");
|
||||
CONTROLLER_BUTTONS("~T~", "~O~", "~X~", "~Q~", "~K~", "~M~", "~A~", "~J~", "~V~", "~C~", "SELECT", "~H~", "~L~", "~(~", "~)~");
|
||||
#endif
|
||||
|
||||
#undef PS2_TRIANGLE
|
||||
@@ -2624,11 +2687,36 @@ void CControllerConfigManager::GetWideStringOfCommandKeys(uint16 action, wchar *
|
||||
if (CPad::GetPad(0)->IsAffectedByController) {
|
||||
wchar wstr[16];
|
||||
|
||||
// TODO: INI and/or menu setting for Xbox/PS switch
|
||||
const char* (*Buttons)[MAX_CONTROLLERACTIONS];
|
||||
|
||||
#ifdef BUTTON_ICONS
|
||||
const char *(*Buttons)[MAX_CONTROLLERACTIONS] = CFont::ButtonsSlot != -1 ? XboxButtons : XboxButtons_noIcons;
|
||||
#ifdef GAMEPAD_MENU
|
||||
switch (FrontEndMenuManager.m_PrefsControllerType)
|
||||
{
|
||||
case CMenuManager::CONTROLLER_DUALSHOCK2:
|
||||
case CMenuManager::CONTROLLER_DUALSHOCK3:
|
||||
case CMenuManager::CONTROLLER_DUALSHOCK4:
|
||||
Buttons = CFont::ButtonsSlot != -1 ? PlayStationButtons : PlayStationButtons_noIcons;
|
||||
break;
|
||||
default:
|
||||
#endif
|
||||
Buttons = CFont::ButtonsSlot != -1 ? XboxButtons : XboxButtons_noIcons;
|
||||
#ifdef GAMEPAD_MENU
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
const char *(*Buttons)[MAX_CONTROLLERACTIONS] = XboxButtons_noIcons;
|
||||
switch (FrontEndMenuManager.m_PrefsControllerType)
|
||||
{
|
||||
case CMenuManager::CONTROLLER_DUALSHOCK2:
|
||||
case CMenuManager::CONTROLLER_DUALSHOCK3:
|
||||
case CMenuManager::CONTROLLER_DUALSHOCK4:
|
||||
Buttons = PlayStationButtons_noIcons;
|
||||
break;
|
||||
default:
|
||||
Buttons = XboxButtons_noIcons;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
assert(Buttons[CPad::GetPad(0)->Mode][action] != nil); // we cannot use these
|
||||
|
||||
@@ -195,6 +195,10 @@ public:
|
||||
void DeleteMatching1rstPersonControls (e_ControllerAction action, int32 key, eControllerType type);
|
||||
void DeleteMatchingActionInitiators (e_ControllerAction action, int32 key, eControllerType type);
|
||||
|
||||
#ifdef RADIO_SCROLL_TO_PREV_STATION
|
||||
bool IsAnyVehicleActionAssignedToMouseKey(int32 key);
|
||||
#endif
|
||||
|
||||
bool GetIsKeyBlank(int32 key, eControllerType type);
|
||||
e_ControllerActionType GetActionType(e_ControllerAction action);
|
||||
|
||||
|
||||
@@ -1279,7 +1279,7 @@ CFileLoader::LoadObjectInstance(const char *line)
|
||||
if(!CStreaming::IsObjectInCdImage(id))
|
||||
debug("Not in cdimage %s\n", mi->GetModelName());
|
||||
|
||||
angle = -RADTODEG(2.0f * acosf(angle));
|
||||
angle = -RADTODEG(2.0f * Acos(angle));
|
||||
xform = RwMatrixCreate();
|
||||
RwMatrixRotate(xform, &axis, angle, rwCOMBINEREPLACE);
|
||||
RwMatrixTranslate(xform, &trans, rwCOMBINEPOSTCONCAT);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -137,6 +137,13 @@ enum eMenuSprites
|
||||
MENUSPRITE_DOWNON,
|
||||
MENUSPRITE_UPOFF,
|
||||
MENUSPRITE_UPON,
|
||||
#ifdef GAMEPAD_MENU
|
||||
MENUSPRITE_CONTROLLER,
|
||||
MENUSPRITE_ARROWS1,
|
||||
MENUSPRITE_ARROWS2,
|
||||
MENUSPRITE_ARROWS3,
|
||||
MENUSPRITE_ARROWS4,
|
||||
#endif
|
||||
NUM_MENU_SPRITES
|
||||
};
|
||||
|
||||
@@ -192,8 +199,10 @@ enum eMenuScreen
|
||||
MENUPAGE_MOUSE_CONTROLS = 31,
|
||||
MENUPAGE_PAUSE_MENU = 32,
|
||||
MENUPAGE_NONE = 33, // Then chooses main menu or pause menu
|
||||
#ifdef LEGACY_MENU_OPTIONS
|
||||
#ifdef GAMEPAD_MENU
|
||||
MENUPAGE_CONTROLLER_SETTINGS,
|
||||
#endif
|
||||
#ifdef LEGACY_MENU_OPTIONS
|
||||
MENUPAGE_DEBUG_MENU,
|
||||
MENUPAGE_CONTROLLER_PC_OLD1,
|
||||
MENUPAGE_CONTROLLER_PC_OLD2,
|
||||
@@ -206,7 +215,7 @@ enum eMenuScreen
|
||||
#ifdef GRAPHICS_MENU_OPTIONS
|
||||
MENUPAGE_GRAPHICS_SETTINGS,
|
||||
#endif
|
||||
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
|
||||
#ifdef DETECT_JOYSTICK_MENU
|
||||
MENUPAGE_DETECT_JOYSTICK,
|
||||
#endif
|
||||
|
||||
@@ -275,7 +284,7 @@ enum eMenuAction
|
||||
MENUACTION_DRAWDIST,
|
||||
MENUACTION_MOUSESENS,
|
||||
MENUACTION_MP3VOLUMEBOOST,
|
||||
#ifdef LEGACY_MENU_OPTIONS
|
||||
#ifdef GAMEPAD_MENU
|
||||
MENUACTION_CTRLVIBRATION,
|
||||
MENUACTION_CTRLCONFIG,
|
||||
#endif
|
||||
@@ -668,6 +677,18 @@ public:
|
||||
int8 m_nDisplayMSAALevel;
|
||||
#endif
|
||||
|
||||
#ifdef GAMEPAD_MENU
|
||||
enum
|
||||
{
|
||||
CONTROLLER_DUALSHOCK2 = 0,
|
||||
CONTROLLER_DUALSHOCK3,
|
||||
CONTROLLER_DUALSHOCK4,
|
||||
CONTROLLER_XBOX360,
|
||||
CONTROLLER_XBOXONE,
|
||||
};
|
||||
|
||||
int8 m_PrefsControllerType;
|
||||
#endif
|
||||
enum LANGUAGE
|
||||
{
|
||||
LANGUAGE_AMERICAN,
|
||||
@@ -714,7 +735,7 @@ public:
|
||||
|
||||
#ifdef XBOX_MESSAGE_SCREEN
|
||||
static uint32 m_nDialogHideTimer;
|
||||
static PauseModeTime m_nDialogHideTimerPauseMode;
|
||||
static uint32 m_nDialogHideTimerPauseMode;
|
||||
static bool m_bDialogOpen;
|
||||
static wchar *m_pDialogText;
|
||||
static bool m_bSaveWasSuccessful;
|
||||
@@ -788,6 +809,10 @@ public:
|
||||
int8 GetPreviousPageOption();
|
||||
|
||||
// uint8 GetNumberOfMenuOptions();
|
||||
#ifdef GAMEPAD_MENU
|
||||
void LoadController(int8 type);
|
||||
void PrintController(void);
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifndef IMPROVED_VIDEOMODE
|
||||
|
||||
@@ -779,7 +779,7 @@ TriggerAudio_RadioStation(CMenuMultiChoicePicturedTriggered *widget)
|
||||
if ( CMenuManager::m_PrefsRadioStation != widget->GetMenuSelection() )
|
||||
{
|
||||
CMenuManager::m_PrefsRadioStation = widget->GetMenuSelection();
|
||||
DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1);
|
||||
DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, TRUE);
|
||||
DMAudio.SetRadioInCar(CMenuManager::m_PrefsRadioStation);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2858,7 +2858,7 @@ CMenuManager::ProcessDPadCrossJustDown(void)
|
||||
{
|
||||
if ( !gMusicPlaying )
|
||||
{
|
||||
DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
|
||||
DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, TRUE);
|
||||
gMusicPlaying = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,10 +246,16 @@ CGame::InitialiseRenderWare(void)
|
||||
|
||||
#ifdef LIBRW
|
||||
#ifdef PS2_MATFX
|
||||
rw::MatFX::modulateEnvMap = true;
|
||||
rw::MatFX::envMapApplyLight = true;
|
||||
rw::MatFX::envMapUseMatColor = true;
|
||||
rw::MatFX::envMapFlipU = true;
|
||||
#else
|
||||
rw::MatFX::modulateEnvMap = false;
|
||||
rw::MatFX::envMapApplyLight = false;
|
||||
rw::MatFX::envMapUseMatColor = false;
|
||||
rw::MatFX::envMapFlipU = false;
|
||||
#endif
|
||||
rw::RGBA envcol = { 64, 64, 64, 255 };
|
||||
rw::MatFX::envMapColor = envcol;
|
||||
#else
|
||||
#ifdef PS2_MATFX
|
||||
ReplaceMatFxCallback();
|
||||
@@ -385,6 +391,11 @@ bool CGame::Initialise(const char* datFile)
|
||||
CTxdStore::Create(gameTxdSlot);
|
||||
CTxdStore::AddRef(gameTxdSlot);
|
||||
|
||||
#ifdef EXTENDED_PIPELINES
|
||||
// for generic fallback
|
||||
CustomPipes::SetTxdFindCallback();
|
||||
#endif
|
||||
|
||||
LoadingScreen("Loading the Game", "Loading particles", nil);
|
||||
int particleTxdSlot = CTxdStore::AddTxdSlot("particle");
|
||||
CTxdStore::LoadTxd(particleTxdSlot, "MODELS/PARTICLE.TXD");
|
||||
@@ -444,10 +455,7 @@ bool CGame::Initialise(const char* datFile)
|
||||
|
||||
// CFileLoader::LoadLevel("DATA\\DEFAULT.DAT");
|
||||
CFileLoader::LoadLevel(datFile);
|
||||
#ifdef EXTENDED_PIPELINES
|
||||
// for generic fallback
|
||||
CustomPipes::SetTxdFindCallback();
|
||||
#endif
|
||||
|
||||
LoadingScreen("Loading the Game", "Add Particles", nil);
|
||||
CWorld::AddParticles();
|
||||
CVehicleModelInfo::LoadVehicleColours();
|
||||
@@ -574,7 +582,7 @@ bool CGame::Initialise(const char* datFile)
|
||||
#endif
|
||||
|
||||
|
||||
DMAudio.SetStartingTrackPositions(true);
|
||||
DMAudio.SetStartingTrackPositions(TRUE);
|
||||
DMAudio.ChangeMusicMode(MUSICMODE_GAME);
|
||||
return true;
|
||||
}
|
||||
@@ -596,7 +604,6 @@ bool CGame::ShutDown(void)
|
||||
gPhoneInfo.Shutdown();
|
||||
CWeapon::ShutdownWeapons();
|
||||
CPedType::Shutdown();
|
||||
CMBlur::MotionBlurClose();
|
||||
|
||||
for (int32 i = 0; i < NUMPLAYERS; i++)
|
||||
{
|
||||
@@ -622,7 +629,7 @@ bool CGame::ShutDown(void)
|
||||
CStreaming::Shutdown();
|
||||
CTxdStore::GameShutdown();
|
||||
CCollision::Shutdown();
|
||||
CWaterLevel::DestroyWavyAtomic();
|
||||
CWaterLevel::Shutdown();
|
||||
CRubbish::Shutdown();
|
||||
CClouds::Shutdown();
|
||||
CShadows::Shutdown();
|
||||
@@ -631,6 +638,7 @@ bool CGame::ShutDown(void)
|
||||
CWeaponEffects::Shutdown();
|
||||
CParticle::Shutdown();
|
||||
CPools::ShutDown();
|
||||
CHud::ReInitialise();
|
||||
CTxdStore::RemoveTxdSlot(gameTxdSlot);
|
||||
CMBlur::MotionBlurClose();
|
||||
CdStreamRemoveImages();
|
||||
|
||||
@@ -277,13 +277,6 @@ CMenuScreen aScreens[] = {
|
||||
{ "", 0, 0, },
|
||||
|
||||
#ifdef LEGACY_MENU_OPTIONS
|
||||
// MENUPAGE_CONTROLLER_SETTINGS
|
||||
{ "FET_CON", MENUPAGE_OPTIONS, 0,
|
||||
MENUACTION_CTRLCONFIG, "FEC_CCF", SAVESLOT_NONE, MENUPAGE_CONTROLLER_SETTINGS, 0, 0, 0,
|
||||
MENUACTION_CTRLVIBRATION, "FEC_VIB", SAVESLOT_NONE, MENUPAGE_CONTROLLER_SETTINGS, 0, 0, 0,
|
||||
MENUACTION_GOBACK, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, 0, 0, 0,
|
||||
},
|
||||
|
||||
// MENUPAGE_DEBUG_MENU
|
||||
{ "FED_DBG", MENUPAGE_NONE, 0,
|
||||
MENUACTION_RELOADIDE, "FED_RID", SAVESLOT_NONE, MENUPAGE_NONE, 0, 0, 0,
|
||||
|
||||
@@ -1,4 +1,13 @@
|
||||
#include "common.h"
|
||||
#if defined DETECT_JOYSTICK_MENU && defined XINPUT
|
||||
#include <windows.h>
|
||||
#include <xinput.h>
|
||||
#if !defined(PSAPI_VERSION) || (PSAPI_VERSION > 1)
|
||||
#pragma comment( lib, "Xinput9_1_0.lib" )
|
||||
#else
|
||||
#pragma comment( lib, "Xinput.lib" )
|
||||
#endif
|
||||
#endif
|
||||
#include "platform.h"
|
||||
#include "crossplatform.h"
|
||||
#include "Renderer.h"
|
||||
@@ -69,11 +78,17 @@
|
||||
#endif
|
||||
|
||||
#ifdef INVERT_LOOK_FOR_PAD
|
||||
#define INVERT_PAD_SELECTOR MENUACTION_CFO_SELECT, "FEC_ILU", { new CCFOSelect((int8*)&CPad::bInvertLook4Pad, "Controller", "InvertPad", off_on, 2, false) }, 150, 0, MENUALIGN_LEFT,
|
||||
#define INVERT_PAD_SELECTOR MENUACTION_CFO_SELECT, "FEC_ILU", { new CCFOSelect((int8*)&CPad::bInvertLook4Pad, "Controller", "InvertPad", off_on, 2, false) }, 0, 0, MENUALIGN_LEFT,
|
||||
#else
|
||||
#define INVERT_PAD_SELECTOR
|
||||
#endif
|
||||
|
||||
#ifdef GAMEPAD_MENU
|
||||
#define SELECT_CONTROLLER_TYPE MENUACTION_CFO_SELECT, "FEC_TYP", { new CCFOSelect((int8*)&FrontEndMenuManager.m_PrefsControllerType, "Controller", "Type", controllerTypes, ARRAY_SIZE(controllerTypes), false, ControllerTypeAfterChange) }, 0, 0, MENUALIGN_LEFT,
|
||||
#else
|
||||
#define SELECT_CONTROLLER_TYPE
|
||||
#endif
|
||||
|
||||
const char *filterNames[] = { "FEM_NON", "FEM_SIM", "FEM_NRM", "FEM_MOB" };
|
||||
const char *off_on[] = { "FEM_OFF", "FEM_ON" };
|
||||
|
||||
@@ -166,38 +181,6 @@ void IslandLoadingAfterChange(int8 before, int8 after) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MORE_LANGUAGES
|
||||
void LangPolSelect(int8 action)
|
||||
{
|
||||
if (action == FEOPTION_ACTION_SELECT) {
|
||||
FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_POLISH;
|
||||
FrontEndMenuManager.m_bFrontEnd_ReloadObrTxtGxt = true;
|
||||
FrontEndMenuManager.InitialiseChangedLanguageSettings();
|
||||
FrontEndMenuManager.SaveSettings();
|
||||
}
|
||||
}
|
||||
|
||||
void LangRusSelect(int8 action)
|
||||
{
|
||||
if (action == FEOPTION_ACTION_SELECT) {
|
||||
FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_RUSSIAN;
|
||||
FrontEndMenuManager.m_bFrontEnd_ReloadObrTxtGxt = true;
|
||||
FrontEndMenuManager.InitialiseChangedLanguageSettings();
|
||||
FrontEndMenuManager.SaveSettings();
|
||||
}
|
||||
}
|
||||
|
||||
void LangJapSelect(int8 action)
|
||||
{
|
||||
if (action == FEOPTION_ACTION_SELECT) {
|
||||
FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_JAPANESE;
|
||||
FrontEndMenuManager.m_bFrontEnd_ReloadObrTxtGxt = true;
|
||||
FrontEndMenuManager.InitialiseChangedLanguageSettings();
|
||||
FrontEndMenuManager.SaveSettings();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef MULTISAMPLING
|
||||
void GraphicsGoBack() {
|
||||
}
|
||||
@@ -277,11 +260,13 @@ void ScreenModeAfterChange(int8 before, int8 after)
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
|
||||
#ifdef DETECT_JOYSTICK_MENU
|
||||
wchar selectedJoystickUnicode[128];
|
||||
int cachedButtonNum = -1;
|
||||
|
||||
wchar* DetectJoystickDraw(bool* disabled, bool userHovering) {
|
||||
|
||||
#if defined RW_GL3 && !defined LIBRW_SDL2
|
||||
int numButtons;
|
||||
int found = -1;
|
||||
const char *joyname;
|
||||
@@ -312,6 +297,37 @@ wchar* DetectJoystickDraw(bool* disabled, bool userHovering) {
|
||||
}
|
||||
}
|
||||
if (PSGLOBAL(joy1id) == -1)
|
||||
#elif defined XINPUT
|
||||
int found = -1;
|
||||
XINPUT_STATE xstate;
|
||||
memset(&xstate, 0, sizeof(XINPUT_STATE));
|
||||
if (userHovering) {
|
||||
for (int i = 0; i <= 3; i++) {
|
||||
if (XInputGetState(i, &xstate) == ERROR_SUCCESS) {
|
||||
if (xstate.Gamepad.bLeftTrigger || xstate.Gamepad.bRightTrigger) {
|
||||
found = i;
|
||||
break;
|
||||
}
|
||||
for (int j = XINPUT_GAMEPAD_DPAD_UP; j != XINPUT_GAMEPAD_Y << 1; j = (j << 1)) {
|
||||
if (xstate.Gamepad.wButtons & j) {
|
||||
found = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found != -1)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found != -1 && CPad::XInputJoy1 != found) {
|
||||
// We should never leave pads -1, so we can process them when they're connected and kinda support hotplug.
|
||||
CPad::XInputJoy2 = (CPad::XInputJoy1 == -1 ? (found + 1) % 4 : CPad::XInputJoy1);
|
||||
CPad::XInputJoy1 = found;
|
||||
cachedButtonNum = 0; // fake too, because xinput bypass CControllerConfig
|
||||
}
|
||||
}
|
||||
sprintf(gSelectedJoystickName, "%d", CPad::XInputJoy1); // fake, on xinput we only store gamepad ids(thanks MS) so this is a temp variable to be used below
|
||||
if (CPad::XInputJoy1 == -1)
|
||||
#endif
|
||||
AsciiToUnicode("Not found", selectedJoystickUnicode);
|
||||
else
|
||||
AsciiToUnicode(gSelectedJoystickName, selectedJoystickUnicode);
|
||||
@@ -332,6 +348,14 @@ void DetectJoystickGoBack() {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef GAMEPAD_MENU
|
||||
const char* controllerTypes[] = { "FEC_DS2", "FEC_DS3", "FEC_DS4", "FEC_360", "FEC_ONE" };
|
||||
void ControllerTypeAfterChange(int8 before, int8 after)
|
||||
{
|
||||
FrontEndMenuManager.LoadController(after);
|
||||
}
|
||||
#endif
|
||||
|
||||
CMenuScreenCustom aScreens[] = {
|
||||
// MENUPAGE_STATS = 0
|
||||
{ "FEH_STA", MENUPAGE_NONE, nil, nil,
|
||||
@@ -415,11 +439,6 @@ CMenuScreenCustom aScreens[] = {
|
||||
MENUACTION_LANG_GER, "FEL_GER", {nil, SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS}, 0, 0, MENUALIGN_CENTER,
|
||||
MENUACTION_LANG_ITA, "FEL_ITA", {nil, SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS}, 0, 0, MENUALIGN_CENTER,
|
||||
MENUACTION_LANG_SPA, "FEL_SPA", {nil, SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS}, 0, 0, MENUALIGN_CENTER,
|
||||
#ifdef MORE_LANGUAGES
|
||||
MENUACTION_CFO_DYNAMIC, "FEL_POL", { new CCFODynamic(nil, nil, nil, nil, LangPolSelect) }, 0, 0, MENUALIGN_CENTER,
|
||||
MENUACTION_CFO_DYNAMIC, "FEL_RUS", { new CCFODynamic(nil, nil, nil, nil, LangRusSelect) }, 0, 0, MENUALIGN_CENTER
|
||||
MENUACTION_CFO_DYNAMIC, "FEL_JAP", { new CCFODynamic(nil, nil, nil, nil, LangJapSelect) }, 0, 0, MENUALIGN_CENTER,
|
||||
#endif
|
||||
MENUACTION_GOBACK, "FEDS_TB", {nil, SAVESLOT_NONE, MENUPAGE_NONE}, 0, 0, MENUALIGN_CENTER,
|
||||
},
|
||||
|
||||
@@ -567,11 +586,13 @@ CMenuScreenCustom aScreens[] = {
|
||||
#else
|
||||
MENUACTION_KEYBOARDCTRLS,"FEC_RED", {nil, SAVESLOT_NONE, MENUPAGE_KEYBOARD_CONTROLS}, 320, 150, MENUALIGN_CENTER,
|
||||
#endif
|
||||
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
|
||||
#ifdef GAMEPAD_MENU
|
||||
MENUACTION_CHANGEMENU, "FET_AGS", {nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_SETTINGS}, 0, 0, MENUALIGN_CENTER,
|
||||
#endif
|
||||
#ifdef DETECT_JOYSTICK_MENU
|
||||
MENUACTION_CHANGEMENU, "FEC_JOD", {nil, SAVESLOT_NONE, MENUPAGE_DETECT_JOYSTICK}, 0, 0, MENUALIGN_CENTER,
|
||||
#endif
|
||||
MENUACTION_CHANGEMENU, "FEC_MOU", {nil, SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS}, 0, 0, MENUALIGN_CENTER,
|
||||
INVERT_PAD_SELECTOR
|
||||
MENUACTION_RESTOREDEF, "FET_DEF", {nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC}, 320, 0, MENUALIGN_CENTER,
|
||||
MENUACTION_GOBACK, "FEDS_TB", {nil, SAVESLOT_NONE, 0}, 320, 0, MENUALIGN_CENTER,
|
||||
},
|
||||
@@ -582,7 +603,7 @@ CMenuScreenCustom aScreens[] = {
|
||||
MENUACTION_LOADRADIO, "FEO_AUD", {nil, SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS}, 0, 0, MENUALIGN_CENTER,
|
||||
MENUACTION_CHANGEMENU, "FEO_DIS", {nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS}, 0, 0, MENUALIGN_CENTER,
|
||||
#ifdef GRAPHICS_MENU_OPTIONS
|
||||
MENUACTION_CHANGEMENU, "FET_GRA", {nil, SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS}, 0, 0, MENUALIGN_CENTER,
|
||||
MENUACTION_CHANGEMENU, "FET_GFX", {nil, SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS}, 0, 0, MENUALIGN_CENTER,
|
||||
#endif
|
||||
MENUACTION_CHANGEMENU, "FEO_LAN", {nil, SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS}, 0, 0, MENUALIGN_CENTER,
|
||||
MENUACTION_PLAYERSETUP, "FET_PS", {nil, SAVESLOT_NONE, MENUPAGE_SKIN_SELECT}, 0, 0, MENUALIGN_CENTER,
|
||||
@@ -611,8 +632,12 @@ CMenuScreenCustom aScreens[] = {
|
||||
{ "FEC_MOU", MENUPAGE_CONTROLLER_PC, nil, nil,
|
||||
MENUACTION_MOUSESENS, "FEC_MSH", {nil, SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS}, 40, 170, MENUALIGN_LEFT,
|
||||
MENUACTION_INVVERT, "FEC_IVV", {nil, SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS}, 0, 0, MENUALIGN_LEFT,
|
||||
#ifndef GAMEPAD_MENU
|
||||
INVERT_PAD_SELECTOR
|
||||
#endif
|
||||
MENUACTION_MOUSESTEER, "FET_MST", {nil, SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS}, 0, 0, MENUALIGN_LEFT,
|
||||
MENUACTION_GOBACK, "FEDS_TB", {nil, SAVESLOT_NONE, 0}, 320, 260, MENUALIGN_CENTER,
|
||||
MENUACTION_GOBACK, "FEDS_TB", {nil, SAVESLOT_NONE, 0}, 320, 0, MENUALIGN_CENTER,
|
||||
//MENUACTION_GOBACK, "FEDS_TB", {nil, SAVESLOT_NONE, 0}, 320, 260, MENUALIGN_CENTER, // original y
|
||||
},
|
||||
|
||||
// MENUPAGE_PAUSE_MENU = 32
|
||||
@@ -629,15 +654,17 @@ CMenuScreenCustom aScreens[] = {
|
||||
// MENUPAGE_NONE = 33
|
||||
{ "", 0, nil, nil, },
|
||||
|
||||
|
||||
#ifdef GAMEPAD_MENU
|
||||
{ "FET_AGS", MENUPAGE_CONTROLLER_PC, new CCustomScreenLayout({40, 78, 25, true, true}), nil,
|
||||
MENUACTION_CTRLCONFIG, "FEC_CCF", { nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_SETTINGS }, 40, 76, MENUALIGN_LEFT,
|
||||
MENUACTION_CTRLDISPLAY, "FEC_CDP", { nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_SETTINGS }, 0, 0, MENUALIGN_LEFT,
|
||||
INVERT_PAD_SELECTOR
|
||||
MENUACTION_CTRLVIBRATION, "FEC_VIB", { nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_SETTINGS }, 0, 0, MENUALIGN_LEFT,
|
||||
SELECT_CONTROLLER_TYPE
|
||||
MENUACTION_GOBACK, "FEDS_TB", { nil, SAVESLOT_NONE, MENUPAGE_NONE }, 0, 0, MENUALIGN_LEFT,
|
||||
},
|
||||
#endif
|
||||
#ifdef LEGACY_MENU_OPTIONS
|
||||
// MENUPAGE_CONTROLLER_SETTINGS = 4
|
||||
{ "FET_CON", MENUPAGE_OPTIONS, nil, nil,
|
||||
MENUACTION_CTRLCONFIG, "FEC_CCF", {nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_SETTINGS}, 0, 0, 0,
|
||||
MENUACTION_CTRLVIBRATION, "FEC_VIB", {nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_SETTINGS}, 0, 0, 0,
|
||||
MENUACTION_GOBACK, "FEDS_TB", {nil, SAVESLOT_NONE, MENUPAGE_NONE}, 0, 0, 0,
|
||||
},
|
||||
|
||||
// MENUPAGE_DEBUG_MENU = 18
|
||||
{ "FED_DBG", MENUPAGE_NONE, nil, nil,
|
||||
MENUACTION_RELOADIDE, "FED_RID", {nil, SAVESLOT_NONE, MENUPAGE_NONE}, 0, 0, 0,
|
||||
@@ -692,7 +719,7 @@ CMenuScreenCustom aScreens[] = {
|
||||
|
||||
#ifdef GRAPHICS_MENU_OPTIONS
|
||||
// MENUPAGE_GRAPHICS_SETTINGS
|
||||
{ "FET_GRA", MENUPAGE_OPTIONS, new CCustomScreenLayout({40, 78, 25, true, true}), GraphicsGoBack,
|
||||
{ "FET_GFX", MENUPAGE_OPTIONS, new CCustomScreenLayout({40, 78, 25, true, true}), GraphicsGoBack,
|
||||
|
||||
MENUACTION_SCREENRES, "FED_RES", { nil, SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS }, 0, 0, MENUALIGN_LEFT,
|
||||
MENUACTION_WIDESCREEN, "FED_WIS", { nil, SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS }, 0, 0, MENUALIGN_LEFT,
|
||||
@@ -715,7 +742,7 @@ CMenuScreenCustom aScreens[] = {
|
||||
},
|
||||
#endif
|
||||
|
||||
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
|
||||
#ifdef DETECT_JOYSTICK_MENU
|
||||
// MENUPAGE_DETECT_JOYSTICK
|
||||
{ "FEC_JOD", MENUPAGE_CONTROLLER_PC, new CCustomScreenLayout({0, 0, 0, false, false, 30}), DetectJoystickGoBack,
|
||||
MENUACTION_LABEL, "FEC_JPR", { nil, SAVESLOT_NONE, MENUPAGE_NONE }, 0, 0, 0,
|
||||
|
||||
@@ -1594,8 +1594,14 @@ void CPad::AddToPCCheatString(char c)
|
||||
}
|
||||
|
||||
#ifdef XINPUT
|
||||
int CPad::XInputJoy1 = 0;
|
||||
int CPad::XInputJoy2 = 1;
|
||||
void CPad::AffectFromXinput(uint32 pad)
|
||||
{
|
||||
pad = pad == 0 ? XInputJoy1 : XInputJoy2;
|
||||
if (pad == -1) // LoadINIControllerSettings can set it to -1
|
||||
return;
|
||||
|
||||
XINPUT_STATE xstate;
|
||||
memset(&xstate, 0, sizeof(XINPUT_STATE));
|
||||
if (XInputGetState(pad, &xstate) == ERROR_SUCCESS)
|
||||
|
||||
@@ -288,6 +288,8 @@ public:
|
||||
int16 GetSkipCutscene() { return GetCrossJustDown(); }
|
||||
|
||||
#ifdef XINPUT
|
||||
static int XInputJoy1;
|
||||
static int XInputJoy2;
|
||||
void AffectFromXinput(uint32 pad);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -2,12 +2,13 @@
|
||||
|
||||
class CPlaceable
|
||||
{
|
||||
protected:
|
||||
CMatrix m_matrix;
|
||||
|
||||
public:
|
||||
// disable allocation
|
||||
static void *operator new(size_t);
|
||||
|
||||
CMatrix m_matrix;
|
||||
|
||||
CPlaceable(void);
|
||||
const CVector &GetPosition(void) { return m_matrix.GetPosition(); }
|
||||
void SetPosition(float x, float y, float z) {
|
||||
@@ -20,6 +21,7 @@ public:
|
||||
CVector &GetForward(void) { return m_matrix.GetForward(); }
|
||||
CVector &GetUp(void) { return m_matrix.GetUp(); }
|
||||
CMatrix &GetMatrix(void) { return m_matrix; }
|
||||
void SetMatrix(CMatrix &newMatrix) { m_matrix = newMatrix; }
|
||||
void SetTransform(RwMatrix *m) { m_matrix = CMatrix(m, false); }
|
||||
void SetHeading(float angle);
|
||||
void SetOrientation(float x, float y, float z){
|
||||
|
||||
@@ -105,7 +105,7 @@ CPools::CheckPoolsEmpty()
|
||||
printf("pools have been cleared\n");
|
||||
}
|
||||
|
||||
|
||||
// Thankfully unused, it would break the game!
|
||||
void
|
||||
CPools::MakeSureSlotInObjectPoolIsEmpty(int32 slot)
|
||||
{
|
||||
|
||||
@@ -239,6 +239,75 @@ void GetTextureCorners(int32 x, int32 y, CVector2D *out)
|
||||
out[3].y = RADAR_TILE_SIZE * (y);
|
||||
}
|
||||
|
||||
uint8 CRadar::CalculateBlipAlpha(float dist)
|
||||
{
|
||||
if (FrontEndMenuManager.m_bMenuMapActive)
|
||||
return 255;
|
||||
|
||||
if (dist <= 1.0f)
|
||||
return 255;
|
||||
|
||||
if (dist <= 10.0f)
|
||||
return (128.0f * ((dist - 1.0f) / 9.0f)) + ((1.0f - (dist - 1.0f) / 9.0f) * 255.0f);
|
||||
|
||||
return 128;
|
||||
}
|
||||
|
||||
void CRadar::ChangeBlipBrightness(int32 i, int32 bright)
|
||||
{
|
||||
int index = GetActualBlipArrayIndex(i);
|
||||
if (index != -1)
|
||||
ms_RadarTrace[index].m_bDim = bright != 1;
|
||||
}
|
||||
|
||||
void CRadar::ChangeBlipColour(int32 i, int32 color)
|
||||
{
|
||||
int index = GetActualBlipArrayIndex(i);
|
||||
if (index != -1)
|
||||
ms_RadarTrace[index].m_nColor = color;
|
||||
}
|
||||
|
||||
void CRadar::ChangeBlipDisplay(int32 i, eBlipDisplay display)
|
||||
{
|
||||
int index = GetActualBlipArrayIndex(i);
|
||||
if (index != -1)
|
||||
ms_RadarTrace[index].m_eBlipDisplay = display;
|
||||
}
|
||||
|
||||
void CRadar::ChangeBlipScale(int32 i, int32 scale)
|
||||
{
|
||||
int index = GetActualBlipArrayIndex(i);
|
||||
if (index != -1)
|
||||
ms_RadarTrace[index].m_wScale = scale;
|
||||
}
|
||||
|
||||
void CRadar::ClearBlip(int32 i)
|
||||
{
|
||||
int index = GetActualBlipArrayIndex(i);
|
||||
if (index != -1) {
|
||||
SetRadarMarkerState(index, false);
|
||||
ms_RadarTrace[index].m_bInUse = false;
|
||||
ms_RadarTrace[index].m_eBlipType = BLIP_NONE;
|
||||
ms_RadarTrace[index].m_eBlipDisplay = BLIP_DISPLAY_NEITHER;
|
||||
ms_RadarTrace[index].m_eRadarSprite = RADAR_SPRITE_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
void CRadar::ClearBlipForEntity(eBlipType type, int32 id)
|
||||
{
|
||||
for (int i = 0; i < NUMRADARBLIPS; i++) {
|
||||
if (type == ms_RadarTrace[i].m_eBlipType && id == ms_RadarTrace[i].m_nEntityHandle) {
|
||||
SetRadarMarkerState(i, false);
|
||||
ms_RadarTrace[i].m_bInUse = false;
|
||||
ms_RadarTrace[i].m_eBlipType = BLIP_NONE;
|
||||
ms_RadarTrace[i].m_eBlipDisplay = BLIP_DISPLAY_NEITHER;
|
||||
ms_RadarTrace[i].m_eRadarSprite = RADAR_SPRITE_NONE;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Why not a proper clipping algorithm?
|
||||
#ifdef THIS_IS_STUPID
|
||||
|
||||
bool IsPointInsideRadar(const CVector2D &point)
|
||||
{
|
||||
@@ -319,74 +388,6 @@ int LineRadarBoxCollision(CVector2D &out, const CVector2D &p1, const CVector2D &
|
||||
return edge;
|
||||
}
|
||||
|
||||
uint8 CRadar::CalculateBlipAlpha(float dist)
|
||||
{
|
||||
if (FrontEndMenuManager.m_bMenuMapActive)
|
||||
return 255;
|
||||
|
||||
if (dist <= 1.0f)
|
||||
return 255;
|
||||
|
||||
if (dist <= 10.0f)
|
||||
return (128.0f * ((dist - 1.0f) / 9.0f)) + ((1.0f - (dist - 1.0f) / 9.0f) * 255.0f);
|
||||
|
||||
return 128;
|
||||
}
|
||||
|
||||
void CRadar::ChangeBlipBrightness(int32 i, int32 bright)
|
||||
{
|
||||
int index = GetActualBlipArrayIndex(i);
|
||||
if (index != -1)
|
||||
ms_RadarTrace[index].m_bDim = bright != 1;
|
||||
}
|
||||
|
||||
void CRadar::ChangeBlipColour(int32 i, int32 color)
|
||||
{
|
||||
int index = GetActualBlipArrayIndex(i);
|
||||
if (index != -1)
|
||||
ms_RadarTrace[index].m_nColor = color;
|
||||
}
|
||||
|
||||
void CRadar::ChangeBlipDisplay(int32 i, eBlipDisplay display)
|
||||
{
|
||||
int index = GetActualBlipArrayIndex(i);
|
||||
if (index != -1)
|
||||
ms_RadarTrace[index].m_eBlipDisplay = display;
|
||||
}
|
||||
|
||||
void CRadar::ChangeBlipScale(int32 i, int32 scale)
|
||||
{
|
||||
int index = GetActualBlipArrayIndex(i);
|
||||
if (index != -1)
|
||||
ms_RadarTrace[index].m_wScale = scale;
|
||||
}
|
||||
|
||||
void CRadar::ClearBlip(int32 i)
|
||||
{
|
||||
int index = GetActualBlipArrayIndex(i);
|
||||
if (index != -1) {
|
||||
SetRadarMarkerState(index, false);
|
||||
ms_RadarTrace[index].m_bInUse = false;
|
||||
ms_RadarTrace[index].m_eBlipType = BLIP_NONE;
|
||||
ms_RadarTrace[index].m_eBlipDisplay = BLIP_DISPLAY_NEITHER;
|
||||
ms_RadarTrace[index].m_eRadarSprite = RADAR_SPRITE_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
void CRadar::ClearBlipForEntity(eBlipType type, int32 id)
|
||||
{
|
||||
for (int i = 0; i < NUMRADARBLIPS; i++) {
|
||||
if (type == ms_RadarTrace[i].m_eBlipType && id == ms_RadarTrace[i].m_nEntityHandle) {
|
||||
SetRadarMarkerState(i, false);
|
||||
ms_RadarTrace[i].m_bInUse = false;
|
||||
ms_RadarTrace[i].m_eBlipType = BLIP_NONE;
|
||||
ms_RadarTrace[i].m_eBlipDisplay = BLIP_DISPLAY_NEITHER;
|
||||
ms_RadarTrace[i].m_eRadarSprite = RADAR_SPRITE_NONE;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Why not a proper clipping algorithm?
|
||||
int CRadar::ClipRadarPoly(CVector2D *poly, const CVector2D *rect)
|
||||
{
|
||||
CVector2D corners[4] = {
|
||||
@@ -465,6 +466,50 @@ int CRadar::ClipRadarPoly(CVector2D *poly, const CVector2D *rect)
|
||||
|
||||
return n;
|
||||
}
|
||||
#else
|
||||
|
||||
int
|
||||
ClipPolyPlane(const CVector2D *in, int nin, CVector2D *out, CVector *plane)
|
||||
{
|
||||
int j;
|
||||
int nout;
|
||||
int x1, x2;
|
||||
float d1, d2, t;
|
||||
|
||||
nout = 0;
|
||||
for(j = 0; j < nin; j++){
|
||||
x1 = j;
|
||||
x2 = (j+1) % nin;
|
||||
|
||||
d1 = plane->x*in[x1].x + plane->y*in[x1].y + plane->z;
|
||||
d2 = plane->x*in[x2].x + plane->y*in[x2].y + plane->z;
|
||||
if(d1*d2 < 0.0f){
|
||||
t = d1/(d1 - d2);
|
||||
out[nout++] = in[x1]*(1.0f-t) + in[x2]*t;
|
||||
}
|
||||
if(d2 >= 0.0f)
|
||||
out[nout++] = in[x2];
|
||||
}
|
||||
return nout;
|
||||
}
|
||||
|
||||
int CRadar::ClipRadarPoly(CVector2D *poly, const CVector2D *rect)
|
||||
{
|
||||
CVector planes[4] = {
|
||||
CVector(-1.0f, 0.0f, 1.0f),
|
||||
CVector( 1.0f, 0.0f, 1.0f),
|
||||
CVector(0.0f, -1.0f, 1.0f),
|
||||
CVector(0.0f, 1.0f, 1.0f)
|
||||
};
|
||||
CVector2D tmp[8];
|
||||
int n;
|
||||
if(n = ClipPolyPlane(rect, 4, tmp, &planes[0]), n == 0) return 0;
|
||||
if(n = ClipPolyPlane(tmp, n, poly, &planes[1]), n == 0) return 0;
|
||||
if(n = ClipPolyPlane(poly, n, tmp, &planes[2]), n == 0) return 0;
|
||||
if(n = ClipPolyPlane(tmp, n, poly, &planes[3]), n == 0) return 0;
|
||||
return n;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool CRadar::DisplayThisBlip(int32 counter)
|
||||
{
|
||||
@@ -488,7 +533,7 @@ void CRadar::Draw3dMarkers()
|
||||
if (ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY) {
|
||||
CVector pos = entity->GetPosition();
|
||||
pos.z += 1.2f * CModelInfo::GetModelInfo(entity->GetModelIndex())->GetColModel()->boundingBox.max.z + 2.5f;
|
||||
C3dMarkers::PlaceMarker(i | (ms_RadarTrace[i].m_BlipIndex << 16), 1, pos, 2.5f, CARBLIP_MARKER_COLOR_R, CARBLIP_MARKER_COLOR_G, CARBLIP_MARKER_COLOR_B, CARBLIP_MARKER_COLOR_A, 1024, 0.2f, 5);
|
||||
C3dMarkers::PlaceMarker(i | (ms_RadarTrace[i].m_BlipIndex << 16), MARKERTYPE_ARROW, pos, 2.5f, CARBLIP_MARKER_COLOR_R, CARBLIP_MARKER_COLOR_G, CARBLIP_MARKER_COLOR_B, CARBLIP_MARKER_COLOR_A, 1024, 0.2f, 5);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -502,7 +547,7 @@ void CRadar::Draw3dMarkers()
|
||||
if (ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY) {
|
||||
CVector pos = entity->GetPosition();
|
||||
pos.z += 3.0f;
|
||||
C3dMarkers::PlaceMarker(i | (ms_RadarTrace[i].m_BlipIndex << 16), 1, pos, 1.5f, CHARBLIP_MARKER_COLOR_R, CHARBLIP_MARKER_COLOR_G, CHARBLIP_MARKER_COLOR_B, CHARBLIP_MARKER_COLOR_A, 1024, 0.2f, 5);
|
||||
C3dMarkers::PlaceMarker(i | (ms_RadarTrace[i].m_BlipIndex << 16), MARKERTYPE_ARROW, pos, 1.5f, CHARBLIP_MARKER_COLOR_R, CHARBLIP_MARKER_COLOR_G, CHARBLIP_MARKER_COLOR_B, CHARBLIP_MARKER_COLOR_A, 1024, 0.2f, 5);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -512,7 +557,7 @@ void CRadar::Draw3dMarkers()
|
||||
if (ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY) {
|
||||
CVector pos = entity->GetPosition();
|
||||
pos.z += CModelInfo::GetModelInfo(entity->GetModelIndex())->GetColModel()->boundingBox.max.z + 1.0f + 1.0f;
|
||||
C3dMarkers::PlaceMarker(i | (ms_RadarTrace[i].m_BlipIndex << 16), 1, pos, 1.0f, OBJECTBLIP_MARKER_COLOR_R, OBJECTBLIP_MARKER_COLOR_G, OBJECTBLIP_MARKER_COLOR_B, OBJECTBLIP_MARKER_COLOR_A, 1024, 0.2f, 5);
|
||||
C3dMarkers::PlaceMarker(i | (ms_RadarTrace[i].m_BlipIndex << 16), MARKERTYPE_ARROW, pos, 1.0f, OBJECTBLIP_MARKER_COLOR_R, OBJECTBLIP_MARKER_COLOR_G, OBJECTBLIP_MARKER_COLOR_B, OBJECTBLIP_MARKER_COLOR_A, 1024, 0.2f, 5);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -521,7 +566,7 @@ void CRadar::Draw3dMarkers()
|
||||
case BLIP_CONTACT_POINT:
|
||||
if (!CTheScripts::IsPlayerOnAMission()) {
|
||||
if (ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY)
|
||||
C3dMarkers::PlaceMarkerSet(i | (ms_RadarTrace[i].m_BlipIndex << 16), 4, ms_RadarTrace[i].m_vecPos, 2.0f, COORDBLIP_MARKER_COLOR_R, COORDBLIP_MARKER_COLOR_G, COORDBLIP_MARKER_COLOR_B, COORDBLIP_MARKER_COLOR_A, 2048, 0.2f, 0);
|
||||
C3dMarkers::PlaceMarkerSet(i | (ms_RadarTrace[i].m_BlipIndex << 16), MARKERTYPE_CYLINDER, ms_RadarTrace[i].m_vecPos, 2.0f, COORDBLIP_MARKER_COLOR_R, COORDBLIP_MARKER_COLOR_G, COORDBLIP_MARKER_COLOR_B, COORDBLIP_MARKER_COLOR_A, 2048, 0.2f, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -879,7 +924,7 @@ int32 CRadar::GetNewUniqueBlipIndex(int32 i)
|
||||
|
||||
uint32 CRadar::GetRadarTraceColour(uint32 color, bool bright)
|
||||
{
|
||||
int32 c;
|
||||
uint32 c;
|
||||
switch (color) {
|
||||
case RADAR_TRACE_RED:
|
||||
if (bright)
|
||||
@@ -1458,7 +1503,7 @@ CRadar::InitFrontEndMap()
|
||||
void
|
||||
CRadar::DrawYouAreHereSprite(float x, float y)
|
||||
{
|
||||
static PauseModeTime lastChange = 0;
|
||||
static uint32 lastChange = 0;
|
||||
static bool show = true;
|
||||
|
||||
if (show) {
|
||||
@@ -1658,7 +1703,7 @@ void
|
||||
CRadar::DrawLegend(int32 x, int32 y, int32 sprite)
|
||||
{
|
||||
if (sprite < 0) {
|
||||
static PauseModeTime lastChange = 0;
|
||||
static uint32 lastChange = 0;
|
||||
static int8 blipMode = 0;
|
||||
|
||||
CRGBA color;
|
||||
|
||||
@@ -39,9 +39,7 @@ CEntity::RegisterReference(CEntity **pent)
|
||||
ref->pentity = pent;
|
||||
ref->next = m_pFirstReference;
|
||||
m_pFirstReference = ref;
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Clean up the reference from *pent -> 'this'
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "common.h"
|
||||
|
||||
#include "main.h"
|
||||
#include "Timer.h"
|
||||
#include "ModelIndices.h"
|
||||
#include "Streaming.h"
|
||||
@@ -91,9 +92,11 @@ void
|
||||
CRopes::Render(void)
|
||||
{
|
||||
int i;
|
||||
PUSH_RENDERGROUP("CRopes::Render");
|
||||
for(i = 0; i < ARRAY_SIZE(aRopes); i++)
|
||||
if(aRopes[i].m_bActive)
|
||||
aRopes[i].Render();
|
||||
POP_RENDERGROUP();
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -167,7 +170,7 @@ CRopes::CreateRopeWithSwatComingDown(CVector pos)
|
||||
swat->bUsesCollision = false;
|
||||
swat->m_pRopeEntity = (CEntity*)1;
|
||||
swat->m_nRopeID = 100 + ropeId;
|
||||
CAnimManager::BlendAnimation(swat->GetClump(), ASSOCGRP_STD, ANIM_ABSEIL, 4.0f);
|
||||
CAnimManager::BlendAnimation(swat->GetClump(), ASSOCGRP_STD, ANIM_STD_ABSEIL, 4.0f);
|
||||
ropeId++;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -214,11 +214,15 @@ CStreaming::Init2(void)
|
||||
|
||||
// allocate streaming buffers
|
||||
if(ms_streamingBufferSize & 1) ms_streamingBufferSize++;
|
||||
#ifndef ONE_THREAD_PER_CHANNEL
|
||||
ms_pStreamingBuffer[0] = (int8*)RwMallocAlign(ms_streamingBufferSize*CDSTREAM_SECTOR_SIZE, CDSTREAM_SECTOR_SIZE);
|
||||
ms_streamingBufferSize /= 2;
|
||||
ms_pStreamingBuffer[1] = ms_pStreamingBuffer[0] + ms_streamingBufferSize*CDSTREAM_SECTOR_SIZE;
|
||||
#ifdef ONE_THREAD_PER_CHANNEL
|
||||
ms_pStreamingBuffer[2] = (int8*)RwMallocAlign(ms_streamingBufferSize*2*CDSTREAM_SECTOR_SIZE, CDSTREAM_SECTOR_SIZE);
|
||||
#else
|
||||
ms_pStreamingBuffer[0] = (int8*)RwMallocAlign(ms_streamingBufferSize*2*CDSTREAM_SECTOR_SIZE, CDSTREAM_SECTOR_SIZE);
|
||||
ms_streamingBufferSize /= 2;
|
||||
ms_pStreamingBuffer[1] = ms_pStreamingBuffer[0] + ms_streamingBufferSize*CDSTREAM_SECTOR_SIZE;
|
||||
ms_pStreamingBuffer[2] = ms_pStreamingBuffer[1] + ms_streamingBufferSize*CDSTREAM_SECTOR_SIZE;
|
||||
ms_pStreamingBuffer[3] = ms_pStreamingBuffer[2] + ms_streamingBufferSize*CDSTREAM_SECTOR_SIZE;
|
||||
#endif
|
||||
debug("Streaming buffer size is %d sectors", ms_streamingBufferSize);
|
||||
@@ -1759,7 +1763,13 @@ CStreaming::StreamVehiclesAndPeds(void)
|
||||
for(i = 0; i < CCarCtrl::TOTAL_CUSTOM_CLASSES; i++){
|
||||
if(CCarCtrl::NumRequestsOfCarRating[i] > maxReq &&
|
||||
((i == 0 && zone.carThreshold[0] != 0) ||
|
||||
#ifdef FIX_BUGS
|
||||
(i < CCarCtrl::NUM_CAR_CLASSES && zone.carThreshold[i] != zone.carThreshold[i-1]) ||
|
||||
(i == CCarCtrl::NUM_CAR_CLASSES && zone.boatThreshold[i - CCarCtrl::NUM_CAR_CLASSES] != 0) ||
|
||||
(i > CCarCtrl::NUM_CAR_CLASSES && i < CCarCtrl::TOTAL_CUSTOM_CLASSES && zone.boatThreshold[i - CCarCtrl::NUM_CAR_CLASSES] != zone.boatThreshold[i - CCarCtrl::NUM_CAR_CLASSES - 1]))) {
|
||||
#else
|
||||
(i != 0 && zone.carThreshold[i] != zone.carThreshold[i-1]))) {
|
||||
#endif
|
||||
maxReq = CCarCtrl::NumRequestsOfCarRating[i];
|
||||
mostRequestedRating = i;
|
||||
}
|
||||
@@ -1902,8 +1912,7 @@ CStreaming::RemoveCurrentZonesModels(void)
|
||||
if (ms_currentPedGrp != -1)
|
||||
for (i = 0; i < NUMMODELSPERPEDGROUP; i++) {
|
||||
ms_bIsPedFromPedGroupLoaded[i] = false;
|
||||
if (CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i] != -1 &&
|
||||
CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i] != MI_MALE01) {
|
||||
if (CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i] != -1) {
|
||||
SetModelIsDeletable(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i]);
|
||||
SetModelTxdIsDeletable(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i]);
|
||||
}
|
||||
@@ -2344,9 +2353,10 @@ CStreaming::LoadRequestedModels(void)
|
||||
}
|
||||
|
||||
|
||||
// Let's load models first, then process it. Unfortunately processing models are still single-threaded.
|
||||
// Let's load models in 4 threads; when one of them becomes idle, process the file, and fill thread with another file. Unfortunately processing models are still single-threaded.
|
||||
// Currently only supported on POSIX streamer.
|
||||
#ifdef ONE_THREAD_PER_CHANNEL
|
||||
// WIP - some files are loaded swapped (CdStreamPosix problem?)
|
||||
#if 0 //def ONE_THREAD_PER_CHANNEL
|
||||
void
|
||||
CStreaming::LoadAllRequestedModels(bool priority)
|
||||
{
|
||||
@@ -2365,14 +2375,18 @@ CStreaming::LoadAllRequestedModels(bool priority)
|
||||
int streamIds[ARRAY_SIZE(ms_pStreamingBuffer)];
|
||||
int streamSizes[ARRAY_SIZE(ms_pStreamingBuffer)];
|
||||
int streamPoses[ARRAY_SIZE(ms_pStreamingBuffer)];
|
||||
bool first = true;
|
||||
int readOrder[4] = {-1}; // Channel IDs ordered by read time
|
||||
int readI = 0;
|
||||
int processI = 0;
|
||||
bool first = true;
|
||||
|
||||
// All those "first" checks are because of variables aren't initialized in first pass.
|
||||
|
||||
while (true) {
|
||||
// Enumerate files and start reading
|
||||
for (int i=0; i<ARRAY_SIZE(ms_pStreamingBuffer); i++) {
|
||||
|
||||
// Channel has file to load
|
||||
if (!first && streamIds[i] != -1) {
|
||||
processI = i;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -2385,12 +2399,16 @@ CStreaming::LoadAllRequestedModels(bool priority)
|
||||
|
||||
if (ms_aInfoForModel[streamId].GetCdPosnAndSize(posn, size)) {
|
||||
streamIds[i] = -1;
|
||||
|
||||
// Big file, needs 2 buffer
|
||||
if (size > (uint32)ms_streamingBufferSize) {
|
||||
if (i + 1 == ARRAY_SIZE(ms_pStreamingBuffer))
|
||||
continue;
|
||||
break;
|
||||
else if (!first && streamIds[i+1] != -1)
|
||||
continue;
|
||||
|
||||
} else {
|
||||
// Buffer of current channel is part of a "big file", pass
|
||||
if (i != 0 && streamIds[i-1] != -1 && streamSizes[i-1] > (uint32)ms_streamingBufferSize)
|
||||
continue;
|
||||
}
|
||||
@@ -2400,8 +2418,18 @@ CStreaming::LoadAllRequestedModels(bool priority)
|
||||
streamIds[i] = streamId;
|
||||
streamSizes[i] = size;
|
||||
streamPoses[i] = posn;
|
||||
|
||||
if (!first)
|
||||
assert(readOrder[readI] == -1);
|
||||
|
||||
//printf("read: order %d, ch %d, id %d, size %d\n", readI, i, streamId, size);
|
||||
|
||||
CdStreamRead(i, ms_pStreamingBuffer[i], imgOffset+posn, size);
|
||||
processI = i;
|
||||
readOrder[readI] = i;
|
||||
if (first && readI+1 != ARRAY_SIZE(readOrder))
|
||||
readOrder[readI+1] = -1;
|
||||
|
||||
readI = (readI + 1) % ARRAY_SIZE(readOrder);
|
||||
} else {
|
||||
ms_aInfoForModel[streamId].RemoveFromList();
|
||||
DecrementRef(streamId);
|
||||
@@ -2409,33 +2437,40 @@ CStreaming::LoadAllRequestedModels(bool priority)
|
||||
ms_aInfoForModel[streamId].m_loadState = STREAMSTATE_LOADED;
|
||||
streamIds[i] = -1;
|
||||
}
|
||||
} else
|
||||
} else {
|
||||
streamIds[i] = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
first = false;
|
||||
int nextChannel = readOrder[processI];
|
||||
|
||||
// Now process
|
||||
if (streamIds[processI] == -1)
|
||||
// Now start processing
|
||||
if (nextChannel == -1 || streamIds[nextChannel] == -1)
|
||||
break;
|
||||
|
||||
// Try again on error
|
||||
while (CdStreamSync(processI) != STREAM_NONE) {
|
||||
CdStreamRead(processI, ms_pStreamingBuffer[processI], imgOffset+streamPoses[processI], streamSizes[processI]);
|
||||
}
|
||||
ms_aInfoForModel[streamIds[processI]].m_loadState = STREAMSTATE_READING;
|
||||
|
||||
MakeSpaceFor(streamSizes[processI] * CDSTREAM_SECTOR_SIZE);
|
||||
ConvertBufferToObject(ms_pStreamingBuffer[processI], streamIds[processI]);
|
||||
if(ms_aInfoForModel[streamIds[processI]].m_loadState == STREAMSTATE_STARTED)
|
||||
FinishLoadingLargeFile(ms_pStreamingBuffer[processI], streamIds[processI]);
|
||||
//printf("process: order %d, ch %d, id %d\n", processI, nextChannel, streamIds[nextChannel]);
|
||||
|
||||
if(streamIds[processI] < STREAM_OFFSET_TXD){
|
||||
CSimpleModelInfo *mi = (CSimpleModelInfo*)CModelInfo::GetModelInfo(streamIds[processI]);
|
||||
// Try again on error
|
||||
while (CdStreamSync(nextChannel) != STREAM_NONE) {
|
||||
CdStreamRead(nextChannel, ms_pStreamingBuffer[nextChannel], imgOffset+streamPoses[nextChannel], streamSizes[nextChannel]);
|
||||
}
|
||||
ms_aInfoForModel[streamIds[nextChannel]].m_loadState = STREAMSTATE_READING;
|
||||
|
||||
MakeSpaceFor(streamSizes[nextChannel] * CDSTREAM_SECTOR_SIZE);
|
||||
ConvertBufferToObject(ms_pStreamingBuffer[nextChannel], streamIds[nextChannel]);
|
||||
if(ms_aInfoForModel[streamIds[nextChannel]].m_loadState == STREAMSTATE_STARTED)
|
||||
FinishLoadingLargeFile(ms_pStreamingBuffer[nextChannel], streamIds[nextChannel]);
|
||||
|
||||
if(streamIds[nextChannel] < STREAM_OFFSET_TXD){
|
||||
CSimpleModelInfo *mi = (CSimpleModelInfo*)CModelInfo::GetModelInfo(streamIds[nextChannel]);
|
||||
if(mi->IsSimple())
|
||||
mi->m_alpha = 255;
|
||||
}
|
||||
streamIds[processI] = -1;
|
||||
streamIds[nextChannel] = -1;
|
||||
readOrder[processI] = -1;
|
||||
processI = (processI + 1) % ARRAY_SIZE(readOrder);
|
||||
}
|
||||
|
||||
ms_bLoadingBigModel = false;
|
||||
@@ -2482,7 +2517,7 @@ CStreaming::LoadAllRequestedModels(bool priority)
|
||||
status = CdStreamRead(0, ms_pStreamingBuffer[0], imgOffset+posn, size);
|
||||
while(CdStreamSync(0) || status == STREAM_NONE);
|
||||
ms_aInfoForModel[streamId].m_loadState = STREAMSTATE_READING;
|
||||
|
||||
|
||||
MakeSpaceFor(size * CDSTREAM_SECTOR_SIZE);
|
||||
ConvertBufferToObject(ms_pStreamingBuffer[0], streamId);
|
||||
if(ms_aInfoForModel[streamId].m_loadState == STREAMSTATE_STARTED)
|
||||
@@ -2539,7 +2574,7 @@ CStreaming::FlushRequestList(void)
|
||||
next = si->m_next;
|
||||
RemoveModel(si - ms_aInfoForModel);
|
||||
}
|
||||
#ifndef _WIN32
|
||||
#ifdef FLUSHABLE_STREAMING
|
||||
if(ms_channel[0].state == CHANNELSTATE_READING) {
|
||||
flushStream[0] = 1;
|
||||
}
|
||||
@@ -3295,4 +3330,4 @@ CStreaming::PrintStreamingBufferState()
|
||||
DoRWStuffEndOfFrame();
|
||||
}
|
||||
CTimer::Update();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,7 +91,11 @@ public:
|
||||
static int32 ms_oldSectorX;
|
||||
static int32 ms_oldSectorY;
|
||||
static int32 ms_streamingBufferSize;
|
||||
#ifndef ONE_THREAD_PER_CHANNEL
|
||||
static int8 *ms_pStreamingBuffer[2];
|
||||
#else
|
||||
static int8 *ms_pStreamingBuffer[4];
|
||||
#endif
|
||||
static size_t ms_memoryUsed;
|
||||
static CStreamingChannel ms_channel[2];
|
||||
static int32 ms_channelError;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "SpecialFX.h"
|
||||
|
||||
uint32 CTimer::m_snTimeInMilliseconds;
|
||||
PauseModeTime CTimer::m_snTimeInMillisecondsPauseMode = 1;
|
||||
uint32 CTimer::m_snTimeInMillisecondsPauseMode = 1;
|
||||
|
||||
uint32 CTimer::m_snTimeInMillisecondsNonClipped;
|
||||
uint32 CTimer::m_snPreviousTimeInMilliseconds;
|
||||
@@ -17,7 +17,11 @@ float CTimer::ms_fTimeScale;
|
||||
float CTimer::ms_fTimeStep;
|
||||
float CTimer::ms_fTimeStepNonClipped;
|
||||
bool CTimer::m_UserPause;
|
||||
bool CTimer::m_CodePause;
|
||||
bool CTimer::m_CodePause;
|
||||
#ifdef FIX_BUGS
|
||||
uint32 CTimer::m_LogicalFrameCounter;
|
||||
uint32 CTimer::m_LogicalFramesPassed;
|
||||
#endif
|
||||
|
||||
uint32 _nCyclesPerMS = 1;
|
||||
|
||||
@@ -35,10 +39,6 @@ RsTimerType suspendPcTimer;
|
||||
|
||||
uint32 suspendDepth;
|
||||
|
||||
#ifdef FIX_HIGH_FPS_BUGS_ON_FRONTEND
|
||||
double frameTime;
|
||||
#endif
|
||||
|
||||
void CTimer::Initialise(void)
|
||||
{
|
||||
debug("Initialising CTimer...\n");
|
||||
@@ -51,6 +51,10 @@ void CTimer::Initialise(void)
|
||||
m_snTimeInMillisecondsNonClipped = 0;
|
||||
m_snPreviousTimeInMilliseconds = 0;
|
||||
m_snTimeInMilliseconds = 1;
|
||||
#ifdef FIX_BUGS
|
||||
m_LogicalFrameCounter = 0;
|
||||
m_LogicalFramesPassed = 0;
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
LARGE_INTEGER perfFreq;
|
||||
@@ -82,6 +86,94 @@ void CTimer::Shutdown(void)
|
||||
;
|
||||
}
|
||||
|
||||
#ifdef FIX_BUGS
|
||||
void CTimer::Update(void)
|
||||
{
|
||||
static double frameTimeLogical = 0.0;
|
||||
static double frameTimeFraction = 0.0;
|
||||
static double frameTimeFractionScaled = 0.0;
|
||||
double frameTime;
|
||||
double dblUpdInMs;
|
||||
|
||||
m_snPreviousTimeInMilliseconds = m_snTimeInMilliseconds;
|
||||
|
||||
#ifdef _WIN32
|
||||
if ( (double)_nCyclesPerMS != 0.0 )
|
||||
{
|
||||
LARGE_INTEGER pc;
|
||||
QueryPerformanceCounter(&pc);
|
||||
|
||||
int32 updInCycles = (pc.LowPart - _oldPerfCounter.LowPart); // & 0x7FFFFFFF; pointless
|
||||
|
||||
_oldPerfCounter = pc;
|
||||
|
||||
float updInCyclesScaled = GetIsPaused() ? updInCycles : updInCycles * ms_fTimeScale;
|
||||
|
||||
frameTime = updInCyclesScaled / (double)_nCyclesPerMS;
|
||||
|
||||
dblUpdInMs = (double)updInCycles / (double)_nCyclesPerMS;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
RsTimerType timer = RsTimer();
|
||||
|
||||
RsTimerType updInMs = timer - oldPcTimer;
|
||||
|
||||
frameTime = (double)updInMs * ms_fTimeScale;
|
||||
|
||||
oldPcTimer = timer;
|
||||
|
||||
dblUpdInMs = (double)updInMs;
|
||||
}
|
||||
|
||||
// count frames as if we're running at 30 fps
|
||||
m_LogicalFramesPassed = 0;
|
||||
frameTimeLogical += dblUpdInMs;
|
||||
while (frameTimeLogical >= 1000.0 / 30.0) {
|
||||
frameTimeLogical -= 1000.0 / 30.0;
|
||||
m_LogicalFramesPassed++;
|
||||
}
|
||||
m_LogicalFrameCounter += m_LogicalFramesPassed;
|
||||
|
||||
frameTimeFraction += dblUpdInMs;
|
||||
frameTimeFractionScaled += frameTime;
|
||||
|
||||
m_snTimeInMillisecondsPauseMode += uint32(frameTimeFraction);
|
||||
|
||||
if ( GetIsPaused() )
|
||||
ms_fTimeStep = 0.0f;
|
||||
else
|
||||
{
|
||||
m_snTimeInMilliseconds += uint32(frameTimeFractionScaled);
|
||||
m_snTimeInMillisecondsNonClipped += uint32(frameTimeFractionScaled);
|
||||
ms_fTimeStep = frameTime / 1000.0f * 50.0f;
|
||||
}
|
||||
frameTimeFraction -= uint32(frameTimeFraction);
|
||||
frameTimeFractionScaled -= uint32(frameTimeFractionScaled);
|
||||
|
||||
if ( ms_fTimeStep < 0.01f && !GetIsPaused() && !CSpecialFX::bSnapShotActive)
|
||||
ms_fTimeStep = 0.01f;
|
||||
|
||||
ms_fTimeStepNonClipped = ms_fTimeStep;
|
||||
|
||||
if ( !CRecordDataForGame::IsPlayingBack() )
|
||||
{
|
||||
ms_fTimeStep = Min(3.0f, ms_fTimeStep);
|
||||
|
||||
if ( (m_snTimeInMilliseconds - m_snPreviousTimeInMilliseconds) > 60 )
|
||||
m_snTimeInMilliseconds = m_snPreviousTimeInMilliseconds + 60;
|
||||
}
|
||||
|
||||
if ( CRecordDataForChase::IsRecording() )
|
||||
{
|
||||
ms_fTimeStep = 1.0f;
|
||||
m_snTimeInMilliseconds = m_snPreviousTimeInMilliseconds + 16;
|
||||
}
|
||||
|
||||
m_FrameCounter++;
|
||||
}
|
||||
#else
|
||||
void CTimer::Update(void)
|
||||
{
|
||||
m_snPreviousTimeInMilliseconds = m_snTimeInMilliseconds;
|
||||
@@ -98,11 +190,7 @@ void CTimer::Update(void)
|
||||
|
||||
float updInCyclesScaled = GetIsPaused() ? updInCycles : updInCycles * ms_fTimeScale;
|
||||
|
||||
// We need that real frame time to fix transparent menu bug.
|
||||
#ifndef FIX_HIGH_FPS_BUGS_ON_FRONTEND
|
||||
double
|
||||
#endif
|
||||
frameTime = updInCyclesScaled / (double)_nCyclesPerMS;
|
||||
double frameTime = updInCyclesScaled / (double)_nCyclesPerMS;
|
||||
|
||||
m_snTimeInMillisecondsPauseMode = m_snTimeInMillisecondsPauseMode + frameTime;
|
||||
|
||||
@@ -122,16 +210,12 @@ void CTimer::Update(void)
|
||||
|
||||
RsTimerType updInMs = timer - oldPcTimer;
|
||||
|
||||
// We need that real frame time to fix transparent menu bug.
|
||||
#ifndef FIX_HIGH_FPS_BUGS_ON_FRONTEND
|
||||
double
|
||||
#endif
|
||||
frameTime = (double)updInMs * ms_fTimeScale;
|
||||
double frameTime = (double)updInMs * ms_fTimeScale;
|
||||
|
||||
oldPcTimer = timer;
|
||||
|
||||
|
||||
m_snTimeInMillisecondsPauseMode = m_snTimeInMillisecondsPauseMode + frameTime;
|
||||
|
||||
|
||||
if ( GetIsPaused() )
|
||||
ms_fTimeStep = 0.0f;
|
||||
else
|
||||
@@ -163,6 +247,7 @@ void CTimer::Update(void)
|
||||
|
||||
m_FrameCounter++;
|
||||
}
|
||||
#endif
|
||||
|
||||
void CTimer::Suspend(void)
|
||||
{
|
||||
|
||||
@@ -1,22 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef FIX_HIGH_FPS_BUGS_ON_FRONTEND
|
||||
#define PauseModeTime double
|
||||
#else
|
||||
#define PauseModeTime uint32
|
||||
#endif
|
||||
|
||||
class CTimer
|
||||
{
|
||||
|
||||
static uint32 m_snTimeInMilliseconds;
|
||||
static PauseModeTime m_snTimeInMillisecondsPauseMode;
|
||||
static uint32 m_snTimeInMillisecondsPauseMode;
|
||||
static uint32 m_snTimeInMillisecondsNonClipped;
|
||||
static uint32 m_snPreviousTimeInMilliseconds;
|
||||
static uint32 m_FrameCounter;
|
||||
static float ms_fTimeScale;
|
||||
static float ms_fTimeStep;
|
||||
static float ms_fTimeStepNonClipped;
|
||||
#ifdef FIX_BUGS
|
||||
static uint32 m_LogicalFrameCounter;
|
||||
static uint32 m_LogicalFramesPassed;
|
||||
#endif
|
||||
public:
|
||||
static bool m_UserPause;
|
||||
static bool m_CodePause;
|
||||
@@ -35,7 +33,7 @@ public:
|
||||
static void SetTimeInMilliseconds(uint32 t) { m_snTimeInMilliseconds = t; }
|
||||
static uint32 GetTimeInMillisecondsNonClipped(void) { return m_snTimeInMillisecondsNonClipped; }
|
||||
static void SetTimeInMillisecondsNonClipped(uint32 t) { m_snTimeInMillisecondsNonClipped = t; }
|
||||
static PauseModeTime GetTimeInMillisecondsPauseMode(void) { return m_snTimeInMillisecondsPauseMode; }
|
||||
static uint32 GetTimeInMillisecondsPauseMode(void) { return m_snTimeInMillisecondsPauseMode; }
|
||||
static void SetTimeInMillisecondsPauseMode(uint32 t) { m_snTimeInMillisecondsPauseMode = t; }
|
||||
static uint32 GetPreviousTimeInMilliseconds(void) { return m_snPreviousTimeInMilliseconds; }
|
||||
static void SetPreviousTimeInMilliseconds(uint32 t) { m_snPreviousTimeInMilliseconds = t; }
|
||||
@@ -67,9 +65,7 @@ public:
|
||||
#ifdef FIX_BUGS
|
||||
static float GetDefaultTimeStep(void) { return 50.0f / 30.0f; }
|
||||
static float GetTimeStepFix(void) { return GetTimeStep() / GetDefaultTimeStep(); }
|
||||
static uint32 GetLogicalFrameCounter(void) { return m_LogicalFrameCounter; }
|
||||
static uint32 GetLogicalFramesPassed(void) { return m_LogicalFramesPassed; }
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef FIX_HIGH_FPS_BUGS_ON_FRONTEND
|
||||
extern double frameTime;
|
||||
#endif
|
||||
|
||||
@@ -65,7 +65,7 @@ CWorld::Initialise()
|
||||
void
|
||||
CWorld::Add(CEntity *ent)
|
||||
{
|
||||
if(ent->IsVehicle() || ent->IsPed()) DMAudio.SetEntityStatus(((CPhysical *)ent)->m_audioEntityId, true);
|
||||
if(ent->IsVehicle() || ent->IsPed()) DMAudio.SetEntityStatus(((CPhysical *)ent)->m_audioEntityId, TRUE);
|
||||
|
||||
if(ent->bIsBIGBuilding)
|
||||
ms_bigBuildingsList[ent->m_level].InsertItem(ent);
|
||||
@@ -80,7 +80,7 @@ CWorld::Add(CEntity *ent)
|
||||
void
|
||||
CWorld::Remove(CEntity *ent)
|
||||
{
|
||||
if(ent->IsVehicle() || ent->IsPed()) DMAudio.SetEntityStatus(((CPhysical *)ent)->m_audioEntityId, false);
|
||||
if(ent->IsVehicle() || ent->IsPed()) DMAudio.SetEntityStatus(((CPhysical *)ent)->m_audioEntityId, FALSE);
|
||||
|
||||
if(ent->bIsBIGBuilding)
|
||||
ms_bigBuildingsList[ent->m_level].RemoveItem(ent);
|
||||
@@ -367,7 +367,7 @@ CWorld::ProcessLineOfSightSectorList(CPtrList &list, const CColLine &line, CColP
|
||||
} else if(e->bUsesCollision)
|
||||
colmodel = CModelInfo::GetModelInfo(e->GetModelIndex())->GetColModel();
|
||||
|
||||
if(colmodel && CCollision::ProcessLineOfSight(line, e->GetMatrix(), *colmodel, point, dist,
|
||||
if(colmodel && CCollision::ProcessLineOfSight(line, e->GetMatrix(), *colmodel, point, mindist,
|
||||
ignoreSeeThrough, ignoreShootThrough))
|
||||
entity = e;
|
||||
if(carTyres && ((CVehicle*)e)->SetUpWheelColModel(&tyreCol) && CCollision::ProcessLineOfSight(line, e->GetMatrix(), tyreCol, tyreColPoint, tyreDist, false, ignoreShootThrough)){
|
||||
@@ -466,7 +466,7 @@ CWorld::ProcessVerticalLineSectorList(CPtrList &list, const CColLine &line, CCol
|
||||
e->m_scanCode = GetCurrentScanCode();
|
||||
|
||||
colmodel = CModelInfo::GetModelInfo(e->GetModelIndex())->GetColModel();
|
||||
if(CCollision::ProcessVerticalLine(line, e->GetMatrix(), *colmodel, point, dist,
|
||||
if(CCollision::ProcessVerticalLine(line, e->GetMatrix(), *colmodel, point, mindist,
|
||||
ignoreSeeThrough, false, poly))
|
||||
entity = e;
|
||||
}
|
||||
@@ -1486,7 +1486,7 @@ CWorld::CallOffChaseForAreaSectorListVehicles(CPtrList &list, float x1, float y1
|
||||
CColModel *pColModel = pVehicle->GetColModel();
|
||||
bool bInsideSphere = false;
|
||||
for(int32 i = 0; i < pColModel->numSpheres; i++) {
|
||||
CVector pos = pVehicle->m_matrix * pColModel->spheres[i].center;
|
||||
CVector pos = pVehicle->GetMatrix() * pColModel->spheres[i].center;
|
||||
float fRadius = pColModel->spheres[i].radius;
|
||||
if(pos.x + fRadius > x1 && pos.x - fRadius < x2 && pos.y + fRadius > y1 &&
|
||||
pos.y - fRadius < y2)
|
||||
@@ -1801,7 +1801,7 @@ CWorld::RepositionOneObject(CEntity *pEntity)
|
||||
position.z = FindGroundZFor3DCoord(position.x, position.y,
|
||||
position.z + OBJECT_REPOSITION_OFFSET_Z, nil) -
|
||||
fBoundingBoxMinZ;
|
||||
pEntity->m_matrix.UpdateRW();
|
||||
pEntity->GetMatrix().UpdateRW();
|
||||
pEntity->UpdateRwFrame();
|
||||
} else if(modelId == MI_BUOY) {
|
||||
float fWaterLevel = 0.0f;
|
||||
@@ -1906,16 +1906,7 @@ CWorld::Process(void)
|
||||
for(int i = 0; i < NUMCUTSCENEOBJECTS; i++) {
|
||||
CCutsceneObject *csObj = CCutsceneMgr::GetCutsceneObject(i);
|
||||
if(csObj && csObj->m_entryInfoList.first) {
|
||||
if(csObj->m_rwObject && RwObjectGetType(csObj->m_rwObject) == rpCLUMP &&
|
||||
RpAnimBlendClumpGetFirstAssociation(csObj->GetClump())) {
|
||||
if (csObj->IsObject())
|
||||
RpAnimBlendClumpUpdateAnimations(csObj->GetClump(), CTimer::GetTimeStepNonClippedInSeconds());
|
||||
else {
|
||||
if (!csObj->bOffscreen)
|
||||
csObj->bOffscreen = !csObj->GetIsOnScreen();
|
||||
RpAnimBlendClumpUpdateAnimations(csObj->GetClump(), CTimer::GetTimeStepInSeconds(), !csObj->bOffscreen);
|
||||
}
|
||||
}
|
||||
csObj->UpdateAnim();
|
||||
csObj->ProcessControl();
|
||||
csObj->ProcessCollision();
|
||||
csObj->GetMatrix().UpdateRW();
|
||||
@@ -1927,26 +1918,40 @@ CWorld::Process(void)
|
||||
} else {
|
||||
for(CPtrNode *node = ms_listMovingEntityPtrs.first; node; node = node->next) {
|
||||
CEntity *movingEnt = (CEntity *)node->item;
|
||||
if(!movingEnt->bRemoveFromWorld && movingEnt->m_rwObject && RwObjectGetType(movingEnt->m_rwObject) == rpCLUMP &&
|
||||
RpAnimBlendClumpGetFirstAssociation(movingEnt->GetClump())) {
|
||||
if (movingEnt->IsObject())
|
||||
RpAnimBlendClumpUpdateAnimations(movingEnt->GetClump(), CTimer::GetTimeStepNonClippedInSeconds());
|
||||
else {
|
||||
if (!movingEnt->bOffscreen)
|
||||
movingEnt->bOffscreen = !movingEnt->GetIsOnScreen();
|
||||
RpAnimBlendClumpUpdateAnimations(movingEnt->GetClump(), CTimer::GetTimeStepInSeconds(), !movingEnt->bOffscreen);
|
||||
}
|
||||
}
|
||||
if(!movingEnt->bRemoveFromWorld)
|
||||
movingEnt->UpdateAnim();
|
||||
}
|
||||
for(CPtrNode *node = ms_listMovingEntityPtrs.first; node; node = node->next) {
|
||||
CPhysical *movingEnt = (CPhysical *)node->item;
|
||||
if(movingEnt->bRemoveFromWorld) {
|
||||
RemoveEntityInsteadOfProcessingIt(movingEnt);
|
||||
} else {
|
||||
movingEnt->ProcessControl();
|
||||
if(!CCutsceneMgr::IsCutsceneProcessing() || movingEnt->UpdatesInCutscene())
|
||||
movingEnt->ProcessControl();
|
||||
if(movingEnt->GetIsStatic()) { movingEnt->RemoveFromMovingList(); }
|
||||
}
|
||||
}
|
||||
for(int y = 0; y < NUMSECTORS_Y; y++)
|
||||
for(int x = 0; x < NUMSECTORS_X; x++){
|
||||
CPtrNode *node;
|
||||
CSector *sect = CWorld::GetSector(x, y);
|
||||
for(node = sect->m_lists[ENTITYLIST_PEDS].first; node; node = node->next)
|
||||
((CEntity*)node->item)->UpdateDistanceFade();
|
||||
for(node = sect->m_lists[ENTITYLIST_PEDS_OVERLAP].first; node; node = node->next)
|
||||
((CEntity*)node->item)->UpdateDistanceFade();
|
||||
for(node = sect->m_lists[ENTITYLIST_VEHICLES].first; node; node = node->next)
|
||||
((CEntity*)node->item)->UpdateDistanceFade();
|
||||
for(node = sect->m_lists[ENTITYLIST_VEHICLES_OVERLAP].first; node; node = node->next)
|
||||
((CEntity*)node->item)->UpdateDistanceFade();
|
||||
for(node = sect->m_lists[ENTITYLIST_OBJECTS].first; node; node = node->next)
|
||||
((CEntity*)node->item)->UpdateDistanceFade();
|
||||
for(node = sect->m_lists[ENTITYLIST_OBJECTS_OVERLAP].first; node; node = node->next)
|
||||
((CEntity*)node->item)->UpdateDistanceFade();
|
||||
for(node = sect->m_lists[ENTITYLIST_DUMMIES].first; node; node = node->next)
|
||||
((CEntity*)node->item)->UpdateDistanceFade();
|
||||
for(node = sect->m_lists[ENTITYLIST_DUMMIES_OVERLAP].first; node; node = node->next)
|
||||
((CEntity*)node->item)->UpdateDistanceFade();
|
||||
}
|
||||
bForceProcessControl = true;
|
||||
for(CPtrNode *node = ms_listMovingEntityPtrs.first; node; node = node->next) {
|
||||
CPhysical *movingEnt = (CPhysical *)node->item;
|
||||
@@ -2192,7 +2197,7 @@ CWorld::TriggerExplosionSectorList(CPtrList &list, const CVector &position, floa
|
||||
PEDPIECE_TORSO, direction);
|
||||
if(pPed->m_nPedState != PED_DIE)
|
||||
pPed->SetFall(2000,
|
||||
(AnimationId)(direction + ANIM_KO_SKID_FRONT), 0);
|
||||
(AnimationId)(direction + ANIM_STD_HIGHIMPACT_FRONT), 0);
|
||||
if(pCreator && pCreator->IsPed()) {
|
||||
eEventType eventType = EVENT_SHOOT_PED;
|
||||
if(pPed->m_nPedType == PEDTYPE_COP) eventType = EVENT_SHOOT_COP;
|
||||
|
||||
@@ -29,6 +29,7 @@ enum
|
||||
{
|
||||
ENTITYLIST_BUILDINGS,
|
||||
ENTITYLIST_BUILDINGS_OVERLAP,
|
||||
ENTITYLIST_UNKNOWN,
|
||||
ENTITYLIST_OBJECTS,
|
||||
ENTITYLIST_OBJECTS_OVERLAP,
|
||||
ENTITYLIST_VEHICLES,
|
||||
|
||||
@@ -452,6 +452,7 @@ CTheZones::GetZoneInfoForTimeOfDay(const CVector *pos, CZoneInfo *info)
|
||||
assert(d >= 0.0f && d <= 1.0f);
|
||||
n = 1.0f - d;
|
||||
}
|
||||
#ifdef FIX_BUGS
|
||||
info->carDensity = day->carDensity * d + night->carDensity * n;
|
||||
for(i = 0; i < ARRAY_SIZE(info->carThreshold); i++)
|
||||
info->carThreshold[i] = day->carThreshold[i] * d + night->carThreshold[i] * n;
|
||||
@@ -465,6 +466,22 @@ CTheZones::GetZoneInfoForTimeOfDay(const CVector *pos, CZoneInfo *info)
|
||||
info->copPedThreshold = day->copPedThreshold * d + night->copPedThreshold * n;
|
||||
for(i = 0; i < ARRAY_SIZE(info->gangPedThreshold); i++)
|
||||
info->gangPedThreshold[i] = day->gangPedThreshold[i] * d + night->gangPedThreshold[i] * n;
|
||||
#else
|
||||
// This is a complete mess.
|
||||
info->carDensity = day->carDensity * n + night->carDensity * d;
|
||||
for(i = 0; i < ARRAY_SIZE(info->carThreshold); i++)
|
||||
info->carThreshold[i] = night->carThreshold[i] * d + night->carThreshold[i] * n;
|
||||
for(i = 0; i < ARRAY_SIZE(info->boatThreshold); i++)
|
||||
info->boatThreshold[i] = night->boatThreshold[i] * d + night->boatThreshold[i] * n;
|
||||
for(i = 0; i < ARRAY_SIZE(info->gangThreshold); i++)
|
||||
info->gangThreshold[i] = night->gangThreshold[i] * d + night->gangThreshold[i] * n;
|
||||
|
||||
info->copThreshold = night->copThreshold * d + night->copThreshold * n;
|
||||
info->pedDensity = night->pedDensity * d + night->pedDensity * n;
|
||||
info->copPedThreshold = night->copPedThreshold * d + night->copPedThreshold * n;
|
||||
for(i = 0; i < ARRAY_SIZE(info->gangPedThreshold); i++)
|
||||
info->gangPedThreshold[i] = night->gangPedThreshold[i] * d + night->gangPedThreshold[i] * n;
|
||||
#endif
|
||||
}
|
||||
if(CClock::GetIsTimeInRange(5, 19))
|
||||
info->pedGroup = day->pedGroup;
|
||||
|
||||
@@ -228,6 +228,12 @@ inline uint32 ldb(uint32 p, uint32 s, uint32 w)
|
||||
|
||||
#include "maths.h"
|
||||
#include "Vector.h"
|
||||
#ifdef GTA_PS2
|
||||
#include "VuVector.h"
|
||||
#define CVUVECTOR CVuVector
|
||||
#else
|
||||
#define CVUVECTOR CVector
|
||||
#endif
|
||||
#include "Vector2D.h"
|
||||
#include "Matrix.h"
|
||||
#include "Rect.h"
|
||||
@@ -369,7 +375,7 @@ __inline__ void TRACE(char *f, ...) { } // this is re3 only, and so the function
|
||||
#ifndef MASTER
|
||||
#define assert(_Expression) (void)( (!!(_Expression)) || (re3_assert(#_Expression, __FILE__, __LINE__, __FUNCTION__), 0) )
|
||||
#else
|
||||
#define assert(_Expression)
|
||||
#define assert(_Expression) (_Expression)
|
||||
#endif
|
||||
#define ASSERT assert
|
||||
|
||||
|
||||
@@ -10,9 +10,9 @@ enum Config {
|
||||
MAX_CDIMAGES = 8, // additional cdimages
|
||||
MAX_CDCHANNELS = 5,
|
||||
|
||||
MODELINFOSIZE = 6500, // only 4900
|
||||
TXDSTORESIZE = 1385, // only 1200
|
||||
COLSTORESIZE = 31, // only 15
|
||||
MODELINFOSIZE = 4900,
|
||||
TXDSTORESIZE = 1200,
|
||||
COLSTORESIZE = 15,
|
||||
EXTRADIRSIZE = 256,
|
||||
CUTSCENEDIRSIZE = 512,
|
||||
|
||||
@@ -100,7 +100,7 @@ enum Config {
|
||||
NUMPACMANPICKUPS = 256,
|
||||
NUMEVENTS = 64,
|
||||
|
||||
NUM_CARGENS = 500,
|
||||
NUM_CARGENS = 195, // 500 on mobile
|
||||
|
||||
NUM_PATH_NODES_IN_AUTOPILOT = 8,
|
||||
|
||||
@@ -131,7 +131,6 @@ enum Config {
|
||||
NUM_PED_COMMENTS_SLOTS = 20,
|
||||
|
||||
NUM_SOUNDS_SAMPLES_BANKS = 2,
|
||||
NUM_SOUNDS_SAMPLES_SLOTS = 27,
|
||||
NUM_AUDIOENTITIES = 250,
|
||||
|
||||
NUM_AUDIO_REFLECTIONS = 8,
|
||||
@@ -196,6 +195,10 @@ enum Config {
|
||||
|
||||
// those infamous texts
|
||||
#define DRAW_GAME_VERSION_TEXT
|
||||
#ifdef DRAW_GAME_VERSION_TEXT
|
||||
// unlike R* development builds, ours has runtime switch on debug menu & .ini, and disabled as default.
|
||||
#define USE_OUR_VERSIONING // If you disable this then game will fetch version from peds.col, as R* did while in development
|
||||
#endif
|
||||
|
||||
// Memory allocation and compression
|
||||
// #define USE_CUSTOM_ALLOCATOR // use CMemoryHeap for allocation. use with care, not finished yet
|
||||
@@ -233,7 +236,6 @@ enum Config {
|
||||
// not in master builds
|
||||
#define VALIDATE_SAVE_SIZE
|
||||
|
||||
#define NO_MOVIES // disable intro videos
|
||||
#define DEBUGMENU
|
||||
#endif
|
||||
|
||||
@@ -250,12 +252,19 @@ enum Config {
|
||||
//#define MORE_LANGUAGES // Add more translations to the game
|
||||
#define COMPATIBLE_SAVES // this allows changing structs while keeping saves compatible
|
||||
#define LOAD_INI_SETTINGS // as the name suggests. fundamental for CUSTOM_FRONTEND_OPTIONS
|
||||
#define FIX_HIGH_FPS_BUGS_ON_FRONTEND
|
||||
|
||||
#define NO_MOVIES // add option to disable intro videos
|
||||
|
||||
#if defined(__LP64__) || defined(_WIN64)
|
||||
#define FIX_BUGS_64 // Must have fixes to be able to run 64 bit build
|
||||
#endif
|
||||
|
||||
#define ASCII_STRCMP // use faster ascii str comparisons
|
||||
|
||||
#if !defined _WIN32 || defined __MWERKS__ || defined __MINGW32__ || defined VANILLA_DEFINES
|
||||
#undef ASCII_STRCMP
|
||||
#endif
|
||||
|
||||
// Just debug menu entries
|
||||
#ifdef DEBUGMENU
|
||||
#define RELOADABLES // some debug menu options to reload TXD files
|
||||
@@ -298,8 +307,8 @@ enum Config {
|
||||
#if !defined(RW_GL3) && defined(_WIN32)
|
||||
#define XINPUT
|
||||
#endif
|
||||
#if !defined(_WIN32) && !defined(__SWITCH__)
|
||||
#define DONT_TRUST_RECOGNIZED_JOYSTICKS // Then we'll only rely on GLFW gamepad DB, and expect user to enter Controller->Detect joysticks if his joystick isn't on that list.
|
||||
#if defined XINPUT || (defined RW_GL3 && !defined LIBRW_SDL2 && !defined __SWITCH__)
|
||||
#define DETECT_JOYSTICK_MENU // Then we'll expect user to enter Controller->Detect joysticks if his joystick isn't detected at the start.
|
||||
#endif
|
||||
#define DETECT_PAD_INPUT_SWITCH // Adds automatic switch of pad related stuff between controller and kb/m
|
||||
#define KANGAROO_CHEAT
|
||||
@@ -307,19 +316,22 @@ enum Config {
|
||||
#define BETTER_ALLCARSAREDODO_CHEAT
|
||||
#define WALLCLIMB_CHEAT
|
||||
#define REGISTER_START_BUTTON
|
||||
//#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
|
||||
#define BUTTON_ICONS // use textures to show controller buttons
|
||||
|
||||
// Hud, frontend and radar
|
||||
#define PC_MENU
|
||||
|
||||
#define FIX_RADAR // use radar size from early version before R* broke it
|
||||
#define RADIO_OFF_TEXT // Won't work without FIX_BUGS
|
||||
|
||||
#ifndef PC_MENU
|
||||
# define PS2_MENU
|
||||
//# define PS2_MENU_USEALLPAGEICONS
|
||||
#else
|
||||
# define MAP_ENHANCEMENTS // Adding waypoint and better mouse support
|
||||
# ifdef XINPUT
|
||||
# define GAMEPAD_MENU // Add gamepad menu
|
||||
# endif
|
||||
# define TRIANGLE_BACK_BUTTON
|
||||
//# define CIRCLE_BACK_BUTTON
|
||||
#define LEGACY_MENU_OPTIONS // i.e. frame sync(vsync)
|
||||
@@ -353,6 +365,10 @@ static_assert(false, "SUPPORT_XBOX_SCRIPT and SUPPORT_MOBILE_SCRIPT are mutually
|
||||
#define USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
|
||||
#define SCRIPT_LOG_FILE_LEVEL 1 // 0 == no log, 1 == overwrite every frame, 2 == full log
|
||||
|
||||
#if SCRIPT_LOG_FILE_LEVEL == 0
|
||||
#undef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
|
||||
#endif
|
||||
|
||||
#ifndef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
|
||||
#define USE_BASIC_SCRIPT_DEBUG_OUTPUT
|
||||
#endif
|
||||
@@ -382,8 +398,10 @@ static_assert(false, "SUPPORT_XBOX_SCRIPT and SUPPORT_MOBILE_SCRIPT are mutually
|
||||
#define FREE_CAM // Rotating cam
|
||||
|
||||
// Audio
|
||||
#define AUDIO_CACHE // cache sound lengths to speed up the cold boot
|
||||
#define PS2_AUDIO_PATHS // changes audio paths for cutscenes and radio to PS2 paths (needs vbdec on MSS builds)
|
||||
#define RADIO_SCROLL_TO_PREV_STATION // Won't work without FIX_BUGS
|
||||
//#define AUDIO_CACHE // cache sound lengths to speed up the cold boot
|
||||
#define PS2_AUDIO_CHANNELS // increases the maximum number of audio channels to PS2 value of 41 (PSP and mobile have 21 originally)
|
||||
//#define PS2_AUDIO_PATHS // changes audio paths for cutscenes and radio to PS2 paths (needs vbdec on MSS builds)
|
||||
//#define AUDIO_OAL_USE_SNDFILE // use libsndfile to decode WAVs instead of our internal decoder
|
||||
#define AUDIO_OAL_USE_MPG123 // use mpg123 to support mp3 files
|
||||
|
||||
@@ -399,18 +417,22 @@ static_assert(false, "SUPPORT_XBOX_SCRIPT and SUPPORT_MOBILE_SCRIPT are mutually
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef LIBRW
|
||||
// these are not supported with librw yet
|
||||
// Streaming
|
||||
#if !defined(_WIN32) && !defined(__SWITCH__)
|
||||
//#define ONE_THREAD_PER_CHANNEL // Don't use if you're not on SSD/Flash - also not utilized too much right now(see commented LoadAllRequestedModels in Streaming.cpp)
|
||||
#define FLUSHABLE_STREAMING // Make it possible to interrupt reading when processing file isn't needed anymore.
|
||||
#endif
|
||||
// IMG
|
||||
#define BIG_IMG // allows to read larger img files
|
||||
#define BIG_IMG // Not complete - allows to read larger img files
|
||||
|
||||
//#define SQUEEZE_PERFORMANCE
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
#undef PS2_ALPHA_TEST
|
||||
#undef NO_ISLAND_LOADING
|
||||
#undef PS2_AUDIO_CHANNELS
|
||||
#endif
|
||||
|
||||
// -------
|
||||
|
||||
#if defined __MWERKS__ || defined VANILLA_DEFINES
|
||||
#define FINAL
|
||||
#undef CHATTYSPLASH
|
||||
@@ -436,7 +458,6 @@ static_assert(false, "SUPPORT_XBOX_SCRIPT and SUPPORT_MOBILE_SCRIPT are mutually
|
||||
#undef MORE_LANGUAGES
|
||||
#undef COMPATIBLE_SAVES
|
||||
#undef LOAD_INI_SETTINGS
|
||||
#undef FIX_HIGH_FPS_BUGS_ON_FRONTEND
|
||||
|
||||
#undef ASPECT_RATIO_SCALE
|
||||
#undef PROPER_SCALING
|
||||
@@ -465,8 +486,10 @@ static_assert(false, "SUPPORT_XBOX_SCRIPT and SUPPORT_MOBILE_SCRIPT are mutually
|
||||
#undef BUTTON_ICONS
|
||||
|
||||
#undef FIX_RADAR
|
||||
#undef RADIO_OFF_TEXT
|
||||
|
||||
#undef MAP_ENHANCEMENTS
|
||||
#undef GAMEPAD_MENU
|
||||
#undef MUCH_SHORTER_OUTRO_SCREEN
|
||||
#undef CUSTOM_FRONTEND_OPTIONS
|
||||
|
||||
@@ -493,4 +516,6 @@ static_assert(false, "SUPPORT_XBOX_SCRIPT and SUPPORT_MOBILE_SCRIPT are mutually
|
||||
#undef IMPROVED_CAMERA
|
||||
#undef FREE_CAM
|
||||
#undef BIG_IMG
|
||||
#undef PS2_AUDIO_CHANNELS
|
||||
#undef RADIO_SCROLL_TO_PREV_STATION
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
#include "common.h"
|
||||
#include <time.h>
|
||||
#include "rpmatfx.h"
|
||||
#include "rphanim.h"
|
||||
#include "rpskin.h"
|
||||
#include "rtbmp.h"
|
||||
#include "rtpng.h"
|
||||
#ifdef ANISOTROPIC_FILTERING
|
||||
#include "rpanisot.h"
|
||||
#endif
|
||||
@@ -73,6 +75,9 @@
|
||||
#include "custompipes.h"
|
||||
#include "screendroplets.h"
|
||||
#include "VarConsole.h"
|
||||
#ifdef USE_OUR_VERSIONING
|
||||
#include "GitSHA1.h"
|
||||
#endif
|
||||
|
||||
GlobalScene Scene;
|
||||
|
||||
@@ -97,6 +102,12 @@ bool gbModelViewer;
|
||||
#ifdef TIMEBARS
|
||||
bool gbShowTimebars;
|
||||
#endif
|
||||
#ifdef DRAW_GAME_VERSION_TEXT
|
||||
bool gbDrawVersionText; // Our addition, we think it was always enabled on !MASTER builds
|
||||
#endif
|
||||
#ifdef NO_MOVIES
|
||||
bool gbNoMovies;
|
||||
#endif
|
||||
|
||||
volatile int32 frameCount;
|
||||
|
||||
@@ -339,7 +350,11 @@ RwGrabScreen(RwCamera *camera, RwChar *filename)
|
||||
strcpy(temp, CFileMgr::GetRootDirName());
|
||||
strcat(temp, filename);
|
||||
|
||||
#ifndef LIBRW
|
||||
if (RtBMPImageWrite(pImage, &temp[0]) == nil)
|
||||
#else
|
||||
if (RtPNGImageWrite(pImage, &temp[0]) == nil)
|
||||
#endif
|
||||
result = false;
|
||||
RwImageDestroy(pImage);
|
||||
return result;
|
||||
@@ -358,6 +373,7 @@ DoRWStuffEndOfFrame(void)
|
||||
RsCameraShowRaster(Scene.camera);
|
||||
#ifndef MASTER
|
||||
char s[48];
|
||||
#ifdef THIS_IS_STUPID
|
||||
if (CPad::GetPad(1)->GetLeftShockJustDown()) {
|
||||
// try using both controllers for this thing... crazy bastards
|
||||
if (CPad::GetPad(0)->GetRightStickY() > 0) {
|
||||
@@ -369,6 +385,12 @@ DoRWStuffEndOfFrame(void)
|
||||
RwGrabScreen(Scene.camera, s);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (CPad::GetPad(1)->GetLeftShockJustDown() || CPad::GetPad(0)->GetFJustDown(11)) {
|
||||
sprintf(s, "screen_%11lld.png", time(nil));
|
||||
RwGrabScreen(Scene.camera, s);
|
||||
}
|
||||
#endif
|
||||
#endif // !MASTER
|
||||
}
|
||||
|
||||
@@ -1048,7 +1070,7 @@ DisplayGameDebugText()
|
||||
|
||||
#ifndef FINAL
|
||||
{
|
||||
SETTWEAKPATH("GameDebugText");
|
||||
SETTWEAKPATH("Debug");
|
||||
TWEAKBOOL(bDisplayPosn);
|
||||
TWEAKBOOL(bDisplayCheatStr);
|
||||
}
|
||||
@@ -1062,13 +1084,56 @@ DisplayGameDebugText()
|
||||
|
||||
#ifdef DRAW_GAME_VERSION_TEXT
|
||||
wchar ver[200];
|
||||
|
||||
|
||||
if(gbDrawVersionText) // This realtime switch is our thing
|
||||
{
|
||||
|
||||
#ifdef USE_OUR_VERSIONING
|
||||
char verA[200];
|
||||
sprintf(verA,
|
||||
#if defined _WIN32
|
||||
"Win "
|
||||
#elif defined __linux__
|
||||
"Linux "
|
||||
#elif defined __APPLE__
|
||||
"Mac OS X "
|
||||
#elif defined __FreeBSD__
|
||||
"FreeBSD "
|
||||
#else
|
||||
"Posix-compliant "
|
||||
#endif
|
||||
#if defined __LP64__ || defined _WIN64
|
||||
"64-bit "
|
||||
#else
|
||||
"32-bit "
|
||||
#endif
|
||||
#if defined RW_D3D9
|
||||
"D3D9 "
|
||||
#elif defined RWLIBS
|
||||
"D3D8 "
|
||||
#elif defined RW_GL3
|
||||
"OpenGL "
|
||||
#endif
|
||||
#if defined AUDIO_OAL
|
||||
"OAL "
|
||||
#elif defined AUDIO_MSS
|
||||
"MSS "
|
||||
#endif
|
||||
#if defined _DEBUG || defined DEBUG
|
||||
"DEBUG "
|
||||
#endif
|
||||
"%.8s",
|
||||
g_GIT_SHA1);
|
||||
AsciiToUnicode(verA, ver);
|
||||
CFont::SetScale(SCREEN_SCALE_X(0.5f), SCREEN_SCALE_Y(0.7f));
|
||||
#else
|
||||
AsciiToUnicode(version_name, ver);
|
||||
CFont::SetScale(SCREEN_SCALE_X(0.5f), SCREEN_SCALE_Y(0.5f));
|
||||
#endif
|
||||
|
||||
CFont::SetPropOn();
|
||||
CFont::SetBackgroundOff();
|
||||
CFont::SetFontStyle(FONT_STANDARD);
|
||||
CFont::SetScale(SCREEN_SCALE_X(0.5f), SCREEN_SCALE_Y(0.5f));
|
||||
CFont::SetCentreOff();
|
||||
CFont::SetRightJustifyOff();
|
||||
CFont::SetWrapx(SCREEN_WIDTH);
|
||||
@@ -1076,11 +1141,20 @@ DisplayGameDebugText()
|
||||
CFont::SetBackGroundOnlyTextOff();
|
||||
CFont::SetColor(CRGBA(255, 108, 0, 255));
|
||||
CFont::PrintString(SCREEN_SCALE_X(10.0f), SCREEN_SCALE_Y(10.0f), ver);
|
||||
#endif
|
||||
}
|
||||
#endif // #ifdef DRAW_GAME_VERSION_TEXT
|
||||
|
||||
FrameSamples++;
|
||||
FramesPerSecondCounter += 1000.0f / (CTimer::GetTimeStepNonClippedInSeconds() * 1000.0f);
|
||||
#ifdef FIX_BUGS
|
||||
// this is inaccurate with over 1000 fps
|
||||
static uint32 PreviousTimeInMillisecondsPauseMode = 0;
|
||||
FramesPerSecondCounter += (CTimer::GetTimeInMillisecondsPauseMode() - PreviousTimeInMillisecondsPauseMode) / 1000.0f; // convert to seconds
|
||||
PreviousTimeInMillisecondsPauseMode = CTimer::GetTimeInMillisecondsPauseMode();
|
||||
FramesPerSecond = FrameSamples / FramesPerSecondCounter;
|
||||
#else
|
||||
FramesPerSecondCounter += 1000.0f / CTimer::GetTimeStepNonClippedInMilliseconds();
|
||||
FramesPerSecond = FramesPerSecondCounter / FrameSamples;
|
||||
#endif
|
||||
|
||||
if ( FrameSamples > 30 )
|
||||
{
|
||||
@@ -1209,6 +1283,7 @@ if(gbRenderEverythingBarRoads)
|
||||
void
|
||||
RenderScene_new(void)
|
||||
{
|
||||
PUSH_RENDERGROUP("RenderScene_new");
|
||||
CClouds::Render();
|
||||
DoRWRenderHorizon();
|
||||
|
||||
@@ -1216,6 +1291,7 @@ RenderScene_new(void)
|
||||
DefinedState();
|
||||
// CMattRenderer::ResetRenderStates
|
||||
// moved CRenderer::RenderBoats to before transparent water
|
||||
POP_RENDERGROUP();
|
||||
}
|
||||
|
||||
// TODO
|
||||
@@ -1223,10 +1299,13 @@ bool FredIsInFirstPersonCam(void) { return false; }
|
||||
void
|
||||
RenderEffects_new(void)
|
||||
{
|
||||
PUSH_RENDERGROUP("RenderEffects_new");
|
||||
/* // stupid to do this before the whole world is drawn!
|
||||
CShadows::RenderStaticShadows();
|
||||
CShadows::RenderStoredShadows();
|
||||
CSkidmarks::Render();
|
||||
CRubbish::Render();
|
||||
*/
|
||||
|
||||
// these aren't really effects
|
||||
DefinedState();
|
||||
@@ -1249,6 +1328,13 @@ if(gbRenderFadingInEntities)
|
||||
CRenderer::RenderFadingInEntities();
|
||||
|
||||
// actual effects here
|
||||
|
||||
// from above
|
||||
CShadows::RenderStaticShadows();
|
||||
CShadows::RenderStoredShadows();
|
||||
CSkidmarks::Render();
|
||||
CRubbish::Render();
|
||||
|
||||
CGlass::Render();
|
||||
// CMattRenderer::ResetRenderStates
|
||||
DefinedState();
|
||||
@@ -1266,6 +1352,7 @@ if(gbRenderFadingInEntities)
|
||||
CPointLights::RenderFogEffect();
|
||||
CMovingThings::Render();
|
||||
CRenderer::RenderFirstPersonVehicle();
|
||||
POP_RENDERGROUP();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1278,6 +1365,7 @@ RenderScene(void)
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
PUSH_RENDERGROUP("RenderScene");
|
||||
CClouds::Render();
|
||||
DoRWRenderHorizon();
|
||||
CRenderer::RenderRoads();
|
||||
@@ -1293,11 +1381,13 @@ RenderScene(void)
|
||||
RwRenderStateSet(rwRENDERSTATECULLMODE, (void*)rwCULLMODECULLNONE);
|
||||
CWeather::RenderRainStreaks();
|
||||
CCoronas::RenderSunReflection();
|
||||
POP_RENDERGROUP();
|
||||
}
|
||||
|
||||
void
|
||||
RenderDebugShit(void)
|
||||
{
|
||||
PUSH_RENDERGROUP("RenderDebugShit");
|
||||
//CTheScripts::RenderTheScriptDebugLines();
|
||||
#ifndef FINAL
|
||||
if(gbShowCollisionLines)
|
||||
@@ -1306,6 +1396,7 @@ RenderDebugShit(void)
|
||||
CDebug::DrawLines();
|
||||
DefinedState();
|
||||
#endif
|
||||
POP_RENDERGROUP();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1317,6 +1408,7 @@ RenderEffects(void)
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
PUSH_RENDERGROUP("RenderEffects");
|
||||
CGlass::Render();
|
||||
CWaterCannons::Render();
|
||||
CSpecialFX::Render();
|
||||
@@ -1333,11 +1425,13 @@ RenderEffects(void)
|
||||
CPointLights::RenderFogEffect();
|
||||
CMovingThings::Render();
|
||||
CRenderer::RenderFirstPersonVehicle();
|
||||
POP_RENDERGROUP();
|
||||
}
|
||||
|
||||
void
|
||||
Render2dStuff(void)
|
||||
{
|
||||
PUSH_RENDERGROUP("Render2dStuff");
|
||||
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE);
|
||||
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
|
||||
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
|
||||
@@ -1409,6 +1503,7 @@ Render2dStuff(void)
|
||||
#ifdef DEBUGMENU
|
||||
DebugMenuRender();
|
||||
#endif
|
||||
POP_RENDERGROUP();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1416,7 +1511,9 @@ RenderMenus(void)
|
||||
{
|
||||
if (FrontEndMenuManager.m_bMenuActive)
|
||||
{
|
||||
PUSH_RENDERGROUP("RenderMenus");
|
||||
FrontEndMenuManager.DrawFrontEnd();
|
||||
POP_RENDERGROUP();
|
||||
}
|
||||
#ifndef MASTER
|
||||
else
|
||||
@@ -1427,6 +1524,7 @@ RenderMenus(void)
|
||||
void
|
||||
Render2dStuffAfterFade(void)
|
||||
{
|
||||
PUSH_RENDERGROUP("Render2dStuffAfterFade");
|
||||
#ifndef MASTER
|
||||
DisplayGameDebugText();
|
||||
#endif
|
||||
@@ -1437,6 +1535,7 @@ Render2dStuffAfterFade(void)
|
||||
CHud::DrawAfterFade();
|
||||
CFont::DrawFonts();
|
||||
CCredits::Render();
|
||||
POP_RENDERGROUP();
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef FINAL
|
||||
// defined in RwHelpder.cpp
|
||||
void PushRendergroup(const char *name);
|
||||
void PopRendergroup(void);
|
||||
#define PUSH_RENDERGROUP(str) PushRendergroup(str)
|
||||
#define POP_RENDERGROUP() PopRendergroup()
|
||||
#else
|
||||
#define PUSH_RENDERGROUP(str)
|
||||
#define POP_RENDERGROUP()
|
||||
#endif
|
||||
|
||||
struct GlobalScene
|
||||
{
|
||||
RpWorld *world;
|
||||
@@ -63,3 +74,11 @@ void SaveINIControllerSettings();
|
||||
extern bool gbNewRenderer;
|
||||
bool FredIsInFirstPersonCam(void);
|
||||
#endif
|
||||
|
||||
#ifdef DRAW_GAME_VERSION_TEXT
|
||||
extern bool gbDrawVersionText;
|
||||
#endif
|
||||
|
||||
#ifdef NO_MOVIES
|
||||
extern bool gbNoMovies;
|
||||
#endif
|
||||
|
||||
268
src/core/re3.cpp
268
src/core/re3.cpp
@@ -1,6 +1,14 @@
|
||||
#include <csignal>
|
||||
#define WITHWINDOWS
|
||||
#include "common.h"
|
||||
#if defined DETECT_JOYSTICK_MENU && defined XINPUT
|
||||
#include <xinput.h>
|
||||
#if !defined(PSAPI_VERSION) || (PSAPI_VERSION > 1)
|
||||
#pragma comment( lib, "Xinput9_1_0.lib" )
|
||||
#else
|
||||
#pragma comment( lib, "Xinput.lib" )
|
||||
#endif
|
||||
#endif
|
||||
#include "Renderer.h"
|
||||
#include "Occlusion.h"
|
||||
#include "Credits.h"
|
||||
@@ -37,7 +45,7 @@
|
||||
#include "MBlur.h"
|
||||
#include "ControllerConfig.h"
|
||||
|
||||
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
|
||||
#ifdef DETECT_JOYSTICK_MENU
|
||||
#include "crossplatform.h"
|
||||
#endif
|
||||
|
||||
@@ -82,16 +90,51 @@ mysrand(unsigned int seed)
|
||||
#ifdef CUSTOM_FRONTEND_OPTIONS
|
||||
#include "frontendoption.h"
|
||||
|
||||
|
||||
|
||||
#ifdef MORE_LANGUAGES
|
||||
void LangPolSelect(int8 action)
|
||||
{
|
||||
if (action == FEOPTION_ACTION_SELECT) {
|
||||
FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_POLISH;
|
||||
FrontEndMenuManager.m_bFrontEnd_ReloadObrTxtGxt = true;
|
||||
FrontEndMenuManager.InitialiseChangedLanguageSettings();
|
||||
FrontEndMenuManager.SaveSettings();
|
||||
}
|
||||
}
|
||||
|
||||
void LangRusSelect(int8 action)
|
||||
{
|
||||
if (action == FEOPTION_ACTION_SELECT) {
|
||||
FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_RUSSIAN;
|
||||
FrontEndMenuManager.m_bFrontEnd_ReloadObrTxtGxt = true;
|
||||
FrontEndMenuManager.InitialiseChangedLanguageSettings();
|
||||
FrontEndMenuManager.SaveSettings();
|
||||
}
|
||||
}
|
||||
|
||||
void LangJapSelect(int8 action)
|
||||
{
|
||||
if (action == FEOPTION_ACTION_SELECT) {
|
||||
FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_JAPANESE;
|
||||
FrontEndMenuManager.m_bFrontEnd_ReloadObrTxtGxt = true;
|
||||
FrontEndMenuManager.InitialiseChangedLanguageSettings();
|
||||
FrontEndMenuManager.SaveSettings();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
CustomFrontendOptionsPopulate(void)
|
||||
{
|
||||
// Moved to an array in MenuScreensCustom.cpp, but APIs are still available. see frontendoption.h
|
||||
|
||||
int fd;
|
||||
// These work only if we have neo folder, so they're dynamically added
|
||||
#ifdef EXTENDED_PIPELINES
|
||||
const char *pipelineNames[] = { "FED_PSP", "FED_PS2","FED_MOB" };
|
||||
const char *off_on[] = { "FEM_OFF", "FEM_ON" };
|
||||
int fd = CFileMgr::OpenFile("neo/neo.txd","r");
|
||||
fd = CFileMgr::OpenFile("neo/neo.txd","r");
|
||||
if (fd) {
|
||||
#ifdef GRAPHICS_MENU_OPTIONS
|
||||
FrontendOptionSetCursor(MENUPAGE_GRAPHICS_SETTINGS, -3, false);
|
||||
@@ -108,6 +151,38 @@ CustomFrontendOptionsPopulate(void)
|
||||
#endif
|
||||
CFileMgr::CloseFile(fd);
|
||||
}
|
||||
#endif
|
||||
// Add outsourced language translations, if files are found
|
||||
#ifdef MORE_LANGUAGES
|
||||
int fd2;
|
||||
FrontendOptionSetCursor(MENUPAGE_LANGUAGE_SETTINGS, 5, false);
|
||||
#if 0
|
||||
if (fd = CFileMgr::OpenFile("text/polish.gxt")) {
|
||||
if (fd2 = CFileMgr::OpenFile("models/fonts_p.txd")) {
|
||||
FrontendOptionAddDynamic("FEL_POL", 0, 0, MENUALIGN_CENTER, nil, nil, LangPolSelect, nil, nil);
|
||||
CFileMgr::CloseFile(fd2);
|
||||
}
|
||||
CFileMgr::CloseFile(fd);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (fd = CFileMgr::OpenFile("text/russian.gxt")) {
|
||||
if (fd2 = CFileMgr::OpenFile("models/fonts_r.txd")) {
|
||||
FrontendOptionAddDynamic("FEL_RUS", 0, 0, MENUALIGN_CENTER, nil, nil, LangRusSelect, nil, nil);
|
||||
CFileMgr::CloseFile(fd2);
|
||||
}
|
||||
CFileMgr::CloseFile(fd);
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (fd = CFileMgr::OpenFile("text/japanese.gxt")) {
|
||||
if (fd2 = CFileMgr::OpenFile("models/fonts_j.txd")) {
|
||||
FrontendOptionAddDynamic("FEL_JAP", 0, 0, MENUALIGN_CENTER, nil, nil, LangJapSelect, nil, nil);
|
||||
CFileMgr::CloseFile(fd2);
|
||||
}
|
||||
CFileMgr::CloseFile(fd);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
}
|
||||
@@ -249,8 +324,40 @@ const char *iniKeyboardButtons[] = {"ESC","F1","F2","F3","F4","F5","F6","F7","F8
|
||||
|
||||
void LoadINIControllerSettings()
|
||||
{
|
||||
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
|
||||
#ifdef DETECT_JOYSTICK_MENU
|
||||
#ifdef XINPUT
|
||||
int storedJoy1 = -1;
|
||||
if (ReadIniIfExists("Controller", "JoystickName", &storedJoy1)) {
|
||||
CPad::XInputJoy1 = -1;
|
||||
CPad::XInputJoy2 = -1;
|
||||
XINPUT_STATE xstate;
|
||||
memset(&xstate, 0, sizeof(XINPUT_STATE));
|
||||
|
||||
// Firstly confirm & set joy 1
|
||||
if (XInputGetState(storedJoy1, &xstate) == ERROR_SUCCESS) {
|
||||
CPad::XInputJoy1 = storedJoy1;
|
||||
}
|
||||
|
||||
for (int i = 0; i <= 3; i++) {
|
||||
if (XInputGetState(i, &xstate) == ERROR_SUCCESS) {
|
||||
if (CPad::XInputJoy1 == -1)
|
||||
CPad::XInputJoy1 = i;
|
||||
else if (CPad::XInputJoy2 == -1 && i != CPad::XInputJoy1)
|
||||
CPad::XInputJoy2 = i;
|
||||
}
|
||||
}
|
||||
|
||||
// There is no plug event on XInput, so let's leave XInputJoy1/2 as 0/1 respectively, and hotplug will be possible.
|
||||
if (CPad::XInputJoy1 == -1) {
|
||||
CPad::XInputJoy1 = 0;
|
||||
CPad::XInputJoy2 = 1;
|
||||
} else if (CPad::XInputJoy2 == -1) {
|
||||
CPad::XInputJoy2 = (CPad::XInputJoy1 + 1) % 4;
|
||||
}
|
||||
}
|
||||
#else
|
||||
ReadIniIfExists("Controller", "JoystickName", gSelectedJoystickName, 128);
|
||||
#endif
|
||||
#endif
|
||||
// force to default GTA behaviour (never overwrite bindings on joy change/initialization) if user init'ed/set bindings before we introduced that
|
||||
if (!ReadIniIfExists("Controller", "PadButtonsInited", &ControlsManager.ms_padButtonsInited)) {
|
||||
@@ -348,8 +455,12 @@ void SaveINIControllerSettings()
|
||||
StoreIni("Bindings", iniControllerActions[i], value, 128);
|
||||
}
|
||||
|
||||
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
|
||||
#ifdef DETECT_JOYSTICK_MENU
|
||||
#ifdef XINPUT
|
||||
StoreIni("Controller", "JoystickName", CPad::XInputJoy1);
|
||||
#else
|
||||
StoreIni("Controller", "JoystickName", gSelectedJoystickName, 128);
|
||||
#endif
|
||||
#endif
|
||||
StoreIni("Controller", "PadButtonsInited", ControlsManager.ms_padButtonsInited);
|
||||
cfg.write_file("reLCS.ini");
|
||||
@@ -373,6 +484,7 @@ bool LoadINISettings()
|
||||
ReadIniIfExists("Controller", "HorizantalMouseSens", &TheCamera.m_fMouseAccelHorzntl);
|
||||
ReadIniIfExists("Controller", "InvertMouseVertically", &MousePointerStateHelper.bInvertVertically);
|
||||
ReadIniIfExists("Controller", "DisableMouseSteering", &CVehicle::m_bDisableMouseSteering);
|
||||
ReadIniIfExists("Controller", "Vibration", &FrontEndMenuManager.m_PrefsUseVibration);
|
||||
ReadIniIfExists("Audio", "SfxVolume", &FrontEndMenuManager.m_PrefsSfxVolume);
|
||||
ReadIniIfExists("Audio", "MusicVolume", &FrontEndMenuManager.m_PrefsMusicVolume);
|
||||
ReadIniIfExists("Audio", "MP3BoostVolume", &FrontEndMenuManager.m_PrefsMP3BoostVolume);
|
||||
@@ -406,6 +518,10 @@ bool LoadINISettings()
|
||||
ReadIniIfExists("CustomPipesValues", "LightmapMult", &CustomPipes::LightmapMult);
|
||||
ReadIniIfExists("CustomPipesValues", "GlossMult", &CustomPipes::GlossMult);
|
||||
#endif
|
||||
ReadIniIfExists("Rendering", "BackfaceCulling", &gBackfaceCulling);
|
||||
#ifdef NEW_RENDERER
|
||||
ReadIniIfExists("Rendering", "NewRenderer", &gbNewRenderer);
|
||||
#endif
|
||||
|
||||
#ifdef PROPER_SCALING
|
||||
ReadIniIfExists("Draw", "ProperScaling", &CDraw::ms_bProperScaling);
|
||||
@@ -416,6 +532,12 @@ bool LoadINISettings()
|
||||
#ifdef FIX_SPRITES
|
||||
ReadIniIfExists("Draw", "FixSprites", &CDraw::ms_bFixSprites);
|
||||
#endif
|
||||
#ifdef DRAW_GAME_VERSION_TEXT
|
||||
ReadIniIfExists("General", "DrawVersionText", &gbDrawVersionText);
|
||||
#endif
|
||||
#ifdef NO_MOVIES
|
||||
ReadIniIfExists("General", "NoMovies", &gbNoMovies);
|
||||
#endif
|
||||
|
||||
#ifdef CUSTOM_FRONTEND_OPTIONS
|
||||
bool migrate = cfg.category_size("FrontendOptions") != 0;
|
||||
@@ -461,6 +583,7 @@ void SaveINISettings()
|
||||
StoreIni("Controller", "HorizantalMouseSens", TheCamera.m_fMouseAccelHorzntl);
|
||||
StoreIni("Controller", "InvertMouseVertically", MousePointerStateHelper.bInvertVertically);
|
||||
StoreIni("Controller", "DisableMouseSteering", CVehicle::m_bDisableMouseSteering);
|
||||
StoreIni("Controller", "Vibration", FrontEndMenuManager.m_PrefsUseVibration);
|
||||
StoreIni("Audio", "SfxVolume", FrontEndMenuManager.m_PrefsSfxVolume);
|
||||
StoreIni("Audio", "MusicVolume", FrontEndMenuManager.m_PrefsMusicVolume);
|
||||
StoreIni("Audio", "MP3BoostVolume", FrontEndMenuManager.m_PrefsMP3BoostVolume);
|
||||
@@ -495,6 +618,9 @@ void SaveINISettings()
|
||||
StoreIni("CustomPipesValues", "GlossMult", CustomPipes::GlossMult);
|
||||
#endif
|
||||
StoreIni("Rendering", "BackfaceCulling", gBackfaceCulling);
|
||||
#ifdef NEW_RENDERER
|
||||
StoreIni("Rendering", "NewRenderer", gbNewRenderer);
|
||||
#endif
|
||||
|
||||
#ifdef PROPER_SCALING
|
||||
StoreIni("Draw", "ProperScaling", CDraw::ms_bProperScaling);
|
||||
@@ -505,6 +631,12 @@ void SaveINISettings()
|
||||
#ifdef FIX_SPRITES
|
||||
StoreIni("Draw", "FixSprites", CDraw::ms_bFixSprites);
|
||||
#endif
|
||||
#ifdef DRAW_GAME_VERSION_TEXT
|
||||
StoreIni("General", "DrawVersionText", gbDrawVersionText);
|
||||
#endif
|
||||
#ifdef NO_MOVIES
|
||||
StoreIni("General", "NoMovies", gbNoMovies);
|
||||
#endif
|
||||
#ifdef CUSTOM_FRONTEND_OPTIONS
|
||||
for (int i = 0; i < MENUPAGES; i++) {
|
||||
for (int j = 0; j < NUM_MENUROWS; j++) {
|
||||
@@ -632,18 +764,6 @@ SwitchCarCollision(void)
|
||||
FindPlayerVehicle()->bUsesCollision = !FindPlayerVehicle()->bUsesCollision;
|
||||
}
|
||||
|
||||
static int engineStatus;
|
||||
static void
|
||||
SetEngineStatus(void)
|
||||
{
|
||||
CVehicle *veh = FindPlayerVehicle();
|
||||
if(veh == nil)
|
||||
return;
|
||||
if(!veh->IsCar())
|
||||
return;
|
||||
((CAutomobile*)veh)->Damage.SetEngineStatus(engineStatus);
|
||||
}
|
||||
|
||||
static void
|
||||
ToggleComedy(void)
|
||||
{
|
||||
@@ -859,13 +979,22 @@ DebugMenuPopulate(void)
|
||||
|
||||
DebugMenuAddVarBool8("Render", "Draw hud", &CHud::m_Wants_To_Draw_Hud, nil);
|
||||
DebugMenuAddVar("Render", "Brightness", &FrontEndMenuManager.m_PrefsBrightness, nil, 16, 0, 700, nil);
|
||||
#ifdef PROPER_SCALING
|
||||
DebugMenuAddVarBool8("Render", "Proper Scaling", &CDraw::ms_bProperScaling, nil);
|
||||
#endif
|
||||
#ifdef FIX_RADAR
|
||||
DebugMenuAddVarBool8("Render", "Fix Radar", &CDraw::ms_bFixRadar, nil);
|
||||
#endif
|
||||
#ifdef FIX_SPRITES
|
||||
DebugMenuAddVarBool8("Render", "Fix Sprites", &CDraw::ms_bFixSprites, nil);
|
||||
#endif
|
||||
DebugMenuAddVarBool8("Render", "Backface Culling", &gBackfaceCulling, nil);
|
||||
DebugMenuAddVarBool8("Render", "PS2 Alpha test Emu", &gPS2alphaTest, nil);
|
||||
DebugMenuAddVarBool8("Render", "Frame limiter", &FrontEndMenuManager.m_PrefsFrameLimiter, nil);
|
||||
DebugMenuAddVarBool8("Render", "VSynch", &FrontEndMenuManager.m_PrefsVsync, nil);
|
||||
DebugMenuAddVar("Render", "Max FPS", &RsGlobal.maxFPS, nil, 1, 1, 1000, nil);
|
||||
#ifdef NEW_RENDERER
|
||||
DebugMenuAddVarBool8("Render", "new renderer", &gbNewRenderer, nil);
|
||||
DebugMenuAddVarBool8("Render", "New Renderer", &gbNewRenderer, nil);
|
||||
extern bool gbRenderRoads;
|
||||
extern bool gbRenderEverythingBarRoads;
|
||||
extern bool gbRenderFadingInUnderwaterEntities;
|
||||
@@ -876,16 +1005,16 @@ extern bool gbRenderVehicles;
|
||||
extern bool gbRenderWorld0;
|
||||
extern bool gbRenderWorld1;
|
||||
extern bool gbRenderWorld2;
|
||||
DebugMenuAddVarBool8("Render", "gbRenderRoads", &gbRenderRoads, nil);
|
||||
DebugMenuAddVarBool8("Render", "gbRenderEverythingBarRoads", &gbRenderEverythingBarRoads, nil);
|
||||
DebugMenuAddVarBool8("Render", "gbRenderFadingInUnderwaterEntities", &gbRenderFadingInUnderwaterEntities, nil);
|
||||
DebugMenuAddVarBool8("Render", "gbRenderFadingInEntities", &gbRenderFadingInEntities, nil);
|
||||
DebugMenuAddVarBool8("Render", "gbRenderWater", &gbRenderWater, nil);
|
||||
DebugMenuAddVarBool8("Render", "gbRenderBoats", &gbRenderBoats, nil);
|
||||
DebugMenuAddVarBool8("Render", "gbRenderVehicles", &gbRenderVehicles, nil);
|
||||
DebugMenuAddVarBool8("Render", "gbRenderWorld0", &gbRenderWorld0, nil);
|
||||
DebugMenuAddVarBool8("Render", "gbRenderWorld1", &gbRenderWorld1, nil);
|
||||
DebugMenuAddVarBool8("Render", "gbRenderWorld2", &gbRenderWorld2, nil);
|
||||
DebugMenuAddVarBool8("Debug Render", "gbRenderRoads", &gbRenderRoads, nil);
|
||||
DebugMenuAddVarBool8("Debug Render", "gbRenderEverythingBarRoads", &gbRenderEverythingBarRoads, nil);
|
||||
DebugMenuAddVarBool8("Debug Render", "gbRenderFadingInUnderwaterEntities", &gbRenderFadingInUnderwaterEntities, nil);
|
||||
DebugMenuAddVarBool8("Debug Render", "gbRenderFadingInEntities", &gbRenderFadingInEntities, nil);
|
||||
DebugMenuAddVarBool8("Debug Render", "gbRenderWater", &gbRenderWater, nil);
|
||||
DebugMenuAddVarBool8("Debug Render", "gbRenderBoats", &gbRenderBoats, nil);
|
||||
DebugMenuAddVarBool8("Debug Render", "gbRenderVehicles", &gbRenderVehicles, nil);
|
||||
DebugMenuAddVarBool8("Debug Render", "gbRenderWorld0", &gbRenderWorld0, nil);
|
||||
DebugMenuAddVarBool8("Debug Render", "gbRenderWorld1", &gbRenderWorld1, nil);
|
||||
DebugMenuAddVarBool8("Debug Render", "gbRenderWorld2", &gbRenderWorld2, nil);
|
||||
#endif
|
||||
|
||||
#ifdef EXTENDED_COLOURFILTER
|
||||
@@ -900,6 +1029,11 @@ extern bool gbRenderWorld2;
|
||||
#ifndef MASTER
|
||||
DebugMenuAddVarBool8("Render", "Occlusion debug", &bDispayOccDebugStuff, nil);
|
||||
#endif
|
||||
#ifdef LIBRW
|
||||
DebugMenuAddVarBool32("Render", "MatFX env map apply light", &rw::MatFX::envMapApplyLight, nil);
|
||||
DebugMenuAddVarBool32("Render", "MatFX env map flip U", &rw::MatFX::envMapFlipU, nil);
|
||||
DebugMenuAddVarBool32("Render", "MatFX env map use matcolor", &rw::MatFX::envMapUseMatColor, nil);
|
||||
#endif
|
||||
#ifdef EXTENDED_PIPELINES
|
||||
static const char *worldpipenames[] = { "PSP", "PS2", "Mobile" };
|
||||
e = DebugMenuAddVar("Render", "World Rendering", &CustomPipes::WorldPipeSwitch, nil,
|
||||
@@ -921,29 +1055,28 @@ extern bool gbRenderDebugEnvMap;
|
||||
// DebugMenuAddVarBool8("Render", "Neo Road Gloss enable", &CustomPipes::GlossEnable, nil);
|
||||
// DebugMenuAddVar("Render", "Mult", &CustomPipes::GlossMult, nil, 0.1f, 0, 1.0f);
|
||||
#endif
|
||||
DebugMenuAddVarBool8("Render", "Show Ped Paths", &gbShowPedPaths, nil);
|
||||
DebugMenuAddVarBool8("Render", "Show Car Paths", &gbShowCarPaths, nil);
|
||||
DebugMenuAddVarBool8("Render", "Show Car Path Links", &gbShowCarPathsLinks, nil);
|
||||
DebugMenuAddVarBool8("Render", "Show Collision Lines", &gbShowCollisionLines, nil);
|
||||
DebugMenuAddVarBool8("Render", "Show Collision Polys", &gbShowCollisionPolys, nil);
|
||||
DebugMenuAddVarBool8("Render", "Don't render Buildings", &gbDontRenderBuildings, nil);
|
||||
DebugMenuAddVarBool8("Render", "Don't render Big Buildings", &gbDontRenderBigBuildings, nil);
|
||||
DebugMenuAddVarBool8("Render", "Don't render Peds", &gbDontRenderPeds, nil);
|
||||
DebugMenuAddVarBool8("Render", "Don't render Vehicles", &gbDontRenderVehicles, nil);
|
||||
DebugMenuAddVarBool8("Render", "Don't render Objects", &gbDontRenderObjects, nil);
|
||||
DebugMenuAddVarBool8("Render", "Don't Render Water", &gbDontRenderWater, nil);
|
||||
DebugMenuAddVarBool8("Debug Render", "Show Ped Paths", &gbShowPedPaths, nil);
|
||||
DebugMenuAddVarBool8("Debug Render", "Show Car Paths", &gbShowCarPaths, nil);
|
||||
DebugMenuAddVarBool8("Debug Render", "Show Car Path Links", &gbShowCarPathsLinks, nil);
|
||||
DebugMenuAddVarBool8("Debug Render", "Show Collision Lines", &gbShowCollisionLines, nil);
|
||||
DebugMenuAddVarBool8("Debug Render", "Show Collision Polys", &gbShowCollisionPolys, nil);
|
||||
DebugMenuAddVarBool8("Debug Render", "Don't render Buildings", &gbDontRenderBuildings, nil);
|
||||
DebugMenuAddVarBool8("Debug Render", "Don't render Big Buildings", &gbDontRenderBigBuildings, nil);
|
||||
DebugMenuAddVarBool8("Debug Render", "Don't render Peds", &gbDontRenderPeds, nil);
|
||||
DebugMenuAddVarBool8("Debug Render", "Don't render Vehicles", &gbDontRenderVehicles, nil);
|
||||
DebugMenuAddVarBool8("Debug Render", "Don't render Objects", &gbDontRenderObjects, nil);
|
||||
DebugMenuAddVarBool8("Debug Render", "Don't Render Water", &gbDontRenderWater, nil);
|
||||
|
||||
#ifdef PROPER_SCALING
|
||||
DebugMenuAddVarBool8("Draw", "Proper Scaling", &CDraw::ms_bProperScaling, nil);
|
||||
|
||||
#ifdef DRAW_GAME_VERSION_TEXT
|
||||
DebugMenuAddVarBool8("Debug", "Version Text", &gbDrawVersionText, nil);
|
||||
#endif
|
||||
#ifdef FIX_RADAR
|
||||
DebugMenuAddVarBool8("Draw", "Fix Radar", &CDraw::ms_bFixRadar, nil);
|
||||
DebugMenuAddVarBool8("Debug", "Show DebugStuffInRelease", &gbDebugStuffInRelease, nil);
|
||||
#ifdef TIMEBARS
|
||||
DebugMenuAddVarBool8("Debug", "Show Timebars", &gbShowTimebars, nil);
|
||||
#endif
|
||||
#ifdef FIX_SPRITES
|
||||
DebugMenuAddVarBool8("Draw", "Fix Sprites", &CDraw::ms_bFixSprites, nil);
|
||||
#endif
|
||||
|
||||
#ifndef FINAL
|
||||
DebugMenuAddVarBool8("Debug", "Use debug render groups", &bDebugRenderGroups, nil);
|
||||
DebugMenuAddVarBool8("Debug", "Print Memory Usage", &gbPrintMemoryUsage, nil);
|
||||
#ifdef USE_CUSTOM_ALLOCATOR
|
||||
DebugMenuAddCmd("Debug", "Parse Heap", ParseHeap);
|
||||
@@ -954,28 +1087,23 @@ extern bool gbRenderDebugEnvMap;
|
||||
#ifdef GTA_SCENE_EDIT
|
||||
DebugMenuAddVarBool8("Debug", "Edit on", &CSceneEdit::m_bEditOn, nil);
|
||||
#endif
|
||||
#ifdef MAP_ENHANCEMENTS
|
||||
DebugMenuAddCmd("Debug", "Teleport to map waypoint", TeleportToWaypoint);
|
||||
#endif
|
||||
DebugMenuAddCmd("Debug", "Switch car collision", SwitchCarCollision);
|
||||
DebugMenuAddVar("Debug", "Engine Status", &engineStatus, nil, 1, 0, 226, nil);
|
||||
DebugMenuAddCmd("Debug", "Set Engine Status", SetEngineStatus);
|
||||
DebugMenuAddCmd("Debug", "Fix Car", FixCar);
|
||||
DebugMenuAddCmd("Debug", "Toggle Comedy Controls", ToggleComedy);
|
||||
DebugMenuAddCmd("Debug", "Place Car on Road", PlaceOnRoad);
|
||||
|
||||
DebugMenuAddVarBool8("Debug", "Script Heli On", &CHeli::ScriptHeliOn, nil);
|
||||
|
||||
DebugMenuAddCmd("Debug", "Start Credits", CCredits::Start);
|
||||
DebugMenuAddCmd("Debug", "Stop Credits", CCredits::Stop);
|
||||
//DebugMenuAddCmd("Debug", "Start Credits", CCredits::Start);
|
||||
//DebugMenuAddCmd("Debug", "Stop Credits", CCredits::Stop);
|
||||
|
||||
#ifdef RELOADABLES
|
||||
DebugMenuAddCmd("Reload", "HUD.TXD", CHud::ReloadTXD);
|
||||
// maybe put it back if we have more to reload
|
||||
// DebugMenuAddCmd("Reload", "HUD.TXD", CHud::ReloadTXD);
|
||||
#endif
|
||||
DebugMenuAddVarBool8("Debug", "Show DebugStuffInRelease", &gbDebugStuffInRelease, nil);
|
||||
#ifdef TIMEBARS
|
||||
DebugMenuAddVarBool8("Debug", "Show Timebars", &gbShowTimebars, nil);
|
||||
|
||||
#ifdef MAP_ENHANCEMENTS
|
||||
DebugMenuAddCmd("Game", "Teleport to map waypoint", TeleportToWaypoint);
|
||||
#endif
|
||||
DebugMenuAddCmd("Game", "Fix Car", FixCar);
|
||||
DebugMenuAddCmd("Game", "Place Car on Road", PlaceOnRoad);
|
||||
DebugMenuAddCmd("Game", "Switch car collision", SwitchCarCollision);
|
||||
DebugMenuAddCmd("Game", "Toggle Comedy Controls", ToggleComedy);
|
||||
|
||||
|
||||
#ifdef MISSION_SWITCHER
|
||||
DebugMenuEntry *missionEntry;
|
||||
static const char* missions[] = {
|
||||
@@ -1005,9 +1133,9 @@ extern bool gbRenderDebugEnvMap;
|
||||
"A Date with Death (Toshiko Kasen)", "Cash in Kazuki's Chips (Toshiko Kasen)"
|
||||
};
|
||||
|
||||
missionEntry = DebugMenuAddVar("Debug", "Select mission", &nextMissionToSwitch, nil, 1, 0, ARRAY_SIZE(missions) - 1, missions);
|
||||
missionEntry = DebugMenuAddVar("Game", "Select mission", &nextMissionToSwitch, nil, 1, 0, ARRAY_SIZE(missions) - 1, missions);
|
||||
DebugMenuEntrySetWrap(missionEntry, true);
|
||||
DebugMenuAddCmd("Debug", "Start selected mission ", SwitchToMission);
|
||||
DebugMenuAddCmd("Game", "Start selected mission ", SwitchToMission);
|
||||
#endif
|
||||
extern bool PrintDebugCode;
|
||||
extern int16 DebugCamMode;
|
||||
@@ -1060,7 +1188,7 @@ void re3_assert(const char *expr, const char *filename, unsigned int lineno, con
|
||||
strcat_s(re3_buff, re3_buffsize, "(Press Retry to debug the application)");
|
||||
|
||||
|
||||
nCode = ::MessageBoxA(nil, re3_buff, "RE3 Assertion Failed!",
|
||||
nCode = ::MessageBoxA(nil, re3_buff, "RELCS Assertion Failed!",
|
||||
MB_ABORTRETRYIGNORE|MB_ICONHAND|MB_SETFOREGROUND|MB_TASKMODAL);
|
||||
|
||||
if (nCode == IDABORT)
|
||||
@@ -1081,7 +1209,7 @@ void re3_assert(const char *expr, const char *filename, unsigned int lineno, con
|
||||
abort();
|
||||
#else
|
||||
// TODO
|
||||
printf("\nRE3 ASSERT FAILED\n\tFile: %s\n\tLine: %d\n\tFunction: %s\n\tExpression: %s\n",filename,lineno,func,expr);
|
||||
printf("\nRELCS ASSERT FAILED\n\tFile: %s\n\tLine: %d\n\tFunction: %s\n\tExpression: %s\n",filename,lineno,func,expr);
|
||||
assert(false);
|
||||
#endif
|
||||
}
|
||||
@@ -1133,14 +1261,14 @@ void re3_usererror(const char *format, ...)
|
||||
vsprintf_s(re3_buff, re3_buffsize, format, va);
|
||||
va_end(va);
|
||||
|
||||
::MessageBoxA(nil, re3_buff, "RE3 Error!",
|
||||
::MessageBoxA(nil, re3_buff, "RELCS Error!",
|
||||
MB_OK|MB_ICONHAND|MB_SETFOREGROUND|MB_TASKMODAL);
|
||||
|
||||
raise(SIGABRT);
|
||||
_exit(3);
|
||||
#else
|
||||
vsprintf(re3_buff, format, va);
|
||||
printf("\nRE3 Error!\n\t%s\n",re3_buff);
|
||||
printf("\nRELCS Error!\n\t%s\n",re3_buff);
|
||||
assert(false);
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user