From 02a1051ffa2ad4fe68ba093068ef1fa3429a2ea9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20D=C3=BCrrenberger?= Date: Sat, 24 May 2014 23:52:09 +0200 Subject: [PATCH] Converted the project to Visual Studio 2013 and made it compilable. --- Landscape.cpp | 38 ++++++----- Landscape.rc | 3 +- Landscape.sln | 20 ++++++ Landscape.vcxproj | 168 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 210 insertions(+), 19 deletions(-) create mode 100644 Landscape.sln create mode 100644 Landscape.vcxproj diff --git a/Landscape.cpp b/Landscape.cpp index acce78e..16c1534 100644 --- a/Landscape.cpp +++ b/Landscape.cpp @@ -299,6 +299,7 @@ extern "C" #define INITGUID #define DIRECTINPUT_VERSION 0x0700 +//#define DIRECTSOUND_VERSION 0x0700 #define DIRECTDRAW_VERSION 0x0500 #include @@ -313,10 +314,11 @@ extern "C" #include #include -#include +#include #include #include +using namespace std; #include "ddutil.h" #include "resource.h" @@ -472,7 +474,7 @@ HINSTANCE g_hInst = NULL; BOOL MouseInit = false; // DirectSound -LPDIRECTSOUND lpds; //DirectSoundObjekt +LPDIRECTSOUND8 lpds; //DirectSoundObjekt DSBUFFERDESC dsbdesc; LPDIRECTSOUNDBUFFER lpdsb; LPDIRECTSOUNDBUFFER lpdsbPrimary; @@ -775,13 +777,12 @@ void InitDDraw() if (ddrval != DD_OK) goto error;; // Get exclusive mode - ddrval = lpDD->SetCooperativeLevel( hwnd,DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN ); + ddrval = lpDD->SetCooperativeLevel(hwnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN ); if(ddrval != DD_OK ) goto error; // Set the video mode to 800x600x16 - - ddrval = lpDD->SetDisplayMode( MAXX, MAXY, 16, 0, 0); + ddrval = lpDD->SetDisplayMode( MAXX, MAXY, 32, 0, 0); if(ddrval != DD_OK) { switch(ddrval) @@ -931,7 +932,7 @@ void InitDInput() DirectInputCreate(g_hInst, DIRECTINPUT_VERSION, &g_pDI, NULL); //DirectInput g_pDI->CreateDevice(GUID_SysMouse, &g_pMouse, NULL); //Mousepointer g_pMouse->SetDataFormat(&c_dfDIMouse); //MausDateninformation einstellen - g_pMouse->SetCooperativeLevel(hwnd,DISCL_EXCLUSIVE | DISCL_FOREGROUND); //Exklusive Maus + g_pMouse->SetCooperativeLevel(hwnd,DISCL_NONEXCLUSIVE | DISCL_FOREGROUND); //Exklusive Maus g_pDI->CreateDevice(GUID_SysKeyboard, &g_pKey, NULL); //Keyboard einrichten g_pKey->SetDataFormat(&c_dfDIKeyboard); //Datenformat auf KeyBoard umschalten @@ -945,7 +946,7 @@ void InitDSound() Soundzustand = 1; //Sound anschalten - hr = DirectSoundCreate(NULL, &lpds, NULL); //DirectSound-Objekt machen + hr = DirectSoundCreate8(NULL, &lpds, NULL); //DirectSound-Objekt machen if (hr != DD_OK) { Soundzustand = -1; @@ -1080,7 +1081,7 @@ void SaveGame() short i; ofstream ofs( "save.dat", ios::binary ); - if (ofs == NULL) return; + if (!ofs) return; ofs.write( (char*)Scape, sizeof(Scape) ); ofs.write( (char*)&Guy, sizeof(Guy) ); @@ -1111,8 +1112,8 @@ bool LoadGame() { short i; - ifstream ifs( "save.dat", ios::binary | ios::nocreate); - if (ifs == NULL) return(false); + ifstream ifs( "save.dat", ios::binary); // | ios::nocreate); + if (!ifs) return(false); ifs.read( (char*)Scape, sizeof(Scape) ); ifs.read( (char*)&Guy, sizeof(Guy) ); @@ -3409,7 +3410,7 @@ void InitStructs() Frage = -1; LastBild = 100; Bild = 0; - time(&Zeit); + Zeit = time(nullptr); Spielbeenden = false; MousePosition.x = MAXX /2; MousePosition.y = MAXY /2; @@ -10305,13 +10306,13 @@ short Refresh() if (Spielzustand == SZNICHTS) { - Spielzustand = SZLOGO; + Spielzustand = SZLOGO; InitStructs(); //Nur zum Wavinitialisieren } while(1) { Bild++; - time(&Zeitsave); + Zeitsave = time(nullptr); if (Zeit+5 < Zeitsave) { Zeit = Zeitsave; @@ -10337,7 +10338,7 @@ short Refresh() Animationen(); //Animationen weiterschalten if (!Guy.Aktiv) Event(Guy.Aktion); //Aktionen starten - if (Guy.Pos.x != RouteStart.x) ZeigeIntro(); //Bild auffrischen (if-Abfrage nötig (seltsamerweise)) + if (Guy.Pos.x == RouteStart.x) ZeigeIntro(); //Bild auffrischen (if-Abfrage nötig (seltsamerweise)) } else if (Spielzustand == SZSPIEL) @@ -10378,7 +10379,8 @@ long FAR PASCAL WindowProc( HWND hWnd, UINT message, switch( message ) { case WM_ACTIVATEAPP: - bActive = wParam; + bActive = wParam; + SetAcquire(); break; case WM_ACTIVATE: // sent when window changes active state @@ -10432,11 +10434,11 @@ static BOOL doInit( HINSTANCE hInstance, int nCmdShow ) WS_EX_TOPMOST, NAME, TITLE, - WS_POPUP, + WS_POPUP, 0, 0, - GetSystemMetrics( SM_CXSCREEN ), - GetSystemMetrics( SM_CYSCREEN ), + GetSystemMetrics(SM_CXSCREEN), + GetSystemMetrics(SM_CYSCREEN), NULL, NULL, hInstance, diff --git a/Landscape.rc b/Landscape.rc index 2846b39..b75c392 100644 --- a/Landscape.rc +++ b/Landscape.rc @@ -7,7 +7,8 @@ // // Generated from the TEXTINCLUDE 2 resource. // -#include "afxres.h" +//#include "afxres.h" +#include ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS diff --git a/Landscape.sln b/Landscape.sln new file mode 100644 index 0000000..62e675c --- /dev/null +++ b/Landscape.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Landscape", "Landscape.vcxproj", "{B47831E3-7517-6403-F657-B2601A03C3F1}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B47831E3-7517-6403-F657-B2601A03C3F1}.Debug|Win32.ActiveCfg = Debug|Win32 + {B47831E3-7517-6403-F657-B2601A03C3F1}.Debug|Win32.Build.0 = Debug|Win32 + {B47831E3-7517-6403-F657-B2601A03C3F1}.Release|Win32.ActiveCfg = Release|Win32 + {B47831E3-7517-6403-F657-B2601A03C3F1}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Landscape.vcxproj b/Landscape.vcxproj new file mode 100644 index 0000000..8a1ac89 --- /dev/null +++ b/Landscape.vcxproj @@ -0,0 +1,168 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + + + {B47831E3-7517-6403-F657-B2601A03C3F1} + + + + Application + false + v120 + + + Application + false + v120 + + + + + + + + + + + + + + + .\Debug\ + .\Debug\ + true + + + .\Release\ + .\Release\ + false + + + + MultiThreadedDebug + Default + false + Disabled + true + Level3 + false + true + EditAndContinue + _CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + .\Debug\ + true + .\Debug\Landscape.pch + .\Debug\ + .\Debug\ + + + true + _DEBUG;%(PreprocessorDefinitions) + .\Debug\Landscape.tlb + true + NUL + Win32 + + + 0x0407 + _DEBUG;%(PreprocessorDefinitions) + + + true + .\Debug\Landscape.bsc + + + true + true + Windows + .\Debug\Landscape.exe + dsound.lib;winmm.lib;dxguid.lib;ddraw.lib;dinput.lib;xinput.lib;dinput8.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x86;C:\Users\Lukas\Downloads\S; + false + + + + + MultiThreaded + OnlyExplicitInline + true + true + MaxSpeed + true + Level3 + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + .\Release\ + true + .\Release\Landscape.pch + .\Release\ + .\Release\ + + + true + NDEBUG;%(PreprocessorDefinitions) + .\Release\Landscape.tlb + true + NUL + Win32 + + + 0x0407 + NDEBUG;%(PreprocessorDefinitions) + + + true + .\Release\Landscape.bsc + + + true + Windows + Release/Schiffbruch.exe + odbc32.lib;odbccp32.lib;dxguid.lib;ddraw.lib;dinput.lib;dsound.lib;winmm.lib;%(AdditionalDependencies) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file