Merge pull request #259 from Fire-Head/master

fix compiling
This commit is contained in:
Fire_Head 2019-10-27 07:55:49 +03:00 committed by GitHub
commit 5470801332
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 56 additions and 56 deletions

View File

@ -248,13 +248,13 @@ public:
static int32 *EditCodesForControls(int32 *pRsKeys, int32 nSize); static int32 *EditCodesForControls(int32 *pRsKeys, int32 nSize);
// mouse // mouse
bool GetLeftMouseJustDown() { return !!(NewMouseControllerState.LMB && !OldMouseControllerState.LMB); } bool GetLeftMouseJustDown() { return !!(NewMouseControllerState.LMB && !OldMouseControllerState.LMB); }
bool GetRightMouseJustDown() { return !!(NewMouseControllerState.RMB && !OldMouseControllerState.RMB); } bool GetRightMouseJustDown() { return !!(NewMouseControllerState.RMB && !OldMouseControllerState.RMB); }
bool GetMiddleMouseJustDown() { return !!(NewMouseControllerState.MMB && !OldMouseControllerState.MMB); } bool GetMiddleMouseJustDown() { return !!(NewMouseControllerState.MMB && !OldMouseControllerState.MMB); }
bool GetMouseWheelUp() { return !!(NewMouseControllerState.WHEELUP && !OldMouseControllerState.WHEELUP); } bool GetMouseWheelUpJustDown() { return !!(NewMouseControllerState.WHEELUP && !OldMouseControllerState.WHEELUP); }
bool GetMouseWheelDown() { return !!(NewMouseControllerState.WHEELDN && !OldMouseControllerState.WHEELDN);} bool GetMouseWheelDownJustDown() { return !!(NewMouseControllerState.WHEELDN && !OldMouseControllerState.WHEELDN);}
bool GetMouseX1() { return !!(NewMouseControllerState.MXB1 && !OldMouseControllerState.MXB1); } bool GetMouseX1JustDown() { return !!(NewMouseControllerState.MXB1 && !OldMouseControllerState.MXB1); }
bool GetMouseX2() { return !!(NewMouseControllerState.MXB2 && !OldMouseControllerState.MXB2); } bool GetMouseX2JustDown() { return !!(NewMouseControllerState.MXB2 && !OldMouseControllerState.MXB2); }
bool GetLeftMouse() { return NewMouseControllerState.LMB; } bool GetLeftMouse() { return NewMouseControllerState.LMB; }

View File

