diff --git a/Speedy Eggbert 2 Source.vcxproj b/Speedy Eggbert 2 Source.vcxproj index cef7bc3..7e373e2 100644 --- a/Speedy Eggbert 2 Source.vcxproj +++ b/Speedy Eggbert 2 Source.vcxproj @@ -1,4 +1,4 @@ - + @@ -29,26 +29,26 @@ Application true - v143 + v140_xp Unicode Application false - v143 + v140_xp true Unicode Application true - v141_xp + v140_xp Unicode Application false - v143 + v140_xp true Unicode @@ -73,13 +73,16 @@ Level3 - true + false WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true + false - Console + Windows true + /FORCE:MULTIPLE /DYNAMICBASE "legacy_stdio_definitions.lib" %(AdditionalOptions) + ./dxsdk3/sdk/lib;%(AdditionalLibraryDirectories) @@ -96,6 +99,7 @@ true true true + ./dxsdk3/sdk/lib;%(AdditionalLibraryDirectories) @@ -104,14 +108,11 @@ true _DEBUG;_CONSOLE;%(PreprocessorDefinitions) true - - Console true - - + ./dxsdk3/sdk/lib;%(AdditionalLibraryDirectories) @@ -128,9 +129,11 @@ true true true + ./dxsdk3/sdk/lib;%(AdditionalLibraryDirectories) + @@ -140,6 +143,7 @@ + @@ -158,7 +162,6 @@ - @@ -172,7 +175,6 @@ - diff --git a/Speedy Eggbert 2 Source.vcxproj.filters b/Speedy Eggbert 2 Source.vcxproj.filters index b4b0cf1..c8f9442 100644 --- a/Speedy Eggbert 2 Source.vcxproj.filters +++ b/Speedy Eggbert 2 Source.vcxproj.filters @@ -98,9 +98,6 @@ Source Files - - Source Files - Source Files @@ -136,9 +133,6 @@ - - Resource Files - Resource Files diff --git a/blupi.cpp b/blupi.cpp index 562b326..ec6ccd4 100644 --- a/blupi.cpp +++ b/blupi.cpp @@ -3,11 +3,21 @@ #define WIN32_LEAN_AND_MEAN +#pragma once + +#pragma comment(lib, "winmm.lib") + +using namespace std; + #include #include #include #include #include +#include +#include +//#include +#include #include "def.h" #include "resource.h" #include "ddutil.h" @@ -22,6 +32,8 @@ #include "misc.h" #include "network.h" +#pragma warning (disable : 4996) + // Define Globals #define NAME "Blupi" @@ -54,10 +66,15 @@ int g_something; MMRESULT g_updateTimer; // timer général BOOL g_bActive = TRUE; // is application active ? BOOL g_bTermInit = FALSE; // initialisation en cours +int g_timer; int g_objectMax; int g_elementMax; int g_blupiMax; int g_exploMax; +short g_object[6]; +short g_element[6]; +short g_blupiCh[6]; +short g_explo[6]; UINT g_lastPhase = 999; @@ -239,9 +256,6 @@ void UpdateFrame(void) { int phase, term; - g_pEvent->ReadInput(); - - g_pEvent->ReadInput(); phase = g_pEvent->GetPhase(); if (phase == WM_PHASE_PLAY || phase == WM_PHASE_PLAYTEST || phase == WM_PHASE_BUILD) @@ -256,72 +270,79 @@ void UpdateFrame(void) } } - if (phase == WM_PHASE_INIT) - { - g_pEvent->DemoStep(); - } - - if (phase == WM_PHASE_PLAYMOVIE || phase == WM_PHASE_WINMOVIE || phase == WM_PHASE_WINMOVIEDESIGN || phase == WM_PHASE_WINMOVIEMULTI) - { - g_pEvent->MovieToStart(); - } - - if (phase == WM_PHASE_INSERT) - { - g_pEvent->TryInsert(); - } - - if (phase == WM_PHASE_PLAY) - { - term = g_pDecor->IsTerminated(); - if (g_pEvent->IsPrivate()) + if (phase == WM_PHASE_INIT) { - if (term == -1) - { - g_pEvent->ChangePhase(WM_PHASE_HISTORY1); - return; - } - if (term != 0) - { - g_pEvent->ChangePhase(WM_PHASE_HELP); - return; - } + g_pEvent->DemoStep(); // d?marre ?v. d?mo automatique } - else + + if (phase == WM_PHASE_PLAYMOVIE || phase == WM_PHASE_WINMOVIE || WM_PHASE_WINMOVIEDESIGN || WM_PHASE_WINMOVIEMULTI) { - if (g_pEvent->IsMulti()) + g_pEvent->MovieToStart(); + } + + if (phase == WM_PHASE_INSERT) + { + g_pEvent->TryInsert(); + } + + if (phase == WM_PHASE_PLAY) + { + if (g_pEvent->IsPrivate() == FALSE) { - if (term == -1) { - g_pEvent->ChangePhase(WM_PHASE_H0MOVIE); - return; + if (g_pEvent->IsMulti() == FALSE) + { + if (g_pDecor->IsTerminated() == -1) + { + g_pEvent->GetWorldGroup(); + g_pEvent->SetLives(g_pDecor->GetNbVies()); + g_pEvent->ChangePhase(WM_PHASE_LOST); + } + if (g_pDecor->IsTerminated() == -2) + { + g_pEvent->SetLives(g_pDecor->GetNbVies()); + g_pEvent->ChangePhase(WM_PHASE_WINMOVIE); + } + if (0 < g_pDecor->IsTerminated()) + { + g_pEvent->SetLives(g_pDecor->GetNbVies()); + g_pEvent->SetMission(g_pDecor->IsTerminated()); + g_pEvent->ChangePhase(WM_PHASE_PLAY); + } } - if (term != 0) { - g_pEvent->ChangePhase(WM_PHASE_H2MOVIE); - return; + else + { + if (g_pDecor->IsTerminated() == -1) + { + g_pEvent->ChangePhase(WM_PHASE_WINm); + return; + } + if (g_pDecor->IsTerminated() != 0) + { + g_pEvent->ChangePhase(WM_PHASE_WINMOVIEm); + return; + } } } else { - if (term == -1) { - g_pEvent->GetWorldGroup(); // probably intended to be a variable assignment? wtf ghidra - g_pEvent->SetNbVies(g_pDecor->GetNbVies()); - g_pEvent->ChangePhase(WM_PHASE_LOST); + if (g_pDecor->IsTerminated() == -1) + { + g_pEvent->ChangePhase(WM_PHASE_LOSTd); + return; } - if (term == -2) { - g_pEvent->SetNbVies(g_pDecor->GetNbVies()); - g_pEvent->ChangePhase(WM_PHASE_PLAYMOVIE); - } - if (term > 0) { - g_pEvent->SetNbVies(g_pDecor->GetNbVies()); - g_pDecor->SetMission(term); - g_pEvent->ChangePhase(WM_PHASE_PLAY); + if (g_pDecor->IsTerminated() != 0) + { + g_pEvent->ChangePhase(WM_PHASE_WINMOVIEd); + return; } } - } } + return; } + + // Incomplete void SetDecor() @@ -329,6 +350,7 @@ void SetDecor() RECT rect; UINT phase; POINT posMouse; + char test[12]; g_pPixmap->MouseBackClear(); posMouse = g_pEvent->GetLastMousePos(); @@ -366,6 +388,7 @@ int Benchmark() // Restitue le jeu après une activation en mode fullScreen. + BOOL RestoreGame() { if ( g_pPixmap == NULL ) return FALSE; @@ -434,14 +457,6 @@ LRESULT CALLBACK WindowProc (HWND hWnd, UINT message, { static HINSTANCE hInstance; POINT mousePos, totalDim, iconDim; -#if 0 - if ( message != WM_TIMER ) - { - char s[100]; - sprintf(s, "message=%d,%d\n", message, wParam); - OutputDebug(s); - } -#endif // La touche F10 envoie un autre message pour activer // le menu dans les applications Windows standard ! @@ -605,6 +620,16 @@ LRESULT CALLBACK WindowProc (HWND hWnd, UINT message, } +LPTIMECALLBACK TimerStep() +{ + if (g_bActive && g_timer == 0) + { + g_timer = 1; + PostMessageA(g_hWnd, WM_UPDATE, 0, 0); + } + return NULL; +} + // Erreur dans DoInit. @@ -623,9 +648,54 @@ BOOL InitFail(char *msg, BOOL bDirectX) return FALSE; } -//[Space for SetTimer] +int Benchmark() +{ + timeb time[6]; + int num0; + int num; + int num2; + int num3; + int i; + short crap[6]; + FILE* open; + int frame; + _MEMORYSTATUS buffer; + char file[100]; -// Initialisation de l'application. + ftime(time); + + num = (int)time; + frame = 10; + + do + { + UpdateFrame(); + SetDecor(); + g_pPixmap->Display(); + frame++; + } while (frame); + + ftime(time); + i = (int)time; + + num0 = HIWORD(crap) & 0xFFFF; + + if (num0 < num) + { + num0 = num0 + 1000; + } + num3 = i - num0; + buffer.dwLength = 32; + GlobalMemoryStatus(&buffer); + sprintf(file, "CheckTime = %d\r\nMemory = %d", num3, buffer.dwTotalPhys); + + if (fopen("data\\time.blp", "wb")) + { + fwrite(file, strlen(file), 1, fopen("data\\time.blp", "wb")); + fclose(fopen("data\\time.blp", "wb")); + } + return num3; +} static BOOL DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow) { @@ -714,14 +784,23 @@ static BOOL DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow) g_pPixmap = new CPixmap; if (g_pPixmap == NULL) return InitFail("New pixmap", TRUE); - g_pPixmap->SetBenchmarkSuccess(g_bBenchmarkSuccess); + totalDim.x = LXIMAGE; + totalDim.y = LYIMAGE; + if (!g_pPixmap->Create(g_hWnd, totalDim, g_bFullScreen, g_mouseType, g_bTrueColorBack, g_bTrueColorDecor)) + return InitFail("Create pixmap", TRUE); -#if _INTRO - if (!g_pPixmap->CacheAll(TRUE, g_hWnd, g_bFullScreen, g_bTrueColor, g_bTrueColorDecor, g_mouseType, "intro1.blp", FALSE)) -#else - if (!g_pPixmap->CacheAll(TRUE, g_hWnd, g_bFullScreen, g_bTrueColorBack, g_bTrueColorDecor, g_mouseType, "init.blp", FALSE)) -#endif + OutputDebug("Image: init\n"); + totalDim.x = LXIMAGE; + totalDim.y = LYIMAGE; + iconDim.x = 0; + iconDim.y = 0; + + if (!g_pPixmap->CacheAll(TRUE, g_hWnd, g_bFullScreen, g_bTrueColor, g_bTrueColorDecor, g_mouseType, "init.blp", 0)) return FALSE; + OutputDebug("SavePalette\n"); + g_pPixmap->SavePalette(); + OutputDebug("InitSysPalette\n"); + g_pPixmap->InitSysPalette(); g_pSound = new CSound; if (g_pSound == NULL) return InitFail("New sound", TRUE); @@ -775,6 +854,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { MSG msg; + LPTIMECALLBACK timeStep; if ( !DoInit(hInstance, lpCmdLine, nCmdShow) ) { @@ -782,13 +862,13 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, } Benchmark(); - timeSetEvent(g_timerInterval, g_timerInterval >> 2, (LPTIMECALLBACK)TimerStep, 0, 1); + g_hWnd = (HWND)timeSetEvent(g_timerInterval, (g_timerInterval + (g_timerInterval >> 31 & 3U)) >> 2, TimerStep(), 0, 1); - while ( TRUE ) + while (TRUE) { - if ( PeekMessage(&msg, NULL, 0,0, PM_NOREMOVE) ) + if (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) { - if ( !GetMessage(&msg, NULL, 0, 0) ) + if (!GetMessage(&msg, NULL, 0, 0)) { return msg.wParam; } diff --git a/button.cpp b/button.cpp index 672bcd8..8492194 100644 --- a/button.cpp +++ b/button.cpp @@ -5,7 +5,7 @@ #include #include #include -#include +//#include #include #include "def.h" #include "pixmap.h" @@ -46,10 +46,7 @@ CButton::~CButton() // Create a new Button BOOL CButton::Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound, - POINT pos, int type, BOOL bMinimizeRedraw, - /*int *pMenu, int nbMenu, - int *pToolTips, int nbToolTips, - int region,*/ UINT message) + POINT pos, int type, BOOL bMinimizeRedraw, int region, UINT message) { POINT iconDim; //int i, icon; @@ -382,7 +379,6 @@ BOOL CButton::MouseDown(POINT pos) m_bRedraw = TRUE; PostMessage(m_hWnd, WM_UPDATE, 0, 0); - m_pSound->PlayImage(SOUND_CLICK, pos); return TRUE; } diff --git a/button.h b/button.h index ab9964f..51bca6c 100644 --- a/button.h +++ b/button.h @@ -1,4 +1,4 @@ -#include +//#include #include #include "decor.h" #include "sound.h" @@ -8,17 +8,6 @@ using namespace std; - -typedef struct -{ - int message; - int type; - int iconMenu[20]; - POINT pos; - int toolTips[20]; -} -Button; - class CButton { public: @@ -26,10 +15,7 @@ public: ~CButton(); BOOL Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound, - POINT pos, int type, BOOL bMinimizeRedraw, - /*int *pMenu, int nbMenu, - int *pTooltips, int nbToolTips, - int region,*/ UINT message); + POINT pos, int type, BOOL bMinimizeRedraw, int region, UINT message); void SetSomethingMenu(int somethingMenu); void Draw(); void Redraw(); diff --git a/ddutil.cpp b/ddutil.cpp index 2f6645d..25a7d03 100644 --- a/ddutil.cpp +++ b/ddutil.cpp @@ -36,7 +36,7 @@ void DDSetDebug(BOOL bDebug) * create a DirectDrawSurface from a bitmap resource. * */ -extern "C" IDirectDrawSurface * DDConnectBitmap(IDirectDraw *pdd, HBITMAP hbm) +extern IDirectDrawSurface * DDConnectBitmap(IDirectDraw *pdd, HBITMAP hbm) { BITMAP bm; DDSURFACEDESC ddsd; @@ -77,7 +77,7 @@ extern "C" IDirectDrawSurface * DDConnectBitmap(IDirectDraw *pdd, HBITMAP hbm) * create a DirectDrawSurface from a bitmap resource. * */ -extern "C" IDirectDrawSurface * DDLoadBitmap(IDirectDraw *pdd, LPCSTR szBitmap, int dx, int dy) +extern IDirectDrawSurface * DDLoadBitmap(IDirectDraw *pdd, LPCSTR szBitmap, int dx, int dy) { HBITMAP hbm; BITMAP bm; @@ -175,7 +175,7 @@ HRESULT DDReLoadBitmap(IDirectDrawSurface *pdds, LPCSTR szBitmap) * draw a bitmap into a DirectDrawSurface * */ -extern "C" HRESULT DDCopyBitmap(IDirectDrawSurface *pdds, HBITMAP hbm, int x, int y, int dx, int dy) +extern HRESULT DDCopyBitmap(IDirectDrawSurface *pdds, HBITMAP hbm, int x, int y, int dx, int dy) { HDC hdcImage; HDC hdc; @@ -242,7 +242,7 @@ extern "C" HRESULT DDCopyBitmap(IDirectDrawSurface *pdds, HBITMAP hbm, int x, in // if the resource does not exist or NULL is passed create a // default 332 palette. // -extern "C" IDirectDrawPalette * DDLoadPalette(IDirectDraw *pdd, LPCSTR szBitmap) +extern IDirectDrawPalette * DDLoadPalette(IDirectDraw *pdd, LPCSTR szBitmap) { IDirectDrawPalette* ddpal; int i; @@ -267,7 +267,7 @@ extern "C" IDirectDrawPalette * DDLoadPalette(IDirectDraw *pdd, LPCSTR szBitmap) // // get a pointer to the bitmap resource. // - if (szBitmap && (h = FindResourceA(NULL, szBitmap, RT_BITMAP))) + if (szBitmap && (h = FindResourceA(NULL, szBitmap, (LPCSTR)RT_BITMAP))) { if ( g_bDebug ) OutputDebug("DDLoadPalette -a\n"); lpbi = (LPBITMAPINFOHEADER)LockResource(LoadResource(NULL, h)); @@ -346,7 +346,7 @@ extern "C" IDirectDrawPalette * DDLoadPalette(IDirectDraw *pdd, LPCSTR szBitmap) * we do this by leting GDI SetPixel() do the color matching * then we lock the memory and see what it got mapped to. */ -extern "C" DWORD DDColorMatch(IDirectDrawSurface *pdds, COLORREF rgb) +extern DWORD DDColorMatch(IDirectDrawSurface *pdds, COLORREF rgb) { COLORREF rgbT; HDC hdc; @@ -397,7 +397,7 @@ extern "C" DWORD DDColorMatch(IDirectDrawSurface *pdds, COLORREF rgb) * if you pass CLR_INVALID as the color key, the pixel * in the upper-left corner will be used. */ -extern "C" HRESULT DDSetColorKey(IDirectDrawSurface *pdds, COLORREF rgb) +extern HRESULT DDSetColorKey(IDirectDrawSurface *pdds, COLORREF rgb) { DDCOLORKEY ddck; @@ -406,7 +406,7 @@ extern "C" HRESULT DDSetColorKey(IDirectDrawSurface *pdds, COLORREF rgb) return pdds->SetColorKey(DDCKEY_SRCBLT, &ddck); } -extern "C" HRESULT DDSetColorKey2(IDirectDrawSurface *pdds, COLORREF rgb1, +extern HRESULT DDSetColorKey2(IDirectDrawSurface *pdds, COLORREF rgb1, COLORREF rgb2) { DDCOLORKEY ddck; diff --git a/ddutil.h b/ddutil.h index 6bc958b..9b550d1 100644 --- a/ddutil.h +++ b/ddutil.h @@ -7,11 +7,14 @@ * ***************************************************************************/ -#ifdef __cplusplus -extern "C" { /* Assume C declarations for C++ */ -#endif /* __cplusplus */ -extern void DDSetDebug(BOOL bDebug); +using namespace std; + +#pragma once + +#include "ddraw.h" + +extern void DDSetDebug (BOOL bDebug); extern IDirectDrawSurface * DDConnectBitmap(IDirectDraw *pdd, HBITMAP hbm); extern IDirectDrawPalette * DDLoadPalette(IDirectDraw *pdd, LPCSTR szBitmap); extern IDirectDrawSurface * DDLoadBitmap(IDirectDraw *pdd, LPCSTR szBitmap, int dx, int dy); @@ -21,6 +24,7 @@ extern DWORD DDColorMatch(IDirectDrawSurface *pdds, COLORREF rgb) extern HRESULT DDSetColorKey(IDirectDrawSurface *pdds, COLORREF rgb); extern HRESULT DDSetColorKey2(IDirectDrawSurface *pdds, COLORREF rgb1, COLORREF rgb2); +/* #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/dectables.h b/dectables.h index 6a39207..a301c49 100644 --- a/dectables.h +++ b/dectables.h @@ -37,6 +37,30 @@ extern int table_shieldloop[] 274, 275, 276, 277, 278 }; +extern int table_blitz[] +{ + 0, + 7, + 15, + 18, + 25, + 27, + 32, + 39, + 45, + 47, + 50, + 58, + 60, + 62, + 64, + 66, + 68, + 70, + 71, + 72 +}; + extern int table_shieldtrack[] { 274, 275, 276, 277, 278, 274, 275, 276, 277, 278, @@ -311,10 +335,527 @@ extern int table_cle2[12] 218, 219 }; -extern int table_cle3[12] +extern int table_decor_action[] { - 229, 228, 227, 226, 225, 224, 223, 224, 225, 226, - 227, 228 + 1, + 32, + -4, + 4, + 4, + -3, + -4, + 2, + 4, + 5, + -4, + -1, + 4, + 2, + -4, + -4, + 4, + -3, + -3, + 2, + 3, + 2, + -3, + -5, + 3, + 4, + -3, + 5, + 3, + -2, + -3, + 5, + 3, + 4, + -2, + -2, + 2, + 4, + -2, + -2, + 2, + -2, + -2, + -4, + 2, + 2, + -2, + -2, + 2, + -3, + -1, + -3, + 1, + -2, + -1, + -1, + 1, + 2, + -1, + -2, + 1, + -1, + -1, + 1, + 1, + 2, + 2, + 32, + -4, + 0, + 4, + 0, + -4, + 0, + 4, + 0, + -4, + 0, + 4, + 0, + -4, + 0, + 4, + 0, + -3, + 0, + 3, + 0, + -3, + 0, + 3, + 0, + -3, + 0, + 3, + 0, + -3, + 0, + 3, + 0, + -2, + 0, + 2, + 0, + -2, + 0, + 2, + 0, + -2, + 0, + 2, + 0, + -2, + 0, + 2, + 0, + -1, + 0, + 1, + 0, + -1, + 0, + 1, + 0, + -1, + 0, + 1, + 0, + -1, + 0, + 1, + 0, + 5, + 192, + 0, + -32, + 0, + 32, + 0, + -16, + 0, + 6, + 0, + -8, + 0, + 8, + 0, + -4, + 0, + 4, + 0, + -2, + 0, + 2, + -7, + 0, + -6, + 0, + -5, + 0, + -4, + 0, + -2, + 0, + 0, + 0, + 2, + 0, + 4, + 0, + 5, + 0, + 6, + 0, + 7, + 0, + 7, + 0, + 6, + 0, + 5, + 0, + 4, + 0, + 2, + 0, + 0, + 0, + -2, + 0, + -4, + 0, + -5, + 0, + -6, + 0, + -7, + 0, + -7, + 0, + -6, + 0, + -5, + 0, + -4, + 0, + -2, + 0, + 0, + 0, + 2, + 0, + 4, + 0, + 5, + 0, + 6, + 0, + 7, + 0, + 7, + 0, + 6, + 0, + 5, + 0, + 4, + 0, + 2, + 0, + 0, + 0, + -2, + 0, + -4, + 0, + -5, + 0, + -6, + 0, + -7, + 0, + -7, + 0, + -6, + 0, + -5, + 0, + -4, + 0, + -2, + 0, + 0, + 0, + 2, + 0, + 4, + 0, + 5, + 0, + 6, + 0, + 7, + 0, + 7, + 0, + 6, + 0, + 5, + 0, + 4, + 0, + 2, + 0, + 0, + 0, + -2, + 0, + -4, + 0, + -5, + 0, + -6, + 0, + -7, + 0, + -7, + 0, + -6, + 0, + -5, + 0, + -4, + 0, + -2, + 0, + 0, + 0, + 2, + 0, + 4, + 0, + 5, + 0, + 6, + 0, + 7, + 0, + 7, + 0, + 6, + 0, + 5, + 0, + 4, + 0, + 2, + 0, + 0, + 0, + -2, + 0, + -4, + 0, + -5, + 0, + -6, + 0, + -7, + 0, + -7, + 0, + -6, + 0, + -5, + 0, + -4, + 0, + -2, + 0, + 0, + 0, + 2, + 0, + 4, + 0, + 5, + 0, + 6, + 0, + 7, + 0, + 7, + 0, + 6, + 0, + 5, + 0, + 4, + 0, + 2, + 0, + 0, + 0, + -2, + 0, + -4, + 0, + -5, + 0, + -6, + 0, + -7, + 0, + -7, + 0, + -6, + 0, + -5, + 0, + -4, + 0, + -2, + 0, + 0, + 0, + 2, + 0, + 4, + 0, + 5, + 0, + 6, + 0, + 7, + 0, + 7, + 0, + 6, + 0, + 5, + 0, + 4, + 0, + 2, + 0, + 0, + 0, + -2, + 0, + -4, + 0, + -5, + 0, + -6, + 0, + -7, + 0, + -7, + 0, + -6, + 0, + -5, + 0, + -4, + 0, + -2, + 0, + 0, + 0, + 2, + 0, + 4, + 0, + 5, + 0, + 6, + 0, + 7, + 0, + 7, + 0, + 6, + 0, + 5, + 0, + 4, + 0, + 2, + 0, + 0, + 0, + -2, + 0, + -4, + 0, + -5, + 0, + -6, + 0, + -7, + 0, + -7, + 0, + -6, + 0, + -5, + 0, + -4, + 0, + -2, + 0, + 0, + 0, + 2, + 0, + 4, + 0, + 5, + 0, + 6, + 0, + 7, + 0, + 7, + 0, + 6, + 0, + 5, + 0, + 4, + 0, + 2, + 0, + 0, + 0, + -2, + 0, + -4, + 0, + -5, + 0, + -6, + 0, + -7, + 0, + -7, + 0, + -6, + 0, + -5, + 0, + -4, + 0, + -2, + 0, + -1, + 0, + 0 }; extern int table_dynamitef[100] @@ -510,29 +1051,1175 @@ extern int table_decor_ventb[]{ 4, 122, 123, 124, 125 }; extern int table_marine[] { - 11, - 203, 204, 205, 206, 207, 208, 207, 206, 205, 204, - 203 + 0, + 2, + 5, + 8, + 3, + 0 }; -extern int table_ressort[]{ 8, 209, 210, 211, 212, 213, 212, 211, 210 }; +extern int table_sploutch2[] +{ + -1, + -1, + -1, + 90, + 91, + 92, + 93, + 94, + 95, + 96, + 97, + 98, + 99 +}; -extern int table_366b0[]{ 3, 20, 21, 22 }; +extern int table_sploutch3[] +{ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 90, + 91, + 92, + 93, + 94, + 95, + 96, + 97, + 98, + 99 +}; -extern int table_366c0[]{ 4, 16, 17, 18, 19 }; +extern int table_tentacule[] +{ + 86, + 85, + 84, + 83, + 84, + 85, + 86, + -1, + 86, + 85, + 84, + 83, + 82, + 81, + 80, + 79, + 78, + 77, + 76, + 75, + 74, + 73, + 72, + 71, + 70, + 70, + 70, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 82, + 83, + 84, + 85, + 86, + -1 +}; -extern int table_366d8[]{ 3, 0x17, 0x18, 0x19 }; +extern int table_bridge[] +{ + 365, + 366, + 365, + 366, + 365, + 366, + 365, + 366, + 365, + 366, + 365, + 366, + 365, + 366, + 365, + 366, + 367, + 367, + 368, + 368, + 369, + 369, + 370, + 370, + 371, + 371, + 372, + 372, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 372, + 372, + 371, + 371, + 370, + 370, + 369, + 369, + 368, + 368, + 367, + 367, + 366, + 366, + 365, + 365, + 364 +}; -extern int table_366e8[]{ 2, 0x1a, 0x1b }; +extern int table_pollution[] +{ + 179, + 180, + 181, + 182, + 183, + 184, + 185, + 186 +}; -extern int table_366f8[]{ 4, 0x1c, 0x1d, 0x1e, 0x1f }; +extern int table_invertstart[] +{ + 179, + 180, + 181, + 182, + 183, + 184, + 185, + 186 +}; -extern int table_36710[]{ 12, 0x2d, 0x2e, 0x2f, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c }; +extern int table_invertstop[] +{ + 186, + 185, + 184, + 183, + 182, + 181, + 180, + 179 +}; -extern int table_36748[]{ 4, 0x42, 0x43, 0x44, 0x45 }; +extern int table_plouf[] +{ + 99, + 100, + 101, + 102, + 101, + 100, + 99 +}; -extern int table_36520[]{ 3, 0x57, 0x58, 0x59 }; +extern int table_tiplouf[] +{ + 244, + 99, + 244 +}; -extern int table_36670[]{ 11, 0x4c, 0x4d, 0xc7, 0xc6, 0xc8, 0xc9, 0xeb, 0xec, 0x177, 0x178, 0x179 }; +extern int table_blup[] +{ + 103, + 104, + 105, + 106, + 104, + 103, + 106, + 105, + 103, + 104, + 103, + 105, + 106, + 103, + 105, + 106, + 103, + 104, + 106, + 105 +}; -extern int table_366a0[]{ 3, 0x193, 0x191, 0x192 }; \ No newline at end of file +extern int table_bulldozer_left[] +{ + 66, + 66, + 67, + 67, + 66, + 66, + 65, + 65 +}; + +extern int table_bulldozer_right[] +{ + 58, + 58, + 57, + 57, + 58, + 58, + 59, + 59 +}; + +extern int table_bulldozer_turn2l[] +{ + 58, + 59, + 59, + 59, + 60, + 60, + 60, + 61, + 61, + 62, + 62, + 63, + 63, + 64, + 64, + 64, + 65, + 65, + 65, + 66, + 66, + 66 +}; + +extern int table_bulldozer_turn2r[] +{ + 66, + 65, + 65, + 65, + 64, + 64, + 64, + 63, + 63, + 62, + 62, + 61, + 61, + 60, + 60, + 60, + 59, + 59, + 59, + 58, + 58, + 58 +}; + +extern int table_poisson_left[] +{ + 82, + 82, + 81, + 81, + 82, + 82, + 83, + 83 +}; + +extern int table_poisson_right[] +{ + 79, + 79, + 78, + 78, + 79, + 79, + 80, + 80 +}; + + + +extern int table_poisson_turn2l[] +{ + 79, + 79, + 80, + 80, + 84, + 84, + 85, + 85, + 86, + 86, + 87, + 87, + 88, + 88, + 83, + 83, + 82, + 82, + 83, + 83, + 88, + 88, + 87, + 87, + 86, + 86, + 85, + 85, + 84, + 84, + 79, + 79, + 79, + 79, + 80, + 80, + 84, + 84, + 85, + 85, + 86, + 86, + 87, + 87, + 88, + 88, + 83, + 83 +}; + +extern int table_poisson_turn2r[] +{ + 82, + 82, + 83, + 83, + 88, + 88, + 87, + 87, + 86, + 86, + 85, + 85, + 84, + 84, + 79, + 79, + 79, + 79, + 80, + 80, + 84, + 84, + 85, + 85, + 86, + 86, + 87, + 87, + 88, + 88, + 83, + 83, + 82, + 82, + 83, + 83, + 88, + 88, + 87, + 87, + 86, + 86, + 85, + 85, + 84, + 84, + 79, + 79 +}; + +extern int table_oiseau_left[] +{ + 98, + 99, + 100, + 101, + 102, + 103, + 104, + 105 +}; + +extern int table_oiseau_right[] +{ + 90, + 91, + 92, + 93, + 94, + 95, + 96, + 97 +}; + +extern int table_oiseau_turn2l[] +{ + 106, + 107, + 108, + 109, + 110, + 111, + 112, + 113, + 105, + 105 +}; + +extern int table_oiseau_turn2r[] +{ + 114, + 115, + 116, + 117, + 118, + 119, + 120, + 121, + 97, + 97 +}; + +extern int table_guepe_left[] +{ + 195, + 196, + 197, + 198, + 197, + 196 +}; + +extern int table_guepe_right[] +{ + 199, + 200, + 201, + 202, + 201, + 200 +}; + +extern int table_guepe_turn2l[] +{ + 207, + 206, + 205, + 204, + 203 +}; + +extern int table_guepe_turn2r[] +{ + 203, + 204, + 205, + 206, + 207 +}; + +extern int table_creature_left[] +{ + 247, + 248, + 249, + 250, + 251, + 250, + 249, + 248 +}; + +extern int table_creature_right[] +{ + 247, + 248, + 249, + 250, + 251, + 250, + 249, + 248 +}; + +extern int table_creature_turn2[] +{ + 244, + 244, + 244, + 244, + 244, + 244, + 244, + 244, + 243, + 243, + 242, + 242, + 242, + 242, + 242, + 242, + 242, + 242, + 243, + 243, + 244, + 244, + 245, + 245, + 246, + 246, + 246, + 246, + 246, + 246, + 246, + 246, + 245, + 245, + 244, + 244, + 243, + 243, + 242, + 242, + 242, + 242, + 242, + 242, + 243, + 243, + 244, + 244, + 245, + 245, + 246, + 246, + 246, + 246, + 246, + 246, + 245, + 245, + 244, + 244, + 243, + 243, + 242, + 242, + 242, + 242, + 243, + 243, + 244, + 244, + 245, + 245, + 246, + 246, + 246, + 246, + 245, + 245, + 244, + 244, + 243, + 243, + 242, + 242, + 243, + 243, + 244, + 244, + 245, + 245, + 246, + 246, + 245, + 245, + 244, + 244, + 243, + 243, + 242, + 242, + 242, + 242, + 243, + 243, + 244, + 244, + 245, + 245, + 246, + 246, + 246, + 246, + 245, + 245, + 244, + 244, + 243, + 243, + 242, + 242, + 242, + 242, + 242, + 242, + 243, + 243, + 244, + 244, + 245, + 245, + 246, + 246, + 246, + 246, + 246, + 246, + 245, + 245, + 244, + 244, + 244, + 244, + 244, + 244, + 244, + 244, + 244, + 244, + 244, + 244, + 244, + 244 +}; + +extern int table_blupih_left[] +{ + 66, + 67, + 68, + 67, + 66, + 69, + 70, + 69 +}; + +extern int table_blupih_right[] +{ + 61, + 62, + 63, + 62, + 61, + 64, + 65, + 64 +}; + +extern int table_blupih_turn2l[] +{ + 71, + 71, + 72, + 72, + 73, + 73, + 74, + 74, + 75, + 75, + 68, + 68, + 275, + 275, + 271, + 271, + 271, + 271, + 272, + 272, + 273, + 273, + 273, + 273, + 275, + 275 +}; + +extern int table_blupih_turn2r[] +{ + 75, + 75, + 74, + 74, + 73, + 73, + 72, + 72, + 71, + 71, + 63, + 63, + 274, + 274, + 271, + 271, + 271, + 271, + 272, + 272, + 273, + 273, + 273, + 273, + 274, + 274 +}; + +extern int table_blupit_left[] +{ + 249, + 249, + 250, + 250, + 249, + 249, + 248, + 248 +}; + +extern int table_blupit_right[] +{ + 238, + 238, + 237, + 237, + 238, + 238, + 239, + 239 +}; + +extern int table_blupit_turn2l[] +{ + 238, + 238, + 251, + 251, + 238, + 238, + 238, + 239, + 240, + 241, + 242, + 243, + 244, + 245, + 246, + 247, + 248, + 249, + 249, + 249, + 252, + 252, + 249, + 249 +}; + +extern int table_blupit_turn2r[] +{ + 249, + 249, + 252, + 252, + 249, + 249, + 249, + 248, + 247, + 246, + 245, + 244, + 243, + 242, + 241, + 240, + 239, + 238, + 238, + 238, + 251, + 251, + 238, + 238 +}; + +extern int table_glu[] +{ + 168, + 168, + 169, + 169, + 170, + 170, + 171, + 171, + 170, + 170, + 169, + 169, + 168, + 168, + 169, + 169, + 169, + 168, + 168, + 169, + 169, + 170, + 170, + 169, + 168 +}; + +extern int table_clear[] +{ + + 40, + 40, + 40, + 40, + 41, + 41, + 41, + 41, + 40, + 40, + 40, + 40, + 40, + 40, + 40, + 41, + 41, + 41, + 40, + 40, + 40, + 40, + 40, + 40, + 40, + 41, + 41, + 41, + 40, + 40, + 42, + 42, + 42, + 43, + 43, + 43, + 44, + 44, + 44, + 45, + 45, + 45, + 46, + 46, + 47, + 47, + 46, + 46, + 47, + 47, + 46, + 46, + 47, + 47, + 46, + 46, + 47, + 47, + 46, + 46, + 47, + 47, + 46, + 46, + 47, + 47, + 46, + 46, + 47, + 47 +}; + +extern int table_electro[] +{ + 266, + 267, + 266, + 267, + 266, + 267, + 266, + 267, + 266, + 267, + 266, + 267, + 266, + 267, + 266, + 267, + 266, + 267, + 266, + 267, + 266, + 267, + 266, + 267, + 266, + 267, + 266, + 267, + 266, + 267, + 40, + 40, + 40, + 40, + 41, + 41, + 41, + 41, + 40, + 40, + 40, + 40, + 40, + 40, + 40, + 41, + 41, + 41, + 40, + 40, + 40, + 40, + 40, + 40, + 40, + 41, + 41, + 41, + 40, + 40, + 42, + 42, + 42, + 43, + 43, + 43, + 44, + 44, + 44, + 45, + 45, + 45, + 46, + 46, + 47, + 47, + 46, + 46, + 47, + 47, + 46, + 46, + 47, + 47, + 46, + 46, + 47, + 47, + 46, + 46 +}; \ No newline at end of file diff --git a/event.h b/event.h index cd4652a..8544239 100644 --- a/event.h +++ b/event.h @@ -4,10 +4,14 @@ ///////////////////////////////////////////////////////////////////////////// +#pragma once + +using namespace std; + #include "movie.h" #include "menu.h" #include "button.h" -#include "decor.h" + typedef struct { @@ -95,7 +99,7 @@ public: int GetState(int button); void SetState(int button, int state); BOOL GetEnable(int button); - void SetEnable(int button, BOOL bEnable); + void SetEnable(WMessage button, int bEnable); void SetSomething(int button, int bSomething); BOOL GetHide(int button); void SetHide(int button, BOOL bHide); @@ -144,6 +148,13 @@ public: void DebugDisplay(char m); void IntroStep(); + void SetLives(int lives); + + void ReadAll(); + BOOL SaveState(int rank); + void SomethingUserMissions(char* lpFilename, LPCSTR fileSomething); + + BOOL AddPhaseText(); void ReadInput(); @@ -168,13 +179,14 @@ public: void PrivateLibelle(); BOOL ReadLibelle(int world, BOOL bSchool, BOOL bHelp); - BOOL WriteInfo(); + BOOL WriteInfo(int gamer, char* playername); BOOL ReadInfo(int gamer); void TryPhase(); void UnTryPhase(); int GetTryPhase(); BOOL ReadPlayer(); - void SetLives(int lives); + void PutTextInputBox(POINT pos); + void DemoRecStart(); void DemoRecStop(); @@ -190,6 +202,8 @@ public: void NetFUN_1d6b0(UINT message, USHORT data); void NetDrawMap(); void ChatSend(); + void HandleChatBuffer(); + void ChatMessageSound(char* data); void MouseRelease(); void MouseCapture(); @@ -200,8 +214,10 @@ protected: int m_exercice; int m_mission; char m_gamerName[100]; + char m_gamerNameList[10][100]; void* m_somethingJoystick; int m_menuIndex; + int m_fileIndex; int m_menuDecor[10]; BOOL m_bMouseRelease; int m_private; @@ -295,6 +311,9 @@ protected: int m_lives; int m_multi; HINSTANCE m_hInstance; - char m_chatZone[100][5]; + char m_chatZone[100][5]; char m_text[100]; -}; \ No newline at end of file +}; + +extern +int DirectoryThing(LPCSTR filename); \ No newline at end of file diff --git a/menu.h b/menu.h index 837e0c8..a73d3f8 100644 --- a/menu.h +++ b/menu.h @@ -4,8 +4,10 @@ using namespace std; -#include +//#include #include +#include "decor.h" +#include "pixmap.h" ////////////////////////////////////////////////////////////////////// diff --git a/misc.cpp b/misc.cpp index 20cc97e..efe329b 100644 --- a/misc.cpp +++ b/misc.cpp @@ -347,7 +347,7 @@ void TraceErrorDD(HRESULT hErr, const char *sFile, int nLine) // //---------------------------------------------------------------------- -void TraceErrorDS(HRESULT hErr, char *sFile, int nLine) +void TraceErrorDS(HRESULT hErr, const char *sFile, int nLine) { char dserr[256]; char err[1024]; diff --git a/movie.cpp b/movie.cpp index 8ba85d0..f7fac33 100644 --- a/movie.cpp +++ b/movie.cpp @@ -1,6 +1,10 @@ // movie.cpp // +using namespace std; + +#pragma once + #include #include #include @@ -10,10 +14,12 @@ #include #include #include +//#include #include "def.h" #include "movie.h" #include "misc.h" +#pragma warning (disable : 4996) //---------------------------------------------------------------------------- @@ -33,7 +39,7 @@ BOOL CMovie::initAVI() // set up the open parameters mciOpen.dwCallback = 0L; mciOpen.wDeviceID = 0; - mciOpen.lpstrDeviceType = AVI_VIDEO; + mciOpen.lpstrDeviceType = (LPWSTR)AVI_VIDEO; mciOpen.lpstrElementName = NULL; mciOpen.lpstrAlias = NULL; mciOpen.dwStyle = 0; @@ -120,7 +126,7 @@ BOOL CMovie::fileOpenMovie(HWND hWnd, RECT rect, char *pFilename) mciOpen.dwCallback = 0L; mciOpen.wDeviceID = 0; mciOpen.lpstrDeviceType = NULL; - mciOpen.lpstrElementName = string; + mciOpen.lpstrElementName = (LPWSTR)string; mciOpen.lpstrAlias = NULL; mciOpen.dwStyle = WS_CHILD; mciOpen.hWndParent = hWnd; @@ -138,7 +144,7 @@ BOOL CMovie::fileOpenMovie(HWND hWnd, RECT rect, char *pFilename) mciWindow.dwCallback = 0L; mciWindow.hWnd = NULL; mciWindow.nCmdShow = SW_SHOW; - mciWindow.lpstrText = (LPSTR)NULL; + mciWindow.lpstrText = (LPWSTR)NULL; // mciSendCommand(m_wMCIDeviceID, MCI_WINDOW, // MCI_DGV_WINDOW_STATE, // (DWORD)(LPMCI_DGV_WINDOW_PARMS)&mciWindow); diff --git a/movie.h b/movie.h index 3cc3fd6..b67f63b 100644 --- a/movie.h +++ b/movie.h @@ -1,6 +1,12 @@ // movie.h // + +#pragma once +using namespace std; + +//#include + class CMovie { public: diff --git a/pixmap.cpp b/pixmap.cpp index bbb782f..a8ca72a 100644 --- a/pixmap.cpp +++ b/pixmap.cpp @@ -5,12 +5,15 @@ #include #include #include +#include +#include #include "def.h" #include "pixmap.h" #include "misc.h" #include "ddutil.h" #include "blupi.cpp" +#pragma comment(lib, "ddraw.lib") ///////////////////////////////////////////////////////////////////////////// @@ -125,6 +128,21 @@ BOOL CPixmap::Create(HWND hwnd, POINT dim, DDSURFACEDESC ddsd; HRESULT ddrval; POINT pos; + HDC hdc; + + hdc = CreateCompatibleDC(NULL); + if (hdc == NULL) { + bTrueColor = 0; + bTrueColorDecor = 0; + } + else { + ddrval = GetDeviceCaps(hdc, SIZEPALETTE); + if ((ddrval != 0) && (ddrval < 257)) { + bTrueColor = 0; + bTrueColorDecor = 0; + } + DeleteDC(hdc); + } m_hWnd = hwnd; m_bFullScreen = bFullScreen; @@ -174,7 +192,7 @@ BOOL CPixmap::Create(HWND hwnd, POINT dim, // Set the video mode to 640x480x8. if ( m_bFullScreen ) { - ddrval = m_lpDD->SetDisplayMode(dim.x, dim.y, 8); + ddrval = m_lpDD->SetDisplayMode(dim.x, dim.y, bTrueColor || bTrueColorDecor ? 16 : 8); if ( ddrval != DD_OK ) { OutputDebug("Fatal error: SetDisplayMode\n"); @@ -278,24 +296,129 @@ BOOL CPixmap::Restore() return TRUE; } -/* -void HudIcon(int channel, int rank, POINT pos) -{ - pos.x = (int)((double)pos.x + CPixmap::originX) -} - void CPixmap::QuickIcon(int channel, int rank, POINT pos) { - RECT rect; + int num; + tagRECT rect; + + if (channel == CHOBJECT) { - rect.left = pos.x; - rect.top = pos.y; - rect.right = pos.x; - rect.bottom = pos.y; - }; - DrawIcon(channel, rank, rect, 1.0, TRUE); + if (g_objectMax <= rank) + { + return; + } + num = rank * 12; + rect.left = (LONG)g_object[rank * 6]; + rect.top = (LONG)g_object[rank * 6 + 1]; + rect.right = g_object[rank * 6 + 4] + rect.left; + rect.bottom = g_object[rank * 6 + 2]; + pos.x = pos.x + g_object[rank * 6 + 2]; + num = (int)g_object[rank * 6 + 3]; + } + else if (channel == CHELEMENT) + { + if (g_elementMax <= rank) + { + return; + } + num = rank * 12; + rect.left = (LONG)g_element[rank * 6]; + rect.top = (LONG)g_element[rank * 6 + 1]; + rect.right = g_element[rank * 6 + 4] + rect.left; + rect.bottom = g_element[rank * 6 + 5] + rect.top; + pos.x = pos.x + g_element[rank * 6 + 2]; + num = (int)g_element[rank * 6 + 3]; + } + else if ((((channel == CHBLUPI) || (channel == CHBLUPI1)) || (channel == CHBLUPI2)) || (channel == CHBLUPI3)) + { + if (g_blupiMax <= rank) + { + return; + } + num = rank * 12; + rect.left = (LONG)g_blupiCh[rank * 6]; + rect.top = (LONG)g_blupiCh[rank * 6 + 1]; + rect.right = g_blupiCh[rank * 6 + 4] + rect.left; + rect.bottom = g_blupiCh[rank * 6 + 5] + rect.top; + pos.x = pos.x + g_blupiCh[rank * 6 + 2]; + num = (int)g_blupiCh[rank * 6 + 3]; + } + else + { + if (channel != CHEXPLO) + { + rect.right = m_iconDim[channel].x; + num = m_totalDim[channel].x / rect.right; + rect.bottom = m_iconDim[channel].y; + if (rank < 0) + { + return; + } + if ((m_totalDim[channel].y / rect.bottom) * num <= rank) + { + return; + } + rect.left = (rank % num) * rect.right; + rect.right = rect.left + rect.right; + rect.top = (rank / num) * rect.bottom; + rect.bottom = rect.top + rect.bottom; + goto LABEL_1; + } + if (g_exploMax <= rank) + { + return; + } + rect.left = (LONG)g_explo[rank * 6]; + rect.top = (LONG)g_explo[rank * 6 + 1]; + rect.right = g_explo[rank * 6 + 4] + rect.left; + rect.bottom = g_explo[rank * 6 + 5] + rect.top; + pos.x = pos.x + g_explo[rank * 6 + 2]; + num = (int)g_explo[rank * 6 + 3]; + } + pos.y = pos.y + num; + +LABEL_1: + num = m_clipRect.left; + if (pos.x < num) + { + num = num - pos.x; + pos.x = m_clipRect.left; + rect.left = rect.left + num; + } + num = (m_clipRect.right + rect.left) - pos.x; + if (num < rect.right) + { + rect.right = num; + } + num = m_clipRect.top; + if (pos.y < num) + { + num = num - pos.y; + pos.y = m_clipRect.top; + rect.top = rect.top + num; + } + num = (m_clipRect.bottom + rect.top) - pos.y; + if (num < rect.bottom) + { + rect.bottom = num; + } + if ((rect.left < rect.right) && (rect.top < rect.bottom)) + { + while (num = (m_lpDDSBack->BltFast(pos.x, pos.y, m_lpDDSurface[channel], &rect, 1), num != 0)) + { + if ((num == 0x7789FE3E) && (num = RestoreAll(), num != 0)) + { + return; + } + if (num != 0x7789FE3E) + { + return; + } + } + } + return; } -*/ + // Initialise la palette syst�me. @@ -607,49 +730,14 @@ int CPixmap::SearchColor(int red, int green, int blue) return j; } +// Cache une image contenant des icônes. -// Cache une image contenant des ic�nes. - -BOOL CPixmap::Cache1(int channel, char *pFilename, POINT totalDim, BOOL bUsePalette) -{ - POINT iconDim; - - if (strstr(pFilename, "blupi") == pFilename) - { - return FALSE; - } - else - { - if (strstr(pFilename, "element") == pFilename) - { - return FALSE; - } - if (strstr(pFilename, "explo") == pFilename) - { - return FALSE; - } - if (strstr(pFilename, "object") == pFilename) - { - return FALSE; - } - return TRUE; - } - - if (bUsePalette != 0) - { - //TODO: more - } -} - - -// Cache une image globale. - -BOOL CPixmap::Cache2(int channel, char *pFilename, POINT totalDim, POINT iconDim, +BOOL CPixmap::Cache(int channel, char *pFilename, POINT totalDim, POINT iconDim, BOOL bUsePalette) { - HRESULT ddrval; + HRESULT ddrval; - if (channel < 0 || channel >= MAXIMAGE) return FALSE; + if (channel < 0 || channel >= MAXIMAGE) return FALSE; if (m_lpDDSurface[channel] != NULL) { @@ -659,10 +747,10 @@ BOOL CPixmap::Cache2(int channel, char *pFilename, POINT totalDim, POINT iconDim // Create and set the palette. if (bUsePalette) { - if (m_bDebug) OutputDebug("Use palette\n"); + if (m_bDebug) OutputDebug("Use palette\n"); if (m_lpDDPal != NULL) { - if (m_bDebug) OutputDebug("Release palette\n"); + if (m_bDebug) OutputDebug("Release palette\n"); m_lpDDPal->Release(); m_lpDDPal = NULL; } @@ -671,8 +759,8 @@ BOOL CPixmap::Cache2(int channel, char *pFilename, POINT totalDim, POINT iconDim if (m_lpDDPal) { - if (m_bDebug) OutputDebug("Set palette\n"); - m_lpDDSPrimary->SetPalette(NULL); // indispensable ! + if (m_bDebug) OutputDebug("Set palette\n"); + m_lpDDSPrimary->SetPalette(NULL); // indispensable ! ddrval = m_lpDDSPrimary->SetPalette(m_lpDDPal); if (ddrval != DD_OK) { @@ -691,8 +779,8 @@ BOOL CPixmap::Cache2(int channel, char *pFilename, POINT totalDim, POINT iconDim } // Set the color key to white - if (m_bDebug) OutputDebug("DDSetColorKey\n"); - DDSetColorKey(m_lpDDSurface[channel], RGB(255, 255, 255)); // blanc + if (m_bDebug) OutputDebug("DDSetColorKey\n"); + DDSetColorKey(m_lpDDSurface[channel], RGB(255, 255, 255)); // blanc strcpy(m_filename[channel], pFilename); @@ -702,16 +790,89 @@ BOOL CPixmap::Cache2(int channel, char *pFilename, POINT totalDim, POINT iconDim return TRUE; } -BOOL CPixmap::CacheAll(BOOL cache, HWND hWnd, BOOL bFullScreen, BOOL bTrueColor, BOOL bTrueColorDecor, int mouseType, char* pFilename, int region) -{ - char filename[100]; +// Cache une image provenant d'un bitmap. +// Probably not needed? + + +BOOL CPixmap::Cache(int channel, HBITMAP hbm, POINT totalDim) +{ + if ( channel < 0 || channel >= MAXIMAGE ) return FALSE; + + if ( m_lpDDSurface[channel] != NULL ) + { + Flush(channel); + } + + // Create the offscreen surface, by loading our bitmap. + m_lpDDSurface[channel] = DDConnectBitmap(m_lpDD, hbm); + + if ( m_lpDDSurface[channel] == NULL ) + { + OutputDebug("Fatal error: DDLoadBitmap\n"); + return FALSE; + } + + // Set the color key to white + DDSetColorKey(m_lpDDSurface[channel], RGB(255,255,255)); // blanc + + m_totalDim[channel] = totalDim; + m_iconDim[channel] = totalDim; + + return TRUE; +} + +BOOL CPixmap::BackgroundCache(int channel, const char* pFilename, POINT totalDim, POINT iconDim, BOOL bUsePalette) +{ + BOOL decor; + char file[100]; + + decor = strstr(pFilename, "blupi") != pFilename && + strstr(pFilename, "element") != pFilename && + strstr(pFilename, "explo") != pFilename && + strstr(pFilename, "object") != pFilename; + if (bUsePalette) + { + goto LABEL1; + } + if (decor) + { + if (m_bTrueColor == FALSE) + { + if (decor) goto LABEL1; + if (m_bTrueColorDecor == FALSE) goto LABEL1; + } + } + strcpy(file, "image16\\"); + strcat(file, pFilename); + if (Cache(channel, file, totalDim, iconDim, FALSE)) + { + return TRUE; + } +LABEL1: + strcpy(file, "image08\\"); + strcat(file, pFilename); + return Cache(channel, file, totalDim, iconDim, bUsePalette); +} + +BOOL CPixmap::CacheAll(BOOL cache, HWND hWnd, BOOL bFullScreen, BOOL bTrueColor, BOOL bTrueColorDecor, int mouseType, const char* pFilename, int region) +{ + SetDebug(TRUE); // + char filename[100]; + char image[12]; POINT totalDim; POINT iconDim; RECT rect; POINT dim; - m_dim = dim; + + totalDim.x = 640; + totalDim.y = 480; + iconDim.x = 0; + iconDim.y = 0; + + dim.x = LXIMAGE; + dim.y = LYIMAGE; if (cache == FALSE) { @@ -728,8 +889,8 @@ BOOL CPixmap::CacheAll(BOOL cache, HWND hWnd, BOOL bFullScreen, BOOL bTrueColor, return FALSE; } - OutputDebug("Image:_init\n"); - if (Cache2(0, "init.blp", totalDim, iconDim, TRUE) == FALSE) + OutputDebug("Image: init\n"); + if (BackgroundCache(0, "init.blp", totalDim, iconDim, TRUE) == FALSE) { return FALSE; } @@ -738,104 +899,160 @@ BOOL CPixmap::CacheAll(BOOL cache, HWND hWnd, BOOL bFullScreen, BOOL bTrueColor, SavePalette(); OutputDebug("InitSysPalette\n"); InitSysPalette(); - SetDebug(FALSE); + //SetDebug(FALSE); if (cache == FALSE) { - if (Cache2(0, pFilename, totalDim, iconDim, FALSE) == NULL) + if (BackgroundCache(0, pFilename, totalDim, iconDim, FALSE) == FALSE) { - return NULL; + return FALSE; } } else { + *(char*)image = (LXIMAGE) << 64; + rect.bottom = LYIMAGE; + rect.left = LOWORD(image); + rect.top = HIWORD(image); + rect.right = HIWORD(image); DrawImage(0, 0, rect, 1); Display(); } - if (Cache2(CHOBJECT, "object.blp", totalDim, iconDim, FALSE) == FALSE) + if (BackgroundCache(CHOBJECT, "object.blp", totalDim, iconDim, FALSE) == FALSE) { return FALSE; } SetTransparent(CHOBJECT, RGB(0, 0, 255)); - if (Cache2(CHBLUPI, "blupi000.blp", totalDim, iconDim, FALSE) == FALSE) + if (BackgroundCache(CHBLUPI, "blupi000.blp", totalDim, iconDim, FALSE) == FALSE) { return FALSE; } SetTransparent(CHBLUPI, RGB(0, 0, 255)); - if (Cache2(CHBLUPI1, "blupi001.blp", totalDim, iconDim, FALSE) == FALSE) + if (BackgroundCache(CHBLUPI1, "blupi001.blp", totalDim, iconDim, FALSE) == FALSE) { return FALSE; } SetTransparent(CHBLUPI1, RGB(0, 0, 255)); - if (Cache2(CHBLUPI2, "blupi002.blp", totalDim, iconDim, FALSE) == FALSE) + if (BackgroundCache(CHBLUPI2, "blupi002.blp", totalDim, iconDim, FALSE) == FALSE) { return FALSE; } SetTransparent(CHBLUPI2, RGB(0, 0, 255)); - if (Cache2(CHBLUPI3, "blupi003.blp", totalDim, iconDim, FALSE) == FALSE) + if (BackgroundCache(CHBLUPI3, "blupi003.blp", totalDim, iconDim, FALSE) == FALSE) { return FALSE; } SetTransparent(CHBLUPI3, RGB(0, 0, 255)); - if (Cache2(CHTEMP, "temp.blp", totalDim, iconDim, FALSE) == FALSE) + if (BackgroundCache(CHTEMP, "temp.blp", totalDim, iconDim, FALSE) == FALSE) { return FALSE; } SetTransparent(CHTEMP, RGB(0, 0, 255)); - if (Cache2(CHMAP, "map.blp", totalDim, iconDim, FALSE) == FALSE) + if (BackgroundCache(CHMAP, "map.blp", totalDim, iconDim, FALSE) == FALSE) { return FALSE; } SetTransparent(CHMAP, RGB(0, 0, 255)); - if (Cache2(CHELEMENT, "element.blp", totalDim, iconDim, FALSE) == FALSE) + if (BackgroundCache(CHELEMENT, "element.blp", totalDim, iconDim, FALSE) == FALSE) { return FALSE; } SetTransparent(CHELEMENT, RGB(0, 0, 255)); - if (Cache2(CHEXPLO, "explo.blp", totalDim, iconDim, FALSE) == FALSE) + if (BackgroundCache(CHEXPLO, "explo.blp", totalDim, iconDim, FALSE) == FALSE) { return FALSE; } SetTransparent(CHEXPLO, RGB(0, 0, 255)); sprintf(filename, "decor%.3d.blp", region); - if (Cache2(CHDECOR, filename, totalDim, iconDim, FALSE) == FALSE) + if (BackgroundCache(CHDECOR, filename, totalDim, iconDim, FALSE) == FALSE) { return FALSE; } - if (Cache2(CHBUTTON, "button00.blp", totalDim, iconDim, FALSE) == FALSE) + if (BackgroundCache(CHBUTTON, "button00.blp", totalDim, iconDim, FALSE) == FALSE) { return FALSE; } SetTransparent(CHBUTTON, RGB(0, 0, 255)); - if (Cache2(CHJAUGE, "jauge.blp", totalDim, iconDim, FALSE) == FALSE) + if (BackgroundCache(CHJAUGE, "jauge.blp", totalDim, iconDim, FALSE) == FALSE) { return FALSE; } SetTransparent(CHJAUGE, RGB(0, 0, 255)); - if (Cache2(CHTEXT, "text.blp", totalDim, iconDim, FALSE) == FALSE) + if (BackgroundCache(CHTEXT, "text.blp", totalDim, iconDim, FALSE) != FALSE) { - return FALSE; - } - SetTransparent(CHTEXT, RGB(0, 0, 255)); - if (Cache2(CHLITTLE, "little.blp", totalDim, iconDim, FALSE) == FALSE) - { - SetTransparent(CHLITTLE, RGB(0, 0, 255)); - Benchmark(); - return TRUE; + SetTransparent(CHTEXT, RGB(0, 0, 255)); + if (BackgroundCache(CHLITTLE, "little.blp", totalDim, iconDim, FALSE) != FALSE) + { + SetTransparent(CHLITTLE, RGB(0, 0, 255)); + Benchmark(); + return TRUE; + } } return FALSE; } int CPixmap::Benchmark() { + timeb time[2]; + RECT rect; + FILE* file; + UINT crap; + int num; + int num2; + int num3; + UINT num4; + int num5; + int num6; + int i; + POINT pos; + POINT dest; + char buffer[100]; + ftime(time); + num = (int)time; + num2 = 29; + num3 = 10; + + rect.top = num; + rect.left = 29; + rect.right = 669; + rect.bottom = 509; + num5 = 120; + dest.x = 0; + dest.y = 0; + DrawPart(-1, -3, dest, rect, 1, FALSE); + do + { + pos.x = 13; + pos.y = 13; + QuickIcon(1, 1, pos); + num5--; + } while (num5); + ftime(time); + i = (int)time; + + crap = 0; + + num4 = crap & 0xFFFF; + + if (num4 < num) + { + i = num4 + 100; + } + num6 = i - num; + sprintf(buffer, "Benchmark = %d\r\n", i - num); + + file = fopen("data\\bench.blp", "wb"); + + if (fopen("data\\bench.blp", "wb")) + { + fwrite(buffer, strlen(buffer), 1, file); + fclose(file); + } + return num6; } -void CPixmap::SetDebug(BOOL bDebug) -{ - m_bDebug = bDebug; - DDSetDebug(bDebug); -} + // Purge une image. @@ -885,7 +1102,7 @@ void CPixmap::SetClipping(RECT clip) // Retourne la r�gion de clipping. -RECT CPixmap::GetClipping() +RECT CPixmap::GetClipping(RECT* rect) { return m_clipRect; } @@ -894,73 +1111,7 @@ RECT CPixmap::GetClipping() // Teste si un point fait partie d'une ic�ne. //Rough rewritten code, might need improvement -BOOL CPixmap::IsIconPixel(int channel, int rank, POINT pos) -{ - int nbx, nby; - COLORREF rgb; - HDC hDC; - if (channel == 1) - { - if (g_objectMax <= rank) - { - return; - } - } - else if (channel == 10) - { - if (g_elementMax <= rank) - { - return; - } - } - else if (channel == CHBLUPI || channel == CHBLUPI1 || channel == CHBLUPI2 || channel == CHBLUPI3) - { - if (g_blupiMax <= rank) - { - return; - } - } - else - { - if (channel != CHEXPLO) - { - if (rank < 0) - return; - } - if (rank < 0 || rank >= nbx * nby) - { - return; - } - if (g_exploMax <= rank) - { - return; - } - } - - if ( channel < 0 || channel >= MAXIMAGE ) return FALSE; - if ( m_lpDDSurface[channel] == NULL ) return FALSE; - - if ( m_iconDim[channel].x == 0 || - m_iconDim[channel].y == 0 ) return FALSE; - - nbx = m_totalDim[channel].x / m_iconDim[channel].x; - nby = m_totalDim[channel].y / m_iconDim[channel].y; - - if ( rank < 0 || rank >= nbx*nby ) return FALSE; - - pos.x += (rank%nbx)*m_iconDim[channel].x; - pos.y += (rank/nbx)*m_iconDim[channel].y; - - if ( m_lpDDSurface[channel]->GetDC(&hDC) != DD_OK ) return FALSE; - rgb = GetPixel(hDC, pos.x, pos.y); - m_lpDDSurface[channel]->ReleaseDC(hDC); - - if ( rgb == m_colorSurface[2*channel+0] || - rgb == m_colorSurface[2*channel+1] ) return FALSE; - - return TRUE; -} // Dessine une partie d'image rectangulaire. @@ -980,6 +1131,7 @@ BOOL CPixmap::DrawIcon(int chDst, int channel, int rank, POINT pos, { return FALSE; } + } else if (channel == CHELEMENT) { @@ -1001,6 +1153,9 @@ BOOL CPixmap::DrawIcon(int chDst, int channel, int rank, POINT pos, { if (channel != CHEXPLO) { + nbx = m_totalDim[channel].x / m_iconDim[channel].x; + nby = m_totalDim[channel].y / m_iconDim[channel].y; + if (channel < 0 || channel >= MAXIMAGE) return FALSE; if (m_lpDDSurface[channel] == NULL) return FALSE; if (m_iconDim[channel].x == 0 || diff --git a/pixmap.h b/pixmap.h index d7f775b..59656e8 100644 --- a/pixmap.h +++ b/pixmap.h @@ -1,57 +1,59 @@ // CPixmap.h +using namespace std; + #pragma once #include ///////////////////////////////////////////////////////////// -#define MAXIMAGE 100 +#define MAXIMAGE 100 class CPixmap { public: - CPixmap(); - ~CPixmap(); + CPixmap(); + ~CPixmap(); - BOOL CacheAll(BOOL _foo, HWND hWnd, BOOL bFullScreen, BOOL bTrueColor, - BOOL bTrueColorDecor, int mouseType, char *_str, int _baz); - int Benchmark(); - void SetDebug(BOOL bDebug); - BOOL Create(HWND hwnd, POINT dim, BOOL bFullScreen, BOOL bTrueColor, - BOOL bTrueColorDecor, int mouseType); - BOOL Flush(); - BOOL Restore(); - BOOL InitSysPalette(); - BOOL GetTrueColor(); - void SetBenchmarkSuccess(BOOL bSuccess); - void SetTrueColor(BOOL bTrueColor); - void SetTrueColorDecor(BOOL bTrueColorDecor); - BOOL FUN_28f60(int channel); + void SetDebug(BOOL bDebug); - BOOL IsPalette(); - void Fill(RECT rect, COLORREF color); + BOOL Create(HWND hwnd, POINT dim, BOOL bFullScreen, int mouseType, BOOL bTrueColor, BOOL bTrueColorDecor); + BOOL Flush(); + BOOL Restore(); + BOOL InitSysPalette(); + BOOL IsPalette(); + void Fill(RECT rect, COLORREF color); + BOOL SavePalette(); + BOOL RestorePalette(); + int SearchColor(int red, int green, int blue); + BOOL Cache(int channel, char *pFilename, POINT totalDim, POINT iconDim, BOOL bUsePalette); + BOOL Cache(int channel, HBITMAP hbm, POINT totalDim); + BOOL BackgroundCache(int channel, const char* pFilename, POINT totalDim, POINT iconDim, BOOL bUsePalette); + BOOL CacheAll(BOOL cache, HWND hWnd, BOOL bFullScreen, BOOL bTrueColor, BOOL bTrueColorDecor, int mouseType, const char* pFilename, int region); + int Benchmark(); + void Flush(int channel); + void SetTransparent(int channel, COLORREF color); + void SetTransparent2(int channel, COLORREF color1, COLORREF color2); + void SetClipping(RECT clip); + RECT GetClipping(RECT* rect); + void HudIcon(int channel, int rank, POINT pos); + void QuickIcon(int channel, int rank, POINT pos); - BOOL SavePalette(); - BOOL RestorePalette(); - int SearchColor(int red, int green, int blue); - BOOL BackgroundCache(int channel, char *pFilename, POINT totalDim, POINT iconDim, BOOL bUsePalette); - BOOL Cache2(int channel, char *pFilename, POINT totalDim, POINT iconDim, BOOL bUsePalette); - void Flush(int channel); - void SetTransparent(int channel, COLORREF color); - void SetTransparent2(int channel, COLORREF color1, COLORREF color2); - void SetClipping(RECT clip); - RECT GetClipping(); - void QuickIcon(int channel, int rank, POINT pos); + BOOL IsIconPixel(int channel, int rank, POINT pos); - BOOL IsIconPixel(int channel, int rank, POINT pos); - - BOOL DrawIcon(int chDst, int channel, int rank, POINT pos, int mode = 0, BOOL bMask = FALSE); - BOOL DrawPart(int chDst, int channel, POINT dest, RECT rect, int mode = 0, BOOL bMask = FALSE); - BOOL DrawImage(int chDst, int channel, RECT rect, int mode = 0); + void DrawChar(int rank, POINT pos, double size); + BOOL DrawIcon(int chDst, int channel, int rank, POINT pos, int mode=0, BOOL bMask=FALSE); + BOOL DrawIconDemi(int chDst, int channel, int rank, POINT pos, int mode=0, BOOL bMask=FALSE); + BOOL DrawIconPart(int chDst, int channel, int rank, POINT pos, int startY, int endY, int mode=0, BOOL bMask=FALSE); + BOOL DrawPart(int chDst, int channel, POINT dest, RECT rect, int mode=0, BOOL bMask=FALSE); + BOOL DrawImage(int chDst, int channel, RECT rect, int mode=0); + BOOL BuildIconMask(int channelMask, int rankMask, + int channel, int rankSrc, int rankDst); + BOOL Display(); void SetMousePosSprite(POINT pos, int sprite, BOOL bDemoPlay); @@ -66,7 +68,7 @@ protected: HRESULT RestoreAll(); HRESULT BltFast(int chDst, int channel, POINT dst, RECT rcRect, int mode); HRESULT BltFast(LPDIRECTDRAWSURFACE lpDD, - int channel, POINT dst, RECT rcRect, int mode); + int channel, POINT dst, RECT rcRect, int mode); void MouseUpdate(); BOOL MouseQuickDraw(RECT rect); @@ -75,42 +77,49 @@ protected: void MouseBackDebug(); RECT MouseRectSprite(); void MouseHotSpot(); + BOOL GetTrueColor(); + + void SetBenchmarkSuccess(BOOL bSuccess); + void SetTrueColor(BOOL bTrueColor); + void SetTrueColorDecor(BOOL bTrueColorDecor); protected: - BOOL m_bFullScreen; - BOOL m_bBenchmarkSuccess; - BOOL m_bTrueColor; - BOOL m_bTrueColorDecor; - BOOL m_field5_0x14; //Need to figure out - BOOL m_field5_0x18; //Need to figure out - int m_mouseType; - BOOL m_bDebug; - BOOL m_bPalette; - HWND m_hWnd; - POINT m_dim; - RECT m_clipRect; + BOOL m_bFullScreen; + BOOL m_bBenchmarkSuccess; + BOOL m_bTrueColor; + BOOL m_bTrueColorDecor; + BOOL m_field5_0x14; //Need to figure out + BOOL m_field5_0x18; //Need to figure out + int m_mouseType; + BOOL m_bDebug; + BOOL m_bPalette; + HWND m_hWnd; + POINT m_dim; + RECT m_clipRect; + double originX; + double originY; - POINT m_mousePos; - int m_mouseSprite; - POINT m_mouseHotSpot; - POINT m_mouseBackPos; - BOOL m_bMouseBack; - BOOL m_bMouseShow; - BOOL m_bBackDisplayed; + POINT m_mousePos; + int m_mouseSprite; + POINT m_mouseHotSpot; + POINT m_mouseBackPos; + BOOL m_bMouseBack; + BOOL m_bMouseShow; + BOOL m_bBackDisplayed; - LPDIRECTDRAW m_lpDD; - LPDIRECTDRAWSURFACE m_lpDDSPrimary; - LPDIRECTDRAWSURFACE m_lpDDSBack; - LPDIRECTDRAWSURFACE m_lpDDSMouse; - LPDIRECTDRAWPALETTE m_lpDDPal; - LPDIRECTDRAWSURFACE m_lpDDSurface[MAXIMAGE]; - LPDIRECTDRAWCLIPPER m_lpClipper; - PALETTEENTRY m_pal[256]; - PALETTEENTRY m_sysPal[256]; - COLORREF m_colorSurface[2 * MAXIMAGE]; + LPDIRECTDRAW m_lpDD; + LPDIRECTDRAWSURFACE m_lpDDSPrimary; + LPDIRECTDRAWSURFACE m_lpDDSBack; + LPDIRECTDRAWSURFACE m_lpDDSMouse; + LPDIRECTDRAWPALETTE m_lpDDPal; + LPDIRECTDRAWSURFACE m_lpDDSurface[MAXIMAGE]; + LPDIRECTDRAWCLIPPER m_lpClipper; + PALETTEENTRY m_pal[256]; + PALETTEENTRY m_sysPal[256]; + COLORREF m_colorSurface[2*MAXIMAGE]; - char m_filename[MAXIMAGE][20]; - POINT m_totalDim[MAXIMAGE]; - POINT m_iconDim[MAXIMAGE]; - DDBLTFX m_DDbltfx; -}; + char m_filename[MAXIMAGE][20]; + POINT m_totalDim[MAXIMAGE]; + POINT m_iconDim[MAXIMAGE]; + DDBLTFX m_DDbltfx; +}; \ No newline at end of file diff --git a/resource.h b/resource.h index 8e685d0..6bac520 100644 --- a/resource.h +++ b/resource.h @@ -37,124 +37,85 @@ #define TX_ACTION_REPEAT 33 #define TX_ACTION_QARMURE 34 #define TX_ACTION_FABARMURE 35 -#define TX_IONAMEEX 100 -#define TX_IOFREE 101 -#define IDR_MENU 102 -#define TX_TERMMIN 102 -#define TX_TERMMAX 103 -#define TX_BUTTON_JOUER 104 -#define TX_BUTTON_APPRENDRE 105 -#define TX_BUTTON_QUITTER 106 -#define TX_BUTTON_PREVP 107 -#define TX_BUTTON_NEXTP 108 -#define TX_BUTTON_PLAYP 109 -#define TX_BUTTON_BUILDP 110 -#define TX_BUTTON_TERM 111 -#define TX_BUTTON_READP 112 -#define TX_BUTTON_WRITEP 113 -#define TX_BUTTON_CANCELP 114 -#define TX_BUTTON_CONTP 115 -#define TX_BUTTON_REPEAT 116 -#define TX_BUTTON_BUTTON 117 -#define TX_BUTTON_CTERM 118 -#define TX_BUTTON_TERMC 119 -#define TX_BUTTON_TERMHBLUPI 120 -#define TX_BUTTON_TERMHPLANCHE 121 -#define TX_BUTTON_TERMFIRE 122 -#define TX_BUTTON_TERMDEC 123 -#define TX_BUTTON_TERMINC 124 -#define TX_PAUSE 125 -#define TX_JAUGE1 126 -#define TX_JAUGE2 127 -#define TX_BUTTON_SETUP 128 -#define TX_BUTTON_MUSIC 129 -#define TX_BUTTON_SETUP1 130 -#define TX_BUTTON_SETUP2 131 -#define TX_BUTTON_SETUP3 132 -#define TX_BUTTON_SETUP4 133 -#define TX_BUTTON_MUSIC1 134 -#define TX_BUTTON_MUSIC2 135 -#define TX_BUTTON_MUSIC3 136 -#define TX_BUTTON_MUSIC4 137 -#define TX_BUTTON_MUSIC5 138 -#define TX_BUTTON_MUSIC6 139 -#define TX_BUTTON_MUSIC7 140 -#define TX_BUTTON_MUSIC8 141 -#define TX_BUTTON_MUSIC9 142 -#define TX_BUTTON_MUSIC10 143 -#define TX_BUTTON_REGION 144 -#define TX_BUTTON_TERMMBLUPI 145 -#define TX_BUTTON_TERMKILL 146 -#define TX_TERM 147 -#define TX_BUTTON 148 -#define TX_MUSIC 149 -#define TX_SCHOOL 150 -#define TX_MISSION 151 -#define TX_IONAMEMI 152 -#define TX_BUTTON_TERMHTOMATE 153 -#define TX_BUTTON_SETUP5 154 -#define TX_BUTTON_SETUP6 155 -#define TX_BUTTON_SETUP7 156 -#define TX_BUTTON_SETUP8 157 -#define TX_OUI 158 -#define TX_NON 159 -#define TX_BUTTON_SETUP9 160 -#define TX_BUTTON_SETUP10 161 -#define TX_INFO_SETUP1 162 -#define TX_INFO_SETUP2 163 -#define TX_INFO_SETUP3 164 -#define TX_INFO_SETUP4 165 -#define TX_INFO_SETUP5 166 -#define TX_INFO_SETUP6 167 -#define TX_INFO_SETUP7 168 -#define TX_INFO_SETUP8 169 -#define TX_INFO_SETUP9 170 -#define TX_INFO_SETUP10 171 -#define TX_INFO_SETUP10b 172 -#define TX_INFO_NOSCROLL 173 -#define TX_BUTTON_REGION1 174 -#define TX_BUTTON_REGION2 175 -#define TX_BUTTON_REGION3 176 -#define TX_BUTTON_REGION4 177 -#define TX_REGION 178 -#define TX_BUTTON_PLAY_STOP 179 -#define TX_BUTTON_PLAY_SETUP 180 -#define TX_BUTTON_PLAY_WRITE 181 -#define TX_INSERT 182 -#define TX_BUTTON_PREVH 183 -#define TX_BUTTON_NEXTH 184 -#define TX_BUTTON_TERMHMETAL 185 -#define TX_BUTTON_HELP 186 -#define TX_HELP 187 -#define TX_BUTTON_PRIVE 188 -#define TX_PRIVATE 189 -#define TX_IONAMEPR 190 -#define TX_PRIVATE_HACHBLUPI 191 -#define TX_PRIVATE_HACHPLANCHE 192 -#define TX_PRIVATE_HACHTOMATE 193 -#define TX_PRIVATE_HACHMETAL 194 -#define TX_PRIVATE_STOPFIRE 195 -#define TX_PRIVATE_HOMEBLUPI 196 -#define TX_PRIVATE_KILLROBOTS 197 -#define TX_BUTTON_UNDO 198 -#define TX_DEMO_END1 199 -#define TX_DEMO_END2 200 -#define TX_DEMO_END3 201 -#define TX_DEMO_END4 202 -#define TX_FULL_END1 203 -#define TX_FULL_END2 204 -#define TX_FULL_END3 205 -#define TX_FULL_END4 206 -#define TX_PRIVATE_OBJECTIF 207 -#define TX_PRIVATE_NBBLUPI 208 -#define TX_BUTTON_SKILL 209 -#define TX_SKILL1 210 -#define TX_SKILL2 211 -#define TX_BUTTON_DEMO 212 -#define TX_DEMOREC 213 -#define TX_DEMOPLAY 214 -#define TX_BUTTON_TERMHROBOT 215 -#define TX_PRIVATE_HACHROBOT 216 +#define TX_IONAMEEX 100 +#define TX_IOFREE 101 +#define TX_OWNMISSION 102 +#define TX_TESTMISSION 103 +#define TX_BUTTON_JOUER 104 +#define TX_BUTTON_APPRENDRE 105 +#define TX_BUTTON_QUITTER 106 +#define TX_BUTTON_PREVP 107 +#define TX_BUTTON_NEXTP 108 +#define TX_BUTTON_PLAYP 109 +#define TX_BUTTON_BUILDP 110 +#define TX_BUTTON_TERM 111 +#define TX_BUTTON_READP 112 +#define TX_BUTTON_WRITEP 113 +#define TX_BUTTON_CANCELP 114 +#define TX_BUTTON_CONTP 115 +#define TX_BUTTON_REPEAT 116 +#define TX_CHOOSEPLAYER 117 +#define TX_PLAYERSNAME 118 +#define TX_BUTTON_TERMC 119 +#define TX_CHOOSESIZE 120 +#define TX_BUTTON_HVSCROLL 121 +#define TX_BUTTON_ONLYHSCROLL 122 +#define TX_BUTTON_ONLYVSCROLL 123 +#define TX_BUTTON_TESTMISSION 124 +#define TX_PAUSE 125 +#define TX_CLEARPLAYER 127 +#define TX_SETTINGS 128 +#define TX_BUTTON_SETUP1 130 +#define TX_BUTTON_SETUP2 131 +#define TX_BUTTON_SETUP3 132 +#define TX_BUTTON_SETUP4 133 +#define TX_BUTTON_REGION 144 +#define TX_DISCARDGAME 145 +#define TX_DESIGNMISSION 147 +#define TX_CHOOSEGAMER 148 +#define TX_MUSIC 149 +#define TX_BUTTON_SETUP5 154 +#define TX_BUTTON_SETUP6 155 +#define TX_BUTTON_SETUP7 156 +#define TX_BUTTON_SETUP8 157 +#define TX_READINFO 167 +#define TX_CONFIRM 174 +#define TX_CANCEL 175 +#define TX_YES 176 +#define TX_NO 177 +#define TX_REGION 178 +#define TX_BUTTON_SETUP 180 +#define TX_INSERT 182 +#define TX_DELETEMISSION 184 +#define TX_NONAME 187 +#define TX_DESIGN 188 +#define TX_MISSIONNUM 189 +#define TX_SINGLEPLAYER 195 +#define TX_MUTLIPLAYER 196 +#define TX_GAMEPAUSE 197 +#define TX_FULL_END1 203 +#define TX_FULL_END2 204 +#define TX_FULL_END3 205 +#define TX_FULL_END4 206 +#define TX_BUTTON_SKILL 209 +#define TX_BUTTON_DEMO 212 +#define TX_DEMOREC 213 +#define TX_DEMOPLAY 214 +#define TX_SHOWNEXT 241 +#define TX_SHOWCONNECTION 242 +#define TX_SHOWNEXT 245 +#define TX_SHOWPREV 246 +#define TX_GAMEJOIN 247 +#define TX_CREATE_MULTIGAME 248 +#define TX_UPDATELIST 249 +#define TX_MULTI_CREATE 250 +#define TX_MULTI_GNAME 251 +#define TX_OPEN 264 +#define TX_LOAD_CGAME 269 +#define TX_SAVE_CGAME 270 +#define TX_GAMESAVED 288 +#define TX_NOTINDEMO 289 + #define TX_REPEAT_CULTIVE 500 #define TX_REPEAT_FLEUR 501 #define TX_REPEAT_FLEURQ 502 @@ -269,6 +230,7 @@ #define TX_LASTWIN2 3201 #define TX_LASTWIN3 3202 #define IDM_EXIT 40001 +#define TX_BUTTON_CREATE 6900 // Next default values for new objects // diff --git a/sound.cpp b/sound.cpp index e779b2d..de21406 100644 --- a/sound.cpp +++ b/sound.cpp @@ -3,11 +3,17 @@ #include #include +//#include #include "sound.h" #include "misc.h" #include "def.h" #include "resource.h" +#pragma warning (disable : 4996) +#pragma comment(lib, "dsound.lib") + +using namespace std; + ///////////////////////////////////////////////////////////////////////////// @@ -60,7 +66,7 @@ BOOL CSound::CreateSoundBuffer(int dwBuf, DWORD dwBufSize, DWORD dwFreq, DWORD d dsbdesc.dwBufferBytes = dwBufSize; dsbdesc.lpwfxFormat = (LPWAVEFORMATEX)&pcmwf; - TRY_DS(m_lpDS->CreateSoundBuffer(&dsbdesc, &m_lpDSB[dwBuf], NULL)) + TRY_DS(m_lpDS->CreateSoundBuffer(&dsbdesc, &m_lpDSB[dwBuf], NULL), 63) return TRUE; } @@ -476,23 +482,19 @@ BOOL CSound::Play(int channel, int volume, int pan) return TRUE; } -BOOL CSound::StopSound(int channel, int volume, int pan) +BOOL CSound::StopSound(Sound channel) { if (m_bEnable) return FALSE; if (m_bState || m_audioVolume == 0) return FALSE; - volume -= (MAXVOLUME - m_audioVolume) * ((10000 / 4) / MAXVOLUME); - - if (0 < channel || channel < MAXSOUND) { if (m_lpDSB[channel] == NULL) - return; + return (BOOL)m_lpDSB[channel]; + m_lpDSB[channel]->Stop(); + m_lpDSB[channel]->SetCurrentPosition(0); + return TRUE; } - m_lpDSB[channel]->SetVolume(volume); - m_lpDSB[channel]->SetPan(pan); - m_lpDSB[channel]->Play(0, 0, 0); - return FALSE; } @@ -578,8 +580,8 @@ BOOL CSound::PlayMusic(HWND hWnd, LPSTR lpszMIDIFilename) // Open the device by specifying the device and filename. // MCI will attempt to choose the MIDI mapper as the output port. - mciOpenParms.lpstrDeviceType = "sequencer"; - mciOpenParms.lpstrElementName = string; + mciOpenParms.lpstrDeviceType = (LPCWSTR)"sequencer"; + mciOpenParms.lpstrElementName = (LPCWSTR)string; dwReturn = mciSendCommand(NULL, MCI_OPEN, MCI_OPEN_TYPE|MCI_OPEN_ELEMENT, diff --git a/sound.h b/sound.h index c884fd6..2d28d5b 100644 --- a/sound.h +++ b/sound.h @@ -1,17 +1,50 @@ // sound.h // +using namespace std; + #pragma once -#include +#include +//#include +#include "dsound.h" #include +typedef enum +{ + SOUND_10_BOUM, + SOUND_11_TRESOR, + SOUND_13_ENDKO, + SOUND_14_ENDOK, + SOUND_16_HELICOHIGH, + SOUND_18_HELICOLOW, + SOUND_23_PLOUF, + SOUND_24_BLUP, + SOUND_29_JEEPHIGH, + SOUND_31_JEEPLOW, + SOUND_33_DOOR, + SOUND_42_STARTSHIELD, + SOUND_50_SUCETTE, + SOUND_51_GLU, + SOUND_57_DRINK, + SOUND_58_CHARGE, + SOUND_59_ELECTRO, + SOUND_60_PERSOTAKE, + SOUND_64_TIPLOUF, + SOUND_69_BLITZ, + SOUND_74_ANGEL, + SOUND_75_SCIE, + SOUND_76_SWITCHOFF, + SOUND_92_FOLLOW +} +Sound; /////////////////////////////////////////////////////////////////////////// #define MAXSOUND 100 #define MAXVOLUME 20 #define MAXBLUPI 100 +#define WIN32_LEAN_AND_MEAN class CSound { diff --git a/texttables.h b/texttables.h index 9e0556e..b55801b 100644 --- a/texttables.h +++ b/texttables.h @@ -131,9 +131,8 @@ extern int table_width[] 0 }; -// WindowsPhoneSpeedyBlupi.Text -// Token: 0x0400035A RID: 858 -extern int table_char[] + +extern char table_char[] { 0, 0,