mirror of
https://git.rip/DMCA_FUCKER/re3.git
synced 2024-12-23 03:50:01 +00:00
commit
7052b0b64c
27
premake5.lua
27
premake5.lua
|
@ -1,7 +1,7 @@
|
|||
Librw = os.getenv("LIBRW") or "librw"
|
||||
|
||||
workspace "re3"
|
||||
configurations { "Debug", "Release", "ReleaseFH", "DebugRW", "ReleaseRW" }
|
||||
configurations { "Debug", "Release", "ReleaseFH", "DebugRW", "ReleaseRW", "ReleaseGLFW" }
|
||||
location "build"
|
||||
|
||||
files { "src/*.*" }
|
||||
|
@ -19,6 +19,7 @@ workspace "re3"
|
|||
files { "src/save/*.*" }
|
||||
files { "src/skel/*.*" }
|
||||
files { "src/skel/win/*.*" }
|
||||
files { "src/skel/glfw/*.*" }
|
||||
files { "src/text/*.*" }
|
||||
files { "src/vehicles/*.*" }
|
||||
files { "src/weapons/*.*" }
|
||||
|
@ -40,6 +41,7 @@ workspace "re3"
|
|||
includedirs { "src/save/" }
|
||||
includedirs { "src/skel/" }
|
||||
includedirs { "src/skel/win" }
|
||||
includedirs { "src/skel/glfw" }
|
||||
includedirs { "src/text" }
|
||||
includedirs { "src/vehicles" }
|
||||
includedirs { "src/weapons" }
|
||||
|
@ -67,6 +69,21 @@ workspace "re3"
|
|||
links { "rwcore", "rpworld", "rpmatfx", "rpskin", "rphanim", "rtbmp", "rtquat", "rtcharse" }
|
||||
filter {}
|
||||
|
||||
filter "configurations:ReleaseGLFW"
|
||||
defines { "GLEW_STATIC", "GLFW_DLL" }
|
||||
files { "src/fakerw/*.*" }
|
||||
includedirs { "src/fakerw" }
|
||||
includedirs { Librw }
|
||||
includedirs { "glfw-3.3.2.bin.WIN32/include" }
|
||||
includedirs { "glew-2.1.0/include" }
|
||||
libdirs { path.join(Librw, "lib/win-x86-gl3/Release") }
|
||||
libdirs { "glew-2.1.0/lib/Release/Win32" }
|
||||
libdirs { "glfw-3.3.2.bin.WIN32/lib-vc2015" }
|
||||
links { "opengl32" }
|
||||
links { "glew32s" }
|
||||
links { "glfw3dll" }
|
||||
links { "rw" }
|
||||
filter {}
|
||||
|
||||
pbcommands = {
|
||||
"setlocal EnableDelayedExpansion",
|
||||
|
@ -107,8 +124,8 @@ project "re3"
|
|||
symbols "Full"
|
||||
staticruntime "off"
|
||||
|
||||
filter "configurations:not *RW"
|
||||
-- prebuildcommands { "cd \"../librw\" && premake5 " .. _ACTION .. " && msbuild \"build/librw.sln\" /property:Configuration=%{cfg.longname} /property:Platform=\"win-x86-d3d9\"" }
|
||||
filter "configurations:Debug or Release or ReleaseFH"
|
||||
prebuildcommands { "cd \"../librw\" && premake5 " .. _ACTION .. " && msbuild \"build/librw.sln\" /property:Configuration=%{cfg.longname} /property:Platform=\"win-x86-d3d9\"" }
|
||||
defines { "LIBRW", "RW_D3D9" }
|
||||
|
||||
filter "configurations:*RW"
|
||||
|
@ -116,6 +133,10 @@ project "re3"
|
|||
staticruntime "on"
|
||||
linkoptions "/SECTION:_rwcseg,ER!W /MERGE:_rwcseg=.text"
|
||||
|
||||
filter "configurations:*GLFW"
|
||||
prebuildcommands { "cd \"../librw\" && premake5 " .. _ACTION .. " && msbuild \"build/librw.sln\" /property:Configuration=Release /property:Platform=\"win-x86-gl3\"" }
|
||||
defines { "LIBRW", "RW_GL3" }
|
||||
|
||||
filter "configurations:Debug*"
|
||||
defines { "DEBUG" }
|
||||
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
#if defined RW_D3D9 || defined RWLIBS
|
||||
#define DIRECTINPUT_VERSION 0x0800
|
||||
#include <dinput.h>
|
||||
#include "common.h"
|
||||
#endif
|
||||
|
||||
#include "common.h"
|
||||
#include "crossplatform.h"
|
||||
#include "ControllerConfig.h"
|
||||
#include "Pad.h"
|
||||
#include "FileMgr.h"
|
||||
|
@ -15,7 +18,6 @@
|
|||
#include "World.h"
|
||||
#include "ModelIndices.h"
|
||||
#include "Camera.h"
|
||||
#include "win.h"
|
||||
#include "GenericGameStorage.h"
|
||||
|
||||
CControllerConfigManager ControlsManager;
|
||||
|
@ -41,14 +43,72 @@ void CControllerConfigManager::MakeControllerActionsBlank()
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef RW_GL3
|
||||
int MapIdToButtonId(int mapId) {
|
||||
switch (mapId) {
|
||||
case GLFW_GAMEPAD_BUTTON_A: // Cross
|
||||
return 2;
|
||||
case GLFW_GAMEPAD_BUTTON_B: // Circle
|
||||
return 1;
|
||||
case GLFW_GAMEPAD_BUTTON_X: // Square
|
||||
return 3;
|
||||
case GLFW_GAMEPAD_BUTTON_Y: // Triangle
|
||||
return 4;
|
||||
case GLFW_GAMEPAD_BUTTON_LEFT_BUMPER:
|
||||
return 7;
|
||||
case GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER:
|
||||
return 8;
|
||||
case GLFW_GAMEPAD_BUTTON_BACK:
|
||||
return 9;
|
||||
case GLFW_GAMEPAD_BUTTON_START:
|
||||
return 12;
|
||||
case GLFW_GAMEPAD_BUTTON_LEFT_THUMB:
|
||||
return 10;
|
||||
case GLFW_GAMEPAD_BUTTON_RIGHT_THUMB:
|
||||
return 11;
|
||||
case GLFW_GAMEPAD_BUTTON_DPAD_UP:
|
||||
return 13;
|
||||
case GLFW_GAMEPAD_BUTTON_DPAD_RIGHT:
|
||||
return 14;
|
||||
case GLFW_GAMEPAD_BUTTON_DPAD_DOWN:
|
||||
return 15;
|
||||
case GLFW_GAMEPAD_BUTTON_DPAD_LEFT:
|
||||
return 16;
|
||||
// GLFW sends those as axes, so I added them here manually.
|
||||
case 15: // Left trigger
|
||||
return 5;
|
||||
case 16: // Right trigger
|
||||
return 6;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int32 CControllerConfigManager::GetJoyButtonJustDown()
|
||||
{
|
||||
#ifdef __DINPUT_INCLUDED__
|
||||
#ifdef FIX_BUGS
|
||||
for (int32 i = 0; i < MAX_BUTTONS; i++)
|
||||
#else
|
||||
for (int32 i = 0; i < JOY_BUTTONS; i++)
|
||||
#endif
|
||||
{
|
||||
if (m_NewState.rgbButtons[i] & 0x80 && !(m_OldState.rgbButtons[i] & 0x80))
|
||||
return i + 1;
|
||||
}
|
||||
#elif defined RW_GL3
|
||||
if (m_NewState.isGamepad) {
|
||||
for (int32 i = 0; i < MAX_BUTTONS; i++) {
|
||||
if (m_NewState.mappedButtons[i] && !(m_OldState.mappedButtons[i]))
|
||||
return MapIdToButtonId(i);
|
||||
}
|
||||
} else {
|
||||
for (int32 i = 0; i < Min(m_NewState.numButtons, MAX_BUTTONS); i++) {
|
||||
if (m_NewState.buttons[i] && !(m_OldState.buttons[i]))
|
||||
return i + 1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
@ -249,8 +309,13 @@ void CControllerConfigManager::InitDefaultControlConfigJoyPad(uint32 buttons)
|
|||
if (buttons > 16)
|
||||
btn = 16;
|
||||
|
||||
// Now we use SDL Game Controller DB
|
||||
#if defined RW_D3D9 || defined RWLIBS
|
||||
if ( AllValidWinJoys.m_aJoys[JOYSTICK1].m_nVendorID == 0x3427
|
||||
&& AllValidWinJoys.m_aJoys[JOYSTICK1].m_nProductID == 0x1190)
|
||||
#else
|
||||
if (0)
|
||||
#endif
|
||||
{
|
||||
//GIC USB Joystick, PS2 Gamepad ?
|
||||
|
||||
|
@ -445,8 +510,13 @@ void CControllerConfigManager::UpdateJoyInConfigMenus_ButtonDown(int32 button, i
|
|||
break;
|
||||
}
|
||||
|
||||
// Now we use SDL Game Controller DB
|
||||
#if defined RW_D3D9 || defined RWLIBS
|
||||
if (AllValidWinJoys.m_aJoys[JOYSTICK1].m_nVendorID == 0x3427
|
||||
&& AllValidWinJoys.m_aJoys[JOYSTICK1].m_nProductID == 0x1190)
|
||||
#else
|
||||
if (0)
|
||||
#endif
|
||||
{
|
||||
//GIC USB Joystick, PS2 Gamepad ?
|
||||
|
||||
|
@ -872,8 +942,13 @@ void CControllerConfigManager::UpdateJoyInConfigMenus_ButtonUp(int32 button, int
|
|||
break;
|
||||
}
|
||||
|
||||
// Now we use SDL Game Controller DB
|
||||
#if defined RW_D3D9 || defined RWLIBS
|
||||
if (AllValidWinJoys.m_aJoys[JOYSTICK1].m_nVendorID == 0x3427
|
||||
&& AllValidWinJoys.m_aJoys[JOYSTICK1].m_nProductID == 0x1190)
|
||||
#else
|
||||
if (0)
|
||||
#endif
|
||||
{
|
||||
//GIC USB Joystick, PS2 Gamepad ?
|
||||
|
||||
|
@ -1809,7 +1884,7 @@ wchar *CControllerConfigManager::GetControllerSettingTextKeyBoard(e_ControllerAc
|
|||
static wchar ActionText[50];
|
||||
static wchar NewStringWithNumber[30];
|
||||
|
||||
for (int32 i = 0; i < ARRAYSIZE(ActionText); i++)
|
||||
for (int32 i = 0; i < ARRAY_SIZE(ActionText); i++)
|
||||
ActionText[i] = '\0';
|
||||
|
||||
if (GetControllerKeyAssociatedWithAction(action, type) != rsNULL)
|
||||
|
@ -2266,6 +2341,19 @@ void CControllerConfigManager::UpdateJoyButtonState(int32 padnumber)
|
|||
else
|
||||
m_aButtonStates[i] = false;
|
||||
}
|
||||
#elif defined RW_GL3
|
||||
if (m_NewState.isGamepad) {
|
||||
for (int32 i = 0; i < MAX_BUTTONS; i++) {
|
||||
if (i == GLFW_GAMEPAD_BUTTON_GUIDE)
|
||||
continue;
|
||||
|
||||
m_aButtonStates[MapIdToButtonId(i)-1] = m_NewState.mappedButtons[i];
|
||||
}
|
||||
} else {
|
||||
for (int32 i = 0; i < Min(m_NewState.numButtons, MAX_BUTTONS); i++) {
|
||||
m_aButtonStates[i] = m_NewState.buttons[i];
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -96,6 +96,16 @@ class CControllerState;
|
|||
|
||||
#define ACTIONNAME_LENGTH 40
|
||||
|
||||
#ifdef RW_GL3
|
||||
struct GlfwJoyState {
|
||||
int8 id;
|
||||
bool isGamepad;
|
||||
uint8 numButtons;
|
||||
uint8* buttons;
|
||||
bool mappedButtons[17];
|
||||
};
|
||||
#endif
|
||||
|
||||
class CControllerConfigManager
|
||||
{
|
||||
public:
|
||||
|
@ -115,8 +125,9 @@ public:
|
|||
#ifdef __DINPUT_INCLUDED__
|
||||
DIJOYSTATE2 m_OldState;
|
||||
DIJOYSTATE2 m_NewState;
|
||||
#else
|
||||
uint32 ___padd[0x110 / 4 * 2];
|
||||
#elif defined RW_GL3
|
||||
GlfwJoyState m_OldState;
|
||||
GlfwJoyState m_NewState;
|
||||
#endif
|
||||
wchar m_aActionNames[MAX_CONTROLLERACTIONS][ACTIONNAME_LENGTH];
|
||||
bool m_aButtonStates[MAX_BUTTONS];
|
||||
|
@ -193,6 +204,6 @@ public:
|
|||
void ResetSettingOrder (e_ControllerAction action);
|
||||
};
|
||||
|
||||
VALIDATE_SIZE(CControllerConfigManager, 0x143C);
|
||||
//VALIDATE_SIZE(CControllerConfigManager, 0x143C);
|
||||
|
||||
extern CControllerConfigManager ControlsManager;
|
|
@ -1,8 +1,11 @@
|
|||
#if defined RW_D3D9 || defined RWLIBS
|
||||
#define DIRECTINPUT_VERSION 0x0800
|
||||
#include <dinput.h>
|
||||
#include "common.h"
|
||||
#endif
|
||||
|
||||
#include "win.h"
|
||||
#define WITHWINDOWS
|
||||
#include "common.h"
|
||||
#include "crossplatform.h"
|
||||
#include "Frontend.h"
|
||||
#include "Font.h"
|
||||
#include "Pad.h"
|
||||
|
@ -430,13 +433,16 @@ CMenuManager::BuildStatLine(char *text, void *stat, bool itsFloat, void *stat2)
|
|||
void
|
||||
CMenuManager::CentreMousePointer()
|
||||
{
|
||||
tagPOINT Point;
|
||||
|
||||
if (SCREEN_WIDTH * 0.5f != 0.0f && 0.0f != SCREEN_HEIGHT * 0.5f) {
|
||||
#if defined RW_D3D9 || defined RWLIBS
|
||||
tagPOINT Point;
|
||||
Point.x = SCREEN_WIDTH / 2;
|
||||
Point.y = SCREEN_HEIGHT / 2;
|
||||
ClientToScreen(PSGLOBAL(window), &Point);
|
||||
SetCursorPos(Point.x, Point.y);
|
||||
#elif defined RW_GL3
|
||||
glfwSetCursorPos(PSGLOBAL(window), SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2);
|
||||
#endif
|
||||
|
||||
PSGLOBAL(lastMousePos.x) = SCREEN_WIDTH / 2;
|
||||
PSGLOBAL(lastMousePos.y) = SCREEN_HEIGHT / 2;
|
||||
|
@ -4474,12 +4480,20 @@ CMenuManager::ProcessButtonPresses(void)
|
|||
ControlsManager.MakeControllerActionsBlank();
|
||||
ControlsManager.InitDefaultControlConfiguration();
|
||||
ControlsManager.InitDefaultControlConfigMouse(MousePointerStateHelper.GetMouseSetUp());
|
||||
if (AllValidWinJoys.m_aJoys[0].m_bInitialised) {
|
||||
#if !defined RW_GL3
|
||||
if (AllValidWinJoys.m_aJoys[JOYSTICK1].m_bInitialised) {
|
||||
DIDEVCAPS devCaps;
|
||||
devCaps.dwSize = sizeof(DIDEVCAPS);
|
||||
PSGLOBAL(joy1)->GetCapabilities(&devCaps);
|
||||
ControlsManager.InitDefaultControlConfigJoyPad(devCaps.dwButtons);
|
||||
}
|
||||
#else
|
||||
if (PSGLOBAL(joy1id) != -1 && glfwJoystickPresent(PSGLOBAL(joy1id))) {
|
||||
int count;
|
||||
glfwGetJoystickButtons(PSGLOBAL(joy1id), &count);
|
||||
ControlsManager.InitDefaultControlConfigJoyPad(count);
|
||||
}
|
||||
#endif
|
||||
m_ControlMethod = CONTROL_STANDARD;
|
||||
MousePointerStateHelper.bInvertVertically = false;
|
||||
TheCamera.m_fMouseAccelHorzntl = 0.0025f;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#pragma warning( disable : 4005)
|
||||
#pragma warning( pop )
|
||||
#include "common.h"
|
||||
#include "win.h"
|
||||
#include "crossplatform.h"
|
||||
|
||||
#include "Game.h"
|
||||
#include "main.h"
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
#pragma warning( push )
|
||||
#pragma warning( disable : 4005)
|
||||
#if defined RW_D3D9 || defined RWLIBS
|
||||
#define DIRECTINPUT_VERSION 0x0800
|
||||
#include <dinput.h>
|
||||
#endif
|
||||
#pragma warning( pop )
|
||||
|
||||
#include "common.h"
|
||||
#include "crossplatform.h"
|
||||
#ifdef XINPUT
|
||||
#include <xinput.h>
|
||||
#pragma comment( lib, "Xinput9_1_0.lib" )
|
||||
|
@ -29,7 +32,6 @@
|
|||
#include "Record.h"
|
||||
#include "Replay.h"
|
||||
#include "Weather.h"
|
||||
#include "win.h"
|
||||
#include "Streaming.h"
|
||||
#include "PathFind.h"
|
||||
#include "Wanted.h"
|
||||
|
@ -423,6 +425,7 @@ CMouseControllerState CMousePointerStateHelper::GetMouseSetUp()
|
|||
{
|
||||
CMouseControllerState state;
|
||||
|
||||
#if defined RW_D3D9 || defined RWLIBS
|
||||
if ( PSGLOBAL(mouse) == nil )
|
||||
_InputInitialiseMouse();
|
||||
|
||||
|
@ -432,7 +435,6 @@ CMouseControllerState CMousePointerStateHelper::GetMouseSetUp()
|
|||
devCaps.dwSize = sizeof(DIDEVCAPS);
|
||||
|
||||
PSGLOBAL(mouse)->GetCapabilities(&devCaps);
|
||||
|
||||
switch ( devCaps.dwButtons )
|
||||
{
|
||||
case 3:
|
||||
|
@ -456,6 +458,19 @@ CMouseControllerState CMousePointerStateHelper::GetMouseSetUp()
|
|||
state.WHEELUP = true;
|
||||
}
|
||||
}
|
||||
#else
|
||||
// It seems there is no way to get number of buttons on mouse, so assign all buttons if we have mouse.
|
||||
double xpos = 1.0f, ypos;
|
||||
glfwGetCursorPos(PSGLOBAL(window), &xpos, &ypos);
|
||||
|
||||
if (xpos != NULL) {
|
||||
state.MMB = true;
|
||||
state.RMB = true;
|
||||
state.LMB = true;
|
||||
state.WHEELDN = true;
|
||||
state.WHEELUP = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
return state;
|
||||
}
|
||||
|
@ -464,6 +479,7 @@ void CPad::UpdateMouse()
|
|||
{
|
||||
if ( IsForegroundApp() )
|
||||
{
|
||||
#if defined RW_D3D9 || defined RWLIBS
|
||||
if ( PSGLOBAL(mouse) == nil )
|
||||
_InputInitialiseMouse();
|
||||
|
||||
|
@ -500,6 +516,44 @@ void CPad::UpdateMouse()
|
|||
OldMouseControllerState = NewMouseControllerState;
|
||||
NewMouseControllerState = PCTempMouseControllerState;
|
||||
}
|
||||
#else
|
||||
double xpos = 1.0f, ypos;
|
||||
glfwGetCursorPos(PSGLOBAL(window), &xpos, &ypos);
|
||||
if (xpos == NULL)
|
||||
return;
|
||||
|
||||
int32 signX = 1;
|
||||
int32 signy = 1;
|
||||
|
||||
if (!FrontEndMenuManager.m_bMenuActive)
|
||||
{
|
||||
if (MousePointerStateHelper.bInvertVertically)
|
||||
signy = -1;
|
||||
if (MousePointerStateHelper.bInvertHorizontally)
|
||||
signX = -1;
|
||||
}
|
||||
|
||||
PCTempMouseControllerState.Clear();
|
||||
|
||||
PCTempMouseControllerState.x = (float)(signX * (xpos - PSGLOBAL(lastMousePos.x)));
|
||||
PCTempMouseControllerState.y = (float)(signy * (ypos - PSGLOBAL(lastMousePos.y)));
|
||||
PCTempMouseControllerState.LMB = glfwGetMouseButton(PSGLOBAL(window), GLFW_MOUSE_BUTTON_LEFT);
|
||||
PCTempMouseControllerState.RMB = glfwGetMouseButton(PSGLOBAL(window), GLFW_MOUSE_BUTTON_RIGHT);
|
||||
PCTempMouseControllerState.MMB = glfwGetMouseButton(PSGLOBAL(window), GLFW_MOUSE_BUTTON_MIDDLE);
|
||||
PCTempMouseControllerState.MXB1 = glfwGetMouseButton(PSGLOBAL(window), GLFW_MOUSE_BUTTON_4);
|
||||
PCTempMouseControllerState.MXB2 = glfwGetMouseButton(PSGLOBAL(window), GLFW_MOUSE_BUTTON_5);
|
||||
|
||||
PSGLOBAL(lastMousePos.x) = xpos;
|
||||
PSGLOBAL(lastMousePos.y) = ypos;
|
||||
|
||||
if (PSGLOBAL(mouseWheel) > 0)
|
||||
PCTempMouseControllerState.WHEELUP = 1;
|
||||
else if (PSGLOBAL(mouseWheel) < 0)
|
||||
PCTempMouseControllerState.WHEELDN = 1;
|
||||
|
||||
OldMouseControllerState = NewMouseControllerState;
|
||||
NewMouseControllerState = PCTempMouseControllerState;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,11 +11,11 @@
|
|||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#ifdef WITHWINDOWS
|
||||
#if defined _WIN32 && defined WITHWINDOWS
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#ifdef WITHD3D
|
||||
#if defined _WIN32 && defined WITHD3D
|
||||
#include <windows.h>
|
||||
#include <d3d8types.h>
|
||||
#endif
|
||||
|
|
|
@ -200,7 +200,7 @@ enum Config {
|
|||
//#define PS2_ALTERNATIVE_CARSPLASH // unused on PS2
|
||||
|
||||
// Pad
|
||||
#define XINPUT
|
||||
// #define XINPUT
|
||||
#define KANGAROO_CHEAT
|
||||
#define REGISTER_START_BUTTON
|
||||
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
#define WITHWINDOWS
|
||||
#include "common.h"
|
||||
#include "patcher.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
StaticPatcher *StaticPatcher::ms_head;
|
||||
|
||||
StaticPatcher::StaticPatcher(Patcher func)
|
||||
|
|
|
@ -460,13 +460,17 @@ RwBool RwRenderStateSet(RwRenderState state, void *value)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
static EngineOpenParams openParams;
|
||||
// WARNING: unused parameters
|
||||
RwBool RwEngineInit(RwMemoryFunctions *memFuncs, RwUInt32 initFlags, RwUInt32 resArenaSize) { Engine::init(); return true; }
|
||||
// TODO: this is platform dependent
|
||||
RwBool RwEngineOpen(RwEngineOpenParams *initParams) {
|
||||
#if defined RW_D3D9 || defined RWLIBS
|
||||
static EngineOpenParams openParams;
|
||||
openParams.window = (HWND)initParams->displayID;
|
||||
#else
|
||||
extern EngineOpenParams openParams;
|
||||
openParams.window = (GLFWwindow**)initParams->displayID;
|
||||
#endif
|
||||
return Engine::open(&openParams);
|
||||
}
|
||||
RwBool RwEngineStart(void) {
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
#if defined RW_D3D9 || defined RWLIBS
|
||||
#define WITHD3D
|
||||
#endif
|
||||
#include "common.h"
|
||||
|
||||
#include "Timecycle.h"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#pragma warning( disable : 4005)
|
||||
#pragma warning( pop )
|
||||
#include "common.h"
|
||||
#include "win.h"
|
||||
#include "crossplatform.h"
|
||||
|
||||
#include "Timer.h"
|
||||
#ifdef GTA_PC
|
||||
|
|
|
@ -127,6 +127,38 @@ CTxdStore::RemoveRefWithoutDelete(int slot)
|
|||
GetSlot(slot)->refCount--;
|
||||
}
|
||||
|
||||
#ifdef RW_GL3
|
||||
rw::Raster*
|
||||
convertTexRaster(rw::Raster* ras)
|
||||
{
|
||||
rw::Image* img = ras->toImage();
|
||||
// ras->destroy();
|
||||
img->unindex();
|
||||
ras = rw::Raster::createFromImage(img);
|
||||
img->destroy();
|
||||
return ras;
|
||||
}
|
||||
|
||||
void
|
||||
convertTxd(rw::TexDictionary* txd)
|
||||
{
|
||||
rw::Texture* tex;
|
||||
FORLIST(lnk, txd->textures) {
|
||||
tex = rw::Texture::fromDict(lnk);
|
||||
rw::Raster* ras = tex->raster;
|
||||
if (ras && ras->platform != rw::platform) {
|
||||
if (!(ras->platform == rw::PLATFORM_D3D8 && rw::platform == rw::PLATFORM_D3D9 ||
|
||||
ras->platform == rw::PLATFORM_D3D9 && rw::platform == rw::PLATFORM_D3D8)) {
|
||||
tex->raster = convertTexRaster(ras);
|
||||
ras->destroy();
|
||||
}
|
||||
}
|
||||
tex->setFilter(rw::Texture::LINEAR);
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
bool
|
||||
CTxdStore::LoadTxd(int slot, RwStream *stream)
|
||||
{
|
||||
|
@ -134,6 +166,9 @@ CTxdStore::LoadTxd(int slot, RwStream *stream)
|
|||
|
||||
if(RwStreamFindChunk(stream, rwID_TEXDICTIONARY, nil, nil)){
|
||||
def->texDict = RwTexDictionaryGtaStreamRead(stream);
|
||||
#ifdef RW_GL3
|
||||
convertTxd(def->texDict);
|
||||
#endif
|
||||
return def->texDict != nil;
|
||||
}
|
||||
printf("Failed to load TXD\n");
|
||||
|
|
|
@ -1,5 +1,61 @@
|
|||
#include <time.h>
|
||||
|
||||
// This is the common include for platform/renderer specific skeletons(glfw, win etc.) and cross platform things (like Windows directories wrapper, platform specific global arrays etc.)
|
||||
|
||||
// This only has <windef.h> as Win header.
|
||||
#ifdef _WIN32
|
||||
#include "win.h"
|
||||
#endif
|
||||
|
||||
#ifdef RW_GL3
|
||||
typedef struct
|
||||
{
|
||||
GLFWwindow* window;
|
||||
RwBool fullScreen;
|
||||
RwV2d lastMousePos;
|
||||
double mouseWheel; // glfw doesn't cache it
|
||||
int8 joy1id;
|
||||
int8 joy2id;
|
||||
}
|
||||
psGlobalType;
|
||||
|
||||
#define PSGLOBAL(var) (((psGlobalType *)(RsGlobal.ps))->var)
|
||||
|
||||
void CapturePad(RwInt32 padID);
|
||||
void joysChangeCB(int jid, int event);
|
||||
#endif
|
||||
|
||||
enum eGameState
|
||||
{
|
||||
GS_START_UP = 0,
|
||||
GS_INIT_LOGO_MPEG,
|
||||
GS_LOGO_MPEG,
|
||||
GS_INIT_INTRO_MPEG,
|
||||
GS_INTRO_MPEG,
|
||||
GS_INIT_ONCE,
|
||||
GS_INIT_FRONTEND,
|
||||
GS_FRONTEND,
|
||||
GS_INIT_PLAYING_GAME,
|
||||
GS_PLAYING_GAME,
|
||||
#ifndef MASTER
|
||||
GS_ANIMVIEWER,
|
||||
#endif
|
||||
};
|
||||
extern RwUInt32 gGameState;
|
||||
|
||||
RwBool IsForegroundApp();
|
||||
void InitialiseLanguage();
|
||||
RwBool _psSetVideoMode(RwInt32 subSystem, RwInt32 videoMode);
|
||||
|
||||
RwChar** _psGetVideoModeList();
|
||||
RwInt32 _psGetNumVideModes();
|
||||
|
||||
void _psSelectScreenVM(RwInt32 videoMode);
|
||||
void HandleExit();
|
||||
void _InputTranslateShiftKeyUpDown(RsKeyCodes* rs);
|
||||
|
||||
// Mostly wrappers around Windows functions
|
||||
|
||||
#ifndef MAX_PATH
|
||||
#if !defined _WIN32 || defined __MINGW32__
|
||||
#define MAX_PATH PATH_MAX
|
||||
|
@ -8,8 +64,6 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
// Mostly wrappers around Windows functions
|
||||
|
||||
// TODO: Remove USEALTERNATIVEWINFUNCS and don't use it anywhere when re3 becomes fully cross-platform, this is for testing
|
||||
// Codes compatible with Windows and Linux
|
||||
#if defined USEALTERNATIVEWINFUNCS || !defined _WIN32 || defined __MINGW32__
|
||||
|
@ -27,18 +81,13 @@ struct SYSTEMTIME {
|
|||
uint16 wMilliseconds;
|
||||
};
|
||||
|
||||
#define GetLocalTime GetLocalTime_CP
|
||||
#else
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
|
||||
void GetLocalTime_CP(SYSTEMTIME* out);
|
||||
|
||||
#define GetLocalTime GetLocalTime_CP
|
||||
#define OutputDebugString(s) re3_debug("[DBG-2]: " s "\n")
|
||||
#endif
|
||||
|
||||
// Only runs on GNU/POSIX/etc.
|
||||
#if !defined _WIN32 || defined __MINGW32__
|
||||
#define OutputDebugString(s) re3_debug("[DBG-2]: " s "\n")
|
||||
|
||||
#include <iostream>
|
||||
#include <dirent.h>
|
||||
#include <sys/types.h>
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
#include "rwcore.h"
|
||||
#include "skeleton.h"
|
||||
#include "events.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "Pad.h"
|
||||
#include "ControllerConfig.h"
|
||||
#include "Frontend.h"
|
||||
#include "Camera.h"
|
||||
|
||||
#include "rwcore.h"
|
||||
#include "skeleton.h"
|
||||
#include "events.h"
|
||||
|
||||
|
||||
/*
|
||||
*****************************************************************************
|
||||
*/
|
||||
|
|
1651
src/skel/glfw/glfw.cpp
Normal file
1651
src/skel/glfw/glfw.cpp
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,3 +1,5 @@
|
|||
#if defined RW_D3D9 || defined RWLIBS
|
||||
|
||||
#define _WIN32_WINDOWS 0x0500
|
||||
#define WINVER 0x0500
|
||||
#define DIRECTINPUT_VERSION 0x0800
|
||||
|
@ -40,7 +42,7 @@
|
|||
#include "resource.h"
|
||||
#include "skeleton.h"
|
||||
#include "platform.h"
|
||||
#include "win.h"
|
||||
#include "crossplatform.h"
|
||||
|
||||
#define MAX_SUBSYSTEMS (16)
|
||||
|
||||
|
@ -3033,3 +3035,4 @@ int strcasecmp(const char *str1, const char *str2)
|
|||
return _strcmpi(str1, str2);
|
||||
}
|
||||
#endif
|
||||
#endif
|
|
@ -1,3 +1,6 @@
|
|||
|
||||
// DON'T include directly. crossplatform.h includes this if you're on Windows.
|
||||
|
||||
#if (!defined(_PLATFORM_WIN_H))
|
||||
#define _PLATFORM_WIN_H
|
||||
|
||||
|
@ -10,23 +13,6 @@
|
|||
#include <windef.h>
|
||||
#endif
|
||||
|
||||
enum eGameState
|
||||
{
|
||||
GS_START_UP = 0,
|
||||
GS_INIT_LOGO_MPEG,
|
||||
GS_LOGO_MPEG,
|
||||
GS_INIT_INTRO_MPEG,
|
||||
GS_INTRO_MPEG,
|
||||
GS_INIT_ONCE,
|
||||
GS_INIT_FRONTEND,
|
||||
GS_FRONTEND,
|
||||
GS_INIT_PLAYING_GAME,
|
||||
GS_PLAYING_GAME,
|
||||
#ifndef MASTER
|
||||
GS_ANIMVIEWER,
|
||||
#endif
|
||||
};
|
||||
|
||||
enum eWinVersion
|
||||
{
|
||||
OS_WIN95 = 0,
|
||||
|
@ -38,8 +24,6 @@ enum eWinVersion
|
|||
|
||||
extern DWORD _dwOperatingSystemVersion;
|
||||
|
||||
extern RwUInt32 gGameState;
|
||||
|
||||
#ifdef __DINPUT_INCLUDED__
|
||||
/* platform specfic global data */
|
||||
typedef struct
|
||||
|
@ -101,12 +85,10 @@ extern "C"
|
|||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#ifdef __DINPUT_INCLUDED__
|
||||
extern LRESULT CALLBACK
|
||||
MainWndProc(HWND window, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
RwBool IsForegroundApp();
|
||||
|
||||
#ifdef __DINPUT_INCLUDED__
|
||||
HRESULT _InputInitialise();
|
||||
HRESULT _InputInitialiseMouse();
|
||||
HRESULT CapturePad(RwInt32 padID);
|
||||
|
@ -117,26 +99,15 @@ HRESULT _InputGetMouseState(DIMOUSESTATE2 *state);
|
|||
void _InputShutdown();
|
||||
BOOL CALLBACK _InputEnumDevicesCallback( const DIDEVICEINSTANCE* pdidInstance, VOID* pContext );
|
||||
BOOL _InputTranslateKey(RsKeyCodes *rs, UINT flag, UINT key);
|
||||
void _InputTranslateShiftKeyUpDown(RsKeyCodes *rs);;
|
||||
BOOL _InputTranslateShiftKey(RsKeyCodes *rs, UINT key, BOOLEAN bDown);
|
||||
BOOL _InputIsExtended(INT flag);
|
||||
#endif
|
||||
|
||||
void InitialiseLanguage();
|
||||
RwBool _psSetVideoMode(RwInt32 subSystem, RwInt32 videoMode);
|
||||
void CenterVideo(void);
|
||||
void CloseClip(void);
|
||||
|
||||
RwChar **_psGetVideoModeList();
|
||||
RwInt32 _psGetNumVideModes();
|
||||
|
||||
void _psSelectScreenVM(RwInt32 videoMode);
|
||||
void HandleExit();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
extern DWORD _dwOperatingSystemVersion;
|
||||
#endif /* (!defined(_PLATFORM_WIN_H)) */
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
#define DIRECTINPUT_VERSION 0x0800
|
||||
#include "dinput.h"
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include "Messages.h"
|
||||
|
|
|
@ -707,13 +707,13 @@ CBoat::Render()
|
|||
((CVehicleModelInfo*)CModelInfo::GetModelInfo(GetModelIndex()))->SetVehicleColour(m_currentColour1, m_currentColour2);
|
||||
if (!CVehicle::bWheelsOnlyCheat)
|
||||
CEntity::Render();
|
||||
KeepWaterOutVertices[0].color = -1;
|
||||
KeepWaterOutVertices[0].setColor(255, 255, 255, 255);
|
||||
KeepWaterOutIndices[0] = 0;
|
||||
KeepWaterOutVertices[1].color = -1;
|
||||
KeepWaterOutVertices[1].setColor(255, 255, 255, 255);
|
||||
KeepWaterOutIndices[1] = 2;
|
||||
KeepWaterOutVertices[2].color = -1;
|
||||
KeepWaterOutVertices[2].setColor(255, 255, 255, 255);
|
||||
KeepWaterOutIndices[2] = 1;
|
||||
KeepWaterOutVertices[3].color = -1;
|
||||
KeepWaterOutVertices[3].setColor(255, 255, 255, 255);
|
||||
KeepWaterOutIndices[3] = 1;
|
||||
KeepWaterOutIndices[4] = 2;
|
||||
KeepWaterOutIndices[5] = 3;
|
||||
|
|
Loading…
Reference in a new issue