mirror of
https://github.com/GTAmodding/re3.git
synced 2021-02-19 17:49:54 +01:00
90% fixes, 10% skel refactoring
This commit is contained in:
parent
bcb2b7a534
commit
15918feb8e
@ -141,6 +141,9 @@ void CGarages::Init(void)
|
|||||||
MessageStartTime = 0;
|
MessageStartTime = 0;
|
||||||
PlayerInGarage = false;
|
PlayerInGarage = false;
|
||||||
BombsAreFree = false;
|
BombsAreFree = false;
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
RespraysAreFree = false;
|
||||||
|
#endif
|
||||||
CarsCollected = 0;
|
CarsCollected = 0;
|
||||||
BankVansCollected = 0;
|
BankVansCollected = 0;
|
||||||
PoliceCarsCollected = 0;
|
PoliceCarsCollected = 0;
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "crossplatform.h"
|
#include "crossplatform.h"
|
||||||
|
#include "platform.h"
|
||||||
#ifdef XINPUT
|
#ifdef XINPUT
|
||||||
#include <xinput.h>
|
#include <xinput.h>
|
||||||
#pragma comment( lib, "Xinput9_1_0.lib" )
|
#pragma comment( lib, "Xinput9_1_0.lib" )
|
||||||
@ -544,9 +545,9 @@ CMouseControllerState CMousePointerStateHelper::GetMouseSetUp()
|
|||||||
|
|
||||||
void CPad::UpdateMouse()
|
void CPad::UpdateMouse()
|
||||||
{
|
{
|
||||||
|
#if defined RW_D3D9 || defined RWLIBS
|
||||||
if ( IsForegroundApp() )
|
if ( IsForegroundApp() )
|
||||||
{
|
{
|
||||||
#if defined RW_D3D9 || defined RWLIBS
|
|
||||||
if ( PSGLOBAL(mouse) == nil )
|
if ( PSGLOBAL(mouse) == nil )
|
||||||
_InputInitialiseMouse();
|
_InputInitialiseMouse();
|
||||||
|
|
||||||
@ -583,7 +584,10 @@ void CPad::UpdateMouse()
|
|||||||
OldMouseControllerState = NewMouseControllerState;
|
OldMouseControllerState = NewMouseControllerState;
|
||||||
NewMouseControllerState = PCTempMouseControllerState;
|
NewMouseControllerState = PCTempMouseControllerState;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
|
if ( IsForegroundApp() && PSGLOBAL(cursorIsInWindow) )
|
||||||
|
{
|
||||||
double xpos = 1.0f, ypos;
|
double xpos = 1.0f, ypos;
|
||||||
glfwGetCursorPos(PSGLOBAL(window), &xpos, &ypos);
|
glfwGetCursorPos(PSGLOBAL(window), &xpos, &ypos);
|
||||||
if (xpos == 0.f)
|
if (xpos == 0.f)
|
||||||
@ -621,8 +625,8 @@ void CPad::UpdateMouse()
|
|||||||
|
|
||||||
OldMouseControllerState = NewMouseControllerState;
|
OldMouseControllerState = NewMouseControllerState;
|
||||||
NewMouseControllerState = PCTempMouseControllerState;
|
NewMouseControllerState = PCTempMouseControllerState;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
CControllerState CPad::ReconcileTwoControllersInput(CControllerState const &State1, CControllerState const &State2)
|
CControllerState CPad::ReconcileTwoControllersInput(CControllerState const &State1, CControllerState const &State2)
|
||||||
@ -1072,6 +1076,13 @@ void CPad::UpdatePads(void)
|
|||||||
#else
|
#else
|
||||||
CapturePad(0);
|
CapturePad(0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Improve keyboard input latency part 1
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
OldKeyState = NewKeyState;
|
||||||
|
NewKeyState = TempKeyState;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef DETECT_PAD_INPUT_SWITCH
|
#ifdef DETECT_PAD_INPUT_SWITCH
|
||||||
if (GetPad(0)->PCTempJoyState.CheckForInput())
|
if (GetPad(0)->PCTempJoyState.CheckForInput())
|
||||||
IsAffectedByController = true;
|
IsAffectedByController = true;
|
||||||
@ -1101,8 +1112,11 @@ void CPad::UpdatePads(void)
|
|||||||
GetPad(1)->OldState.Clear();
|
GetPad(1)->OldState.Clear();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Improve keyboard input latency part 2
|
||||||
|
#ifndef FIX_BUGS
|
||||||
OldKeyState = NewKeyState;
|
OldKeyState = NewKeyState;
|
||||||
NewKeyState = TempKeyState;
|
NewKeyState = TempKeyState;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPad::ProcessPCSpecificStuff(void)
|
void CPad::ProcessPCSpecificStuff(void)
|
||||||
|
@ -210,11 +210,7 @@ CStreaming::Init2(void)
|
|||||||
desiredNumVehiclesLoaded = (int32)((ms_memoryAvailable / MB - 50) / 3 + 12);
|
desiredNumVehiclesLoaded = (int32)((ms_memoryAvailable / MB - 50) / 3 + 12);
|
||||||
if(desiredNumVehiclesLoaded > MAXVEHICLESLOADED)
|
if(desiredNumVehiclesLoaded > MAXVEHICLESLOADED)
|
||||||
desiredNumVehiclesLoaded = MAXVEHICLESLOADED;
|
desiredNumVehiclesLoaded = MAXVEHICLESLOADED;
|
||||||
#if defined(__LP64__) || defined(_WIN64)
|
debug("Memory allocated to Streaming is %zuMB", ms_memoryAvailable/MB); // original modifier was %d
|
||||||
debug("Memory allocated to Streaming is %lluMB", ms_memoryAvailable/MB);
|
|
||||||
#else
|
|
||||||
debug("Memory allocated to Streaming is %dMB", ms_memoryAvailable/MB);
|
|
||||||
#endif
|
|
||||||
#undef MB
|
#undef MB
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -2497,11 +2493,7 @@ CStreaming::UpdateForAnimViewer(void)
|
|||||||
if (CStreaming::ms_channelError == -1) {
|
if (CStreaming::ms_channelError == -1) {
|
||||||
CStreaming::AddModelsToRequestList(CVector(0.0f, 0.0f, 0.0f));
|
CStreaming::AddModelsToRequestList(CVector(0.0f, 0.0f, 0.0f));
|
||||||
CStreaming::LoadRequestedModels();
|
CStreaming::LoadRequestedModels();
|
||||||
#if defined(__LP64__) || defined(_WIN64)
|
sprintf(gString, "Requested %d, memory size %zuK\n", CStreaming::ms_numModelsRequested, 2 * CStreaming::ms_memoryUsed); // original modifier was %d
|
||||||
sprintf(gString, "Requested %d, memory size %lluK\n", CStreaming::ms_numModelsRequested, 2 * CStreaming::ms_memoryUsed);
|
|
||||||
#else
|
|
||||||
sprintf(gString, "Requested %d, memory size %dK\n", CStreaming::ms_numModelsRequested, 2 * CStreaming::ms_memoryUsed);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
CStreaming::RetryLoadFile(CStreaming::ms_channelError);
|
CStreaming::RetryLoadFile(CStreaming::ms_channelError);
|
||||||
|
@ -3,19 +3,34 @@
|
|||||||
// This is the common include for platform/renderer specific skeletons(glfw.cpp, win.cpp etc.) and using cross platform things (like Windows directories wrapper, platform specific global arrays etc.)
|
// This is the common include for platform/renderer specific skeletons(glfw.cpp, win.cpp etc.) and using cross platform things (like Windows directories wrapper, platform specific global arrays etc.)
|
||||||
// Functions that's different on glfw and win but have same signature, should be located on platform.h.
|
// Functions that's different on glfw and win but have same signature, should be located on platform.h.
|
||||||
|
|
||||||
|
enum eWinVersion
|
||||||
|
{
|
||||||
|
OS_WIN95 = 0,
|
||||||
|
OS_WIN98,
|
||||||
|
OS_WINNT,
|
||||||
|
OS_WIN2000,
|
||||||
|
OS_WINXP,
|
||||||
|
};
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
// This only has <windef.h> as Windows header, which is lighter (as long as WITHWINDOWS isn't defined / <Windows.h> isn't included).
|
|
||||||
|
// As long as WITHWINDOWS isn't defined / <Windows.h> isn't included, include <windef.h>, which is lighter.
|
||||||
|
#ifndef _INC_WINDOWS
|
||||||
|
#ifdef _WIN64
|
||||||
|
#define _ARM64_
|
||||||
|
#else
|
||||||
|
#define _X86_
|
||||||
|
#endif
|
||||||
|
#include <windef.h>
|
||||||
|
#endif
|
||||||
|
#if defined RW_D3D9 || defined RWLIBS
|
||||||
#include "win.h"
|
#include "win.h"
|
||||||
|
#endif
|
||||||
extern DWORD _dwOperatingSystemVersion;
|
extern DWORD _dwOperatingSystemVersion;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
char *strupr(char *str);
|
char *strupr(char *str);
|
||||||
char *strlwr(char *str);
|
char *strlwr(char *str);
|
||||||
enum {
|
|
||||||
OS_WIN98,
|
|
||||||
OS_WIN2000,
|
|
||||||
OS_WINNT,
|
|
||||||
OS_WINXP,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
LANG_OTHER,
|
LANG_OTHER,
|
||||||
@ -42,6 +57,7 @@ typedef struct
|
|||||||
RwBool fullScreen;
|
RwBool fullScreen;
|
||||||
RwV2d lastMousePos;
|
RwV2d lastMousePos;
|
||||||
double mouseWheel; // glfw doesn't cache it
|
double mouseWheel; // glfw doesn't cache it
|
||||||
|
bool cursorIsInWindow;
|
||||||
RwInt8 joy1id;
|
RwInt8 joy1id;
|
||||||
RwInt8 joy2id;
|
RwInt8 joy2id;
|
||||||
}
|
}
|
||||||
|
@ -278,6 +278,7 @@ psInitialize(void)
|
|||||||
RsGlobal.ps = &PsGlobal;
|
RsGlobal.ps = &PsGlobal;
|
||||||
|
|
||||||
PsGlobal.fullScreen = FALSE;
|
PsGlobal.fullScreen = FALSE;
|
||||||
|
PsGlobal.cursorIsInWindow = TRUE;
|
||||||
|
|
||||||
PsGlobal.joy1id = -1;
|
PsGlobal.joy1id = -1;
|
||||||
PsGlobal.joy2id = -1;
|
PsGlobal.joy2id = -1;
|
||||||
@ -786,6 +787,7 @@ void keypressCB(GLFWwindow* window, int key, int scancode, int action, int mods)
|
|||||||
void resizeCB(GLFWwindow* window, int width, int height);
|
void resizeCB(GLFWwindow* window, int width, int height);
|
||||||
void scrollCB(GLFWwindow* window, double xoffset, double yoffset);
|
void scrollCB(GLFWwindow* window, double xoffset, double yoffset);
|
||||||
void cursorCB(GLFWwindow* window, double xpos, double ypos);
|
void cursorCB(GLFWwindow* window, double xpos, double ypos);
|
||||||
|
void cursorEnterCB(GLFWwindow* window, int entered);
|
||||||
void joysChangeCB(int jid, int event);
|
void joysChangeCB(int jid, int event);
|
||||||
|
|
||||||
bool IsThisJoystickBlacklisted(int i)
|
bool IsThisJoystickBlacklisted(int i)
|
||||||
@ -821,9 +823,10 @@ void _InputInitialiseJoys()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _InputInitialiseMouse()
|
long _InputInitialiseMouse()
|
||||||
{
|
{
|
||||||
glfwSetInputMode(PSGLOBAL(window), GLFW_CURSOR, GLFW_CURSOR_HIDDEN);
|
glfwSetInputMode(PSGLOBAL(window), GLFW_CURSOR, GLFW_CURSOR_HIDDEN);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void psPostRWinit(void)
|
void psPostRWinit(void)
|
||||||
@ -835,6 +838,7 @@ void psPostRWinit(void)
|
|||||||
glfwSetWindowSizeCallback(PSGLOBAL(window), resizeCB);
|
glfwSetWindowSizeCallback(PSGLOBAL(window), resizeCB);
|
||||||
glfwSetScrollCallback(PSGLOBAL(window), scrollCB);
|
glfwSetScrollCallback(PSGLOBAL(window), scrollCB);
|
||||||
glfwSetCursorPosCallback(PSGLOBAL(window), cursorCB);
|
glfwSetCursorPosCallback(PSGLOBAL(window), cursorCB);
|
||||||
|
glfwSetCursorEnterCallback(PSGLOBAL(window), cursorEnterCB);
|
||||||
glfwSetJoystickCallback(joysChangeCB);
|
glfwSetJoystickCallback(joysChangeCB);
|
||||||
|
|
||||||
_InputInitialiseJoys();
|
_InputInitialiseJoys();
|
||||||
@ -1340,13 +1344,18 @@ _InputTranslateShiftKeyUpDown(RsKeyCodes *rs) {
|
|||||||
RsKeyboardEventHandler(rshiftStatus ? rsKEYDOWN : rsKEYUP, &(*rs = rsRSHIFT));
|
RsKeyboardEventHandler(rshiftStatus ? rsKEYDOWN : rsKEYUP, &(*rs = rsRSHIFT));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO this only works in frontend(and luckily only frontend use this), maybe because of glfw knows that mouse pos is > 32000 in game??
|
// TODO this only works in frontend(and luckily only frontend use this). Fun fact: if I get pos manually in game, glfw reports that it's > 32000
|
||||||
void
|
void
|
||||||
cursorCB(GLFWwindow* window, double xpos, double ypos) {
|
cursorCB(GLFWwindow* window, double xpos, double ypos) {
|
||||||
FrontEndMenuManager.m_nMouseTempPosX = xpos;
|
FrontEndMenuManager.m_nMouseTempPosX = xpos;
|
||||||
FrontEndMenuManager.m_nMouseTempPosY = ypos;
|
FrontEndMenuManager.m_nMouseTempPosY = ypos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
cursorEnterCB(GLFWwindow* window, int entered) {
|
||||||
|
PSGLOBAL(cursorIsInWindow) = !!entered;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
*/
|
*/
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#ifndef PLATFORM_H
|
#ifndef PLATFORM_H
|
||||||
#define PLATFORM_H
|
#define PLATFORM_H
|
||||||
|
|
||||||
|
// Functions that's different on glfw/win etc. but have same signature (but if a function only used in win.cpp you can keep in win.h)
|
||||||
|
|
||||||
#include "rwcore.h"
|
#include "rwcore.h"
|
||||||
#include "skeleton.h"
|
#include "skeleton.h"
|
||||||
|
|
||||||
@ -35,6 +37,8 @@ extern RwBool psInstallFileSystem(void);
|
|||||||
extern RwBool psNativeTextureSupport(void);
|
extern RwBool psNativeTextureSupport(void);
|
||||||
|
|
||||||
extern void _InputTranslateShiftKeyUpDown(RsKeyCodes* rs);
|
extern void _InputTranslateShiftKeyUpDown(RsKeyCodes* rs);
|
||||||
|
extern long _InputInitialiseMouse(); // returns HRESULT on Windows actually
|
||||||
|
extern void _InputInitialiseJoys();
|
||||||
|
|
||||||
extern void HandleExit();
|
extern void HandleExit();
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
// DON'T include directly. crossplatform.h includes this if you're on Windows.
|
// DON'T include directly. crossplatform.h includes this if you're using D3D9 backend(win.cpp).
|
||||||
|
|
||||||
#if (!defined(_PLATFORM_WIN_H))
|
#if (!defined(_PLATFORM_WIN_H))
|
||||||
#define _PLATFORM_WIN_H
|
#define _PLATFORM_WIN_H
|
||||||
@ -8,25 +8,6 @@
|
|||||||
#define RSREGSETBREAKALLOC(_name) /* No op */
|
#define RSREGSETBREAKALLOC(_name) /* No op */
|
||||||
#endif /* (!defined(RSREGSETBREAKALLOC)) */
|
#endif /* (!defined(RSREGSETBREAKALLOC)) */
|
||||||
|
|
||||||
#ifndef _INC_WINDOWS
|
|
||||||
#ifdef _WIN64
|
|
||||||
#define _AMD64_
|
|
||||||
#else
|
|
||||||
#define _X86_
|
|
||||||
#endif
|
|
||||||
#include <windef.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
enum eWinVersion
|
|
||||||
{
|
|
||||||
OS_WIN95 = 0,
|
|
||||||
OS_WIN98,
|
|
||||||
OS_WINNT,
|
|
||||||
OS_WIN2000,
|
|
||||||
OS_WINXP,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __DINPUT_INCLUDED__
|
#ifdef __DINPUT_INCLUDED__
|
||||||
/* platform specfic global data */
|
/* platform specfic global data */
|
||||||
typedef struct
|
typedef struct
|
||||||
@ -87,14 +68,12 @@ extern "C"
|
|||||||
{
|
{
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
#ifdef __DINPUT_INCLUDED__
|
|
||||||
extern LRESULT CALLBACK
|
extern LRESULT CALLBACK
|
||||||
MainWndProc(HWND window, UINT message, WPARAM wParam, LPARAM lParam);
|
MainWndProc(HWND window, UINT message, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
|
#ifdef __DINPUT_INCLUDED__
|
||||||
HRESULT _InputInitialise();
|
HRESULT _InputInitialise();
|
||||||
HRESULT _InputInitialiseMouse();
|
|
||||||
HRESULT CapturePad(RwInt32 padID);
|
HRESULT CapturePad(RwInt32 padID);
|
||||||
void _InputInitialiseJoys();
|
|
||||||
void _InputAddJoyStick(LPDIRECTINPUTDEVICE8 lpDevice, INT num);
|
void _InputAddJoyStick(LPDIRECTINPUTDEVICE8 lpDevice, INT num);
|
||||||
HRESULT _InputAddJoys();
|
HRESULT _InputAddJoys();
|
||||||
HRESULT _InputGetMouseState(DIMOUSESTATE2 *state);
|
HRESULT _InputGetMouseState(DIMOUSESTATE2 *state);
|
||||||
|
@ -28,7 +28,7 @@ void CCarGenerator::SwitchOff()
|
|||||||
|
|
||||||
void CCarGenerator::SwitchOn()
|
void CCarGenerator::SwitchOn()
|
||||||
{
|
{
|
||||||
m_nUsesRemaining = -1;
|
m_nUsesRemaining = 255;
|
||||||
m_nTimer = CalcNextGen();
|
m_nTimer = CalcNextGen();
|
||||||
++CTheCarGenerators::CurrentActiveCount;
|
++CTheCarGenerators::CurrentActiveCount;
|
||||||
}
|
}
|
||||||
@ -110,8 +110,13 @@ void CCarGenerator::DoInternalProcessing()
|
|||||||
m_nVehicleHandle = CPools::GetVehiclePool()->GetIndex(pCar);
|
m_nVehicleHandle = CPools::GetVehiclePool()->GetIndex(pCar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m_nUsesRemaining < -1) /* I don't think this is a correct comparasion */
|
#ifdef FIX_BUGS
|
||||||
|
if (m_nUsesRemaining != 0)
|
||||||
--m_nUsesRemaining;
|
--m_nUsesRemaining;
|
||||||
|
#else
|
||||||
|
if (m_nUsesRemaining < -1)
|
||||||
|
--m_nUsesRemaining;
|
||||||
|
#endif
|
||||||
m_nTimer = CalcNextGen();
|
m_nTimer = CalcNextGen();
|
||||||
if (m_nUsesRemaining == 0)
|
if (m_nUsesRemaining == 0)
|
||||||
--CTheCarGenerators::CurrentActiveCount;
|
--CTheCarGenerators::CurrentActiveCount;
|
||||||
|
Loading…
Reference in New Issue
Block a user