mirror of
https://github.com/jmarshall23/CnC_Remastered_Collection.git
synced 2026-08-21 18:35:04 +02:00
Initial SDL implementation very very rough.
This commit is contained in:
+39
-22
@@ -55,6 +55,7 @@
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
#include "function.h"
|
||||
#include <SDL.h>
|
||||
|
||||
|
||||
/*
|
||||
@@ -471,7 +472,6 @@ KeyNumType GadgetClass::Input(void)
|
||||
{
|
||||
int mousex, mousey;
|
||||
KeyNumType key;
|
||||
unsigned flags;
|
||||
int forced = false;
|
||||
|
||||
/*
|
||||
@@ -530,33 +530,50 @@ KeyNumType GadgetClass::Input(void)
|
||||
** know the position of the mouse at the exact instant when the click occurred
|
||||
** rather the the mouse position at the time we get around to this function.
|
||||
*/
|
||||
if (((key&0xFF) == KN_LMOUSE) || ((key&0xFF) == KN_RMOUSE)) {
|
||||
mousex = Keyboard->MouseQX;
|
||||
mousey = Keyboard->MouseQY;
|
||||
} else {
|
||||
mousex = Get_Mouse_X();
|
||||
mousey = Get_Mouse_Y();
|
||||
// jmarshall
|
||||
static int flags = 0;
|
||||
SDL_GetMouseState(&mousex, &mousey);
|
||||
|
||||
if (flags == LEFTRELEASE || flags == RIGHTRELEASE)
|
||||
flags = 0;
|
||||
|
||||
SDL_Event event;
|
||||
while (SDL_PollEvent(&event)) {
|
||||
switch (event.type)
|
||||
{
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
if (event.button.button == SDL_BUTTON_LEFT) {
|
||||
flags = LEFTPRESS;
|
||||
}
|
||||
break;
|
||||
|
||||
case SDL_MOUSEBUTTONUP:
|
||||
if (event.button.button == SDL_BUTTON_LEFT) {
|
||||
flags = LEFTRELEASE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
// jmarshall end
|
||||
|
||||
/*
|
||||
** Set the mouse button state flags. These will be passed to the individual
|
||||
** buttons so that they can determine what action to perform (if any).
|
||||
*/
|
||||
flags = 0;
|
||||
if (key) {
|
||||
if (key == KN_LMOUSE) {
|
||||
flags |= LEFTPRESS;
|
||||
}
|
||||
if (key == KN_RMOUSE) {
|
||||
flags |= RIGHTPRESS;
|
||||
}
|
||||
if (key == (KN_LMOUSE | KN_RLSE_BIT)) {
|
||||
flags |= LEFTRELEASE;
|
||||
}
|
||||
if (key == (KN_RMOUSE | KN_RLSE_BIT)) {
|
||||
flags |= RIGHTRELEASE;
|
||||
}
|
||||
}
|
||||
//if (key) {
|
||||
// if (key == KN_LMOUSE) {
|
||||
// flags |= LEFTPRESS;
|
||||
// }
|
||||
// if (key == KN_RMOUSE) {
|
||||
// flags |= RIGHTPRESS;
|
||||
// }
|
||||
// if (key == (KN_LMOUSE | KN_RLSE_BIT)) {
|
||||
// flags |= LEFTRELEASE;
|
||||
// }
|
||||
// if (key == (KN_RMOUSE | KN_RLSE_BIT)) {
|
||||
// flags |= RIGHTRELEASE;
|
||||
// }
|
||||
//}
|
||||
|
||||
/*
|
||||
** If the mouse wasn't responsible for this key code, then it must be from
|
||||
|
||||
+1
-1
@@ -3381,7 +3381,7 @@ static void Init_Mouse(void)
|
||||
** to set one of our own.
|
||||
*/
|
||||
#ifdef WIN32
|
||||
ShowCursor(false);
|
||||
// ShowCursor(false);
|
||||
#endif
|
||||
if (MouseInstalled) {
|
||||
void const * temp_mouse_shapes = MFCD::Retrieve("MOUSE.SHP");
|
||||
|
||||
@@ -40,6 +40,8 @@
|
||||
#include <sys\timeb.h>
|
||||
#endif
|
||||
|
||||
#include <sdl.h>
|
||||
|
||||
/*****************************
|
||||
** Function prototypes
|
||||
******************************/
|
||||
@@ -807,6 +809,7 @@ int Main_Menu(unsigned long )
|
||||
/*
|
||||
** Get and process player input.
|
||||
*/
|
||||
input = (KeyNumType)0;
|
||||
input = commands->Input();
|
||||
|
||||
#ifndef FIXIT_VERSION_3
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@ int WWMessageBox::Process(const char * msg, const char * b1txt, const char * b2t
|
||||
int curbutton;
|
||||
TextButtonClass * buttons[3];
|
||||
void * back;
|
||||
BOOL display; // display level
|
||||
BOOL display = TRUE; // display level
|
||||
int realval[5];
|
||||
|
||||
#ifndef WIN32
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<ConformanceMode>false</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>./win32lib</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>../external/sdl2/include;./win32lib</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<PreprocessorDefinitions>WINDOWS_IGNORE_PACKING_MISMATCH;TRUE_FALSE_DEFINED;ENGLISH;WIN32;NDEBUG;_WINDOWS;_USRDLL;REDALERT_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
@@ -120,7 +120,7 @@
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<ConformanceMode>false</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>./win32lib</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>../external/sdl2/include;./win32lib</AdditionalIncludeDirectories>
|
||||
<SDLCheck>false</SDLCheck>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
@@ -782,6 +782,9 @@
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="Resource\RedAlert.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Library Include="..\external\sdl2\lib\x86\SDL2.lib" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
<Filter Include="Source Files\Resource">
|
||||
<UniqueIdentifier>{f4599de7-e877-410c-943f-afc4bef70eb6}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\sdl">
|
||||
<UniqueIdentifier>{3254aa87-c780-4496-a35f-35ab3a6d4cc1}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="AADATA.CPP">
|
||||
@@ -1839,4 +1842,9 @@
|
||||
<Filter>Source Files\Resource</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Library Include="..\external\sdl2\lib\x86\SDL2.lib">
|
||||
<Filter>Source Files\sdl</Filter>
|
||||
</Library>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -702,18 +702,18 @@ extern int DLLForceMouseY;
|
||||
|
||||
int Get_Mouse_X(void)
|
||||
{
|
||||
if (DLLForceMouseX >= 0) {
|
||||
return DLLForceMouseX;
|
||||
}
|
||||
//if (DLLForceMouseX >= 0) {
|
||||
// return DLLForceMouseX;
|
||||
//}
|
||||
if (!_Mouse) return(0);
|
||||
return(_Mouse->Get_Mouse_X());
|
||||
}
|
||||
|
||||
int Get_Mouse_Y(void)
|
||||
{
|
||||
if (DLLForceMouseY >= 0) {
|
||||
return DLLForceMouseY;
|
||||
}
|
||||
//if (DLLForceMouseY >= 0) {
|
||||
// return DLLForceMouseY;
|
||||
//}
|
||||
|
||||
if (!_Mouse) return(0);
|
||||
return(_Mouse->Get_Mouse_Y());
|
||||
|
||||
+29
-18
@@ -51,9 +51,13 @@
|
||||
#include "ipx95.h"
|
||||
#endif //WINSOCK_IPX
|
||||
|
||||
#include <SDL.h>
|
||||
#include <SDL_syswm.h>
|
||||
|
||||
void output(short,short)
|
||||
{}
|
||||
|
||||
SDL_Window* game_window;
|
||||
|
||||
unsigned long CCFocusMessage = WM_USER+50; //Private message for receiving application focus
|
||||
extern void VQA_PauseAudio(void);
|
||||
@@ -455,24 +459,31 @@ void Create_Main_Window ( HANDLE instance , int command_show , int width , int h
|
||||
//
|
||||
// Create our main window
|
||||
//
|
||||
hwnd = CreateWindowEx (
|
||||
WS_EX_TOPMOST,
|
||||
WINDOW_NAME,
|
||||
WINDOW_NAME,
|
||||
WS_POPUP, // Denzil | WS_MAXIMIZE,
|
||||
0,
|
||||
0,
|
||||
// Denzil 5/18/98 - Making window fullscreen prevents other apps
|
||||
// from getting WM_PAINT messages
|
||||
// jmarshall
|
||||
width, //width,
|
||||
height, //height,
|
||||
// jmarshall end
|
||||
// End Denzil
|
||||
NULL,
|
||||
NULL,
|
||||
(HINSTANCE)instance,
|
||||
NULL );
|
||||
// hwnd = CreateWindowEx (
|
||||
// WS_EX_TOPMOST,
|
||||
// WINDOW_NAME,
|
||||
// WINDOW_NAME,
|
||||
// WS_POPUP, // Denzil | WS_MAXIMIZE,
|
||||
// 0,
|
||||
// 0,
|
||||
// // Denzil 5/18/98 - Making window fullscreen prevents other apps
|
||||
// // from getting WM_PAINT messages
|
||||
//// jmarshall
|
||||
// width, //width,
|
||||
// height, //height,
|
||||
//// jmarshall end
|
||||
// // End Denzil
|
||||
// NULL,
|
||||
// NULL,
|
||||
// (HINSTANCE)instance,
|
||||
// NULL );
|
||||
SDL_Init(SDL_INIT_VIDEO);
|
||||
game_window = SDL_CreateWindow(WINDOW_NAME, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, width, height, SDL_WINDOW_SHOWN);
|
||||
SDL_SysWMinfo wmInfo;
|
||||
SDL_VERSION(&wmInfo.version);
|
||||
SDL_GetWindowWMInfo(game_window, &wmInfo);
|
||||
hwnd = wmInfo.info.win.window;
|
||||
GameInFocus = TRUE;
|
||||
|
||||
ShowWindow (hwnd, command_show );
|
||||
ShowCommand = command_show;
|
||||
|
||||
Reference in New Issue
Block a user