@ -1,58 +1,58 @@
#define DIRECTINPUT_VERSION 0x0800 #define DIRECTINPUT_VERSION 0x0800
#include "dinput.h" #include "dinput.h"
#include "common.h" #include "common.h"
#include "patcher.h" #include "patcher.h"
#include "Messages.h" #include "Messages.h"
#include "RwHelper.h" #include "RwHelper.h"
#include "Hud.h" #include "Hud.h"
#include "User.h" #include "User.h"
#include "Timer.h" #include "Timer.h"
#include "Text.h" #include "Text.h"
#include "ControllerConfig.h" #include "ControllerConfig.h"
tMessage(&CMessages::BriefMessages)[NUMBRIEFMESSAGES] = *(tMessage(*)[NUMBRIEFMESSAGES])*(uintptr*)0x8786E0; tMessage(&CMessages::BriefMessages)[NUMBRIEFMESSAGES] = *(tMessage(*)[NUMBRIEFMESSAGES])*(uintptr*)0x8786E0;
tPreviousBrief(&CMessages::PreviousBriefs)[NUMPREVIOUSBRIEFS] = *(tPreviousBrief(*)[NUMPREVIOUSBRIEFS])*(uintptr*)0x713C08; tPreviousBrief(&CMessages::PreviousBriefs)[NUMPREVIOUSBRIEFS] = *(tPreviousBrief(*)[NUMPREVIOUSBRIEFS])*(uintptr*)0x713C08;
tBigMessage(&CMessages::BIGMessages)[NUMBIGMESSAGES] = *(tBigMessage(*)[NUMBIGMESSAGES])*(uintptr*)0x773628; tBigMessage(&CMessages::BIGMessages)[NUMBIGMESSAGES] = *(tBigMessage(*)[NUMBIGMESSAGES])*(uintptr*)0x773628;
char CMessages::PreviousMissionTitle[16]; // unused char CMessages::PreviousMissionTitle[16]; // unused
void void
CMessages::Init() CMessages::Init()
{ {
ClearMessages(); ClearMessages();
for (int32 i = 0; i < NUMPREVIOUSBRIEFS; i++) { for (int32 i = 0; i < NUMPREVIOUSBRIEFS; i++) {
PreviousBriefs[i].m_pText = nil; PreviousBriefs[i].m_pText = nil;
PreviousBriefs[i].m_pString = nil; PreviousBriefs[i].m_pString = nil;
} }
} }
uint16 uint16
CMessages::GetWideStringLength(wchar *src) CMessages::GetWideStringLength(wchar *src)
{ {
uint16 length = 0; uint16 length = 0;
while (*(src++)) length++; while (*(src++)) length++;
return length; return length;
} }
void void
CMessages::WideStringCopy(wchar *dst, wchar *src, uint16 size) CMessages::WideStringCopy(wchar *dst, wchar *src, uint16 size)
{ {
int32 i = 0; int32 i = 0;
if (src) { if (src) {
while (i < size - 1) { while (i < size - 1) {
if (!src[i]) break; if (!src[i]) break;
dst[i] = src[i]; dst[i] = src[i];
i++; i++;
} }
} else { } else {
while (i < size - 1) while (i < size - 1)
dst[i++] = '\0'; dst[i++] = '\0';
} }
dst[i] = '\0'; dst[i] = '\0';
} }
bool bool
CMessages::WideStringCompare(wchar *str1, wchar *str2, uint16 size) CMessages::WideStringCompare(wchar *str1, wchar *str2, uint16 size)
{ {
@ -251,11 +251,11 @@ CMessages::AddMessageSoon(wchar *msg, uint32 time, uint16 flag)
void void
CMessages::ClearMessages() CMessages::ClearMessages()
{ {
for (int32 i = 0; i < NUMBIGMESSAGES; i++) { for (int32 i = 0; i < NUMBIGMESSAGES; i++) {
for (int32 j = 0; j < 4; j++) { for (int32 j = 0; j < 4; j++) {
BIGMessages[i].m_Stack[j].m_pText = nil; BIGMessages[i].m_Stack[j].m_pText = nil;
BIGMessages[i].m_Stack[j].m_pString = nil; BIGMessages[i].m_Stack[j].m_pString = nil;
} }
} }
ClearSmallMessagesOnly(); ClearSmallMessagesOnly();
} }
@ -442,7 +442,7 @@ CMessages::InsertPlayerControlKeysInString(wchar *str)
for (i = 0; i < strSize;) { for (i = 0; i < strSize;) {
if (str[i] == '~' && str[i + 1] == 'k' && str[i + 2] == '~') { if (str[i] == '~' && str[i + 1] == 'k' && str[i + 2] == '~') {
i += 4; i += 4;
for (int32 cont = 0; cont < TOTAL_CONTROL_ACTIONS; cont++) { for (int32 cont = 0; cont < MAX_CONTROLLERACTIONS; cont++) {
uint16 contSize = GetWideStringLength(ControlsManager.m_aActionNames[cont]); uint16 contSize = GetWideStringLength(ControlsManager.m_aActionNames[cont]);
if (contSize != 0) { if (contSize != 0) {
if (WideStringCompare(&str[i], ControlsManager.m_aActionNames[cont], contSize)) { if (WideStringCompare(&str[i], ControlsManager.m_aActionNames[cont], contSize)) {
@ -832,4 +832,4 @@ STARTPATCHES
InjectHook(0x52B140, CMessages::ClearThisPrint, PATCH_JUMP); InjectHook(0x52B140, CMessages::ClearThisPrint, PATCH_JUMP);
InjectHook(0x52B3C0, CMessages::ClearThisBigPrint, PATCH_JUMP); InjectHook(0x52B3C0, CMessages::ClearThisBigPrint, PATCH_JUMP);
InjectHook(0x52B670, CMessages::ClearAllMessagesDisplayedByGame, PATCH_JUMP); InjectHook(0x52B670, CMessages::ClearAllMessagesDisplayedByGame, PATCH_JUMP);
ENDPATCHES ENDPATCHES