mirror of
https://git.rip/DMCA_FUCKER/re3.git
synced 2024-11-05 06:35:54 +00:00
Merge pull request #662 from erorcun/miami
90% fixes, 10% skel refactoring
This commit is contained in:
commit
b05cb3f1a3
|
@ -137,6 +137,9 @@ void CGarages::Init(void)
|
|||
MessageStartTime = 0;
|
||||
PlayerInGarage = false;
|
||||
BombsAreFree = false;
|
||||
#ifdef FIX_BUGS
|
||||
RespraysAreFree = false;
|
||||
#endif
|
||||
CarsCollected = 0;
|
||||
BankVansCollected = 0;
|
||||
PoliceCarsCollected = 0;
|
||||
|
|
|
@ -5155,13 +5155,10 @@ CMenuManager::SwitchMenuOnAndOff()
|
|||
m_bMenuActive = !m_bMenuActive;
|
||||
|
||||
if (m_bMenuActive) {
|
||||
#if defined RW_D3D9 || defined RWLIBS
|
||||
if (_InputMouseNeedsExclusive()) {
|
||||
_InputShutdownMouse();
|
||||
_InputInitialiseMouse(false);
|
||||
}
|
||||
#endif
|
||||
|
||||
Initialise();
|
||||
LoadAllTextures();
|
||||
} else {
|
||||
|
@ -5173,12 +5170,10 @@ CMenuManager::SwitchMenuOnAndOff()
|
|||
DoRWStuffEndOfFrame();
|
||||
DoRWStuffStartOfFrame(0, 0, 0, 0, 0, 0, 255);
|
||||
DoRWStuffEndOfFrame();
|
||||
#if defined RW_D3D9 || defined RWLIBS
|
||||
if (_InputMouseNeedsExclusive()) {
|
||||
_InputShutdownMouse();
|
||||
_InputInitialiseMouse(true);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PS2_LIKE_MENU
|
||||
bottomBarActive = false;
|
||||
|
@ -5223,12 +5218,10 @@ CMenuManager::SwitchMenuOnAndOff()
|
|||
m_bMenuActive = true;
|
||||
m_OnlySaveMenu = true;
|
||||
|
||||
#if defined RW_D3D9 || defined RWLIBS
|
||||
if (_InputMouseNeedsExclusive()) {
|
||||
_InputShutdownMouse();
|
||||
_InputInitialiseMouse(false);
|
||||
}
|
||||
#endif
|
||||
|
||||
Initialise();
|
||||
LoadAllTextures();
|
||||
|
|
|
@ -722,9 +722,9 @@ CMouseControllerState CMousePointerStateHelper::GetMouseSetUp()
|
|||
|
||||
void CPad::UpdateMouse()
|
||||
{
|
||||
#if defined RW_D3D9 || defined RWLIBS
|
||||
if ( IsForegroundApp() )
|
||||
{
|
||||
#if defined RW_D3D9 || defined RWLIBS
|
||||
if ( PSGLOBAL(mouse) == nil )
|
||||
_InputInitialiseMouse(!FrontEndMenuManager.m_bMenuActive && _InputMouseNeedsExclusive());
|
||||
|
||||
|
@ -761,7 +761,10 @@ void CPad::UpdateMouse()
|
|||
OldMouseControllerState = NewMouseControllerState;
|
||||
NewMouseControllerState = PCTempMouseControllerState;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if ( IsForegroundApp() && PSGLOBAL(cursorIsInWindow) )
|
||||
{
|
||||
double xpos = 1.0f, ypos;
|
||||
glfwGetCursorPos(PSGLOBAL(window), &xpos, &ypos);
|
||||
if (xpos == 0.f)
|
||||
|
@ -799,8 +802,8 @@ void CPad::UpdateMouse()
|
|||
|
||||
OldMouseControllerState = NewMouseControllerState;
|
||||
NewMouseControllerState = PCTempMouseControllerState;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
CControllerState CPad::ReconcileTwoControllersInput(CControllerState const &State1, CControllerState const &State2)
|
||||
|
@ -1451,6 +1454,13 @@ void CPad::UpdatePads(void)
|
|||
#else
|
||||
CapturePad(0);
|
||||
#endif
|
||||
|
||||
// Improve keyboard input latency part 1
|
||||
#ifdef FIX_BUGS
|
||||
OldKeyState = NewKeyState;
|
||||
NewKeyState = TempKeyState;
|
||||
#endif
|
||||
|
||||
#ifdef DETECT_PAD_INPUT_SWITCH
|
||||
if (GetPad(0)->PCTempJoyState.CheckForInput())
|
||||
IsAffectedByController = true;
|
||||
|
@ -1472,7 +1482,7 @@ void CPad::UpdatePads(void)
|
|||
if ( bUpdate )
|
||||
{
|
||||
GetPad(0)->Update(0);
|
||||
GetPad(1)->Update(0);
|
||||
// GetPad(1)->Update(0); // not in VC
|
||||
}
|
||||
|
||||
#if defined(MASTER) && !defined(XINPUT)
|
||||
|
@ -1480,8 +1490,11 @@ void CPad::UpdatePads(void)
|
|||
GetPad(1)->OldState.Clear();
|
||||
#endif
|
||||
|
||||
// Improve keyboard input latency part 2
|
||||
#ifndef FIX_BUGS
|
||||
OldKeyState = NewKeyState;
|
||||
NewKeyState = TempKeyState;
|
||||
#endif
|
||||
}
|
||||
|
||||
void CPad::ProcessPCSpecificStuff(void)
|
||||
|
|
|
@ -689,7 +689,11 @@ ChooseComponent(int32 rule, int32 comps)
|
|||
return COMPRULE_COMPN(comps, n-1);
|
||||
return -1;
|
||||
case 4:
|
||||
#ifdef FIX_BUGS
|
||||
return CGeneral::GetRandomNumberInRange(0, 6);
|
||||
#else
|
||||
return CGeneral::GetRandomNumberInRange(0, 5);
|
||||
#endif
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -137,8 +137,8 @@ void CPedAttractorManager::RemoveIceCreamVanEffects(C2dEffect* pEffect)
|
|||
for (std::vector<CVehicleToEffect>::const_iterator assoc = vVehicleToEffect.cbegin(); assoc != vVehicleToEffect.cend();) {
|
||||
if (assoc->GetVehicle() != pVehicle)
|
||||
return;
|
||||
int total = 0;
|
||||
for (int j = 0; j < NUM_ATTRACTORS_FOR_ICECREAM_VAN; j++) {
|
||||
uint32 total = 0;
|
||||
for (uint32 j = 0; j < NUM_ATTRACTORS_FOR_ICECREAM_VAN; j++) {
|
||||
if (FindAssociatedAttractor(assoc->GetEffect(j), vIceCreamAttractors))
|
||||
total++;
|
||||
}
|
||||
|
@ -355,13 +355,13 @@ bool CPedAttractor::BroadcastArrival(CPed* pPed)
|
|||
bool CPedAttractor::BroadcastDeparture(CPed* pPed)
|
||||
{
|
||||
int qid = -1;
|
||||
for (int i = 0; i < vWaitingQueue.size(); i++){
|
||||
for (uint32 i = 0; i < vWaitingQueue.size(); i++){
|
||||
if (vWaitingQueue[i] == pPed)
|
||||
qid = i;
|
||||
}
|
||||
if (qid < 0)
|
||||
return false;
|
||||
for (int i = qid + 1; i < vWaitingQueue.size(); i++) {
|
||||
for (uint32 i = qid + 1; i < vWaitingQueue.size(); i++) {
|
||||
CVector pos;
|
||||
float heading;
|
||||
float time;
|
||||
|
@ -401,7 +401,7 @@ bool CPedAttractor::BroadcastDeparture(CPed* pPed)
|
|||
bool CPedShelterAttractor::BroadcastDeparture(CPed* pPed)
|
||||
{
|
||||
int qid = -1;
|
||||
for (int i = 0; i < vWaitingQueue.size(); i++) {
|
||||
for (uint32 i = 0; i < vWaitingQueue.size(); i++) {
|
||||
if (vWaitingQueue[i] == pPed)
|
||||
qid = i;
|
||||
}
|
||||
|
|
|
@ -1133,7 +1133,11 @@ CFont::ParseToken(wchar *s)
|
|||
case 'r': SetColor(CRGBA(255, 150, 225, 255)); Details.anonymous_23 = true; break;
|
||||
case 't': SetColor(CRGBA(86, 212, 146, 255)); Details.anonymous_23 = true; break;
|
||||
case 'w': SetColor(CRGBA(175, 175, 175, 255)); Details.anonymous_23 = true; break;
|
||||
#ifdef FIX_BUGS
|
||||
case 'x': SetColor(CRGBA(0, 255, 255, 255)); Details.anonymous_23 = true; break;
|
||||
#else
|
||||
case 'x': SetColor(CRGBA(132, 146, 197, 255)); Details.anonymous_23 = true; break;
|
||||
#endif
|
||||
case 'y': SetColor(CRGBA(255, 227, 79, 255)); Details.anonymous_23 = true; break;
|
||||
}
|
||||
while(*s != '~') s++;
|
||||
|
@ -1208,11 +1212,19 @@ CFont::ParseToken(wchar* str, CRGBA &color, bool &flash, bool &bold)
|
|||
color.g = 175;
|
||||
color.b = 175;
|
||||
break;
|
||||
#ifdef FIX_BUGS
|
||||
case 'x':
|
||||
color.r = 0;
|
||||
color.g = 255;
|
||||
color.b = 255;
|
||||
break;
|
||||
#else
|
||||
case 'x':
|
||||
color.r = 132;
|
||||
color.g = 146;
|
||||
color.b = 197;
|
||||
break;
|
||||
#endif
|
||||
case 'y':
|
||||
color.r = 255;
|
||||
color.g = 227;
|
||||
|
|
|
@ -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.)
|
||||
// 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
|
||||
// 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"
|
||||
#endif
|
||||
extern DWORD _dwOperatingSystemVersion;
|
||||
|
||||
#else
|
||||
char *strupr(char *str);
|
||||
char *strlwr(char *str);
|
||||
enum {
|
||||
OS_WIN98,
|
||||
OS_WIN2000,
|
||||
OS_WINNT,
|
||||
OS_WINXP,
|
||||
};
|
||||
|
||||
enum {
|
||||
LANG_OTHER,
|
||||
|
@ -42,6 +57,7 @@ typedef struct
|
|||
RwBool fullScreen;
|
||||
RwV2d lastMousePos;
|
||||
double mouseWheel; // glfw doesn't cache it
|
||||
bool cursorIsInWindow;
|
||||
RwInt8 joy1id;
|
||||
RwInt8 joy2id;
|
||||
}
|
||||
|
|
|
@ -282,6 +282,7 @@ psInitialize(void)
|
|||
RsGlobal.ps = &PsGlobal;
|
||||
|
||||
PsGlobal.fullScreen = FALSE;
|
||||
PsGlobal.cursorIsInWindow = TRUE;
|
||||
|
||||
PsGlobal.joy1id = -1;
|
||||
PsGlobal.joy2id = -1;
|
||||
|
@ -790,6 +791,7 @@ void keypressCB(GLFWwindow* window, int key, int scancode, int action, int mods)
|
|||
void resizeCB(GLFWwindow* window, int width, int height);
|
||||
void scrollCB(GLFWwindow* window, double xoffset, double yoffset);
|
||||
void cursorCB(GLFWwindow* window, double xpos, double ypos);
|
||||
void cursorEnterCB(GLFWwindow* window, int entered);
|
||||
void joysChangeCB(int jid, int event);
|
||||
|
||||
bool IsThisJoystickBlacklisted(int i)
|
||||
|
@ -831,6 +833,17 @@ long _InputInitialiseMouse(bool exclusive)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void _InputShutdownMouse()
|
||||
{
|
||||
// Not needed
|
||||
}
|
||||
|
||||
bool _InputMouseNeedsExclusive()
|
||||
{
|
||||
// That was the cause of infamous mouse bug on Win. Not supported on glfw anyway
|
||||
return false;
|
||||
}
|
||||
|
||||
void psPostRWinit(void)
|
||||
{
|
||||
RwVideoMode vm;
|
||||
|
@ -840,6 +853,7 @@ void psPostRWinit(void)
|
|||
glfwSetWindowSizeCallback(PSGLOBAL(window), resizeCB);
|
||||
glfwSetScrollCallback(PSGLOBAL(window), scrollCB);
|
||||
glfwSetCursorPosCallback(PSGLOBAL(window), cursorCB);
|
||||
glfwSetCursorEnterCallback(PSGLOBAL(window), cursorEnterCB);
|
||||
glfwSetJoystickCallback(joysChangeCB);
|
||||
|
||||
_InputInitialiseJoys();
|
||||
|
@ -1345,13 +1359,18 @@ _InputTranslateShiftKeyUpDown(RsKeyCodes *rs) {
|
|||
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
|
||||
cursorCB(GLFWwindow* window, double xpos, double ypos) {
|
||||
FrontEndMenuManager.m_nMouseTempPosX = xpos;
|
||||
FrontEndMenuManager.m_nMouseTempPosY = ypos;
|
||||
}
|
||||
|
||||
void
|
||||
cursorEnterCB(GLFWwindow* window, int entered) {
|
||||
PSGLOBAL(cursorIsInWindow) = !!entered;
|
||||
}
|
||||
|
||||
/*
|
||||
*****************************************************************************
|
||||
*/
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef 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 "skeleton.h"
|
||||
|
||||
|
@ -36,6 +38,9 @@ extern RwBool psNativeTextureSupport(void);
|
|||
|
||||
extern void _InputTranslateShiftKeyUpDown(RsKeyCodes* rs);
|
||||
extern long _InputInitialiseMouse(bool exclusive); // returns HRESULT on Windows actually
|
||||
extern void _InputShutdownMouse();
|
||||
extern bool _InputMouseNeedsExclusive();
|
||||
extern void _InputInitialiseJoys();
|
||||
|
||||
extern void HandleExit();
|
||||
|
||||
|
|
|
@ -2883,8 +2883,13 @@ void _InputShutdownMouse()
|
|||
SAFE_RELEASE(PSGLOBAL(mouse));
|
||||
}
|
||||
|
||||
BOOL _InputMouseNeedsExclusive(void)
|
||||
bool _InputMouseNeedsExclusive(void)
|
||||
{
|
||||
// FIX: I don't know why R* needed that, but it causes infamous mouse bug on modern systems.
|
||||
// Probably DirectInput bug, since Acquire() and GetDeviceState() reports everything A-OK.
|
||||
#ifdef FIX_BUGS
|
||||
return false;
|
||||
#endif
|
||||
RwVideoMode vm;
|
||||
RwEngineGetVideoModeInfo(&vm, GcurSelVM);
|
||||
|
||||
|
|
|
@ -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))
|
||||
#define _PLATFORM_WIN_H
|
||||
|
@ -8,25 +8,6 @@
|
|||
#define RSREGSETBREAKALLOC(_name) /* No op */
|
||||
#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__
|
||||
/* platform specfic global data */
|
||||
typedef struct
|
||||
|
@ -87,19 +68,16 @@ extern "C"
|
|||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#ifdef __DINPUT_INCLUDED__
|
||||
extern LRESULT CALLBACK
|
||||
MainWndProc(HWND window, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
#ifdef __DINPUT_INCLUDED__
|
||||
HRESULT _InputInitialise();
|
||||
HRESULT CapturePad(RwInt32 padID);
|
||||
void _InputInitialiseJoys();
|
||||
void _InputAddJoyStick(LPDIRECTINPUTDEVICE8 lpDevice, INT num);
|
||||
HRESULT _InputAddJoys();
|
||||
HRESULT _InputGetMouseState(DIMOUSESTATE2 *state);
|
||||
void _InputShutdown();
|
||||
void _InputShutdownMouse();
|
||||
BOOL _InputMouseNeedsExclusive();
|
||||
BOOL CALLBACK _InputEnumDevicesCallback( const DIDEVICEINSTANCE* pdidInstance, VOID* pContext );
|
||||
BOOL _InputTranslateKey(RsKeyCodes *rs, UINT flag, UINT key);
|
||||
BOOL _InputTranslateShiftKey(RsKeyCodes *rs, UINT key, BOOLEAN bDown);
|
||||
|
|
|
@ -32,7 +32,7 @@ void CCarGenerator::SwitchOff()
|
|||
|
||||
void CCarGenerator::SwitchOn()
|
||||
{
|
||||
m_nUsesRemaining = -1;
|
||||
m_nUsesRemaining = 255;
|
||||
m_nTimer = CalcNextGen();
|
||||
++CTheCarGenerators::CurrentActiveCount;
|
||||
}
|
||||
|
@ -141,8 +141,14 @@ void CCarGenerator::DoInternalProcessing()
|
|||
}
|
||||
CVisibilityPlugins::SetClumpAlpha(pVehicle->GetClump(), 0);
|
||||
m_nVehicleHandle = CPools::GetVehiclePool()->GetIndex(pVehicle);
|
||||
if (m_nUsesRemaining < -1) /* I don't think this is a correct comparasion */
|
||||
/* I don't think this is a correct comparasion */
|
||||
#ifdef FIX_BUGS
|
||||
if (m_nUsesRemaining != 0)
|
||||
--m_nUsesRemaining;
|
||||
#else
|
||||
if (m_nUsesRemaining < -1)
|
||||
--m_nUsesRemaining;
|
||||
#endif
|
||||
m_nTimer = CalcNextGen();
|
||||
if (m_nUsesRemaining == 0)
|
||||
--CTheCarGenerators::CurrentActiveCount;
|
||||
|
|
Loading…
Reference in a new issue